Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-19 22:28:41 +00:00
parent ff159f4ded
commit a3e13de758
24 changed files with 1336 additions and 1336 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Call
## Update
Call a function by name
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
@@ -21,14 +21,66 @@ import(
"go.m3o.com/function"
)
// Call a function by name
func CallAfunction() {
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## List
List all the deployed functions
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// List all the deployed functions
func ListFunctions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
@@ -97,12 +149,12 @@ Subfolder: "examples/go-function",
}
```
## 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
@@ -114,38 +166,14 @@ 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{
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
@@ -235,31 +263,3 @@ func ReserveAfunction() {
}
```
## Update
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```