Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-12-09 14:49:22 +00:00
parent 8245cf14ad
commit e6a4ba7a6a
21 changed files with 703 additions and 703 deletions

View File

@@ -4,43 +4,9 @@ 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.
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/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.
// 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 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
Delete an object from space
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
@@ -55,7 +21,7 @@ import(
"go.m3o.com/space"
)
// Delete an object
// Delete an object from space
func DeleteAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Delete(&space.DeleteRequest{
@@ -68,7 +34,7 @@ func DeleteAnObject() {
```
## List
List the objects in the space
List the objects in space
[https://m3o.com/space/api#List](https://m3o.com/space/api#List)
@@ -83,7 +49,7 @@ import(
"go.m3o.com/space"
)
// List the objects in the space
// List the objects in space
func ListObjectsWithPrefix() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.List(&space.ListRequest{
@@ -124,7 +90,7 @@ func HeadAnObject() {
```
## Read
Read an object in storage. Use for private objects.
Read an object in space. Use for private objects.
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
@@ -139,7 +105,7 @@ import(
"go.m3o.com/space"
)
// Read an object in storage. Use for private objects.
// Read an object in space. Use for private objects.
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
@@ -184,3 +150,37 @@ Visibility: "public",
}
```
## Update
Update an object. If an object with this name does not exist, creates a new one.
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/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.
// 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 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)
}
```