From 53a197a685b62e3feac3e0c19870bcbf1908dada Mon Sep 17 00:00:00 2001 From: m3o-actions <> Date: Thu, 11 Nov 2021 10:57:32 +0000 Subject: [PATCH] Commit from m3o/m3o action --- examples/currency/README.md | 118 +++---- examples/db/README.md | 56 ++-- examples/event/publish/publishAnEvent/main.go | 2 +- examples/forex/README.md | 56 ++-- examples/function/README.md | 64 ++-- examples/mq/README.md | 66 ++-- examples/notes/README.md | 58 ++-- examples/otp/README.md | 56 ++-- examples/postcode/README.md | 56 ++-- examples/rss/README.md | 110 +++---- examples/stock/README.md | 64 ++-- examples/sunnah/README.md | 60 ++-- examples/twitter/README.md | 54 ++-- examples/user/README.md | 288 +++++++++--------- 14 files changed, 554 insertions(+), 554 deletions(-) diff --git a/examples/currency/README.md b/examples/currency/README.md index 773caf3..bf674d6 100755 --- a/examples/currency/README.md +++ b/examples/currency/README.md @@ -4,6 +4,65 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api]( Endpoints: +## Convert + +Convert returns the currency conversion rate between two pairs e.g USD/GBP + + +[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/currency" +) + +// Convert returns the currency conversion rate between two pairs e.g USD/GBP +func ConvertUsdToGbp() { + currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) + rsp, err := currencyService.Convert(¤cy.ConvertRequest{ + From: "USD", +To: "GBP", + + }) + fmt.Println(rsp, err) + +} +``` +## Convert + +Convert returns the currency conversion rate between two pairs e.g USD/GBP + + +[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/currency" +) + +// Convert returns the currency conversion rate between two pairs e.g USD/GBP +func Convert10usdToGbp() { + currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) + rsp, err := currencyService.Convert(¤cy.ConvertRequest{ + Amount: 10, +From: "USD", +To: "GBP", + + }) + fmt.Println(rsp, err) + +} +``` ## History Returns the historic rates for a currency on a given date @@ -88,62 +147,3 @@ func GetRatesForUsd() { } ``` -## Convert - -Convert returns the currency conversion rate between two pairs e.g USD/GBP - - -[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/currency" -) - -// Convert returns the currency conversion rate between two pairs e.g USD/GBP -func ConvertUsdToGbp() { - currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) - rsp, err := currencyService.Convert(¤cy.ConvertRequest{ - From: "USD", -To: "GBP", - - }) - fmt.Println(rsp, err) - -} -``` -## Convert - -Convert returns the currency conversion rate between two pairs e.g USD/GBP - - -[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/currency" -) - -// Convert returns the currency conversion rate between two pairs e.g USD/GBP -func Convert10usdToGbp() { - currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN")) - rsp, err := currencyService.Convert(¤cy.ConvertRequest{ - Amount: 10, -From: "USD", -To: "GBP", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/db/README.md b/examples/db/README.md index e390a54..2738df7 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https: Endpoints: +## Count + +Count records in a table + + +[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/db" +) + +// Count records in a table +func CountEntriesInAtable() { + dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) + rsp, err := dbService.Count(&db.CountRequest{ + Table: "users", + + }) + fmt.Println(rsp, err) + +} +``` ## Create Create a record in the database. Optionally include an "id" field otherwise it's set automatically. @@ -156,31 +184,3 @@ func TruncateTable() { } ``` -## Count - -Count records in a table - - -[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/db" -) - -// Count records in a table -func CountEntriesInAtable() { - dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) - rsp, err := dbService.Count(&db.CountRequest{ - Table: "users", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/event/publish/publishAnEvent/main.go b/examples/event/publish/publishAnEvent/main.go index 49e4e18..037cd17 100755 --- a/examples/event/publish/publishAnEvent/main.go +++ b/examples/event/publish/publishAnEvent/main.go @@ -12,9 +12,9 @@ func main() { eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) rsp, err := eventService.Publish(&event.PublishRequest{ Message: map[string]interface{}{ - "id": "1", "type": "signup", "user": "john", + "id": "1", }, Topic: "user", }) diff --git a/examples/forex/README.md b/examples/forex/README.md index 076f73a..2be477d 100755 --- a/examples/forex/README.md +++ b/examples/forex/README.md @@ -4,6 +4,34 @@ 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 @@ -60,31 +88,3 @@ func GetAfxQuote() { } ``` -## 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 68c5eda..0889d21 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -4,6 +4,38 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api]( Endpoints: +## Deploy + +Deploy a group of functions + + +[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Deploy a group of functions +func DeployAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Deploy(&function.DeployRequest{ + Entrypoint: "helloworld", +Name: "my-first-func", +Project: "tests", +Repo: "github.com/m3o/nodejs-function-example", +Runtime: "nodejs14", + + }) + fmt.Println(rsp, err) + +} +``` ## Call Call a function by name @@ -119,35 +151,3 @@ Project: "tests", } ``` -## Deploy - -Deploy a group of functions - - -[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Deploy a group of functions -func DeployAfunction() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Deploy(&function.DeployRequest{ - Entrypoint: "helloworld", -Name: "my-first-func", -Project: "tests", -Repo: "github.com/m3o/nodejs-function-example", -Runtime: "nodejs14", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/mq/README.md b/examples/mq/README.md index 8153f1c..9a14fd0 100755 --- a/examples/mq/README.md +++ b/examples/mq/README.md @@ -4,39 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Mq/api](https: Endpoints: -## Publish - -Publish a message. Specify a topic to group messages for a specific topic. - - -[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/mq" -) - -// Publish a message. Specify a topic to group messages for a specific topic. -func PublishAmessage() { - mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) - rsp, err := mqService.Publish(&mq.PublishRequest{ - Message: map[string]interface{}{ - "type": "signup", - "user": "john", - "id": "1", -}, -Topic: "events", - - }) - fmt.Println(rsp, err) - -} -``` ## Subscribe Subscribe to messages for a given topic. @@ -78,3 +45,36 @@ func SubscribeToAtopic() { } } ``` +## Publish + +Publish a message. Specify a topic to group messages for a specific topic. + + +[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/mq" +) + +// Publish a message. Specify a topic to group messages for a specific topic. +func PublishAmessage() { + mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) + rsp, err := mqService.Publish(&mq.PublishRequest{ + Message: map[string]interface{}{ + "id": "1", + "type": "signup", + "user": "john", +}, +Topic: "events", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/notes/README.md b/examples/notes/README.md index 9b7f4c8..3d9f237 100755 --- a/examples/notes/README.md +++ b/examples/notes/README.md @@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt Endpoints: +## Create + +Create a new note + + +[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/notes" +) + +// Create a new note +func CreateAnote() { + notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) + rsp, err := notesService.Create(¬es.CreateRequest{ + Text: "This is my note", +Title: "New Note", + + }) + fmt.Println(rsp, err) + +} +``` ## Read Read a note @@ -160,32 +189,3 @@ func SubscribeToEvents() { } } ``` -## Create - -Create a new note - - -[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/notes" -) - -// Create a new note -func CreateAnote() { - notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN")) - rsp, err := notesService.Create(¬es.CreateRequest{ - Text: "This is my note", -Title: "New Note", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/otp/README.md b/examples/otp/README.md index c643291..66d4d50 100755 --- a/examples/otp/README.md +++ b/examples/otp/README.md @@ -4,34 +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 @@ -61,3 +33,31 @@ Id: "asim@example.com", } ``` +## 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/postcode/README.md b/examples/postcode/README.md index 0ce5559..cccb09a 100755 --- a/examples/postcode/README.md +++ b/examples/postcode/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Postcode/api]( Endpoints: -## Validate - -Validate a postcode. - - -[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/postcode" -) - -// Validate a postcode. -func ReturnArandomPostcodeAndItsInformation() { - postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN")) - rsp, err := postcodeService.Validate(&postcode.ValidateRequest{ - Postcode: "SW1A 2AA", - - }) - fmt.Println(rsp, err) - -} -``` ## Lookup Lookup a postcode to retrieve the related region, county, etc @@ -87,3 +59,31 @@ func ReturnArandomPostcodeAndItsInformation() { } ``` +## Validate + +Validate a postcode. + + +[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/postcode" +) + +// Validate a postcode. +func ReturnArandomPostcodeAndItsInformation() { + postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN")) + rsp, err := postcodeService.Validate(&postcode.ValidateRequest{ + Postcode: "SW1A 2AA", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/rss/README.md b/examples/rss/README.md index bde5033..62d0224 100755 --- a/examples/rss/README.md +++ b/examples/rss/README.md @@ -4,61 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Rss/api](https Endpoints: -## List - -List the saved RSS fields - - -[https://m3o.com/rss/api#List](https://m3o.com/rss/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/rss" -) - -// List the saved RSS fields -func ListRssFeeds() { - rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) - rsp, err := rssService.List(&rss.ListRequest{ - - }) - 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) - -} -``` ## Add Add a new RSS feed with a name, url, and category @@ -117,3 +62,58 @@ func ReadAfeed() { } ``` +## List + +List the saved RSS fields + + +[https://m3o.com/rss/api#List](https://m3o.com/rss/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/rss" +) + +// List the saved RSS fields +func ListRssFeeds() { + rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN")) + rsp, err := rssService.List(&rss.ListRequest{ + + }) + 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 4983276..b627a34 100755 --- a/examples/stock/README.md +++ b/examples/stock/README.md @@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stock/api](htt Endpoints: -## OrderBook - -Get the historic order book and each trade by timestamp - - -[https://m3o.com/stock/api#OrderBook](https://m3o.com/stock/api#OrderBook) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stock" -) - -// Get the historic order book and each trade by timestamp -func OrderBookHistory() { - stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) - rsp, err := stockService.OrderBook(&stock.OrderBookRequest{ - Date: "2020-10-01", -End: "2020-10-01T11:00:00Z", -Limit: 3, -Start: "2020-10-01T10:00:00Z", -Stock: "AAPL", - - }) - fmt.Println(rsp, err) - -} -``` ## Price Get the last price for a given stock ticker @@ -121,3 +89,35 @@ Stock: "AAPL", } ``` +## OrderBook + +Get the historic order book and each trade by timestamp + + +[https://m3o.com/stock/api#OrderBook](https://m3o.com/stock/api#OrderBook) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stock" +) + +// Get the historic order book and each trade by timestamp +func OrderBookHistory() { + stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN")) + rsp, err := stockService.OrderBook(&stock.OrderBookRequest{ + Date: "2020-10-01", +End: "2020-10-01T11:00:00Z", +Limit: 3, +Start: "2020-10-01T10:00:00Z", +Stock: "AAPL", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/sunnah/README.md b/examples/sunnah/README.md index 2b42fdf..7b24889 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,6 +4,36 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sunnah/api](ht Endpoints: +## Books + +Get a list of books from within a collection. A book can contain many chapters +each with its own hadiths. + + +[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/sunnah" +) + +// Get a list of books from within a collection. A book can contain many chapters +// each with its own hadiths. +func GetTheBooksWithinAcollection() { + sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) + rsp, err := sunnahService.Books(&sunnah.BooksRequest{ + Collection: "bukhari", + + }) + fmt.Println(rsp, err) + +} +``` ## Chapters Get all the chapters of a given book within a collection. @@ -93,33 +123,3 @@ func ListAvailableCollections() { } ``` -## Books - -Get a list of books from within a collection. A book can contain many chapters -each with its own hadiths. - - -[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/sunnah" -) - -// Get a list of books from within a collection. A book can contain many chapters -// each with its own hadiths. -func GetTheBooksWithinAcollection() { - sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN")) - rsp, err := sunnahService.Books(&sunnah.BooksRequest{ - Collection: "bukhari", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/twitter/README.md b/examples/twitter/README.md index fd92920..f11d086 100755 --- a/examples/twitter/README.md +++ b/examples/twitter/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Twitter/api](h Endpoints: +## Trends + +Get the current global trending topics + + +[https://m3o.com/twitter/api#Trends](https://m3o.com/twitter/api#Trends) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/twitter" +) + +// Get the current global trending topics +func GetTheCurrentGlobalTrendingTopics() { + twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) + rsp, err := twitterService.Trends(&twitter.TrendsRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## User Get a user's twitter profile @@ -89,30 +116,3 @@ func SearchForTweets() { } ``` -## Trends - -Get the current global trending topics - - -[https://m3o.com/twitter/api#Trends](https://m3o.com/twitter/api#Trends) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/twitter" -) - -// Get the current global trending topics -func GetTheCurrentGlobalTrendingTopics() { - twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) - rsp, err := twitterService.Trends(&twitter.TrendsRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/user/README.md b/examples/user/README.md index 3349a08..4086c5f 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,12 +4,18 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http Endpoints: -## Read +## SendVerificationEmail -Read an account by id, username or email. Only one need to be specified. +Send a verification email +to the user being signed up. Email from will be from 'support@m3o.com', +but you can provide the title and contents. +The verification link will be injected in to the email as a template variable, $micro_verification_link. +Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' +The variable will be replaced with an actual url that will look similar to this: +'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' -[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) +[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail) ```go package example @@ -21,67 +27,52 @@ import( "go.m3o.com/user" ) -// Read an account by id, username or email. Only one need to be specified. -func ReadAnAccountById() { +// Send a verification email +// to the user being signed up. Email from will be from 'support@m3o.com', +// but you can provide the title and contents. +// The verification link will be injected in to the email as a template variable, $micro_verification_link. +// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' +// The variable will be replaced with an actual url that will look similar to this: +// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' +func SendVerificationEmail() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Read(&user.ReadRequest{ - Id: "usrid-1", - - }) - fmt.Println(rsp, err) - -} -``` -## Read - -Read an account by id, username or email. Only one need to be specified. - - -[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Read an account by id, username or email. Only one need to be specified. -func ReadAccountByUsernameOrEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Read(&user.ReadRequest{ - Username: "usrname-1", - - }) - fmt.Println(rsp, err) - -} -``` -## Read - -Read an account by id, username or email. Only one need to be specified. - - -[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Read an account by id, username or email. Only one need to be specified. -func ReadAccountByEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Read(&user.ReadRequest{ + rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{ Email: "joe@example.com", +FailureRedirectUrl: "https://m3o.com/verification-failed", +FromName: "Awesome Dot Com", +RedirectUrl: "https://m3o.com", +Subject: "Email verification", +TextContent: `Hi there, + +Please verify your email by clicking this link: $micro_verification_link`, + + }) + fmt.Println(rsp, err) + +} +``` +## Delete + +Delete an account by id + + +[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Delete an account by id +func DeleteUserAccount() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Delete(&user.DeleteRequest{ + Id: "fdf34f34f34-f34f34-f43f43f34-f4f34f", }) fmt.Println(rsp, err) @@ -117,6 +108,34 @@ 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 @@ -209,12 +228,12 @@ OldPassword: "mySecretPass123", } ``` -## Logout +## Read -Logout a user account +Read an account by id, username or email. Only one need to be specified. -[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout) +[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) ```go package example @@ -226,11 +245,67 @@ import( "go.m3o.com/user" ) -// Logout a user account -func LogAuserOut() { +// Read an account by id, username or email. Only one need to be specified. +func ReadAnAccountById() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Logout(&user.LogoutRequest{ - SessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s", + rsp, err := userService.Read(&user.ReadRequest{ + Id: "usrid-1", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read an account by id, username or email. Only one need to be specified. + + +[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Read an account by id, username or email. Only one need to be specified. +func ReadAccountByUsernameOrEmail() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Read(&user.ReadRequest{ + Username: "usrname-1", + + }) + fmt.Println(rsp, err) + +} +``` +## Read + +Read an account by id, username or email. Only one need to be specified. + + +[https://m3o.com/user/api#Read](https://m3o.com/user/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Read an account by id, username or email. Only one need to be specified. +func ReadAccountByEmail() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.Read(&user.ReadRequest{ + Email: "joe@example.com", }) fmt.Println(rsp, err) @@ -263,53 +338,6 @@ func ReadAsessionByTheSessionId() { }) fmt.Println(rsp, err) -} -``` -## SendVerificationEmail - -Send a verification email -to the user being signed up. Email from will be from 'support@m3o.com', -but you can provide the title and contents. -The verification link will be injected in to the email as a template variable, $micro_verification_link. -Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' -The variable will be replaced with an actual url that will look similar to this: -'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' - - -[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// Send a verification email -// to the user being signed up. Email from will be from 'support@m3o.com', -// but you can provide the title and contents. -// The verification link will be injected in to the email as a template variable, $micro_verification_link. -// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' -// The variable will be replaced with an actual url that will look similar to this: -// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' -func SendVerificationEmail() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{ - Email: "joe@example.com", -FailureRedirectUrl: "https://m3o.com/verification-failed", -FromName: "Awesome Dot Com", -RedirectUrl: "https://m3o.com", -Subject: "Email verification", -TextContent: `Hi there, - -Please verify your email by clicking this link: $micro_verification_link`, - - }) - fmt.Println(rsp, err) - } ``` ## VerifyEmail @@ -340,31 +368,3 @@ func VerifyEmail() { } ``` -## 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) - -} -```