client

package
v0.0.19 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"
)
View Source
const (
	V1PlayersRoute string = "/v1/players"
)

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.

func TranslatePlayer added in v0.0.19

func TranslatePlayer(p rest.Player) (*assets.Player, error)

TranslatePlayer translates a network player into an assets player.

func TranslatePlayerChange added in v0.0.19

func TranslatePlayerChange(i assets.PlayerChange) (rest.PlayerRequest, error)

TranslatePlayerChange translates an asset player change struct to a network player 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) CreatePlayer added in v0.0.19

func (c Client) CreatePlayer(ctx context.Context, player assets.PlayerCreate) (*assets.Player, error)

CreatePlayer creates an player.

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) GetPlayer added in v0.0.19

func (c Client) GetPlayer(ctx context.Context, id assets.PlayerID) (*assets.Player, error)

GetPlayer returns an player for the given player 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) ListPlayers added in v0.0.19

func (c Client) ListPlayers(ctx context.Context, filter assets.PlayerFilter) ([]*assets.Player, error)

ListPlayers returns a list of players for the given player filter.

func (Client) RemoveItem

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

RemoveItem deletes an item.

func (Client) RemovePlayer added in v0.0.19

func (c Client) RemovePlayer(ctx context.Context, id assets.PlayerID) error

RemovePlayer deletes an player.

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.

func (Client) UpdatePlayer added in v0.0.19

func (c Client) UpdatePlayer(ctx context.Context, id assets.PlayerID, player assets.PlayerUpdate) (*assets.Player, error)

UpdatePlayer updates the player with the given player 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