Documentation
¶
Index ¶
- Constants
- func TranslateItem(i rest.Item) (*asset.Item, error)
- func TranslateItemChange(i asset.ItemChange) (rest.ItemRequest, error)
- func TranslateLink(p rest.Link) (*asset.Link, error)
- func TranslateLinkChange(i asset.LinkChange) (rest.LinkRequest, error)
- func TranslatePlayer(p rest.Player) (*asset.Player, error)
- func TranslatePlayerChange(i asset.PlayerChange) (rest.PlayerRequest, error)
- func TranslateRoom(p rest.Room) (*asset.Room, error)
- func TranslateRoomChange(i asset.RoomChange) (rest.RoomRequest, error)
- type Client
- func (c Client) CreateItem(ctx context.Context, item asset.ItemCreate) (*asset.Item, error)
- func (c Client) CreateLink(ctx context.Context, link asset.LinkCreate) (*asset.Link, error)
- func (c Client) CreatePlayer(ctx context.Context, player asset.PlayerCreate) (*asset.Player, error)
- func (c Client) CreateRoom(ctx context.Context, room asset.RoomCreate) (*asset.Room, error)
- func (c Client) GetItem(ctx context.Context, id asset.ItemID) (*asset.Item, error)
- func (c Client) GetLink(ctx context.Context, id asset.LinkID) (*asset.Link, error)
- func (c Client) GetPlayer(ctx context.Context, id asset.PlayerID) (*asset.Player, error)
- func (c Client) GetRoom(ctx context.Context, id asset.RoomID) (*asset.Room, error)
- func (c Client) ListItems(ctx context.Context, filter asset.ItemFilter) ([]*asset.Item, error)
- func (c Client) ListLinks(ctx context.Context, filter asset.LinkFilter) ([]*asset.Link, error)
- func (c Client) ListPlayers(ctx context.Context, filter asset.PlayerFilter) ([]*asset.Player, error)
- func (c Client) ListRooms(ctx context.Context, filter asset.RoomFilter) ([]*asset.Room, error)
- func (c Client) RemoveItem(ctx context.Context, id asset.ItemID) error
- func (c Client) RemoveLink(ctx context.Context, id asset.LinkID) error
- func (c Client) RemovePlayer(ctx context.Context, id asset.PlayerID) error
- func (c Client) RemoveRoom(ctx context.Context, id asset.RoomID) error
- func (c Client) Send(ctx context.Context, req *http.Request) (*http.Response, error)
- func (c Client) UpdateItem(ctx context.Context, id asset.ItemID, item asset.ItemUpdate) (*asset.Item, error)
- func (c Client) UpdateLink(ctx context.Context, id asset.LinkID, link asset.LinkUpdate) (*asset.Link, error)
- func (c Client) UpdatePlayer(ctx context.Context, id asset.PlayerID, player asset.PlayerUpdate) (*asset.Player, error)
- func (c Client) UpdateRoom(ctx context.Context, id asset.RoomID, room asset.RoomUpdate) (*asset.Room, error)
- type ClientOption
- type ResponseError
Constants ¶
const (
V1ItemRoute string = "/v1/item"
)
const (
V1LinkRoute string = "/v1/link"
)
const (
V1PlayerRoute string = "/v1/player"
)
const (
V1RoomRoute string = "/v1/room"
)
Variables ¶
This section is empty.
Functions ¶
func TranslateItemChange ¶
func TranslateItemChange(i asset.ItemChange) (rest.ItemRequest, error)
func TranslateLinkChange ¶ added in v0.0.22
func TranslateLinkChange(i asset.LinkChange) (rest.LinkRequest, error)
func TranslatePlayerChange ¶
func TranslatePlayerChange(i asset.PlayerChange) (rest.PlayerRequest, error)
func TranslateRoomChange ¶ added in v0.0.21
func TranslateRoomChange(i asset.RoomChange) (rest.RoomRequest, error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client for the asset api.
func New ¶
func New(baseURL string, opts ...ClientOption) *Client
New returns a new client for the asset API.
func (Client) CreateItem ¶
CreateItem creates an item.
func (Client) CreateLink ¶ added in v0.0.22
CreateLink creates an link.
func (Client) CreatePlayer ¶
CreatePlayer creates an player.
func (Client) CreateRoom ¶ added in v0.0.21
CreateRoom creates an room.
func (Client) ListLinks ¶ added in v0.0.22
ListLinks returns a list of links for the given link filter.
func (Client) ListPlayers ¶
func (c Client) ListPlayers(ctx context.Context, filter asset.PlayerFilter) ([]*asset.Player, error)
ListPlayers returns a list of players for the given player filter.
func (Client) ListRooms ¶ added in v0.0.21
ListRooms returns a list of rooms for the given room filter.
func (Client) RemoveItem ¶
RemoveItem deletes an item.
func (Client) RemoveLink ¶ added in v0.0.22
RemoveLink deletes an link.
func (Client) RemovePlayer ¶
RemovePlayer deletes an player.
func (Client) RemoveRoom ¶ added in v0.0.21
RemoveRoom deletes an room.
func (Client) UpdateItem ¶
func (c Client) UpdateItem(ctx context.Context, id asset.ItemID, item asset.ItemUpdate) (*asset.Item, error)
UpdateItem updates the item with the given item update.
func (Client) UpdateLink ¶ added in v0.0.22
func (c Client) UpdateLink(ctx context.Context, id asset.LinkID, link asset.LinkUpdate) (*asset.Link, error)
UpdateLink updates the link with the given link update.
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption provides options for configuring the creation of an asset client.
func WithTLSConfig ¶ added in v0.2.8
func WithTLSConfig(cfg *tls.Config) ClientOption
WithTLSConfig sets the client tls config.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTime sets the client timeout.
type ResponseError ¶ added in v0.0.23
func (ResponseError) Error ¶ added in v0.0.23
func (e ResponseError) Error() string