mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 10:34:27 +00:00
Commit from m3o/m3o action
This commit is contained in:
@@ -4,6 +4,92 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the apps
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/app"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the apps
|
||||||
|
func ListTheApps() {
|
||||||
|
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := appService.List(&app.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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
|
||||||
|
|
||||||
|
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
|
## Status
|
||||||
|
|
||||||
Get the status of an app
|
Get the status of an app
|
||||||
@@ -144,89 +230,3 @@ func ReserveAppName() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
|
||||||
|
|
||||||
List all the apps
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/app"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the apps
|
|
||||||
func ListTheApps() {
|
|
||||||
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := appService.List(&app.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## List
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() {
|
|
||||||
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := contactService.List(&contact.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## List
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/contact"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
func ListContactsWithSpecificOffsetAndLimit() {
|
|
||||||
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := contactService.List(&contact.ListRequest{
|
|
||||||
Limit: 1,
|
|
||||||
Offset: 1,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
## Create
|
||||||
|
|
||||||
|
|
||||||
@@ -217,3 +161,59 @@ func DeleteAcontact() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() {
|
||||||
|
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := contactService.List(&contact.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
func ListContactsWithSpecificOffsetAndLimit() {
|
||||||
|
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := contactService.List(&contact.ListRequest{
|
||||||
|
Limit: 1,
|
||||||
|
Offset: 1,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/crypto/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## News
|
||||||
|
|
||||||
|
Get news related to a currency
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/crypto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get news related to a currency
|
||||||
|
func GetCryptocurrencyNews() {
|
||||||
|
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cryptoService.News(&crypto.NewsRequest{
|
||||||
|
Symbol: "BTCUSD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Price
|
## Price
|
||||||
|
|
||||||
Get the last price for a given crypto ticker
|
Get the last price for a given crypto ticker
|
||||||
@@ -88,31 +116,3 @@ func GetPreviousClose() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## News
|
|
||||||
|
|
||||||
Get news related to a currency
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get news related to a currency
|
|
||||||
func GetCryptocurrencyNews() {
|
|
||||||
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cryptoService.News(&crypto.NewsRequest{
|
|
||||||
Symbol: "BTCUSD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/currency/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## History
|
|
||||||
|
|
||||||
Returns the historic rates for a currency on a given date
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/currency"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Returns the historic rates for a currency on a given date
|
|
||||||
func HistoricRatesForAcurrency() {
|
|
||||||
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := currencyService.History(¤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
|
||||||
@@ -147,3 +118,32 @@ To: "GBP",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## History
|
||||||
|
|
||||||
|
Returns the historic rates for a currency on a given date
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/currency/api#History](https://m3o.com/currency/api#History)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/currency"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Returns the historic rates for a currency on a given date
|
||||||
|
func HistoricRatesForAcurrency() {
|
||||||
|
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := currencyService.History(¤cy.HistoryRequest{
|
||||||
|
Code: "USD",
|
||||||
|
Date: "2021-05-30",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,40 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
func CreateArecord() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
|
Record: map[string]interface{}{
|
||||||
|
"name": "Jane",
|
||||||
|
"age": 42,
|
||||||
|
"isActive": true,
|
||||||
|
"id": "1",
|
||||||
|
},
|
||||||
|
Table: "example",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Delete
|
## Delete
|
||||||
|
|
||||||
Delete a record in the database by id.
|
Delete a record in the database by id.
|
||||||
@@ -33,12 +67,12 @@ Table: "example",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Count
|
## Truncate
|
||||||
|
|
||||||
Count records in a table
|
Truncate the records in a table
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
|
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -50,10 +84,10 @@ import(
|
|||||||
"go.m3o.com/db"
|
"go.m3o.com/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Count records in a table
|
// Truncate the records in a table
|
||||||
func CountEntriesInAtable() {
|
func TruncateTable() {
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := dbService.Count(&db.CountRequest{
|
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
||||||
Table: "example",
|
Table: "example",
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -61,12 +95,12 @@ func CountEntriesInAtable() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
## RenameTable
|
||||||
|
|
||||||
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
Rename a table
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -78,17 +112,12 @@ import(
|
|||||||
"go.m3o.com/db"
|
"go.m3o.com/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
// Rename a table
|
||||||
func CreateArecord() {
|
func RenameTable() {
|
||||||
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.RenameTable(&db.RenameTableRequest{
|
||||||
Record: map[string]interface{}{
|
From: "examples2",
|
||||||
"id": "1",
|
To: "examples3",
|
||||||
"name": "Jane",
|
|
||||||
"age": 42,
|
|
||||||
"isActive": true,
|
|
||||||
},
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -117,8 +146,8 @@ func UpdateArecord() {
|
|||||||
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",
|
||||||
|
|
||||||
@@ -154,34 +183,6 @@ Table: "example",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Truncate
|
|
||||||
|
|
||||||
Truncate the records in a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Truncate the records in a table
|
|
||||||
func TruncateTable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
|
||||||
Table: "example",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## DropTable
|
## DropTable
|
||||||
@@ -210,6 +211,34 @@ func DropTable() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
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
|
||||||
@@ -239,32 +268,3 @@ func ListTables() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## RenameTable
|
|
||||||
|
|
||||||
Rename a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Rename a table
|
|
||||||
func RenameTable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
|
|
||||||
From: "examples2",
|
|
||||||
To: "examples3",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -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{}{
|
||||||
"age": 42,
|
|
||||||
"isActive": true,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
|
"age": 42,
|
||||||
|
"isActive": true,
|
||||||
},
|
},
|
||||||
Table: "example",
|
Table: "example",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/emoji/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Find
|
||||||
|
|
||||||
|
Find an emoji by its alias e.g :beer:
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/emoji"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Find an emoji by its alias e.g :beer:
|
||||||
|
func FindEmoji() {
|
||||||
|
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := emojiService.Find(&emoji.FindRequest{
|
||||||
|
Alias: ":beer:",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Flag
|
||||||
|
|
||||||
|
Get the flag for a country. Requires country code e.g GB for great britain
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/emoji"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the flag for a country. Requires country code e.g GB for great britain
|
||||||
|
func GetFlagByCountryCode() {
|
||||||
|
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := emojiService.Flag(&emoji.FlagRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Print
|
## Print
|
||||||
|
|
||||||
Print text and renders the emojis with aliases e.g
|
Print text and renders the emojis with aliases e.g
|
||||||
@@ -64,58 +119,3 @@ To: "+44782669123",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Find
|
|
||||||
|
|
||||||
Find an emoji by its alias e.g :beer:
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/emoji"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Find an emoji by its alias e.g :beer:
|
|
||||||
func FindEmoji() {
|
|
||||||
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := emojiService.Find(&emoji.FindRequest{
|
|
||||||
Alias: ":beer:",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Flag
|
|
||||||
|
|
||||||
Get the flag for a country. Requires country code e.g GB for great britain
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/emoji"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the flag for a country. Requires country code e.g GB for great britain
|
|
||||||
func GetFlagByCountryCode() {
|
|
||||||
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := emojiService.Flag(&emoji.FlagRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/evchargers/api
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## ReferenceData
|
|
||||||
|
|
||||||
Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/evchargers"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
||||||
func GetReferenceData() {
|
|
||||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Search
|
## Search
|
||||||
|
|
||||||
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
||||||
@@ -125,3 +98,30 @@ Location: &evchargers.Coordinates{
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## ReferenceData
|
||||||
|
|
||||||
|
Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/evchargers"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
||||||
|
func GetReferenceData() {
|
||||||
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Describe
|
## Call
|
||||||
|
|
||||||
Get the info for a deployed function
|
Call a function by name
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
|
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -21,11 +21,70 @@ import(
|
|||||||
"go.m3o.com/function"
|
"go.m3o.com/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get the info for a deployed function
|
// Call a function by name
|
||||||
func DescribeFunctionStatus() {
|
func CallAfunction() {
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := functionService.Describe(&function.DescribeRequest{
|
rsp, err := functionService.Call(&function.CallRequest{
|
||||||
Name: "helloworld",
|
Name: "helloworld",
|
||||||
|
Request: map[string]interface{}{
|
||||||
|
"name": "Alice",
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Reserve
|
||||||
|
|
||||||
|
Reserve function names and resources beyond free quota
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reserve function names and resources beyond free quota
|
||||||
|
func ReserveAfunction() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Reserve(&function.ReserveRequest{
|
||||||
|
Name: "helloworld",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Proxy
|
||||||
|
|
||||||
|
Return the backend url for proxying
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Return the backend url for proxying
|
||||||
|
func ProxyUrl() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
||||||
|
Id: "helloworld",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -92,6 +151,61 @@ func UpdateAfunction() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Describe
|
||||||
|
|
||||||
|
Get the info for a deployed function
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the info for a deployed function
|
||||||
|
func DescribeFunctionStatus() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Describe(&function.DescribeRequest{
|
||||||
|
Name: "helloworld",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Regions
|
||||||
|
|
||||||
|
Return a list of supported regions
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/function"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Return a list of supported regions
|
||||||
|
func ListRegions() {
|
||||||
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := functionService.Regions(&function.RegionsRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
## List
|
||||||
@@ -149,117 +263,3 @@ func DeleteAfunction() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Call
|
|
||||||
|
|
||||||
Call a function by name
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Call a function by name
|
|
||||||
func CallAfunction() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.Call(&function.CallRequest{
|
|
||||||
Name: "helloworld",
|
|
||||||
Request: map[string]interface{}{
|
|
||||||
"name": "Alice",
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Regions
|
|
||||||
|
|
||||||
Return a list of supported regions
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Return a list of supported regions
|
|
||||||
func ListRegions() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.Regions(&function.RegionsRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Reserve
|
|
||||||
|
|
||||||
Reserve function names and resources beyond free quota
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reserve function names and resources beyond free quota
|
|
||||||
func ReserveAfunction() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.Reserve(&function.ReserveRequest{
|
|
||||||
Name: "helloworld",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Proxy
|
|
||||||
|
|
||||||
Return the backend url for proxying
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/function"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Return the backend url for proxying
|
|
||||||
func ProxyUrl() {
|
|
||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := functionService.Proxy(&function.ProxyRequest{
|
|
||||||
Id: "helloworld",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,76 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/image/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Upload
|
|
||||||
|
|
||||||
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
|
||||||
To resize an image before uploading, see the Resize endpoint.
|
|
||||||
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
|
||||||
with each parameter as a form field.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
|
||||||
// To resize an image before uploading, see the Resize endpoint.
|
|
||||||
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
|
||||||
// with each parameter as a form field.
|
|
||||||
func UploadAbase64imageToMicrosCdn() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Upload(&image.UploadRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
|
|
||||||
Name: "cat.jpeg",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Upload
|
|
||||||
|
|
||||||
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
|
||||||
To resize an image before uploading, see the Resize endpoint.
|
|
||||||
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
|
||||||
with each parameter as a form field.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
|
||||||
// To resize an image before uploading, see the Resize endpoint.
|
|
||||||
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
|
||||||
// with each parameter as a form field.
|
|
||||||
func UploadAnImageFromAurlToMicrosCdn() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Upload(&image.UploadRequest{
|
|
||||||
Name: "cat.jpeg",
|
|
||||||
Url: "somewebsite.com/cat.png",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Delete
|
## Delete
|
||||||
|
|
||||||
Delete an image previously uploaded.
|
Delete an image previously uploaded.
|
||||||
@@ -256,3 +186,73 @@ Url: "somewebsite.com/cat.png",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Upload
|
||||||
|
|
||||||
|
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
||||||
|
To resize an image before uploading, see the Resize endpoint.
|
||||||
|
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
||||||
|
with each parameter as a form field.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
||||||
|
// To resize an image before uploading, see the Resize endpoint.
|
||||||
|
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
||||||
|
// with each parameter as a form field.
|
||||||
|
func UploadAbase64imageToMicrosCdn() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
|
||||||
|
Name: "cat.jpeg",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Upload
|
||||||
|
|
||||||
|
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
||||||
|
To resize an image before uploading, see the Resize endpoint.
|
||||||
|
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
||||||
|
with each parameter as a form field.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
||||||
|
// To resize an image before uploading, see the Resize endpoint.
|
||||||
|
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
|
||||||
|
// with each parameter as a form field.
|
||||||
|
func UploadAnImageFromAurlToMicrosCdn() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
||||||
|
Name: "cat.jpeg",
|
||||||
|
Url: "somewebsite.com/cat.png",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,42 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/location/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Save
|
||||||
|
|
||||||
|
Save an entity's current position
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/location"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Save an entity's current position
|
||||||
|
func SaveAnEntity() {
|
||||||
|
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := locationService.Save(&location.SaveRequest{
|
||||||
|
Entity: &location.Entity{
|
||||||
|
Id: "1",
|
||||||
|
Location: &location.Point{
|
||||||
|
Latitude: 51.511061,
|
||||||
|
Longitude: -0.120022,
|
||||||
|
Timestamp: 1622802761,
|
||||||
|
},
|
||||||
|
Type: "bike",
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Read
|
## Read
|
||||||
|
|
||||||
Read an entity by its ID
|
Read an entity by its ID
|
||||||
@@ -66,39 +102,3 @@ Type: "bike",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Save
|
|
||||||
|
|
||||||
Save an entity's current position
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/location"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Save an entity's current position
|
|
||||||
func SaveAnEntity() {
|
|
||||||
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := locationService.Save(&location.SaveRequest{
|
|
||||||
Entity: &location.Entity{
|
|
||||||
Id: "1",
|
|
||||||
Location: &location.Point{
|
|
||||||
Latitude: 51.511061,
|
|
||||||
Longitude: -0.120022,
|
|
||||||
Timestamp: 1622802761,
|
|
||||||
},
|
|
||||||
Type: "bike",
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
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{}{
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
|
"id": "1",
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ func main() {
|
|||||||
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := mqService.Publish(&mq.PublishRequest{
|
rsp, err := mqService.Publish(&mq.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
|
"id": "1",
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all the notes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/notes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all the notes
|
||||||
|
func ListAllNotes() {
|
||||||
|
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := notesService.List(¬es.ListRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
Update a note
|
Update a note
|
||||||
@@ -162,30 +189,3 @@ func ReadAnote() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## List
|
|
||||||
|
|
||||||
List all the notes
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List all the notes
|
|
||||||
func ListAllNotes() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.List(¬es.ListRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/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
|
||||||
@@ -88,3 +60,31 @@ 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,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/place/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Autocomplete
|
|
||||||
|
|
||||||
Autocomplete queries (coming soon)
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/place/api#Autocomplete](https://m3o.com/place/api#Autocomplete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/place"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Autocomplete queries (coming soon)
|
|
||||||
func AutocompleteQueries() {
|
|
||||||
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := placeService.Autocomplete(&place.AutocompleteRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Nearby
|
## Nearby
|
||||||
|
|
||||||
Find places nearby using a location
|
Find places nearby using a location
|
||||||
|
|||||||
@@ -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,6 +4,41 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/routing/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Route
|
||||||
|
|
||||||
|
Retrieve a route as a simple list of gps points along with total distance and estimated duration
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/routing/api#Route](https://m3o.com/routing/api#Route)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/routing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Retrieve a route as a simple list of gps points along with total distance and estimated duration
|
||||||
|
func GpsPointsForAroute() {
|
||||||
|
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := routingService.Route(&routing.RouteRequest{
|
||||||
|
Destination: &routing.Point{
|
||||||
|
Latitude: 52.529407,
|
||||||
|
Longitude: 13.397634,
|
||||||
|
},
|
||||||
|
Origin: &routing.Point{
|
||||||
|
Latitude: 52.517037,
|
||||||
|
Longitude: 13.38886,
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Eta
|
## Eta
|
||||||
|
|
||||||
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||||
@@ -74,38 +109,3 @@ Origin: &routing.Point{
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Route
|
|
||||||
|
|
||||||
Retrieve a route as a simple list of gps points along with total distance and estimated duration
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/routing/api#Route](https://m3o.com/routing/api#Route)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/routing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Retrieve a route as a simple list of gps points along with total distance and estimated duration
|
|
||||||
func GpsPointsForAroute() {
|
|
||||||
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := routingService.Route(&routing.RouteRequest{
|
|
||||||
Destination: &routing.Point{
|
|
||||||
Latitude: 52.529407,
|
|
||||||
Longitude: 13.397634,
|
|
||||||
},
|
|
||||||
Origin: &routing.Point{
|
|
||||||
Latitude: 52.517037,
|
|
||||||
Longitude: 13.38886,
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,36 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/rss/api](https
|
|||||||
|
|
||||||
Endpoints:
|
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
|
## Feed
|
||||||
|
|
||||||
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
|
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
|
||||||
@@ -117,3 +87,33 @@ 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,62 @@ 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 document i.e. insert a document to search for.
|
Index a document i.e. insert a document to search for.
|
||||||
@@ -27,9 +83,9 @@ func IndexAdocument() {
|
|||||||
rsp, err := searchService.Index(&search.IndexRequest{
|
rsp, err := searchService.Index(&search.IndexRequest{
|
||||||
Document: &search.Document{
|
Document: &search.Document{
|
||||||
Contents: map[string]interface{}{
|
Contents: map[string]interface{}{
|
||||||
"name": "John Doe",
|
|
||||||
"age": 37,
|
"age": 37,
|
||||||
"starsign": "Leo",
|
"starsign": "Leo",
|
||||||
|
"name": "John Doe",
|
||||||
},
|
},
|
||||||
Id: "1234",
|
Id: "1234",
|
||||||
},
|
},
|
||||||
@@ -156,59 +212,3 @@ 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ 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
|
||||||
|
|
||||||
Download an object via a presigned url
|
Download an object via a presigned url
|
||||||
@@ -204,31 +232,3 @@ 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,38 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stock/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
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
|
## Price
|
||||||
|
|
||||||
Get the last price for a given stock ticker
|
Get the last price for a given stock ticker
|
||||||
@@ -89,35 +121,3 @@ 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,37 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stream/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## CreateChannel
|
|
||||||
|
|
||||||
Create a channel with a given name and description. Channels are created automatically but
|
|
||||||
this allows you to specify a description that's persisted for the lifetime of the channel.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stream/api#CreateChannel](https://m3o.com/stream/api#CreateChannel)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a channel with a given name and description. Channels are created automatically but
|
|
||||||
// this allows you to specify a description that's persisted for the lifetime of the channel.
|
|
||||||
func CreateChannel() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.CreateChannel(&stream.CreateChannelRequest{
|
|
||||||
Description: "The channel for all things",
|
|
||||||
Name: "general",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## SendMessage
|
## SendMessage
|
||||||
|
|
||||||
Send a message to the stream.
|
Send a message to the stream.
|
||||||
@@ -119,3 +88,34 @@ func ListChannels() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## CreateChannel
|
||||||
|
|
||||||
|
Create a channel with a given name and description. Channels are created automatically but
|
||||||
|
this allows you to specify a description that's persisted for the lifetime of the channel.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stream/api#CreateChannel](https://m3o.com/stream/api#CreateChannel)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stream"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a channel with a given name and description. Channels are created automatically but
|
||||||
|
// this allows you to specify a description that's persisted for the lifetime of the channel.
|
||||||
|
func CreateChannel() {
|
||||||
|
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := streamService.CreateChannel(&stream.CreateChannelRequest{
|
||||||
|
Description: "The channel for all things",
|
||||||
|
Name: "general",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,6 +4,35 @@ 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
|
## Books
|
||||||
|
|
||||||
Get a list of books from within a collection. A book can contain many chapters
|
Get a list of books from within a collection. A book can contain many chapters
|
||||||
@@ -94,32 +123,3 @@ Collection: "bukhari",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Collections
|
|
||||||
|
|
||||||
Get a list of available collections. A collection is
|
|
||||||
a compilation of hadiths collected and written by an author.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/sunnah"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get a list of available collections. A collection is
|
|
||||||
// a compilation of hadiths collected and written by an author.
|
|
||||||
func ListAvailableCollections() {
|
|
||||||
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/url/api](https
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Proxy
|
||||||
|
|
||||||
|
Proxy returns the destination URL of a short URL.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/url/api#Proxy](https://m3o.com/url/api#Proxy)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Proxy returns the destination URL of a short URL.
|
||||||
|
func ResolveAshortUrlToAlongDestinationUrl() {
|
||||||
|
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := urlService.Proxy(&url.ProxyRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## List
|
## List
|
||||||
|
|
||||||
List all the shortened URLs
|
List all the shortened URLs
|
||||||
@@ -58,30 +85,3 @@ func ShortenAlongUrl() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Proxy
|
|
||||||
|
|
||||||
Proxy returns the destination URL of a short URL.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/url/api#Proxy](https://m3o.com/url/api#Proxy)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/url"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Proxy returns the destination URL of a short URL.
|
|
||||||
func ResolveAshortUrlToAlongDestinationUrl() {
|
|
||||||
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := urlService.Proxy(&url.ProxyRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,65 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## ResetPassword
|
||||||
|
|
||||||
|
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
func ResetPassword() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
|
||||||
|
Code: "012345",
|
||||||
|
ConfirmPassword: "NewPassword1",
|
||||||
|
Email: "joe@example.com",
|
||||||
|
NewPassword: "NewPassword1",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete an account by id
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete an account by id
|
||||||
|
func DeleteUserAccount() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Delete(&user.DeleteRequest{
|
||||||
|
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## VerifyToken
|
## VerifyToken
|
||||||
|
|
||||||
Check whether the token attached to MagicLink is valid or not.
|
Check whether the token attached to MagicLink is valid or not.
|
||||||
@@ -38,12 +97,12 @@ func VerifyAtoken() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## ReadSession
|
## Update
|
||||||
|
|
||||||
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
Update the account username or email
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession)
|
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -55,99 +114,12 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
// Update the account username or email
|
||||||
func ReadAsessionByTheSessionId() {
|
func UpdateAnAccount() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
rsp, err := userService.Update(&user.UpdateRequest{
|
||||||
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
Email: "joe+2@example.com",
|
||||||
|
Id: "user-1",
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ResetPassword
|
|
||||||
|
|
||||||
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
|
||||||
func ResetPassword() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
|
|
||||||
Code: "012345",
|
|
||||||
ConfirmPassword: "NewPassword1",
|
|
||||||
Email: "joe@example.com",
|
|
||||||
NewPassword: "NewPassword1",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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)
|
fmt.Println(rsp, err)
|
||||||
@@ -189,12 +161,13 @@ Click here to access your account $micro_verification_link`,
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
## Login
|
||||||
|
|
||||||
Create a new user account. The email address and username for the account must be unique.
|
Login using username or email. The response will return a new session for successful login,
|
||||||
|
401 in the case of login failure and 500 for any other error
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create)
|
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -206,14 +179,41 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create a new user account. The email address and username for the account must be unique.
|
// Login using username or email. The response will return a new session for successful login,
|
||||||
func CreateAnAccount() {
|
// 401 in the case of login failure and 500 for any other error
|
||||||
|
func LogAuserIn() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Create(&user.CreateRequest{
|
rsp, err := userService.Login(&user.LoginRequest{
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
Id: "user-1",
|
|
||||||
Password: "Password1",
|
Password: "Password1",
|
||||||
Username: "joe",
|
|
||||||
|
})
|
||||||
|
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)
|
fmt.Println(rsp, err)
|
||||||
@@ -304,13 +304,13 @@ func ReadAccountByEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Login
|
## SendPasswordResetEmail
|
||||||
|
|
||||||
Login using username or email. The response will return a new session for successful login,
|
Send an email with a verification code to reset password.
|
||||||
401 in the case of login failure and 500 for any other error
|
Call "ResetPassword" endpoint once user provides the code.
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
|
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -322,13 +322,132 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Login using username or email. The response will return a new session for successful login,
|
// Send an email with a verification code to reset password.
|
||||||
// 401 in the case of login failure and 500 for any other error
|
// Call "ResetPassword" endpoint once user provides the code.
|
||||||
func LogAuserIn() {
|
func SendPasswordResetEmail() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Login(&user.LoginRequest{
|
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
|
||||||
Email: "joe@example.com",
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## ReadSession
|
||||||
|
|
||||||
|
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
|
func ReadAsessionByTheSessionId() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
||||||
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a new user account. The email address and username for the account must be unique.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a new user account. The email address and username for the account must be unique.
|
||||||
|
func CreateAnAccount() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Create(&user.CreateRequest{
|
||||||
|
Email: "joe@example.com",
|
||||||
|
Id: "user-1",
|
||||||
Password: "Password1",
|
Password: "Password1",
|
||||||
|
Username: "joe",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -413,122 +532,3 @@ Please verify your email by clicking this link: $micro_verification_link`,
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## 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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete an account by id
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete an account by id
|
|
||||||
func DeleteUserAccount() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Delete(&user.DeleteRequest{
|
|
||||||
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Logout
|
|
||||||
|
|
||||||
Logout a user account
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Logout a user account
|
|
||||||
func LogAuserOut() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Logout(&user.LogoutRequest{
|
|
||||||
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Update
|
|
||||||
|
|
||||||
Update the account username or email
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Update the account username or email
|
|
||||||
func UpdateAnAccount() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Update(&user.UpdateRequest{
|
|
||||||
Email: "joe+2@example.com",
|
|
||||||
Id: "user-1",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/youtube/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Search
|
|
||||||
|
|
||||||
Search for videos on YouTube
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/youtube"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Search for videos on YouTube
|
|
||||||
func SearchForVideos() {
|
|
||||||
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := youtubeService.Search(&youtube.SearchRequest{
|
|
||||||
Query: "donuts",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Embed
|
## Embed
|
||||||
|
|
||||||
Embed a YouTube video
|
Embed a YouTube video
|
||||||
@@ -60,3 +32,31 @@ func EmbedAyoutubeVideo() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Search
|
||||||
|
|
||||||
|
Search for videos on YouTube
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/youtube/api#Search](https://m3o.com/youtube/api#Search)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/youtube"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Search for videos on YouTube
|
||||||
|
func SearchForVideos() {
|
||||||
|
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := youtubeService.Search(&youtube.SearchRequest{
|
||||||
|
Query: "donuts",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Place interface {
|
type Place interface {
|
||||||
Autocomplete(*AutocompleteRequest) (*AutocompleteResponse, error)
|
|
||||||
Nearby(*NearbyRequest) (*NearbyResponse, error)
|
Nearby(*NearbyRequest) (*NearbyResponse, error)
|
||||||
Search(*SearchRequest) (*SearchResponse, error)
|
Search(*SearchRequest) (*SearchResponse, error)
|
||||||
}
|
}
|
||||||
@@ -22,14 +21,6 @@ type PlaceService struct {
|
|||||||
client *client.Client
|
client *client.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autocomplete queries (coming soon)
|
|
||||||
func (t *PlaceService) Autocomplete(request *AutocompleteRequest) (*AutocompleteResponse, error) {
|
|
||||||
|
|
||||||
rsp := &AutocompleteResponse{}
|
|
||||||
return rsp, t.client.Call("place", "Autocomplete", request, rsp)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find places nearby using a location
|
// Find places nearby using a location
|
||||||
func (t *PlaceService) Nearby(request *NearbyRequest) (*NearbyResponse, error) {
|
func (t *PlaceService) Nearby(request *NearbyRequest) (*NearbyResponse, error) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user