1.3 KiB
1.3 KiB
Inventory
Source: inventory.go, player_inventory.go. Types: InventoryItem, InventoryList, InventoryAdjustment.
Batch adjust
func (s *InventoryService) Adjust(ctx context.Context, parameters AdjustInventoryParameters) ([]InventoryItem, error)
type AdjustInventoryParameters struct {
IdempotencyKey string
Items []InventoryAdjustment
}
// InventoryAdjustment: {PlayerID, Slug, Amount int64, Reason}
// Negative Amount removes items. Returns updated items in item order.
List
func (s *InventoryService) List(ctx context.Context, playerID string, parameters ListInventoryParameters) (*InventoryList, error)
type ListInventoryParameters struct {
Limit int
Cursor *string
}
// InventoryList: {Items []InventoryItem, NextCursor string}
// InventoryItem: {ID, Slug, Amount int64, UpdatedAt}
PlayerInventoryHandle
client.Player(id).Inventory():
func (h *PlayerInventoryHandle) Adjust(ctx context.Context, parameters AdjustPlayerInventoryParameters) (*InventoryItem, error)
type AdjustPlayerInventoryParameters struct {
IdempotencyKey string
Slug string
Amount int64
Reason string
}
func (h *PlayerInventoryHandle) List(ctx context.Context, parameters ListInventoryParameters) (*InventoryList, error)