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,38 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Run
|
||||||
|
|
||||||
|
Run an app from source
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/app"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Run an app from source
|
||||||
|
func RunAnApp() {
|
||||||
|
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := appService.Run(&app.RunRequest{
|
||||||
|
Branch: "master",
|
||||||
|
Name: "helloworld",
|
||||||
|
Port: 8080,
|
||||||
|
Region: "europe-west1",
|
||||||
|
Repo: "github.com/asim/helloworld",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Regions
|
## Regions
|
||||||
|
|
||||||
Return the support regions
|
Return the support regions
|
||||||
@@ -198,35 +230,3 @@ func ListTheApps() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Run
|
|
||||||
|
|
||||||
Run an app from source
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/app"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Run an app from source
|
|
||||||
func RunAnApp() {
|
|
||||||
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := appService.Run(&app.RunRequest{
|
|
||||||
Branch: "master",
|
|
||||||
Name: "helloworld",
|
|
||||||
Port: 8080,
|
|
||||||
Region: "europe-west1",
|
|
||||||
Repo: "github.com/asim/helloworld",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
58
examples/cache/README.md
vendored
58
examples/cache/README.md
vendored
@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Set
|
||||||
|
|
||||||
|
Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
func SetAvalue() {
|
||||||
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cacheService.Set(&cache.SetRequest{
|
||||||
|
Key: "foo",
|
||||||
|
Value: "bar",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Get
|
## Get
|
||||||
|
|
||||||
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.
|
||||||
@@ -145,32 +174,3 @@ func ListTheKeys() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Delete
|
## Send
|
||||||
|
|
||||||
Delete a chat room
|
Connect to a chat to receive a stream of messages
|
||||||
|
Send a message to a chat
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#Delete](https://m3o.com/chat/api#Delete)
|
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -21,10 +22,14 @@ import(
|
|||||||
"go.m3o.com/chat"
|
"go.m3o.com/chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Delete a chat room
|
// Connect to a chat to receive a stream of messages
|
||||||
func DeleteAchat() {
|
// Send a message to a chat
|
||||||
|
func SendAmessage() {
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := chatService.Delete(&chat.DeleteRequest{
|
rsp, err := chatService.Send(&chat.SendRequest{
|
||||||
|
Client: "web",
|
||||||
|
Subject: "Random",
|
||||||
|
Text: "Hey whats up?",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -85,12 +90,12 @@ func LeaveAroom() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
## Create
|
||||||
|
|
||||||
List available chats
|
Create a new chat room
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
|
[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -102,10 +107,12 @@ import(
|
|||||||
"go.m3o.com/chat"
|
"go.m3o.com/chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// List available chats
|
// Create a new chat room
|
||||||
func ListChatRooms() {
|
func CreateAnewChat() {
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := chatService.List(&chat.ListRequest{
|
rsp, err := chatService.Create(&chat.CreateRequest{
|
||||||
|
Description: "The general chat room",
|
||||||
|
Name: "general",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -137,38 +144,6 @@ func InviteAuser() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Send
|
|
||||||
|
|
||||||
Connect to a chat to receive a stream of messages
|
|
||||||
Send a message to a chat
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/chat"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Connect to a chat to receive a stream of messages
|
|
||||||
// Send a message to a chat
|
|
||||||
func SendAmessage() {
|
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := chatService.Send(&chat.SendRequest{
|
|
||||||
Client: "web",
|
|
||||||
Subject: "Random",
|
|
||||||
Text: "Hey whats up?",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## History
|
## History
|
||||||
@@ -238,12 +213,12 @@ func JoinAroom() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
## List
|
||||||
|
|
||||||
Create a new chat room
|
List available chats
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create)
|
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -255,12 +230,37 @@ import(
|
|||||||
"go.m3o.com/chat"
|
"go.m3o.com/chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create a new chat room
|
// List available chats
|
||||||
func CreateAnewChat() {
|
func ListChatRooms() {
|
||||||
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := chatService.Create(&chat.CreateRequest{
|
rsp, err := chatService.List(&chat.ListRequest{
|
||||||
Description: "The general chat room",
|
|
||||||
Name: "general",
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete a chat room
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/chat/api#Delete](https://m3o.com/chat/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/chat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete a chat room
|
||||||
|
func DeleteAchat() {
|
||||||
|
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := chatService.Delete(&chat.DeleteRequest{
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|||||||
@@ -4,47 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/comments/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
Subscribe to comments events
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/comments/api#Events](https://m3o.com/comments/api#Events)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/comments"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Subscribe to comments events
|
|
||||||
func SubscribeToEvents() {
|
|
||||||
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
|
|
||||||
stream, err := commentsService.Events(&comments.EventsRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
|
||||||
rsp, err := stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(rsp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
## Create
|
||||||
|
|
||||||
Create a new comment
|
Create a new comment
|
||||||
@@ -188,3 +147,44 @@ func DeleteAcomment() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Events
|
||||||
|
|
||||||
|
Subscribe to comments events
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/comments/api#Events](https://m3o.com/comments/api#Events)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/comments"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Subscribe to comments events
|
||||||
|
func SubscribeToEvents() {
|
||||||
|
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
|
||||||
|
stream, err := commentsService.Events(&comments.EventsRequest{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
rsp, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(rsp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## List
|
|
||||||
|
|
||||||
List contacts
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List contacts
|
|
||||||
func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() {
|
|
||||||
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := contactService.List(&contact.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## List
|
|
||||||
|
|
||||||
List contacts
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List contacts
|
|
||||||
func ListContactsWithSpecificOffsetAndLimit() {
|
|
||||||
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := contactService.List(&contact.ListRequest{
|
|
||||||
Limit: 1,
|
|
||||||
Offset: 1,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
## Create
|
||||||
|
|
||||||
Create a contact
|
Create a contact
|
||||||
@@ -217,3 +161,59 @@ func DeleteAcontact() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
List contacts
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List contacts
|
||||||
|
func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() {
|
||||||
|
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := contactService.List(&contact.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
List contacts
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List contacts
|
||||||
|
func ListContactsWithSpecificOffsetAndLimit() {
|
||||||
|
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := contactService.List(&contact.ListRequest{
|
||||||
|
Limit: 1,
|
||||||
|
Offset: 1,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/crypto/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Symbols
|
|
||||||
|
|
||||||
Returns the full list of supported symbols
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/crypto/api#Symbols](https://m3o.com/crypto/api#Symbols)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Returns the full list of supported symbols
|
|
||||||
func GetListOfAllSupportedSymbols() {
|
|
||||||
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cryptoService.Symbols(&crypto.SymbolsRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## News
|
## News
|
||||||
|
|
||||||
Get news related to a currency
|
Get news related to a currency
|
||||||
@@ -143,3 +116,30 @@ func GetPreviousClose() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Symbols
|
||||||
|
|
||||||
|
Returns the full list of supported symbols
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/crypto/api#Symbols](https://m3o.com/crypto/api#Symbols)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/crypto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Returns the full list of supported symbols
|
||||||
|
func GetListOfAllSupportedSymbols() {
|
||||||
|
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cryptoService.Symbols(&crypto.SymbolsRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/currency/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
Returns the historic rates for a currency on a given date
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/currency"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Returns the historic rates for a currency on a given date
|
||||||
|
func HistoricRatesForAcurrency() {
|
||||||
|
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := currencyService.History(¤cy.HistoryRequest{
|
||||||
|
Code: "USD",
|
||||||
|
Date: "2021-05-30",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Codes
|
## Codes
|
||||||
|
|
||||||
Codes returns the supported currency codes for the API
|
Codes returns the supported currency codes for the API
|
||||||
@@ -118,32 +147,3 @@ To: "GBP",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## History
|
|
||||||
|
|
||||||
Returns the historic rates for a currency on a given date
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/currency"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Returns the historic rates for a currency on a given date
|
|
||||||
func HistoricRatesForAcurrency() {
|
|
||||||
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := currencyService.History(¤cy.HistoryRequest{
|
|
||||||
Code: "USD",
|
|
||||||
Date: "2021-05-30",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,94 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Update
|
|
||||||
|
|
||||||
Update a record in the database. Include an "id" in the record to update.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update a record in the database. Include an "id" in the record to update.
|
|
||||||
func UpdateArecord() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Update(&db.UpdateRequest{
|
|
||||||
Record: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"age": 43,
|
|
||||||
},
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## DropTable
|
|
||||||
|
|
||||||
Drop a table in the DB
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Drop a table in the DB
|
|
||||||
func DropTable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.DropTable(&db.DropTableRequest{
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Count
|
|
||||||
|
|
||||||
Count records in a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Count records in a table
|
|
||||||
func CountEntriesInAtable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Count(&db.CountRequest{
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ListTables
|
## ListTables
|
||||||
|
|
||||||
List tables in the DB
|
List tables in the DB
|
||||||
@@ -170,10 +82,127 @@ func CreateArecord() {
|
|||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"id": "1",
|
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
"age": 42,
|
"age": 42,
|
||||||
"isActive": true,
|
"isActive": true,
|
||||||
|
"id": "1",
|
||||||
|
},
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## DropTable
|
||||||
|
|
||||||
|
Drop a table in the DB
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Drop a table in the DB
|
||||||
|
func DropTable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.DropTable(&db.DropTableRequest{
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Count
|
||||||
|
|
||||||
|
Count records in a table
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Count records in a table
|
||||||
|
func CountEntriesInAtable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Count(&db.CountRequest{
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Update
|
||||||
|
|
||||||
|
Update a record in the database. Include an "id" in the record to update.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update a record in the database. Include an "id" in the record to update.
|
||||||
|
func UpdateArecord() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Update(&db.UpdateRequest{
|
||||||
|
Record: map[string]interface{}{
|
||||||
|
"id": "1",
|
||||||
|
"age": 43,
|
||||||
},
|
},
|
||||||
Table: "example",
|
Table: "example",
|
||||||
|
|
||||||
@@ -239,32 +268,3 @@ func TruncateTable() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ func main() {
|
|||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
|
"isActive": true,
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
"age": 42,
|
"age": 42,
|
||||||
"isActive": true,
|
|
||||||
},
|
},
|
||||||
Table: "example",
|
Table: "example",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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{}{
|
||||||
"id": "1",
|
|
||||||
"age": 43,
|
"age": 43,
|
||||||
|
"id": "1",
|
||||||
},
|
},
|
||||||
Table: "example",
|
Table: "example",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/email/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Parse
|
|
||||||
|
|
||||||
Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/email/api#Parse](https://m3o.com/email/api#Parse)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/email"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
|
||||||
func ParseEmail() {
|
|
||||||
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := emailService.Parse(&email.ParseRequest{
|
|
||||||
Address: "Joe Blogs <joe@example.com>",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Validate
|
## Validate
|
||||||
|
|
||||||
Validate an email address format
|
Validate an email address format
|
||||||
@@ -92,3 +64,31 @@ Please verify your email by clicking this link: $micro_verification_link`,
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Parse
|
||||||
|
|
||||||
|
Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/email/api#Parse](https://m3o.com/email/api#Parse)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/email"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
|
||||||
|
func ParseEmail() {
|
||||||
|
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := emailService.Parse(&email.ParseRequest{
|
||||||
|
Address: "Joe Blogs <joe@example.com>",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,39 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/event/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Publish
|
||||||
|
|
||||||
|
Publish a event to the event stream.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/event"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Publish a event to the event stream.
|
||||||
|
func PublishAnEvent() {
|
||||||
|
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := eventService.Publish(&event.PublishRequest{
|
||||||
|
Message: map[string]interface{}{
|
||||||
|
"user": "john",
|
||||||
|
"id": "1",
|
||||||
|
"type": "signup",
|
||||||
|
},
|
||||||
|
Topic: "user",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Consume
|
## Consume
|
||||||
|
|
||||||
Consume events from a given topic.
|
Consume events from a given topic.
|
||||||
@@ -73,36 +106,3 @@ func ReadEventsOnAtopic() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Publish
|
|
||||||
|
|
||||||
Publish a event to the event stream.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/event"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Publish a event to the event stream.
|
|
||||||
func PublishAnEvent() {
|
|
||||||
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := eventService.Publish(&event.PublishRequest{
|
|
||||||
Message: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
|
||||||
"user": "john",
|
|
||||||
},
|
|
||||||
Topic: "user",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,38 +4,6 @@ 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.
|
||||||
@@ -122,3 +90,35 @@ 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/forex/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## History
|
|
||||||
|
|
||||||
Returns the data for the previous close
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/forex"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Returns the data for the previous close
|
|
||||||
func GetPreviousClose() {
|
|
||||||
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := forexService.History(&forex.HistoryRequest{
|
|
||||||
Symbol: "GBPUSD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Price
|
## Price
|
||||||
|
|
||||||
Get the latest price for a given forex ticker
|
Get the latest price for a given forex ticker
|
||||||
@@ -88,3 +60,31 @@ func GetAfxQuote() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## History
|
||||||
|
|
||||||
|
Returns the data for the previous close
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/forex"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Returns the data for the previous close
|
||||||
|
func GetPreviousClose() {
|
||||||
|
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := forexService.History(&forex.HistoryRequest{
|
||||||
|
Symbol: "GBPUSD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Proxy
|
||||||
|
|
||||||
|
Return the backend url for proxying
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Return the backend url for proxying
|
||||||
|
func ProxyUrl() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
||||||
|
Id: "helloworld",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Call
|
## Call
|
||||||
|
|
||||||
Call a function by name
|
Call a function by name
|
||||||
@@ -33,33 +88,6 @@ Request: map[string]interface{}{
|
|||||||
})
|
})
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Delete
|
## Delete
|
||||||
@@ -143,62 +171,6 @@ func ListRegions() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Proxy
|
|
||||||
|
|
||||||
Return the backend url for proxying
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Return the backend url for proxying
|
|
||||||
func ProxyUrl() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
|
||||||
Id: "helloworld",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Reserve
|
## Reserve
|
||||||
@@ -290,3 +262,31 @@ 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/id/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Types
|
||||||
|
|
||||||
|
List the types of IDs available. No query params needed.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/id"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List the types of IDs available. No query params needed.
|
||||||
|
func ListTheTypesOfIdsAvailable() {
|
||||||
|
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := idService.Types(&id.TypesRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Generate
|
## Generate
|
||||||
|
|
||||||
Generate a unique ID. Defaults to uuid.
|
Generate a unique ID. Defaults to uuid.
|
||||||
@@ -116,30 +143,3 @@ func GenerateAbigflakeId() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Types
|
|
||||||
|
|
||||||
List the types of IDs available. No query params needed.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/id"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List the types of IDs available. No query params needed.
|
|
||||||
func ListTheTypesOfIdsAvailable() {
|
|
||||||
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := idService.Types(&id.TypesRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -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,61 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/lists/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read a list
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/lists/api#Read](https://m3o.com/lists/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/lists"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read a list
|
|
||||||
func ReadAlist() {
|
|
||||||
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := listsService.Read(&lists.ReadRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## List
|
|
||||||
|
|
||||||
List all the lists
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/lists/api#List](https://m3o.com/lists/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/lists"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the lists
|
|
||||||
func ListAllLists() {
|
|
||||||
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := listsService.List(&lists.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
Update a list
|
Update a list
|
||||||
@@ -185,3 +130,58 @@ func CreateAlist() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read a list
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/lists/api#Read](https://m3o.com/lists/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/lists"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a list
|
||||||
|
func ReadAlist() {
|
||||||
|
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := listsService.Read(&lists.ReadRequest{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the lists
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/lists/api#List](https://m3o.com/lists/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/lists"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the lists
|
||||||
|
func ListAllLists() {
|
||||||
|
listsService := lists.NewListsService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := listsService.List(&lists.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ func PublishAmessage() {
|
|||||||
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := mqService.Publish(&mq.PublishRequest{
|
rsp, err := mqService.Publish(&mq.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
|
"user": "john",
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,93 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read a note
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/notes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a note
|
||||||
|
func ReadAnote() {
|
||||||
|
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := notesService.Read(¬es.ReadRequest{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the notes
|
||||||
|
|
||||||
|
|
||||||
|
[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 a note
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/notes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update a note
|
||||||
|
func UpdateAnote() {
|
||||||
|
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := notesService.Update(¬es.UpdateRequest{
|
||||||
|
Note: ¬es.Note{
|
||||||
|
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
||||||
|
Text: "Updated note text",
|
||||||
|
Title: "Update Note",
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Delete
|
## Delete
|
||||||
|
|
||||||
Delete a note
|
Delete a note
|
||||||
@@ -102,90 +189,3 @@ Title: "New Note",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Read
|
|
||||||
|
|
||||||
Read a note
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read a note
|
|
||||||
func ReadAnote() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.Read(¬es.ReadRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## List
|
|
||||||
|
|
||||||
List all the notes
|
|
||||||
|
|
||||||
|
|
||||||
[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 a note
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update a note
|
|
||||||
func UpdateAnote() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.Update(¬es.UpdateRequest{
|
|
||||||
Note: ¬es.Note{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
Text: "Updated note text",
|
|
||||||
Title: "Update Note",
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/ping/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Url
|
||||||
|
|
||||||
|
Ping a HTTP URL
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/ping/api#Url](https://m3o.com/ping/api#Url)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/ping"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ping a HTTP URL
|
||||||
|
func CheckAurl() {
|
||||||
|
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := pingService.Url(&ping.UrlRequest{
|
||||||
|
Address: "google.com",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Ip
|
## Ip
|
||||||
|
|
||||||
Ping an IP address
|
Ping an IP address
|
||||||
@@ -60,31 +88,3 @@ func DialAtcpAddress() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Url
|
|
||||||
|
|
||||||
Ping a HTTP URL
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/ping/api#Url](https://m3o.com/ping/api#Url)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/ping"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Ping a HTTP URL
|
|
||||||
func CheckAurl() {
|
|
||||||
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := pingService.Url(&ping.UrlRequest{
|
|
||||||
Address: "google.com",
|
|
||||||
|
|
||||||
})
|
|
||||||
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:
|
||||||
|
|
||||||
|
## Chapters
|
||||||
|
|
||||||
|
List the Chapters (surahs) of the Quran
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/quran/api#Chapters](https://m3o.com/quran/api#Chapters)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/quran"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List the Chapters (surahs) of the Quran
|
||||||
|
func ListChapters() {
|
||||||
|
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := quranService.Chapters(&quran.ChaptersRequest{
|
||||||
|
Language: "en",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
Get a summary for a given chapter (surah)
|
Get a summary for a given chapter (surah)
|
||||||
@@ -92,31 +120,3 @@ func SearchTheQuran() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Chapters
|
|
||||||
|
|
||||||
List the Chapters (surahs) of the Quran
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/quran/api#Chapters](https://m3o.com/quran/api#Chapters)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/quran"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List the Chapters (surahs) of the Quran
|
|
||||||
func ListChapters() {
|
|
||||||
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := quranService.Chapters(&quran.ChaptersRequest{
|
|
||||||
Language: "en",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/rss/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Remove
|
|
||||||
|
|
||||||
Remove an RSS feed by name
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/rss"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Remove an RSS feed by name
|
|
||||||
func RemoveAfeed() {
|
|
||||||
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := rssService.Remove(&rss.RemoveRequest{
|
|
||||||
Name: "bbc",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Add
|
## Add
|
||||||
|
|
||||||
Add a new RSS feed with a name, url, and category
|
Add a new RSS feed with a name, url, and category
|
||||||
@@ -117,3 +89,31 @@ func ListRssFeeds() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Remove
|
||||||
|
|
||||||
|
Remove an RSS feed by name
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/rss"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Remove an RSS feed by name
|
||||||
|
func RemoveAfeed() {
|
||||||
|
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := rssService.Remove(&rss.RemoveRequest{
|
||||||
|
Name: "bbc",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/search/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## CreateIndex
|
|
||||||
|
|
||||||
Create an index by name
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/search/api#CreateIndex](https://m3o.com/search/api#CreateIndex)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/search"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create an index by name
|
|
||||||
func CreateAnIndex() {
|
|
||||||
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := searchService.CreateIndex(&search.CreateIndexRequest{
|
|
||||||
Index: "customers",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## DeleteIndex
|
|
||||||
|
|
||||||
Delete an index by name
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/search/api#DeleteIndex](https://m3o.com/search/api#DeleteIndex)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/search"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete an index by name
|
|
||||||
func DeleteAnIndex() {
|
|
||||||
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{
|
|
||||||
Index: "customers",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Index
|
## Index
|
||||||
|
|
||||||
Index a record i.e. insert a document to search for.
|
Index a record i.e. insert a document to search for.
|
||||||
@@ -82,9 +26,9 @@ func IndexArecord() {
|
|||||||
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := searchService.Index(&search.IndexRequest{
|
rsp, err := searchService.Index(&search.IndexRequest{
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
|
"starsign": "Leo",
|
||||||
"name": "John Doe",
|
"name": "John Doe",
|
||||||
"age": 37,
|
"age": 37,
|
||||||
"starsign": "Leo",
|
|
||||||
},
|
},
|
||||||
Index: "customers",
|
Index: "customers",
|
||||||
|
|
||||||
@@ -209,3 +153,59 @@ Index: "customers",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## CreateIndex
|
||||||
|
|
||||||
|
Create an index by name
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/search/api#CreateIndex](https://m3o.com/search/api#CreateIndex)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/search"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create an index by name
|
||||||
|
func CreateAnIndex() {
|
||||||
|
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := searchService.CreateIndex(&search.CreateIndexRequest{
|
||||||
|
Index: "customers",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## DeleteIndex
|
||||||
|
|
||||||
|
Delete an index by name
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/search/api#DeleteIndex](https://m3o.com/search/api#DeleteIndex)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/search"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete an index by name
|
||||||
|
func DeleteAnIndex() {
|
||||||
|
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{
|
||||||
|
Index: "customers",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ func main() {
|
|||||||
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := searchService.Index(&search.IndexRequest{
|
rsp, err := searchService.Index(&search.IndexRequest{
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
|
"starsign": "Leo",
|
||||||
"name": "John Doe",
|
"name": "John Doe",
|
||||||
"age": 37,
|
"age": 37,
|
||||||
"starsign": "Leo",
|
|
||||||
},
|
},
|
||||||
Index: "customers",
|
Index: "customers",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/space/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read an object in space
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/space"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read an object in space
|
|
||||||
func ReadAnObject() {
|
|
||||||
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := spaceService.Read(&space.ReadRequest{
|
|
||||||
Name: "images/file.jpg",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Download
|
|
||||||
|
|
||||||
Download an object via a presigned url
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/space/api#Download](https://m3o.com/space/api#Download)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/space"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Download an object via a presigned url
|
|
||||||
func DownloadAnObject() {
|
|
||||||
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := spaceService.Download(&space.DownloadRequest{
|
|
||||||
Name: "images/file.jpg",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Upload
|
## Upload
|
||||||
|
|
||||||
Upload a large object (> 10MB). Returns a time limited presigned URL to be used for uploading the object
|
Upload a large object (> 10MB). Returns a time limited presigned URL to be used for uploading the object
|
||||||
@@ -232,3 +176,59 @@ func HeadAnObject() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read an object in space
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/space"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read an object in space
|
||||||
|
func ReadAnObject() {
|
||||||
|
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spaceService.Read(&space.ReadRequest{
|
||||||
|
Name: "images/file.jpg",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Download
|
||||||
|
|
||||||
|
Download an object via a presigned url
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/space/api#Download](https://m3o.com/space/api#Download)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/space"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Download an object via a presigned url
|
||||||
|
func DownloadAnObject() {
|
||||||
|
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spaceService.Download(&space.DownloadRequest{
|
||||||
|
Name: "images/file.jpg",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ 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
|
## ListChannels
|
||||||
|
|
||||||
List all the active channels
|
List all the active channels
|
||||||
@@ -91,31 +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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,65 +4,6 @@ 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.
|
||||||
@@ -123,3 +64,62 @@ 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,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/time/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Now
|
||||||
|
|
||||||
|
Get the current time
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the current time
|
||||||
|
func ReturnsCurrentTimeOptionallyWithLocation() {
|
||||||
|
timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := timeService.Now(&time.NowRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Zone
|
## Zone
|
||||||
|
|
||||||
Get the timezone info for a specific location
|
Get the timezone info for a specific location
|
||||||
@@ -32,30 +59,3 @@ func GetTheTimezoneInfoForAspecificLocation() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Now
|
|
||||||
|
|
||||||
Get the current time
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the current time
|
|
||||||
func ReturnsCurrentTimeOptionallyWithLocation() {
|
|
||||||
timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := timeService.Now(&time.NowRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/twitter/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## User
|
||||||
|
|
||||||
|
Get a user's twitter profile
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/twitter"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get a user's twitter profile
|
||||||
|
func GetAusersTwitterProfile() {
|
||||||
|
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := twitterService.User(&twitter.UserRequest{
|
||||||
|
Username: "crufter",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Timeline
|
## Timeline
|
||||||
|
|
||||||
Get the timeline for a given user
|
Get the timeline for a given user
|
||||||
@@ -88,31 +116,3 @@ func GetTheCurrentGlobalTrendingTopics() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## User
|
|
||||||
|
|
||||||
Get a user's twitter profile
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/twitter"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get a user's twitter profile
|
|
||||||
func GetAusersTwitterProfile() {
|
|
||||||
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := twitterService.User(&twitter.UserRequest{
|
|
||||||
Username: "crufter",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/url/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the shortened URLs
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/url/api#List](https://m3o.com/url/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the shortened URLs
|
||||||
|
func ListYourShortenedUrls() {
|
||||||
|
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := urlService.List(&url.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Shorten
|
## Shorten
|
||||||
|
|
||||||
Shorten a long URL
|
Shorten a long URL
|
||||||
@@ -58,30 +85,3 @@ func ResolveAshortUrlToAlongDestinationUrl() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
|
||||||
|
|
||||||
List all the shortened URLs
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/url/api#List](https://m3o.com/url/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/url"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the shortened URLs
|
|
||||||
func ListYourShortenedUrls() {
|
|
||||||
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := urlService.List(&url.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,141 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## UpdatePassword
|
|
||||||
|
|
||||||
Update the account password
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update the account password
|
|
||||||
func UpdateTheAccountPassword() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
|
||||||
ConfirmPassword: "Password2",
|
|
||||||
NewPassword: "Password2",
|
|
||||||
OldPassword: "Password1",
|
|
||||||
UserId: "user-1",
|
|
||||||
|
|
||||||
})
|
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## VerifyEmail
|
|
||||||
|
|
||||||
Verify the email address of an account from a token sent in an email to the user.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Verify the email address of an account from a token sent in an email to the user.
|
|
||||||
func VerifyEmail() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
|
||||||
Token: "012345",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## List
|
|
||||||
|
|
||||||
List all users. Returns a paged list of results
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all users. Returns a paged list of results
|
|
||||||
func ListAllUsers() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.List(&user.ListRequest{
|
|
||||||
Limit: 100,
|
|
||||||
Offset: 0,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## SendMagicLink
|
## SendMagicLink
|
||||||
|
|
||||||
Login using email only - Passwordless
|
Login using email only - Passwordless
|
||||||
@@ -312,6 +177,62 @@ func ReadAsessionByTheSessionId() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## VerifyEmail
|
||||||
|
|
||||||
|
Verify the email address of an account from a token sent in an email to the user.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Verify the email address of an account from a token sent in an email to the user.
|
||||||
|
func VerifyEmail() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
||||||
|
Token: "012345",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Logout
|
||||||
|
|
||||||
|
Logout a user account
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Logout a user account
|
||||||
|
func LogAuserOut() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Logout(&user.LogoutRequest{
|
||||||
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## VerifyToken
|
## VerifyToken
|
||||||
@@ -377,6 +298,112 @@ Username: "joe",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Update
|
||||||
|
|
||||||
|
Update the account username or email
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update the account username or email
|
||||||
|
func UpdateAnAccount() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Update(&user.UpdateRequest{
|
||||||
|
Email: "joe+2@example.com",
|
||||||
|
Id: "user-1",
|
||||||
|
Username: "joe",
|
||||||
|
|
||||||
|
})
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## SendPasswordResetEmail
|
## SendPasswordResetEmail
|
||||||
@@ -475,12 +502,12 @@ Password: "Password1",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Logout
|
## UpdatePassword
|
||||||
|
|
||||||
Logout a user account
|
Update the account password
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
|
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -492,41 +519,14 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logout a user account
|
// Update the account password
|
||||||
func LogAuserOut() {
|
func UpdateTheAccountPassword() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Logout(&user.LogoutRequest{
|
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
||||||
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
ConfirmPassword: "Password2",
|
||||||
|
NewPassword: "Password2",
|
||||||
})
|
OldPassword: "Password1",
|
||||||
fmt.Println(rsp, err)
|
UserId: "user-1",
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Update
|
|
||||||
|
|
||||||
Update the account username or email
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update the account username or email
|
|
||||||
func UpdateAnAccount() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Update(&user.UpdateRequest{
|
|
||||||
Email: "joe+2@example.com",
|
|
||||||
Id: "user-1",
|
|
||||||
Username: "joe",
|
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|||||||
@@ -141,13 +141,15 @@ type DeployRequest struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
// region to deploy in. defaults to europe-west1
|
// region to deploy in. defaults to europe-west1
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
// github url to repo
|
// github url for a repo
|
||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
// runtime/lanaguage of the function e.g php74,
|
// runtime/lanaguage of the function e.g php74,
|
||||||
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
|
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
|
||||||
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
|
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
|
||||||
// python37, python38, python39
|
// python37, python38, python39
|
||||||
Runtime string `json:"runtime"`
|
Runtime string `json:"runtime"`
|
||||||
|
// inline source code
|
||||||
|
Source string `json:"source"`
|
||||||
// optional subfolder path
|
// optional subfolder path
|
||||||
Subfolder string `json:"subfolder"`
|
Subfolder string `json:"subfolder"`
|
||||||
}
|
}
|
||||||
@@ -189,6 +191,8 @@ type Func struct {
|
|||||||
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
|
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
|
||||||
// python37, python38, python39
|
// python37, python38, python39
|
||||||
Runtime string `json:"runtime"`
|
Runtime string `json:"runtime"`
|
||||||
|
// the source code
|
||||||
|
Source string `json:"source"`
|
||||||
// eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc
|
// eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
// subfolder path to entrypoint
|
// subfolder path to entrypoint
|
||||||
@@ -257,6 +261,8 @@ type RuntimesResponse struct {
|
|||||||
type UpdateRequest struct {
|
type UpdateRequest struct {
|
||||||
// function name
|
// function name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
// inline source code
|
||||||
|
Source string `json:"source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateResponse struct {
|
type UpdateResponse struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user