@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
55 lines • 1.94 kB
JavaScript
import { z } from 'zod';
import { LocationListParamsSchema } from '../schemas';
import { BaseResponseSchema } from '../../../core/schemas';
const UnknownResponseSchema = BaseResponseSchema(z.unknown());
const UnknownArrayResponseSchema = BaseResponseSchema(z.array(z.unknown()));
/**
* Creates the location resource methods
* OpenAPI Path: /location → location.*
* @description Location management operations for warehouse and distribution
*/
export function createLocationResource(executeRequest, createListMethod) {
const listMethod = createListMethod('/location', LocationListParamsSchema, UnknownArrayResponseSchema);
return {
/**
* List locations with filtering
* @fullPath api.p21Core.location.list
* @service p21-core
* @domain location-and-warehouse-management
* @dataMethod locationData.list
* @discoverable true
*/
list: listMethod,
/**
* Get location details by ID
* @fullPath api.p21Core.location.get
* @service p21-core
* @domain location-and-warehouse-management
* @dataMethod locationData.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/location/{locationId}',
responseSchema: UnknownResponseSchema,
}, undefined, { locationId: params.locationId });
},
};
}
/**
* Creates the locationData resource methods (data-only versions)
*/
export function createLocationDataResource(location) {
return {
list: async (params) => {
const response = await location.list(params);
return response.data;
},
get: async (params) => {
const response = await location.get(params);
return response.data;
},
};
}
//# sourceMappingURL=location.js.map