53 Commits

Author SHA1 Message Date
m3o-actions
27e13d2b6c Commit from m3o/m3o action 2021-12-29 13:41:36 +00:00
m3o-actions
8561aa8205 Commit from m3o/m3o action 2021-12-28 10:50:15 +00:00
m3o-actions
f051277b48 Commit from m3o/m3o action 2021-12-28 10:47:34 +00:00
m3o-actions
1132b4809a Commit from m3o/m3o action 2021-12-28 07:23:23 +00:00
m3o-actions
85ff0bf56f Commit from m3o/m3o action 2021-12-23 09:07:13 +00:00
m3o-actions
f362f68c54 Commit from m3o/m3o action 2021-12-22 10:20:20 +00:00
m3o-actions
063e059d70 Commit from m3o/m3o action 2021-12-21 14:18:03 +00:00
m3o-actions
1773d164e4 Commit from m3o/m3o action 2021-12-21 11:38:52 +00:00
m3o-actions
a835eaddc4 Commit from m3o/m3o action 2021-12-21 11:38:29 +00:00
m3o-actions
a905d67b2c Commit from m3o/m3o action 2021-12-21 11:37:33 +00:00
m3o-actions
9c1ae9e4d2 Commit from m3o/m3o action 2021-12-21 11:36:48 +00:00
m3o-actions
5daed5e997 Commit from m3o/m3o action 2021-12-21 11:36:33 +00:00
m3o-actions
7c8a6f80de Commit from m3o/m3o action 2021-12-21 11:27:10 +00:00
Asim Aslam
05097a471d Remove contact examples 2021-12-21 11:16:46 +00:00
m3o-actions
3d0f9dda4b Commit from m3o/m3o action 2021-12-21 10:51:03 +00:00
m3o-actions
36d8023ada Commit from m3o/m3o action 2021-12-21 09:21:58 +00:00
m3o-actions
b135490f0e Commit from m3o/m3o action 2021-12-20 20:02:20 +00:00
m3o-actions
a97ced0f02 Commit from m3o/m3o action 2021-12-20 19:53:22 +00:00
m3o-actions
002380be31 Commit from m3o/m3o action 2021-12-20 14:22:15 +00:00
m3o-actions
1211b1b74e Commit from m3o/m3o action 2021-12-20 11:10:57 +00:00
m3o-actions
9a39681342 Commit from m3o/m3o action 2021-12-17 16:16:32 +00:00
m3o-actions
fd12523b0d Commit from m3o/m3o action 2021-12-17 15:38:23 +00:00
m3o-actions
4822495226 Commit from m3o/m3o action 2021-12-17 15:26:23 +00:00
m3o-actions
9cfa252f59 Commit from m3o/m3o action 2021-12-17 14:57:36 +00:00
m3o-actions
ab4602b369 Commit from m3o/m3o action 2021-12-17 14:01:44 +00:00
m3o-actions
9c97fbb4da Commit from m3o/m3o action 2021-12-17 13:02:04 +00:00
m3o-actions
3c853a2cbc Commit from m3o/m3o action 2021-12-17 10:03:03 +00:00
m3o-actions
ed1603b391 Commit from m3o/m3o action 2021-12-17 09:58:48 +00:00
m3o-actions
6ba5ad8ce4 Commit from m3o/m3o action 2021-12-17 09:34:07 +00:00
m3o-actions
24b609b070 Commit from m3o/m3o action 2021-12-17 09:29:22 +00:00
m3o-actions
801e983f3a Commit from m3o/m3o action 2021-12-17 09:28:01 +00:00
m3o-actions
c3e28cbc66 Commit from m3o/m3o action 2021-12-17 09:26:50 +00:00
m3o-actions
c4e0fe407e Commit from m3o/m3o action 2021-12-17 09:25:23 +00:00
m3o-actions
43e6f37402 Commit from m3o/m3o action 2021-12-17 09:24:04 +00:00
m3o-actions
9036b95fd2 Commit from m3o/m3o action 2021-12-17 09:20:58 +00:00
m3o-actions
937cb915ac Commit from m3o/m3o action 2021-12-17 09:14:47 +00:00
m3o-actions
da2b23fbab Commit from m3o/m3o action 2021-12-17 08:08:27 +00:00
m3o-actions
4de67b6746 Commit from m3o/m3o action 2021-12-16 21:02:03 +00:00
m3o-actions
75ba0d6c3a Commit from m3o/m3o action 2021-12-16 19:51:32 +00:00
Asim Aslam
873ba7f939 fix examples 2021-12-16 19:47:04 +00:00
m3o-actions
a6c66fb76a Commit from m3o/m3o action 2021-12-16 19:24:48 +00:00
m3o-actions
292001f3f2 Commit from m3o/m3o action 2021-12-16 19:22:42 +00:00
m3o-actions
d7e95f687f Commit from m3o/m3o action 2021-12-16 17:34:25 +00:00
m3o-actions
32496fe696 Commit from m3o/m3o action 2021-12-16 17:18:38 +00:00
m3o-actions
86803cc1e2 Commit from m3o/m3o action 2021-12-16 17:03:59 +00:00
m3o-actions
3f24078efb Commit from m3o/m3o action 2021-12-16 17:00:50 +00:00
m3o-actions
bb753c4504 Commit from m3o/m3o action 2021-12-16 16:55:04 +00:00
m3o-actions
3c6466378c Commit from m3o/m3o action 2021-12-16 15:49:00 +00:00
m3o-actions
d921922cd9 Commit from m3o/m3o action 2021-12-16 15:17:46 +00:00
m3o-actions
d2230e009d Commit from m3o/m3o action 2021-12-16 15:16:44 +00:00
m3o-actions
536e9cfe77 Commit from m3o/m3o action 2021-12-16 15:06:05 +00:00
m3o-actions
c707489b7a Commit from m3o/m3o action 2021-12-16 14:52:39 +00:00
m3o-actions
1a28fb54f9 Commit from m3o/m3o action 2021-12-16 12:53:53 +00:00
92 changed files with 2164 additions and 1103 deletions

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Address interface {
LookupPostcode(*LookupPostcodeRequest) (*LookupPostcodeResponse, error)
}
func NewAddressService(token string) *AddressService { func NewAddressService(token string) *AddressService {
return &AddressService{ return &AddressService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Answer interface {
Question(*QuestionRequest) (*QuestionResponse, error)
}
func NewAnswerService(token string) *AnswerService { func NewAnswerService(token string) *AnswerService {
return &AnswerService{ return &AnswerService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,17 @@ import (
"go.m3o.com/client" "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 { func NewAppService(token string) *AppService {
return &AppService{ return &AppService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Avatar interface {
Generate(*GenerateRequest) (*GenerateResponse, error)
}
func NewAvatarService(token string) *AvatarService { func NewAvatarService(token string) *AvatarService {
return &AvatarService{ return &AvatarService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

8
cache/cache.go vendored
View File

@@ -4,6 +4,14 @@ import (
"go.m3o.com/client" "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 { func NewCacheService(token string) *CacheService {
return &CacheService{ return &CacheService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

200
contact/contact.go Executable file
View File

@@ -0,0 +1,200 @@
package contact
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{
Token: token,
}),
}
}
type ContactService struct {
client *client.Client
}
//
func (t *ContactService) Create(request *CreateRequest) (*CreateResponse, error) {
rsp := &CreateResponse{}
return rsp, t.client.Call("contact", "Create", request, rsp)
}
//
func (t *ContactService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("contact", "Delete", request, rsp)
}
//
func (t *ContactService) List(request *ListRequest) (*ListResponse, error) {
rsp := &ListResponse{}
return rsp, t.client.Call("contact", "List", request, rsp)
}
//
func (t *ContactService) Read(request *ReadRequest) (*ReadResponse, error) {
rsp := &ReadResponse{}
return rsp, t.client.Call("contact", "Read", request, rsp)
}
//
func (t *ContactService) Update(request *UpdateRequest) (*UpdateResponse, error) {
rsp := &UpdateResponse{}
return rsp, t.client.Call("contact", "Update", request, rsp)
}
type Address struct {
// the label of the address
Label string `json:"label"`
// the address location
Location string `json:"location"`
}
type ContactInfo struct {
// the address
Addresses []Address `json:"addresses"`
// the birthday
Birthday string `json:"birthday"`
// create date string in RFC3339
CreatedAt string `json:"created_at"`
// the emails
Emails []Email `json:"emails"`
// contact id
Id string `json:"id"`
// the contact links
Links []Link `json:"links"`
// the contact name
Name string `json:"name"`
// note of the contact
Note string `json:"note"`
// the phone numbers
Phones []Phone `json:"phones"`
// the social media username
SocialMedias *SocialMedia `json:"social_medias"`
// update date string in RFC3339
UpdatedAt string `json:"updated_at"`
}
type CreateRequest struct {
// optional, location
Addresses []Address `json:"addresses"`
// optional, birthday
Birthday string `json:"birthday"`
// optional, emails
Emails []Email `json:"emails"`
// optional, links
Links []Link `json:"links"`
// required, the name of the contact
Name string `json:"name"`
// optional, note of the contact
Note string `json:"note"`
// optional, phone numbers
Phones []Phone `json:"phones"`
// optional, social media
SocialMedias *SocialMedia `json:"social_medias"`
}
type CreateResponse struct {
Contact *ContactInfo `json:"contact"`
}
type DeleteRequest struct {
// the id of the contact
Id string `json:"id"`
}
type DeleteResponse struct {
}
type Email struct {
// the email address
Address string `json:"address"`
// the label of the email
Label string `json:"label"`
}
type Link struct {
// the label of the link
Label string `json:"label"`
// the url of the contact
Url string `json:"url"`
}
type ListRequest struct {
// optional, default is 30
Limit int32 `json:"limit"`
// optional
Offset int32 `json:"offset"`
}
type ListResponse struct {
Contacts []ContactInfo `json:"contacts"`
}
type Phone struct {
// the label of the phone number
Label string `json:"label"`
// phone number
Number string `json:"number"`
}
type ReadRequest struct {
Id string `json:"id"`
}
type ReadResponse struct {
Contact *ContactInfo `json:"contact"`
}
type SocialMedia struct {
// the label of the social
Label string `json:"label"`
// the username of social media
Username string `json:"username"`
}
type UpdateRequest struct {
// optional, addresses
Addresses []Address `json:"addresses"`
// optional, birthday
Birthday string `json:"birthday"`
// optional, emails
Emails []Email `json:"emails"`
// required, the contact id
Id string `json:"id"`
// optional, links
Links []Link `json:"links"`
// required, the name
Name string `json:"name"`
// optional, note
Note string `json:"note"`
// optional, phone number
Phones []Phone `json:"phones"`
// optional, social media
SocialMedias *SocialMedia `json:"social_medias"`
}
type UpdateResponse struct {
Contact *ContactInfo `json:"contact"`
}

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewCryptoService(token string) *CryptoService {
return &CryptoService{ return &CryptoService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewCurrencyService(token string) *CurrencyService {
return &CurrencyService{ return &CurrencyService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,18 @@ import (
"go.m3o.com/client" "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 { func NewDbService(token string) *DbService {
return &DbService{ return &DbService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Email interface {
Send(*SendRequest) (*SendResponse, error)
}
func NewEmailService(token string) *EmailService { func NewEmailService(token string) *EmailService {
return &EmailService{ return &EmailService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewEmojiService(token string) *EmojiService {
return &EmojiService{ return &EmojiService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Evchargers interface {
ReferenceData(*ReferenceDataRequest) (*ReferenceDataResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewEvchargersService(token string) *EvchargersService { func NewEvchargersService(token string) *EvchargersService {
return &EvchargersService{ return &EvchargersService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Event interface {
Consume(*ConsumeRequest) (*ConsumeResponseStream, error)
Publish(*PublishRequest) (*PublishResponse, error)
Read(*ReadRequest) (*ReadResponse, error)
}
func NewEventService(token string) *EventService { func NewEventService(token string) *EventService {
return &EventService{ return &EventService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https
Endpoints: Endpoints:
## Status
Get the status of an app
[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Get the status of an app
func GetTheStatusOfAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Status(&app.StatusRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Resolve
Resolve an app by id to its raw backend endpoint
[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Resolve an app by id to its raw backend endpoint
func ResolveAppById() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Resolve(&app.ResolveRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Update ## Update
Update the app. The latest source code will be downloaded, built and deployed. Update the app. The latest source code will be downloaded, built and deployed.
@@ -174,59 +230,3 @@ func ListRegions() {
} }
``` ```
## Status
Get the status of an app
[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Get the status of an app
func GetTheStatusOfAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Status(&app.StatusRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Resolve
Resolve an app by id to its raw backend endpoint
[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Resolve an app by id to its raw backend endpoint
func ResolveAppById() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Resolve(&app.ResolveRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}
```

219
examples/contact/README.md Executable file
View File

@@ -0,0 +1,219 @@
# Contact
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Contact/api](https://m3o.com/Contact/api).
Endpoints:
## Create
[https://m3o.com/contact/api#Create](https://m3o.com/contact/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func CreateAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Create(&contact.CreateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}
```
## Update
[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func UpdateAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Update(&contact.UpdateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}
```
## Read
[https://m3o.com/contact/api#Read](https://m3o.com/contact/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func GetAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Read(&contact.ReadRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}
```
## Delete
[https://m3o.com/contact/api#Delete](https://m3o.com/contact/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func DeleteAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
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 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)
}
```

View File

@@ -0,0 +1,39 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Create(&contact.CreateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{
Limit: 1,
Offset: 1,
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Read(&contact.ReadRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,40 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Update(&contact.UpdateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}

View File

@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api](
Endpoints: 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(&currency.HistoryRequest{
Code: "USD",
Date: "2021-05-30",
})
fmt.Println(rsp, err)
}
```
## Codes ## Codes
Codes returns the supported currency codes for the API 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(&currency.HistoryRequest{
Code: "USD",
Date: "2021-05-30",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,67 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
Endpoints: 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.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Read ## Read
Read data from a table. Lookup can be by ID or via querying any field in the record. Read data from a table. Lookup can be by ID or via querying any field in the record.
@@ -31,63 +92,6 @@ Table: "example",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## DropTable
Drop a table in the DB
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
fmt.Println(rsp, err)
}
```
## RenameTable
Rename a table
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Rename a table
func RenameTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "examples2",
To: "examples3",
})
fmt.Println(rsp, err)
} }
``` ```
## Truncate ## Truncate
@@ -116,6 +120,34 @@ func TruncateTable() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## DropTable
Drop a table in the DB
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
fmt.Println(rsp, err)
} }
``` ```
## Count ## Count
@@ -171,6 +203,35 @@ func ListTables() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## RenameTable
Rename a table
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Rename a table
func RenameTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "examples2",
To: "examples3",
})
fmt.Println(rsp, err)
} }
``` ```
## Create ## Create
@@ -195,10 +256,10 @@ func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{ rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"isActive": true,
"id": "1", "id": "1",
"name": "Jane", "name": "Jane",
"age": 42, "age": 42,
"isActive": true,
}, },
Table: "example", Table: "example",
@@ -207,64 +268,3 @@ Table: "example",
} }
``` ```
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```

View File

@@ -12,9 +12,9 @@ func main() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{ rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "user", Topic: "user",
}) })

View File

@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](http
Endpoints: Endpoints:
## Read
Read a file by path
[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// Read a file by path
func ReadFile() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Read(&file.ReadRequest{
Path: "/document/text-files/file.txt",
Project: "examples",
})
fmt.Println(rsp, err)
}
```
## Delete ## Delete
Delete a file by project name/path Delete a file by project name/path
@@ -122,3 +93,32 @@ func ListFiles() {
} }
``` ```
## Read
Read a file by path
[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// Read a file by path
func ReadFile() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Read(&file.ReadRequest{
Path: "/document/text-files/file.txt",
Project: "examples",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,40 +4,9 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api](
Endpoints: 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: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
})
fmt.Println(rsp, err)
}
```
## Update ## Update
Update a function Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update) [https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
@@ -52,14 +21,11 @@ import(
"go.m3o.com/function" "go.m3o.com/function"
) )
// Update a function // Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() { func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{ rsp, err := functionService.Update(&function.UpdateRequest{
Entrypoint: "helloworld", Name: "helloworld",
Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
@@ -89,6 +55,7 @@ func CallAfunction() {
rsp, err := functionService.Call(&function.CallRequest{ rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld", Name: "helloworld",
Request: map[string]interface{}{ Request: map[string]interface{}{
"name": "Alice",
}, },
}) })
@@ -121,6 +88,67 @@ func ListFunctions() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Regions
Return a list of supported regions
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)
}
```
## 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{
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
fmt.Println(rsp, err)
} }
``` ```
## Delete ## Delete
@@ -179,3 +207,59 @@ func DescribeFunctionStatus() {
} }
``` ```
## Reserve
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Proxy
Return the backend url for proxying
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,7 +12,9 @@ func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{ rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld", Name: "helloworld",
Request: map[string]interface{}{}, Request: map[string]interface{}{
"name": "Alice",
},
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }

View File

@@ -12,7 +12,6 @@ func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{ rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "my-first-func", Name: "my-first-func",
Project: "tests",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }

View File

@@ -13,7 +13,6 @@ func DeployAfunction() {
rsp, err := functionService.Deploy(&function.DeployRequest{ rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld", Entrypoint: "helloworld",
Name: "my-first-func", Name: "my-first-func",
Project: "tests",
Repo: "github.com/m3o/nodejs-function-example", Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14", Runtime: "nodejs14",
}) })

View File

@@ -11,10 +11,13 @@ import (
func main() { func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{ rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld", Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld", Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example", Region: "europe-west1",
Runtime: "nodejs14", Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }

View File

@@ -12,7 +12,6 @@ func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{ rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "my-first-func", Name: "my-first-func",
Project: "tests",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Return the backend url for proxying
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported regions
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}

View File

@@ -7,14 +7,11 @@ import (
"go.m3o.com/function" "go.m3o.com/function"
) )
// Update a function // Update a function. Downloads the source, builds and redeploys
func main() { func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN")) functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{ rsp, err := functionService.Update(&function.UpdateRequest{
Entrypoint: "helloworld",
Name: "helloworld", Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }

View File

@@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Id/api](https:
Endpoints: Endpoints:
## Types
List the types of IDs available. No query params needed.
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/id"
)
// List the types of IDs available. No query params needed.
func ListTheTypesOfIdsAvailable() {
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
rsp, err := idService.Types(&id.TypesRequest{
})
fmt.Println(rsp, err)
}
```
## Generate ## Generate
Generate a unique ID. Defaults to uuid. Generate a unique ID. Defaults to uuid.
@@ -143,3 +116,30 @@ func GenerateAbigflakeId() {
} }
``` ```
## Types
List the types of IDs available. No query params needed.
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/id"
)
// List the types of IDs available. No query params needed.
func ListTheTypesOfIdsAvailable() {
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
rsp, err := idService.Types(&id.TypesRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,76 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
Endpoints: Endpoints:
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Delete ## Delete
Delete an image previously uploaded. Delete an image previously uploaded.
@@ -186,73 +256,3 @@ Url: "somewebsite.com/cat.png",
} }
``` ```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```

View File

@@ -26,9 +26,9 @@ func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{ rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"id": "1",
"type": "signup", "type": "signup",
"user": "john", "user": "john",
"id": "1",
}, },
Topic: "events", Topic: "events",

View File

@@ -12,9 +12,9 @@ func main() {
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{ rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "events", Topic: "events",
}) })

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Nft/api](https
Endpoints: 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
Create your own NFT (coming soon) 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)
}
```

View File

@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt
Endpoints: 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(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```
## Read ## Read
Read a note 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(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Postcode/api](
Endpoints: 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
Lookup a postcode to retrieve the related region, county, etc 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)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Quran/api](htt
Endpoints: 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 ## Summary
Get a summary for a given chapter (surah) Get a summary for a given chapter (surah)
@@ -92,31 +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)
}
```

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Rss/api](https
Endpoints: Endpoints:
## Feed
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
[https://m3o.com/rss/api#Feed](https://m3o.com/rss/api#Feed)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
func ReadAfeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Feed(&rss.FeedRequest{
Name: "bbc",
})
fmt.Println(rsp, err)
}
```
## List ## List
List the saved RSS fields List the saved RSS fields
@@ -117,3 +89,31 @@ Url: "http://feeds.bbci.co.uk/news/rss.xml",
} }
``` ```
## Feed
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
[https://m3o.com/rss/api#Feed](https://m3o.com/rss/api#Feed)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
func ReadAfeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Feed(&rss.FeedRequest{
Name: "bbc",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,90 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Space/api](htt
Endpoints: 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
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read an object in space
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Read an object in space
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Download ## Download
Download an object via a presigned url Download an object via a presigned url
@@ -148,87 +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)
}
```
## Head
Retrieve meta information about an object
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read an object in space
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Read an object in space
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stock/api](htt
Endpoints: Endpoints:
## Price
Get the last price for a given stock ticker
[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stock"
)
// Get the last price for a given stock ticker
func GetAstockPrice() {
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
rsp, err := stockService.Price(&stock.PriceRequest{
Symbol: "AAPL",
})
fmt.Println(rsp, err)
}
```
## Quote ## Quote
Get the last quote for the stock Get the last quote for the stock
@@ -93,31 +121,3 @@ Stock: "AAPL",
} }
``` ```
## Price
Get the last price for a given stock ticker
[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stock"
)
// Get the last price for a given stock ticker
func GetAstockPrice() {
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
rsp, err := stockService.Price(&stock.PriceRequest{
Symbol: "AAPL",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](ht
Endpoints: 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 ## CreateChannel
Create a channel with a given name and description. Channels are created automatically but 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)
}
```

View File

@@ -4,6 +4,65 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sunnah/api](ht
Endpoints: Endpoints:
## Collections
Get a list of available collections. A collection is
a compilation of hadiths collected and written by an author.
[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
func ListAvailableCollections() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{
})
fmt.Println(rsp, err)
}
```
## Books
Get a list of books from within a collection. A book can contain many chapters
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 ## Chapters
Get all the chapters of a given book within a collection. Get all the chapters of a given book within a collection.
@@ -64,62 +123,3 @@ Collection: "bukhari",
} }
``` ```
## Collections
Get a list of available collections. A collection is
a compilation of hadiths collected and written by an author.
[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
func ListAvailableCollections() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{
})
fmt.Println(rsp, err)
}
```
## Books
Get a list of books from within a collection. A book can contain many chapters
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)
}
```

View File

@@ -4,6 +4,66 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http
Endpoints: Endpoints:
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
}
```
## 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,
})
fmt.Println(rsp, err)
}
```
## SendMagicLink ## SendMagicLink
Login using email only - Passwordless Login using email only - Passwordless
@@ -37,6 +97,177 @@ Click here to access your account $micro_verification_link`,
}) })
fmt.Println(rsp, err) 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)
}
```
## SendVerificationEmail
Send a verification email
to the user being signed up. Email from will be from 'noreply@email.m3ocontent.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 'noreply@email.m3ocontent.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)
}
```
## ResetPassword
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
func ResetPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
Code: "012345",
ConfirmPassword: "NewPassword1",
Email: "joe@example.com",
NewPassword: "NewPassword1",
})
fmt.Println(rsp, err)
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
fmt.Println(rsp, err)
}
```
## UpdatePassword
Update the account password
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
})
fmt.Println(rsp, err)
} }
``` ```
## Read ## Read
@@ -123,18 +354,13 @@ func ReadAccountByEmail() {
} }
``` ```
## SendVerificationEmail ## SendPasswordResetEmail
Send a verification email Send an email with a verification code to reset password.
to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com', Call "ResetPassword" endpoint once user provides the code.
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) [https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go ```go
package example package example
@@ -146,144 +372,16 @@ import(
"go.m3o.com/user" "go.m3o.com/user"
) )
// Send a verification email // Send an email with a verification code to reset password.
// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com', // Call "ResetPassword" endpoint once user provides the code.
// but you can provide the title and contents. func SendPasswordResetEmail() {
// 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")) userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{ rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
Email: "joe@example.com", Email: "joe@example.com",
FailureRedirectUrl: "https://m3o.com/verification-failed",
FromName: "Awesome Dot Com", FromName: "Awesome Dot Com",
RedirectUrl: "https://m3o.com", Subject: "Password reset",
Subject: "Email verification",
TextContent: `Hi there, TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
Please verify your email by clicking this link: $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)
}
```
## Logout
Logout a user account
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Logout a user account
func LogAuserOut() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Logout(&user.LogoutRequest{
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
})
fmt.Println(rsp, err)
}
```
## 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,
})
fmt.Println(rsp, err)
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
@@ -316,6 +414,91 @@ func ReadAsessionByTheSessionId() {
}) })
fmt.Println(rsp, err) 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)
}
```
## 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: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
})
fmt.Println(rsp, err)
}
```
## Logout
Logout a user account
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Logout a user account
func LogAuserOut() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Logout(&user.LogoutRequest{
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
})
fmt.Println(rsp, err)
} }
``` ```
## Create ## Create
@@ -349,186 +532,3 @@ Username: "joe",
} }
``` ```
## 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
Update the account password
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
})
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: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
})
fmt.Println(rsp, err)
}
```
## SendPasswordResetEmail
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Send an email with a verification code to reset password.
// Call "ResetPassword" endpoint once user provides the code.
func SendPasswordResetEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
Email: "joe@example.com",
FromName: "Awesome Dot Com",
Subject: "Password reset",
TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
})
fmt.Println(rsp, err)
}
```
## ResetPassword
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
func ResetPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
Code: "012345",
ConfirmPassword: "NewPassword1",
Email: "joe@example.com",
NewPassword: "NewPassword1",
})
fmt.Println(rsp, err)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewFileService(token string) *FileService {
return &FileService{ return &FileService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Forex interface {
History(*HistoryRequest) (*HistoryResponse, error)
Price(*PriceRequest) (*PriceResponse, error)
Quote(*QuoteRequest) (*QuoteResponse, error)
}
func NewForexService(token string) *ForexService { func NewForexService(token string) *ForexService {
return &ForexService{ return &ForexService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,18 @@ import (
"go.m3o.com/client" "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 { func NewFunctionService(token string) *FunctionService {
return &FunctionService{ return &FunctionService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{
@@ -56,7 +68,31 @@ func (t *FunctionService) List(request *ListRequest) (*ListResponse, error) {
} }
// Update a function // Return the backend url for proxying
func (t *FunctionService) Proxy(request *ProxyRequest) (*ProxyResponse, error) {
rsp := &ProxyResponse{}
return rsp, t.client.Call("function", "Proxy", request, rsp)
}
// Return a list of supported regions
func (t *FunctionService) Regions(request *RegionsRequest) (*RegionsResponse, error) {
rsp := &RegionsResponse{}
return rsp, t.client.Call("function", "Regions", request, rsp)
}
// Reserve function names and resources beyond free quota
func (t *FunctionService) Reserve(request *ReserveRequest) (*ReserveResponse, error) {
rsp := &ReserveResponse{}
return rsp, t.client.Call("function", "Reserve", request, rsp)
}
// Update a function. Downloads the source, builds and redeploys
func (t *FunctionService) Update(request *UpdateRequest) (*UpdateResponse, error) { func (t *FunctionService) Update(request *UpdateRequest) (*UpdateResponse, error) {
rsp := &UpdateResponse{} rsp := &UpdateResponse{}
@@ -79,14 +115,14 @@ type CallResponse struct {
type DeleteRequest struct { type DeleteRequest struct {
// The name of the function // The name of the function
Name string `json:"name"` Name string `json:"name"`
// Optional project name
Project string `json:"project"`
} }
type DeleteResponse struct { type DeleteResponse struct {
} }
type DeployRequest struct { type DeployRequest struct {
// branch to deploy. defaults to master
Branch string `json:"branch"`
// entry point, ie. handler name in the source code // entry point, ie. handler name in the source code
// if not provided, defaults to the name parameter // if not provided, defaults to the name parameter
Entrypoint string `json:"entrypoint"` Entrypoint string `json:"entrypoint"`
@@ -94,18 +130,13 @@ type DeployRequest struct {
EnvVars map[string]string `json:"env_vars"` EnvVars map[string]string `json:"env_vars"`
// function name // function name
Name string `json:"name"` Name string `json:"name"`
// project is used for namespacing your functions // region to deploy in. defaults to europe-west1
// optional. defaults to "default". Region string `json:"region"`
Project string `json:"project"`
// github url to repo // github url to repo
Repo string `json:"repo"` Repo string `json:"repo"`
// runtime/language of the function // runtime/lanaguage of the function e.g php74,
// eg: php74, // nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16 // dotnet3, java11, ruby26, ruby27, go111, go113, go116,
// dotnet3
// java11
// ruby26, ruby27
// go111, go113, go116
// python37, python38, python39 // python37, python38, python39
Runtime string `json:"runtime"` Runtime string `json:"runtime"`
// optional subfolder path // optional subfolder path
@@ -113,56 +144,53 @@ type DeployRequest struct {
} }
type DeployResponse struct { type DeployResponse struct {
Function *Func `json:"function"`
} }
type DescribeRequest struct { type DescribeRequest struct {
// The name of the function // The name of the function
Name string `json:"name"` Name string `json:"name"`
// Optional project name
Project string `json:"project"`
} }
type DescribeResponse struct { type DescribeResponse struct {
// The function requested // The function requested
Function *Func `json:"function"` Function *Func `json:"function"`
// The timeout for requests to the function
Timeout string `json:"timeout"`
// The time at which the function was updated
UpdatedAt string `json:"updated_at"`
} }
type Func struct { type Func struct {
// branch to deploy. defaults to master
Branch string `json:"branch"`
// time of creation
Created string `json:"created"`
// name of handler in source code // name of handler in source code
Entrypoint string `json:"entrypoint"` Entrypoint string `json:"entrypoint"`
// associated env vars // associated env vars
EnvVars map[string]string `json:"env_vars"` EnvVars map[string]string `json:"env_vars"`
// id of the function
Id string `json:"id"`
// function name // function name
// limitation: must be unique across projects // limitation: must be unique across projects
Name string `json:"name"` Name string `json:"name"`
// project of function, optional // region to deploy in. defaults to europe-west1
// defaults to literal "default" Region string `json:"region"`
// used to namespace functions
Project string `json:"project"`
// git repo address // git repo address
Repo string `json:"repo"` Repo string `json:"repo"`
// runtime/language of the function // runtime/language of the function e.g php74,
// eg: php74, // nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16 // dotnet3, java11, ruby26, ruby27, go111, go113, go116,
// dotnet3
// java11
// ruby26, ruby27
// go111, go113, go116
// python37, python38, python39 // python37, python38, python39
Runtime string `json:"runtime"` Runtime string `json:"runtime"`
// eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc // eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc
Status string `json:"status"` Status string `json:"status"`
// subfolder path to entrypoint // subfolder path to entrypoint
Subfolder string `json:"subfolder"` Subfolder string `json:"subfolder"`
// time it was updated
Updated string `json:"updated"`
// unique url of the function
Url string `json:"url"`
} }
type ListRequest struct { type ListRequest struct {
// optional project name
Project string `json:"project"`
} }
type ListResponse struct { type ListResponse struct {
@@ -170,30 +198,49 @@ type ListResponse struct {
Functions []Func `json:"functions"` Functions []Func `json:"functions"`
} }
type ProxyRequest struct {
// id of the function
Id string `json:"id"`
}
type ProxyResponse struct {
// backend url
Url string `json:"url"`
}
type RegionsRequest struct {
}
type RegionsResponse struct {
Regions []string `json:"regions"`
}
type Reservation struct {
// time of reservation
Created string `json:"created"`
// time reservation expires
Expires string `json:"expires"`
// name of the app
Name string `json:"name"`
// owner id
Owner string `json:"owner"`
// associated token
Token string `json:"token"`
}
type ReserveRequest struct {
// name of your app e.g helloworld
Name string `json:"name"`
}
type ReserveResponse struct {
// The app reservation
Reservation *Reservation `json:"reservation"`
}
type UpdateRequest struct { type UpdateRequest struct {
// entry point, ie. handler name in the source code
// if not provided, defaults to the name parameter
Entrypoint string `json:"entrypoint"`
// environment variables to pass in at runtime
EnvVars map[string]string `json:"env_vars"`
// function name // function name
Name string `json:"name"` Name string `json:"name"`
// project is used for namespacing your functions
// optional. defaults to "default".
Project string `json:"project"`
// github url to repo
Repo string `json:"repo"`
// runtime/language of the function
// eg: php74,
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16
// dotnet3
// java11
// ruby26, ruby27
// go111, go113, go116
// python37, python38, python39
Runtime string `json:"runtime"`
// optional subfolder path
Subfolder string `json:"subfolder"`
} }
type UpdateResponse struct { type UpdateResponse struct {

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Geocoding interface {
Lookup(*LookupRequest) (*LookupResponse, error)
Reverse(*ReverseRequest) (*ReverseResponse, error)
}
func NewGeocodingService(token string) *GeocodingService { func NewGeocodingService(token string) *GeocodingService {
return &GeocodingService{ return &GeocodingService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Gifs interface {
Search(*SearchRequest) (*SearchResponse, error)
}
func NewGifsService(token string) *GifsService { func NewGifsService(token string) *GifsService {
return &GifsService{ return &GifsService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Google interface {
Search(*SearchRequest) (*SearchResponse, error)
}
func NewGoogleService(token string) *GoogleService { func NewGoogleService(token string) *GoogleService {
return &GoogleService{ return &GoogleService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Helloworld interface {
Call(*CallRequest) (*CallResponse, error)
Stream(*StreamRequest) (*StreamResponseStream, error)
}
func NewHelloworldService(token string) *HelloworldService { func NewHelloworldService(token string) *HelloworldService {
return &HelloworldService{ return &HelloworldService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Holidays interface {
Countries(*CountriesRequest) (*CountriesResponse, error)
List(*ListRequest) (*ListResponse, error)
}
func NewHolidaysService(token string) *HolidaysService { func NewHolidaysService(token string) *HolidaysService {
return &HolidaysService{ return &HolidaysService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Id interface {
Generate(*GenerateRequest) (*GenerateResponse, error)
Types(*TypesRequest) (*TypesResponse, error)
}
func NewIdService(token string) *IdService { func NewIdService(token string) *IdService {
return &IdService{ return &IdService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewImageService(token string) *ImageService {
return &ImageService{ return &ImageService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Ip interface {
Lookup(*LookupRequest) (*LookupResponse, error)
}
func NewIpService(token string) *IpService { func NewIpService(token string) *IpService {
return &IpService{ return &IpService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Joke interface {
Random(*RandomRequest) (*RandomResponse, error)
}
func NewJokeService(token string) *JokeService { func NewJokeService(token string) *JokeService {
return &JokeService{ return &JokeService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Location interface {
Read(*ReadRequest) (*ReadResponse, error)
Save(*SaveRequest) (*SaveResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewLocationService(token string) *LocationService { func NewLocationService(token string) *LocationService {
return &LocationService{ return &LocationService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

3
m3o.go
View File

@@ -6,6 +6,7 @@ import (
"go.m3o.com/app" "go.m3o.com/app"
"go.m3o.com/avatar" "go.m3o.com/avatar"
"go.m3o.com/cache" "go.m3o.com/cache"
"go.m3o.com/contact"
"go.m3o.com/crypto" "go.m3o.com/crypto"
"go.m3o.com/currency" "go.m3o.com/currency"
"go.m3o.com/db" "go.m3o.com/db"
@@ -66,6 +67,7 @@ func NewClient(token string) *Client {
AppService: app.NewAppService(token), AppService: app.NewAppService(token),
AvatarService: avatar.NewAvatarService(token), AvatarService: avatar.NewAvatarService(token),
CacheService: cache.NewCacheService(token), CacheService: cache.NewCacheService(token),
ContactService: contact.NewContactService(token),
CryptoService: crypto.NewCryptoService(token), CryptoService: crypto.NewCryptoService(token),
CurrencyService: currency.NewCurrencyService(token), CurrencyService: currency.NewCurrencyService(token),
DbService: db.NewDbService(token), DbService: db.NewDbService(token),
@@ -126,6 +128,7 @@ type Client struct {
AppService *app.AppService AppService *app.AppService
AvatarService *avatar.AvatarService AvatarService *avatar.AvatarService
CacheService *cache.CacheService CacheService *cache.CacheService
ContactService *contact.ContactService
CryptoService *crypto.CryptoService CryptoService *crypto.CryptoService
CurrencyService *currency.CurrencyService CurrencyService *currency.CurrencyService
DbService *db.DbService DbService *db.DbService

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Movie interface {
Search(*SearchRequest) (*SearchResponse, error)
}
func NewMovieService(token string) *MovieService { func NewMovieService(token string) *MovieService {
return &MovieService{ return &MovieService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Mq interface {
Publish(*PublishRequest) (*PublishResponse, error)
Subscribe(*SubscribeRequest) (*SubscribeResponseStream, error)
}
func NewMqService(token string) *MqService { func NewMqService(token string) *MqService {
return &MqService{ return &MqService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type News interface {
Headlines(*HeadlinesRequest) (*HeadlinesResponse, error)
}
func NewNewsService(token string) *NewsService { func NewNewsService(token string) *NewsService {
return &NewsService{ return &NewsService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Nft interface {
Assets(*AssetsRequest) (*AssetsResponse, error)
Collections(*CollectionsRequest) (*CollectionsResponse, error)
Create(*CreateRequest) (*CreateResponse, error)
}
func NewNftService(token string) *NftService { func NewNftService(token string) *NftService {
return &NftService{ return &NftService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,15 @@ import (
"go.m3o.com/client" "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 { func NewNotesService(token string) *NotesService {
return &NotesService{ return &NotesService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Otp interface {
Generate(*GenerateRequest) (*GenerateResponse, error)
Validate(*ValidateRequest) (*ValidateResponse, error)
}
func NewOtpService(token string) *OtpService { func NewOtpService(token string) *OtpService {
return &OtpService{ return &OtpService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Postcode interface {
Lookup(*LookupRequest) (*LookupResponse, error)
Random(*RandomRequest) (*RandomResponse, error)
Validate(*ValidateRequest) (*ValidateResponse, error)
}
func NewPostcodeService(token string) *PostcodeService { func NewPostcodeService(token string) *PostcodeService {
return &PostcodeService{ return &PostcodeService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Prayer interface {
Times(*TimesRequest) (*TimesResponse, error)
}
func NewPrayerService(token string) *PrayerService { func NewPrayerService(token string) *PrayerService {
return &PrayerService{ return &PrayerService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Qr interface {
Generate(*GenerateRequest) (*GenerateResponse, error)
}
func NewQrService(token string) *QrService { func NewQrService(token string) *QrService {
return &QrService{ return &QrService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewQuranService(token string) *QuranService {
return &QuranService{ return &QuranService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Routing interface {
Directions(*DirectionsRequest) (*DirectionsResponse, error)
Eta(*EtaRequest) (*EtaResponse, error)
Route(*RouteRequest) (*RouteResponse, error)
}
func NewRoutingService(token string) *RoutingService { func NewRoutingService(token string) *RoutingService {
return &RoutingService{ return &RoutingService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewRssService(token string) *RssService {
return &RssService{ return &RssService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Search interface {
Vote(*VoteRequest) (*VoteResponse, error)
}
func NewSearchService(token string) *SearchService { func NewSearchService(token string) *SearchService {
return &SearchService{ return &SearchService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Sentiment interface {
Analyze(*AnalyzeRequest) (*AnalyzeResponse, error)
}
func NewSentimentService(token string) *SentimentService { func NewSentimentService(token string) *SentimentService {
return &SentimentService{ return &SentimentService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Sms interface {
Send(*SendRequest) (*SendResponse, error)
}
func NewSmsService(token string) *SmsService { func NewSmsService(token string) *SmsService {
return &SmsService{ return &SmsService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,17 @@ import (
"go.m3o.com/client" "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 { func NewSpaceService(token string) *SpaceService {
return &SpaceService{ return &SpaceService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Spam interface {
Classify(*ClassifyRequest) (*ClassifyResponse, error)
}
func NewSpamService(token string) *SpamService { func NewSpamService(token string) *SpamService {
return &SpamService{ return &SpamService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewStockService(token string) *StockService {
return &StockService{ return &StockService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewStreamService(token string) *StreamService {
return &StreamService{ return &StreamService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewSunnahService(token string) *SunnahService {
return &SunnahService{ return &SunnahService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Thumbnail interface {
Screenshot(*ScreenshotRequest) (*ScreenshotResponse, error)
}
func NewThumbnailService(token string) *ThumbnailService { func NewThumbnailService(token string) *ThumbnailService {
return &ThumbnailService{ return &ThumbnailService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Time interface {
Now(*NowRequest) (*NowResponse, error)
Zone(*ZoneRequest) (*ZoneResponse, error)
}
func NewTimeService(token string) *TimeService { func NewTimeService(token string) *TimeService {
return &TimeService{ return &TimeService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Translate interface {
Text(*TextRequest) (*TextResponse, error)
}
func NewTranslateService(token string) *TranslateService { func NewTranslateService(token string) *TranslateService {
return &TranslateService{ return &TranslateService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client" "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 { func NewTwitterService(token string) *TwitterService {
return &TwitterService{ return &TwitterService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Url interface {
List(*ListRequest) (*ListResponse, error)
Proxy(*ProxyRequest) (*ProxyResponse, error)
Shorten(*ShortenRequest) (*ShortenResponse, error)
}
func NewUrlService(token string) *UrlService { func NewUrlService(token string) *UrlService {
return &UrlService{ return &UrlService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,24 @@ import (
"go.m3o.com/client" "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 { func NewUserService(token string) *UserService {
return &UserService{ return &UserService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Vehicle interface {
Lookup(*LookupRequest) (*LookupResponse, error)
}
func NewVehicleService(token string) *VehicleService { func NewVehicleService(token string) *VehicleService {
return &VehicleService{ return &VehicleService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Weather interface {
Forecast(*ForecastRequest) (*ForecastResponse, error)
Now(*NowRequest) (*NowResponse, error)
}
func NewWeatherService(token string) *WeatherService { func NewWeatherService(token string) *WeatherService {
return &WeatherService{ return &WeatherService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client" "go.m3o.com/client"
) )
type Youtube interface {
Embed(*EmbedRequest) (*EmbedResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewYoutubeService(token string) *YoutubeService { func NewYoutubeService(token string) *YoutubeService {
return &YoutubeService{ return &YoutubeService{
client: client.NewClient(&client.Options{ client: client.NewClient(&client.Options{