@simpleapps-com/augur-api 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,108 @@
1
1
  import { HTTPClient } from '../../core/client';
2
2
  import { BaseServiceClient } from '../../core/base-client';
3
- import { type OrderDocumentParams } from './schemas';
3
+ import { type OrderDocumentParams, type OrderLookupParams, type PurchaseOrderListParams, type PurchaseOrderScanParams } from './schemas';
4
4
  /**
5
5
  * Orders Service Client
6
+ * @description Comprehensive order management functionality for the Augur platform covering the complete order lifecycle from creation through fulfillment, including order processing, invoicing, purchase orders, and sales representative management.
6
7
  *
7
- * Provides comprehensive order management functionality for the Augur platform.
8
- * Handles the complete order lifecycle from creation through fulfillment,
9
- * including order processing, invoicing, purchase orders, and sales representative management.
8
+ * @fullPath api.orders
9
+ * @service orders
10
+ * @domain order-management
11
+ * @discoverable true
12
+ * @searchTerms ["orders", "order management", "purchase orders", "invoices", "sales orders", "order processing", "fulfillment"]
13
+ * @relatedEndpoints ["api.customers.customer.list", "api.items.products.list", "api.pricing.job-pricing.create", "api.commerce.checkout.process"]
14
+ * @commonPatterns ["Order lookup", "Order tracking", "Purchase order management", "Invoice processing", "Sales rep orders"]
15
+ * @functionalArea "order-and-fulfillment-management"
16
+ * @workflow ["order-processing", "purchase-order-workflow", "invoice-management", "sales-order-lifecycle"]
17
+ * @businessRules ["Orders require valid customer and items", "Purchase orders track receiving status", "Invoices integrate with Prophet 21", "Access filtered by sales rep permissions"]
18
+ * @performance "Supports pagination and filtering. Use edgeCache for frequently accessed data."
10
19
  *
11
20
  * @example
12
21
  * ```typescript
13
22
  * const api = new AugurAPI({ bearerToken: 'token', siteId: 'site' });
14
23
  *
15
- * // List orders
16
- * const orders = await api.orders.orders.lookup({ limit: 10, q: '12345' });
24
+ * // Standard methods (full BaseResponse)
25
+ * const ordersResponse = await api.orders.orders.lookup({ limit: 10, q: '12345' });
26
+ * console.log(`Found ${ordersResponse.total} orders`);
17
27
  *
18
- * // Get order document
19
- * const order = await api.orders.orders.getDocument(12345678, { postalCode: '12345' });
28
+ * // Data methods (data only)
29
+ * const orders = await api.orders.orders.lookupData({ limit: 10, q: '12345' });
30
+ * orders.forEach(order => console.log(order.orderNo, order.customerName));
20
31
  *
21
- * // List purchase orders
22
- * const pos = await api.orders.purchaseOrders.list({ complete: 'N', limit: 20 });
32
+ * // Get order document with validation
33
+ * const orderDoc = await api.orders.orders.getDocument(12345678, { postalCode: '12345' });
34
+ *
35
+ * // Purchase order workflow
36
+ * const pos = await api.orders.purchaseOrders.listData({ complete: 'N', limit: 20 });
37
+ * const poDoc = await api.orders.purchaseOrders.getDocument(pos[0].poNo);
23
38
  * ```
24
39
  */
25
40
  export declare class OrdersClient extends BaseServiceClient {
41
+ /**
42
+ * Create a new OrdersClient instance
43
+ * @param http Configured HTTPClient instance with authentication
44
+ * @param baseUrl Base URL for the Orders API (default: https://orders.augur-api.com)
45
+ */
26
46
  constructor(http: HTTPClient, baseUrl?: string);
27
47
  /**
28
48
  * Order Management Operations (oe-hdr endpoints)
49
+ * @description Core order management functionality for searching, tracking, and retrieving sales orders
29
50
  */
30
51
  orders: {
31
52
  /**
32
53
  * Search and list order headers with flexible filtering options
54
+ * @description Returns paginated order headers with comprehensive filtering by customer, date, status, sales rep, and search terms. Supports edge caching for improved performance.
55
+ *
56
+ * @fullPath api.orders.orders.lookup
57
+ * @service orders
58
+ * @domain order-management
59
+ * @dataMethod lookupData - returns only the order headers array without metadata
60
+ * @discoverable true
61
+ * @searchTerms ["order lookup", "search orders", "order list", "find orders", "order search", "sales orders"]
62
+ * @relatedEndpoints ["api.orders.orders.getDocument", "api.customers.customer.list", "api.orders.salesRep.getOrders"]
63
+ * @commonPatterns ["Search orders by customer", "Find orders by order number", "List incomplete orders", "Filter by date range"]
64
+ * @workflow ["order-discovery", "order-status-tracking", "customer-order-history"]
65
+ * @prerequisites ["Valid authentication token", "Order access permissions"]
66
+ * @nextSteps ["api.orders.orders.getDocument for full details", "api.customers.customer.get for customer info"]
67
+ * @businessRules ["Returns only orders accessible to current user/sales rep", "Completed orders may have restricted access", "Search supports partial matches"]
68
+ * @functionalArea "order-and-fulfillment-management"
69
+ * @caching "Supports edgeCache parameter (1-8 hours) for frequently accessed order lists"
70
+ * @performance "Use pagination for large result sets. Filter by specific criteria to improve performance."
71
+ *
72
+ * @param params Optional filtering and pagination parameters
73
+ * @param params.q Search query for order number, customer name, or PO number
74
+ * @param params.completed Filter by completion status ('Y' for completed, 'N' for incomplete)
75
+ * @param params.salesrepId Filter orders by specific sales representative ID
76
+ * @param params.class1Id Filter by customer class/category
77
+ * @param params.dateOrderCompleted Filter by order completion date (YYYY-MM-DD format)
78
+ * @param params.limit Maximum number of orders to return (default: 20, max: 100)
79
+ * @param params.offset Number of items to skip for pagination
80
+ * @param params.edgeCache Cache duration in hours (1-8) for improved performance
81
+ * @returns Promise<BaseResponse<OrderHeader[]>> Complete response with order headers and metadata
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Search orders with full response metadata
86
+ * const response = await api.orders.orders.lookup({
87
+ * q: '12345',
88
+ * completed: 'N',
89
+ * limit: 10
90
+ * });
91
+ * console.log(`Found ${response.total} orders`);
92
+ *
93
+ * // Get just the order data
94
+ * const orders = await api.orders.orders.lookupData({
95
+ * salesrepId: 'REP001',
96
+ * limit: 50
97
+ * });
98
+ *
99
+ * // Filter by completion status with caching
100
+ * const incompleteOrders = await api.orders.orders.lookup({
101
+ * completed: 'N',
102
+ * edgeCache: 2, // Cache for 2 hours
103
+ * orderBy: 'orderDate DESC'
104
+ * });
105
+ * ```
33
106
  */
34
107
  lookup: (params?: {
35
108
  edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
@@ -63,8 +136,65 @@ export declare class OrdersClient extends BaseServiceClient {
63
136
  total: number;
64
137
  totalResults: number;
65
138
  }>;
139
+ /**
140
+ * Get only order headers data without response metadata
141
+ * @description Data-only version of lookup() method - returns the order headers array directly
142
+ *
143
+ * @param params Same parameters as lookup() method
144
+ * @returns Promise<OrderHeader[]> Direct array of order headers
145
+ */
146
+ lookupData: (params?: OrderLookupParams) => Promise<{
147
+ customerId: string;
148
+ customerName: string;
149
+ orderNo: string | number;
150
+ orderDate: string;
151
+ completed: string;
152
+ jobName?: string | undefined;
153
+ requestedDate?: string | undefined;
154
+ dateOrderCompleted?: string | null | undefined;
155
+ salesrepId?: string | undefined;
156
+ }[]>;
66
157
  /**
67
158
  * Retrieve complete order document with all related information
159
+ * @description Returns comprehensive order details including customer info, shipping address, line items, and totals. Includes optional postal code validation for security.
160
+ *
161
+ * @fullPath api.orders.orders.getDocument
162
+ * @service orders
163
+ * @domain order-management
164
+ * @dataMethod getDocumentData - returns only the order document without metadata
165
+ * @discoverable true
166
+ * @searchTerms ["order document", "order details", "full order", "order with lines", "complete order"]
167
+ * @relatedEndpoints ["api.orders.orders.lookup", "api.customers.customer.get", "api.items.products.get"]
168
+ * @commonPatterns ["Get order details", "View complete order", "Order with line items", "Full order document"]
169
+ * @workflow ["order-review", "order-fulfillment", "customer-service"]
170
+ * @prerequisites ["Valid order number", "Order access permissions", "Optional postal code for validation"]
171
+ * @nextSteps ["Process order fulfillment", "Update order status", "Generate invoice"]
172
+ * @businessRules ["Postal code validation optional but recommended for security", "Access restricted by sales rep permissions", "Includes all order line items and totals"]
173
+ * @functionalArea "order-and-fulfillment-management"
174
+ * @performance "Single document retrieval - no pagination needed. Consider caching for frequently accessed orders."
175
+ *
176
+ * @param orderNo Order number to retrieve
177
+ * @param params Optional parameters including postal code validation
178
+ * @param params.postalCode Optional postal code for additional security validation
179
+ * @returns Promise<BaseResponse<OrderDocument>> Complete response with full order document
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * // Get order document with validation
184
+ * const response = await api.orders.orders.getDocument(12345678, {
185
+ * postalCode: '12345'
186
+ * });
187
+ * console.log(`Order ${response.data.orderNo} for ${response.data.customerName}`);
188
+ *
189
+ * // Get just the document data
190
+ * const order = await api.orders.orders.getDocumentData(12345678);
191
+ * order.lines.forEach(line => {
192
+ * console.log(`${line.itemId}: ${line.qtyOrdered} @ $${line.unitPrice}`);
193
+ * });
194
+ *
195
+ * // Without postal code validation
196
+ * const orderDoc = await api.orders.orders.getDocument(12345678);
197
+ * ```
68
198
  */
69
199
  getDocument: (orderNo: number, params?: OrderDocumentParams) => Promise<{
70
200
  params: Record<string, unknown> | unknown[];
@@ -102,13 +232,79 @@ export declare class OrdersClient extends BaseServiceClient {
102
232
  total: number;
103
233
  totalResults: number;
104
234
  }>;
235
+ /**
236
+ * Get only order document data without response metadata
237
+ * @description Data-only version of getDocument() method - returns the order document directly
238
+ *
239
+ * @param orderNo Order number to retrieve
240
+ * @param params Optional parameters including postal code validation
241
+ * @returns Promise<OrderDocument> Direct order document object
242
+ */
243
+ getDocumentData: (orderNo: number, params?: OrderDocumentParams) => Promise<{
244
+ customerId: string;
245
+ lines: {
246
+ description: string;
247
+ lineNo: number;
248
+ invMastUid: number;
249
+ unitOfMeasure: string;
250
+ unitPrice: number;
251
+ itemId: string;
252
+ qtyAllocated: number;
253
+ qtyInvoiced: number;
254
+ qtyOrdered: number;
255
+ extendedPrice: number;
256
+ }[];
257
+ customerName: string;
258
+ orderNo: number;
259
+ orderDate: string;
260
+ completed: string;
261
+ poNo?: string | undefined;
262
+ ship2Name?: string | undefined;
263
+ ship2City?: string | undefined;
264
+ ship2State?: string | undefined;
265
+ ship2Zip?: string | undefined;
266
+ webReferenceNo?: string | undefined;
267
+ ship2Address1?: string | undefined;
268
+ freightOut?: number | undefined;
269
+ }>;
105
270
  };
106
271
  /**
107
272
  * Sales Representative Order Operations
273
+ * @description Order management functionality specific to sales representatives including territory-based order access and rep-specific reporting
108
274
  */
109
275
  salesRep: {
110
276
  /**
111
277
  * Get order list for a specific sales representative
278
+ * @description Returns all orders associated with a specific sales representative, filtered by territory and permissions. Essential for sales performance tracking and customer relationship management.
279
+ *
280
+ * @fullPath api.orders.salesRep.getOrders
281
+ * @service orders
282
+ * @domain sales-management
283
+ * @dataMethod getOrdersData - returns only the orders array without metadata
284
+ * @discoverable true
285
+ * @searchTerms ["sales rep orders", "representative orders", "territory orders", "sales orders by rep", "rep performance"]
286
+ * @relatedEndpoints ["api.orders.salesRep.getOrderDocument", "api.orders.orders.lookup", "api.customers.customer.list"]
287
+ * @commonPatterns ["Sales rep performance", "Territory management", "Rep order history", "Sales tracking"]
288
+ * @workflow ["sales-performance-tracking", "territory-management", "commission-calculation"]
289
+ * @prerequisites ["Valid sales representative ID", "Sales rep access permissions"]
290
+ * @nextSteps ["api.orders.salesRep.getOrderDocument for details", "Calculate commission totals", "Territory analysis"]
291
+ * @businessRules ["Returns only orders within rep's territory", "Respects sales hierarchy permissions", "May include completed and pending orders"]
292
+ * @functionalArea "sales-and-territory-management"
293
+ * @performance "Territory-filtered results - typically smaller datasets than global order lists"
294
+ *
295
+ * @param salesrepId Sales representative ID to retrieve orders for
296
+ * @returns Promise<BaseResponse<SalesRepOrder[]>> Complete response with rep's orders and metadata
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * // Get all orders for a sales rep
301
+ * const response = await api.orders.salesRep.getOrders(12345);
302
+ * console.log(`Rep has ${response.data.length} orders`);
303
+ *
304
+ * // Get just the orders data
305
+ * const repOrders = await api.orders.salesRep.getOrdersData(12345);
306
+ * const totalValue = repOrders.reduce((sum, order) => sum + order.orderTotal, 0);
307
+ * ```
112
308
  */
113
309
  getOrders: (salesrepId: number) => Promise<{
114
310
  params: Record<string, unknown> | unknown[];
@@ -129,8 +325,56 @@ export declare class OrdersClient extends BaseServiceClient {
129
325
  total: number;
130
326
  totalResults: number;
131
327
  }>;
328
+ /**
329
+ * Get only sales rep orders data without response metadata
330
+ * @description Data-only version of getOrders() method - returns the orders array directly
331
+ *
332
+ * @param salesrepId Sales representative ID
333
+ * @returns Promise<SalesRepOrder[]> Direct array of sales rep orders
334
+ */
335
+ getOrdersData: (salesrepId: number) => Promise<{
336
+ customerId: string;
337
+ customerName: string;
338
+ orderNo: string | number;
339
+ orderDate: string;
340
+ completed: string;
341
+ jobName?: string | undefined;
342
+ requestedDate?: string | undefined;
343
+ dateOrderCompleted?: string | null | undefined;
344
+ }[]>;
132
345
  /**
133
346
  * Get specific order document for a sales representative
347
+ * @description Returns complete order document with sales rep context, including commission details and territory-specific information. Validates that the order belongs to the specified sales representative.
348
+ *
349
+ * @fullPath api.orders.salesRep.getOrderDocument
350
+ * @service orders
351
+ * @domain sales-management
352
+ * @dataMethod getOrderDocumentData - returns only the order document without metadata
353
+ * @discoverable true
354
+ * @searchTerms ["sales rep order document", "rep order details", "territory order document", "rep order with lines"]
355
+ * @relatedEndpoints ["api.orders.salesRep.getOrders", "api.orders.orders.getDocument", "api.customers.customer.get"]
356
+ * @commonPatterns ["Rep order details", "Commission calculation", "Territory order review", "Sales order analysis"]
357
+ * @workflow ["sales-order-review", "commission-processing", "territory-analysis"]
358
+ * @prerequisites ["Valid sales rep ID", "Valid order number", "Order must belong to specified rep"]
359
+ * @nextSteps ["Calculate commission", "Update order status", "Customer follow-up"]
360
+ * @businessRules ["Order must belong to specified sales rep", "Includes commission and territory data", "Access controlled by sales hierarchy"]
361
+ * @functionalArea "sales-and-territory-management"
362
+ * @performance "Single document retrieval with rep validation - efficient for territory-specific access"
363
+ *
364
+ * @param salesrepId Sales representative ID
365
+ * @param orderNo Order number to retrieve
366
+ * @returns Promise<BaseResponse<SalesRepOrderDocument>> Complete response with rep-specific order document
367
+ *
368
+ * @example
369
+ * ```typescript
370
+ * // Get order document for specific sales rep
371
+ * const response = await api.orders.salesRep.getOrderDocument(12345, 987654);
372
+ * console.log(`Order ${response.data.orderNo} - Commission: $${response.data.commissionAmount}`);
373
+ *
374
+ * // Get just the document data
375
+ * const repOrder = await api.orders.salesRep.getOrderDocumentData(12345, 987654);
376
+ * console.log(`Territory: ${repOrder.territoryCode}`);
377
+ * ```
134
378
  */
135
379
  getOrderDocument: (salesrepId: number, orderNo: number) => Promise<{
136
380
  params: Record<string, unknown> | unknown[];
@@ -153,13 +397,75 @@ export declare class OrdersClient extends BaseServiceClient {
153
397
  total: number;
154
398
  totalResults: number;
155
399
  }>;
400
+ /**
401
+ * Get only sales rep order document data without response metadata
402
+ * @description Data-only version of getOrderDocument() method - returns the order document directly
403
+ *
404
+ * @param salesrepId Sales representative ID
405
+ * @param orderNo Order number to retrieve
406
+ * @returns Promise<SalesRepOrderDocument> Direct sales rep order document object
407
+ */
408
+ getOrderDocumentData: (salesrepId: number, orderNo: number) => Promise<{
409
+ customerId: string;
410
+ lines: unknown[];
411
+ orderNo: number;
412
+ orderDate: string;
413
+ completed: string;
414
+ jobName?: string | undefined;
415
+ ship2Name?: string | undefined;
416
+ pickTickets?: unknown[] | undefined;
417
+ ship2Address1?: string | undefined;
418
+ invoices?: unknown[] | undefined;
419
+ }>;
156
420
  };
157
421
  /**
158
422
  * Purchase Order Operations
423
+ * @description Comprehensive purchase order management including creation, tracking, receiving, and document generation for procurement workflows
159
424
  */
160
425
  purchaseOrders: {
161
426
  /**
162
427
  * List purchase orders with filtering and pagination
428
+ * @description Returns paginated purchase orders with comprehensive filtering by status, vendor, date ranges, and completion status. Essential for procurement management and receiving workflows.
429
+ *
430
+ * @fullPath api.orders.purchaseOrders.list
431
+ * @service orders
432
+ * @domain procurement-management
433
+ * @dataMethod listData - returns only the purchase orders array without metadata
434
+ * @discoverable true
435
+ * @searchTerms ["purchase orders", "PO list", "procurement", "vendor orders", "purchase order management", "receiving"]
436
+ * @relatedEndpoints ["api.orders.purchaseOrders.get", "api.orders.purchaseOrders.getDocument", "api.orders.purchaseOrders.scan", "api.nexus.receiving.list"]
437
+ * @commonPatterns ["List open POs", "Find POs by vendor", "Track receiving status", "Procurement dashboard"]
438
+ * @workflow ["procurement-workflow", "purchase-order-lifecycle", "receiving-management"]
439
+ * @prerequisites ["Valid authentication", "Purchase order access permissions"]
440
+ * @nextSteps ["api.orders.purchaseOrders.get for details", "api.nexus.receiving.create for receiving", "Update PO status"]
441
+ * @businessRules ["Filters by completion status", "Supports vendor and date filtering", "Pagination required for large datasets"]
442
+ * @functionalArea "procurement-and-purchasing"
443
+ * @performance "Use filtering to reduce result sets. Consider pagination for better performance."
444
+ *
445
+ * @param params Optional filtering and pagination parameters
446
+ * @param params.complete Filter by completion status ('Y' for complete, 'N' for incomplete)
447
+ * @param params.vendorId Filter by specific vendor ID
448
+ * @param params.dateFrom Filter POs created from this date (YYYY-MM-DD)
449
+ * @param params.dateTo Filter POs created to this date (YYYY-MM-DD)
450
+ * @param params.limit Maximum number of POs to return (default: 20, max: 100)
451
+ * @param params.offset Number of items to skip for pagination
452
+ * @returns Promise<BaseResponse<PurchaseOrder[]>> Complete response with purchase orders and metadata
453
+ *
454
+ * @example
455
+ * ```typescript
456
+ * // List incomplete purchase orders
457
+ * const response = await api.orders.purchaseOrders.list({
458
+ * complete: 'N',
459
+ * limit: 50
460
+ * });
461
+ * console.log(`${response.total} open purchase orders`);
462
+ *
463
+ * // Get just the PO data
464
+ * const openPOs = await api.orders.purchaseOrders.listData({
465
+ * complete: 'N',
466
+ * vendorId: 'VENDOR001'
467
+ * });
468
+ * ```
163
469
  */
164
470
  list: (params?: {
165
471
  edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
@@ -174,11 +480,22 @@ export declare class OrdersClient extends BaseServiceClient {
174
480
  data: {
175
481
  poNo: number;
176
482
  complete: string;
177
- totalAmount: number;
178
- vendorId: string;
179
- vendorName: string;
180
- poDate: string;
483
+ vendorId: number;
484
+ vendorName: string | null;
485
+ lines?: unknown[] | undefined;
181
486
  locationId?: number | undefined;
487
+ orderDate?: unknown;
488
+ ship2Name?: string | null | undefined;
489
+ ship2Add1?: string | null | undefined;
490
+ ship2Add2?: string | null | undefined;
491
+ totalAmount?: number | undefined;
492
+ poHdrUid?: number | undefined;
493
+ supplierId?: number | undefined;
494
+ supplierName?: string | null | undefined;
495
+ divisionId?: number | undefined;
496
+ poDate?: string | undefined;
497
+ companyNo?: string | undefined;
498
+ packingSlipNumber?: unknown;
182
499
  expedite?: string | undefined;
183
500
  ackFlag?: string | undefined;
184
501
  }[];
@@ -189,31 +506,96 @@ export declare class OrdersClient extends BaseServiceClient {
189
506
  total: number;
190
507
  totalResults: number;
191
508
  }>;
509
+ /**
510
+ * Get only purchase orders data without response metadata
511
+ * @description Data-only version of list() method - returns the purchase orders array directly
512
+ *
513
+ * @param params Same parameters as list() method
514
+ * @returns Promise<PurchaseOrder[]> Direct array of purchase orders
515
+ */
516
+ listData: (params?: PurchaseOrderListParams) => Promise<{
517
+ poNo: number;
518
+ complete: string;
519
+ vendorId: number;
520
+ vendorName: string | null;
521
+ lines?: unknown[] | undefined;
522
+ locationId?: number | undefined;
523
+ orderDate?: unknown;
524
+ ship2Name?: string | null | undefined;
525
+ ship2Add1?: string | null | undefined;
526
+ ship2Add2?: string | null | undefined;
527
+ totalAmount?: number | undefined;
528
+ poHdrUid?: number | undefined;
529
+ supplierId?: number | undefined;
530
+ supplierName?: string | null | undefined;
531
+ divisionId?: number | undefined;
532
+ poDate?: string | undefined;
533
+ companyNo?: string | undefined;
534
+ packingSlipNumber?: unknown;
535
+ expedite?: string | undefined;
536
+ ackFlag?: string | undefined;
537
+ }[]>;
192
538
  /**
193
539
  * Get detailed purchase order information
540
+ * @description Returns comprehensive purchase order details including header information, vendor details, status, and summary totals. Used for PO management and tracking.
541
+ *
542
+ * @fullPath api.orders.purchaseOrders.get
543
+ * @service orders
544
+ * @domain procurement-management
545
+ * @dataMethod getData - returns only the purchase order detail without metadata
546
+ * @discoverable true
547
+ * @searchTerms ["purchase order details", "PO details", "purchase order info", "PO header"]
548
+ * @relatedEndpoints ["api.orders.purchaseOrders.list", "api.orders.purchaseOrders.getDocument", "api.nexus.receiving.list"]
549
+ * @commonPatterns ["Get PO details", "View purchase order", "PO status check", "Vendor order info"]
550
+ * @workflow ["purchase-order-review", "receiving-preparation", "vendor-management"]
551
+ * @prerequisites ["Valid purchase order number", "PO access permissions"]
552
+ * @nextSteps ["api.orders.purchaseOrders.getDocument for full details", "Create receiving record", "Update PO status"]
553
+ * @businessRules ["Returns header-level information only", "Access controlled by permissions", "Status reflects current receiving state"]
554
+ * @functionalArea "procurement-and-purchasing"
555
+ * @performance "Single PO retrieval - efficient for header information"
556
+ *
557
+ * @param id Purchase order number to retrieve
558
+ * @returns Promise<BaseResponse<PurchaseOrderDetail>> Complete response with PO details
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * // Get PO details
563
+ * const response = await api.orders.purchaseOrders.get(12345);
564
+ * console.log(`PO ${response.data.poNo} - Status: ${response.data.status}`);
565
+ *
566
+ * // Get just the PO data
567
+ * const poDetail = await api.orders.purchaseOrders.getData(12345);
568
+ * ```
194
569
  */
195
570
  get: (id: string | number, params?: import("../../core/base-client").CacheParams | undefined) => Promise<{
196
571
  params: Record<string, unknown> | unknown[];
197
572
  data: {
198
573
  lines: {
199
- description: string;
200
574
  lineNo: number;
201
575
  invMastUid: number;
202
- unitOfMeasure: string;
203
576
  itemId: string;
204
577
  qtyOrdered: number;
205
578
  qtyReceived: number;
206
- unitCost: number;
207
- extendedCost: number;
579
+ description?: string | undefined;
580
+ unitOfMeasure?: string | undefined;
581
+ itemDesc?: string | undefined;
582
+ serialized?: string | undefined;
583
+ primaryBin?: string | undefined;
584
+ qtyOutstanding?: number | undefined;
585
+ unitCost?: number | undefined;
586
+ extendedCost?: number | undefined;
587
+ trackBins?: string | undefined;
588
+ lotAssignmentRequired?: string | undefined;
208
589
  }[];
209
590
  poNo: number;
210
591
  complete: string;
211
- totalAmount: number;
212
- vendorId: string;
213
- vendorName: string;
214
- poDate: string;
592
+ vendorId: number;
593
+ vendorName: string | null;
215
594
  approved?: string | undefined;
595
+ orderDate?: unknown;
216
596
  requestedDate?: string | undefined;
597
+ totalAmount?: number | undefined;
598
+ poDate?: string | undefined;
217
599
  expedite?: string | undefined;
218
600
  ackFlag?: string | undefined;
219
601
  currencyId?: string | undefined;
@@ -226,30 +608,108 @@ export declare class OrdersClient extends BaseServiceClient {
226
608
  total: number;
227
609
  totalResults: number;
228
610
  }>;
611
+ /**
612
+ * Get only purchase order detail data without response metadata
613
+ * @description Data-only version of get() method - returns the purchase order detail directly
614
+ *
615
+ * @param id Purchase order number to retrieve
616
+ * @returns Promise<PurchaseOrderDetail> Direct purchase order detail object
617
+ */
618
+ getData: (id: number) => Promise<{
619
+ lines: {
620
+ lineNo: number;
621
+ invMastUid: number;
622
+ itemId: string;
623
+ qtyOrdered: number;
624
+ qtyReceived: number;
625
+ description?: string | undefined;
626
+ unitOfMeasure?: string | undefined;
627
+ itemDesc?: string | undefined;
628
+ serialized?: string | undefined;
629
+ primaryBin?: string | undefined;
630
+ qtyOutstanding?: number | undefined;
631
+ unitCost?: number | undefined;
632
+ extendedCost?: number | undefined;
633
+ trackBins?: string | undefined;
634
+ lotAssignmentRequired?: string | undefined;
635
+ }[];
636
+ poNo: number;
637
+ complete: string;
638
+ vendorId: number;
639
+ vendorName: string | null;
640
+ approved?: string | undefined;
641
+ orderDate?: unknown;
642
+ requestedDate?: string | undefined;
643
+ totalAmount?: number | undefined;
644
+ poDate?: string | undefined;
645
+ expedite?: string | undefined;
646
+ ackFlag?: string | undefined;
647
+ currencyId?: string | undefined;
648
+ exchangeRate?: number | undefined;
649
+ }>;
229
650
  /**
230
651
  * Get complete purchase order document with all related information
652
+ * @description Returns comprehensive purchase order document including header, line items, vendor information, shipping details, and totals. Complete document for receiving and fulfillment processes.
653
+ *
654
+ * @fullPath api.orders.purchaseOrders.getDocument
655
+ * @service orders
656
+ * @domain procurement-management
657
+ * @dataMethod getDocumentData - returns only the purchase order document without metadata
658
+ * @discoverable true
659
+ * @searchTerms ["purchase order document", "complete PO", "PO with lines", "full purchase order", "PO document"]
660
+ * @relatedEndpoints ["api.orders.purchaseOrders.get", "api.orders.purchaseOrders.list", "api.nexus.receiving.create"]
661
+ * @commonPatterns ["Complete PO details", "PO for receiving", "Full purchase order", "PO with line items"]
662
+ * @workflow ["purchase-order-fulfillment", "receiving-workflow", "vendor-management"]
663
+ * @prerequisites ["Valid purchase order number", "Document access permissions"]
664
+ * @nextSteps ["Process receiving", "Create receiving records", "Update line item status"]
665
+ * @businessRules ["Includes all line items and quantities", "Shows receiving status per line", "Contains vendor and shipping details"]
666
+ * @functionalArea "procurement-and-purchasing"
667
+ * @performance "Complete document retrieval - includes all related data in single call"
668
+ *
669
+ * @param poNo Purchase order number to retrieve
670
+ * @returns Promise<BaseResponse<PurchaseOrderDocument>> Complete response with full PO document
671
+ *
672
+ * @example
673
+ * ```typescript
674
+ * // Get complete PO document
675
+ * const response = await api.orders.purchaseOrders.getDocument(12345);
676
+ * console.log(`PO ${response.data.poNo} has ${response.data.lines.length} line items`);
677
+ *
678
+ * // Get just the document data
679
+ * const poDoc = await api.orders.purchaseOrders.getDocumentData(12345);
680
+ * poDoc.lines.forEach(line => {
681
+ * console.log(`${line.itemId}: ${line.qtyOrdered} (${line.qtyReceived} received)`);
682
+ * });
683
+ * ```
231
684
  */
232
685
  getDocument: (poNo: number) => Promise<{
233
686
  params: Record<string, unknown> | unknown[];
234
687
  data: {
235
688
  lines: {
236
- description: string;
237
689
  lineNo: number;
238
690
  invMastUid: number;
239
- unitOfMeasure: string;
240
691
  itemId: string;
241
692
  qtyOrdered: number;
242
693
  qtyReceived: number;
243
- unitCost: number;
244
- extendedCost: number;
694
+ description?: string | undefined;
695
+ unitOfMeasure?: string | undefined;
696
+ itemDesc?: string | undefined;
697
+ serialized?: string | undefined;
698
+ primaryBin?: string | undefined;
699
+ qtyOutstanding?: number | undefined;
700
+ unitCost?: number | undefined;
701
+ extendedCost?: number | undefined;
702
+ trackBins?: string | undefined;
703
+ lotAssignmentRequired?: string | undefined;
245
704
  }[];
246
705
  poNo: number;
247
- totalAmount: number;
248
- vendorId: string;
249
- vendorName: string;
250
- poDate: string;
706
+ vendorId: number;
707
+ vendorName: string | null;
251
708
  receipts?: unknown[] | undefined;
709
+ orderDate?: unknown;
710
+ totalAmount?: number | undefined;
252
711
  invoices?: unknown[] | undefined;
712
+ poDate?: string | undefined;
253
713
  vendorAddress?: {
254
714
  state?: string | undefined;
255
715
  city?: string | undefined;
@@ -266,13 +726,94 @@ export declare class OrdersClient extends BaseServiceClient {
266
726
  total: number;
267
727
  totalResults: number;
268
728
  }>;
729
+ /**
730
+ * Get only purchase order document data without response metadata
731
+ * @description Data-only version of getDocument() method - returns the purchase order document directly
732
+ *
733
+ * @param poNo Purchase order number to retrieve
734
+ * @returns Promise<PurchaseOrderDocument> Direct purchase order document object
735
+ */
736
+ getDocumentData: (poNo: number) => Promise<{
737
+ lines: {
738
+ lineNo: number;
739
+ invMastUid: number;
740
+ itemId: string;
741
+ qtyOrdered: number;
742
+ qtyReceived: number;
743
+ description?: string | undefined;
744
+ unitOfMeasure?: string | undefined;
745
+ itemDesc?: string | undefined;
746
+ serialized?: string | undefined;
747
+ primaryBin?: string | undefined;
748
+ qtyOutstanding?: number | undefined;
749
+ unitCost?: number | undefined;
750
+ extendedCost?: number | undefined;
751
+ trackBins?: string | undefined;
752
+ lotAssignmentRequired?: string | undefined;
753
+ }[];
754
+ poNo: number;
755
+ vendorId: number;
756
+ vendorName: string | null;
757
+ receipts?: unknown[] | undefined;
758
+ orderDate?: unknown;
759
+ totalAmount?: number | undefined;
760
+ invoices?: unknown[] | undefined;
761
+ poDate?: string | undefined;
762
+ vendorAddress?: {
763
+ state?: string | undefined;
764
+ city?: string | undefined;
765
+ address1?: string | undefined;
766
+ zip?: string | undefined;
767
+ } | undefined;
768
+ terms?: string | undefined;
769
+ fobPoint?: string | undefined;
770
+ }>;
269
771
  /**
270
772
  * Scan for similar purchase orders based on provided criteria
773
+ * @description Intelligent purchase order discovery that finds similar POs based on items, vendors, or other criteria. Useful for reordering, vendor analysis, and procurement optimization.
774
+ *
775
+ * @fullPath api.orders.purchaseOrders.scan
776
+ * @service orders
777
+ * @domain procurement-management
778
+ * @dataMethod scanData - returns only the scan results without metadata
779
+ * @discoverable true
780
+ * @searchTerms ["PO scan", "similar purchase orders", "find similar POs", "PO search", "procurement patterns"]
781
+ * @relatedEndpoints ["api.orders.purchaseOrders.list", "api.orders.purchaseOrders.getDocument", "api.items.products.list"]
782
+ * @commonPatterns ["Find similar orders", "Reorder analysis", "Vendor pattern analysis", "Procurement optimization"]
783
+ * @workflow ["procurement-optimization", "reorder-analysis", "vendor-comparison"]
784
+ * @prerequisites ["Scan criteria parameters", "PO access permissions"]
785
+ * @nextSteps ["Analyze results for reordering", "Compare vendor patterns", "Optimize procurement"]
786
+ * @businessRules ["Matches based on provided criteria", "Returns similarity scores", "Filters by date ranges and status"]
787
+ * @functionalArea "procurement-and-purchasing"
788
+ * @performance "Advanced search operation - may take longer for complex criteria"
789
+ *
790
+ * @param params Scan criteria and parameters
791
+ * @param params.itemIds Array of item IDs to match against
792
+ * @param params.vendorId Vendor ID to focus scan on
793
+ * @param params.dateFrom Start date for scan range
794
+ * @param params.dateTo End date for scan range
795
+ * @param params.similarityThreshold Minimum similarity score (0-100)
796
+ * @returns Promise<BaseResponse<PurchaseOrderScanResult[]>> Complete response with matching POs and similarity scores
797
+ *
798
+ * @example
799
+ * ```typescript
800
+ * // Scan for similar POs by items
801
+ * const response = await api.orders.purchaseOrders.scan({
802
+ * itemIds: ['ITEM001', 'ITEM002'],
803
+ * similarityThreshold: 70
804
+ * });
805
+ *
806
+ * // Get just the scan results
807
+ * const similarPOs = await api.orders.purchaseOrders.scanData({
808
+ * vendorId: 'VENDOR001',
809
+ * dateFrom: '2024-01-01'
810
+ * });
811
+ * ```
271
812
  */
272
813
  scan: (data: {
273
814
  locationId?: number | undefined;
274
815
  complete?: string | undefined;
275
- vendorId?: string | undefined;
816
+ vendorId?: number | undefined;
276
817
  dateRange?: {
277
818
  startDate?: string | undefined;
278
819
  endDate?: string | undefined;
@@ -285,10 +826,11 @@ export declare class OrdersClient extends BaseServiceClient {
285
826
  data: {
286
827
  similarity: number;
287
828
  poNo: number;
288
- totalAmount: number;
289
- vendorId: string;
290
- poDate: string;
829
+ vendorId: number;
291
830
  matchedCriteria: string[];
831
+ orderDate?: unknown;
832
+ totalAmount?: number | undefined;
833
+ poDate?: string | undefined;
292
834
  }[];
293
835
  options: Record<string, unknown> | unknown[];
294
836
  status: number;
@@ -297,13 +839,62 @@ export declare class OrdersClient extends BaseServiceClient {
297
839
  total: number;
298
840
  totalResults: number;
299
841
  }>;
842
+ /**
843
+ * Get only purchase order scan results data without response metadata
844
+ * @description Data-only version of scan() method - returns the scan results directly
845
+ *
846
+ * @param params Same parameters as scan() method
847
+ * @returns Promise<PurchaseOrderScanResult[]> Direct array of scan results
848
+ */
849
+ scanData: (params?: PurchaseOrderScanParams) => Promise<{
850
+ similarity: number;
851
+ poNo: number;
852
+ vendorId: number;
853
+ matchedCriteria: string[];
854
+ orderDate?: unknown;
855
+ totalAmount?: number | undefined;
856
+ poDate?: string | undefined;
857
+ }[]>;
300
858
  };
301
859
  /**
302
860
  * Invoice Management Operations
861
+ * @description Invoice processing and document management with Prophet 21 integration for billing and accounting workflows
303
862
  */
304
863
  invoices: {
305
864
  /**
306
865
  * Reprint an existing invoice through Prophet 21 integration
866
+ * @description Generates a reprint of an existing invoice through Prophet 21 system integration. Returns invoice document data and reprint status for billing and customer service workflows.
867
+ *
868
+ * @fullPath api.orders.invoices.reprint
869
+ * @service orders
870
+ * @domain invoice-management
871
+ * @dataMethod reprintData - returns only the reprint result without metadata
872
+ * @discoverable true
873
+ * @searchTerms ["invoice reprint", "reprint invoice", "invoice copy", "duplicate invoice", "invoice document"]
874
+ * @relatedEndpoints ["api.orders.orders.getDocument", "api.customers.customer.get", "api.p21-core.company.get"]
875
+ * @commonPatterns ["Reprint invoice", "Customer invoice copy", "Billing document", "Invoice duplicate"]
876
+ * @workflow ["invoice-management", "customer-service", "billing-workflow"]
877
+ * @prerequisites ["Valid invoice number", "Invoice exists in Prophet 21", "Reprint permissions"]
878
+ * @nextSteps ["Deliver invoice to customer", "Update billing records", "Customer service follow-up"]
879
+ * @businessRules ["Invoice must exist in Prophet 21", "Reprint creates audit trail", "Formatting matches original invoice"]
880
+ * @functionalArea "billing-and-invoicing"
881
+ * @performance "Integrates with Prophet 21 - response time depends on P21 system load"
882
+ *
883
+ * @param invoiceNo Invoice number to reprint (string format)
884
+ * @returns Promise<BaseResponse<InvoiceReprintResult>> Complete response with reprint status and document data
885
+ *
886
+ * @example
887
+ * ```typescript
888
+ * // Reprint an invoice
889
+ * const response = await api.orders.invoices.reprint('INV-12345');
890
+ * console.log(`Invoice reprint status: ${response.data.status}`);
891
+ *
892
+ * // Get just the reprint data
893
+ * const reprintResult = await api.orders.invoices.reprintData('INV-12345');
894
+ * if (reprintResult.success) {
895
+ * console.log(`Reprint generated: ${reprintResult.documentUrl}`);
896
+ * }
897
+ * ```
307
898
  */
308
899
  reprint: (invoiceNo: string) => Promise<{
309
900
  params: Record<string, unknown> | unknown[];
@@ -324,9 +915,39 @@ export declare class OrdersClient extends BaseServiceClient {
324
915
  total: number;
325
916
  totalResults: number;
326
917
  }>;
918
+ /**
919
+ * Get only invoice reprint data without response metadata
920
+ * @description Data-only version of reprint() method - returns the reprint result directly
921
+ *
922
+ * @param invoiceNo Invoice number to reprint
923
+ * @returns Promise<InvoiceReprintResult> Direct reprint result object
924
+ */
925
+ reprintData: (invoiceNo: string) => Promise<{
926
+ invoiceNo: string;
927
+ reprintStatus: string;
928
+ reprintDate: string;
929
+ documentPath?: string | undefined;
930
+ p21Response?: {
931
+ status: string;
932
+ documentId?: string | undefined;
933
+ } | undefined;
934
+ }>;
327
935
  };
328
936
  /**
329
937
  * Health check endpoint
938
+ * @description Service health and status monitoring endpoint for system diagnostics and uptime verification
939
+ *
940
+ * @fullPath api.orders.getHealthCheck
941
+ * @service orders
942
+ * @domain system-monitoring
943
+ * @dataMethod getHealthCheckData - returns only the health check data without metadata
944
+ * @discoverable true
945
+ * @searchTerms ["health check", "service status", "orders health", "system status"]
946
+ * @relatedEndpoints ["api.joomla.getHealthCheck", "api.nexus.getHealthCheck", "api.items.getHealthCheck"]
947
+ * @commonPatterns ["Check service health", "System monitoring", "Service status"]
948
+ * @workflow ["system-monitoring", "health-diagnostics"]
949
+ * @functionalArea "system-operations"
950
+ * @performance "Lightweight endpoint for monitoring - minimal response time"
330
951
  */
331
952
  getHealthCheck: () => Promise<{
332
953
  params: Record<string, unknown> | unknown[];
@@ -341,5 +962,22 @@ export declare class OrdersClient extends BaseServiceClient {
341
962
  total: number;
342
963
  totalResults: number;
343
964
  }>;
965
+ /**
966
+ * Get only health check data without response metadata
967
+ * @description Data-only version of getHealthCheck() method - returns the health check data directly
968
+ *
969
+ * @returns Promise<HealthCheckData> Direct health check data object
970
+ *
971
+ * @example
972
+ * ```typescript
973
+ * // Get just the health check data
974
+ * const healthData = await api.orders.getHealthCheckData();
975
+ * console.log(`Site: ${healthData.siteId} - Hash: ${healthData.siteHash}`);
976
+ * ```
977
+ */
978
+ getHealthCheckData: () => Promise<{
979
+ siteHash: string;
980
+ siteId: string;
981
+ }>;
344
982
  }
345
983
  //# sourceMappingURL=client.d.ts.map