Commit from GitHub Actions (Generate Clients & Examples)

This commit is contained in:
asim
2021-11-02 13:30:51 +00:00
parent 2dbc66ebd7
commit 93b1c73b18
15 changed files with 151 additions and 5 deletions

53
clients/go/event/event.go Executable file
View File

@@ -0,0 +1,53 @@
package event
import (
"github.com/m3o/m3o-go/client"
)
func NewEventService(token string) *EventService {
return &EventService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type EventService struct {
client *client.Client
}
// Publish a message to the event. Specify a topic to group messages for a specific topic.
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {
rsp := &PublishResponse{}
return rsp, t.client.Call("event", "Publish", request, rsp)
}
// Subscribe to messages for a given topic.
func (t *EventService) Subscribe(request *SubscribeRequest) (*SubscribeResponse, error) {
rsp := &SubscribeResponse{}
return rsp, t.client.Call("event", "Subscribe", request, rsp)
}
type PublishRequest struct {
// The json message to publish
Message map[string]interface{} `json:"message"`
// The topic to publish to
Topic string `json:"topic"`
}
type PublishResponse struct {
}
type SubscribeRequest struct {
// Optional group for the subscription
Group string `json:"group"`
// The topic to subscribe to
Topic string `json:"topic"`
}
type SubscribeResponse struct {
// The next json message on the topic
Message map[string]interface{} `json:"message"`
// The topic subscribed to
Topic string `json:"topic"`
}

View File

@@ -10,6 +10,7 @@ import (
"github.com/micro/services/clients/go/email"
"github.com/micro/services/clients/go/emoji"
"github.com/micro/services/clients/go/evchargers"
"github.com/micro/services/clients/go/event"
"github.com/micro/services/clients/go/file"
"github.com/micro/services/clients/go/forex"
"github.com/micro/services/clients/go/function"
@@ -58,6 +59,7 @@ func NewClient(token string) *Client {
EmailService: email.NewEmailService(token),
EmojiService: emoji.NewEmojiService(token),
EvchargersService: evchargers.NewEvchargersService(token),
EventService: event.NewEventService(token),
FileService: file.NewFileService(token),
ForexService: forex.NewForexService(token),
FunctionService: function.NewFunctionService(token),
@@ -106,6 +108,7 @@ type Client struct {
EmailService *email.EmailService
EmojiService *emoji.EmojiService
EvchargersService *evchargers.EvchargersService
EventService *event.EventService
FileService *file.FileService
ForexService *forex.ForexService
FunctionService *function.FunctionService

View File

@@ -28,7 +28,7 @@ func (t *NotesService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
return rsp, t.client.Call("notes", "Delete", request, rsp)
}
// Specify the note to events
// Subscribe to notes events
func (t *NotesService) Events(request *EventsRequest) (*EventsResponse, error) {
rsp := &EventsResponse{}
return rsp, t.client.Call("notes", "Events", request, rsp)

View File

@@ -21,6 +21,7 @@ db
email
emoji
evchargers
event
file
forex
function

View File

@@ -7,6 +7,7 @@ import * as db from "./db";
import * as email from "./email";
import * as emoji from "./emoji";
import * as evchargers from "./evchargers";
import * as event from "./event";
import * as file from "./file";
import * as forex from "./forex";
import * as fx from "./function";
@@ -52,6 +53,7 @@ export class Client {
this.emailService = new email.EmailService(token);
this.emojiService = new emoji.EmojiService(token);
this.evchargersService = new evchargers.EvchargersService(token);
this.eventService = new event.EventService(token);
this.fileService = new file.FileService(token);
this.forexService = new forex.ForexService(token);
this.functionService = new fx.FunctionService(token);
@@ -96,6 +98,7 @@ export class Client {
emailService: email.EmailService;
emojiService: emoji.EmojiService;
evchargersService: evchargers.EvchargersService;
eventService: event.EventService;
fileService: file.FileService;
forexService: forex.ForexService;
functionService: fx.FunctionService;

View File

@@ -26,6 +26,7 @@
"email",
"emoji",
"evchargers",
"event",
"file",
"forex",
"function",
@@ -76,5 +77,5 @@
"prepare": "npm run build"
},
"types": "index.d.ts",
"version": "1.0.597"
"version": "1.0.599"
}