From 0561a7f7c25ce4fa15e461e4eb0bc4604ef57b45 Mon Sep 17 00:00:00 2001 From: m3o-actions <> Date: Mon, 1 Nov 2021 17:09:11 +0000 Subject: [PATCH] Commit from m3o/m3o action --- examples/cache/README.md | 112 ++++---- examples/currency/README.md | 56 ++-- examples/db/README.md | 116 ++++----- examples/db/create/createARecord.go | 2 +- examples/db/update/updateARecord.go | 2 +- examples/emoji/README.md | 110 ++++---- examples/forex/README.md | 54 ++-- examples/function/README.md | 112 ++++---- examples/location/README.md | 66 ++--- examples/notes/README.md | 52 ++-- examples/quran/README.md | 54 ++-- examples/routing/README.md | 68 ++--- examples/rss/README.md | 54 ++-- examples/stock/README.md | 108 ++++---- examples/stream/README.md | 54 ++-- examples/stream/publish/publishAMessage.go | 2 +- examples/sunnah/README.md | 60 ++--- examples/url/README.md | 52 ++-- examples/user/README.md | 282 ++++++++++----------- 19 files changed, 708 insertions(+), 708 deletions(-) diff --git a/examples/cache/README.md b/examples/cache/README.md index b79b7ce..8355dcc 100755 --- a/examples/cache/README.md +++ b/examples/cache/README.md @@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt Endpoints: -## Increment - -Increment a value (if it's a number) - - -[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Increment a value (if it's a number) -func IncrementAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Increment(&cache.IncrementRequest{ - Key: "counter", -Value: 2, - - }) - fmt.Println(rsp, err) -} -``` -## Decrement - -Decrement a value (if it's a number) - - -[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) -func DecrementAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Decrement(&cache.DecrementRequest{ - Key: "counter", -Value: 2, - - }) - fmt.Println(rsp, err) -} -``` ## Set Set an item in the cache. Overwrites any existing value already set. @@ -142,3 +86,59 @@ func DeleteAvalue() { fmt.Println(rsp, err) } ``` +## Increment + +Increment a value (if it's a number) + + +[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Increment a value (if it's a number) +func IncrementAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Increment(&cache.IncrementRequest{ + Key: "counter", +Value: 2, + + }) + fmt.Println(rsp, err) +} +``` +## Decrement + +Decrement a value (if it's a number) + + +[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) +func DecrementAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Decrement(&cache.DecrementRequest{ + Key: "counter", +Value: 2, + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/currency/README.md b/examples/currency/README.md index 1e32012..a8adaa9 100755 --- a/examples/currency/README.md +++ b/examples/currency/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api]( Endpoints: +## History + +Returns the historic rates for a currency on a given date + + +[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/currency" +) + +// Returns the historic rates for a currency on a given date +func HistoricRatesForAcurrency() { + currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) + rsp, err := currencyService.History(¤cy.HistoryRequest{ + Code: "USD", +Date: "2021-05-30", + + }) + fmt.Println(rsp, err) +} +``` ## Codes Codes returns the supported currency codes for the API @@ -114,31 +142,3 @@ To: "GBP", fmt.Println(rsp, err) } ``` -## History - -Returns the historic rates for a currency on a given date - - -[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/currency" -) - -// Returns the historic rates for a currency on a given date -func HistoricRatesForAcurrency() { - currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) - rsp, err := currencyService.History(¤cy.HistoryRequest{ - Code: "USD", -Date: "2021-05-30", - - }) - fmt.Println(rsp, err) -} -``` diff --git a/examples/db/README.md b/examples/db/README.md index 9e93ff6..d56b62e 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https: Endpoints: -## 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: "users", - - }) - fmt.Println(rsp, err) -} -``` -## Delete - -Delete a record in the database by id. - - -[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Delete a record in the database by id. -func DeleteArecord() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Delete(&db.DeleteRequest{ - Id: "1", -Table: "users", - - }) - fmt.Println(rsp, err) -} -``` ## Truncate Truncate the records in a table @@ -136,10 +80,10 @@ func CreateArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Create(&db.CreateRequest{ Record: map[string]interface{}{ - "isActive": true, "id": "1", "name": "Jane", "age": 42, + "isActive": true, }, Table: "users", @@ -169,8 +113,8 @@ func UpdateArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Update(&db.UpdateRequest{ Record: map[string]interface{}{ - "age": 43, "id": "1", + "age": 43, }, Table: "users", @@ -178,3 +122,59 @@ Table: "users", 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: "users", + + }) + fmt.Println(rsp, err) +} +``` +## Delete + +Delete a record in the database by id. + + +[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Delete a record in the database by id. +func DeleteArecord() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Delete(&db.DeleteRequest{ + Id: "1", +Table: "users", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/db/create/createARecord.go b/examples/db/create/createARecord.go index 688b6e8..456564c 100755 --- a/examples/db/create/createARecord.go +++ b/examples/db/create/createARecord.go @@ -12,10 +12,10 @@ func CreateArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Create(&db.CreateRequest{ Record: map[string]interface{}{ + "id": "1", "name": "Jane", "age": 42, "isActive": true, - "id": "1", }, Table: "users", }) diff --git a/examples/db/update/updateARecord.go b/examples/db/update/updateARecord.go index 3a9822b..378a5d6 100755 --- a/examples/db/update/updateARecord.go +++ b/examples/db/update/updateARecord.go @@ -12,8 +12,8 @@ func UpdateArecord() { dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) rsp, err := dbService.Update(&db.UpdateRequest{ Record: map[string]interface{}{ - "age": 43, "id": "1", + "age": 43, }, Table: "users", }) diff --git a/examples/emoji/README.md b/examples/emoji/README.md index f6859b4..8907f04 100755 --- a/examples/emoji/README.md +++ b/examples/emoji/README.md @@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](htt Endpoints: +## Flag + +Get the flag for a country. Requires country code e.g GB for great britain + + +[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/emoji" +) + +// Get the flag for a country. Requires country code e.g GB for great britain +func GetFlagByCountryCode() { + emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) + rsp, err := emojiService.Flag(&emoji.FlagRequest{ + + }) + fmt.Println(rsp, err) +} +``` +## 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) +} +``` ## Send Send an emoji to anyone via SMS. Messages are sent in the form ' Sent from ' @@ -60,58 +115,3 @@ func FindEmoji() { fmt.Println(rsp, err) } ``` -## Flag - -Get the flag for a country. Requires country code e.g GB for great britain - - -[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/emoji" -) - -// Get the flag for a country. Requires country code e.g GB for great britain -func GetFlagByCountryCode() { - emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) - rsp, err := emojiService.Flag(&emoji.FlagRequest{ - - }) - fmt.Println(rsp, err) -} -``` -## 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/forex/README.md b/examples/forex/README.md index 3cea13c..8fe80a6 100755 --- a/examples/forex/README.md +++ b/examples/forex/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](htt Endpoints: -## History - -Returns the data for the previous close - - -[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/forex" -) - -// Returns the data for the previous close -func GetPreviousClose() { - forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN")) - rsp, err := forexService.History(&forex.HistoryRequest{ - Symbol: "GBPUSD", - - }) - fmt.Println(rsp, err) -} -``` ## Price Get the latest price for a given forex ticker @@ -85,3 +58,30 @@ func GetAfxQuote() { fmt.Println(rsp, err) } ``` +## History + +Returns the data for the previous close + + +[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/forex" +) + +// Returns the data for the previous close +func GetPreviousClose() { + forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN")) + rsp, err := forexService.History(&forex.HistoryRequest{ + Symbol: "GBPUSD", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/function/README.md b/examples/function/README.md index 886738f..3a72ea5 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api]( Endpoints: -## 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: "my-first-func", -Project: "tests", - - }) - 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: "my-first-func", -Project: "tests", - - }) - fmt.Println(rsp, err) -} -``` ## Deploy Deploy a group of functions @@ -146,3 +90,59 @@ func ListFunctions() { 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: "my-first-func", +Project: "tests", + + }) + 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: "my-first-func", +Project: "tests", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/location/README.md b/examples/location/README.md index 999a2ca..828fe78 100755 --- a/examples/location/README.md +++ b/examples/location/README.md @@ -4,39 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Location/api]( Endpoints: -## Search - -Search for entities in a given radius - - -[https://m3o.com/location/api#Search](https://m3o.com/location/api#Search) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/location" -) - -// Search for entities in a given radius -func SearchForLocations() { - locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN")) - rsp, err := locationService.Search(&location.SearchRequest{ - Center: &location.Point{ - Latitude: 51.511061, - Longitude: -0.120022, - }, -NumEntities: 10, -Radius: 100, -Type: "bike", - - }) - fmt.Println(rsp, err) -} -``` ## Save Save an entity's current position @@ -99,3 +66,36 @@ func GetLocationById() { fmt.Println(rsp, err) } ``` +## Search + +Search for entities in a given radius + + +[https://m3o.com/location/api#Search](https://m3o.com/location/api#Search) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/location" +) + +// Search for entities in a given radius +func SearchForLocations() { + locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN")) + rsp, err := locationService.Search(&location.SearchRequest{ + Center: &location.Point{ + Latitude: 51.511061, + Longitude: -0.120022, + }, +NumEntities: 10, +Radius: 100, +Type: "bike", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/notes/README.md b/examples/notes/README.md index 6e2f3e9..53f94d3 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,6 +4,32 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt Endpoints: +## List + +List all the notes + + +[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// List all the notes +func ListAllNotes() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.List(¬es.ListRequest{ + + }) + fmt.Println(rsp, err) +} +``` ## Update Update a note @@ -144,29 +170,3 @@ func ReadAnote() { 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/quran/README.md b/examples/quran/README.md index 1a0da95..79165db 100755 --- a/examples/quran/README.md +++ b/examples/quran/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Quran/api](htt Endpoints: -## Search - -Search the Quran for any form of query or questions - - -[https://m3o.com/quran/api#Search](https://m3o.com/quran/api#Search) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/quran" -) - -// Search the Quran for any form of query or questions -func SearchTheQuran() { - quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) - rsp, err := quranService.Search(&quran.SearchRequest{ - Query: "messenger", - - }) - fmt.Println(rsp, err) -} -``` ## Chapters List the Chapters (surahs) of the Quran @@ -116,3 +89,30 @@ func GetVersesOfAchapter() { fmt.Println(rsp, err) } ``` +## Search + +Search the Quran for any form of query or questions + + +[https://m3o.com/quran/api#Search](https://m3o.com/quran/api#Search) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/quran" +) + +// Search the Quran for any form of query or questions +func SearchTheQuran() { + quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) + rsp, err := quranService.Search(&quran.SearchRequest{ + Query: "messenger", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/routing/README.md b/examples/routing/README.md index 8f4968f..1f0e61c 100755 --- a/examples/routing/README.md +++ b/examples/routing/README.md @@ -4,40 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Routing/api](h Endpoints: -## Eta - -Get the eta for a route from origin to destination. The eta is an estimated time based on car routes - - -[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/routing" -) - -// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes -func EtaFromPointAtoPointB() { - routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN")) - rsp, err := routingService.Eta(&routing.EtaRequest{ - Destination: &routing.Point{ - Latitude: 52.529407, - Longitude: 13.397634, -}, -Origin: &routing.Point{ - Latitude: 52.517037, - Longitude: 13.38886, -}, - - }) - fmt.Println(rsp, err) -} -``` ## Directions Turn by turn directions from a start point to an end point including maneuvers and bearings @@ -106,3 +72,37 @@ Origin: &routing.Point{ fmt.Println(rsp, err) } ``` +## Eta + +Get the eta for a route from origin to destination. The eta is an estimated time based on car routes + + +[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/routing" +) + +// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes +func EtaFromPointAtoPointB() { + routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN")) + rsp, err := routingService.Eta(&routing.EtaRequest{ + Destination: &routing.Point{ + Latitude: 52.529407, + Longitude: 13.397634, +}, +Origin: &routing.Point{ + Latitude: 52.517037, + Longitude: 13.38886, +}, + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/rss/README.md b/examples/rss/README.md index bf20bf2..439a4f5 100755 --- a/examples/rss/README.md +++ b/examples/rss/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Rss/api](https Endpoints: -## Remove - -Remove an RSS feed by name - - -[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/rss" -) - -// Remove an RSS feed by name -func RemoveAfeed() { - rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) - rsp, err := rssService.Remove(&rss.RemoveRequest{ - Name: "bbc", - - }) - fmt.Println(rsp, err) -} -``` ## Add Add a new RSS feed with a name, url, and category @@ -113,3 +86,30 @@ func ListRssFeeds() { fmt.Println(rsp, err) } ``` +## Remove + +Remove an RSS feed by name + + +[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/rss" +) + +// Remove an RSS feed by name +func RemoveAfeed() { + rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) + rsp, err := rssService.Remove(&rss.RemoveRequest{ + Name: "bbc", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/stock/README.md b/examples/stock/README.md index 88bbec7..9dda59f 100755 --- a/examples/stock/README.md +++ b/examples/stock/README.md @@ -4,60 +4,6 @@ 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 @@ -117,3 +63,57 @@ Stock: "AAPL", fmt.Println(rsp, err) } ``` +## 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/stream/README.md b/examples/stream/README.md index b67534c..21899b7 100755 --- a/examples/stream/README.md +++ b/examples/stream/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](ht Endpoints: +## Subscribe + +Subscribe to messages for a given topic. + + +[https://m3o.com/stream/api#Subscribe](https://m3o.com/stream/api#Subscribe) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stream" +) + +// Subscribe to messages for a given topic. +func SubscribeToAtopic() { + streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) + rsp, err := streamService.Subscribe(&stream.SubscribeRequest{ + Topic: "events", + + }) + fmt.Println(rsp, err) +} +``` ## Publish Publish a message to the stream. Specify a topic to group messages for a specific topic. @@ -36,30 +63,3 @@ Topic: "events", fmt.Println(rsp, err) } ``` -## Subscribe - -Subscribe to messages for a given topic. - - -[https://m3o.com/stream/api#Subscribe](https://m3o.com/stream/api#Subscribe) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stream" -) - -// Subscribe to messages for a given topic. -func SubscribeToAtopic() { - streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) - rsp, err := streamService.Subscribe(&stream.SubscribeRequest{ - Topic: "events", - - }) - fmt.Println(rsp, err) -} -``` diff --git a/examples/stream/publish/publishAMessage.go b/examples/stream/publish/publishAMessage.go index aa3fe64..95108c2 100755 --- a/examples/stream/publish/publishAMessage.go +++ b/examples/stream/publish/publishAMessage.go @@ -12,9 +12,9 @@ func PublishAmessage() { streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) rsp, err := streamService.Publish(&stream.PublishRequest{ Message: map[string]interface{}{ + "id": "1", "type": "signup", "user": "john", - "id": "1", }, Topic: "events", }) diff --git a/examples/sunnah/README.md b/examples/sunnah/README.md index 6d24e69..e450b78 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,36 +4,6 @@ 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 @@ -119,3 +89,33 @@ Collection: "bukhari", fmt.Println(rsp, err) } ``` +## 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/url/README.md b/examples/url/README.md index 314e672..fb798cd 100755 --- a/examples/url/README.md +++ b/examples/url/README.md @@ -4,32 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Url/api](https Endpoints: -## List - -List information on all the shortened URLs that you have created - - -[https://m3o.com/url/api#List](https://m3o.com/url/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/url" -) - -// List information on all the shortened URLs that you have created -func ListYourShortenedUrls() { - urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN")) - rsp, err := urlService.List(&url.ListRequest{ - - }) - fmt.Println(rsp, err) -} -``` ## Shorten Shortens a destination URL and returns a full short URL. @@ -82,3 +56,29 @@ func ResolveAshortUrlToAlongDestinationUrl() { fmt.Println(rsp, err) } ``` +## List + +List information on all the shortened URLs that you have created + + +[https://m3o.com/url/api#List](https://m3o.com/url/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/url" +) + +// List information on all the shortened URLs that you have created +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 514f068..ff56e9f 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,65 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http Endpoints: -## 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: "usrid-1", -Password: "mySecretPass123", -Username: "usrname-1", - - }) - fmt.Println(rsp, err) -} -``` -## UpdatePassword - -Update the account password - - -[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Update the account password -func UpdateTheAccountPassword() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{ - ConfirmPassword: "myEvenMoreSecretPass123", -NewPassword: "myEvenMoreSecretPass123", -OldPassword: "mySecretPass123", - - }) - fmt.Println(rsp, err) -} -``` ## Read Read an account by id, username or email. Only one need to be specified. @@ -144,88 +85,6 @@ func ReadAccountByEmail() { 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: "fdf34f34f34-f34f34-f43f43f34-f4f34f", - - }) - 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: "sds34s34s34-s34s34-s43s43s34-s4s34s", - - }) - 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: "joeotheremail@example.com", -Id: "usrid-1", - - }) - fmt.Println(rsp, err) -} -``` ## SendVerificationEmail Send a verification email @@ -299,6 +158,117 @@ func VerifyEmail() { 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: "sds34s34s34-s34s34-s43s43s34-s4s34s", + + }) + 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: "joeotheremail@example.com", +Id: "usrid-1", + + }) + fmt.Println(rsp, err) +} +``` +## UpdatePassword + +Update the account password + + +[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Update the account password +func UpdateTheAccountPassword() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{ + ConfirmPassword: "myEvenMoreSecretPass123", +NewPassword: "myEvenMoreSecretPass123", +OldPassword: "mySecretPass123", + + }) + 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: "fdf34f34f34-f34f34-f43f43f34-f4f34f", + + }) + fmt.Println(rsp, err) +} +``` ## Login Login using username or email. The response will return a new session for successful login, @@ -356,3 +326,33 @@ func LogAuserOut() { 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: "usrid-1", +Password: "mySecretPass123", +Username: "usrname-1", + + }) + fmt.Println(rsp, err) +} +```