diff --git a/address/address.go b/address/address.go index 2eb3b05..e133294 100755 --- a/address/address.go +++ b/address/address.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Address interface { + LookupPostcode(*LookupPostcodeRequest) (*LookupPostcodeResponse, error) +} + func NewAddressService(token string) *AddressService { return &AddressService{ client: client.NewClient(&client.Options{ diff --git a/answer/answer.go b/answer/answer.go index a16eb45..8562c9e 100755 --- a/answer/answer.go +++ b/answer/answer.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Answer interface { + Question(*QuestionRequest) (*QuestionResponse, error) +} + func NewAnswerService(token string) *AnswerService { return &AnswerService{ client: client.NewClient(&client.Options{ diff --git a/app/app.go b/app/app.go index ff1f6f6..c76a826 100755 --- a/app/app.go +++ b/app/app.go @@ -4,6 +4,17 @@ import ( "go.m3o.com/client" ) +type App interface { + Delete(*DeleteRequest) (*DeleteResponse, error) + List(*ListRequest) (*ListResponse, error) + Regions(*RegionsRequest) (*RegionsResponse, error) + Reserve(*ReserveRequest) (*ReserveResponse, error) + Resolve(*ResolveRequest) (*ResolveResponse, error) + Run(*RunRequest) (*RunResponse, error) + Status(*StatusRequest) (*StatusResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) +} + func NewAppService(token string) *AppService { return &AppService{ client: client.NewClient(&client.Options{ diff --git a/avatar/avatar.go b/avatar/avatar.go index fe24188..3395a54 100755 --- a/avatar/avatar.go +++ b/avatar/avatar.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Avatar interface { + Generate(*GenerateRequest) (*GenerateResponse, error) +} + func NewAvatarService(token string) *AvatarService { return &AvatarService{ client: client.NewClient(&client.Options{ diff --git a/cache/cache.go b/cache/cache.go index 0af1dd0..5ab83b9 100755 --- a/cache/cache.go +++ b/cache/cache.go @@ -4,6 +4,14 @@ import ( "go.m3o.com/client" ) +type Cache interface { + Decrement(*DecrementRequest) (*DecrementResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + Get(*GetRequest) (*GetResponse, error) + Increment(*IncrementRequest) (*IncrementResponse, error) + Set(*SetRequest) (*SetResponse, error) +} + func NewCacheService(token string) *CacheService { return &CacheService{ client: client.NewClient(&client.Options{ diff --git a/contact/contact.go b/contact/contact.go index 4122710..26999f4 100755 --- a/contact/contact.go +++ b/contact/contact.go @@ -4,6 +4,14 @@ import ( "go.m3o.com/client" ) +type Contact interface { + Create(*CreateRequest) (*CreateResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + List(*ListRequest) (*ListResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) +} + func NewContactService(token string) *ContactService { return &ContactService{ client: client.NewClient(&client.Options{ diff --git a/crypto/crypto.go b/crypto/crypto.go index 0f1ebe7..2859e9b 100755 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Crypto interface { + History(*HistoryRequest) (*HistoryResponse, error) + News(*NewsRequest) (*NewsResponse, error) + Price(*PriceRequest) (*PriceResponse, error) + Quote(*QuoteRequest) (*QuoteResponse, error) +} + func NewCryptoService(token string) *CryptoService { return &CryptoService{ client: client.NewClient(&client.Options{ diff --git a/currency/currency.go b/currency/currency.go index 60e47e6..1464795 100755 --- a/currency/currency.go +++ b/currency/currency.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Currency interface { + Codes(*CodesRequest) (*CodesResponse, error) + Convert(*ConvertRequest) (*ConvertResponse, error) + History(*HistoryRequest) (*HistoryResponse, error) + Rates(*RatesRequest) (*RatesResponse, error) +} + func NewCurrencyService(token string) *CurrencyService { return &CurrencyService{ client: client.NewClient(&client.Options{ diff --git a/db/db.go b/db/db.go index 3bc6060..0277747 100755 --- a/db/db.go +++ b/db/db.go @@ -4,6 +4,18 @@ import ( "go.m3o.com/client" ) +type Db interface { + Count(*CountRequest) (*CountResponse, error) + Create(*CreateRequest) (*CreateResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + DropTable(*DropTableRequest) (*DropTableResponse, error) + ListTables(*ListTablesRequest) (*ListTablesResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + RenameTable(*RenameTableRequest) (*RenameTableResponse, error) + Truncate(*TruncateRequest) (*TruncateResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) +} + func NewDbService(token string) *DbService { return &DbService{ client: client.NewClient(&client.Options{ diff --git a/email/email.go b/email/email.go index 1dc9af7..1e004c9 100755 --- a/email/email.go +++ b/email/email.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Email interface { + Send(*SendRequest) (*SendResponse, error) +} + func NewEmailService(token string) *EmailService { return &EmailService{ client: client.NewClient(&client.Options{ diff --git a/emoji/emoji.go b/emoji/emoji.go index c30fa16..714aabb 100755 --- a/emoji/emoji.go +++ b/emoji/emoji.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Emoji interface { + Find(*FindRequest) (*FindResponse, error) + Flag(*FlagRequest) (*FlagResponse, error) + Print(*PrintRequest) (*PrintResponse, error) + Send(*SendRequest) (*SendResponse, error) +} + func NewEmojiService(token string) *EmojiService { return &EmojiService{ client: client.NewClient(&client.Options{ diff --git a/evchargers/evchargers.go b/evchargers/evchargers.go index c70597d..2fc1c44 100755 --- a/evchargers/evchargers.go +++ b/evchargers/evchargers.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Evchargers interface { + ReferenceData(*ReferenceDataRequest) (*ReferenceDataResponse, error) + Search(*SearchRequest) (*SearchResponse, error) +} + func NewEvchargersService(token string) *EvchargersService { return &EvchargersService{ client: client.NewClient(&client.Options{ diff --git a/event/event.go b/event/event.go index ab23a99..4f57245 100755 --- a/event/event.go +++ b/event/event.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Event interface { + Consume(*ConsumeRequest) (*ConsumeResponseStream, error) + Publish(*PublishRequest) (*PublishResponse, error) + Read(*ReadRequest) (*ReadResponse, error) +} + func NewEventService(token string) *EventService { return &EventService{ client: client.NewClient(&client.Options{ diff --git a/examples/app/README.md b/examples/app/README.md index 442a7e3..4fc30ad 100755 --- a/examples/app/README.md +++ b/examples/app/README.md @@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https Endpoints: -## Regions - -Return the support regions - - -[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/app" -) - -// Return the support regions -func ListRegions() { - appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) - rsp, err := appService.Regions(&app.RegionsRequest{ - - }) - fmt.Println(rsp, err) - -} -``` ## Status Get the status of an app @@ -230,3 +203,30 @@ Repo: "github.com/asim/helloworld", } ``` +## Regions + +Return the support regions + + +[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/app" +) + +// Return the support regions +func ListRegions() { + appService := app.NewAppService(os.Getenv("M3O_API_TOKEN")) + rsp, err := appService.Regions(&app.RegionsRequest{ + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/cache/README.md b/examples/cache/README.md index 03c0009..44097c1 100755 --- a/examples/cache/README.md +++ b/examples/cache/README.md @@ -4,6 +4,63 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt Endpoints: +## Set + +Set an item in the cache. Overwrites any existing value already set. + + +[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Set an item in the cache. Overwrites any existing value already set. +func SetAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Set(&cache.SetRequest{ + Key: "foo", +Value: "bar", + + }) + fmt.Println(rsp, err) + +} +``` +## Get + +Get an item from the cache by key. If key is not found, an empty response is returned. + + +[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/cache" +) + +// Get an item from the cache by key. If key is not found, an empty response is returned. +func GetAvalue() { + cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) + rsp, err := cacheService.Get(&cache.GetRequest{ + Key: "foo", + + }) + fmt.Println(rsp, err) + +} +``` ## Delete Delete a value from the cache. If key not found a success response is returned. @@ -90,60 +147,3 @@ Value: 2, } ``` -## Set - -Set an item in the cache. Overwrites any existing value already set. - - -[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Set an item in the cache. Overwrites any existing value already set. -func SetAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Set(&cache.SetRequest{ - Key: "foo", -Value: "bar", - - }) - fmt.Println(rsp, err) - -} -``` -## Get - -Get an item from the cache by key. If key is not found, an empty response is returned. - - -[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/cache" -) - -// Get an item from the cache by key. If key is not found, an empty response is returned. -func GetAvalue() { - cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) - rsp, err := cacheService.Get(&cache.GetRequest{ - Key: "foo", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/contact/README.md b/examples/contact/README.md index efaddd5..13df2eb 100755 --- a/examples/contact/README.md +++ b/examples/contact/README.md @@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Contact/api](h Endpoints: -## List - - - - -[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// -func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() { - contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) - rsp, err := contactService.List(&contact.ListRequest{ - - }) - fmt.Println(rsp, err) - -} -``` -## List - - - - -[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/contact" -) - -// -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 @@ -217,3 +161,59 @@ func DeleteAcontact() { } ``` +## List + + + + +[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// +func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() { + contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN")) + rsp, err := contactService.List(&contact.ListRequest{ + + }) + fmt.Println(rsp, err) + +} +``` +## List + + + + +[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/contact" +) + +// +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/currency/README.md b/examples/currency/README.md index 773caf3..65a799d 100755 --- a/examples/currency/README.md +++ b/examples/currency/README.md @@ -4,35 +4,6 @@ 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 @@ -147,3 +118,32 @@ To: "GBP", } ``` +## 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 2d581df..2b6bda0 100755 --- a/examples/db/README.md +++ b/examples/db/README.md @@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https: Endpoints: +## 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: "example", + + }) + fmt.Println(rsp, err) + +} +``` ## Update Update a record in the database. Include an "id" in the record to update. @@ -63,35 +92,6 @@ Table: "example", }) 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: "example", - - }) - fmt.Println(rsp, err) - } ``` ## Truncate @@ -120,68 +120,6 @@ func TruncateTable() { }) fmt.Println(rsp, err) -} -``` -## 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: "example", - - }) - 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: "example", - - }) - fmt.Println(rsp, err) - } ``` ## DropTable @@ -210,6 +148,34 @@ func DropTable() { }) fmt.Println(rsp, err) +} +``` +## 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: "example", + + }) + fmt.Println(rsp, err) + } ``` ## ListTables @@ -268,3 +234,37 @@ To: "examples3", } ``` +## 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: "example", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/db/create/createARecord/main.go b/examples/db/create/createARecord/main.go index f7b3a81..f258334 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{}{ + "id": "1", "name": "Jane", "age": 42, "isActive": true, - "id": "1", }, Table: "example", }) diff --git a/examples/db/update/updateARecord/main.go b/examples/db/update/updateARecord/main.go index 79984e8..f14eea3 100755 --- a/examples/db/update/updateARecord/main.go +++ b/examples/db/update/updateARecord/main.go @@ -12,8 +12,8 @@ func main() { 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: "example", }) diff --git a/examples/event/README.md b/examples/event/README.md index 53b6a9b..bfdbd1a 100755 --- a/examples/event/README.md +++ b/examples/event/README.md @@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Event/api](htt Endpoints: -## Read - -Read stored events - - -[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/event" -) - -// Read stored events -func ReadEventsOnAtopic() { - eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) - rsp, err := eventService.Read(&event.ReadRequest{ - Topic: "user", - - }) - fmt.Println(rsp, err) - -} -``` ## Publish Publish a event to the event stream. @@ -54,9 +26,9 @@ 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", - "id": "1", }, Topic: "user", @@ -106,3 +78,31 @@ func ConsumeFromAtopic() { } } ``` +## Read + +Read stored events + + +[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/event" +) + +// Read stored events +func ReadEventsOnAtopic() { + eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) + rsp, err := eventService.Read(&event.ReadRequest{ + Topic: "user", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/file/README.md b/examples/file/README.md index 842161c..698b95b 100755 --- a/examples/file/README.md +++ b/examples/file/README.md @@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](http Endpoints: +## Delete + +Delete a file by project name/path + + +[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/file" +) + +// Delete a file by project name/path +func DeleteFile() { + fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) + rsp, err := fileService.Delete(&file.DeleteRequest{ + Path: "/document/text-files/file.txt", +Project: "examples", + + }) + fmt.Println(rsp, err) + +} +``` ## Save Save a file @@ -93,32 +122,3 @@ Project: "examples", } ``` -## Delete - -Delete a file by project name/path - - -[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/file" -) - -// Delete a file by project name/path -func DeleteFile() { - fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN")) - rsp, err := fileService.Delete(&file.DeleteRequest{ - Path: "/document/text-files/file.txt", -Project: "examples", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/function/README.md b/examples/function/README.md index c8751e7..e50bd0a 100755 --- a/examples/function/README.md +++ b/examples/function/README.md @@ -30,6 +30,37 @@ 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 @@ -57,62 +88,6 @@ 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: "helloworld", - - }) - fmt.Println(rsp, err) - -} -``` -## Describe - -Get the info for a deployed function - - -[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/function" -) - -// Get the info for a deployed function -func DescribeFunctionStatus() { - functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) - rsp, err := functionService.Describe(&function.DescribeRequest{ - Name: "helloworld", - - }) - fmt.Println(rsp, err) - } ``` ## Regions @@ -174,6 +149,62 @@ Subfolder: "examples/go-function", }) fmt.Println(rsp, err) +} +``` +## Delete + +Delete a function by name + + +[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Delete a function by name +func DeleteAfunction() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Delete(&function.DeleteRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + +} +``` +## Describe + +Get the info for a deployed function + + +[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/function" +) + +// Get the info for a deployed function +func DescribeFunctionStatus() { + functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) + rsp, err := functionService.Describe(&function.DescribeRequest{ + Name: "helloworld", + + }) + fmt.Println(rsp, err) + } ``` ## Reserve @@ -232,34 +263,3 @@ func ProxyUrl() { } ``` -## 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) - -} -``` diff --git a/examples/mq/publish/publishAMessage/main.go b/examples/mq/publish/publishAMessage/main.go index e6a7451..fe21c56 100755 --- a/examples/mq/publish/publishAMessage/main.go +++ b/examples/mq/publish/publishAMessage/main.go @@ -12,9 +12,9 @@ func main() { mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) rsp, err := mqService.Publish(&mq.PublishRequest{ Message: map[string]interface{}{ - "type": "signup", "user": "john", "id": "1", + "type": "signup", }, Topic: "events", }) diff --git a/examples/nft/README.md b/examples/nft/README.md index 0075be9..4450c3a 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: +## Assets + +Return a list of assets + + +[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/nft" +) + +// Return a list of assets +func GetAlistOfAssets() { + nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) + rsp, err := nftService.Assets(&nft.AssetsRequest{ + Limit: 1, + + }) + fmt.Println(rsp, err) + +} +``` ## Create Create your own NFT (coming soon) @@ -61,31 +89,3 @@ func ListCollections() { } ``` -## Assets - -Return a list of assets - - -[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/nft" -) - -// Return a list of assets -func GetAlistOfAssets() { - nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN")) - rsp, err := nftService.Assets(&nft.AssetsRequest{ - Limit: 1, - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/quran/README.md b/examples/quran/README.md index ee61912..03a059b 100755 --- a/examples/quran/README.md +++ b/examples/quran/README.md @@ -4,6 +4,62 @@ 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) + + +[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 @@ -64,59 +120,3 @@ func SearchTheQuran() { } ``` -## 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) - - -[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/rss/README.md b/examples/rss/README.md index 62d0224..bde5033 100755 --- a/examples/rss/README.md +++ b/examples/rss/README.md @@ -4,6 +4,61 @@ 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 @@ -62,58 +117,3 @@ 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/space/README.md b/examples/space/README.md index cd269f5..a404d0e 100755 --- a/examples/space/README.md +++ b/examples/space/README.md @@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Space/api](htt Endpoints: +## List + +List the objects in space + + +[https://m3o.com/space/api#List](https://m3o.com/space/api#List) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/space" +) + +// List the objects in space +func ListObjectsWithPrefix() { + spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) + rsp, err := spaceService.List(&space.ListRequest{ + Prefix: "images/", + + }) + fmt.Println(rsp, err) + +} +``` ## Head Retrieve meta information about an object @@ -204,31 +232,3 @@ func DeleteAnObject() { } ``` -## List - -List the objects in space - - -[https://m3o.com/space/api#List](https://m3o.com/space/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/space" -) - -// List the objects in space -func ListObjectsWithPrefix() { - spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN")) - rsp, err := spaceService.List(&space.ListRequest{ - Prefix: "images/", - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/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/stream/README.md b/examples/stream/README.md index 08f1f1a..6d83f90 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: +## ListChannels + +List all the active channels + + +[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/stream" +) + +// List all the active channels +func ListChannels() { + streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) + rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## CreateChannel Create a channel with a given name and description. Channels are created automatically but @@ -92,30 +119,3 @@ func ListMessages() { } ``` -## ListChannels - -List all the active channels - - -[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/stream" -) - -// List all the active channels -func ListChannels() { - streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN")) - rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/sunnah/README.md b/examples/sunnah/README.md index 5c33a4f..0b5cf6e 100755 --- a/examples/sunnah/README.md +++ b/examples/sunnah/README.md @@ -4,37 +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 @@ -123,3 +92,34 @@ 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/time/README.md b/examples/time/README.md index 73de990..29b28b8 100755 --- a/examples/time/README.md +++ b/examples/time/README.md @@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Time/api](http Endpoints: +## Now + +Get the current time + + +[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/time" +) + +// Get the current time +func ReturnsCurrentTimeOptionallyWithLocation() { + timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN")) + rsp, err := timeService.Now(&time.NowRequest{ + + }) + fmt.Println(rsp, err) + +} +``` ## Zone Get the timezone info for a specific location @@ -32,30 +59,3 @@ func GetTheTimezoneInfoForAspecificLocation() { } ``` -## Now - -Get the current time - - -[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/time" -) - -// Get the current time -func ReturnsCurrentTimeOptionallyWithLocation() { - timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN")) - rsp, err := timeService.Now(&time.NowRequest{ - - }) - fmt.Println(rsp, err) - -} -``` diff --git a/examples/twitter/README.md b/examples/twitter/README.md index f11d086..e099911 100755 --- a/examples/twitter/README.md +++ b/examples/twitter/README.md @@ -4,61 +4,6 @@ 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 - - -[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/twitter" -) - -// Get a user's twitter profile -func GetAusersTwitterProfile() { - twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) - rsp, err := twitterService.User(&twitter.UserRequest{ - Username: "crufter", - - }) - fmt.Println(rsp, err) - -} -``` ## Timeline Get the timeline for a given user @@ -116,3 +61,58 @@ 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) + +} +``` +## User + +Get a user's twitter profile + + +[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/twitter" +) + +// Get a user's twitter profile +func GetAusersTwitterProfile() { + twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN")) + rsp, err := twitterService.User(&twitter.UserRequest{ + Username: "crufter", + + }) + fmt.Println(rsp, err) + +} +``` diff --git a/examples/user/README.md b/examples/user/README.md index f43d51f..6d32b11 100755 --- a/examples/user/README.md +++ b/examples/user/README.md @@ -4,12 +4,13 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http Endpoints: -## Create +## Login -Create a new user account. The email address and username for the account must be unique. +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#Create](https://m3o.com/user/api#Create) +[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login) ```go package example @@ -21,26 +22,25 @@ import( "go.m3o.com/user" ) -// Create a new user account. The email address and username for the account must be unique. -func CreateAnAccount() { +// 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.Create(&user.CreateRequest{ + rsp, err := userService.Login(&user.LoginRequest{ Email: "joe@example.com", -Id: "user-1", Password: "Password1", -Username: "joe", }) fmt.Println(rsp, err) } ``` -## Logout +## List -Logout a user account +List all users. Returns a paged list of results -[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout) +[https://m3o.com/user/api#List](https://m3o.com/user/api#List) ```go package example @@ -52,11 +52,76 @@ import( "go.m3o.com/user" ) -// Logout a user account -func LogAuserOut() { +// List all users. Returns a paged list of results +func ListAllUsers() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Logout(&user.LogoutRequest{ - SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", + rsp, err := userService.List(&user.ListRequest{ + Limit: 100, +Offset: 0, + + }) + fmt.Println(rsp, err) + +} +``` +## SendMagicLink + +Login using email only - Passwordless + + +[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink) + +```go +package example + +import( + "fmt" + "os" + + "go.m3o.com/user" +) + +// Login using email only - Passwordless +func SendAmagicLink() { + userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) + rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{ + Address: "www.example.com", +Email: "joe@example.com", +Endpoint: "verifytoken", +FromName: "Awesome Dot Com", +Subject: "MagicLink to access your account", +TextContent: `Hi there, + +Click here to access your account $micro_verification_link`, + + }) + fmt.Println(rsp, err) + +} +``` +## 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{ + Email: "joe@example.com", +Token: "012345", }) fmt.Println(rsp, err) @@ -110,12 +175,12 @@ Please verify your email by clicking this link: $micro_verification_link`, } ``` -## ReadSession +## ResetPassword -Read a session by the session id. In the event it has expired or is not found and error is returned. +Reset password with the code sent by the "SendPasswordResetEmail" endoint. -[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession) +[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword) ```go package example @@ -127,40 +192,14 @@ import( "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() { +// Reset password with the code sent by the "SendPasswordResetEmail" endoint. +func ResetPassword() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.ReadSession(&user.ReadSessionRequest{ - SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", - - }) - fmt.Println(rsp, err) - -} -``` -## List - -List all users. Returns a paged list of results - - -[https://m3o.com/user/api#List](https://m3o.com/user/api#List) - -```go -package example - -import( - "fmt" - "os" - - "go.m3o.com/user" -) - -// List all users. Returns a paged list of results -func ListAllUsers() { - userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.List(&user.ListRequest{ - Limit: 100, -Offset: 0, + rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{ + Code: "012345", +ConfirmPassword: "NewPassword1", +Email: "joe@example.com", +NewPassword: "NewPassword1", }) fmt.Println(rsp, err) @@ -199,35 +238,6 @@ func VerifyAtoken() { }) 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", - - }) - fmt.Println(rsp, err) - } ``` ## UpdatePassword @@ -342,41 +352,6 @@ func ReadAccountByEmail() { }) 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) - } ``` ## SendPasswordResetEmail @@ -413,12 +388,12 @@ TextContent: `Hi there, } ``` -## ResetPassword +## ReadSession -Reset password with the code sent by the "SendPasswordResetEmail" endoint. +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#ResetPassword](https://m3o.com/user/api#ResetPassword) +[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession) ```go package example @@ -430,26 +405,23 @@ import( "go.m3o.com/user" ) -// Reset password with the code sent by the "SendPasswordResetEmail" endoint. -func ResetPassword() { +// 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.ResetPassword(&user.ResetPasswordRequest{ - Code: "012345", -ConfirmPassword: "NewPassword1", -Email: "joe@example.com", -NewPassword: "NewPassword1", + rsp, err := userService.ReadSession(&user.ReadSessionRequest{ + SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", }) fmt.Println(rsp, err) } ``` -## VerifyEmail +## Update -Verify the email address of an account from a token sent in an email to the user. +Update the account username or email -[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail) +[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update) ```go package example @@ -461,12 +433,12 @@ import( "go.m3o.com/user" ) -// Verify the email address of an account from a token sent in an email to the user. -func VerifyEmail() { +// Update the account username or email +func UpdateAnAccount() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{ - Email: "joe@example.com", -Token: "012345", + rsp, err := userService.Update(&user.UpdateRequest{ + Email: "joe+2@example.com", +Id: "user-1", }) fmt.Println(rsp, err) @@ -501,13 +473,12 @@ func DeleteUserAccount() { } ``` -## Login +## Logout -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 +Logout a user account -[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login) +[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout) ```go package example @@ -519,13 +490,42 @@ import( "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() { +// Logout a user account +func LogAuserOut() { userService := user.NewUserService(os.Getenv("M3O_API_TOKEN")) - rsp, err := userService.Login(&user.LoginRequest{ - Email: "joe@example.com", -Password: "Password1", + rsp, err := userService.Logout(&user.LogoutRequest{ + SessionId: "df91a612-5b24-4634-99ff-240220ab8f55", + + }) + 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) diff --git a/file/file.go b/file/file.go index 095522c..e001b10 100755 --- a/file/file.go +++ b/file/file.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type File interface { + Delete(*DeleteRequest) (*DeleteResponse, error) + List(*ListRequest) (*ListResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + Save(*SaveRequest) (*SaveResponse, error) +} + func NewFileService(token string) *FileService { return &FileService{ client: client.NewClient(&client.Options{ diff --git a/forex/forex.go b/forex/forex.go index a56c116..cd154bb 100755 --- a/forex/forex.go +++ b/forex/forex.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Forex interface { + History(*HistoryRequest) (*HistoryResponse, error) + Price(*PriceRequest) (*PriceResponse, error) + Quote(*QuoteRequest) (*QuoteResponse, error) +} + func NewForexService(token string) *ForexService { return &ForexService{ client: client.NewClient(&client.Options{ diff --git a/function/function.go b/function/function.go index 71d7dbd..2e94260 100755 --- a/function/function.go +++ b/function/function.go @@ -4,6 +4,18 @@ import ( "go.m3o.com/client" ) +type Function interface { + Call(*CallRequest) (*CallResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + Deploy(*DeployRequest) (*DeployResponse, error) + Describe(*DescribeRequest) (*DescribeResponse, error) + List(*ListRequest) (*ListResponse, error) + Proxy(*ProxyRequest) (*ProxyResponse, error) + Regions(*RegionsRequest) (*RegionsResponse, error) + Reserve(*ReserveRequest) (*ReserveResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) +} + func NewFunctionService(token string) *FunctionService { return &FunctionService{ client: client.NewClient(&client.Options{ diff --git a/geocoding/geocoding.go b/geocoding/geocoding.go index fb3b1c8..d66387c 100755 --- a/geocoding/geocoding.go +++ b/geocoding/geocoding.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Geocoding interface { + Lookup(*LookupRequest) (*LookupResponse, error) + Reverse(*ReverseRequest) (*ReverseResponse, error) +} + func NewGeocodingService(token string) *GeocodingService { return &GeocodingService{ client: client.NewClient(&client.Options{ diff --git a/gifs/gifs.go b/gifs/gifs.go index 26cb86c..0ec89be 100755 --- a/gifs/gifs.go +++ b/gifs/gifs.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Gifs interface { + Search(*SearchRequest) (*SearchResponse, error) +} + func NewGifsService(token string) *GifsService { return &GifsService{ client: client.NewClient(&client.Options{ diff --git a/google/google.go b/google/google.go index 9d419fb..deb4a0e 100755 --- a/google/google.go +++ b/google/google.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Google interface { + Search(*SearchRequest) (*SearchResponse, error) +} + func NewGoogleService(token string) *GoogleService { return &GoogleService{ client: client.NewClient(&client.Options{ diff --git a/helloworld/helloworld.go b/helloworld/helloworld.go index 7d7555a..ceb82fd 100755 --- a/helloworld/helloworld.go +++ b/helloworld/helloworld.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Helloworld interface { + Call(*CallRequest) (*CallResponse, error) + Stream(*StreamRequest) (*StreamResponseStream, error) +} + func NewHelloworldService(token string) *HelloworldService { return &HelloworldService{ client: client.NewClient(&client.Options{ diff --git a/holidays/holidays.go b/holidays/holidays.go index 19861d2..0a8eae0 100755 --- a/holidays/holidays.go +++ b/holidays/holidays.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Holidays interface { + Countries(*CountriesRequest) (*CountriesResponse, error) + List(*ListRequest) (*ListResponse, error) +} + func NewHolidaysService(token string) *HolidaysService { return &HolidaysService{ client: client.NewClient(&client.Options{ diff --git a/id/id.go b/id/id.go index 277ae63..8a7f9b4 100755 --- a/id/id.go +++ b/id/id.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Id interface { + Generate(*GenerateRequest) (*GenerateResponse, error) + Types(*TypesRequest) (*TypesResponse, error) +} + func NewIdService(token string) *IdService { return &IdService{ client: client.NewClient(&client.Options{ diff --git a/image/image.go b/image/image.go index 473df12..d78cc9f 100755 --- a/image/image.go +++ b/image/image.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Image interface { + Convert(*ConvertRequest) (*ConvertResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + Resize(*ResizeRequest) (*ResizeResponse, error) + Upload(*UploadRequest) (*UploadResponse, error) +} + func NewImageService(token string) *ImageService { return &ImageService{ client: client.NewClient(&client.Options{ diff --git a/ip/ip.go b/ip/ip.go index b772332..8ebbb36 100755 --- a/ip/ip.go +++ b/ip/ip.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Ip interface { + Lookup(*LookupRequest) (*LookupResponse, error) +} + func NewIpService(token string) *IpService { return &IpService{ client: client.NewClient(&client.Options{ diff --git a/joke/joke.go b/joke/joke.go index 632be8c..b97803f 100755 --- a/joke/joke.go +++ b/joke/joke.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Joke interface { + Random(*RandomRequest) (*RandomResponse, error) +} + func NewJokeService(token string) *JokeService { return &JokeService{ client: client.NewClient(&client.Options{ diff --git a/location/location.go b/location/location.go index b1dd33f..ecd3a0a 100755 --- a/location/location.go +++ b/location/location.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Location interface { + Read(*ReadRequest) (*ReadResponse, error) + Save(*SaveRequest) (*SaveResponse, error) + Search(*SearchRequest) (*SearchResponse, error) +} + func NewLocationService(token string) *LocationService { return &LocationService{ client: client.NewClient(&client.Options{ diff --git a/movie/movie.go b/movie/movie.go index 1c74cd1..69920ae 100755 --- a/movie/movie.go +++ b/movie/movie.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Movie interface { + Search(*SearchRequest) (*SearchResponse, error) +} + func NewMovieService(token string) *MovieService { return &MovieService{ client: client.NewClient(&client.Options{ diff --git a/mq/mq.go b/mq/mq.go index 8b666cc..6a9f7b3 100755 --- a/mq/mq.go +++ b/mq/mq.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Mq interface { + Publish(*PublishRequest) (*PublishResponse, error) + Subscribe(*SubscribeRequest) (*SubscribeResponseStream, error) +} + func NewMqService(token string) *MqService { return &MqService{ client: client.NewClient(&client.Options{ diff --git a/news/news.go b/news/news.go index fa4b807..0225271 100755 --- a/news/news.go +++ b/news/news.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type News interface { + Headlines(*HeadlinesRequest) (*HeadlinesResponse, error) +} + func NewNewsService(token string) *NewsService { return &NewsService{ client: client.NewClient(&client.Options{ diff --git a/nft/nft.go b/nft/nft.go index 2a149cd..bf83852 100755 --- a/nft/nft.go +++ b/nft/nft.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Nft interface { + Assets(*AssetsRequest) (*AssetsResponse, error) + Collections(*CollectionsRequest) (*CollectionsResponse, error) + Create(*CreateRequest) (*CreateResponse, error) +} + func NewNftService(token string) *NftService { return &NftService{ client: client.NewClient(&client.Options{ diff --git a/notes/notes.go b/notes/notes.go index 5e2e157..519a0bf 100755 --- a/notes/notes.go +++ b/notes/notes.go @@ -4,6 +4,15 @@ import ( "go.m3o.com/client" ) +type Notes interface { + Create(*CreateRequest) (*CreateResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + Events(*EventsRequest) (*EventsResponseStream, error) + List(*ListRequest) (*ListResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) +} + func NewNotesService(token string) *NotesService { return &NotesService{ client: client.NewClient(&client.Options{ diff --git a/otp/otp.go b/otp/otp.go index 94ca7fd..088e105 100755 --- a/otp/otp.go +++ b/otp/otp.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Otp interface { + Generate(*GenerateRequest) (*GenerateResponse, error) + Validate(*ValidateRequest) (*ValidateResponse, error) +} + func NewOtpService(token string) *OtpService { return &OtpService{ client: client.NewClient(&client.Options{ diff --git a/postcode/postcode.go b/postcode/postcode.go index 44b195d..2a81802 100755 --- a/postcode/postcode.go +++ b/postcode/postcode.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Postcode interface { + Lookup(*LookupRequest) (*LookupResponse, error) + Random(*RandomRequest) (*RandomResponse, error) + Validate(*ValidateRequest) (*ValidateResponse, error) +} + func NewPostcodeService(token string) *PostcodeService { return &PostcodeService{ client: client.NewClient(&client.Options{ diff --git a/prayer/prayer.go b/prayer/prayer.go index 10aec04..65db5ae 100755 --- a/prayer/prayer.go +++ b/prayer/prayer.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Prayer interface { + Times(*TimesRequest) (*TimesResponse, error) +} + func NewPrayerService(token string) *PrayerService { return &PrayerService{ client: client.NewClient(&client.Options{ diff --git a/qr/qr.go b/qr/qr.go index 96d3d12..0231805 100755 --- a/qr/qr.go +++ b/qr/qr.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Qr interface { + Generate(*GenerateRequest) (*GenerateResponse, error) +} + func NewQrService(token string) *QrService { return &QrService{ client: client.NewClient(&client.Options{ diff --git a/quran/quran.go b/quran/quran.go index 27b221c..c60fe23 100755 --- a/quran/quran.go +++ b/quran/quran.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Quran interface { + Chapters(*ChaptersRequest) (*ChaptersResponse, error) + Search(*SearchRequest) (*SearchResponse, error) + Summary(*SummaryRequest) (*SummaryResponse, error) + Verses(*VersesRequest) (*VersesResponse, error) +} + func NewQuranService(token string) *QuranService { return &QuranService{ client: client.NewClient(&client.Options{ diff --git a/routing/routing.go b/routing/routing.go index b7fbee1..7d716d5 100755 --- a/routing/routing.go +++ b/routing/routing.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Routing interface { + Directions(*DirectionsRequest) (*DirectionsResponse, error) + Eta(*EtaRequest) (*EtaResponse, error) + Route(*RouteRequest) (*RouteResponse, error) +} + func NewRoutingService(token string) *RoutingService { return &RoutingService{ client: client.NewClient(&client.Options{ diff --git a/rss/rss.go b/rss/rss.go index dc97aa1..dbbd559 100755 --- a/rss/rss.go +++ b/rss/rss.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Rss interface { + Add(*AddRequest) (*AddResponse, error) + Feed(*FeedRequest) (*FeedResponse, error) + List(*ListRequest) (*ListResponse, error) + Remove(*RemoveRequest) (*RemoveResponse, error) +} + func NewRssService(token string) *RssService { return &RssService{ client: client.NewClient(&client.Options{ diff --git a/search/search.go b/search/search.go index aa4b2de..8338f95 100755 --- a/search/search.go +++ b/search/search.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Search interface { + Vote(*VoteRequest) (*VoteResponse, error) +} + func NewSearchService(token string) *SearchService { return &SearchService{ client: client.NewClient(&client.Options{ diff --git a/sentiment/sentiment.go b/sentiment/sentiment.go index a531489..3491ca1 100755 --- a/sentiment/sentiment.go +++ b/sentiment/sentiment.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Sentiment interface { + Analyze(*AnalyzeRequest) (*AnalyzeResponse, error) +} + func NewSentimentService(token string) *SentimentService { return &SentimentService{ client: client.NewClient(&client.Options{ diff --git a/sms/sms.go b/sms/sms.go index d4dc8f8..79505a2 100755 --- a/sms/sms.go +++ b/sms/sms.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Sms interface { + Send(*SendRequest) (*SendResponse, error) +} + func NewSmsService(token string) *SmsService { return &SmsService{ client: client.NewClient(&client.Options{ diff --git a/space/space.go b/space/space.go index df897d6..9f46411 100755 --- a/space/space.go +++ b/space/space.go @@ -4,6 +4,17 @@ import ( "go.m3o.com/client" ) +type Space interface { + Create(*CreateRequest) (*CreateResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + Download(*DownloadRequest) (*DownloadResponse, error) + Head(*HeadRequest) (*HeadResponse, error) + List(*ListRequest) (*ListResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) + Upload(*UploadRequest) (*UploadResponse, error) +} + func NewSpaceService(token string) *SpaceService { return &SpaceService{ client: client.NewClient(&client.Options{ diff --git a/spam/spam.go b/spam/spam.go index 743b499..04e85c6 100755 --- a/spam/spam.go +++ b/spam/spam.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Spam interface { + Classify(*ClassifyRequest) (*ClassifyResponse, error) +} + func NewSpamService(token string) *SpamService { return &SpamService{ client: client.NewClient(&client.Options{ diff --git a/stock/stock.go b/stock/stock.go index 1b82efa..04f7305 100755 --- a/stock/stock.go +++ b/stock/stock.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Stock interface { + History(*HistoryRequest) (*HistoryResponse, error) + OrderBook(*OrderBookRequest) (*OrderBookResponse, error) + Price(*PriceRequest) (*PriceResponse, error) + Quote(*QuoteRequest) (*QuoteResponse, error) +} + func NewStockService(token string) *StockService { return &StockService{ client: client.NewClient(&client.Options{ diff --git a/stream/stream.go b/stream/stream.go index 73261dc..4fba984 100755 --- a/stream/stream.go +++ b/stream/stream.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Stream interface { + CreateChannel(*CreateChannelRequest) (*CreateChannelResponse, error) + ListChannels(*ListChannelsRequest) (*ListChannelsResponse, error) + ListMessages(*ListMessagesRequest) (*ListMessagesResponse, error) + SendMessage(*SendMessageRequest) (*SendMessageResponse, error) +} + func NewStreamService(token string) *StreamService { return &StreamService{ client: client.NewClient(&client.Options{ diff --git a/sunnah/sunnah.go b/sunnah/sunnah.go index fb36b08..3d77ed5 100755 --- a/sunnah/sunnah.go +++ b/sunnah/sunnah.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Sunnah interface { + Books(*BooksRequest) (*BooksResponse, error) + Chapters(*ChaptersRequest) (*ChaptersResponse, error) + Collections(*CollectionsRequest) (*CollectionsResponse, error) + Hadiths(*HadithsRequest) (*HadithsResponse, error) +} + func NewSunnahService(token string) *SunnahService { return &SunnahService{ client: client.NewClient(&client.Options{ diff --git a/thumbnail/thumbnail.go b/thumbnail/thumbnail.go index edc150b..988bbc5 100755 --- a/thumbnail/thumbnail.go +++ b/thumbnail/thumbnail.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Thumbnail interface { + Screenshot(*ScreenshotRequest) (*ScreenshotResponse, error) +} + func NewThumbnailService(token string) *ThumbnailService { return &ThumbnailService{ client: client.NewClient(&client.Options{ diff --git a/time/time.go b/time/time.go index c84445d..98daca1 100755 --- a/time/time.go +++ b/time/time.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Time interface { + Now(*NowRequest) (*NowResponse, error) + Zone(*ZoneRequest) (*ZoneResponse, error) +} + func NewTimeService(token string) *TimeService { return &TimeService{ client: client.NewClient(&client.Options{ diff --git a/translate/translate.go b/translate/translate.go index 94541a4..f680802 100755 --- a/translate/translate.go +++ b/translate/translate.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Translate interface { + Text(*TextRequest) (*TextResponse, error) +} + func NewTranslateService(token string) *TranslateService { return &TranslateService{ client: client.NewClient(&client.Options{ diff --git a/twitter/twitter.go b/twitter/twitter.go index 259357f..fb9dedf 100755 --- a/twitter/twitter.go +++ b/twitter/twitter.go @@ -4,6 +4,13 @@ import ( "go.m3o.com/client" ) +type Twitter interface { + Search(*SearchRequest) (*SearchResponse, error) + Timeline(*TimelineRequest) (*TimelineResponse, error) + Trends(*TrendsRequest) (*TrendsResponse, error) + User(*UserRequest) (*UserResponse, error) +} + func NewTwitterService(token string) *TwitterService { return &TwitterService{ client: client.NewClient(&client.Options{ diff --git a/url/url.go b/url/url.go index a607964..b57099f 100755 --- a/url/url.go +++ b/url/url.go @@ -4,6 +4,12 @@ import ( "go.m3o.com/client" ) +type Url interface { + List(*ListRequest) (*ListResponse, error) + Proxy(*ProxyRequest) (*ProxyResponse, error) + Shorten(*ShortenRequest) (*ShortenResponse, error) +} + func NewUrlService(token string) *UrlService { return &UrlService{ client: client.NewClient(&client.Options{ diff --git a/user/user.go b/user/user.go index 1887221..2215342 100755 --- a/user/user.go +++ b/user/user.go @@ -4,6 +4,24 @@ import ( "go.m3o.com/client" ) +type User interface { + Create(*CreateRequest) (*CreateResponse, error) + Delete(*DeleteRequest) (*DeleteResponse, error) + List(*ListRequest) (*ListResponse, error) + Login(*LoginRequest) (*LoginResponse, error) + Logout(*LogoutRequest) (*LogoutResponse, error) + Read(*ReadRequest) (*ReadResponse, error) + ReadSession(*ReadSessionRequest) (*ReadSessionResponse, error) + ResetPassword(*ResetPasswordRequest) (*ResetPasswordResponse, error) + SendMagicLink(*SendMagicLinkRequest) (*SendMagicLinkResponse, error) + SendPasswordResetEmail(*SendPasswordResetEmailRequest) (*SendPasswordResetEmailResponse, error) + SendVerificationEmail(*SendVerificationEmailRequest) (*SendVerificationEmailResponse, error) + UpdatePassword(*UpdatePasswordRequest) (*UpdatePasswordResponse, error) + Update(*UpdateRequest) (*UpdateResponse, error) + VerifyEmail(*VerifyEmailRequest) (*VerifyEmailResponse, error) + VerifyToken(*VerifyTokenRequest) (*VerifyTokenResponse, error) +} + func NewUserService(token string) *UserService { return &UserService{ client: client.NewClient(&client.Options{ diff --git a/vehicle/vehicle.go b/vehicle/vehicle.go index f7cd683..ccb135d 100755 --- a/vehicle/vehicle.go +++ b/vehicle/vehicle.go @@ -4,6 +4,10 @@ import ( "go.m3o.com/client" ) +type Vehicle interface { + Lookup(*LookupRequest) (*LookupResponse, error) +} + func NewVehicleService(token string) *VehicleService { return &VehicleService{ client: client.NewClient(&client.Options{ diff --git a/weather/weather.go b/weather/weather.go index 22f873a..097e45b 100755 --- a/weather/weather.go +++ b/weather/weather.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Weather interface { + Forecast(*ForecastRequest) (*ForecastResponse, error) + Now(*NowRequest) (*NowResponse, error) +} + func NewWeatherService(token string) *WeatherService { return &WeatherService{ client: client.NewClient(&client.Options{ diff --git a/youtube/youtube.go b/youtube/youtube.go index be105e9..07f49c7 100755 --- a/youtube/youtube.go +++ b/youtube/youtube.go @@ -4,6 +4,11 @@ import ( "go.m3o.com/client" ) +type Youtube interface { + Embed(*EmbedRequest) (*EmbedResponse, error) + Search(*SearchRequest) (*SearchResponse, error) +} + func NewYoutubeService(token string) *YoutubeService { return &YoutubeService{ client: client.NewClient(&client.Options{