mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 06:25:07 +00:00
Generate clients (#206)
This commit is contained in:
10
examples/file/save/curl/saveFile.sh
Executable file
10
examples/file/save/curl/saveFile.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
curl "https://api.m3o.com/v1/file/Save" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"file": {
|
||||
"content": "file content example",
|
||||
"path": "/document/text-files/file.txt",
|
||||
"project": "examples"
|
||||
}
|
||||
}'
|
||||
20
examples/file/save/go/saveFile.go
Executable file
20
examples/file/save/go/saveFile.go
Executable file
@@ -0,0 +1,20 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/file"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Save a file
|
||||
func SaveFile() {
|
||||
fileService := file.NewFileService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := fileService.Save(&file.SaveRequest{
|
||||
File: &file.Record{
|
||||
Content: "file content example",
|
||||
Path: "/document/text-files/file.txt",
|
||||
Project: "examples",
|
||||
},
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
16
examples/file/save/node/saveFile.js
Executable file
16
examples/file/save/node/saveFile.js
Executable file
@@ -0,0 +1,16 @@
|
||||
import * as file from "m3o/file";
|
||||
|
||||
// Save a file
|
||||
async function SaveFile() {
|
||||
let fileService = new file.FileService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await fileService.save({
|
||||
file: {
|
||||
content: "file content example",
|
||||
path: "/document/text-files/file.txt",
|
||||
project: "examples",
|
||||
},
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await SaveFile();
|
||||
Reference in New Issue
Block a user