mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Commit from m3o/m3o action
This commit is contained in:
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete an app
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/app"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete an app
|
||||||
|
func DeleteAnApp() {
|
||||||
|
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := appService.Delete(&app.DeleteRequest{
|
||||||
|
Name: "helloworld",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Reserve
|
## Reserve
|
||||||
|
|
||||||
Reserve apps beyond the free quota. Call Run after.
|
Reserve apps beyond the free quota. Call Run after.
|
||||||
@@ -202,31 +230,3 @@ func UpdateAnApp() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete an app
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/app"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete an app
|
|
||||||
func DeleteAnApp() {
|
|
||||||
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := appService.Delete(&app.DeleteRequest{
|
|
||||||
Name: "helloworld",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
112
examples/cache/README.md
vendored
112
examples/cache/README.md
vendored
@@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## ListKeys
|
||||||
|
|
||||||
|
List all the available keys
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the available keys
|
||||||
|
func ListTheKeys() {
|
||||||
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Set
|
||||||
|
|
||||||
|
Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
func SetAvalue() {
|
||||||
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cacheService.Set(&cache.SetRequest{
|
||||||
|
Key: "foo",
|
||||||
|
Value: "bar",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Get
|
## Get
|
||||||
|
|
||||||
Get an item from the cache by key. If key is not found, an empty response is returned.
|
Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||||
@@ -118,59 +174,3 @@ Value: 2,
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## ListKeys
|
|
||||||
|
|
||||||
List all the available keys
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the available keys
|
|
||||||
func ListTheKeys() {
|
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Set
|
|
||||||
|
|
||||||
Set an item in the cache. Overwrites any existing value already set.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Set an item in the cache. Overwrites any existing value already set.
|
|
||||||
func SetAvalue() {
|
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cacheService.Set(&cache.SetRequest{
|
|
||||||
Key: "foo",
|
|
||||||
Value: "bar",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -63,100 +63,6 @@ Text: "Hey whats up?",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## History
|
|
||||||
|
|
||||||
List the messages in a chat
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/chat"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List the messages in a chat
|
|
||||||
func GetChatHistory() {
|
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := chatService.History(&chat.HistoryRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Join
|
|
||||||
|
|
||||||
Join a chat room
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#Join](https://m3o.com/chat/api#Join)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/chat"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Join a chat room
|
|
||||||
func JoinAroom() {
|
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
|
|
||||||
stream, err := chatService.Join(&chat.JoinRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
|
||||||
rsp, err := stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(rsp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Kick
|
|
||||||
|
|
||||||
Kick a user from a chat room
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/chat"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Kick a user from a chat room
|
|
||||||
func KickAuserFromAroom() {
|
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := chatService.Kick(&chat.KickRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Leave
|
## Leave
|
||||||
@@ -267,3 +173,97 @@ func InviteAuser() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## History
|
||||||
|
|
||||||
|
List the messages in a chat
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/chat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List the messages in a chat
|
||||||
|
func GetChatHistory() {
|
||||||
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := chatService.History(&chat.HistoryRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Join
|
||||||
|
|
||||||
|
Join a chat room
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/chat/api#Join](https://m3o.com/chat/api#Join)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/chat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Join a chat room
|
||||||
|
func JoinAroom() {
|
||||||
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
|
||||||
|
stream, err := chatService.Join(&chat.JoinRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
rsp, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(rsp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Kick
|
||||||
|
|
||||||
|
Kick a user from a chat room
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/chat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Kick a user from a chat room
|
||||||
|
func KickAuserFromAroom() {
|
||||||
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := chatService.Kick(&chat.KickRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/comments/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a new comment
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/comments/api#Create](https://m3o.com/comments/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/comments"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a new comment
|
||||||
|
func CreateAcomment() {
|
||||||
|
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := commentsService.Create(&comments.CreateRequest{
|
||||||
|
Text: "This is my comment",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read a comment
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/comments"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a comment
|
||||||
|
func ReadAcomment() {
|
||||||
|
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := commentsService.Read(&comments.ReadRequest{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## List
|
## List
|
||||||
|
|
||||||
List all the comments
|
List all the comments
|
||||||
@@ -132,59 +188,3 @@ func SubscribeToEvents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
|
||||||
|
|
||||||
Create a new comment
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/comments/api#Create](https://m3o.com/comments/api#Create)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/comments"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a new comment
|
|
||||||
func CreateAcomment() {
|
|
||||||
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := commentsService.Create(&comments.CreateRequest{
|
|
||||||
Text: "This is my comment",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read a comment
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/comments"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read a comment
|
|
||||||
func ReadAcomment() {
|
|
||||||
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := commentsService.Read(&comments.ReadRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,85 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Update
|
||||||
|
|
||||||
|
Update a contact
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update a 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
|
||||||
|
|
||||||
|
Read contact details
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#Read](https://m3o.com/contact/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read contact details
|
||||||
|
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
|
## Delete
|
||||||
|
|
||||||
Delete a contact
|
Delete a contact
|
||||||
@@ -138,82 +217,3 @@ contact.Phone{
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Update
|
|
||||||
|
|
||||||
Update a contact
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update a 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
|
|
||||||
|
|
||||||
Read contact details
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#Read](https://m3o.com/contact/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read contact details
|
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/crypto/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## News
|
||||||
|
|
||||||
|
Get news related to a currency
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/crypto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get news related to a currency
|
||||||
|
func GetCryptocurrencyNews() {
|
||||||
|
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cryptoService.News(&crypto.NewsRequest{
|
||||||
|
Symbol: "BTCUSD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Price
|
||||||
|
|
||||||
|
Get the last price for a given crypto ticker
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/crypto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the last price for a given crypto ticker
|
||||||
|
func GetCryptocurrencyPrice() {
|
||||||
|
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cryptoService.Price(&crypto.PriceRequest{
|
||||||
|
Symbol: "BTCUSD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Quote
|
## Quote
|
||||||
|
|
||||||
Get the last quote for a given crypto ticker
|
Get the last quote for a given crypto ticker
|
||||||
@@ -87,59 +143,3 @@ func GetListOfAllSupportedSymbols() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## News
|
|
||||||
|
|
||||||
Get news related to a currency
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get news related to a currency
|
|
||||||
func GetCryptocurrencyNews() {
|
|
||||||
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cryptoService.News(&crypto.NewsRequest{
|
|
||||||
Symbol: "BTCUSD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Price
|
|
||||||
|
|
||||||
Get the last price for a given crypto ticker
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the last price for a given crypto ticker
|
|
||||||
func GetCryptocurrencyPrice() {
|
|
||||||
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cryptoService.Price(&crypto.PriceRequest{
|
|
||||||
Symbol: "BTCUSD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/currency/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Codes
|
||||||
|
|
||||||
|
Codes returns the supported currency codes for the API
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/currency"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Codes returns the supported currency codes for the API
|
||||||
|
func GetSupportedCodes() {
|
||||||
|
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := currencyService.Codes(¤cy.CodesRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Rates
|
||||||
|
|
||||||
|
Rates returns the currency rates for a given code e.g USD
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/currency/api#Rates](https://m3o.com/currency/api#Rates)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/currency"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Rates returns the currency rates for a given code e.g USD
|
||||||
|
func GetRatesForUsd() {
|
||||||
|
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := currencyService.Rates(¤cy.RatesRequest{
|
||||||
|
Code: "USD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Convert
|
## Convert
|
||||||
|
|
||||||
Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||||
@@ -92,58 +147,3 @@ Date: "2021-05-30",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Codes
|
|
||||||
|
|
||||||
Codes returns the supported currency codes for the API
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/currency"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Codes returns the supported currency codes for the API
|
|
||||||
func GetSupportedCodes() {
|
|
||||||
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := currencyService.Codes(¤cy.CodesRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Rates
|
|
||||||
|
|
||||||
Rates returns the currency rates for a given code e.g USD
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/currency/api#Rates](https://m3o.com/currency/api#Rates)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/currency"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Rates returns the currency rates for a given code e.g USD
|
|
||||||
func GetRatesForUsd() {
|
|
||||||
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := currencyService.Rates(¤cy.RatesRequest{
|
|
||||||
Code: "USD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,40 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
func CreateArecord() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
|
Record: map[string]interface{}{
|
||||||
|
"isActive": true,
|
||||||
|
"id": "1",
|
||||||
|
"name": "Jane",
|
||||||
|
"age": 42,
|
||||||
|
},
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
Update a record in the database. Include an "id" in the record to update.
|
Update a record in the database. Include an "id" in the record to update.
|
||||||
@@ -34,6 +68,118 @@ Table: "example",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Truncate
|
||||||
|
|
||||||
|
Truncate the records in a table
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Truncate the records in a table
|
||||||
|
func TruncateTable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## ListTables
|
||||||
|
|
||||||
|
List tables in the DB
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List tables in the DB
|
||||||
|
func ListTables() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.ListTables(&db.ListTablesRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read data from a table. Lookup can be by ID or via querying any field in the record.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Read](https://m3o.com/db/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read data from a table. Lookup can be by ID or via querying any field in the record.
|
||||||
|
func ReadRecords() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Read(&db.ReadRequest{
|
||||||
|
Query: "age == 43",
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Delete
|
## Delete
|
||||||
@@ -63,125 +209,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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
|
||||||
|
|
||||||
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
|
||||||
func CreateArecord() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
|
||||||
Record: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"name": "Jane",
|
|
||||||
"age": 42,
|
|
||||||
"isActive": true,
|
|
||||||
},
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read data from a table. Lookup can be by ID or via querying any field in the record.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Read](https://m3o.com/db/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read data from a table. Lookup can be by ID or via querying any field in the record.
|
|
||||||
func ReadRecords() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Read(&db.ReadRequest{
|
|
||||||
Query: "age == 43",
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Truncate
|
|
||||||
|
|
||||||
Truncate the records in a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Truncate the records in a table
|
|
||||||
func TruncateTable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Count
|
## Count
|
||||||
@@ -210,33 +237,6 @@ func CountEntriesInAtable() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ListTables
|
|
||||||
|
|
||||||
List tables in the DB
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List tables in the DB
|
|
||||||
func ListTables() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.ListTables(&db.ListTablesRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## RenameTable
|
## RenameTable
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ func main() {
|
|||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := dbService.Update(&db.UpdateRequest{
|
rsp, err := dbService.Update(&db.UpdateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"age": 43,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
|
"age": 43,
|
||||||
},
|
},
|
||||||
Table: "example",
|
Table: "example",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/email/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Send
|
|
||||||
|
|
||||||
Send an email by passing in from, to, subject, and a text or html body
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/email/api#Send](https://m3o.com/email/api#Send)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/email"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Send an email by passing in from, to, subject, and a text or html body
|
|
||||||
func SendEmail() {
|
|
||||||
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := emailService.Send(&email.SendRequest{
|
|
||||||
From: "Awesome Dot Com",
|
|
||||||
Subject: "Email verification",
|
|
||||||
TextBody: `Hi there,
|
|
||||||
|
|
||||||
Please verify your email by clicking this link: $micro_verification_link`,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Parse
|
## Parse
|
||||||
|
|
||||||
Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
||||||
@@ -92,3 +60,35 @@ func ValidateEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Send
|
||||||
|
|
||||||
|
Send an email by passing in from, to, subject, and a text or html body
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/email/api#Send](https://m3o.com/email/api#Send)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/email"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Send an email by passing in from, to, subject, and a text or html body
|
||||||
|
func SendEmail() {
|
||||||
|
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := emailService.Send(&email.SendRequest{
|
||||||
|
From: "Awesome Dot Com",
|
||||||
|
Subject: "Email verification",
|
||||||
|
TextBody: `Hi there,
|
||||||
|
|
||||||
|
Please verify your email by clicking this link: $micro_verification_link`,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/event/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read stored events
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/event"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read stored events
|
|
||||||
func ReadEventsOnAtopic() {
|
|
||||||
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := eventService.Read(&event.ReadRequest{
|
|
||||||
Topic: "user",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Publish
|
## Publish
|
||||||
|
|
||||||
Publish a event to the event stream.
|
Publish a event to the event stream.
|
||||||
@@ -106,3 +78,31 @@ func ConsumeFromAtopic() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read stored events
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/event"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read stored events
|
||||||
|
func ReadEventsOnAtopic() {
|
||||||
|
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := eventService.Read(&event.ReadRequest{
|
||||||
|
Topic: "user",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -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{}{
|
||||||
|
"id": "1",
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
"id": "1",
|
|
||||||
},
|
},
|
||||||
Topic: "user",
|
Topic: "user",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,38 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/file/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Save
|
||||||
|
|
||||||
|
Save a file
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/file/api#Save](https://m3o.com/file/api#Save)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/file"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Save a file
|
||||||
|
func SaveFile() {
|
||||||
|
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := fileService.Save(&file.SaveRequest{
|
||||||
|
File: &file.Record{
|
||||||
|
Content: "file content example",
|
||||||
|
Path: "/document/text-files/file.txt",
|
||||||
|
Project: "examples",
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## List
|
## List
|
||||||
|
|
||||||
List files by their project and optionally a path.
|
List files by their project and optionally a path.
|
||||||
@@ -90,35 +122,3 @@ Project: "examples",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Save
|
|
||||||
|
|
||||||
Save a file
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/file/api#Save](https://m3o.com/file/api#Save)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/file"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Save a file
|
|
||||||
func SaveFile() {
|
|
||||||
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := fileService.Save(&file.SaveRequest{
|
|
||||||
File: &file.Record{
|
|
||||||
Content: "file content example",
|
|
||||||
Path: "/document/text-files/file.txt",
|
|
||||||
Project: "examples",
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ func DeleteAfunction() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Proxy
|
## Runtimes
|
||||||
|
|
||||||
Return the backend url for proxying
|
Return a list of supported runtimes
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -49,23 +49,22 @@ import(
|
|||||||
"go.m3o.com/function"
|
"go.m3o.com/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Return the backend url for proxying
|
// Return a list of supported runtimes
|
||||||
func ProxyUrl() {
|
func ListRuntimes() {
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
|
||||||
Id: "helloworld",
|
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Deploy
|
## List
|
||||||
|
|
||||||
Deploy a group of functions
|
List all the deployed functions
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
|
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -77,17 +76,38 @@ import(
|
|||||||
"go.m3o.com/function"
|
"go.m3o.com/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deploy a group of functions
|
// List all the deployed functions
|
||||||
func DeployAfunction() {
|
func ListFunctions() {
|
||||||
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.List(&function.ListRequest{
|
||||||
Branch: "main",
|
|
||||||
Entrypoint: "Helloworld",
|
})
|
||||||
Name: "helloworld",
|
fmt.Println(rsp, err)
|
||||||
Region: "europe-west1",
|
|
||||||
Repo: "https://github.com/m3o/m3o",
|
}
|
||||||
Runtime: "go116",
|
```
|
||||||
Subfolder: "examples/go-function",
|
## Update
|
||||||
|
|
||||||
|
Update a function. Downloads the source, builds and redeploys
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update a function. Downloads the source, builds and redeploys
|
||||||
|
func UpdateAfunction() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Update(&function.UpdateRequest{
|
||||||
|
Name: "helloworld",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -208,12 +228,12 @@ func ReserveAfunction() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Runtimes
|
## Proxy
|
||||||
|
|
||||||
Return a list of supported runtimes
|
Return the backend url for proxying
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
|
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -225,22 +245,23 @@ import(
|
|||||||
"go.m3o.com/function"
|
"go.m3o.com/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Return a list of supported runtimes
|
// Return the backend url for proxying
|
||||||
func ListRuntimes() {
|
func ProxyUrl() {
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
|
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
||||||
|
Id: "helloworld",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Update
|
## Deploy
|
||||||
|
|
||||||
Update a function. Downloads the source, builds and redeploys
|
Deploy a group of functions
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
|
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -252,41 +273,20 @@ import(
|
|||||||
"go.m3o.com/function"
|
"go.m3o.com/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update a function. Downloads the source, builds and redeploys
|
// Deploy a group of functions
|
||||||
func UpdateAfunction() {
|
func DeployAfunction() {
|
||||||
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.Deploy(&function.DeployRequest{
|
||||||
Name: "helloworld",
|
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)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
|
||||||
|
|
||||||
List all the deployed functions
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the deployed functions
|
|
||||||
func ListFunctions() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.List(&function.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/geocoding/api]
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Reverse
|
||||||
|
|
||||||
|
Reverse lookup an address from gps coordinates
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/geocoding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reverse lookup an address from gps coordinates
|
||||||
|
func ReverseGeocodeLocation() {
|
||||||
|
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{
|
||||||
|
Latitude: 51.5123064,
|
||||||
|
Longitude: -0.1216235,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Lookup
|
## Lookup
|
||||||
|
|
||||||
Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
|
Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
|
||||||
@@ -35,32 +64,3 @@ Postcode: "wc2b",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Reverse
|
|
||||||
|
|
||||||
Reverse lookup an address from gps coordinates
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/geocoding"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reverse lookup an address from gps coordinates
|
|
||||||
func ReverseGeocodeLocation() {
|
|
||||||
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{
|
|
||||||
Latitude: 51.5123064,
|
|
||||||
Longitude: -0.1216235,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/holidays/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Countries
|
||||||
|
|
||||||
|
Get the list of countries that are supported by this API
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/holidays/api#Countries](https://m3o.com/holidays/api#Countries)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/holidays"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the list of countries that are supported by this API
|
||||||
|
func ListCountries() {
|
||||||
|
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## List
|
## List
|
||||||
|
|
||||||
List the holiday dates for a given country and year
|
List the holiday dates for a given country and year
|
||||||
@@ -32,30 +59,3 @@ func GetHolidays() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Countries
|
|
||||||
|
|
||||||
Get the list of countries that are supported by this API
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/holidays/api#Countries](https://m3o.com/holidays/api#Countries)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/holidays"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the list of countries that are supported by this API
|
|
||||||
func ListCountries() {
|
|
||||||
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,125 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/image/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toHostedImage() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
Height: 100,
|
||||||
|
Name: "cat.png",
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toBase64image() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
Height: 100,
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toBase64imageWithCropping() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
CropOptions: &image.CropOptions{
|
||||||
|
Height: 50,
|
||||||
|
Width: 50,
|
||||||
|
},
|
||||||
|
Height: 100,
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Convert
|
## Convert
|
||||||
|
|
||||||
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
|
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
|
||||||
@@ -137,122 +256,3 @@ func DeleteAnUploadedImage() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
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#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
// 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 Base64toHostedImage() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
Height: 100,
|
|
||||||
Name: "cat.png",
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
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#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
// 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 Base64toBase64image() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
Height: 100,
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
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#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
// 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 Base64toBase64imageWithCropping() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
CropOptions: &image.CropOptions{
|
|
||||||
Height: 50,
|
|
||||||
Width: 50,
|
|
||||||
},
|
|
||||||
Height: 100,
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/lists/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete a list
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/lists/api#Delete](https://m3o.com/lists/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/lists"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete a list
|
||||||
|
func DeleteAlist() {
|
||||||
|
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := listsService.Delete(&lists.DeleteRequest{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
Subscribe to lists events
|
Subscribe to lists events
|
||||||
@@ -157,31 +185,3 @@ func UpdateAlist() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete a list
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/lists/api#Delete](https://m3o.com/lists/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/lists"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete a list
|
|
||||||
func DeleteAlist() {
|
|
||||||
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := listsService.Delete(&lists.DeleteRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,39 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/mq/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Publish
|
|
||||||
|
|
||||||
Publish a message. Specify a topic to group messages for a specific topic.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/mq"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Publish a message. Specify a topic to group messages for a specific topic.
|
|
||||||
func PublishAmessage() {
|
|
||||||
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := mqService.Publish(&mq.PublishRequest{
|
|
||||||
Message: map[string]interface{}{
|
|
||||||
"type": "signup",
|
|
||||||
"user": "john",
|
|
||||||
"id": "1",
|
|
||||||
},
|
|
||||||
Topic: "events",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Subscribe
|
## Subscribe
|
||||||
|
|
||||||
Subscribe to messages for a given topic.
|
Subscribe to messages for a given topic.
|
||||||
@@ -78,3 +45,36 @@ func SubscribeToAtopic() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Publish
|
||||||
|
|
||||||
|
Publish a message. Specify a topic to group messages for a specific topic.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/mq"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Publish a message. Specify a topic to group messages for a specific topic.
|
||||||
|
func PublishAmessage() {
|
||||||
|
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := mqService.Publish(&mq.PublishRequest{
|
||||||
|
Message: map[string]interface{}{
|
||||||
|
"id": "1",
|
||||||
|
"type": "signup",
|
||||||
|
"user": "john",
|
||||||
|
},
|
||||||
|
Topic: "events",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,61 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/nft/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Asset
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/nft/api#Asset](https://m3o.com/nft/api#Asset)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/nft"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
func GetAsingleAsset() {
|
|
||||||
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := nftService.Asset(&nft.AssetRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Collection
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/nft/api#Collection](https://m3o.com/nft/api#Collection)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/nft"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
func GetAsingleCollection() {
|
|
||||||
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := nftService.Collection(&nft.CollectionRequest{
|
|
||||||
Slug: "doodles-official",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Assets
|
## Assets
|
||||||
|
|
||||||
Return a list of assets
|
Return a list of assets
|
||||||
@@ -144,3 +89,58 @@ func ListCollections() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Asset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/nft/api#Asset](https://m3o.com/nft/api#Asset)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/nft"
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
func GetAsingleAsset() {
|
||||||
|
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := nftService.Asset(&nft.AssetRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Collection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/nft/api#Collection](https://m3o.com/nft/api#Collection)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/nft"
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
func GetAsingleCollection() {
|
||||||
|
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := nftService.Collection(&nft.CollectionRequest{
|
||||||
|
Slug: "doodles-official",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the notes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/notes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the notes
|
||||||
|
func ListAllNotes() {
|
||||||
|
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := notesService.List(¬es.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
Update a note
|
Update a note
|
||||||
@@ -162,30 +189,3 @@ func ReadAnote() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
|
||||||
|
|
||||||
List all the notes
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the notes
|
|
||||||
func ListAllNotes() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.List(¬es.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/otp/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Generate
|
|
||||||
|
|
||||||
Generate an OTP (one time pass) code
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/otp/api#Generate](https://m3o.com/otp/api#Generate)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/otp"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Generate an OTP (one time pass) code
|
|
||||||
func GenerateOtp() {
|
|
||||||
otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := otpService.Generate(&otp.GenerateRequest{
|
|
||||||
Id: "asim@example.com",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Validate
|
## Validate
|
||||||
|
|
||||||
Validate the OTP code
|
Validate the OTP code
|
||||||
@@ -61,3 +33,31 @@ Id: "asim@example.com",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Generate
|
||||||
|
|
||||||
|
Generate an OTP (one time pass) code
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/otp/api#Generate](https://m3o.com/otp/api#Generate)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/otp"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Generate an OTP (one time pass) code
|
||||||
|
func GenerateOtp() {
|
||||||
|
otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := otpService.Generate(&otp.GenerateRequest{
|
||||||
|
Id: "asim@example.com",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/place/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Search
|
|
||||||
|
|
||||||
Search for places by text query
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/place"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Search for places by text query
|
|
||||||
func SearchForPlaces() {
|
|
||||||
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := placeService.Search(&place.SearchRequest{
|
|
||||||
Location: "51.5074577,-0.1297515",
|
|
||||||
Query: "food",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Nearby
|
## Nearby
|
||||||
|
|
||||||
Find places nearby using a location
|
Find places nearby using a location
|
||||||
@@ -63,3 +34,32 @@ Type: "store",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Search
|
||||||
|
|
||||||
|
Search for places by text query
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/place"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Search for places by text query
|
||||||
|
func SearchForPlaces() {
|
||||||
|
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := placeService.Search(&place.SearchRequest{
|
||||||
|
Location: "51.5074577,-0.1297515",
|
||||||
|
Query: "food",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/quran/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Search
|
||||||
|
|
||||||
|
Search the Quran for any form of query or questions
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/quran/api#Search](https://m3o.com/quran/api#Search)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/quran"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Search the Quran for any form of query or questions
|
||||||
|
func SearchTheQuran() {
|
||||||
|
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := quranService.Search(&quran.SearchRequest{
|
||||||
|
Query: "messenger",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Chapters
|
## Chapters
|
||||||
|
|
||||||
List the Chapters (surahs) of the Quran
|
List the Chapters (surahs) of the Quran
|
||||||
@@ -92,31 +120,3 @@ func GetVersesOfAchapter() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Search
|
|
||||||
|
|
||||||
Search the Quran for any form of query or questions
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/quran/api#Search](https://m3o.com/quran/api#Search)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/quran"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Search the Quran for any form of query or questions
|
|
||||||
func SearchTheQuran() {
|
|
||||||
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := quranService.Search(&quran.SearchRequest{
|
|
||||||
Query: "messenger",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,41 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/routing/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Eta
|
|
||||||
|
|
||||||
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/routing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
|
||||||
func EtaFromPointAtoPointB() {
|
|
||||||
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := routingService.Eta(&routing.EtaRequest{
|
|
||||||
Destination: &routing.Point{
|
|
||||||
Latitude: 52.529407,
|
|
||||||
Longitude: 13.397634,
|
|
||||||
},
|
|
||||||
Origin: &routing.Point{
|
|
||||||
Latitude: 52.517037,
|
|
||||||
Longitude: 13.38886,
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Directions
|
## Directions
|
||||||
|
|
||||||
Turn by turn directions from a start point to an end point including maneuvers and bearings
|
Turn by turn directions from a start point to an end point including maneuvers and bearings
|
||||||
@@ -109,3 +74,38 @@ Origin: &routing.Point{
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Eta
|
||||||
|
|
||||||
|
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/routing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||||
|
func EtaFromPointAtoPointB() {
|
||||||
|
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := routingService.Eta(&routing.EtaRequest{
|
||||||
|
Destination: &routing.Point{
|
||||||
|
Latitude: 52.529407,
|
||||||
|
Longitude: 13.397634,
|
||||||
|
},
|
||||||
|
Origin: &routing.Point{
|
||||||
|
Latitude: 52.517037,
|
||||||
|
Longitude: 13.38886,
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,39 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/search/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
Index a record i.e. insert a document to search for.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/search/api#Index](https://m3o.com/search/api#Index)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/search"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Index a record i.e. insert a document to search for.
|
||||||
|
func IndexArecord() {
|
||||||
|
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := searchService.Index(&search.IndexRequest{
|
||||||
|
Data: map[string]interface{}{
|
||||||
|
"name": "John Doe",
|
||||||
|
"age": 37,
|
||||||
|
"starsign": "Leo",
|
||||||
|
},
|
||||||
|
Index: "customers",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Search
|
## Search
|
||||||
|
|
||||||
Search for records in a given in index
|
Search for records in a given in index
|
||||||
@@ -176,36 +209,3 @@ func DeleteAnIndex() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Index
|
|
||||||
|
|
||||||
Index a record i.e. insert a document to search for.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/search/api#Index](https://m3o.com/search/api#Index)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/search"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Index a record i.e. insert a document to search for.
|
|
||||||
func IndexArecord() {
|
|
||||||
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := searchService.Index(&search.IndexRequest{
|
|
||||||
Data: map[string]interface{}{
|
|
||||||
"age": 37,
|
|
||||||
"starsign": "Leo",
|
|
||||||
"name": "John Doe",
|
|
||||||
},
|
|
||||||
Index: "customers",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,90 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/space/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete an object from space
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/space"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete an object from space
|
||||||
|
func DeleteAnObject() {
|
||||||
|
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spaceService.Delete(&space.DeleteRequest{
|
||||||
|
Name: "images/file.jpg",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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
|
||||||
|
|
||||||
Read an object in space
|
Read an object in space
|
||||||
@@ -148,87 +232,3 @@ Visibility: "public",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete an object from space
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/space"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete an object from space
|
|
||||||
func DeleteAnObject() {
|
|
||||||
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := spaceService.Delete(&space.DeleteRequest{
|
|
||||||
Name: "images/file.jpg",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stock/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
Get the historic open-close for a given day
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stock/api#History](https://m3o.com/stock/api#History)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stock"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the historic open-close for a given day
|
||||||
|
func GetHistoricData() {
|
||||||
|
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := stockService.History(&stock.HistoryRequest{
|
||||||
|
Date: "2020-10-01",
|
||||||
|
Stock: "AAPL",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## OrderBook
|
## OrderBook
|
||||||
|
|
||||||
Get the historic order book and each trade by timestamp
|
Get the historic order book and each trade by timestamp
|
||||||
@@ -92,32 +121,3 @@ func GetAstockQuote() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## History
|
|
||||||
|
|
||||||
Get the historic open-close for a given day
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stock/api#History](https://m3o.com/stock/api#History)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stock"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the historic open-close for a given day
|
|
||||||
func GetHistoricData() {
|
|
||||||
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := stockService.History(&stock.HistoryRequest{
|
|
||||||
Date: "2020-10-01",
|
|
||||||
Stock: "AAPL",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stream/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## ListMessages
|
||||||
|
|
||||||
|
List messages for a given channel
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stream/api#ListMessages](https://m3o.com/stream/api#ListMessages)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stream"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List messages for a given channel
|
||||||
|
func ListMessages() {
|
||||||
|
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := streamService.ListMessages(&stream.ListMessagesRequest{
|
||||||
|
Channel: "general",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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
|
||||||
@@ -64,58 +119,3 @@ Text: "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## ListMessages
|
|
||||||
|
|
||||||
List messages for a given channel
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stream/api#ListMessages](https://m3o.com/stream/api#ListMessages)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List messages for a given channel
|
|
||||||
func ListMessages() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.ListMessages(&stream.ListMessagesRequest{
|
|
||||||
Channel: "general",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## SendMagicLink
|
## SendMagicLink
|
||||||
|
|
||||||
Login using email only - Passwordless
|
Login using email only - Passwordless
|
||||||
@@ -123,6 +67,94 @@ Username: "joe",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## UpdatePassword
|
## UpdatePassword
|
||||||
@@ -154,6 +186,115 @@ UserId: "user-1",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## SendVerificationEmail
|
||||||
|
|
||||||
|
Send a verification email to a user.
|
||||||
|
Email "from" will be 'noreply@email.m3ocontent.com'.
|
||||||
|
The verification link will be injected in the email
|
||||||
|
as a template variable, $micro_verification_link e.g
|
||||||
|
'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
|
||||||
|
The variable will be replaced with a url similar to:
|
||||||
|
'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 a user.
|
||||||
|
// Email "from" will be 'noreply@email.m3ocontent.com'.
|
||||||
|
// The verification link will be injected in the email
|
||||||
|
// as a template variable, $micro_verification_link e.g
|
||||||
|
// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
|
||||||
|
// The variable will be replaced with a url similar to:
|
||||||
|
// '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)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## SendPasswordResetEmail
|
## SendPasswordResetEmail
|
||||||
@@ -219,37 +360,6 @@ NewPassword: "NewPassword1",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## VerifyEmail
|
## VerifyEmail
|
||||||
@@ -278,34 +388,6 @@ func VerifyEmail() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ReadSession
|
|
||||||
|
|
||||||
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
|
||||||
func ReadAsessionByTheSessionId() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
|
||||||
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
## Create
|
||||||
@@ -423,18 +505,12 @@ func ReadAccountByEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## SendVerificationEmail
|
## ReadSession
|
||||||
|
|
||||||
Send a verification email to a user.
|
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
Email "from" will be 'noreply@email.m3ocontent.com'.
|
|
||||||
The verification link will be injected in the email
|
|
||||||
as a template variable, $micro_verification_link e.g
|
|
||||||
'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
|
|
||||||
The variable will be replaced with a url similar to:
|
|
||||||
'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#ReadSession](https://m3o.com/user/api#ReadSession)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -446,87 +522,11 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Send a verification email to a user.
|
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
// Email "from" will be 'noreply@email.m3ocontent.com'.
|
func ReadAsessionByTheSessionId() {
|
||||||
// The verification link will be injected in the email
|
|
||||||
// as a template variable, $micro_verification_link e.g
|
|
||||||
// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
|
|
||||||
// The variable will be replaced with a url similar to:
|
|
||||||
// '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.ReadSession(&user.ReadSessionRequest{
|
||||||
Email: "joe@example.com",
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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)
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/youtube/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Search
|
|
||||||
|
|
||||||
Search for videos on YouTube
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/youtube"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Search for videos on YouTube
|
|
||||||
func SearchForVideos() {
|
|
||||||
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := youtubeService.Search(&youtube.SearchRequest{
|
|
||||||
Query: "donuts",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Embed
|
## Embed
|
||||||
|
|
||||||
Embed a YouTube video
|
Embed a YouTube video
|
||||||
@@ -60,3 +32,31 @@ func EmbedAyoutubeVideo() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Search
|
||||||
|
|
||||||
|
Search for videos on YouTube
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/youtube"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Search for videos on YouTube
|
||||||
|
func SearchForVideos() {
|
||||||
|
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := youtubeService.Search(&youtube.SearchRequest{
|
||||||
|
Query: "donuts",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user