@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
516 lines • 23 kB
TypeScript
import { BaseServiceClient } from '../../core/base-client';
import type { HTTPClient } from '../../core/client';
import { CreateInvMastTagRequest, UpdateInvMastTagRequest, CreateInvMastWebDescRequest, UpdateInvMastWebDescRequest, AlsoBoughtListResponse, InvMastTagListResponse, InvMastTagResponse, InvMastWebDescListResponse, InvMastWebDescResponse, ItemCategoryResponse, OrderResetApiResponse, DeleteResponse } from './schemas';
/**
* Legacy API Client
* @description Client for interacting with Legacy microservice API endpoints for legacy data structures, state management, inventory operations, and order processing
* @example
* ```typescript
* import { HTTPClient } from '@augur/api-client/core';
* import { LegacyClient } from '@augur/api-client/services/legacy';
*
* const http = new HTTPClient('legacy', { siteId: 'your-site-id', bearerToken: 'your-token' });
* const legacy = new LegacyClient(http);
*
* // List states
* const states = await legacy.states.list({ limit: 25, twoLetterCode: 'CA' });
*
* // Get inventory tags
* const tags = await legacy.invMast.tags.list(12345);
*
* // Reset order
* const resetResult = await legacy.orders.reset(67890);
* ```
*/
export declare class LegacyClient extends BaseServiceClient {
/**
* Create a new LegacyClient instance
* @param http Configured HTTPClient instance
* @param baseUrl Base URL for the Legacy API (default: https://legacy.augur-api.com)
*/
constructor(http: HTTPClient, baseUrl?: string);
/**
* Health check endpoint
* @description Service health monitoring (requires only x-site-id header, no bearer token)
*/
getHealthCheck: () => Promise<{
params: Record<string, unknown> | unknown[];
data: {
siteHash: string;
siteId: string;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* State management endpoints
* @description CRUD operations for US states and provinces with tax information
*/
states: {
/**
* List states with optional filtering and pagination
* @description Retrieve a paginated list of states with optional filtering by two-letter code
* @param params Optional filtering and pagination parameters
* @returns Paginated list of state objects with tax information
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* // List all states
* const allStates = await client.states.list();
*
* // Filter by state code
* const californiaStates = await client.states.list({
* twoLetterCode: 'CA',
* limit: 10
* });
*
* // Paginated results
* const statesPage = await client.states.list({
* limit: 25,
* offset: 50
* });
* ```
*/
list: (params?: {
edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
limit?: number | undefined;
offset?: number | undefined;
q?: string | undefined;
orderBy?: string | undefined;
} | undefined) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
statusCd: number;
updateCd: number;
processCd: number;
stateUid: number;
dateCreated?: string | null | undefined;
dateLastModified?: string | null | undefined;
dateLastChecked?: string | null | undefined;
createdBy?: string | null | undefined;
lastMaintainedBy?: string | null | undefined;
countryUid?: number | null | undefined;
twoLetterCode?: string | null | undefined;
stateName?: string | null | undefined;
combinedFederalState1099No?: number | null | undefined;
telecheckStateCode?: number | null | undefined;
active?: number | null | undefined;
taxRate?: number | null | undefined;
taxShipping?: number | null | undefined;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Get state details by UID
* @description Retrieve complete details for a specific state including tax information
* @param stateUid State unique identifier
* @param params Optional query parameters
* @returns Complete state object with tax and administrative information
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* // Get state by UID
* const state = await client.states.get(1);
* console.log(state.state_name, state.tax_rate);
*
* // Get with additional filtering
* const state = await client.states.get(1, { twoLetterCode: 'CA' });
* ```
*/
get: (id: string | number, params?: {
edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
} | undefined) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
statusCd: number;
updateCd: number;
processCd: number;
stateUid: number;
dateCreated?: string | null | undefined;
dateLastModified?: string | null | undefined;
dateLastChecked?: string | null | undefined;
createdBy?: string | null | undefined;
lastMaintainedBy?: string | null | undefined;
countryUid?: number | null | undefined;
twoLetterCode?: string | null | undefined;
stateName?: string | null | undefined;
combinedFederalState1099No?: number | null | undefined;
telecheckStateCode?: number | null | undefined;
active?: number | null | undefined;
taxRate?: number | null | undefined;
taxShipping?: number | null | undefined;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Create a new state record
* @description Add a new state or province to the system with tax configuration
* @param stateData State information including name, code, and tax settings
* @returns Created state object with assigned state_uid
* @throws ValidationError When state data is invalid or response is malformed
* @example
* ```typescript
* const newState = await client.states.create({
* country_uid: 1,
* two_letter_code: 'TX',
* state_name: 'Texas',
* tax_rate: 0.0625,
* active: 1,
* tax_shipping: 0
* });
* console.log('Created state with UID:', newState.state_uid);
* ```
*/
create: (data: {
twoLetterCode: string;
stateName: string;
createdBy?: string | undefined;
countryUid?: number | null | undefined;
combinedFederalState1099No?: number | null | undefined;
telecheckStateCode?: number | null | undefined;
active?: number | undefined;
taxRate?: number | undefined;
taxShipping?: number | undefined;
}) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
statusCd: number;
updateCd: number;
processCd: number;
stateUid: number;
dateCreated?: string | null | undefined;
dateLastModified?: string | null | undefined;
dateLastChecked?: string | null | undefined;
createdBy?: string | null | undefined;
lastMaintainedBy?: string | null | undefined;
countryUid?: number | null | undefined;
twoLetterCode?: string | null | undefined;
stateName?: string | null | undefined;
combinedFederalState1099No?: number | null | undefined;
telecheckStateCode?: number | null | undefined;
active?: number | null | undefined;
taxRate?: number | null | undefined;
taxShipping?: number | null | undefined;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Update an existing state record
* @description Modify state information including tax rates and administrative details
* @param stateUid State unique identifier
* @param stateData Updated state information (partial updates supported)
* @returns Updated state object
* @throws ValidationError When state data is invalid or response is malformed
* @example
* ```typescript
* const updatedState = await client.states.update(1, {
* state_name: 'California Updated',
* tax_rate: 0.0925,
* active: 1
* });
* ```
*/
update: (id: string | number, data: {
active?: number | null | undefined;
taxRate?: number | null | undefined;
taxShipping?: number | null | undefined;
}) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
statusCd: number;
updateCd: number;
processCd: number;
stateUid: number;
dateCreated?: string | null | undefined;
dateLastModified?: string | null | undefined;
dateLastChecked?: string | null | undefined;
createdBy?: string | null | undefined;
lastMaintainedBy?: string | null | undefined;
countryUid?: number | null | undefined;
twoLetterCode?: string | null | undefined;
stateName?: string | null | undefined;
combinedFederalState1099No?: number | null | undefined;
telecheckStateCode?: number | null | undefined;
active?: number | null | undefined;
taxRate?: number | null | undefined;
taxShipping?: number | null | undefined;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Delete a state record
* @description Remove a state from the system (use with caution)
* @param stateUid State unique identifier
* @returns Confirmation of deletion
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const result = await client.states.delete(1);
* console.log('State deleted:', result.deleted);
* ```
*/
delete: (id: string | number) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
message: string;
deleted: boolean;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Inventory master operations
* @description Operations for inventory items including also-bought analysis, tagging, and web descriptions
*/
invMast: {
/**
* Get products frequently bought with a specific item
* @description Retrieve products commonly purchased together for recommendation systems
* @param invMastUid Inventory master unique identifier
* @returns Array of related products with relationship strength data
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const alsoBought = await client.invMast.getAlsoBought(12345);
* alsoBought.forEach(product => {
* console.log(`${product.item_desc} - Frequency: ${product.frequency}`);
* });
* ```
*/
getAlsoBought: (invMastUid: number) => Promise<AlsoBoughtListResponse>;
/**
* Inventory tags management
* @description CRUD operations for inventory item tags and metadata
*/
tags: {
/**
* List tags for an inventory item
* @description Retrieve all tags associated with a specific inventory item
* @param invMastUid Inventory master unique identifier
* @returns Array of tag objects for the item
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const tags = await client.invMast.tags.list(12345);
* tags.forEach(tag => {
* console.log(`${tag.tag_name}: ${tag.tag_value}`);
* });
* ```
*/
list: (invMastUid: number) => Promise<InvMastTagListResponse>;
/**
* Get specific tag details
* @description Retrieve details of a specific inventory tag
* @param invMastUid Inventory master unique identifier
* @param invMastTagsUid Tag unique identifier
* @returns Complete tag object
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const tag = await client.invMast.tags.get(12345, 67890);
* console.log(`Tag: ${tag.tag_name} = ${tag.tag_value}`);
* ```
*/
get: (invMastUid: number, invMastTagsUid: number) => Promise<InvMastTagResponse>;
/**
* Create a new tag for an inventory item
* @description Add a new tag to an inventory item for categorization or metadata
* @param invMastUid Inventory master unique identifier
* @param tagData Tag information including name and value
* @returns Created tag object with assigned UID
* @throws ValidationError When tag data is invalid or response is malformed
* @example
* ```typescript
* const newTag = await client.invMast.tags.create(12345, {
* tag_name: 'Featured Product',
* tag_value: 'true',
* active: 1
* });
* ```
*/
create: (invMastUid: number, tagData: CreateInvMastTagRequest) => Promise<InvMastTagResponse>;
/**
* Update an existing inventory tag
* @description Modify tag information for an inventory item
* @param invMastUid Inventory master unique identifier
* @param invMastTagsUid Tag unique identifier
* @param tagData Updated tag information
* @returns Updated tag object
* @throws ValidationError When tag data is invalid or response is malformed
* @example
* ```typescript
* const updatedTag = await client.invMast.tags.update(12345, 67890, {
* tag_name: 'Premium Product',
* tag_value: 'true'
* });
* ```
*/
update: (invMastUid: number, invMastTagsUid: number, tagData: UpdateInvMastTagRequest) => Promise<InvMastTagResponse>;
/**
* Delete an inventory tag
* @description Remove a tag from an inventory item
* @param invMastUid Inventory master unique identifier
* @param invMastTagsUid Tag unique identifier
* @returns Confirmation of deletion
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const result = await client.invMast.tags.delete(12345, 67890);
* console.log('Tag deleted:', result.deleted);
* ```
*/
delete: (invMastUid: number, invMastTagsUid: number) => Promise<DeleteResponse>;
};
/**
* Web descriptions management
* @description CRUD operations for inventory item web descriptions and marketing content
*/
webDescriptions: {
/**
* List web descriptions for an inventory item
* @description Retrieve all web descriptions for display on websites and catalogs
* @param invMastUid Inventory master unique identifier
* @returns Array of web description objects
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const descriptions = await client.invMast.webDescriptions.list(12345);
* descriptions.forEach(desc => {
* console.log(`${desc.description_type}: ${desc.description_text}`);
* });
* ```
*/
list: (invMastUid: number) => Promise<InvMastWebDescListResponse>;
/**
* Get specific web description details
* @description Retrieve details of a specific web description
* @param invMastUid Inventory master unique identifier
* @param invMastWebDescUid Web description unique identifier
* @returns Complete web description object
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const desc = await client.invMast.webDescriptions.get(12345, 67890);
* console.log(desc.description_type, desc.description_text);
* ```
*/
get: (invMastUid: number, invMastWebDescUid: number) => Promise<InvMastWebDescResponse>;
/**
* Create a new web description
* @description Add web description content for an inventory item
* @param invMastUid Inventory master unique identifier
* @param descData Web description content and metadata
* @returns Created web description object with assigned UID
* @throws ValidationError When description data is invalid or response is malformed
* @example
* ```typescript
* const newDesc = await client.invMast.webDescriptions.create(12345, {
* description_type: 'long',
* description_text: 'Detailed product description for web display',
* display_order: 1
* });
* ```
*/
create: (invMastUid: number, descData: CreateInvMastWebDescRequest) => Promise<InvMastWebDescResponse>;
/**
* Update an existing web description
* @description Modify web description content for an inventory item
* @param invMastUid Inventory master unique identifier
* @param invMastWebDescUid Web description unique identifier
* @param descData Updated description information
* @returns Updated web description object
* @throws ValidationError When description data is invalid or response is malformed
* @example
* ```typescript
* const updatedDesc = await client.invMast.webDescriptions.update(12345, 67890, {
* description_text: 'Updated detailed product description',
* display_order: 2
* });
* ```
*/
update: (invMastUid: number, invMastWebDescUid: number, descData: UpdateInvMastWebDescRequest) => Promise<InvMastWebDescResponse>;
/**
* Delete a web description
* @description Remove web description content from an inventory item
* @param invMastUid Inventory master unique identifier
* @param invMastWebDescUid Web description unique identifier
* @returns Confirmation of deletion
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const result = await client.invMast.webDescriptions.delete(12345, 67890);
* console.log('Description deleted:', result.deleted);
* ```
*/
delete: (invMastUid: number, invMastWebDescUid: number) => Promise<DeleteResponse>;
};
};
/**
* Item category operations
* @description Operations for hierarchical item categorization
*/
itemCategory: {
/**
* Get item category details
* @description Retrieve complete details for a specific item category including hierarchical information
* @param itemCategoryUid Item category unique identifier
* @returns Complete category object with hierarchy details
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const category = await client.itemCategory.get(12345);
* console.log(category.item_category_desc, category.path, category.level);
* ```
*/
get: (itemCategoryUid: number) => Promise<ItemCategoryResponse>;
};
/**
* Order management operations
* @description Operations for order processing and management
*/
orders: {
/**
* Reset order for reprocessing
* @description Reset an order by ID for reprocessing (can use web_orders_uid or web_reference_no)
* @param orderId Order identifier (web_orders_uid or web_reference_no)
* @returns Order reset confirmation with processing status
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const resetResult = await client.orders.reset(12345);
* console.log(resetResult.reset_status, resetResult.message);
* ```
*/
reset: (orderId: number) => Promise<OrderResetApiResponse>;
};
}
//# sourceMappingURL=client.d.ts.map