Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-03-09 11:51:42 +00:00
parent 885aa8766c
commit 465010411d
30 changed files with 1468 additions and 1468 deletions

View File

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

View File

@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](htt
Endpoints:
## ListKeys
List all the available keys
[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// List all the available keys
func ListTheKeys() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{
})
fmt.Println(rsp, err)
}
```
## Set
Set an item in the cache. Overwrites any existing value already set.
@@ -147,30 +174,3 @@ Value: 2,
}
```
## ListKeys
List all the available keys
[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// List all the available keys
func ListTheKeys() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -31,6 +31,119 @@ Name: "general",
})
fmt.Println(rsp, err)
}
```
## List
List available chats
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// List available chats
func ListChatRooms() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.List(&chat.ListRequest{
})
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)
}
```
## 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)
}
```
## Invite
Invite a user to a chat room
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Invite a user to a chat room
func InviteAuser() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Invite(&chat.InviteRequest{
})
fmt.Println(rsp, err)
}
```
## History
@@ -154,116 +267,3 @@ func LeaveAroom() {
}
```
## List
List available chats
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// List available chats
func ListChatRooms() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.List(&chat.ListRequest{
})
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)
}
```
## Invite
Invite a user to a chat room
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Invite a user to a chat room
func InviteAuser() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Invite(&chat.InviteRequest{
})
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)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/comments/api](
Endpoints:
## Read
Read a comment
[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/comments"
)
// Read a comment
func ReadAcomment() {
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
rsp, err := commentsService.Read(&comments.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```
## List
List all the comments
@@ -160,31 +188,3 @@ func CreateAcomment() {
}
```
## Read
Read a comment
[https://m3o.com/comments/api#Read](https://m3o.com/comments/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/comments"
)
// Read a comment
func ReadAcomment() {
commentsService := comments.NewCommentsService(os.Getenv("M3O_API_TOKEN"))
rsp, err := commentsService.Read(&comments.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,90 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h
Endpoints:
## Delete
Delete a contact
[https://m3o.com/contact/api#Delete](https://m3o.com/contact/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
// Delete a contact
func DeleteAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}
```
## List
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 a contact
@@ -217,3 +133,87 @@ func GetAcontact() {
}
```
## Delete
Delete a contact
[https://m3o.com/contact/api#Delete](https://m3o.com/contact/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
// Delete a contact
func DeleteAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}
```
## List
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)
}
```

View File

@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/crypto/api](ht
Endpoints:
## Price
Get the last price for a given crypto ticker
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last price for a given crypto ticker
func GetCryptocurrencyPrice() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Price(&crypto.PriceRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Quote
Get the last quote for a given crypto ticker
[https://m3o.com/crypto/api#Quote](https://m3o.com/crypto/api#Quote)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last quote for a given crypto ticker
func GetAcryptocurrencyQuote() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Quote(&crypto.QuoteRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## History
Returns the history for the previous close
@@ -143,3 +87,59 @@ func GetCryptocurrencyNews() {
}
```
## Price
Get the last price for a given crypto ticker
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last price for a given crypto ticker
func GetCryptocurrencyPrice() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Price(&crypto.PriceRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Quote
Get the last quote for a given crypto ticker
[https://m3o.com/crypto/api#Quote](https://m3o.com/crypto/api#Quote)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last quote for a given crypto ticker
func GetAcryptocurrencyQuote() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Quote(&crypto.QuoteRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/currency/api](
Endpoints:
## History
Returns the historic rates for a currency on a given date
[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Returns the historic rates for a currency on a given date
func HistoricRatesForAcurrency() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.History(&currency.HistoryRequest{
Code: "USD",
Date: "2021-05-30",
})
fmt.Println(rsp, err)
}
```
## Codes
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(&currency.HistoryRequest{
Code: "USD",
Date: "2021-05-30",
})
fmt.Println(rsp, err)
}
```

View File

@@ -26,10 +26,10 @@ func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"age": 42,
"isActive": true,
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "example",
@@ -67,12 +67,12 @@ Table: "example",
}
```
## DropTable
## Truncate
Drop a table in the DB
Truncate the records in a table
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
```go
package example
@@ -84,10 +84,10 @@ import(
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
// Truncate the records in a table
func TruncateTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "example",
})
@@ -121,6 +121,33 @@ func CountEntriesInAtable() {
})
fmt.Println(rsp, err)
}
```
## ListTables
List tables in the DB
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
}
```
## RenameTable
@@ -213,12 +240,12 @@ Table: "example",
}
```
## Truncate
## DropTable
Truncate the records in a table
Drop a table in the DB
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
@@ -230,10 +257,10 @@ import(
"go.m3o.com/db"
)
// Truncate the records in a table
func TruncateTable() {
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
@@ -241,30 +268,3 @@ func TruncateTable() {
}
```
## ListTables
List tables in the DB
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,10 +12,10 @@ func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
"id": "1",
},
Table: "example",
})

View File

@@ -4,6 +4,47 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/event/api](htt
Endpoints:
## Consume
Consume events from a given topic.
[https://m3o.com/event/api#Consume](https://m3o.com/event/api#Consume)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Consume events from a given topic.
func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
stream, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user",
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```
## Read
Read stored events
@@ -54,9 +95,9 @@ func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "user",
@@ -65,44 +106,3 @@ Topic: "user",
}
```
## Consume
Consume events from a given topic.
[https://m3o.com/event/api#Consume](https://m3o.com/event/api#Consume)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Consume events from a given topic.
func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
stream, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user",
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/file/api](http
Endpoints:
## List
List files by their project and optionally a path.
[https://m3o.com/file/api#List](https://m3o.com/file/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// List files by their project and optionally a path.
func ListFiles() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.List(&file.ListRequest{
Project: "examples",
})
fmt.Println(rsp, err)
}
```
## Read
Read a file by path
@@ -122,3 +94,31 @@ func SaveFile() {
}
```
## List
List files by their project and optionally a path.
[https://m3o.com/file/api#List](https://m3o.com/file/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// List files by their project and optionally a path.
func ListFiles() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.List(&file.ListRequest{
Project: "examples",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
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)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Deploy
Deploy a group of functions
@@ -97,12 +152,12 @@ Request: map[string]interface{}{
}
```
## List
## Describe
List all the deployed functions
Get the info for a deployed function
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
@@ -114,37 +169,10 @@ import(
"go.m3o.com/function"
)
// List all the deployed functions
func ListFunctions() {
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
@@ -205,6 +233,33 @@ func ReserveAfunction() {
})
fmt.Println(rsp, err)
}
```
## Runtimes
Return a list of supported runtimes
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported runtimes
func ListRuntimes() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
})
fmt.Println(rsp, err)
}
```
## Proxy
@@ -235,58 +290,3 @@ func ProxyUrl() {
}
```
## Describe
Get the info for a deployed function
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Runtimes
Return a list of supported runtimes
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported runtimes
func ListRuntimes() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/geocoding/api]
Endpoints:
## Reverse
Reverse lookup an address from gps coordinates
[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/geocoding"
)
// Reverse lookup an address from gps coordinates
func ReverseGeocodeLocation() {
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{
Latitude: 51.5123064,
Longitude: -0.1216235,
})
fmt.Println(rsp, err)
}
```
## Lookup
Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
@@ -35,32 +64,3 @@ Postcode: "wc2b",
}
```
## Reverse
Reverse lookup an address from gps coordinates
[https://m3o.com/geocoding/api#Reverse](https://m3o.com/geocoding/api#Reverse)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/geocoding"
)
// Reverse lookup an address from gps coordinates
func ReverseGeocodeLocation() {
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{
Latitude: 51.5123064,
Longitude: -0.1216235,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,41 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/image/api](htt
Endpoints:
## Convert
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
or by uploading the conversion result.
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#Convert](https://m3o.com/image/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
// 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 ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Convert(&image.ConvertRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
@@ -256,3 +221,38 @@ Width: 100,
}
```
## Convert
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
or by uploading the conversion result.
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#Convert](https://m3o.com/image/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
// 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 ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Convert(&image.ConvertRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,40 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/location/api](
Endpoints:
## Search
Search for entities in a given radius
[https://m3o.com/location/api#Search](https://m3o.com/location/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/location"
)
// Search for entities in a given radius
func SearchForLocations() {
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
rsp, err := locationService.Search(&location.SearchRequest{
Center: &location.Point{
Latitude: 51.511061,
Longitude: -0.120022,
},
NumEntities: 10,
Radius: 100,
Type: "bike",
})
fmt.Println(rsp, err)
}
```
## Save
Save an entity's current position
@@ -102,3 +68,37 @@ func GetLocationById() {
}
```
## Search
Search for entities in a given radius
[https://m3o.com/location/api#Search](https://m3o.com/location/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/location"
)
// Search for entities in a given radius
func SearchForLocations() {
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
rsp, err := locationService.Search(&location.SearchRequest{
Center: &location.Point{
Latitude: 51.511061,
Longitude: -0.120022,
},
NumEntities: 10,
Radius: 100,
Type: "bike",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/nft/api](https
Endpoints:
## Assets
Return a list of assets
[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Return a list of assets
func GetAlistOfAssets() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Assets(&nft.AssetsRequest{
Limit: 1,
})
fmt.Println(rsp, err)
}
```
## Create
Create your own NFT (coming soon)
@@ -116,31 +144,3 @@ func GetAsingleCollection() {
}
```
## Assets
Return a list of assets
[https://m3o.com/nft/api#Assets](https://m3o.com/nft/api#Assets)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Return a list of assets
func GetAlistOfAssets() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Assets(&nft.AssetsRequest{
Limit: 1,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,93 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt
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(&notes.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(&notes.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(&notes.UpdateRequest{
Note: &notes.Note{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
Text: "Updated note text",
Title: "Update Note",
},
})
fmt.Println(rsp, err)
}
```
## Delete
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(&notes.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(&notes.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(&notes.UpdateRequest{
Note: &notes.Note{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
Text: "Updated note text",
Title: "Update Note",
},
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/ping/api](http
Endpoints:
## Ip
Ping an IP address
[https://m3o.com/ping/api#Ip](https://m3o.com/ping/api#Ip)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping an IP address
func PingAnIp() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Ip(&ping.IpRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}
```
## Tcp
Ping a TCP port is open
@@ -60,31 +88,3 @@ func CheckAurl() {
}
```
## Ip
Ping an IP address
[https://m3o.com/ping/api#Ip](https://m3o.com/ping/api#Ip)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping an IP address
func PingAnIp() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Ip(&ping.IpRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/place/api](htt
Endpoints:
## Search
Search for places by text query
[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/place"
)
// Search for places by text query
func SearchForPlaces() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Search(&place.SearchRequest{
Location: "51.5074577,-0.1297515",
Query: "food",
})
fmt.Println(rsp, err)
}
```
## Nearby
Find places nearby using a location
@@ -63,3 +34,32 @@ Type: "store",
}
```
## Search
Search for places by text query
[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/place"
)
// Search for places by text query
func SearchForPlaces() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Search(&place.SearchRequest{
Location: "51.5074577,-0.1297515",
Query: "food",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/postcode/api](
Endpoints:
## Validate
Validate a postcode.
[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/postcode"
)
// Validate a postcode.
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Validate(&postcode.ValidateRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```
## Lookup
Lookup a postcode to retrieve the related region, county, etc
@@ -59,31 +87,3 @@ func ReturnArandomPostcodeAndItsInformation() {
}
```
## Validate
Validate a postcode.
[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/postcode"
)
// Validate a postcode.
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Validate(&postcode.ValidateRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/quran/api](htt
Endpoints:
## Verses
Lookup the verses (ayahs) for a chapter including
translation, interpretation and breakdown by individual
words.
[https://m3o.com/quran/api#Verses](https://m3o.com/quran/api#Verses)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/quran"
)
// Lookup the verses (ayahs) for a chapter including
// translation, interpretation and breakdown by individual
// words.
func GetVersesOfAchapter() {
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
rsp, err := quranService.Verses(&quran.VersesRequest{
Chapter: 1,
})
fmt.Println(rsp, err)
}
```
## Search
Search the Quran for any form of query or questions
@@ -120,3 +88,35 @@ func GetChapterSummary() {
}
```
## Verses
Lookup the verses (ayahs) for a chapter including
translation, interpretation and breakdown by individual
words.
[https://m3o.com/quran/api#Verses](https://m3o.com/quran/api#Verses)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/quran"
)
// Lookup the verses (ayahs) for a chapter including
// translation, interpretation and breakdown by individual
// words.
func GetVersesOfAchapter() {
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
rsp, err := quranService.Verses(&quran.VersesRequest{
Chapter: 1,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,41 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/routing/api](h
Endpoints:
## Eta
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/routing"
)
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
func EtaFromPointAtoPointB() {
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := routingService.Eta(&routing.EtaRequest{
Destination: &routing.Point{
Latitude: 52.529407,
Longitude: 13.397634,
},
Origin: &routing.Point{
Latitude: 52.517037,
Longitude: 13.38886,
},
})
fmt.Println(rsp, err)
}
```
## Directions
Turn by turn directions from a start point to an end point including maneuvers and bearings
@@ -109,3 +74,38 @@ Origin: &routing.Point{
}
```
## Eta
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/routing"
)
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
func EtaFromPointAtoPointB() {
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := routingService.Eta(&routing.EtaRequest{
Destination: &routing.Point{
Latitude: 52.529407,
Longitude: 13.397634,
},
Origin: &routing.Point{
Latitude: 52.517037,
Longitude: 13.38886,
},
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,36 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/rss/api](https
Endpoints:
## Add
Add a new RSS feed with a name, url, and category
[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Add a new RSS feed with a name, url, and category
func AddAnewFeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Add(&rss.AddRequest{
Category: "news",
Name: "bbc",
Url: "http://feeds.bbci.co.uk/news/rss.xml",
})
fmt.Println(rsp, err)
}
```
## Feed
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
@@ -87,33 +117,3 @@ func RemoveAfeed() {
}
```
## Add
Add a new RSS feed with a name, url, and category
[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Add a new RSS feed with a name, url, and category
func AddAnewFeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Add(&rss.AddRequest{
Category: "news",
Name: "bbc",
Url: "http://feeds.bbci.co.uk/news/rss.xml",
})
fmt.Println(rsp, err)
}
```

View File

@@ -26,9 +26,9 @@ func IndexArecord() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Index(&search.IndexRequest{
Data: map[string]interface{}{
"starsign": "Leo",
"name": "John Doe",
"age": 37,
"starsign": "Leo",
},
Index: "customers",

View File

@@ -4,6 +4,118 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/space/api](htt
Endpoints:
## Delete
Delete an object from space
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Delete an object from space
func DeleteAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Delete(&space.DeleteRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## List
List the objects in space
[https://m3o.com/space/api#List](https://m3o.com/space/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// List the objects in space
func ListObjectsWithPrefix() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.List(&space.ListRequest{
Prefix: "images/",
})
fmt.Println(rsp, err)
}
```
## Head
Retrieve meta information about an object
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read 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
@@ -120,115 +232,3 @@ Visibility: "public",
}
```
## Delete
Delete an object from space
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Delete an object from space
func DeleteAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Delete(&space.DeleteRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## List
List the objects in space
[https://m3o.com/space/api#List](https://m3o.com/space/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// List the objects in space
func ListObjectsWithPrefix() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.List(&space.ListRequest{
Prefix: "images/",
})
fmt.Println(rsp, err)
}
```
## Head
Retrieve meta information about an object
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read an object in space
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Read an object in space
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stock/api](htt
Endpoints:
## OrderBook
Get the historic order book and each trade by timestamp
[https://m3o.com/stock/api#OrderBook](https://m3o.com/stock/api#OrderBook)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stock"
)
// Get the historic order book and each trade by timestamp
func OrderBookHistory() {
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
rsp, err := stockService.OrderBook(&stock.OrderBookRequest{
Date: "2020-10-01",
End: "2020-10-01T11:00:00Z",
Limit: 3,
Start: "2020-10-01T10:00:00Z",
Stock: "AAPL",
})
fmt.Println(rsp, err)
}
```
## Price
Get the last price for a given stock ticker
@@ -121,3 +89,35 @@ Stock: "AAPL",
}
```
## OrderBook
Get the historic order book and each trade by timestamp
[https://m3o.com/stock/api#OrderBook](https://m3o.com/stock/api#OrderBook)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stock"
)
// Get the historic order book and each trade by timestamp
func OrderBookHistory() {
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
rsp, err := stockService.OrderBook(&stock.OrderBookRequest{
Date: "2020-10-01",
End: "2020-10-01T11:00:00Z",
Limit: 3,
Start: "2020-10-01T10:00:00Z",
Stock: "AAPL",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stream/api](ht
Endpoints:
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```
## CreateChannel
Create a channel with a given name and description. Channels are created automatically but
@@ -119,3 +92,30 @@ func ListMessages() {
}
```
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,65 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sunnah/api](ht
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
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)
}
```

View File

@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/time/api](http
Endpoints:
## Now
Get the current time
[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/time"
)
// Get the current time
func ReturnsCurrentTimeOptionallyWithLocation() {
timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := timeService.Now(&time.NowRequest{
})
fmt.Println(rsp, err)
}
```
## Zone
Get the timezone info for a specific location
@@ -32,30 +59,3 @@ func GetTheTimezoneInfoForAspecificLocation() {
}
```
## Now
Get the current time
[https://m3o.com/time/api#Now](https://m3o.com/time/api#Now)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/time"
)
// Get the current time
func ReturnsCurrentTimeOptionallyWithLocation() {
timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := timeService.Now(&time.NowRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,72 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http
Endpoints:
## SendMagicLink
Login using email only - Passwordless
[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using email only - Passwordless
func SendAmagicLink() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{
Address: "www.example.com",
Email: "joe@example.com",
Endpoint: "verifytoken",
FromName: "Awesome Dot Com",
Subject: "MagicLink to access your account",
TextContent: `Hi there,
Click here to access your account $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
@@ -155,6 +89,101 @@ func ReadAsessionByTheSessionId() {
})
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)
}
```
## 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)
}
```
## SendPasswordResetEmail
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Send an email with a verification code to reset password.
// Call "ResetPassword" endpoint once user provides the code.
func SendPasswordResetEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
Email: "joe@example.com",
FromName: "Awesome Dot Com",
Subject: "Password reset",
TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
})
fmt.Println(rsp, err)
}
```
## VerifyToken
@@ -275,18 +304,12 @@ func ReadAccountByEmail() {
}
```
## SendVerificationEmail
## VerifyEmail
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'
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
@@ -298,24 +321,40 @@ import(
"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() {
// 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.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,
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Token: "012345",
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)
@@ -351,34 +390,6 @@ NewPassword: "NewPassword1",
})
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)
}
```
## Delete
@@ -440,12 +451,18 @@ Username: "joe",
}
```
## Update
## SendVerificationEmail
Update the account username or email
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#Update](https://m3o.com/user/api#Update)
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
```go
package example
@@ -457,59 +474,36 @@ import(
"go.m3o.com/user"
)
// Update the account username or email
func UpdateAnAccount() {
// 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.Update(&user.UpdateRequest{
Email: "joe+2@example.com",
Id: "user-1",
Username: "joe",
})
fmt.Println(rsp, err)
}
```
## SendPasswordResetEmail
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Send an email with a verification code to reset password.
// Call "ResetPassword" endpoint once user provides the code.
func SendPasswordResetEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
Email: "joe@example.com",
FailureRedirectUrl: "https://m3o.com/verification-failed",
FromName: "Awesome Dot Com",
Subject: "Password reset",
RedirectUrl: "https://m3o.com",
Subject: "Email verification",
TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```
## List
## SendMagicLink
List all users. Returns a paged list of results
Login using email only - Passwordless
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink)
```go
package example
@@ -521,12 +515,18 @@ import(
"go.m3o.com/user"
)
// List all users. Returns a paged list of results
func ListAllUsers() {
// Login using email only - Passwordless
func SendAmagicLink() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.List(&user.ListRequest{
Limit: 100,
Offset: 0,
rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{
Address: "www.example.com",
Email: "joe@example.com",
Endpoint: "verifytoken",
FromName: "Awesome Dot Com",
Subject: "MagicLink to access your account",
TextContent: `Hi there,
Click here to access your account $micro_verification_link`,
})
fmt.Println(rsp, err)