@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
1,131 lines • 48.6 kB
TypeScript
import { BaseServiceClient } from '../../core/base-client';
import type { HTTPClient } from '../../core/client';
import { OrderHeaderListResponse, OrderDocumentListResponse, OrderDocumentResponse, CustomerLookupParams, ContactCreateParams, ContactListParams, ContactCustomersParams, AddressListParams, ShipToAddressListParams, ShipToAddressCreateParams, OrderListParams, InvoiceListParams, QuoteListParams, PurchasedItemListParams } from './schemas';
/**
* Customers API Client
* @description Client for interacting with Customers microservice API endpoints
* @example
* ```typescript
* import { HTTPClient } from '@augur/api-client/core';
* import { CustomersClient } from '@augur/api-client/services/customers';
*
* const http = new HTTPClient('customers', { siteId: 'your-site-id', bearerToken: 'your-token' });
* const customers = new CustomersClient(http);
*
* // List customers
* const customerList = await customers.customer.list({ limit: 10 });
*
* // Get customer by ID
* const customer = await customers.customer.get(123);
*
* // Search customers
* const searchResults = await customers.customer.lookup({ q: 'Acme Corp' });
* ```
*/
export declare class CustomersClient extends BaseServiceClient {
/**
* Create a new CustomersClient instance
* @param http Configured HTTPClient instance
* @param baseUrl Base URL for the Customers API (default: https://customers.augur-api.com)
*/
constructor(http: HTTPClient, baseUrl?: string);
/**
* Customer management endpoints
* @description Methods for customer CRUD operations and lookups
*/
customer: {
/**
* Retrieve a paginated list of customer documents
* @description Returns customers with optional filtering by class5Id and search query
* @param params Optional filtering and pagination parameters
* @returns Array of customer documents
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* // Get all customers
* const customers = await client.customer.list();
*
* // Get filtered customers
* const filtered = await client.customer.list({
* class5Id: 'GOLD',
* limit: 50,
* q: 'Acme'
* });
* ```
*/
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;
class5Id?: string | undefined;
} | undefined) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
deleteFlag: string;
userDefined: {} & {
[k: string]: unknown;
};
companyId: string;
customerName: string | null;
class1Id: string | null;
class2Id: string | null;
class3Id: string | null;
class4Id: string | null;
class5Id: string | null;
webEnabledFlag: string;
salesRepId: string | null;
poNoRequired: string;
termsId: string | null;
taxableFlag: string;
termsDesc: string | null;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Get complete customer document by ID
* @description Returns full customer document including addresses, contacts, and ship-to addresses
* @param customerId Customer ID
* @returns Complete customer document
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const customer = await client.customer.get(12345);
* console.log(customer.data.customerName, customer.data.addresses);
* ```
*/
get: (id: string | number, params?: import("../../core/base-client").CacheParams | undefined) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
deleteFlag: string;
userDefined: {} & {
[k: string]: unknown;
};
companyId: string;
customerName: string | null;
class1Id: string | null;
class2Id: string | null;
class3Id: string | null;
class4Id: string | null;
class5Id: string | null;
webEnabledFlag: string;
salesRepId: string | null;
poNoRequired: string;
termsId: string | null;
taxableFlag: string;
termsDesc: string | null;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Search for customers by name or ID with summary information
* @description Returns customer ID and name for lookup purposes
* @param params Search parameters with required query string
* @returns Array of customer lookup results
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const results = await client.customer.lookup({ q: 'Acme Corporation' });
* ```
*/
lookup: (params: CustomerLookupParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
customerName: string | null;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Customer address management
* @description Methods for looking up customer addresses
*/
addresses: {
/**
* Lookup customer addresses with search functionality
* @description Returns customer addresses matching search query
* @param customerId Customer ID
* @param params Search parameters with required query string
* @returns Array of customer addresses
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const addresses = await client.customer.addresses.list(12345, { q: 'Main' });
* ```
*/
list: (customerId: number, params: AddressListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
state: string;
customerId: number;
city: string;
zipCode: string;
country: string;
addressId: number;
addressName: string;
address1: string;
isPrimary?: boolean | undefined;
phoneNumber?: string | undefined;
address2?: string | undefined;
faxNumber?: string | undefined;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Customer contact management
* @description Methods for managing customer contacts
*/
contacts: {
/**
* Lookup contacts associated with a customer
* @description Returns contacts matching search query for the specified customer
* @param customerId Customer ID
* @param params Search parameters with required query string
* @returns Array of customer contacts
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const contacts = await client.customer.contacts.list(12345, { q: 'John' });
* ```
*/
list: (customerId: number, params: ContactListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
email: string;
customerId: number;
contactId: number;
firstName: string;
lastName: string;
title?: string | undefined;
role?: string | undefined;
dateCreated?: string | undefined;
dateLastModified?: string | undefined;
permissions?: {
canViewPricing?: boolean | undefined;
canPlaceOrders?: boolean | undefined;
canViewInvoices?: boolean | undefined;
} | undefined;
isPrimary?: boolean | undefined;
phoneNumber?: string | undefined;
webEnabled?: boolean | undefined;
loginCredentials?: {
username?: string | undefined;
lastLogin?: string | undefined;
} | undefined;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Create a new contact for a customer
* @description Creates a new contact with permissions and role information
* @param customerId Customer ID
* @param data Contact creation parameters
* @returns Created contact details
* @throws ValidationError When data is invalid or response is malformed
* @example
* ```typescript
* const newContact = await client.customer.contacts.create(12345, {
* firstName: 'Jane',
* lastName: 'Doe',
* email: 'jane.doe@acme.com',
* title: 'Procurement Specialist',
* role: 'BUYER'
* });
* ```
*/
create: (customerId: number, data: ContactCreateParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
email: string;
customerId: number;
contactId: number;
firstName: string;
lastName: string;
title?: string | undefined;
role?: string | undefined;
dateCreated?: string | undefined;
dateLastModified?: string | undefined;
permissions?: {
canViewPricing?: boolean | undefined;
canPlaceOrders?: boolean | undefined;
canViewInvoices?: boolean | undefined;
} | undefined;
isPrimary?: boolean | undefined;
phoneNumber?: string | undefined;
webEnabled?: boolean | undefined;
loginCredentials?: {
username?: string | undefined;
lastLogin?: string | undefined;
} | undefined;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Customer ship-to address management
* @description Methods for managing customer ship-to addresses
*/
shipTo: {
/**
* List customer ship-to addresses
* @description Returns ship-to addresses with optional search filtering
* @param customerId Customer ID
* @param params Optional search and pagination parameters
* @returns Array of ship-to addresses
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* // Get all ship-to addresses
* const shipToAddresses = await client.customer.shipTo.list(12345, {});
*
* // Search ship-to addresses
* const filtered = await client.customer.shipTo.list(12345, { q: 'warehouse' });
* ```
*/
list: (customerId: number, params?: ShipToAddressListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
address: {
id: number;
name: string | null;
physState: string | null;
mailState: string | null;
mailAddress1: string | null;
mailAddress2: string | null;
mailCity: string | null;
mailPostalCode: string | null;
mailCountry: string | null;
physAddress1: string | null;
physAddress2: string | null;
physCity: string | null;
physPostalCode: string | null;
physCountry: string | null;
};
shipToId: number;
companyId: string;
defaultBranch: string;
defaultCarrierId: number | null;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Create a new ship-to address for a customer
* @description Creates a new shipping destination address
* @param customerId Customer ID
* @param data Ship-to address creation parameters
* @returns Created ship-to address details
* @throws ValidationError When data is invalid or response is malformed
* @example
* ```typescript
* const newShipTo = await client.customer.shipTo.create(12345, {
* shipToName: 'New Warehouse',
* address1: '789 Commerce Drive',
* city: 'Atlanta',
* state: 'GA',
* zipCode: '30309',
* country: 'USA'
* });
* ```
*/
create: (customerId: number, data: ShipToAddressCreateParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
address: {
id: number;
name: string | null;
physState: string | null;
mailState: string | null;
mailAddress1: string | null;
mailAddress2: string | null;
mailCity: string | null;
mailPostalCode: string | null;
mailCountry: string | null;
physAddress1: string | null;
physAddress2: string | null;
physCity: string | null;
physPostalCode: string | null;
physCountry: string | null;
};
shipToId: number;
companyId: string;
defaultBranch: string;
defaultCarrierId: number | null;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Customer order management
* @description Methods for viewing customer orders
*/
orders: {
/**
* List customer orders
* @description Returns customer orders with different detail levels based on fullDocument parameter
* @param customerId Customer ID (number)
* @param params Optional filtering and pagination parameters
* @param params.addressId Filter by specific ship-to address ID (number, optional)
* @param params.fullDocument Controls response detail level (string, optional):
* - 'Y' (default): Returns complete order documents with orderLines array and shipping details
* - 'N': Returns order headers only - summary information without line items
* @param params.limit Maximum number of results to return (number, optional, default: 10)
* @param params.offset Number of results to skip for pagination (number, optional, default: 0)
* @param params.orderBy Sort ordering in format 'field|direction' (string, optional, default: 'date_created|DESC')
* @param params.q Search query string (string, optional)
* @returns Promise resolving to either OrderHeaderListResponse or OrderDocumentListResponse
* @throws ValidationError When parameters are invalid or response is malformed
*
* @example Basic usage
* ```typescript
* // Get complete order documents (default behavior)
* const fullOrders = await client.customer.orders.list(12345);
* // Returns: OrderDocumentListResponse
*
* // Get order headers with pagination
* const paginatedHeaders = await client.customer.orders.list(12345, {
* limit: 25,
* offset: 50,
* fullDocument: 'N'
* });
* ```
*
* @example Advanced usage
* ```typescript
* // Get complete order documents with line items
* const fullOrders = await client.customer.orders.list(12345, {
* fullDocument: 'Y',
* orderBy: 'order_date|DESC',
* q: 'PO-2023'
* });
* // Returns: OrderDocumentListResponse
*
* // Filter by ship-to address
* const addressOrders = await client.customer.orders.list(12345, {
* addressId: 67890,
* fullDocument: 'N'
* });
* ```
*
* @note Parameter Types
* - fullDocument must be exactly 'Y' or 'N' (strings, not boolean)
* - orderBy format: 'field_name|ASC' or 'field_name|DESC'
* - All parameters are optional; method works without any parameters
*/
list: (customerId: number, params?: OrderListParams) => Promise<OrderHeaderListResponse | OrderDocumentListResponse>;
/**
* Get specific customer order details
* @description Returns complete order information including line items and shipping details
* @param customerId Customer ID
* @param orderNo Order number
* @returns Complete order document with line items (always returns full document)
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const order = await client.customer.orders.get(12345, 123456);
* // Returns: OrderDocumentResponse with full order details and line items
* ```
*/
get: (customerId: number, orderNo: number) => Promise<OrderDocumentResponse>;
};
/**
* Customer invoice management
* @description Methods for viewing customer invoices
*/
invoices: {
/**
* List customer invoices
* @description Returns customer invoices with required search query
* @param customerId Customer ID
* @param params Search parameters with required query string and optional shipToId filter
* @returns Array of customer invoices
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const invoices = await client.customer.invoices.list(12345, { q: '2023' });
* ```
*/
list: (customerId: number, params: InvoiceListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
taxAmount: number;
lines: {
lineNo: number;
invMastUid: number | null;
unitOfMeasure: string | null;
unitPrice: number;
itemId: string | null;
itemDesc: string;
extendedPrice: number;
qtyRequested: number;
qtyShipped: number;
oderNo: string | null;
oeLineNumber: number | null;
}[];
poNo: string | null;
customerName: string;
orderNo: string | null;
invoiceNo: string;
ship2Name: string | null;
ship2City: string | null;
ship2State: string | null;
ship2Country: string | null;
ship2EmailAddress: string | null;
shipToPhone: string | null;
invoiceDate: string;
ship2Contact: string | null;
ship2Address1: string | null;
ship2Address2: string | null;
ship2Address3: string | null;
ship2PostalCode: string | null;
bill2Name: string | null;
bill2Contact: string | null;
bill2Address1: string | null;
bill2Address2: string | null;
bill2Address3: string | null;
bill2City: string | null;
bill2State: string | null;
bill2PostalCode: string | null;
bill2Country: string | null;
totalAmount: number;
amountPaid: number;
paidInFullFlag: string | null;
taxAmountPaid: number;
shippingCost: number | null;
datePaid: string | null;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Get specific customer invoice details
* @description Returns complete invoice information including line items and payments
* @param customerId Customer ID
* @param invoiceNo Invoice number
* @returns Complete invoice details
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const invoice = await client.customer.invoices.get(12345, 789123);
* ```
*/
get: (customerId: number, invoiceNo: number) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
taxAmount: number;
lines: {
lineNo: number;
invMastUid: number | null;
unitOfMeasure: string | null;
unitPrice: number;
itemId: string | null;
itemDesc: string;
extendedPrice: number;
qtyRequested: number;
qtyShipped: number;
oderNo: string | null;
oeLineNumber: number | null;
}[];
poNo: string | null;
customerName: string;
orderNo: string | null;
invoiceNo: string;
ship2Name: string | null;
ship2City: string | null;
ship2State: string | null;
ship2Country: string | null;
ship2EmailAddress: string | null;
shipToPhone: string | null;
invoiceDate: string;
ship2Contact: string | null;
ship2Address1: string | null;
ship2Address2: string | null;
ship2Address3: string | null;
ship2PostalCode: string | null;
bill2Name: string | null;
bill2Contact: string | null;
bill2Address1: string | null;
bill2Address2: string | null;
bill2Address3: string | null;
bill2City: string | null;
bill2State: string | null;
bill2PostalCode: string | null;
bill2Country: string | null;
totalAmount: number;
amountPaid: number;
paidInFullFlag: string | null;
taxAmountPaid: number;
shippingCost: number | null;
datePaid: string | null;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Customer quote management
* @description Methods for viewing customer quotes
*/
quotes: {
/**
* List customer quotes
* @description Returns customer quotes with pagination and ordering
* @param customerId Customer ID
* @param params Optional pagination and ordering parameters
* @returns Array of customer quotes
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const quotes = await client.customer.quotes.list(12345);
* ```
*/
list: (customerId: number, params?: QuoteListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
contactId: string | null;
taker: string | null;
lines: {
lineNo: number | null;
invMastUid: number;
unitOfMeasure: string | null;
unitPrice: number | null;
itemId: string | null;
unitQuantity: number | null;
unitSize: string | null;
itemDesc: string | null;
displayDesc: string | null;
deleteFlag: "Y" | "N" | null;
qtyAllocated: number | null;
cancelFlag: "Y" | "N" | null;
complete: "Y" | "N" | null;
disposition: string | null;
orderNo: string | null;
originalQtyOrdered: number | null;
qtyCanceled: number | null;
qtyInvoiced: number | null;
qtyOnPickTickets: number | null;
qtyOrdered: number | null;
extendedPrice: number | null;
trinityItemId: string | null;
trinityItemDesc: string | null;
agentItemId: string | null;
agentItemDesc: string | null;
}[];
poNo: string | null;
customerName: string | null;
class1Id: string | null;
class2Id: string | null;
class3Id: string | null;
class4Id: string | null;
class5Id: string | null;
deliveryInstructions: string | null;
orderNo: string;
carrierId: number | null;
carrierName: string | null;
jobName: string | null;
orderDate: string | null;
requestedDate: string | null;
completed: string | null;
ship2Name: string | null;
ship2Add1: string | null;
ship2Add2: string | null;
ship2Add3: string | null;
ship2City: string | null;
ship2State: string | null;
ship2Zip: string | null;
ship2Country: string | null;
ship2EmailAddress: string | null;
shipToPhone: string | null;
webReferenceNo: string | null;
orderStatus: string;
contactFirstName: string | null;
contactLastName: string | null;
pickTickets: {
lines: {
invMastUid: number;
itemId: string;
lineNumber: number;
itemDesc?: string | null | undefined;
displayDesc?: unknown;
trinityItemId?: string | undefined;
trinityItemDesc?: string | undefined;
agentItemId?: string | undefined;
agentItemDesc?: string | undefined;
shipQuantity?: number | null | undefined;
qtyRequested?: number | null | undefined;
}[];
orderNo: string;
pickTicketNo: number;
carrierName: string;
trackingNo?: string | null | undefined;
invoiceNo?: string | null | undefined;
shipDate?: string | null | undefined;
printedFlag?: string | null | undefined;
printDate?: string | null | undefined;
instructions?: string | null | undefined;
carrierId?: number | null | undefined;
}[];
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Get specific customer quote details
* @description Returns complete quote information including line items and terms
* @param customerId Customer ID
* @param quoteNo Quote number
* @returns Complete quote details
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const quote = await client.customer.quotes.get(12345, 456789);
* ```
*/
get: (customerId: number, quoteNo: number) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
contactId: string | null;
taker: string | null;
lines: {
lineNo: number | null;
invMastUid: number;
unitOfMeasure: string | null;
unitPrice: number | null;
itemId: string | null;
unitQuantity: number | null;
unitSize: string | null;
itemDesc: string | null;
displayDesc: string | null;
deleteFlag: "Y" | "N" | null;
qtyAllocated: number | null;
cancelFlag: "Y" | "N" | null;
complete: "Y" | "N" | null;
disposition: string | null;
orderNo: string | null;
originalQtyOrdered: number | null;
qtyCanceled: number | null;
qtyInvoiced: number | null;
qtyOnPickTickets: number | null;
qtyOrdered: number | null;
extendedPrice: number | null;
trinityItemId: string | null;
trinityItemDesc: string | null;
agentItemId: string | null;
agentItemDesc: string | null;
}[];
poNo: string | null;
customerName: string;
class1Id: string | null;
class2Id: string | null;
class3Id: string | null;
class4Id: string | null;
class5Id: string | null;
deliveryInstructions: string | null;
orderNo: string;
carrierId: number | null;
carrierName: string;
jobName: string | null;
orderDate: string | null;
requestedDate: string | null;
completed: "Y" | "N" | null;
ship2Name: string | null;
ship2Add1: string | null;
ship2Add2: string | null;
ship2Add3: string | null;
ship2City: string | null;
ship2State: string | null;
ship2Zip: string | null;
ship2Country: string | null;
ship2EmailAddress: string | null;
shipToPhone: string | null;
webReferenceNo: string | null;
orderStatus: "PENDING" | "SHIPPED" | "ON HOLD" | "IN PROCESS" | "SUBMITTED";
contactFirstName: string | null;
contactLastName: string | null;
pickTickets: {
lines: {
invMastUid: number;
itemId: string;
lineNumber: number;
itemDesc?: string | null | undefined;
displayDesc?: unknown;
trinityItemId?: string | undefined;
trinityItemDesc?: string | undefined;
agentItemId?: string | undefined;
agentItemDesc?: string | undefined;
shipQuantity?: number | null | undefined;
qtyRequested?: number | null | undefined;
}[];
orderNo: string;
pickTicketNo: number;
carrierName: string;
trackingNo?: string | null | undefined;
invoiceNo?: string | null | undefined;
shipDate?: string | null | undefined;
printedFlag?: string | null | undefined;
printDate?: string | null | undefined;
instructions?: string | null | undefined;
carrierId?: number | null | undefined;
}[];
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Customer purchase history
* @description Methods for viewing customer purchase history
*/
purchaseHistory: {
/**
* List customer purchase history
* @description Returns items purchased by customer with frequency and pricing information
* @param customerId Customer ID
* @param params Optional pagination and ordering parameters
* @returns Array of purchased items with history
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const history = await client.customer.purchaseHistory.list(12345, {
* orderBy: 'date_last_purchased|DESC'
* });
* ```
*/
list: (customerId: number, params?: PurchasedItemListParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
count: number;
customerId: number;
invMastUid: number;
itemId: string;
itemDesc: string | null;
displayDesc: string | null;
invoices: number;
lastOrderNo: string | null;
dateLastPurchased: string | null;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
};
/**
* Contact management endpoints
* @description Methods for individual contact operations
*/
contacts: {
/**
* Get complete contact document by ID
* @description Returns full contact details including login credentials and permissions
* @param contactId Contact ID
* @returns Complete contact document
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const contact = await client.contacts.get(12345);
* console.log(contact.data.firstName, contact.data.permissions);
* ```
*/
get: (id: string | number, params?: import("../../core/base-client").CacheParams | undefined) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
email: string;
customerId: number;
contactId: number;
firstName: string;
lastName: string;
title?: string | undefined;
role?: string | undefined;
dateCreated?: string | undefined;
dateLastModified?: string | undefined;
permissions?: {
canViewPricing?: boolean | undefined;
canPlaceOrders?: boolean | undefined;
canViewInvoices?: boolean | undefined;
} | undefined;
isPrimary?: boolean | undefined;
phoneNumber?: string | undefined;
webEnabled?: boolean | undefined;
loginCredentials?: {
username?: string | undefined;
lastLogin?: string | undefined;
} | undefined;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Get web allowance information for a contact (USCCO specific)
* @description Returns web allowance details including current usage and remaining balance
* @param contactId Contact ID
* @returns Web allowance information
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const allowance = await client.contacts.getWebAllowance(12345);
* console.log(allowance.data.remainingAllowance);
* ```
*/
getWebAllowance: (contactId: number) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
id: string;
customerId: number;
webAllowance: number;
orderStartDate: string | null;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* List customers associated with a sales representative contact
* @description Returns customers managed by the specified sales rep contact
* @param contactId Contact ID (sales rep)
* @param params Optional filtering and pagination parameters
* @returns Array of customers managed by the sales rep
* @throws ValidationError When parameters are invalid or response is malformed
* @example
* ```typescript
* const customers = await client.contacts.getCustomers(12345, {
* class5Id: 'GOLD',
* q: 'Acme'
* });
* ```
*/
getCustomers: (contactId: number, params?: ContactCustomersParams) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
customerId: number;
customerName: string;
class5Id?: string | undefined;
salesRepId?: string | undefined;
territoryId?: string | undefined;
lastOrderDate?: string | undefined;
}[];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* List user-defined fields for a contact
* @description Returns custom fields configured for the contact
* @param contactId Contact ID
* @returns Contact user-defined fields
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const customFields = await client.contacts.getUserDefinedFields(12345);
* ```
*/
getUserDefinedFields: (contactId: number) => Promise<{
params: Record<string, unknown> | unknown[];
data: {
contactId: number;
customFields: {
fieldName: string;
fieldValue: string;
fieldType: string;
}[];
lastUpdated: string;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Trigger contact data refresh from Prophet 21
* @description Initiates synchronization of contact data from the ERP system
* @returns Refresh operation status
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const refresh = await client.contacts.refresh();
* console.log(refresh.data.jobId);
* ```
*/
refresh: () => Promise<{
params: Record<string, unknown> | unknown[];
data: {
message: string;
timestamp: string;
jobId: string;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Ship-to address refresh endpoints
* @description Methods for triggering data refresh operations
*/
shipToRefresh: {
/**
* Trigger ship-to address data refresh from Prophet 21
* @description Initiates synchronization of ship-to address data from the ERP system
* @returns Refresh operation status
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const refresh = await client.shipToRefresh.refresh();
* console.log(refresh.data.jobId);
* ```
*/
refresh: () => Promise<{
params: Record<string, unknown> | unknown[];
data: {
message: string;
timestamp: string;
jobId: string;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Order entry contacts customer refresh endpoints
* @description Methods for triggering OE contacts customer data refresh
*/
oeContactsCustomerRefresh: {
/**
* Trigger order entry contacts customer data refresh
* @description Initiates synchronization of OE contacts customer data
* @returns Refresh operation status
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const refresh = await client.oeContactsCustomerRefresh.refresh();
* console.log(refresh.data.jobId);
* ```
*/
refresh: () => Promise<{
params: Record<string, unknown> | unknown[];
data: {
message: string;
timestamp: string;
jobId: string;
};
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
};
/**
* Health check endpoint
* @description Monitor service health and connectivity
* @returns Service health status including site information
* @throws ValidationError When response is malformed
* @example
* ```typescript
* const health = await client.getHealthCheck();
* console.log(health.data.siteId, health.data.siteHash);
* ```
*/
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;
}>;
}
//# sourceMappingURL=client.d.ts.map