UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

223 lines 9.79 kB
import { CreateAttributeGroupRequestSchema, UpdateAttributeGroupRequestSchema, AttributeGroupListParamsSchema, AttributeGroupResponseSchema, AttributeGroupListResponseSchema, AttributeGroupAttributesListParamsSchema, CreateAttributeGroupAttributeRequestSchema, UpdateAttributeGroupAttributeRequestSchema, AttributeGroupAttributeResponseSchema, AttributeGroupAttributeListResponseSchema, } from '../schemas'; /** * Creates the attributeGroups resource methods * OpenAPI Path: /attribute-groups → attributeGroups.* * @description Methods for managing attribute groups with CRUD operations */ export 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: AttributeGroupListParamsSchema, responseSchema: 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: CreateAttributeGroupRequestSchema, responseSchema: 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: 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: UpdateAttributeGroupRequestSchema, responseSchema: 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: 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: AttributeGroupAttributesListParamsSchema, responseSchema: 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: CreateAttributeGroupAttributeRequestSchema, responseSchema: 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: 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: UpdateAttributeGroupAttributeRequestSchema, responseSchema: 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: AttributeGroupAttributeResponseSchema, }); }, }, }; } /** * Creates the attributeGroupsData resource methods (data-only versions) */ export 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