Documentation ¶
Index ¶
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) GetImage(ctx context.Context, imageID string) (m Image, err error)
- func (c *Client) GetImages(ctx context.Context) (m Images, err error)
- func (c *Client) PostImage(ctx context.Context, data NewImage) (m Image, err error)
- func (c *Client) PutImage(ctx context.Context, imageID string, data Image) (m Image, err error)
- type ErrInvalidImageAPIResponse
- type Image
- type ImageDownload
- type ImageUpload
- type Images
- type License
- type NewImage
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 a image api client which can be used to make requests to the server
func NewAPIClient ¶
NewAPIClient creates a new instance of Client with a given image api url and the relevant tokens
func NewAPIClientWithMaxRetries ¶
NewAPIClientWithMaxRetries creates a new instance of Client with a given image api url and the relevant tokens, setting a number of max retires for the HTTP client
func (*Client) Checker ¶
Checker calls image api health endpoint and returns a check object to the caller.
type ErrInvalidImageAPIResponse ¶
type ErrInvalidImageAPIResponse struct {
// contains filtered or unexported fields
}
ErrInvalidImageAPIResponse is returned when the image api does not respond with a valid status
func NewImageAPIResponse ¶
func NewImageAPIResponse(resp *http.Response, uri string) (e *ErrInvalidImageAPIResponse)
NewImageAPIResponse creates an error response, optionally adding body to e when status is 404
func (ErrInvalidImageAPIResponse) Code ¶
func (e ErrInvalidImageAPIResponse) Code() int
Code returns the status code received from image api if an error is returned
func (ErrInvalidImageAPIResponse) Error ¶
func (e ErrInvalidImageAPIResponse) Error() string
Error should be called by the user to print out the stringified version of the error
type Image ¶
type Image struct { Id string `json:"id,omitempty"` CollectionId string `json:"collection_id,omitempty"` State string `json:"state,omitempty"` //enum: //- created //- uploaded //- publishing //- published //- deleted Filename string `json:"filename,omitempty"` License License `json:"license,omitempty"` Upload ImageUpload `json:"upload,omitempty"` Type string `json:"type,omitempty"` Downloads map[string]map[string]ImageDownload `json:"downloads,omitempty"` }
type ImageDownload ¶
type ImageUpload ¶
type ImageUpload struct {
Path string `json:"path,omitempty"`
}