From 6910f3d25afce29767a270f9d72d912c74b7d6d2 Mon Sep 17 00:00:00 2001 From: m3o-actions <> Date: Wed, 9 Mar 2022 20:18:31 +0000 Subject: [PATCH] Commit from m3o/m3o action --- examples/app/README.md | 168 +++--- examples/cache/README.md | 112 ++-- examples/chat/README.md | 134 ++--- examples/comments/README.md | 166 +++--- examples/contact/README.md | 112 ++-- examples/crypto/README.md | 110 ++-- examples/currency/README.md | 54 +- examples/db/README.md | 248 ++++----- examples/db/create/createARecord/main.go | 2 +- examples/evchargers/README.md | 54 +- examples/event/README.md | 66 +-- examples/function/README.md | 228 ++++---- examples/lists/README.md | 82 +-- examples/mq/README.md | 66 +-- examples/nft/README.md | 56 +- examples/notes/README.md | 82 +-- examples/ping/README.md | 56 +- examples/place/README.md | 58 +-- examples/quran/README.md | 56 +- examples/search/README.md | 56 +- examples/search/index/indexARecord/main.go | 2 +- examples/space/README.md | 112 ++-- examples/stock/README.md | 112 ++-- examples/sunnah/README.md | 62 +-- examples/twitter/README.md | 56 +- examples/url/README.md | 54 +- examples/user/README.md | 578 ++++++++++----------- examples/youtube/README.md | 56 +- 28 files changed, 1499 insertions(+), 1499 deletions(-) diff --git a/examples/app/README.md b/examples/app/README.md index 3c53fd6..3692e03 100755 --- a/examples/app/README.md +++ b/examples/app/README.md @@ -4,90 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https Endpoints: -## Status - -Get the status of an app - - -[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/app" -) - -// Get the status of an app -func GetTheStatusOfAnApp() { - appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) - rsp, err := appService.Status(&app.StatusRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` -## 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 @@ -230,3 +146,87 @@ func ListRegions() { } ``` +## Status + +Get the status of an app + + +[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/app" +) + +// Get the status of an app +func GetTheStatusOfAnApp() { + appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) + rsp, err := appService.Status(&app.StatusRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## 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 359c982..e2c4a50 100755 --- a/examples/cache/README.md +++ b/examples/cache/README.md @@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](htt Endpoints: +## Decrement + +Decrement a value (if it's a number). If key not found it is equivalent to set. + + +[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Decrement a value (if it's a number). If key not found it is equivalent to set. +func DecrementAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Decrement(&cache.DecrementRequest{ + Key: "counter", +Value: 2, + + }) + fmt.Println(rsp, err) + +} +``` +## ListKeys + +List all the available keys + + +[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// List all the available keys +func ListTheKeys() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Set Set an item in the cache. Overwrites any existing value already set. @@ -118,59 +174,3 @@ Value: 2, } ``` -## Decrement - -Decrement a value (if it's a number). If key not found it is equivalent to set. - - -[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Decrement a value (if it's a number). If key not found it is equivalent to set. -func DecrementAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Decrement(&cache.DecrementRequest{ - Key: "counter", -Value: 2, - - }) - fmt.Println(rsp, err) - -} -``` -## ListKeys - -List all the available keys - - -[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// List all the available keys -func ListTheKeys() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/chat/README.md b/examples/chat/README.md index fd03b1a..5ef5bf6 100755 --- a/examples/chat/README.md +++ b/examples/chat/README.md @@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http Endpoints: -## Invite +## Create -Invite a user to a chat room +Create a new chat room -[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite) +[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create) ```go package example @@ -21,42 +21,12 @@ import( "go.m3o.com/chat" ) -// Invite a user to a chat room -func InviteAuser() { +// Create a new chat room +func CreateAnewChat() { chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) - rsp, err := chatService.Invite(&chat.InviteRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## Send - -Connect to a chat to receive a stream of messages -Send a message to a chat - - -[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/chat" -) - -// Connect to a chat to receive a stream of messages -// Send a message to a chat -func SendAmessage() { - chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) - rsp, err := chatService.Send(&chat.SendRequest{ - Client: "web", -Subject: "Random", -Text: "Hey whats up?", + rsp, err := chatService.Create(&chat.CreateRequest{ + Description: "The general chat room", +Name: "general", }) fmt.Println(rsp, err) @@ -128,35 +98,6 @@ func KickAuserFromAroom() { }) 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) - } ``` ## List @@ -211,6 +152,65 @@ func DeleteAchat() { }) fmt.Println(rsp, err) +} +``` +## Invite + +Invite a user to a chat room + + +[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/chat" +) + +// Invite a user to a chat room +func InviteAuser() { + chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) + rsp, err := chatService.Invite(&chat.InviteRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## Send + +Connect to a chat to receive a stream of messages +Send a message to a chat + + +[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/chat" +) + +// Connect to a chat to receive a stream of messages +// Send a message to a chat +func SendAmessage() { + chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN")) + rsp, err := chatService.Send(&chat.SendRequest{ + Client: "web", +Subject: "Random", +Text: "Hey whats up?", + + }) + fmt.Println(rsp, err) + } ``` ## History diff --git a/examples/comments/README.md b/examples/comments/README.md index fd28995..6e8311b 100755 --- a/examples/comments/README.md +++ b/examples/comments/README.md @@ -4,6 +4,89 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/comments/api]( Endpoints: +## Create + +Create a new comment + + +[https://m3o.com/comments/api#Create](https://m3o.com/comments/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/comments" +) + +// Create a new comment +func CreateAcomment() { + commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) + rsp, err := commentsService.Create(&comments.CreateRequest{ + Text: "This is my comment", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read a comment + + +[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/comments" +) + +// Read a comment +func ReadAcomment() { + commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) + rsp, err := commentsService.Read(&comments.ReadRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + fmt.Println(rsp, err) + +} +``` +## List + +List all the comments + + +[https://m3o.com/comments/api#List](https://m3o.com/comments/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/comments" +) + +// List all the comments +func ListAllComments() { + commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) + rsp, err := commentsService.List(&comments.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Update Update a comment @@ -105,86 +188,3 @@ func SubscribeToEvents() { } } ``` -## Create - -Create a new comment - - -[https://m3o.com/comments/api#Create](https://m3o.com/comments/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/comments" -) - -// Create a new comment -func CreateAcomment() { - commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) - rsp, err := commentsService.Create(&comments.CreateRequest{ - Text: "This is my comment", - - }) - fmt.Println(rsp, err) - -} -``` -## Read - -Read a comment - - -[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/comments" -) - -// Read a comment -func ReadAcomment() { - commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) - rsp, err := commentsService.Read(&comments.ReadRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - fmt.Println(rsp, err) - -} -``` -## List - -List all the comments - - -[https://m3o.com/comments/api#List](https://m3o.com/comments/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/comments" -) - -// List all the comments -func ListAllComments() { - commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN")) - rsp, err := commentsService.List(&comments.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/contact/README.md b/examples/contact/README.md index e2e01cc..6fedb2a 100755 --- a/examples/contact/README.md +++ b/examples/contact/README.md @@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h Endpoints: +## List + +List contacts + + +[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// List contacts +func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() { + contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) + rsp, err := contactService.List(&contact.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## List + +List contacts + + +[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// List contacts +func ListContactsWithSpecificOffsetAndLimit() { + contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) + rsp, err := contactService.List(&contact.ListRequest{ + Limit: 1, +Offset: 1, + + }) + fmt.Println(rsp, err) + +} +``` ## Create Create a contact @@ -161,59 +217,3 @@ func DeleteAcontact() { } ``` -## List - -List contacts - - -[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// List contacts -func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() { - contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) - rsp, err := contactService.List(&contact.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## List - -List contacts - - -[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// List contacts -func ListContactsWithSpecificOffsetAndLimit() { - contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) - rsp, err := contactService.List(&contact.ListRequest{ - Limit: 1, -Offset: 1, - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/crypto/README.md b/examples/crypto/README.md index 7517ee7..d9bae9e 100755 --- a/examples/crypto/README.md +++ b/examples/crypto/README.md @@ -4,61 +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) - -} -``` -## Symbols - -Returns the full list of supported symbols - - -[https://m3o.com/crypto/api#Symbols](https://m3o.com/crypto/api#Symbols) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/crypto" -) - -// Returns the full list of supported symbols -func GetListOfAllSupportedSymbols() { - cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cryptoService.Symbols(&crypto.SymbolsRequest{ - - }) - fmt.Println(rsp, err) - -} -``` ## News Get news related to a currency @@ -143,3 +88,58 @@ 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) + +} +``` +## Symbols + +Returns the full list of supported symbols + + +[https://m3o.com/crypto/api#Symbols](https://m3o.com/crypto/api#Symbols) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/crypto" +) + +// Returns the full list of supported symbols +func GetListOfAllSupportedSymbols() { + cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cryptoService.Symbols(&crypto.SymbolsRequest{ + + }) + 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 d518118..38033ff 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: -## ListTables +## Update -List tables in the DB +Update a record in the database. Include an "id" in the record to update. -[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables) +[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update) ```go package example @@ -21,11 +21,101 @@ import( "go.m3o.com/db" ) -// List tables in the DB -func ListTables() { +// 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.ListTables(&db.ListTablesRequest{ - + rsp, err := dbService.Update(&db.UpdateRequest{ + Record: map[string]interface{}{ + "id": "1", + "age": 43, +}, +Table: "example", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read data from a table. Lookup can be by ID or via querying any field in the record. + + +[https://m3o.com/db/api#Read](https://m3o.com/db/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Read data from a table. Lookup can be by ID or via querying any field in the record. +func ReadRecords() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Read(&db.ReadRequest{ + Query: "age == 43", +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 + +Drop a table in the DB + + +[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Drop a table in the DB +func DropTable() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.DropTable(&db.DropTableRequest{ + Table: "example", + }) fmt.Println(rsp, err) @@ -63,35 +153,6 @@ Table: "example", }) fmt.Println(rsp, err) -} -``` -## Read - -Read data from a table. Lookup can be by ID or via querying any field in the record. - - -[https://m3o.com/db/api#Read](https://m3o.com/db/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Read data from a table. Lookup can be by ID or via querying any field in the record. -func ReadRecords() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Read(&db.ReadRequest{ - Query: "age == 43", -Table: "example", - - }) - fmt.Println(rsp, err) - } ``` ## Delete @@ -121,94 +182,6 @@ Table: "example", }) fmt.Println(rsp, err) -} -``` -## DropTable - -Drop a table in the DB - - -[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Drop a table in the DB -func DropTable() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.DropTable(&db.DropTableRequest{ - Table: "example", - - }) - 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{}{ - "id": "1", - "age": 43, -}, -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 @@ -237,6 +210,33 @@ func CountEntriesInAtable() { }) fmt.Println(rsp, err) +} +``` +## 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 diff --git a/examples/db/create/createARecord/main.go b/examples/db/create/createARecord/main.go index f094c0c..f7b3a81 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{}{ + "name": "Jane", "age": 42, "isActive": true, "id": "1", - "name": "Jane", }, Table: "example", }) diff --git a/examples/evchargers/README.md b/examples/evchargers/README.md index 7e1c9b6..176565e 100755 --- a/examples/evchargers/README.md +++ b/examples/evchargers/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/evchargers/api Endpoints: +## ReferenceData + +Retrieve reference data as used by this API and in conjunction with the Search endpoint + + +[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/evchargers" +) + +// Retrieve reference data as used by this API and in conjunction with the Search endpoint +func GetReferenceData() { + evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN")) + rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Search Search by giving a coordinate and a max distance, or bounding box and optional filters @@ -98,30 +125,3 @@ Location: &evchargers.Coordinates{ } ``` -## ReferenceData - -Retrieve reference data as used by this API and in conjunction with the Search endpoint - - -[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/evchargers" -) - -// Retrieve reference data as used by this API and in conjunction with the Search endpoint -func GetReferenceData() { - evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN")) - rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/event/README.md b/examples/event/README.md index e84ca13..c8f6f43 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{}{ + "id": "1", + "type": "signup", + "user": "john", +}, +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{}{ - "type": "signup", - "user": "john", - "id": "1", -}, -Topic: "user", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/function/README.md b/examples/function/README.md index 4641aac..8e89155 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api]( Endpoints: +## 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) + +} +``` ## Update Update a function. Downloads the source, builds and redeploys @@ -30,37 +58,6 @@ func UpdateAfunction() { }) fmt.Println(rsp, err) -} -``` -## Call - -Call a function by name - - -[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Call a function by name -func CallAfunction() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Call(&function.CallRequest{ - Name: "helloworld", -Request: map[string]interface{}{ - "name": "Alice", -}, - - }) - fmt.Println(rsp, err) - } ``` ## List @@ -115,6 +112,61 @@ func ListRegions() { }) 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) + +} +``` +## Runtimes + +Return a list of supported runtimes + + +[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Return a list of supported runtimes +func ListRuntimes() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Runtimes(&function.RuntimesRequest{ + + }) + fmt.Println(rsp, err) + } ``` ## Proxy @@ -177,6 +229,37 @@ Subfolder: "examples/go-function", }) fmt.Println(rsp, err) +} +``` +## Call + +Call a function by name + + +[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Call a function by name +func CallAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Call(&function.CallRequest{ + Name: "helloworld", +Request: map[string]interface{}{ + "name": "Alice", +}, + + }) + fmt.Println(rsp, err) + } ``` ## Delete @@ -207,86 +290,3 @@ func DeleteAfunction() { } ``` -## 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) - -} -``` -## Runtimes - -Return a list of supported runtimes - - -[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Return a list of supported runtimes -func ListRuntimes() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Runtimes(&function.RuntimesRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/lists/README.md b/examples/lists/README.md index da20dd4..7fe9884 100755 --- a/examples/lists/README.md +++ b/examples/lists/README.md @@ -4,47 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/lists/api](htt Endpoints: -## Events - -Subscribe to lists events - - -[https://m3o.com/lists/api#Events](https://m3o.com/lists/api#Events) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/lists" -) - -// Subscribe to lists events -func SubscribeToEvents() { - listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN")) - - stream, err := listsService.Events(&lists.EventsRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - if err != nil { - fmt.Println(err) - return - } - - for { - rsp, err := stream.Recv() - if err != nil { - fmt.Println(err) - return - } - - fmt.Println(rsp) - } -} -``` ## Create Create a new list @@ -185,3 +144,44 @@ func DeleteAlist() { } ``` +## Events + +Subscribe to lists events + + +[https://m3o.com/lists/api#Events](https://m3o.com/lists/api#Events) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/lists" +) + +// Subscribe to lists events +func SubscribeToEvents() { + listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN")) + + stream, err := listsService.Events(&lists.EventsRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + if err != nil { + fmt.Println(err) + return + } + + for { + rsp, err := stream.Recv() + if err != nil { + fmt.Println(err) + return + } + + fmt.Println(rsp) + } +} +``` diff --git a/examples/mq/README.md b/examples/mq/README.md index a0bfa01..1582975 100755 --- a/examples/mq/README.md +++ b/examples/mq/README.md @@ -4,6 +4,39 @@ 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. @@ -45,36 +78,3 @@ 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{}{ - "id": "1", - "type": "signup", - "user": "john", -}, -Topic: "events", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/nft/README.md b/examples/nft/README.md index effa289..b313682 100755 --- a/examples/nft/README.md +++ b/examples/nft/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/nft/api](https Endpoints: +## Collection + +Get a collection by its slug + + +[https://m3o.com/nft/api#Collection](https://m3o.com/nft/api#Collection) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/nft" +) + +// Get a collection by its slug +func GetAsingleCollection() { + nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) + rsp, err := nftService.Collection(&nft.CollectionRequest{ + Slug: "doodles-official", + + }) + fmt.Println(rsp, err) + +} +``` ## Assets Return a list of assets @@ -116,31 +144,3 @@ func GetAsingleAsset() { } ``` -## Collection - -Get a collection by its slug - - -[https://m3o.com/nft/api#Collection](https://m3o.com/nft/api#Collection) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/nft" -) - -// Get a collection by its slug -func GetAsingleCollection() { - nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) - rsp, err := nftService.Collection(&nft.CollectionRequest{ - Slug: "doodles-official", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/notes/README.md b/examples/notes/README.md index 6997879..9e98ae9 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,47 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt Endpoints: -## Events - -Subscribe to notes events - - -[https://m3o.com/notes/api#Events](https://m3o.com/notes/api#Events) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Subscribe to notes events -func SubscribeToEvents() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - - stream, err := notesService.Events(¬es.EventsRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - if err != nil { - fmt.Println(err) - return - } - - for { - rsp, err := stream.Recv() - if err != nil { - fmt.Println(err) - return - } - - fmt.Println(rsp) - } -} -``` ## Create Create a new note @@ -189,3 +148,44 @@ func DeleteAnote() { } ``` +## Events + +Subscribe to notes events + + +[https://m3o.com/notes/api#Events](https://m3o.com/notes/api#Events) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Subscribe to notes events +func SubscribeToEvents() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + + stream, err := notesService.Events(¬es.EventsRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + if err != nil { + fmt.Println(err) + return + } + + for { + rsp, err := stream.Recv() + if err != nil { + fmt.Println(err) + return + } + + fmt.Println(rsp) + } +} +``` diff --git a/examples/ping/README.md b/examples/ping/README.md index 54dea8b..f7db414 100755 --- a/examples/ping/README.md +++ b/examples/ping/README.md @@ -4,34 +4,6 @@ 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 @@ -88,3 +60,31 @@ 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/place/README.md b/examples/place/README.md index 4a83a0a..edccd56 100755 --- a/examples/place/README.md +++ b/examples/place/README.md @@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/place/api](htt Endpoints: +## Search + +Search for places by text query + + +[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/place" +) + +// Search for places by text query +func SearchForPlaces() { + placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := placeService.Search(&place.SearchRequest{ + Location: "51.5074577,-0.1297515", +Query: "food", + + }) + fmt.Println(rsp, err) + +} +``` ## Nearby Find places nearby using a location @@ -34,32 +63,3 @@ Type: "store", } ``` -## Search - -Search for places by text query - - -[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/place" -) - -// Search for places by text query -func SearchForPlaces() { - placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := placeService.Search(&place.SearchRequest{ - Location: "51.5074577,-0.1297515", -Query: "food", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/quran/README.md b/examples/quran/README.md index ec04685..5ce6584 100755 --- a/examples/quran/README.md +++ b/examples/quran/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/quran/api](htt Endpoints: +## Summary + +Get a summary for a given chapter (surah) + + +[https://m3o.com/quran/api#Summary](https://m3o.com/quran/api#Summary) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/quran" +) + +// Get a summary for a given chapter (surah) +func GetChapterSummary() { + quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) + rsp, err := quranService.Summary(&quran.SummaryRequest{ + Chapter: 1, + + }) + fmt.Println(rsp, err) + +} +``` ## Verses Lookup the verses (ayahs) for a chapter including @@ -92,31 +120,3 @@ func ListChapters() { } ``` -## Summary - -Get a summary for a given chapter (surah) - - -[https://m3o.com/quran/api#Summary](https://m3o.com/quran/api#Summary) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/quran" -) - -// Get a summary for a given chapter (surah) -func GetChapterSummary() { - quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) - rsp, err := quranService.Summary(&quran.SummaryRequest{ - Chapter: 1, - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/search/README.md b/examples/search/README.md index 99681a2..fb59678 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. @@ -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/search/index/indexARecord/main.go b/examples/search/index/indexARecord/main.go index d4c7261..8f47156 100755 --- a/examples/search/index/indexARecord/main.go +++ b/examples/search/index/indexARecord/main.go @@ -12,9 +12,9 @@ func main() { searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN")) rsp, err := searchService.Index(&search.IndexRequest{ Data: map[string]interface{}{ - "starsign": "Leo", "name": "John Doe", "age": 37, + "starsign": "Leo", }, Index: "customers", }) diff --git a/examples/space/README.md b/examples/space/README.md index caa0bf5..e0dac00 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: +## Read + +Read an object in space + + +[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// Read an object in space +func ReadAnObject() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.Read(&space.ReadRequest{ + Name: "images/file.jpg", + + }) + fmt.Println(rsp, err) + +} +``` +## Download + +Download an object via a presigned url + + +[https://m3o.com/space/api#Download](https://m3o.com/space/api#Download) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// Download an object via a presigned url +func DownloadAnObject() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.Download(&space.DownloadRequest{ + Name: "images/file.jpg", + + }) + fmt.Println(rsp, err) + +} +``` ## Upload Upload a large object (> 10MB). Returns a time limited presigned URL to be used for uploading the object @@ -176,59 +232,3 @@ func HeadAnObject() { } ``` -## Read - -Read an object in space - - -[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// Read an object in space -func ReadAnObject() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.Read(&space.ReadRequest{ - Name: "images/file.jpg", - - }) - fmt.Println(rsp, err) - -} -``` -## Download - -Download an object via a presigned url - - -[https://m3o.com/space/api#Download](https://m3o.com/space/api#Download) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// Download an object via a presigned url -func DownloadAnObject() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.Download(&space.DownloadRequest{ - Name: "images/file.jpg", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/stock/README.md b/examples/stock/README.md index 83cd80a..0d497b8 100755 --- a/examples/stock/README.md +++ b/examples/stock/README.md @@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stock/api](htt Endpoints: +## Price + +Get the last price for a given stock ticker + + +[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stock" +) + +// Get the last price for a given stock ticker +func GetAstockPrice() { + stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) + rsp, err := stockService.Price(&stock.PriceRequest{ + Symbol: "AAPL", + + }) + fmt.Println(rsp, err) + +} +``` +## Quote + +Get the last quote for the stock + + +[https://m3o.com/stock/api#Quote](https://m3o.com/stock/api#Quote) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stock" +) + +// Get the last quote for the stock +func GetAstockQuote() { + stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) + rsp, err := stockService.Quote(&stock.QuoteRequest{ + Symbol: "AAPL", + + }) + fmt.Println(rsp, err) + +} +``` ## History Get the historic open-close for a given day @@ -65,59 +121,3 @@ Stock: "AAPL", } ``` -## Price - -Get the last price for a given stock ticker - - -[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stock" -) - -// Get the last price for a given stock ticker -func GetAstockPrice() { - stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) - rsp, err := stockService.Price(&stock.PriceRequest{ - Symbol: "AAPL", - - }) - fmt.Println(rsp, err) - -} -``` -## Quote - -Get the last quote for the stock - - -[https://m3o.com/stock/api#Quote](https://m3o.com/stock/api#Quote) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stock" -) - -// Get the last quote for the stock -func GetAstockQuote() { - stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) - rsp, err := stockService.Quote(&stock.QuoteRequest{ - Symbol: "AAPL", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/sunnah/README.md b/examples/sunnah/README.md index d2d603b..fbe4416 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,6 +4,37 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sunnah/api](ht Endpoints: +## Hadiths + +Hadiths returns a list of hadiths and their corresponding text for a +given book within a collection. + + +[https://m3o.com/sunnah/api#Hadiths](https://m3o.com/sunnah/api#Hadiths) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/sunnah" +) + +// Hadiths returns a list of hadiths and their corresponding text for a +// given book within a collection. +func ListTheHadithsInAbook() { + sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) + rsp, err := sunnahService.Hadiths(&sunnah.HadithsRequest{ + Book: 1, +Collection: "bukhari", + + }) + fmt.Println(rsp, err) + +} +``` ## Collections Get a list of available collections. A collection is @@ -92,34 +123,3 @@ Collection: "bukhari", } ``` -## Hadiths - -Hadiths returns a list of hadiths and their corresponding text for a -given book within a collection. - - -[https://m3o.com/sunnah/api#Hadiths](https://m3o.com/sunnah/api#Hadiths) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/sunnah" -) - -// Hadiths returns a list of hadiths and their corresponding text for a -// given book within a collection. -func ListTheHadithsInAbook() { - sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) - rsp, err := sunnahService.Hadiths(&sunnah.HadithsRequest{ - Book: 1, -Collection: "bukhari", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/twitter/README.md b/examples/twitter/README.md index 19128ad..ef25975 100755 --- a/examples/twitter/README.md +++ b/examples/twitter/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/twitter/api](h Endpoints: -## Search - -Search for tweets with a simple query - - -[https://m3o.com/twitter/api#Search](https://m3o.com/twitter/api#Search) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/twitter" -) - -// Search for tweets with a simple query -func SearchForTweets() { - twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) - rsp, err := twitterService.Search(&twitter.SearchRequest{ - Query: "cats", - - }) - fmt.Println(rsp, err) - -} -``` ## Trends Get the current global trending topics @@ -116,3 +88,31 @@ Username: "m3oservices", } ``` +## Search + +Search for tweets with a simple query + + +[https://m3o.com/twitter/api#Search](https://m3o.com/twitter/api#Search) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/twitter" +) + +// Search for tweets with a simple query +func SearchForTweets() { + twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) + rsp, err := twitterService.Search(&twitter.SearchRequest{ + Query: "cats", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/url/README.md b/examples/url/README.md index ec670c0..551bd38 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: +## Proxy + +Proxy returns the destination URL of a short URL. + + +[https://m3o.com/url/api#Proxy](https://m3o.com/url/api#Proxy) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/url" +) + +// Proxy returns the destination URL of a short URL. +func ResolveAshortUrlToAlongDestinationUrl() { + urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN")) + rsp, err := urlService.Proxy(&url.ProxyRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## List List all the shortened URLs @@ -58,30 +85,3 @@ func ShortenAlongUrl() { } ``` -## Proxy - -Proxy returns the destination URL of a short URL. - - -[https://m3o.com/url/api#Proxy](https://m3o.com/url/api#Proxy) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/url" -) - -// Proxy returns the destination URL of a short URL. -func ResolveAshortUrlToAlongDestinationUrl() { - urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN")) - rsp, err := urlService.Proxy(&url.ProxyRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/user/README.md b/examples/user/README.md index c1b4842..6a1626d 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,6 +4,71 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http Endpoints: +## 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 Read an account by id, username or email. Only one need to be specified. @@ -88,12 +153,12 @@ func ReadAccountByEmail() { } ``` -## ResetPassword +## VerifyEmail -Reset password with the code sent by the "SendPasswordResetEmail" endpoint. +Verify the email address of an account from a token sent in an email to the user. -[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword) +[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail) ```go package example @@ -105,14 +170,11 @@ import( "go.m3o.com/user" ) -// Reset password with the code sent by the "SendPasswordResetEmail" endpoint. -func ResetPassword() { +// 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.ResetPassword(&user.ResetPasswordRequest{ - Code: "012345", -ConfirmPassword: "NewPassword1", -Email: "joe@example.com", -NewPassword: "NewPassword1", + rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{ + Token: "012345", }) fmt.Println(rsp, err) @@ -145,164 +207,6 @@ func DeleteUserAccount() { }) 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) - -} -``` -## 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) - -} -``` -## 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) - -} -``` -## 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) - -} -``` -## 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) - } ``` ## List @@ -363,127 +267,6 @@ UserId: "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) - -} -``` -## 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) - -} -``` -## 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) - -} -``` -## 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) - } ``` ## SendVerificationEmail @@ -533,3 +316,220 @@ Please verify your email by clicking this link: $micro_verification_link`, } ``` +## 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) + +} +``` +## 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) + +} +``` +## 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) + +} +``` +## 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) + +} +``` +## 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) + +} +``` +## 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) + +} +``` diff --git a/examples/youtube/README.md b/examples/youtube/README.md index fc27a59..a866acf 100755 --- a/examples/youtube/README.md +++ b/examples/youtube/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/youtube/api](h Endpoints: -## Search - -Search for videos on YouTube - - -[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/youtube" -) - -// Search for videos on YouTube -func SearchForVideos() { - youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN")) - rsp, err := youtubeService.Search(&youtube.SearchRequest{ - Query: "donuts", - - }) - fmt.Println(rsp, err) - -} -``` ## Embed Embed a YouTube video @@ -60,3 +32,31 @@ func EmbedAyoutubeVideo() { } ``` +## Search + +Search for videos on YouTube + + +[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/youtube" +) + +// Search for videos on YouTube +func SearchForVideos() { + youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN")) + rsp, err := youtubeService.Search(&youtube.SearchRequest{ + Query: "donuts", + + }) + fmt.Println(rsp, err) + +} +```