Documentation ¶
Overview ¶
Package apiclient implements a client for connecting to Kopia HTTP API server.
Index ¶
- type HTTPStatusError
- type KopiaAPIClient
- func (c *KopiaAPIClient) Delete(ctx context.Context, urlSuffix string, onNotFound error, ...) error
- func (c *KopiaAPIClient) Get(ctx context.Context, urlSuffix string, onNotFound error, ...) error
- func (c *KopiaAPIClient) Post(ctx context.Context, urlSuffix string, reqPayload, respPayload interface{}) error
- func (c *KopiaAPIClient) Put(ctx context.Context, urlSuffix string, reqPayload, respPayload interface{}) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPStatusError ¶ added in v0.8.0
HTTPStatusError encapsulates HTTP status error.
func (HTTPStatusError) Error ¶ added in v0.8.0
func (e HTTPStatusError) Error() string
type KopiaAPIClient ¶
KopiaAPIClient provides helper methods for communicating with Kopia API server.
func NewKopiaAPIClient ¶
func NewKopiaAPIClient(options Options) (*KopiaAPIClient, error)
NewKopiaAPIClient creates a client for connecting to Kopia HTTP API.
func (*KopiaAPIClient) Delete ¶
func (c *KopiaAPIClient) Delete(ctx context.Context, urlSuffix string, onNotFound error, reqPayload, respPayload interface{}) error
Delete is a helper that performs HTTP DELETE on a URL with the specified body from reqPayload and decodes the response onto respPayload which must be a pointer to byte slice or JSON-serializable structure.
func (*KopiaAPIClient) Get ¶
func (c *KopiaAPIClient) Get(ctx context.Context, urlSuffix string, onNotFound error, respPayload interface{}) error
Get is a helper that performs HTTP GET on a URL with the specified suffix and decodes the response onto respPayload which must be a pointer to byte slice or JSON-serializable structure.
func (*KopiaAPIClient) Post ¶
func (c *KopiaAPIClient) Post(ctx context.Context, urlSuffix string, reqPayload, respPayload interface{}) error
Post is a helper that performs HTTP POST on a URL with the specified body from reqPayload and decodes the response onto respPayload which must be a pointer to byte slice or JSON-serializable structure.
func (*KopiaAPIClient) Put ¶
func (c *KopiaAPIClient) Put(ctx context.Context, urlSuffix string, reqPayload, respPayload interface{}) error
Put is a helper that performs HTTP PUT on a URL with the specified body from reqPayload and decodes the response onto respPayload which must be a pointer to byte slice or JSON-serializable structure.