client

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1ItemsRoute string = "/v1/items"
)

Variables

This section is empty.

Functions

func TranslateItem

func TranslateItem(i rest.Item) (*assets.Item, error)

TranslateItem translates a network item into an assets item.

func TranslateItemChange

func TranslateItemChange(i assets.ItemChange) (rest.ItemRequest, error)

TranslateItemChange translates an asset item change struct to a network item request.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a client for the assets api.

func New

func New(baseURL string, opts ...ClientOption) *Client

New returns a new client for the assets API.

func (Client) CreateItem

func (c Client) CreateItem(ctx context.Context, item assets.ItemCreate) (*assets.Item, error)

CreateItem creates an item.

func (Client) GetItem

func (c Client) GetItem(ctx context.Context, id assets.ItemID) (*assets.Item, error)

GetItem returns an item for the given item id.

func (Client) ListItems

func (c Client) ListItems(ctx context.Context, filter assets.ItemFilter) ([]*assets.Item, error)

ListItems returns a list of items for the given item filter.

func (Client) RemoveItem

func (c Client) RemoveItem(ctx context.Context, id assets.ItemID) error

RemoveItem deletes an item.

func (Client) UpdateItem

func (c Client) UpdateItem(ctx context.Context, id assets.ItemID, item assets.ItemUpdate) (*assets.Item, error)

UpdateItem updates the item with the given item update.

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption provides options for configuring the creation of an assets client.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

WithTime sets the client timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL