Documentation
¶
Overview ¶
Package client provides a HTTP client for calls to the connector service.
The configuration needed for the call are defined by the struct Config
Index ¶
- type Client
- type Config
- type ConnectorClient
- func (client *ConnectorClient) Delete(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
- func (client *ConnectorClient) Get(ctx context.Context, target url.URL) ([]byte, error)
- func (client *ConnectorClient) Post(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
- func (client *ConnectorClient) Put(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Post(ctx context.Context, url url.URL, activity schema.Activity) ([]byte, error)
Delete(ctx context.Context, url url.URL, activity schema.Activity) ([]byte, error)
Put(ctx context.Context, url url.URL, activity schema.Activity) ([]byte, error)
Get(ctx context.Context, url url.URL) ([]byte, error)
}
Client provides interface to send requests to the connector service.
type Config ¶
type Config struct {
Credentials auth.CredentialProvider
AuthURL url.URL
AuthClient *http.Client
ReplyClient *http.Client
}
Config represents the credentials for a user program and the URL for validating the credentials.
func NewClientConfig ¶
func NewClientConfig(credentials auth.CredentialProvider, tokenURL string) (*Config, error)
NewClientConfig creates configuration for ConnectorClient.
type ConnectorClient ¶
ConnectorClient implements Client to send HTTP requests to the connector service.
func (*ConnectorClient) Delete ¶
func (client *ConnectorClient) Delete(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
Delete an activity.
Creates a HTTP DELETE request with the provided activity ID and a Bearer token in the header. Returns any error as received from the call to connector service.
func (*ConnectorClient) Get ¶ added in v0.0.5
Get an response.
Creates a HTTP GET request with a Bearer token in the header. Returns any error as received from the call to connector service.
func (*ConnectorClient) Post ¶
func (client *ConnectorClient) Post(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
Post an activity to given URL.
Creates a HTTP POST request with the provided activity as the body and a Bearer token in the header. Returns any error as received from the call to connector service.
func (*ConnectorClient) Put ¶
func (client *ConnectorClient) Put(ctx context.Context, target url.URL, activity schema.Activity) ([]byte, error)
Put an activity.
Creates a HTTP PUT request with the provided activity payload and a Bearer token in the header. Returns any error as received from the call to connector service.