Documentation ¶
Index ¶
- type Client
- type EventClient
- func (c *EventClient) PollEvent(ctx context.Context, req event.PollEventRequest) (event.PollEventResponse, error)
- func (c *EventClient) PollEventUntilNotEmpty(ctx context.Context, req event.PollEventRequest) (event.PollEventResponse, error)
- func (c *EventClient) Subscribe(ctx context.Context, req event.SubscribeRequest) (event.SubscribeResponse, error)
- func (c *EventClient) Unsubscribe(ctx context.Context, req event.UnsubscribeRequest) error
- type ID
- type PollEventDataDeserialized
- type PollEventDataDeserializer
- type PollServiceResponseDeserialized
- type PollServiceResponseDeserializer
- type Request
- type Response
- type Route
- type ServiceClient
- func (c *ServiceClient) DeployService(ctx context.Context, req service.DeployServiceRequest) (service.DeployServiceResponse, error)
- func (c *ServiceClient) DeployServiceSync(ctx context.Context, req service.DeployServiceRequest) (service.Event, error)
- func (c *ServiceClient) ExecuteService(ctx context.Context, req service.ExecuteServiceRequest) (service.ExecuteServiceResponse, error)
- func (c *ServiceClient) ExecuteServiceSync(ctx context.Context, req service.ExecuteServiceRequest) (service.Event, error)
- func (c *ServiceClient) GetCode(ctx context.Context, req service.GetCodeRequest) (service.GetCodeResponse, error)
- func (c *ServiceClient) GetPublicKey(ctx context.Context, req service.GetPublicKeyRequest) (service.GetPublicKeyResponse, error)
- func (c *ServiceClient) PollService(ctx context.Context, req service.PollServiceRequest) (service.PollServiceResponse, error)
- func (c ServiceClient) PollServiceUntilNotEmpty(ctx context.Context, req service.PollServiceRequest) (service.PollServiceResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an implementation of a client that sends requests to a bound server. The server is just the API implementation this is not supposed to be a client to make requests with real IO, but just to test a particular implementation
func NewClient ¶
func NewClient(router *rpc.HttpRouter) *Client
NewClient creates a new client for calling the API
func (*Client) Request ¶
Request performs a request and returns the response generated by the server, or the error if any
func (*Client) RequestAPI ¶
func (c *Client) RequestAPI(de rpc.Deserializer, req interface{}, session string, route Route) error
RequestAPI performs a request to the API
type EventClient ¶
type EventClient struct {
// contains filtered or unexported fields
}
EventClient is the client implementation for the Event API
func NewEventClient ¶
func NewEventClient(router *rpc.HttpRouter) *EventClient
NewEventClient creates a new instance of an event client with an underlying client and session ready to be used to execute a router API
func (*EventClient) PollEvent ¶
func (c *EventClient) PollEvent( ctx context.Context, req event.PollEventRequest, ) (event.PollEventResponse, error)
PollEvent polls for subscription events
func (*EventClient) PollEventUntilNotEmpty ¶
func (c *EventClient) PollEventUntilNotEmpty( ctx context.Context, req event.PollEventRequest, ) (event.PollEventResponse, error)
PollEventUntilNotEmpty polls for events until at least one event is received or it times out
func (*EventClient) Subscribe ¶
func (c *EventClient) Subscribe( ctx context.Context, req event.SubscribeRequest, ) (event.SubscribeResponse, error)
Subscribe creates a subscription to an event topic
func (*EventClient) Unsubscribe ¶
func (c *EventClient) Unsubscribe( ctx context.Context, req event.UnsubscribeRequest, ) error
Unsubscribe destroys an existing subscription to an event topic
type PollEventDataDeserializer ¶
func (*PollEventDataDeserializer) Deserialize ¶
func (d *PollEventDataDeserializer) Deserialize(r io.Reader) error
type PollServiceResponseDeserialized ¶
type PollServiceResponseDeserialized struct { Offset uint64 `json:"offset"` Events []json.RawMessage `json:"events"` }
type PollServiceResponseDeserializer ¶
type PollServiceResponseDeserializer struct { Requests map[uint64]service.Request // contains filtered or unexported fields }
func (*PollServiceResponseDeserializer) Deserialize ¶
func (d *PollServiceResponseDeserializer) Deserialize(r io.Reader) error
type Request ¶
type Request struct { // Route that uniquely identifies the handler that should // handle the request Route Route // Body of the request Body []byte // Headers defines metadata to specify different options on how // the request may be handled Headers map[string]string }
Request identifies a request sent by a client and handled by a server
type Response ¶
type Response struct { // Body is the content of the response Body []byte // Code may be used to identify whether the request // was handled successfully or not Code int }
Response to a request
type Route ¶
type Route struct { // Method that will be executed on the resource Method string // Path that indicates the resource or action to // be executed Path string }
Route defines how a request will be multiplexed. A request endpoint should be uniquely identified by a route
type ServiceClient ¶
type ServiceClient struct {
// contains filtered or unexported fields
}
ServiceClient is the client implementation for the Service API
func NewServiceClient ¶
func NewServiceClient(router *rpc.HttpRouter) *ServiceClient
NewServiceClient creates a new instance of a service client with an underlying client and session ready to be used to execute a router API
func (*ServiceClient) DeployService ¶
func (c *ServiceClient) DeployService( ctx context.Context, req service.DeployServiceRequest, ) (service.DeployServiceResponse, error)
DeployService deploys the specific service
func (*ServiceClient) DeployServiceSync ¶
func (c *ServiceClient) DeployServiceSync( ctx context.Context, req service.DeployServiceRequest, ) (service.Event, error)
DeployServiceSync makes a DeployService request and waits for the event response
func (*ServiceClient) ExecuteService ¶
func (c *ServiceClient) ExecuteService( ctx context.Context, req service.ExecuteServiceRequest, ) (service.ExecuteServiceResponse, error)
ExecuteService deploys the specific service
func (*ServiceClient) ExecuteServiceSync ¶
func (c *ServiceClient) ExecuteServiceSync( ctx context.Context, req service.ExecuteServiceRequest, ) (service.Event, error)
ExecuteServiceSync makes a ExecuteService request and waits for the event response
func (*ServiceClient) GetCode ¶
func (c *ServiceClient) GetCode( ctx context.Context, req service.GetCodeRequest, ) (service.GetCodeResponse, error)
func (*ServiceClient) GetPublicKey ¶
func (c *ServiceClient) GetPublicKey( ctx context.Context, req service.GetPublicKeyRequest, ) (service.GetPublicKeyResponse, error)
func (*ServiceClient) PollService ¶
func (c *ServiceClient) PollService( ctx context.Context, req service.PollServiceRequest, ) (service.PollServiceResponse, error)
func (ServiceClient) PollServiceUntilNotEmpty ¶
func (c ServiceClient) PollServiceUntilNotEmpty( ctx context.Context, req service.PollServiceRequest, ) (service.PollServiceResponse, error)