Commit from GitHub Actions (Generate Clients & Examples)

This commit is contained in:
domwong
2021-11-04 12:17:43 +00:00
parent d0456884c8
commit f1c9693633
9 changed files with 53 additions and 6 deletions

View File

@@ -23,6 +23,12 @@ func (t *ImageService) Convert(request *ConvertRequest) (*ConvertResponse, error
return rsp, t.client.Call("image", "Convert", request, rsp)
}
// Delete an image previously uploaded.
func (t *ImageService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("image", "Delete", request, rsp)
}
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
// If one of width or height is 0, the image aspect ratio is preserved.
// Optional cropping.
@@ -66,6 +72,14 @@ type CropOptions struct {
Width int32 `json:"width"`
}
type DeleteRequest struct {
// url of the image to delete e.g. https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.jpeg
Url string `json:"url"`
}
type DeleteResponse struct {
}
type Point struct {
X int32 `json:"x"`
Y int32 `json:"y"`

View File

@@ -78,5 +78,5 @@
"prepare": "npm run build"
},
"types": "index.d.ts",
"version": "1.0.639"
"version": "1.0.642"
}

View File

@@ -12,10 +12,10 @@ func CreateArecord() {
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"isActive": true,
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "users",
})

View File

@@ -0,0 +1,6 @@
curl "http://localhost:8080/image/Delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"url": "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png"
}'

View File

@@ -0,0 +1,17 @@
package example
import (
"fmt"
"os"
"github.com/micro/services/clients/go/image"
)
// Delete an image previously uploaded.
func DeleteAnUploadedImage() {
imageService := image.NewImageService(os.Getenv("MICRO_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

@@ -0,0 +1,12 @@
const { ImageService } = require("m3o/image");
// Delete an image previously uploaded.
async function deleteAnUploadedImage() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.delete({
url: "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png",
});
console.log(rsp);
}
deleteAnUploadedImage();

View File

@@ -3,6 +3,5 @@ curl "http://localhost:8080/image/Upload" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"base64": "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
"name": "cat.jpeg",
"outputURL": true
"name": "cat.jpeg"
}'

View File

@@ -8,7 +8,6 @@ async function uploadAbase64imageToMicrosCdn() {
base64:
"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
name: "cat.jpeg",
outputURL: true,
});
console.log(rsp);
}

View File

@@ -12,9 +12,9 @@ func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "events",
})