mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 06:25:07 +00:00
Commit from GitHub Actions (Generate Clients & Examples)
This commit is contained in:
@@ -22,12 +22,27 @@ func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error
|
||||
return rsp, t.client.Call("event", "Publish", request, rsp)
|
||||
}
|
||||
|
||||
// Read stored events
|
||||
func (t *EventService) Read(request *ReadRequest) (*ReadResponse, error) {
|
||||
rsp := &ReadResponse{}
|
||||
return rsp, t.client.Call("event", "Read", 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 Ev struct {
|
||||
// event id
|
||||
Id string `json:"id"`
|
||||
// event message
|
||||
Message map[string]interface{} `json:"message"`
|
||||
// event timestamp
|
||||
Timestamp string `json:"timestamp"`
|
||||
}
|
||||
|
||||
type PublishRequest struct {
|
||||
// The json message to publish
|
||||
Message map[string]interface{} `json:"message"`
|
||||
@@ -38,16 +53,36 @@ type PublishRequest struct {
|
||||
type PublishResponse struct {
|
||||
}
|
||||
|
||||
type ReadRequest struct {
|
||||
// number of events to read; default 25
|
||||
Limit int32 `json:"limit"`
|
||||
// offset for the events; default 0
|
||||
Offset int32 `json:"offset"`
|
||||
// topic to read from
|
||||
Topic string `json:"topic"`
|
||||
}
|
||||
|
||||
type ReadResponse struct {
|
||||
// the events
|
||||
Events []Ev `json:"events"`
|
||||
}
|
||||
|
||||
type SubscribeRequest struct {
|
||||
// Optional group for the subscription
|
||||
Group string `json:"group"`
|
||||
// Optional offset to read from e.g "2006-01-02T15:04:05.999Z07:00"
|
||||
Offset string `json:"offset"`
|
||||
// The topic to subscribe to
|
||||
Topic string `json:"topic"`
|
||||
}
|
||||
|
||||
type SubscribeResponse struct {
|
||||
// Unique message id
|
||||
Id string `json:"id"`
|
||||
// The next json message on the topic
|
||||
Message map[string]interface{} `json:"message"`
|
||||
// Timestamp of publishing
|
||||
Timestamp string `json:"timestamp"`
|
||||
// The topic subscribed to
|
||||
Topic string `json:"topic"`
|
||||
}
|
||||
|
||||
@@ -77,5 +77,5 @@
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "1.0.611"
|
||||
"version": "1.0.612"
|
||||
}
|
||||
Reference in New Issue
Block a user