mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-18 04:43:12 +02:00
Controller info endpoint and API integration examples (#75)
* Controller API: introduce controller's information endpoint * Prevent generation of empty events after channel closure * Allow events to be buffered in the events channel * Controller API: introduce controller's information endpoint[1] * IntegrationGuide.md: a couple of Python and Golang examples * Rephrase a sentence Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com> --------- Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
This commit is contained in:
co-authored by
Fedor Korotkov
parent
84633d0e45
commit
77656517fd
@@ -0,0 +1,23 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ControllerService struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
func (service *ControllerService) Info(ctx context.Context) (v1.ControllerInfo, error) {
|
||||
var controllerInfo v1.ControllerInfo
|
||||
|
||||
err := service.client.request(ctx, http.MethodGet, "controller/info", nil, &controllerInfo,
|
||||
nil)
|
||||
if err != nil {
|
||||
return controllerInfo, err
|
||||
}
|
||||
|
||||
return controllerInfo, nil
|
||||
}
|
||||
Reference in New Issue
Block a user