mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
inventory and prop support
This commit is contained in:
@@ -21,6 +21,8 @@ import inviteMessagesRequest from './inviteMessages';
|
||||
import imageRequest from './image';
|
||||
import miscRequest from './misc';
|
||||
import groupRequest from './group';
|
||||
import inventoryRequest from './inventory';
|
||||
import propRequest from './prop';
|
||||
|
||||
window.request = {
|
||||
userRequest,
|
||||
@@ -37,7 +39,9 @@ window.request = {
|
||||
inviteMessagesRequest,
|
||||
imageRequest,
|
||||
miscRequest,
|
||||
groupRequest
|
||||
groupRequest,
|
||||
inventoryRequest,
|
||||
propRequest
|
||||
};
|
||||
|
||||
export {
|
||||
@@ -55,5 +59,7 @@ export {
|
||||
inviteMessagesRequest,
|
||||
imageRequest,
|
||||
miscRequest,
|
||||
groupRequest
|
||||
groupRequest,
|
||||
inventoryRequest,
|
||||
propRequest
|
||||
};
|
||||
|
||||
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;
|
||||
20
src/api/prop.js
Normal file
20
src/api/prop.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const propReq = {
|
||||
/**
|
||||
* @param {{ propId: string }} params
|
||||
* @returns {Promise<{json: any, params}>}
|
||||
*/
|
||||
getProp(params) {
|
||||
return window.API.call(`props/${params.propId}`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
return args;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default propReq;
|
||||
Reference in New Issue
Block a user