inventory and prop support

This commit is contained in:
Natsumi
2025-06-17 08:16:34 +12:00
parent adea1c083f
commit eaca05a485
10 changed files with 263 additions and 6 deletions

74
src/api/inventory.js Normal file
View File

@@ -0,0 +1,74 @@
const inventoryReq = {
/**
* @param {{ inventoryId: string }} params
* @returns {Promise<{json: any, params}>}
*/
getInventoryItem(params) {
return window.API.call(`inventory/${params.inventoryId}`, {
method: 'GET',
params
}).then((json) => {
const args = {
json,
params
};
return args;
});
},
/**
* @param {{ n: number, offset: number, order: string, types: string }} params
* @returns {Promise<{json: any, params}>}
*/
getInventoryItems(params) {
return window.API.call('inventory', {
method: 'GET',
params
}).then((json) => {
const args = {
json,
params
};
return args;
});
},
/**
* @param {{ inventoryId: string }} params
* @returns {Promise<{json: any, params}>}
*/
consumeInventoryBundle(params) {
return window.API.call(`inventory/${params.inventoryId}/consume`, {
method: 'PUT',
params
}).then((json) => {
const args = {
json,
params
};
return args;
});
},
/**
* @param {{ inventoryTemplateId: string }} params
* @returns {Promise<{json: any, params}>}
*/
getInventoryTemplate(params) {
return window.API.call(
`inventory/template/${params.inventoryTemplateId}`,
{
method: 'GET',
params
}
).then((json) => {
const args = {
json,
params
};
return args;
});
}
};
export default inventoryReq;