Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-12-15 12:22:04 +00:00
parent 27a864147e
commit e1e192f018
24 changed files with 989 additions and 989 deletions

View File

@@ -4,6 +4,62 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https
Endpoints:
## Delete
Delete an app
[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Delete an app
func DeleteAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Delete(&app.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Reserve
Reserve apps beyond the free quota. Call Run after.
[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Reserve apps beyond the free quota. Call Run after.
func ReserveAppName() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Reserve(&app.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## List
List all the apps
@@ -174,59 +230,3 @@ func UpdateAnApp() {
}
```
## Delete
Delete an app
[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Delete an app
func DeleteAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Delete(&app.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Reserve
Reserve apps beyond the free quota. Call Run after.
[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Reserve apps beyond the free quota. Call Run after.
func ReserveAppName() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Reserve(&app.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt
Endpoints:
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
@@ -118,32 +147,3 @@ func DeleteAvalue() {
}
```
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Crypto/api](ht
Endpoints:
## News
Get news related to a currency
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get news related to a currency
func GetCryptocurrencyNews() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.News(&crypto.NewsRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Price
Get the last price for a given crypto ticker
@@ -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)
}
```

View File

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

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
Endpoints:
## DropTable
Drop a table in the DB
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Count
Count records in a table
@@ -85,6 +57,40 @@ func ListTables() {
})
fmt.Println(rsp, err)
}
```
## Create
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Update
@@ -176,12 +182,12 @@ func TruncateTable() {
}
```
## Create
## DropTable
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
Drop a table in the DB
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
@@ -193,17 +199,11 @@ import(
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func CreateArecord() {
// Drop a table in the DB
func DropTable() {
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",
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
fmt.Println(rsp, err)

View File

@@ -12,8 +12,8 @@ func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
"id": "1",
},
Table: "example",
})

View File

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

View File

@@ -26,9 +26,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",

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,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api](
Endpoints:
## 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)
}
```
## Deploy
Deploy a group of functions
@@ -151,31 +179,3 @@ func DeleteAfunction() {
}
```
## 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)
}
```

View File

@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Holidays/api](
Endpoints:
## Countries
Get the list of countries that are supported by this API
[https://m3o.com/holidays/api#Countries](https://m3o.com/holidays/api#Countries)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/holidays"
)
// Get the list of countries that are supported by this API
func ListCountries() {
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{
})
fmt.Println(rsp, err)
}
```
## List
List the holiday dates for a given country and year
@@ -32,30 +59,3 @@ func GetHolidays() {
}
```
## Countries
Get the list of countries that are supported by this API
[https://m3o.com/holidays/api#Countries](https://m3o.com/holidays/api#Countries)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/holidays"
)
// Get the list of countries that are supported by this API
func ListCountries() {
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{
})
fmt.Println(rsp, err)
}
```

View File

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

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
Endpoints:
## Delete
Delete an image previously uploaded.
[https://m3o.com/image/api#Delete](https://m3o.com/image/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Delete an image previously uploaded.
func DeleteAnUploadedImage() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Delete(&image.DeleteRequest{
Url: "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png",
})
fmt.Println(rsp, err)
}
```
## Resize
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
@@ -228,31 +256,3 @@ Url: "somewebsite.com/cat.png",
}
```
## Delete
Delete an image previously uploaded.
[https://m3o.com/image/api#Delete](https://m3o.com/image/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Delete an image previously uploaded.
func DeleteAnUploadedImage() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Delete(&image.DeleteRequest{
Url: "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png",
})
fmt.Println(rsp, err)
}
```

View File

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

View File

@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Nft/api](https
Endpoints:
## Create
Create your own NFT (coming soon)
[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Create your own NFT (coming soon)
func CreateAnNft() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Create(&nft.CreateRequest{
Description: "The epic monkey island character",
Name: "Guybrush Threepwood",
})
fmt.Println(rsp, err)
}
```
## Collections
Get a list of collections
@@ -89,3 +60,32 @@ func GetAlistOfAssets() {
}
```
## Create
Create your own NFT (coming soon)
[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Create your own NFT (coming soon)
func CreateAnNft() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Create(&nft.CreateRequest{
Description: "The epic monkey island character",
Name: "Guybrush Threepwood",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,90 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt
Endpoints:
## Create
Create a new note
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Create a new note
func CreateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Create(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```
## Read
Read 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
@@ -105,87 +189,3 @@ func SubscribeToEvents() {
}
}
```
## Create
Create a new note
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Create a new note
func CreateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Create(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```

View File

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

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Quran/api](htt
Endpoints:
## Summary
Get a summary for a given chapter (surah)
[https://m3o.com/quran/api#Summary](https://m3o.com/quran/api#Summary)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/quran"
)
// Get a summary for a given chapter (surah)
func GetChapterSummary() {
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
rsp, err := quranService.Summary(&quran.SummaryRequest{
Chapter: 1,
})
fmt.Println(rsp, err)
}
```
## Verses
Lookup the verses (ayahs) for a chapter including
@@ -92,31 +120,3 @@ func ListChapters() {
}
```
## Summary
Get a summary for a given chapter (surah)
[https://m3o.com/quran/api#Summary](https://m3o.com/quran/api#Summary)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/quran"
)
// Get a summary for a given chapter (surah)
func GetChapterSummary() {
quranService := quran.NewQuranService(os.Getenv("M3O_API_TOKEN"))
rsp, err := quranService.Summary(&quran.SummaryRequest{
Chapter: 1,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,64 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Space/api](htt
Endpoints:
## Update
Update an object. If an object with this name does not exist, creates a new one.
[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Update an object. If an object with this name does not exist, creates a new one.
func UpdateAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Update(&space.UpdateRequest{
Name: "images/file.jpg",
Object: "<file bytes>",
Visibility: "public",
})
fmt.Println(rsp, err)
}
```
## 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
@@ -232,3 +174,61 @@ Visibility: "public",
}
```
## Update
Update an object. If an object with this name does not exist, creates a new one.
[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Update an object. If an object with this name does not exist, creates a new one.
func UpdateAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Update(&space.UpdateRequest{
Name: "images/file.jpg",
Object: "<file bytes>",
Visibility: "public",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```

View File

@@ -4,6 +4,33 @@ 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
@@ -92,30 +119,3 @@ func ListMessages() {
}
```
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,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,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Twitter/api](h
Endpoints:
## User
Get a user's twitter profile
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/twitter"
)
// Get a user's twitter profile
func GetAusersTwitterProfile() {
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
rsp, err := twitterService.User(&twitter.UserRequest{
Username: "crufter",
})
fmt.Println(rsp, err)
}
```
## Timeline
Get the timeline for a given user
@@ -88,31 +116,3 @@ func GetTheCurrentGlobalTrendingTopics() {
}
```
## User
Get a user's twitter profile
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/twitter"
)
// Get a user's twitter profile
func GetAusersTwitterProfile() {
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
rsp, err := twitterService.User(&twitter.UserRequest{
Username: "crufter",
})
fmt.Println(rsp, err)
}
```

View File

@@ -51,13 +51,12 @@ Please verify your email by clicking this link: $micro_verification_link`,
}
```
## SendPasswordResetEmail
## ResetPassword
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
```go
package example
@@ -69,16 +68,129 @@ import(
"go.m3o.com/user"
)
// Send an email with a verification code to reset password.
// Call "ResetPassword" endpoint once user provides the code.
func SendPasswordResetEmail() {
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
func ResetPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
Code: "012345",
ConfirmPassword: "NewPassword1",
Email: "joe@example.com",
NewPassword: "NewPassword1",
})
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)
}
```
## UpdatePassword
Update the account password
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
})
fmt.Println(rsp, err)
}
```
## VerifyEmail
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Verify the email address of an account from a token sent in an email to the user.
func VerifyEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Email: "joe@example.com",
FromName: "Awesome Dot Com",
Subject: "Password reset",
TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
Token: "012345",
})
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)
@@ -114,6 +226,69 @@ Password: "Password1",
})
fmt.Println(rsp, err)
}
```
## List
List all users. Returns a paged list of results
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// List all users. Returns a paged list of results
func ListAllUsers() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.List(&user.ListRequest{
Limit: 100,
Offset: 0,
})
fmt.Println(rsp, err)
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
fmt.Println(rsp, err)
}
```
## Update
@@ -143,6 +318,72 @@ Id: "user-1",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## 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",
Username: "joe",
})
fmt.Println(rsp, err)
}
```
## Read
@@ -229,12 +470,13 @@ func ReadAccountByEmail() {
}
```
## List
## SendPasswordResetEmail
List all users. Returns a paged list of results
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
@@ -246,163 +488,16 @@ import(
"go.m3o.com/user"
)
// List all users. Returns a paged list of results
func ListAllUsers() {
// 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.List(&user.ListRequest{
Limit: 100,
Offset: 0,
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## 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{
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
Email: "joe@example.com",
Token: "012345",
})
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",
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)
@@ -437,98 +532,3 @@ func ReadAsessionByTheSessionId() {
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
fmt.Println(rsp, err)
}
```
## 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",
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",
})
fmt.Println(rsp, err)
}
```

View File

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