ZEPETO.Multiplay.Inventory
11 min
type description inventoryerror /#inventoryerror the error code specifies the reason for the failure of inventory related requests inventoryrecord /#inventoryrecord inventory product information inventory /#inventory inventory manages operations associated with the player's in world product inventory inventoryerror enum the error code specifies the reason for the failure of inventory related requests name value description unknown 1 error unknown error networkerror 0 error errors related to network issues, including disconnections or unstable connections inventoryrecord interface inventory product information properties name type description productid string product id quantity number quantity of the product createdat date date and time when the product was added to the inventory updatedat date date and time when the product information was last updated inventory interface inventory manages operations associated with the player's in world product inventory methods use use(productid string, quantity? number, reason? string) → promise\<boolean> uses an in world product from the player's inventory throws inventoryerror parameter type description productid string id of the product to use quantity (optional) number quantity of the product to use defaults to 1 reason (optional) string optionally describes the reason for usage returns promise\<boolean> — promise resolved upon completion, indicating success ( true ) or failure ( false ) add add(productid string, quantity? number, reason? string) → promise\<boolean> adds an in world product to the player's inventory throws inventoryerror parameter type description productid string id of the product to add quantity (optional) number quantity of the product to add defaults to 1 reason (optional) string optionally describes the reason for the addition returns promise\<boolean> — promise resolved upon completion, indicating success ( true ) or failure ( false ) madd madd(products { productid string; quantity number; reason? string }\[]) → promise\<boolean> adds multiple in world products to the player's inventory throws inventoryerror parameter type description products { productid string; quantity number; reason? string }\[] array of products to add returns promise\<boolean> — promise resolved upon completion, indicating success ( true ) or failure ( false ) has has(productid string) → promise\<boolean> checks the existence of an in world product in the player's inventory throws inventoryerror parameter type description productid string id of the product to check returns promise\<boolean> — promise resolved upon completion, indicating exist ( true ) or non exist ( false ) get get(productid string) → promise\<inventoryrecord | null> retrieves an in world product from the player's inventory throws inventoryerror parameter type description productid string id of the product to retrieve returns promise\<inventoryrecord | null> — promise resolved upon completion, with the retrieved inventoryrecord object remove remove(productid string) → promise\<boolean> removes an in world product from the player's inventory throws inventoryerror parameter type description productid string id of the product to remove returns promise\<boolean> — promise resolved upon completion, indicating success ( true ) or failure ( false ) list list() → promise\<inventoryrecord\[]> retrieves all in world products from the player's inventory throws inventoryerror returns promise\<inventoryrecord\[]> — promise resolved upon completion, with an array of the retrieved inventoryrecord objects
