mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 09:13:50 +02:00
inventory and prop support
This commit is contained in:
74
src/api/inventory.js
Normal file
74
src/api/inventory.js
Normal 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;
|
||||
Reference in New Issue
Block a user