Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-03-02 10:16:25 +00:00
parent e56aeee2a7
commit fd8353bc9c
31 changed files with 1698 additions and 1605 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Call
## List
Call a function by name
List all the deployed functions
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
@@ -21,26 +21,22 @@ import(
"go.m3o.com/function"
)
// Call a function by name
func CallAfunction() {
// List all the deployed functions
func ListFunctions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Reserve
## Runtimes
Reserve function names and resources beyond free quota
Return a list of supported runtimes
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
```go
package example
@@ -52,11 +48,38 @@ import(
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
// Return a list of supported runtimes
func ListRuntimes() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
})
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)
@@ -91,12 +114,12 @@ func UpdateAfunction() {
}
```
## List
## Call
List all the deployed functions
Call a function by name
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
```go
package example
@@ -108,11 +131,15 @@ import(
"go.m3o.com/function"
)
// List all the deployed functions
func ListFunctions() {
// Call a function by name
func CallAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
@@ -201,12 +228,12 @@ func ListRegions() {
}
```
## Runtimes
## Reserve
Return a list of supported runtimes
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Runtimes](https://m3o.com/function/api#Runtimes)
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
@@ -218,38 +245,11 @@ import(
"go.m3o.com/function"
)
// Return a list of supported runtimes
func ListRuntimes() {
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Runtimes(&function.RuntimesRequest{
})
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",
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)