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 25513bb..841fcfc 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,98 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https: Endpoints: -## Create - -Create a record in the database. Optionally include an "id" field otherwise it's set automatically. - - -[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. -func CreateArecord() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Create(&db.CreateRequest{ - Record: map[string]interface{}{ - "isActive": true, - "id": "1", - "name": "Jane", - "age": 42, -}, -Table: "users", - - }) - 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: "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. @@ -178,3 +86,95 @@ func CountEntriesInAtable() { fmt.Println(rsp, err) } ``` +## Create + +Create a record in the database. Optionally include an "id" field otherwise it's set automatically. + + +[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. +func CreateArecord() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Create(&db.CreateRequest{ + Record: map[string]interface{}{ + "id": "1", + "name": "Jane", + "age": 42, + "isActive": true, +}, +Table: "users", + + }) + fmt.Println(rsp, err) +} +``` +## Update + +Update a record in the database. Include an "id" in the record to update. + + +[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Update a record in the database. Include an "id" in the record to update. +func UpdateArecord() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Update(&db.UpdateRequest{ + Record: map[string]interface{}{ + "age": 43, + "id": "1", +}, +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) +} +``` diff --git a/examples/db/update/updateARecord.go b/examples/db/update/updateARecord.go index 378a5d6..3a9822b 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{}{ - "id": "1", "age": 43, + "id": "1", }, Table: "users", }) diff --git a/examples/emoji/README.md b/examples/emoji/README.md index af78e78..f6859b4 100755 --- a/examples/emoji/README.md +++ b/examples/emoji/README.md @@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](htt Endpoints: +## Send + +Send an emoji to anyone via SMS. Messages are sent in the form ' Sent from ' + + +[https://m3o.com/emoji/api#Send](https://m3o.com/emoji/api#Send) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/emoji" +) + +// Send an emoji to anyone via SMS. Messages are sent in the form ' Sent from ' +func SendAtextContainingAnEmojiToAnyoneViaSms() { + emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) + rsp, err := emojiService.Send(&emoji.SendRequest{ + From: "Alice", +Message: "let's grab a :beer:", +To: "+44782669123", + + }) + fmt.Println(rsp, err) +} +``` ## Find Find an emoji by its alias e.g :beer: @@ -86,32 +115,3 @@ func PrintTextIncludingEmoji() { fmt.Println(rsp, err) } ``` -## Send - -Send an emoji to anyone via SMS. Messages are sent in the form ' Sent from ' - - -[https://m3o.com/emoji/api#Send](https://m3o.com/emoji/api#Send) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/emoji" -) - -// Send an emoji to anyone via SMS. Messages are sent in the form ' Sent from ' -func SendAtextContainingAnEmojiToAnyoneViaSms() { - emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN")) - rsp, err := emojiService.Send(&emoji.SendRequest{ - From: "Alice", -Message: "let's grab a :beer:", -To: "+44782669123", - - }) - fmt.Println(rsp, err) -} -``` diff --git a/examples/file/README.md b/examples/file/README.md index 6534b12..68a6a0a 100755 --- a/examples/file/README.md +++ b/examples/file/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](http Endpoints: -## Read - -Read a file by path - - -[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/file" -) - -// Read a file by path -func ReadFile() { - fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) - rsp, err := fileService.Read(&file.ReadRequest{ - Path: "/document/text-files/file.txt", -Project: "examples", - - }) - fmt.Println(rsp, err) -} -``` ## Save Save a file @@ -118,3 +90,31 @@ Project: "examples", fmt.Println(rsp, err) } ``` +## Read + +Read a file by path + + +[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/file" +) + +// Read a file by path +func ReadFile() { + fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) + rsp, err := fileService.Read(&file.ReadRequest{ + Path: "/document/text-files/file.txt", +Project: "examples", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/geocoding/README.md b/examples/geocoding/README.md index 448d333..4ac78c5 100755 --- a/examples/geocoding/README.md +++ b/examples/geocoding/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Geocoding/api] Endpoints: +## Reverse + +Reverse lookup an address from gps coordinates + + +[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/geocoding" +) + +// Reverse lookup an address from gps coordinates +func ReverseGeocodeLocation() { + geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN")) + rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{ + Latitude: 51.5123064, +Longitude: -0.1216235, + + }) + fmt.Println(rsp, err) +} +``` ## Lookup Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results @@ -34,31 +62,3 @@ Postcode: "wc2b", fmt.Println(rsp, err) } ``` -## Reverse - -Reverse lookup an address from gps coordinates - - -[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/geocoding" -) - -// Reverse lookup an address from gps coordinates -func ReverseGeocodeLocation() { - geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN")) - rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{ - Latitude: 51.5123064, -Longitude: -0.1216235, - - }) - fmt.Println(rsp, err) -} -``` diff --git a/examples/mq/README.md b/examples/mq/README.md index 83dced6..b6a63bf 100755 --- a/examples/mq/README.md +++ b/examples/mq/README.md @@ -6,7 +6,7 @@ Endpoints: ## Publish -Publish a message to the mq. Specify a topic to group messages for a specific topic. +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) @@ -21,7 +21,7 @@ import( "go.m3o.com/mq" ) -// Publish a message to the mq. Specify a topic to group messages for a specific topic. +// 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{ diff --git a/examples/mq/publish/publishAMessage.go b/examples/mq/publish/publishAMessage.go index 420b6d0..e78ac1a 100755 --- a/examples/mq/publish/publishAMessage.go +++ b/examples/mq/publish/publishAMessage.go @@ -7,14 +7,14 @@ import ( "go.m3o.com/mq" ) -// Publish a message to the mq. Specify a topic to group messages for a specific topic. +// Publish a message. Specify a topic to group messages for a specific topic. func PublishAmessage() { mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) rsp, err := mqService.Publish(&mq.PublishRequest{ Message: map[string]interface{}{ - "user": "john", "id": "1", "type": "signup", + "user": "john", }, Topic: "events", }) diff --git a/examples/notes/README.md b/examples/notes/README.md index f0ef1cc..81a5075 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,88 +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")) - rsp, err := notesService.Events(¬es.EventsRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - fmt.Println(rsp, err) -} -``` -## Create - -Create a new note - - -[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Create a new note -func CreateAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Create(¬es.CreateRequest{ - Text: "This is my note", -Title: "New Note", - - }) - fmt.Println(rsp, err) -} -``` -## Read - -Read a note - - -[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Read a note -func ReadAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Read(¬es.ReadRequest{ - Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", - - }) - fmt.Println(rsp, err) -} -``` ## List List all the notes @@ -170,3 +88,85 @@ func DeleteAnote() { fmt.Println(rsp, err) } ``` +## 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")) + rsp, err := notesService.Events(¬es.EventsRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + fmt.Println(rsp, err) +} +``` +## Create + +Create a new note + + +[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Create a new note +func CreateAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Create(¬es.CreateRequest{ + Text: "This is my note", +Title: "New Note", + + }) + fmt.Println(rsp, err) +} +``` +## Read + +Read a note + + +[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Read a note +func ReadAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Read(¬es.ReadRequest{ + Id: "63c0cdf8-2121-11ec-a881-0242e36f037a", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/otp/README.md b/examples/otp/README.md index d1ab2a1..001b680 100755 --- a/examples/otp/README.md +++ b/examples/otp/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Otp/api](https Endpoints: -## Generate - -Generate an OTP (one time pass) code - - -[https://m3o.com/otp/api#Generate](https://m3o.com/otp/api#Generate) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/otp" -) - -// Generate an OTP (one time pass) code -func GenerateOtp() { - otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN")) - rsp, err := otpService.Generate(&otp.GenerateRequest{ - Id: "asim@example.com", - - }) - fmt.Println(rsp, err) -} -``` ## Validate Validate the OTP code @@ -59,3 +32,30 @@ Id: "asim@example.com", fmt.Println(rsp, err) } ``` +## Generate + +Generate an OTP (one time pass) code + + +[https://m3o.com/otp/api#Generate](https://m3o.com/otp/api#Generate) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/otp" +) + +// Generate an OTP (one time pass) code +func GenerateOtp() { + otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN")) + rsp, err := otpService.Generate(&otp.GenerateRequest{ + Id: "asim@example.com", + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/quran/README.md b/examples/quran/README.md index 1e8ba4d..79165db 100755 --- a/examples/quran/README.md +++ b/examples/quran/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Quran/api](htt Endpoints: +## Chapters + +List the Chapters (surahs) of the Quran + + +[https://m3o.com/quran/api#Chapters](https://m3o.com/quran/api#Chapters) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/quran" +) + +// List the Chapters (surahs) of the Quran +func ListChapters() { + quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) + rsp, err := quranService.Chapters(&quran.ChaptersRequest{ + Language: "en", + + }) + fmt.Println(rsp, err) +} +``` ## Summary Get a summary for a given chapter (surah) @@ -89,30 +116,3 @@ func SearchTheQuran() { fmt.Println(rsp, err) } ``` -## Chapters - -List the Chapters (surahs) of the Quran - - -[https://m3o.com/quran/api#Chapters](https://m3o.com/quran/api#Chapters) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/quran" -) - -// List the Chapters (surahs) of the Quran -func ListChapters() { - quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN")) - rsp, err := quranService.Chapters(&quran.ChaptersRequest{ - Language: "en", - - }) - fmt.Println(rsp, err) -} -``` diff --git a/examples/routing/README.md b/examples/routing/README.md index 1f0e61c..8f4968f 100755 --- a/examples/routing/README.md +++ b/examples/routing/README.md @@ -4,6 +4,40 @@ 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 @@ -72,37 +106,3 @@ 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/sunnah/README.md b/examples/sunnah/README.md index e450b78..8f2aa8f 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sunnah/api](ht Endpoints: -## Collections - -Get a list of available collections. A collection is -a compilation of hadiths collected and written by an author. - - -[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/sunnah" -) - -// Get a list of available collections. A collection is -// a compilation of hadiths collected and written by an author. -func ListAvailableCollections() { - sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) - rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{ - - }) - fmt.Println(rsp, err) -} -``` ## Books Get a list of books from within a collection. A book can contain many chapters @@ -119,3 +91,31 @@ Collection: "bukhari", fmt.Println(rsp, err) } ``` +## Collections + +Get a list of available collections. A collection is +a compilation of hadiths collected and written by an author. + + +[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/sunnah" +) + +// Get a list of available collections. A collection is +// a compilation of hadiths collected and written by an author. +func ListAvailableCollections() { + sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) + rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{ + + }) + fmt.Println(rsp, err) +} +``` diff --git a/examples/user/README.md b/examples/user/README.md index 3397d35..901b411 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http Endpoints: -## UpdatePassword +## Update -Update the account password +Update the account username or email -[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword) +[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update) ```go package example @@ -21,13 +21,12 @@ import( "go.m3o.com/user" ) -// Update the account password -func UpdateTheAccountPassword() { +// Update the account username or email +func UpdateAnAccount() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{ - ConfirmPassword: "myEvenMoreSecretPass123", -NewPassword: "myEvenMoreSecretPass123", -OldPassword: "mySecretPass123", + rsp, err := userService.Update(&user.UpdateRequest{ + Email: "joeotheremail@example.com", +Id: "usrid-1", }) fmt.Println(rsp, err) @@ -117,33 +116,6 @@ Password: "mySecretPass123", 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: "sds34s34s34-s34s34-s43s43s34-s4s34s", - - }) - fmt.Println(rsp, err) -} -``` ## Create Create a new user account. The email address and username for the account must be unique. @@ -174,34 +146,6 @@ Username: "usrname-1", 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) -} -``` ## Read Read an account by id, username or email. Only one need to be specified. @@ -329,6 +273,33 @@ Please verify your email by clicking this link: $micro_verification_link`, 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: "sds34s34s34-s34s34-s43s43s34-s4s34s", + + }) + 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. @@ -356,3 +327,32 @@ func ReadAsessionByTheSessionId() { 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) +} +``` diff --git a/m3o.go b/m3o.go index 20bc035..5bcf974 100755 --- a/m3o.go +++ b/m3o.go @@ -35,7 +35,6 @@ import ( "go.m3o.com/sentiment" "go.m3o.com/sms" "go.m3o.com/stock" - "go.m3o.com/stream" "go.m3o.com/sunnah" "go.m3o.com/thumbnail" "go.m3o.com/time" @@ -85,7 +84,6 @@ func NewClient(token string) *Client { SentimentService: sentiment.NewSentimentService(token), SmsService: sms.NewSmsService(token), StockService: stock.NewStockService(token), - StreamService: stream.NewStreamService(token), SunnahService: sunnah.NewSunnahService(token), ThumbnailService: thumbnail.NewThumbnailService(token), TimeService: time.NewTimeService(token), @@ -135,7 +133,6 @@ type Client struct { SentimentService *sentiment.SentimentService SmsService *sms.SmsService StockService *stock.StockService - StreamService *stream.StreamService SunnahService *sunnah.SunnahService ThumbnailService *thumbnail.ThumbnailService TimeService *time.TimeService diff --git a/mq/mq.go b/mq/mq.go index 647fa23..8272b3e 100755 --- a/mq/mq.go +++ b/mq/mq.go @@ -16,7 +16,7 @@ type MqService struct { client *client.Client } -// Publish a message to the mq. Specify a topic to group messages for a specific topic. +// Publish a message. Specify a topic to group messages for a specific topic. func (t *MqService) Publish(request *PublishRequest) (*PublishResponse, error) { rsp := &PublishResponse{} return rsp, t.client.Call("mq", "Publish", request, rsp)