mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 22:45:09 +00:00
Commit from GitHub Actions (Publish APIs & Clients)
This commit is contained in:
@@ -16,7 +16,7 @@ type FunctionService struct {
|
|||||||
client *client.Client
|
client *client.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a function
|
// Call a function by name
|
||||||
func (t *FunctionService) Call(request *CallRequest) (*CallResponse, error) {
|
func (t *FunctionService) Call(request *CallRequest) (*CallResponse, error) {
|
||||||
rsp := &CallResponse{}
|
rsp := &CallResponse{}
|
||||||
return rsp, t.client.Call("function", "Call", request, rsp)
|
return rsp, t.client.Call("function", "Call", request, rsp)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export class FunctionService {
|
|||||||
constructor(token: string) {
|
constructor(token: string) {
|
||||||
this.client = new m3o.Client({ token: token });
|
this.client = new m3o.Client({ token: token });
|
||||||
}
|
}
|
||||||
// Call a function
|
// Call a function by name
|
||||||
call(request: CallRequest): Promise<CallResponse> {
|
call(request: CallRequest): Promise<CallResponse> {
|
||||||
return this.client.call(
|
return this.client.call(
|
||||||
"function",
|
"function",
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ func CreateArecord() {
|
|||||||
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"isActive": true,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
"age": 42,
|
"age": 42,
|
||||||
|
"isActive": true,
|
||||||
},
|
},
|
||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ func UpdateArecord() {
|
|||||||
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := dbService.Update(&db.UpdateRequest{
|
rsp, err := dbService.Update(&db.UpdateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"age": 43,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
|
"age": 43,
|
||||||
},
|
},
|
||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Call a function
|
// Call a function by name
|
||||||
func CallAfunction() {
|
func CallAfunction() {
|
||||||
functionService := function.NewFunctionService(os.Getenv("MICRO_API_TOKEN"))
|
functionService := function.NewFunctionService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := functionService.Call(&function.CallRequest{
|
rsp, err := functionService.Call(&function.CallRequest{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as fx from "m3o/function";
|
import * as fx from "m3o/function";
|
||||||
|
|
||||||
// Call a function
|
// Call a function by name
|
||||||
async function CallAfunction() {
|
async function CallAfunction() {
|
||||||
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
|
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
|
||||||
let rsp = await functionService.call({
|
let rsp = await functionService.call({
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ func PublishAmessage() {
|
|||||||
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
rsp, err := streamService.Publish(&stream.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
|
"id": "1",
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user