client

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1ItemRoute string = "/v1/item"
)
View Source
const (
	V1LinkRoute string = "/v1/link"
)
View Source
const (
	V1PlayerRoute string = "/v1/player"
)
View Source
const (
	V1RoomRoute string = "/v1/room"
)

Variables

This section is empty.

Functions

func TranslateItem

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

func TranslateItemChange

func TranslateItemChange(i asset.ItemChange) (rest.ItemRequest, error)
func TranslateLink(p rest.Link) (*asset.Link, error)

func TranslateLinkChange added in v0.0.22

func TranslateLinkChange(i asset.LinkChange) (rest.LinkRequest, error)

func TranslatePlayer

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

func TranslatePlayerChange

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

func TranslateRoom added in v0.0.21

func TranslateRoom(p rest.Room) (*asset.Room, 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

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

CreateItem creates an item.

func (c Client) CreateLink(ctx context.Context, link asset.LinkCreate) (*asset.Link, error)

CreateLink creates an link.

func (Client) CreatePlayer

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

CreatePlayer creates an player.

func (Client) CreateRoom added in v0.0.21

func (c Client) CreateRoom(ctx context.Context, room asset.RoomCreate) (*asset.Room, error)

CreateRoom creates an room.

func (Client) GetItem

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

GetItem returns an item for the given item id.

func (c Client) GetLink(ctx context.Context, id asset.LinkID) (*asset.Link, error)

GetLink returns an link for the given link id.

func (Client) GetPlayer

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

GetPlayer returns an player for the given player id.

func (Client) GetRoom added in v0.0.21

func (c Client) GetRoom(ctx context.Context, id asset.RoomID) (*asset.Room, error)

GetRoom returns an room for the given room id.

func (Client) ListItems

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

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

func (c Client) ListLinks(ctx context.Context, filter asset.LinkFilter) ([]*asset.Link, error)

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

func (c Client) ListRooms(ctx context.Context, filter asset.RoomFilter) ([]*asset.Room, error)

ListRooms returns a list of rooms for the given room filter.

func (Client) RemoveItem

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

RemoveItem deletes an item.

func (c Client) RemoveLink(ctx context.Context, id asset.LinkID) error

RemoveLink deletes an link.

func (Client) RemovePlayer

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

RemovePlayer deletes an player.

func (Client) RemoveRoom added in v0.0.21

func (c Client) RemoveRoom(ctx context.Context, id asset.RoomID) error

RemoveRoom deletes an room.

func (Client) Send added in v0.0.23

func (c Client) Send(ctx context.Context, req *http.Request) (*http.Response, error)

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 (c Client) UpdateLink(ctx context.Context, id asset.LinkID, link asset.LinkUpdate) (*asset.Link, error)

UpdateLink updates the link with the given link update.

func (Client) UpdatePlayer

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

UpdatePlayer updates the player with the given player update.

func (Client) UpdateRoom added in v0.0.21

func (c Client) UpdateRoom(ctx context.Context, id asset.RoomID, room asset.RoomUpdate) (*asset.Room, error)

UpdateRoom updates the room with the given room 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

type ResponseError struct {
	Status int    `json:"status"`
	Detail string `json:"detail"`
}

func (ResponseError) Error added in v0.0.23

func (e ResponseError) Error() string

Jump to

Keyboard shortcuts

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