Documentation

InventoryApi

Import

Import

  • const { InventoryApi } = require("@unity-services/economy-2.0");

Constructors

Constructor

Methods

Add Inventory Item

  • Add an item to a player's inventory.

    summary

    Add Inventory Item

    throws

    {RequiredError}

    memberof

    InventoryApi

    Parameters

    • projectId: string

      ID of the project

    • playerId: string

      ID of the player

    • Optional addInventoryRequest: AddInventoryRequest
    • Optional options: any

    Returns Promise<AxiosResponse<InventoryResponse>>

Delete Inventory Item

  • deleteInventoryItem(projectId: string, playerId: string, playersInventoryItemId: string, inventoryDeleteRequest?: InventoryDeleteRequest, options?: any): Promise<AxiosResponse<void>>
  • Delete a player inventory item.

    summary

    Delete Inventory Item

    throws

    {RequiredError}

    memberof

    InventoryApi

    Parameters

    • projectId: string
    • playerId: string
    • playersInventoryItemId: string
    • Optional inventoryDeleteRequest: InventoryDeleteRequest
    • Optional options: any

    Returns Promise<AxiosResponse<void>>

Get Player Inventory

  • getPlayerInventory(projectId: string, playerId: string, after?: string, limit?: number, playersInventoryItemIds?: string[], inventoryItemIds?: string[], options?: any): Promise<AxiosResponse<PlayerInventoryResponse>>
  • Get a list of inventory for a player. Results ordered by Player Inventory Item ID ascending. Players inventory item ID and Inventory Item ID filters are optional, if not given all will be returned. If both are given an item must match both to be returned.

    summary

    List Player Inventory

    throws

    {RequiredError}

    memberof

    InventoryApi

    Parameters

    • projectId: string

      ID of the project

    • playerId: string

      ID of the player

    • Optional after: string
    • Optional limit: number
    • Optional playersInventoryItemIds: string[]
    • Optional inventoryItemIds: string[]
    • Optional options: any

    Returns Promise<AxiosResponse<PlayerInventoryResponse>>

Update Inventory Item

  • updateInventoryItem(projectId: string, playerId: string, playersInventoryItemId: string, inventoryRequestUpdate?: InventoryRequestUpdate, options?: any): Promise<AxiosResponse<InventoryResponse>>
  • Update a players inventory item.

    summary

    Player Inventory Item

    throws

    {RequiredError}

    memberof

    InventoryApi

    Parameters

    • projectId: string
    • playerId: string
    • playersInventoryItemId: string
    • Optional inventoryRequestUpdate: InventoryRequestUpdate
    • Optional options: any

    Returns Promise<AxiosResponse<InventoryResponse>>