From 1373d7afea03bfcf6ddc2599ed5ee15011fb083d Mon Sep 17 00:00:00 2001 From: m3o-actions <> Date: Wed, 9 Mar 2022 07:41:47 +0000 Subject: [PATCH] Commit from m3o/m3o action --- examples/app/README.md | 112 +-- examples/cache/README.md | 56 +- examples/chat/README.md | 126 +-- examples/contact/README.md | 202 ++--- examples/currency/README.md | 54 +- examples/db/README.md | 200 ++--- examples/email/README.md | 56 +- examples/emoji/README.md | 60 +- examples/event/README.md | 66 +- examples/event/publish/publishAnEvent/main.go | 2 +- examples/file/README.md | 116 +-- examples/function/README.md | 290 +++---- examples/lists/README.md | 54 +- examples/location/README.md | 72 +- examples/memegen/README.md | 54 +- examples/mq/README.md | 66 +- examples/nft/README.md | 114 +-- examples/notes/README.md | 168 ++-- examples/ping/README.md | 56 +- examples/search/README.md | 58 +- examples/space/README.md | 112 +-- examples/stream/README.md | 54 +- examples/sunnah/README.md | 60 +- examples/twitter/README.md | 56 +- examples/url/README.md | 54 +- examples/user/README.md | 730 +++++++++--------- examples/weather/README.md | 56 +- 27 files changed, 1552 insertions(+), 1552 deletions(-) diff --git a/examples/app/README.md b/examples/app/README.md index 3692e03..adff04f 100755 --- a/examples/app/README.md +++ b/examples/app/README.md @@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https Endpoints: +## Resolve + +Resolve an app by id to its raw backend endpoint + + +[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/app" +) + +// Resolve an app by id to its raw backend endpoint +func ResolveAppById() { + appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) + rsp, err := appService.Resolve(&app.ResolveRequest{ + Id: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## Update + +Update the app. The latest source code will be downloaded, built and deployed. + + +[https://m3o.com/app/api#Update](https://m3o.com/app/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/app" +) + +// Update the app. The latest source code will be downloaded, built and deployed. +func UpdateAnApp() { + appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) + rsp, err := appService.Update(&app.UpdateRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` ## Delete Delete an app @@ -174,59 +230,3 @@ func GetTheStatusOfAnApp() { } ``` -## Resolve - -Resolve an app by id to its raw backend endpoint - - -[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/app" -) - -// Resolve an app by id to its raw backend endpoint -func ResolveAppById() { - appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) - rsp, err := appService.Resolve(&app.ResolveRequest{ - Id: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` -## Update - -Update the app. The latest source code will be downloaded, built and deployed. - - -[https://m3o.com/app/api#Update](https://m3o.com/app/api#Update) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/app" -) - -// Update the app. The latest source code will be downloaded, built and deployed. -func UpdateAnApp() { - appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) - rsp, err := appService.Update(&app.UpdateRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/cache/README.md b/examples/cache/README.md index be90aff..575e286 100755 --- a/examples/cache/README.md +++ b/examples/cache/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](htt Endpoints: +## Delete + +Delete a value from the cache. If key not found a success response is returned. + + +[https://m3o.com/cache/api#Delete](https://m3o.com/cache/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Delete a value from the cache. If key not found a success response is returned. +func DeleteAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Delete(&cache.DeleteRequest{ + Key: "foo", + + }) + fmt.Println(rsp, err) + +} +``` ## Increment Increment a value (if it's a number). If key not found it is equivalent to set. @@ -146,31 +174,3 @@ func GetAvalue() { } ``` -## Delete - -Delete a value from the cache. If key not found a success response is returned. - - -[https://m3o.com/cache/api#Delete](https://m3o.com/cache/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Delete a value from the cache. If key not found a success response is returned. -func DeleteAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Delete(&cache.DeleteRequest{ - Key: "foo", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/chat/README.md b/examples/chat/README.md index 5e61279..f06a4e1 100755 --- a/examples/chat/README.md +++ b/examples/chat/README.md @@ -4,6 +4,60 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http Endpoints: +## List + +List available chats + + +[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/chat" +) + +// List available chats +func ListChatRooms() { + chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) + rsp, err := chatService.List(&chat.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## History + +List the messages in a chat + + +[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/chat" +) + +// List the messages in a chat +func GetChatHistory() { + chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) + rsp, err := chatService.History(&chat.HistoryRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Join Join a chat room @@ -44,12 +98,12 @@ func JoinAroom() { } } ``` -## List +## Create -List available chats +Create a new chat room -[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List) +[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create) ```go package example @@ -61,11 +115,13 @@ import( "go.m3o.com/chat" ) -// List available chats -func ListChatRooms() { +// Create a new chat room +func CreateAnewChat() { chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) - rsp, err := chatService.List(&chat.ListRequest{ - + rsp, err := chatService.Create(&chat.CreateRequest{ + Description: "The general chat room", +Name: "general", + }) fmt.Println(rsp, err) @@ -128,33 +184,6 @@ Text: "Hey whats up?", }) fmt.Println(rsp, err) -} -``` -## History - -List the messages in a chat - - -[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/chat" -) - -// List the messages in a chat -func GetChatHistory() { - chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) - rsp, err := chatService.History(&chat.HistoryRequest{ - - }) - fmt.Println(rsp, err) - } ``` ## Kick @@ -209,35 +238,6 @@ func LeaveAroom() { }) fmt.Println(rsp, err) -} -``` -## Create - -Create a new chat room - - -[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/chat" -) - -// Create a new chat room -func CreateAnewChat() { - chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) - rsp, err := chatService.Create(&chat.CreateRequest{ - Description: "The general chat room", -Name: "general", - - }) - fmt.Println(rsp, err) - } ``` ## Delete diff --git a/examples/contact/README.md b/examples/contact/README.md index e2e01cc..64726ed 100755 --- a/examples/contact/README.md +++ b/examples/contact/README.md @@ -4,107 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h Endpoints: -## Create - -Create a contact - - -[https://m3o.com/contact/api#Create](https://m3o.com/contact/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// Create a contact -func CreateAcontact() { - contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) - rsp, err := contactService.Create(&contact.CreateRequest{ - Addresses: []contact.Address{ -contact.Address{ - Label: "company address", - Location: "123 street address", -}}, -Birthday: "1995-01-01", -Emails: []contact.Email{ -contact.Email{ - Address: "home@example.com", - Label: "home", -}}, -Links: []contact.Link{ -contact.Link{ - Label: "blog", - Url: "https://blog.joe.me", -}}, -Name: "joe", -Note: "this person is very important", -Phones: []contact.Phone{ -contact.Phone{ - Label: "home", - Number: "010-12345678", -}}, - - }) - fmt.Println(rsp, err) - -} -``` -## Update - -Update a contact - - -[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// Update a contact -func UpdateAcontact() { - contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) - rsp, err := contactService.Update(&contact.UpdateRequest{ - Addresses: []contact.Address{ -contact.Address{ - Label: "company address", - Location: "123 street address", -}}, -Birthday: "1995-01-01", -Emails: []contact.Email{ -contact.Email{ - Address: "home@example.com", - Label: "home", -}}, -Id: "42e48a3c-6221-11ec-96d2-acde48001122", -Links: []contact.Link{ -contact.Link{ - Label: "blog", - Url: "https://blog.joe.me", -}}, -Name: "joe", -Note: "this person is very important", -Phones: []contact.Phone{ -contact.Phone{ - Label: "home", - Number: "010-12345678", -}}, - - }) - fmt.Println(rsp, err) - -} -``` ## Read Read contact details @@ -217,3 +116,104 @@ Offset: 1, } ``` +## Create + +Create a contact + + +[https://m3o.com/contact/api#Create](https://m3o.com/contact/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// Create a contact +func CreateAcontact() { + contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) + rsp, err := contactService.Create(&contact.CreateRequest{ + Addresses: []contact.Address{ +contact.Address{ + Label: "company address", + Location: "123 street address", +}}, +Birthday: "1995-01-01", +Emails: []contact.Email{ +contact.Email{ + Address: "home@example.com", + Label: "home", +}}, +Links: []contact.Link{ +contact.Link{ + Label: "blog", + Url: "https://blog.joe.me", +}}, +Name: "joe", +Note: "this person is very important", +Phones: []contact.Phone{ +contact.Phone{ + Label: "home", + Number: "010-12345678", +}}, + + }) + fmt.Println(rsp, err) + +} +``` +## Update + +Update a contact + + +[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// Update a contact +func UpdateAcontact() { + contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) + rsp, err := contactService.Update(&contact.UpdateRequest{ + Addresses: []contact.Address{ +contact.Address{ + Label: "company address", + Location: "123 street address", +}}, +Birthday: "1995-01-01", +Emails: []contact.Email{ +contact.Email{ + Address: "home@example.com", + Label: "home", +}}, +Id: "42e48a3c-6221-11ec-96d2-acde48001122", +Links: []contact.Link{ +contact.Link{ + Label: "blog", + Url: "https://blog.joe.me", +}}, +Name: "joe", +Note: "this person is very important", +Phones: []contact.Phone{ +contact.Phone{ + Label: "home", + Number: "010-12345678", +}}, + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/currency/README.md b/examples/currency/README.md index 333170f..f788d89 100755 --- a/examples/currency/README.md +++ b/examples/currency/README.md @@ -4,33 +4,6 @@ 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 @@ -147,3 +120,30 @@ 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 b59cd1c..0959e8e 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https: Endpoints: -## Update +## RenameTable -Update a record in the database. Include an "id" in the record to update. +Rename a table -[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update) +[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable) ```go package example @@ -21,13 +21,44 @@ import( "go.m3o.com/db" ) -// Update a record in the database. Include an "id" in the record to update. -func UpdateArecord() { +// Rename a table +func RenameTable() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Update(&db.UpdateRequest{ + rsp, err := dbService.RenameTable(&db.RenameTableRequest{ + From: "examples2", +To: "examples3", + + }) + 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{}{ + "name": "Jane", + "age": 42, + "isActive": true, "id": "1", - "age": 43, }, Table: "example", @@ -63,6 +94,34 @@ Table: "example", }) fmt.Println(rsp, err) +} +``` +## Truncate + +Truncate the records in a table + + +[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Truncate the records in a table +func TruncateTable() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Truncate(&db.TruncateRequest{ + Table: "example", + + }) + fmt.Println(rsp, err) + } ``` ## Count @@ -93,12 +152,12 @@ func CountEntriesInAtable() { } ``` -## Create +## ListTables -Create a record in the database. Optionally include an "id" field otherwise it's set automatically. +List tables in the DB -[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) +[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables) ```go package example @@ -110,15 +169,40 @@ import( "go.m3o.com/db" ) -// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. -func CreateArecord() { +// List tables in the DB +func ListTables() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Create(&db.CreateRequest{ + rsp, err := dbService.ListTables(&db.ListTablesRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## Update + +Update a record in the database. Include an "id" in the record to update. + + +[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Update a record in the database. Include an "id" in the record to update. +func UpdateArecord() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Update(&db.UpdateRequest{ Record: map[string]interface{}{ - "age": 42, - "isActive": true, "id": "1", - "name": "Jane", + "age": 43, }, Table: "example", @@ -154,34 +238,6 @@ Table: "example", }) fmt.Println(rsp, err) -} -``` -## Truncate - -Truncate the records in a table - - -[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Truncate the records in a table -func TruncateTable() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Truncate(&db.TruncateRequest{ - Table: "example", - - }) - fmt.Println(rsp, err) - } ``` ## DropTable @@ -212,59 +268,3 @@ func DropTable() { } ``` -## ListTables - -List tables in the DB - - -[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// List tables in the DB -func ListTables() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.ListTables(&db.ListTablesRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## RenameTable - -Rename a table - - -[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Rename a table -func RenameTable() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.RenameTable(&db.RenameTableRequest{ - From: "examples2", -To: "examples3", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/email/README.md b/examples/email/README.md index 8e6afcf..b04ca45 100755 --- a/examples/email/README.md +++ b/examples/email/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/email/api](htt Endpoints: +## Validate + +Validate an email address format + + +[https://m3o.com/email/api#Validate](https://m3o.com/email/api#Validate) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/email" +) + +// Validate an email address format +func ValidateEmail() { + emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN")) + rsp, err := emailService.Validate(&email.ValidateRequest{ + Address: "joe@example.com", + + }) + fmt.Println(rsp, err) + +} +``` ## Send Send an email by passing in from, to, subject, and a text or html body @@ -64,31 +92,3 @@ func ParseEmail() { } ``` -## Validate - -Validate an email address format - - -[https://m3o.com/email/api#Validate](https://m3o.com/email/api#Validate) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/email" -) - -// Validate an email address format -func ValidateEmail() { - emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN")) - rsp, err := emailService.Validate(&email.ValidateRequest{ - Address: "joe@example.com", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/emoji/README.md b/examples/emoji/README.md index e461cd8..dc735fb 100755 --- a/examples/emoji/README.md +++ b/examples/emoji/README.md @@ -4,36 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/emoji/api](htt Endpoints: -## Print - -Print text and renders the emojis with aliases e.g -let's grab a :beer: becomes let's grab a 🍺 - - -[https://m3o.com/emoji/api#Print](https://m3o.com/emoji/api#Print) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/emoji" -) - -// Print text and renders the emojis with aliases e.g -// let's grab a :beer: becomes let's grab a 🍺 -func PrintTextIncludingEmoji() { - emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) - rsp, err := emojiService.Print(&emoji.PrintRequest{ - Text: "let's grab a :beer:", - - }) - fmt.Println(rsp, err) - -} -``` ## Find Find an emoji by its alias e.g :beer: @@ -89,3 +59,33 @@ func GetFlagByCountryCode() { } ``` +## Print + +Print text and renders the emojis with aliases e.g +let's grab a :beer: becomes let's grab a 🍺 + + +[https://m3o.com/emoji/api#Print](https://m3o.com/emoji/api#Print) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/emoji" +) + +// Print text and renders the emojis with aliases e.g +// let's grab a :beer: becomes let's grab a 🍺 +func PrintTextIncludingEmoji() { + emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) + rsp, err := emojiService.Print(&emoji.PrintRequest{ + Text: "let's grab a :beer:", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/event/README.md b/examples/event/README.md index 300dc67..fc81ead 100755 --- a/examples/event/README.md +++ b/examples/event/README.md @@ -4,6 +4,39 @@ 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{}{ + "type": "signup", + "user": "john", + "id": "1", +}, +Topic: "user", + + }) + fmt.Println(rsp, err) + +} +``` ## Consume Consume events from a given topic. @@ -73,36 +106,3 @@ 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/event/publish/publishAnEvent/main.go b/examples/event/publish/publishAnEvent/main.go index eb4cfd3..287af64 100755 --- a/examples/event/publish/publishAnEvent/main.go +++ b/examples/event/publish/publishAnEvent/main.go @@ -12,9 +12,9 @@ func main() { eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) rsp, err := eventService.Publish(&event.PublishRequest{ Message: map[string]interface{}{ - "user": "john", "id": "1", "type": "signup", + "user": "john", }, Topic: "user", }) diff --git a/examples/file/README.md b/examples/file/README.md index bd236f7..40962ee 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: +## 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) + +} +``` +## 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) + +} +``` ## Save Save a file @@ -64,61 +122,3 @@ func ListFiles() { } ``` -## 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) - -} -``` -## 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) - -} -``` diff --git a/examples/function/README.md b/examples/function/README.md index f472580..ca58d12 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -4,95 +4,6 @@ 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{ - Branch: "main", -Entrypoint: "Helloworld", -Name: "helloworld", -Region: "europe-west1", -Repo: "https://github.com/m3o/m3o", -Runtime: "go116", -Subfolder: "examples/go-function", - - }) - fmt.Println(rsp, err) - -} -``` -## List - -List all the deployed functions - - -[https://m3o.com/function/api#List](https://m3o.com/function/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// List all the deployed functions -func ListFunctions() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.List(&function.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## Describe - -Get the info for a deployed function - - -[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Get the info for a deployed function -func DescribeFunctionStatus() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Describe(&function.DescribeRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` ## Regions Return a list of supported regions @@ -173,6 +84,151 @@ func ProxyUrl() { }) fmt.Println(rsp, err) +} +``` +## List + +List all the deployed functions + + +[https://m3o.com/function/api#List](https://m3o.com/function/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// List all the deployed functions +func ListFunctions() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.List(&function.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## Delete + +Delete a function by name + + +[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Delete a function by name +func DeleteAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Delete(&function.DeleteRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## Describe + +Get the info for a deployed function + + +[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Get the info for a deployed function +func DescribeFunctionStatus() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Describe(&function.DescribeRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## Reserve + +Reserve function names and resources beyond free quota + + +[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Reserve function names and resources beyond free quota +func ReserveAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Reserve(&function.ReserveRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## 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{ + Branch: "main", +Entrypoint: "Helloworld", +Name: "helloworld", +Region: "europe-west1", +Repo: "https://github.com/m3o/m3o", +Runtime: "go116", +Subfolder: "examples/go-function", + + }) + fmt.Println(rsp, err) + } ``` ## Update @@ -234,59 +290,3 @@ Request: map[string]interface{}{ } ``` -## Delete - -Delete a function by name - - -[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Delete a function by name -func DeleteAfunction() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Delete(&function.DeleteRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` -## Reserve - -Reserve function names and resources beyond free quota - - -[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Reserve function names and resources beyond free quota -func ReserveAfunction() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Reserve(&function.ReserveRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/lists/README.md b/examples/lists/README.md index eefdd95..7fe9884 100755 --- a/examples/lists/README.md +++ b/examples/lists/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/lists/api](htt Endpoints: +## Create + +Create a new list + + +[https://m3o.com/lists/api#Create](https://m3o.com/lists/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/lists" +) + +// Create a new list +func CreateAlist() { + listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN")) + rsp, err := listsService.Create(&lists.CreateRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Read Read a list @@ -158,30 +185,3 @@ func SubscribeToEvents() { } } ``` -## Create - -Create a new list - - -[https://m3o.com/lists/api#Create](https://m3o.com/lists/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/lists" -) - -// Create a new list -func CreateAlist() { - listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN")) - rsp, err := listsService.Create(&lists.CreateRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/location/README.md b/examples/location/README.md index 78700e1..a7e58ad 100755 --- a/examples/location/README.md +++ b/examples/location/README.md @@ -4,42 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/location/api]( Endpoints: -## Save - -Save an entity's current position - - -[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/location" -) - -// Save an entity's current position -func SaveAnEntity() { - locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN")) - rsp, err := locationService.Save(&location.SaveRequest{ - Entity: &location.Entity{ - Id: "1", - Location: &location.Point{ - Latitude: 51.511061, - Longitude: -0.120022, - Timestamp: 1622802761, -}, - Type: "bike", -}, - - }) - fmt.Println(rsp, err) - -} -``` ## Read Read an entity by its ID @@ -102,3 +66,39 @@ Type: "bike", } ``` +## Save + +Save an entity's current position + + +[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/location" +) + +// Save an entity's current position +func SaveAnEntity() { + locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN")) + rsp, err := locationService.Save(&location.SaveRequest{ + Entity: &location.Entity{ + Id: "1", + Location: &location.Point{ + Latitude: 51.511061, + Longitude: -0.120022, + Timestamp: 1622802761, +}, + Type: "bike", +}, + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/memegen/README.md b/examples/memegen/README.md index a35d7c0..02370b8 100755 --- a/examples/memegen/README.md +++ b/examples/memegen/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/memegen/api](h Endpoints: +## Templates + +List the available templates + + +[https://m3o.com/memegen/api#Templates](https://m3o.com/memegen/api#Templates) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/memegen" +) + +// List the available templates +func MemeTemplates() { + memegenService := memegen.NewMemegenService(os.Getenv("M3O_API_TOKEN")) + rsp, err := memegenService.Templates(&memegen.TemplatesRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Generate Generate a meme using a template @@ -32,30 +59,3 @@ func GenerateAmeme() { } ``` -## Templates - -List the available templates - - -[https://m3o.com/memegen/api#Templates](https://m3o.com/memegen/api#Templates) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/memegen" -) - -// List the available templates -func MemeTemplates() { - memegenService := memegen.NewMemegenService(os.Getenv("M3O_API_TOKEN")) - rsp, err := memegenService.Templates(&memegen.TemplatesRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/mq/README.md b/examples/mq/README.md index 1582975..2bde790 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{}{ - "id": "1", - "type": "signup", - "user": "john", -}, -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/nft/README.md b/examples/nft/README.md index e8c38f0..3f32ff7 100755 --- a/examples/nft/README.md +++ b/examples/nft/README.md @@ -4,6 +4,63 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/nft/api](https Endpoints: +## Assets + +Return a list of assets + + +[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/nft" +) + +// Return a list of assets +func GetAlistOfAssets() { + nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) + rsp, err := nftService.Assets(&nft.AssetsRequest{ + Limit: 1, + + }) + fmt.Println(rsp, err) + +} +``` +## Create + +Create your own NFT (coming soon) + + +[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/nft" +) + +// Create your own NFT (coming soon) +func CreateAnNft() { + nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) + rsp, err := nftService.Create(&nft.CreateRequest{ + Description: "The epic monkey island character", +Name: "Guybrush Threepwood", + + }) + fmt.Println(rsp, err) + +} +``` ## Collections Get a list of collections @@ -87,60 +144,3 @@ func GetAsingleCollection() { } ``` -## Assets - -Return a list of assets - - -[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/nft" -) - -// Return a list of assets -func GetAlistOfAssets() { - nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) - rsp, err := nftService.Assets(&nft.AssetsRequest{ - Limit: 1, - - }) - fmt.Println(rsp, err) - -} -``` -## Create - -Create your own NFT (coming soon) - - -[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/nft" -) - -// Create your own NFT (coming soon) -func CreateAnNft() { - nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) - rsp, err := nftService.Create(&nft.CreateRequest{ - Description: "The epic monkey island character", -Name: "Guybrush Threepwood", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/notes/README.md b/examples/notes/README.md index 9e98ae9..3bc665d 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,90 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt Endpoints: -## Create - -Create a new note - - -[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Create a new note -func CreateAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Create(¬es.CreateRequest{ - Text: "This is my note", -Title: "New Note", - - }) - fmt.Println(rsp, err) - -} -``` -## Read - -Read a note - - -[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Read a note -func ReadAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Read(¬es.ReadRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - fmt.Println(rsp, err) - -} -``` -## 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 @@ -189,3 +105,87 @@ func SubscribeToEvents() { } } ``` +## Create + +Create a new note + + +[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Create a new note +func CreateAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Create(¬es.CreateRequest{ + Text: "This is my note", +Title: "New Note", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read a note + + +[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Read a note +func ReadAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Read(¬es.ReadRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + fmt.Println(rsp, err) + +} +``` +## 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) + +} +``` diff --git a/examples/ping/README.md b/examples/ping/README.md index f7db414..54dea8b 100755 --- a/examples/ping/README.md +++ b/examples/ping/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/ping/api](http Endpoints: +## Ip + +Ping an IP address + + +[https://m3o.com/ping/api#Ip](https://m3o.com/ping/api#Ip) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/ping" +) + +// Ping an IP address +func PingAnIp() { + pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN")) + rsp, err := pingService.Ip(&ping.IpRequest{ + Address: "google.com", + + }) + fmt.Println(rsp, err) + +} +``` ## Tcp Ping a TCP port is open @@ -60,31 +88,3 @@ func CheckAurl() { } ``` -## Ip - -Ping an IP address - - -[https://m3o.com/ping/api#Ip](https://m3o.com/ping/api#Ip) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/ping" -) - -// Ping an IP address -func PingAnIp() { - pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN")) - rsp, err := pingService.Ip(&ping.IpRequest{ - Address: "google.com", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/search/README.md b/examples/search/README.md index 99681a2..3fc5086 100755 --- a/examples/search/README.md +++ b/examples/search/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/search/api](ht Endpoints: -## DeleteIndex - -Delete an index by name - - -[https://m3o.com/search/api#DeleteIndex](https://m3o.com/search/api#DeleteIndex) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/search" -) - -// Delete an index by name -func DeleteAnIndex() { - searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN")) - rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{ - Index: "customers", - - }) - fmt.Println(rsp, err) - -} -``` ## Index Index a record i.e. insert a document to search for. @@ -54,9 +26,9 @@ func IndexArecord() { searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN")) rsp, err := searchService.Index(&search.IndexRequest{ Data: map[string]interface{}{ - "name": "John Doe", "age": 37, "starsign": "Leo", + "name": "John Doe", }, Index: "customers", @@ -209,3 +181,31 @@ func CreateAnIndex() { } ``` +## DeleteIndex + +Delete an index by name + + +[https://m3o.com/search/api#DeleteIndex](https://m3o.com/search/api#DeleteIndex) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/search" +) + +// Delete an index by name +func DeleteAnIndex() { + searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN")) + rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{ + Index: "customers", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/space/README.md b/examples/space/README.md index a3418ba..d61c3c6 100755 --- a/examples/space/README.md +++ b/examples/space/README.md @@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/space/api](htt Endpoints: +## Delete + +Delete an object from space + + +[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// Delete an object from space +func DeleteAnObject() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.Delete(&space.DeleteRequest{ + Name: "images/file.jpg", + + }) + fmt.Println(rsp, err) + +} +``` +## List + +List the objects in space + + +[https://m3o.com/space/api#List](https://m3o.com/space/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// List the objects in space +func ListObjectsWithPrefix() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.List(&space.ListRequest{ + Prefix: "images/", + + }) + fmt.Println(rsp, err) + +} +``` ## Head Retrieve meta information about an object @@ -176,59 +232,3 @@ Visibility: "public", } ``` -## Delete - -Delete an object from space - - -[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// Delete an object from space -func DeleteAnObject() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.Delete(&space.DeleteRequest{ - Name: "images/file.jpg", - - }) - fmt.Println(rsp, err) - -} -``` -## List - -List the objects in space - - -[https://m3o.com/space/api#List](https://m3o.com/space/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// List the objects in space -func ListObjectsWithPrefix() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.List(&space.ListRequest{ - Prefix: "images/", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/stream/README.md b/examples/stream/README.md index d35da4f..232026e 100755 --- a/examples/stream/README.md +++ b/examples/stream/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stream/api](ht Endpoints: -## ListChannels - -List all the active channels - - -[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stream" -) - -// List all the active channels -func ListChannels() { - streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) - rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{ - - }) - fmt.Println(rsp, err) - -} -``` ## CreateChannel Create a channel with a given name and description. Channels are created automatically but @@ -119,3 +92,30 @@ func ListMessages() { } ``` +## ListChannels + +List all the active channels + + +[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stream" +) + +// List all the active channels +func ListChannels() { + streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) + rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{ + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/sunnah/README.md b/examples/sunnah/README.md index 6036ae5..68ccae1 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,6 +4,36 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sunnah/api](ht Endpoints: +## Books + +Get a list of books from within a collection. A book can contain many chapters +each with its own hadiths. + + +[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/sunnah" +) + +// Get a list of books from within a collection. A book can contain many chapters +// each with its own hadiths. +func GetTheBooksWithinAcollection() { + sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) + rsp, err := sunnahService.Books(&sunnah.BooksRequest{ + Collection: "bukhari", + + }) + fmt.Println(rsp, err) + +} +``` ## Chapters Get all the chapters of a given book within a collection. @@ -93,33 +123,3 @@ func ListAvailableCollections() { } ``` -## Books - -Get a list of books from within a collection. A book can contain many chapters -each with its own hadiths. - - -[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/sunnah" -) - -// Get a list of books from within a collection. A book can contain many chapters -// each with its own hadiths. -func GetTheBooksWithinAcollection() { - sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) - rsp, err := sunnahService.Books(&sunnah.BooksRequest{ - Collection: "bukhari", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/twitter/README.md b/examples/twitter/README.md index b65c6ac..ec1dada 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/url/README.md b/examples/url/README.md index 24bd71a..ec670c0 100755 --- a/examples/url/README.md +++ b/examples/url/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/url/api](https Endpoints: +## List + +List all the shortened URLs + + +[https://m3o.com/url/api#List](https://m3o.com/url/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/url" +) + +// List all the shortened URLs +func ListYourShortenedUrls() { + urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN")) + rsp, err := urlService.List(&url.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Shorten Shorten a long URL @@ -58,30 +85,3 @@ func ResolveAshortUrlToAlongDestinationUrl() { } ``` -## List - -List all the shortened URLs - - -[https://m3o.com/url/api#List](https://m3o.com/url/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/url" -) - -// List all the shortened URLs -func ListYourShortenedUrls() { - urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN")) - rsp, err := urlService.List(&url.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/user/README.md b/examples/user/README.md index 5bbf435..99c1a84 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,6 +4,99 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http Endpoints: +## Logout + +Logout a user account + + +[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Logout a user account +func LogAuserOut() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Logout(&user.LogoutRequest{ + SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", + + }) + fmt.Println(rsp, err) + +} +``` +## VerifyToken + +Check whether the token attached to MagicLink is valid or not. +Ideally, you need to call this endpoint from your http request +handler that handles the endpoint which is specified in the +SendMagicLink request. + + +[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Check whether the token attached to MagicLink is valid or not. +// Ideally, you need to call this endpoint from your http request +// handler that handles the endpoint which is specified in the +// SendMagicLink request. +func VerifyAtoken() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{ + Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld", + + }) + fmt.Println(rsp, err) + +} +``` +## Create + +Create a new user account. The email address and username for the account must be unique. + + +[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Create a new user account. The email address and username for the account must be unique. +func CreateAnAccount() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Create(&user.CreateRequest{ + Email: "joe@example.com", +Id: "user-1", +Password: "Password1", +Username: "joe", + + }) + fmt.Println(rsp, err) + +} +``` ## UpdatePassword Update the account password @@ -33,6 +126,268 @@ UserId: "user-1", }) fmt.Println(rsp, err) +} +``` +## SendVerificationEmail + +Send a verification email to a user. +Email "from" will be 'noreply@email.m3ocontent.com'. +The verification link will be injected in the email +as a template variable, $micro_verification_link e.g +'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' +The variable will be replaced with a url similar to: +'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' + + +[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Send a verification email to a user. +// Email "from" will be 'noreply@email.m3ocontent.com'. +// The verification link will be injected in the email +// as a template variable, $micro_verification_link e.g +// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' +// The variable will be replaced with a url similar to: +// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' +func SendVerificationEmail() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{ + Email: "joe@example.com", +FailureRedirectUrl: "https://m3o.com/verification-failed", +FromName: "Awesome Dot Com", +RedirectUrl: "https://m3o.com", +Subject: "Email verification", +TextContent: `Hi there, + +Please verify your email by clicking this link: $micro_verification_link`, + + }) + 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) + +} +``` +## 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 + +Reset password with the code sent by the "SendPasswordResetEmail" endpoint. + + +[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Reset password with the code sent by the "SendPasswordResetEmail" endpoint. +func ResetPassword() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{ + Code: "012345", +ConfirmPassword: "NewPassword1", +Email: "joe@example.com", +NewPassword: "NewPassword1", + + }) + 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{ + Token: "012345", + + }) + 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) + +} +``` +## SendMagicLink + +Login using email only - Passwordless + + +[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Login using email only - Passwordless +func SendAmagicLink() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{ + Address: "www.example.com", +Email: "joe@example.com", +Endpoint: "verifytoken", +FromName: "Awesome Dot Com", +Subject: "MagicLink to access your account", +TextContent: `Hi there, + +Click here to access your account $micro_verification_link`, + + }) + 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", +Username: "joe", + + }) + fmt.Println(rsp, err) + } ``` ## Read @@ -119,12 +474,13 @@ func ReadAccountByEmail() { } ``` -## Logout +## Login -Logout a user account +Login using username or email. The response will return a new session for successful login, +401 in the case of login failure and 500 for any other error -[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout) +[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login) ```go package example @@ -136,11 +492,13 @@ import( "go.m3o.com/user" ) -// Logout a user account -func LogAuserOut() { +// Login using username or email. The response will return a new session for successful login, +// 401 in the case of login failure and 500 for any other error +func LogAuserIn() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Logout(&user.LogoutRequest{ - SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", + rsp, err := userService.Login(&user.LoginRequest{ + Email: "joe@example.com", +Password: "Password1", }) fmt.Println(rsp, err) @@ -175,361 +533,3 @@ func ReadAsessionByTheSessionId() { } ``` -## VerifyToken - -Check whether the token attached to MagicLink is valid or not. -Ideally, you need to call this endpoint from your http request -handler that handles the endpoint which is specified in the -SendMagicLink request. - - -[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Check whether the token attached to MagicLink is valid or not. -// Ideally, you need to call this endpoint from your http request -// handler that handles the endpoint which is specified in the -// SendMagicLink request. -func VerifyAtoken() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{ - Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld", - - }) - fmt.Println(rsp, err) - -} -``` -## SendVerificationEmail - -Send a verification email to a user. -Email "from" will be 'noreply@email.m3ocontent.com'. -The verification link will be injected in the email -as a template variable, $micro_verification_link e.g -'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' -The variable will be replaced with a url similar to: -'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' - - -[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Send a verification email to a user. -// Email "from" will be 'noreply@email.m3ocontent.com'. -// The verification link will be injected in the email -// as a template variable, $micro_verification_link e.g -// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' -// The variable will be replaced with a url similar to: -// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' -func SendVerificationEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{ - Email: "joe@example.com", -FailureRedirectUrl: "https://m3o.com/verification-failed", -FromName: "Awesome Dot Com", -RedirectUrl: "https://m3o.com", -Subject: "Email verification", -TextContent: `Hi there, - -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{ - Token: "012345", - - }) - fmt.Println(rsp, err) - -} -``` -## SendMagicLink - -Login using email only - Passwordless - - -[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Login using email only - Passwordless -func SendAmagicLink() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{ - Address: "www.example.com", -Email: "joe@example.com", -Endpoint: "verifytoken", -FromName: "Awesome Dot Com", -Subject: "MagicLink to access your account", -TextContent: `Hi there, - -Click here to access your account $micro_verification_link`, - - }) - fmt.Println(rsp, err) - -} -``` -## Create - -Create a new user account. The email address and username for the account must be unique. - - -[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Create a new user account. The email address and username for the account must be unique. -func CreateAnAccount() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Create(&user.CreateRequest{ - Email: "joe@example.com", -Id: "user-1", -Password: "Password1", -Username: "joe", - - }) - fmt.Println(rsp, err) - -} -``` -## Login - -Login using username or email. The response will return a new session for successful login, -401 in the case of login failure and 500 for any other error - - -[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Login using username or email. The response will return a new session for successful login, -// 401 in the case of login failure and 500 for any other error -func LogAuserIn() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Login(&user.LoginRequest{ - Email: "joe@example.com", -Password: "Password1", - - }) - 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", -Username: "joe", - - }) - 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 - -Reset password with the code sent by the "SendPasswordResetEmail" endpoint. - - -[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Reset password with the code sent by the "SendPasswordResetEmail" endpoint. -func ResetPassword() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{ - Code: "012345", -ConfirmPassword: "NewPassword1", -Email: "joe@example.com", -NewPassword: "NewPassword1", - - }) - 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) - -} -``` diff --git a/examples/weather/README.md b/examples/weather/README.md index 43c5660..4fa715b 100755 --- a/examples/weather/README.md +++ b/examples/weather/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/weather/api](h Endpoints: +## Now + +Get the current weather report for a location by postcode, city, zip code, ip address + + +[https://m3o.com/weather/api#Now](https://m3o.com/weather/api#Now) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/weather" +) + +// Get the current weather report for a location by postcode, city, zip code, ip address +func GetCurrentWeather() { + weatherService := weather.NewWeatherService(os.Getenv("M3O_API_TOKEN")) + rsp, err := weatherService.Now(&weather.NowRequest{ + Location: "london", + + }) + fmt.Println(rsp, err) + +} +``` ## Forecast Get the weather forecast for the next 1-10 days @@ -33,31 +61,3 @@ Location: "London", } ``` -## Now - -Get the current weather report for a location by postcode, city, zip code, ip address - - -[https://m3o.com/weather/api#Now](https://m3o.com/weather/api#Now) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/weather" -) - -// Get the current weather report for a location by postcode, city, zip code, ip address -func GetCurrentWeather() { - weatherService := weather.NewWeatherService(os.Getenv("M3O_API_TOKEN")) - rsp, err := weatherService.Now(&weather.NowRequest{ - Location: "london", - - }) - fmt.Println(rsp, err) - -} -```