@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
227 lines • 9.79 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAttributeGroupsResource = createAttributeGroupsResource;
exports.createAttributeGroupsDataResource = createAttributeGroupsDataResource;
const schemas_1 = require("../schemas");
/**
* Creates the attributeGroups resource methods
* OpenAPI Path: /attribute-groups → attributeGroups.*
* @description Methods for managing attribute groups with CRUD operations
*/
function createAttributeGroupsResource(executeRequest) {
return {
/**
* List all attribute groups
* @description Retrieve a list of attribute groups with filtering options
* @fullPath api.items.attributeGroups.list
* @service items
* @domain inventory-management
* @discoverable true
* @dataMethod attributeGroupsData.list
*/
list: async (params) => {
return executeRequest({
method: 'GET',
path: '/attribute-groups',
paramsSchema: schemas_1.AttributeGroupListParamsSchema,
responseSchema: schemas_1.AttributeGroupListResponseSchema,
}, params);
},
/**
* Create new attribute group
* @description Create a new attribute group
* @fullPath api.items.attributeGroups.create
* @service items
* @domain inventory-management
* @discoverable true
*/
create: async (data) => {
return executeRequest({
method: 'POST',
path: '/attribute-groups',
paramsSchema: schemas_1.CreateAttributeGroupRequestSchema,
responseSchema: schemas_1.AttributeGroupResponseSchema,
}, data);
},
/**
* Get attribute group by ID
* @description Retrieve specific attribute group details
* @fullPath api.items.attributeGroups.get
* @service items
* @domain inventory-management
* @discoverable true
*/
get: async (attributeGroupUid) => {
return executeRequest({
method: 'GET',
path: `/attribute-groups/${attributeGroupUid}`,
responseSchema: schemas_1.AttributeGroupResponseSchema,
});
},
/**
* Update attribute group
* @description Update existing attribute group
* @fullPath api.items.attributeGroups.update
* @service items
* @domain inventory-management
* @discoverable true
*/
update: async (attributeGroupUid, data) => {
return executeRequest({
method: 'PUT',
path: `/attribute-groups/${attributeGroupUid}`,
paramsSchema: schemas_1.UpdateAttributeGroupRequestSchema,
responseSchema: schemas_1.AttributeGroupResponseSchema,
}, data);
},
/**
* Delete attribute group
* @description Delete existing attribute group
* @fullPath api.items.attributeGroups.delete
* @service items
* @domain inventory-management
* @discoverable true
*/
delete: async (attributeGroupUid) => {
return executeRequest({
method: 'DELETE',
path: `/attribute-groups/${attributeGroupUid}`,
responseSchema: schemas_1.AttributeGroupResponseSchema,
});
},
/**
* OpenAPI Path: /attribute-groups/{attributeGroupUid}/attributes → attributeGroups.attributes.*
* @description Nested path for managing attributes within attribute groups
*/
attributes: {
/**
* List attributes in attribute group
* @description List all attributes associated with an attribute group
* @fullPath api.items.attributeGroups.attributes.list
* @service items
* @domain inventory-management
* @discoverable true
*/
list: async (attributeGroupUid, params) => {
return executeRequest({
method: 'GET',
path: `/attribute-groups/${attributeGroupUid}/attributes`,
paramsSchema: schemas_1.AttributeGroupAttributesListParamsSchema,
responseSchema: schemas_1.AttributeGroupAttributeListResponseSchema,
}, params);
},
/**
* Add attribute to attribute group
* @description Create association between attribute and attribute group
* @fullPath api.items.attributeGroups.attributes.create
* @service items
* @domain inventory-management
* @discoverable true
*/
create: async (attributeGroupUid, data) => {
return executeRequest({
method: 'POST',
path: `/attribute-groups/${attributeGroupUid}/attributes`,
paramsSchema: schemas_1.CreateAttributeGroupAttributeRequestSchema,
responseSchema: schemas_1.AttributeGroupAttributeResponseSchema,
}, data);
},
/**
* Get attribute group attribute association
* @description Get specific attribute-group association details
* @fullPath api.items.attributeGroups.attributes.get
* @service items
* @domain inventory-management
* @discoverable true
*/
get: async (attributeGroupUid, attributeXAttributeGroupUid) => {
return executeRequest({
method: 'GET',
path: `/attribute-groups/${attributeGroupUid}/attributes/${attributeXAttributeGroupUid}`,
responseSchema: schemas_1.AttributeGroupAttributeResponseSchema,
});
},
/**
* Update attribute group attribute association
* @description Update existing attribute-group association
* @fullPath api.items.attributeGroups.attributes.update
* @service items
* @domain inventory-management
* @discoverable true
*/
update: async (attributeGroupUid, attributeXAttributeGroupUid, data) => {
return executeRequest({
method: 'PUT',
path: `/attribute-groups/${attributeGroupUid}/attributes/${attributeXAttributeGroupUid}`,
paramsSchema: schemas_1.UpdateAttributeGroupAttributeRequestSchema,
responseSchema: schemas_1.AttributeGroupAttributeResponseSchema,
}, data);
},
/**
* Remove attribute from attribute group
* @description Delete attribute-group association
* @fullPath api.items.attributeGroups.attributes.delete
* @service items
* @domain inventory-management
* @discoverable true
*/
delete: async (attributeGroupUid, attributeXAttributeGroupUid) => {
return executeRequest({
method: 'DELETE',
path: `/attribute-groups/${attributeGroupUid}/attributes/${attributeXAttributeGroupUid}`,
responseSchema: schemas_1.AttributeGroupAttributeResponseSchema,
});
},
},
};
}
/**
* Creates the attributeGroupsData resource methods (data-only versions)
*/
function createAttributeGroupsDataResource(attributeGroups) {
return {
list: async (params) => {
const response = await attributeGroups.list(params);
return response.data;
},
create: async (data) => {
const response = await attributeGroups.create(data);
return response.data;
},
get: async (attributeGroupUid) => {
const response = await attributeGroups.get(attributeGroupUid);
return response.data;
},
update: async (attributeGroupUid, data) => {
const response = await attributeGroups.update(attributeGroupUid, data);
return response.data;
},
delete: async (attributeGroupUid) => {
const response = await attributeGroups.delete(attributeGroupUid);
return response.data;
},
attributes: {
list: async (attributeGroupUid, params) => {
const response = await attributeGroups.attributes.list(attributeGroupUid, params);
return response.data;
},
create: async (attributeGroupUid, data) => {
const response = await attributeGroups.attributes.create(attributeGroupUid, data);
return response.data;
},
get: async (attributeGroupUid, attributeXAttributeGroupUid) => {
const response = await attributeGroups.attributes.get(attributeGroupUid, attributeXAttributeGroupUid);
return response.data;
},
update: async (attributeGroupUid, attributeXAttributeGroupUid, data) => {
const response = await attributeGroups.attributes.update(attributeGroupUid, attributeXAttributeGroupUid, data);
return response.data;
},
delete: async (attributeGroupUid, attributeXAttributeGroupUid) => {
const response = await attributeGroups.attributes.delete(attributeGroupUid, attributeXAttributeGroupUid);
return response.data;
},
},
};
}
//# sourceMappingURL=attribute-groups.js.map