From e6a4ba7a6ab2d5226912c5cd4cb7bf01f90b9f1f Mon Sep 17 00:00:00 2001 From: m3o-actions <> Date: Thu, 9 Dec 2021 14:49:22 +0000 Subject: [PATCH] Commit from m3o/m3o action --- examples/cache/README.md | 114 +++---- examples/crypto/README.md | 56 ++-- examples/currency/README.md | 54 +-- examples/db/README.md | 100 +++--- examples/db/create/createARecord/main.go | 4 +- examples/event/README.md | 66 ++-- examples/file/README.md | 116 +++---- examples/forex/README.md | 56 ++-- examples/function/README.md | 62 ++-- examples/mq/README.md | 66 ++-- examples/mq/publish/publishAMessage/main.go | 2 +- examples/notes/README.md | 118 +++---- examples/routing/README.md | 70 ++-- examples/rss/README.md | 60 ++-- examples/space/README.md | 80 ++--- examples/space/delete/deleteAnObject/main.go | 2 +- .../space/list/listObjectsWithPrefix/main.go | 2 +- examples/space/read/readAnObject/main.go | 2 +- examples/twitter/README.md | 56 ++-- examples/user/README.md | 312 +++++++++--------- space/space.go | 8 +- 21 files changed, 703 insertions(+), 703 deletions(-) diff --git a/examples/cache/README.md b/examples/cache/README.md index 44097c1..03c0009 100755 --- a/examples/cache/README.md +++ b/examples/cache/README.md @@ -4,63 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt Endpoints: -## Set - -Set an item in the cache. Overwrites any existing value already set. - - -[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Set an item in the cache. Overwrites any existing value already set. -func SetAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Set(&cache.SetRequest{ - Key: "foo", -Value: "bar", - - }) - fmt.Println(rsp, err) - -} -``` -## Get - -Get an item from the cache by key. If key is not found, an empty response is returned. - - -[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Get an item from the cache by key. If key is not found, an empty response is returned. -func GetAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Get(&cache.GetRequest{ - Key: "foo", - - }) - fmt.Println(rsp, err) - -} -``` ## Delete Delete a value from the cache. If key not found a success response is returned. @@ -147,3 +90,60 @@ Value: 2, } ``` +## Set + +Set an item in the cache. Overwrites any existing value already set. + + +[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Set an item in the cache. Overwrites any existing value already set. +func SetAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Set(&cache.SetRequest{ + Key: "foo", +Value: "bar", + + }) + fmt.Println(rsp, err) + +} +``` +## Get + +Get an item from the cache by key. If key is not found, an empty response is returned. + + +[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Get an item from the cache by key. If key is not found, an empty response is returned. +func GetAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Get(&cache.GetRequest{ + Key: "foo", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/crypto/README.md b/examples/crypto/README.md index bbef239..b836e92 100755 --- a/examples/crypto/README.md +++ b/examples/crypto/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Crypto/api](ht Endpoints: -## History - -Returns the history for the previous close - - -[https://m3o.com/crypto/api#History](https://m3o.com/crypto/api#History) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/crypto" -) - -// Returns the history for the previous close -func GetPreviousClose() { - cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cryptoService.History(&crypto.HistoryRequest{ - Symbol: "BTCUSD", - - }) - fmt.Println(rsp, err) - -} -``` ## News Get news related to a currency @@ -116,3 +88,31 @@ func GetAcryptocurrencyQuote() { } ``` +## History + +Returns the history for the previous close + + +[https://m3o.com/crypto/api#History](https://m3o.com/crypto/api#History) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/crypto" +) + +// Returns the history for the previous close +func GetPreviousClose() { + cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cryptoService.History(&crypto.HistoryRequest{ + Symbol: "BTCUSD", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/currency/README.md b/examples/currency/README.md index 529b845..65a799d 100755 --- a/examples/currency/README.md +++ b/examples/currency/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api]( Endpoints: +## Codes + +Codes returns the supported currency codes for the API + + +[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/currency" +) + +// Codes returns the supported currency codes for the API +func GetSupportedCodes() { + currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) + rsp, err := currencyService.Codes(¤cy.CodesRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Rates Rates returns the currency rates for a given code e.g USD @@ -120,30 +147,3 @@ Date: "2021-05-30", } ``` -## Codes - -Codes returns the supported currency codes for the API - - -[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/currency" -) - -// Codes returns the supported currency codes for the API -func GetSupportedCodes() { - currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) - rsp, err := currencyService.Codes(¤cy.CodesRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/db/README.md b/examples/db/README.md index 83a61af..f685923 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,40 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https: Endpoints: -## Create - -Create a record in the database. Optionally include an "id" field otherwise it's set automatically. - - -[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. -func CreateArecord() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Create(&db.CreateRequest{ - Record: map[string]interface{}{ - "name": "Jane", - "age": 42, - "isActive": true, - "id": "1", -}, -Table: "example", - - }) - fmt.Println(rsp, err) - -} -``` ## Update Update a record in the database. Include an "id" in the record to update. @@ -60,8 +26,8 @@ func UpdateArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Update(&db.UpdateRequest{ Record: map[string]interface{}{ - "id": "1", "age": 43, + "id": "1", }, Table: "example", @@ -70,12 +36,12 @@ Table: "example", } ``` -## Truncate +## Delete -Truncate the records in a table +Delete a record in the database by id. -[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate) +[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete) ```go package example @@ -87,11 +53,12 @@ import( "go.m3o.com/db" ) -// Truncate the records in a table -func TruncateTable() { +// Delete a record in the database by id. +func DeleteArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Truncate(&db.TruncateRequest{ - Table: "example", + rsp, err := dbService.Delete(&db.DeleteRequest{ + Id: "1", +Table: "example", }) fmt.Println(rsp, err) @@ -151,6 +118,40 @@ func ListTables() { }) fmt.Println(rsp, err) +} +``` +## Create + +Create a record in the database. Optionally include an "id" field otherwise it's set automatically. + + +[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. +func CreateArecord() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Create(&db.CreateRequest{ + Record: map[string]interface{}{ + "id": "1", + "name": "Jane", + "age": 42, + "isActive": true, +}, +Table: "example", + + }) + fmt.Println(rsp, err) + } ``` ## Read @@ -182,12 +183,12 @@ Table: "example", } ``` -## Delete +## Truncate -Delete a record in the database by id. +Truncate the records in a table -[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete) +[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate) ```go package example @@ -199,12 +200,11 @@ import( "go.m3o.com/db" ) -// Delete a record in the database by id. -func DeleteArecord() { +// Truncate the records in a table +func TruncateTable() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Delete(&db.DeleteRequest{ - Id: "1", -Table: "example", + rsp, err := dbService.Truncate(&db.TruncateRequest{ + Table: "example", }) fmt.Println(rsp, err) diff --git a/examples/db/create/createARecord/main.go b/examples/db/create/createARecord/main.go index 134e687..3b0247c 100755 --- a/examples/db/create/createARecord/main.go +++ b/examples/db/create/createARecord/main.go @@ -12,10 +12,10 @@ func main() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Create(&db.CreateRequest{ Record: map[string]interface{}{ - "age": 42, - "isActive": true, "id": "1", "name": "Jane", + "age": 42, + "isActive": true, }, Table: "example", }) diff --git a/examples/event/README.md b/examples/event/README.md index cb93c29..346f40c 100755 --- a/examples/event/README.md +++ b/examples/event/README.md @@ -4,39 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Event/api](htt Endpoints: -## Publish - -Publish a event to the event stream. - - -[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/event" -) - -// Publish a event to the event stream. -func PublishAnEvent() { - eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) - rsp, err := eventService.Publish(&event.PublishRequest{ - Message: map[string]interface{}{ - "user": "john", - "id": "1", - "type": "signup", -}, -Topic: "user", - - }) - fmt.Println(rsp, err) - -} -``` ## Consume Consume events from a given topic. @@ -106,3 +73,36 @@ func ReadEventsOnAtopic() { } ``` +## Publish + +Publish a event to the event stream. + + +[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/event" +) + +// Publish a event to the event stream. +func PublishAnEvent() { + eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) + rsp, err := eventService.Publish(&event.PublishRequest{ + Message: map[string]interface{}{ + "id": "1", + "type": "signup", + "user": "john", +}, +Topic: "user", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/file/README.md b/examples/file/README.md index 6b3ff5e..f07c5f3 100755 --- a/examples/file/README.md +++ b/examples/file/README.md @@ -4,6 +4,64 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](http Endpoints: +## Delete + +Delete a file by project name/path + + +[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/file" +) + +// Delete a file by project name/path +func DeleteFile() { + fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) + rsp, err := fileService.Delete(&file.DeleteRequest{ + Path: "/document/text-files/file.txt", +Project: "examples", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read a file by path + + +[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/file" +) + +// Read a file by path +func ReadFile() { + fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) + rsp, err := fileService.Read(&file.ReadRequest{ + Path: "/document/text-files/file.txt", +Project: "examples", + + }) + fmt.Println(rsp, err) + +} +``` ## Save Save a file @@ -64,61 +122,3 @@ func ListFiles() { } ``` -## Delete - -Delete a file by project name/path - - -[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/file" -) - -// Delete a file by project name/path -func DeleteFile() { - fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) - rsp, err := fileService.Delete(&file.DeleteRequest{ - Path: "/document/text-files/file.txt", -Project: "examples", - - }) - fmt.Println(rsp, err) - -} -``` -## Read - -Read a file by path - - -[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/file" -) - -// Read a file by path -func ReadFile() { - fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) - rsp, err := fileService.Read(&file.ReadRequest{ - Path: "/document/text-files/file.txt", -Project: "examples", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/forex/README.md b/examples/forex/README.md index 076f73a..0a103c1 100755 --- a/examples/forex/README.md +++ b/examples/forex/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](htt Endpoints: -## Price - -Get the latest price for a given forex ticker - - -[https://m3o.com/forex/api#Price](https://m3o.com/forex/api#Price) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/forex" -) - -// Get the latest price for a given forex ticker -func GetAnFxPrice() { - forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN")) - rsp, err := forexService.Price(&forex.PriceRequest{ - Symbol: "GBPUSD", - - }) - fmt.Println(rsp, err) - -} -``` ## Quote Get the latest quote for the forex @@ -88,3 +60,31 @@ func GetPreviousClose() { } ``` +## Price + +Get the latest price for a given forex ticker + + +[https://m3o.com/forex/api#Price](https://m3o.com/forex/api#Price) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/forex" +) + +// Get the latest price for a given forex ticker +func GetAnFxPrice() { + forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN")) + rsp, err := forexService.Price(&forex.PriceRequest{ + Symbol: "GBPUSD", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/function/README.md b/examples/function/README.md index 7381915..c2c5bf5 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -4,6 +4,37 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api]( Endpoints: +## Deploy + +Deploy a group of functions + + +[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Deploy a group of functions +func DeployAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Deploy(&function.DeployRequest{ + Entrypoint: "helloworld", +Name: "helloworld", +Repo: "github.com/m3o/nodejs-function-example", +Runtime: "nodejs14", + + }) + fmt.Println(rsp, err) + +} +``` ## Call Call a function by name @@ -117,34 +148,3 @@ func DescribeFunctionStatus() { } ``` -## Deploy - -Deploy a group of functions - - -[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Deploy a group of functions -func DeployAfunction() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Deploy(&function.DeployRequest{ - Entrypoint: "helloworld", -Name: "helloworld", -Repo: "github.com/m3o/nodejs-function-example", -Runtime: "nodejs14", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/mq/README.md b/examples/mq/README.md index e9efd8f..c905321 100755 --- a/examples/mq/README.md +++ b/examples/mq/README.md @@ -4,39 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Mq/api](https: Endpoints: -## Publish - -Publish a message. Specify a topic to group messages for a specific topic. - - -[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/mq" -) - -// Publish a message. Specify a topic to group messages for a specific topic. -func PublishAmessage() { - mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) - rsp, err := mqService.Publish(&mq.PublishRequest{ - Message: map[string]interface{}{ - "user": "john", - "id": "1", - "type": "signup", -}, -Topic: "events", - - }) - fmt.Println(rsp, err) - -} -``` ## Subscribe Subscribe to messages for a given topic. @@ -78,3 +45,36 @@ func SubscribeToAtopic() { } } ``` +## Publish + +Publish a message. Specify a topic to group messages for a specific topic. + + +[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/mq" +) + +// Publish a message. Specify a topic to group messages for a specific topic. +func PublishAmessage() { + mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) + rsp, err := mqService.Publish(&mq.PublishRequest{ + Message: map[string]interface{}{ + "user": "john", + "id": "1", + "type": "signup", +}, +Topic: "events", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/mq/publish/publishAMessage/main.go b/examples/mq/publish/publishAMessage/main.go index d5d14f2..ebf73a2 100755 --- a/examples/mq/publish/publishAMessage/main.go +++ b/examples/mq/publish/publishAMessage/main.go @@ -12,9 +12,9 @@ func main() { mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) rsp, err := mqService.Publish(&mq.PublishRequest{ Message: map[string]interface{}{ + "user": "john", "id": "1", "type": "signup", - "user": "john", }, Topic: "events", }) diff --git a/examples/notes/README.md b/examples/notes/README.md index 04d20a1..9407f43 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,6 +4,65 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt Endpoints: +## List + +List all the notes + + +[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// List all the notes +func ListAllNotes() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.List(¬es.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## Update + +Update a note + + +[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Update a note +func UpdateAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Update(¬es.UpdateRequest{ + Note: ¬es.Note{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + Text: "Updated note text", + Title: "Update Note", + }, + + }) + fmt.Println(rsp, err) + +} +``` ## Delete Delete a note @@ -130,62 +189,3 @@ func ReadAnote() { } ``` -## List - -List all the notes - - -[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// List all the notes -func ListAllNotes() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.List(¬es.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## Update - -Update a note - - -[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Update a note -func UpdateAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Update(¬es.UpdateRequest{ - Note: ¬es.Note{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - Text: "Updated note text", - Title: "Update Note", - }, - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/routing/README.md b/examples/routing/README.md index c409916..bd394b1 100755 --- a/examples/routing/README.md +++ b/examples/routing/README.md @@ -4,6 +4,41 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Routing/api](h Endpoints: +## Eta + +Get the eta for a route from origin to destination. The eta is an estimated time based on car routes + + +[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/routing" +) + +// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes +func EtaFromPointAtoPointB() { + routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN")) + rsp, err := routingService.Eta(&routing.EtaRequest{ + Destination: &routing.Point{ + Latitude: 52.529407, + Longitude: 13.397634, +}, +Origin: &routing.Point{ + Latitude: 52.517037, + Longitude: 13.38886, +}, + + }) + fmt.Println(rsp, err) + +} +``` ## Directions Turn by turn directions from a start point to an end point including maneuvers and bearings @@ -74,38 +109,3 @@ Origin: &routing.Point{ } ``` -## Eta - -Get the eta for a route from origin to destination. The eta is an estimated time based on car routes - - -[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/routing" -) - -// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes -func EtaFromPointAtoPointB() { - routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN")) - rsp, err := routingService.Eta(&routing.EtaRequest{ - Destination: &routing.Point{ - Latitude: 52.529407, - Longitude: 13.397634, -}, -Origin: &routing.Point{ - Latitude: 52.517037, - Longitude: 13.38886, -}, - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/rss/README.md b/examples/rss/README.md index 62d0224..023a099 100755 --- a/examples/rss/README.md +++ b/examples/rss/README.md @@ -4,36 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Rss/api](https Endpoints: -## Add - -Add a new RSS feed with a name, url, and category - - -[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/rss" -) - -// Add a new RSS feed with a name, url, and category -func AddAnewFeed() { - rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) - rsp, err := rssService.Add(&rss.AddRequest{ - Category: "news", -Name: "bbc", -Url: "http://feeds.bbci.co.uk/news/rss.xml", - - }) - fmt.Println(rsp, err) - -} -``` ## Feed Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries. @@ -117,3 +87,33 @@ func RemoveAfeed() { } ``` +## Add + +Add a new RSS feed with a name, url, and category + + +[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/rss" +) + +// Add a new RSS feed with a name, url, and category +func AddAnewFeed() { + rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) + rsp, err := rssService.Add(&rss.AddRequest{ + Category: "news", +Name: "bbc", +Url: "http://feeds.bbci.co.uk/news/rss.xml", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/space/README.md b/examples/space/README.md index 19fb39b..7596f64 100755 --- a/examples/space/README.md +++ b/examples/space/README.md @@ -4,43 +4,9 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Space/api](htt Endpoints: -## Update - -Update an object. If an object with this name does not exist, creates a new one. -You need to send the request as a multipart/form-data rather than the usual application/json -with each parameter as a form field. - - -[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// Update an object. If an object with this name does not exist, creates a new one. -// You need to send the request as a multipart/form-data rather than the usual application/json -// with each parameter as a form field. -func UpdateAnObject() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.Update(&space.UpdateRequest{ - Name: "images/file.jpg", -Object: "", -Visibility: "public", - - }) - fmt.Println(rsp, err) - -} -``` ## Delete -Delete an object +Delete an object from space [https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete) @@ -55,7 +21,7 @@ import( "go.m3o.com/space" ) -// Delete an object +// Delete an object from space func DeleteAnObject() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.Delete(&space.DeleteRequest{ @@ -68,7 +34,7 @@ func DeleteAnObject() { ``` ## List -List the objects in the space +List the objects in space [https://m3o.com/space/api#List](https://m3o.com/space/api#List) @@ -83,7 +49,7 @@ import( "go.m3o.com/space" ) -// List the objects in the space +// List the objects in space func ListObjectsWithPrefix() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.List(&space.ListRequest{ @@ -124,7 +90,7 @@ func HeadAnObject() { ``` ## Read -Read an object in storage. Use for private objects. +Read an object in space. Use for private objects. [https://m3o.com/space/api#Read](https://m3o.com/space/api#Read) @@ -139,7 +105,7 @@ import( "go.m3o.com/space" ) -// Read an object in storage. Use for private objects. +// Read an object in space. Use for private objects. func ReadAnObject() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.Read(&space.ReadRequest{ @@ -184,3 +150,37 @@ Visibility: "public", } ``` +## Update + +Update an object. If an object with this name does not exist, creates a new one. +You need to send the request as a multipart/form-data rather than the usual application/json +with each parameter as a form field. + + +[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// Update an object. If an object with this name does not exist, creates a new one. +// You need to send the request as a multipart/form-data rather than the usual application/json +// with each parameter as a form field. +func UpdateAnObject() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.Update(&space.UpdateRequest{ + Name: "images/file.jpg", +Object: "", +Visibility: "public", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/space/delete/deleteAnObject/main.go b/examples/space/delete/deleteAnObject/main.go index 94f5d3a..5782b33 100755 --- a/examples/space/delete/deleteAnObject/main.go +++ b/examples/space/delete/deleteAnObject/main.go @@ -7,7 +7,7 @@ import ( "go.m3o.com/space" ) -// Delete an object +// Delete an object from space func main() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.Delete(&space.DeleteRequest{ diff --git a/examples/space/list/listObjectsWithPrefix/main.go b/examples/space/list/listObjectsWithPrefix/main.go index 84bea3a..9495439 100755 --- a/examples/space/list/listObjectsWithPrefix/main.go +++ b/examples/space/list/listObjectsWithPrefix/main.go @@ -7,7 +7,7 @@ import ( "go.m3o.com/space" ) -// List the objects in the space +// List the objects in space func main() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.List(&space.ListRequest{ diff --git a/examples/space/read/readAnObject/main.go b/examples/space/read/readAnObject/main.go index a34c963..621a96a 100755 --- a/examples/space/read/readAnObject/main.go +++ b/examples/space/read/readAnObject/main.go @@ -7,7 +7,7 @@ import ( "go.m3o.com/space" ) -// Read an object in storage. Use for private objects. +// Read an object in space. Use for private objects. func main() { spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) rsp, err := spaceService.Read(&space.ReadRequest{ diff --git a/examples/twitter/README.md b/examples/twitter/README.md index e099911..fd92920 100755 --- a/examples/twitter/README.md +++ b/examples/twitter/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Twitter/api](h Endpoints: +## User + +Get a user's twitter profile + + +[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/twitter" +) + +// Get a user's twitter profile +func GetAusersTwitterProfile() { + twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) + rsp, err := twitterService.User(&twitter.UserRequest{ + Username: "crufter", + + }) + fmt.Println(rsp, err) + +} +``` ## Timeline Get the timeline for a given user @@ -88,31 +116,3 @@ func GetTheCurrentGlobalTrendingTopics() { } ``` -## User - -Get a user's twitter profile - - -[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/twitter" -) - -// Get a user's twitter profile -func GetAusersTwitterProfile() { - twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) - rsp, err := twitterService.User(&twitter.UserRequest{ - Username: "crufter", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/user/README.md b/examples/user/README.md index 7270058..fa6fa3c 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http Endpoints: -## List - -List all users. Returns a paged list of results - - -[https://m3o.com/user/api#List](https://m3o.com/user/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// List all users. Returns a paged list of results -func ListAllUsers() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.List(&user.ListRequest{ - Limit: 100, -Offset: 0, - - }) - fmt.Println(rsp, err) - -} -``` ## Create Create a new user account. The email address and username for the account must be unique. @@ -176,6 +147,126 @@ func ReadAccountByEmail() { }) fmt.Println(rsp, err) +} +``` +## SendPasswordResetEmail + +Send an email with a verification code to reset password. +Call "ResetPassword" endpoint once user provides the code. + + +[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Send an email with a verification code to reset password. +// Call "ResetPassword" endpoint once user provides the code. +func SendPasswordResetEmail() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{ + Email: "joe@example.com", +FromName: "Awesome Dot Com", +Subject: "Password reset", +TextContent: `Hi there, + click here to reset your password: myapp.com/reset/code?=$code`, + + }) + fmt.Println(rsp, err) + +} +``` +## Delete + +Delete an account by id + + +[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Delete an account by id +func DeleteUserAccount() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Delete(&user.DeleteRequest{ + Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f", + + }) + fmt.Println(rsp, err) + +} +``` +## List + +List all users. Returns a paged list of results + + +[https://m3o.com/user/api#List](https://m3o.com/user/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// List all users. Returns a paged list of results +func ListAllUsers() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.List(&user.ListRequest{ + Limit: 100, +Offset: 0, + + }) + fmt.Println(rsp, err) + +} +``` +## Update + +Update the account username or email + + +[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Update the account username or email +func UpdateAnAccount() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Update(&user.UpdateRequest{ + Email: "joe+2@example.com", +Id: "user-1", + + }) + fmt.Println(rsp, err) + } ``` ## SendVerificationEmail @@ -223,126 +314,6 @@ Please verify your email by clicking this link: $micro_verification_link`, }) fmt.Println(rsp, err) -} -``` -## VerifyEmail - -Verify the email address of an account from a token sent in an email to the user. - - -[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Verify the email address of an account from a token sent in an email to the user. -func VerifyEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{ - Email: "joe@example.com", -Token: "012345", - - }) - fmt.Println(rsp, err) - -} -``` -## ReadSession - -Read a session by the session id. In the event it has expired or is not found and error is returned. - - -[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Read a session by the session id. In the event it has expired or is not found and error is returned. -func ReadAsessionByTheSessionId() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.ReadSession(&user.ReadSessionRequest{ - SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", - - }) - fmt.Println(rsp, err) - -} -``` -## Update - -Update the account username or email - - -[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Update the account username or email -func UpdateAnAccount() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Update(&user.UpdateRequest{ - Email: "joe+2@example.com", -Id: "user-1", - - }) - fmt.Println(rsp, err) - -} -``` -## SendPasswordResetEmail - -Send an email with a verification code to reset password. -Call "ResetPassword" endpoint once user provides the code. - - -[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Send an email with a verification code to reset password. -// Call "ResetPassword" endpoint once user provides the code. -func SendPasswordResetEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{ - Email: "joe@example.com", -FromName: "Awesome Dot Com", -Subject: "Password reset", -TextContent: `Hi there, - click here to reset your password: myapp.com/reset/code?=$code`, - - }) - fmt.Println(rsp, err) - } ``` ## ResetPassword @@ -376,12 +347,12 @@ NewPassword: "NewPassword1", } ``` -## Delete +## VerifyEmail -Delete an account by id +Verify the email address of an account from a token sent in an email to the user. -[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete) +[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail) ```go package example @@ -393,11 +364,12 @@ import( "go.m3o.com/user" ) -// Delete an account by id -func DeleteUserAccount() { +// Verify the email address of an account from a token sent in an email to the user. +func VerifyEmail() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Delete(&user.DeleteRequest{ - Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f", + rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{ + Email: "joe@example.com", +Token: "012345", }) fmt.Println(rsp, err) @@ -463,3 +435,31 @@ func LogAuserOut() { } ``` +## ReadSession + +Read a session by the session id. In the event it has expired or is not found and error is returned. + + +[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Read a session by the session id. In the event it has expired or is not found and error is returned. +func ReadAsessionByTheSessionId() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.ReadSession(&user.ReadSessionRequest{ + SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/space/space.go b/space/space.go index 5a753a0..fdfd664 100755 --- a/space/space.go +++ b/space/space.go @@ -26,7 +26,7 @@ func (t *SpaceService) Create(request *CreateRequest) (*CreateResponse, error) { } -// Delete an object +// Delete an object from space func (t *SpaceService) Delete(request *DeleteRequest) (*DeleteResponse, error) { rsp := &DeleteResponse{} @@ -42,7 +42,7 @@ func (t *SpaceService) Head(request *HeadRequest) (*HeadResponse, error) { } -// List the objects in the space +// List the objects in space func (t *SpaceService) List(request *ListRequest) (*ListResponse, error) { rsp := &ListResponse{} @@ -50,7 +50,7 @@ func (t *SpaceService) List(request *ListRequest) (*ListResponse, error) { } -// Read an object in storage. Use for private objects. +// Read an object in space. Use for private objects. func (t *SpaceService) Read(request *ReadRequest) (*ReadResponse, error) { rsp := &ReadResponse{} @@ -133,7 +133,7 @@ type ReadRequest struct { } type ReadResponse struct { - // Returns the response as raw data + // Returns the object as raw data Object string `json:"object"` }