@oway/sdk 0.1.0
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.
- package/README.md +224 -0
- package/dist/index.d.mts +1410 -0
- package/dist/index.d.ts +1410 -0
- package/dist/index.js +381 -0
- package/dist/index.mjs +352 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1410 @@
|
|
|
1
|
+
interface OwayConfig {
|
|
2
|
+
/**
|
|
3
|
+
* M2M Client ID (REQUIRED for all integrations)
|
|
4
|
+
* Provided by Oway Sales Engineering team
|
|
5
|
+
*/
|
|
6
|
+
clientId: string;
|
|
7
|
+
/**
|
|
8
|
+
* M2M Client Secret (REQUIRED for all integrations)
|
|
9
|
+
* Provided by Oway Sales Engineering team
|
|
10
|
+
*/
|
|
11
|
+
clientSecret: string;
|
|
12
|
+
/**
|
|
13
|
+
* Default company API key (optional)
|
|
14
|
+
*
|
|
15
|
+
* Single-company: Set this to your company's API key
|
|
16
|
+
* Multi-company: Omit this and provide per-request
|
|
17
|
+
*
|
|
18
|
+
* Get from: https://app.oway.io/settings/api
|
|
19
|
+
*/
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Base URL for the Oway API
|
|
23
|
+
* @default "https://rest-api.sandbox.oway.io"
|
|
24
|
+
*/
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Token endpoint for authentication
|
|
28
|
+
* @default "https://rest-api.sandbox.oway.io/v1/auth/token"
|
|
29
|
+
*/
|
|
30
|
+
tokenUrl?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of retry attempts for failed requests
|
|
33
|
+
* @default 3
|
|
34
|
+
*/
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Timeout in milliseconds for API requests
|
|
38
|
+
* @default 30000
|
|
39
|
+
*/
|
|
40
|
+
timeout?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Enable debug logging (logs sanitized request/response metadata)
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
debug?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Custom logger implementation
|
|
48
|
+
*/
|
|
49
|
+
logger?: {
|
|
50
|
+
debug: (msg: string, meta?: Record<string, any>) => void;
|
|
51
|
+
info: (msg: string, meta?: Record<string, any>) => void;
|
|
52
|
+
warn: (msg: string, meta?: Record<string, any>) => void;
|
|
53
|
+
error: (msg: string, meta?: Record<string, any>) => void;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
declare class OwayError extends Error {
|
|
57
|
+
code?: string | undefined;
|
|
58
|
+
statusCode?: number | undefined;
|
|
59
|
+
requestId?: string | undefined;
|
|
60
|
+
constructor(message: string, code?: string | undefined, statusCode?: number | undefined, requestId?: string | undefined);
|
|
61
|
+
/**
|
|
62
|
+
* Determines if this error represents a transient failure that should be retried
|
|
63
|
+
*/
|
|
64
|
+
isRetryable(): boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* HTTP client for making authenticated requests to the Oway API
|
|
68
|
+
*/
|
|
69
|
+
declare class HttpClient {
|
|
70
|
+
private config;
|
|
71
|
+
private accessToken;
|
|
72
|
+
private tokenExpiry;
|
|
73
|
+
private tokenRefreshPromise;
|
|
74
|
+
constructor(config: OwayConfig);
|
|
75
|
+
/**
|
|
76
|
+
* Internal logging with sanitization
|
|
77
|
+
*/
|
|
78
|
+
private log;
|
|
79
|
+
/**
|
|
80
|
+
* Sanitize objects for logging - remove sensitive fields
|
|
81
|
+
*/
|
|
82
|
+
private sanitizeForLogging;
|
|
83
|
+
/**
|
|
84
|
+
* Get or refresh the access token using the API key
|
|
85
|
+
* Handles concurrent requests by queuing them behind a single refresh
|
|
86
|
+
*/
|
|
87
|
+
private getAccessToken;
|
|
88
|
+
/**
|
|
89
|
+
* Perform the actual token refresh using M2M credentials
|
|
90
|
+
*/
|
|
91
|
+
private refreshToken;
|
|
92
|
+
/**
|
|
93
|
+
* Generate a unique request ID
|
|
94
|
+
*/
|
|
95
|
+
private generateRequestId;
|
|
96
|
+
/**
|
|
97
|
+
* Make an authenticated request to the Oway API
|
|
98
|
+
*/
|
|
99
|
+
request<T>(method: string, path: string, options?: {
|
|
100
|
+
query?: Record<string, string | number | boolean>;
|
|
101
|
+
body?: unknown;
|
|
102
|
+
headers?: Record<string, string>;
|
|
103
|
+
requestId?: string;
|
|
104
|
+
companyApiKey?: string;
|
|
105
|
+
}): Promise<T>;
|
|
106
|
+
get<T>(path: string, query?: Record<string, string | number | boolean>, companyApiKey?: string): Promise<T>;
|
|
107
|
+
post<T>(path: string, body?: unknown, companyApiKey?: string): Promise<T>;
|
|
108
|
+
put<T>(path: string, body?: unknown, companyApiKey?: string): Promise<T>;
|
|
109
|
+
delete<T>(path: string, companyApiKey?: string): Promise<T>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* This file was auto-generated by openapi-typescript.
|
|
114
|
+
* Do not make direct changes to the file.
|
|
115
|
+
*/
|
|
116
|
+
interface paths {
|
|
117
|
+
"/v1/shipper/shipment/{orderNumber}/confirm": {
|
|
118
|
+
parameters: {
|
|
119
|
+
query?: never;
|
|
120
|
+
header?: never;
|
|
121
|
+
path?: never;
|
|
122
|
+
cookie?: never;
|
|
123
|
+
};
|
|
124
|
+
get?: never;
|
|
125
|
+
/**
|
|
126
|
+
* Confirm a shipment by order number
|
|
127
|
+
* @description Confirms an existing shipment using its order number (PRO number).
|
|
128
|
+
* Moves the shipment from INITIALIZED to CONFIRMED state.
|
|
129
|
+
*
|
|
130
|
+
* **Prerequisites:**
|
|
131
|
+
* - The order must be in INITIALIZED state
|
|
132
|
+
* - The order must have an associated quote
|
|
133
|
+
*
|
|
134
|
+
* **Validation Requirements:**
|
|
135
|
+
*
|
|
136
|
+
* The following fields are validated during confirmation. If any are missing or invalid,
|
|
137
|
+
* the shipment will remain in INITIALIZED state.
|
|
138
|
+
*
|
|
139
|
+
* *Address Fields (required on BOTH pickup and delivery addresses):*
|
|
140
|
+
* - `name` - Location/company name
|
|
141
|
+
* - `address1` - Street address
|
|
142
|
+
* - `zipCode` - ZIP code
|
|
143
|
+
* - `contactPerson` - Contact name
|
|
144
|
+
* - `phoneNumber` - Contact phone (E.164 format, e.g., "+15551234567")
|
|
145
|
+
* - `openTime` - Opening time in HH:mm format (defaults to "10:00")
|
|
146
|
+
* - `closeTime` - Closing time in HH:mm format (defaults to "16:00")
|
|
147
|
+
*
|
|
148
|
+
* *Order Fields:*
|
|
149
|
+
* - `description` - Must not be empty
|
|
150
|
+
* - `totalPalletCount` - Must be between 1 and 51
|
|
151
|
+
* - `totalPoundsWeight` - Must be between 1 and 2,500 lbs per pallet
|
|
152
|
+
*
|
|
153
|
+
* *Order Component Fields (per component):*
|
|
154
|
+
* - `palletCount` - Must be at least 1
|
|
155
|
+
* - `poundsWeight` - Must be between 1 and 2,500 lbs per pallet
|
|
156
|
+
* - `palletDimensions` - Must be valid dimensions within limits (subject to change, these are configurable):
|
|
157
|
+
* - Standard: max 60×52×94 inches (L×W×H) - pallets exceeding these are charged as oversized
|
|
158
|
+
* - Oversized maximum: 95×95×96 inches - no pallet can exceed this
|
|
159
|
+
* - With liftgate: max 62×62×94 inches
|
|
160
|
+
*
|
|
161
|
+
* *Component Totals:*
|
|
162
|
+
* - Sum of component `palletCount` must equal order `totalPalletCount`
|
|
163
|
+
* - Sum of component `poundsWeight` must equal order `totalPoundsWeight`
|
|
164
|
+
*/
|
|
165
|
+
put: operations["confirmShipmentByOrderNumber"];
|
|
166
|
+
post?: never;
|
|
167
|
+
delete?: never;
|
|
168
|
+
options?: never;
|
|
169
|
+
head?: never;
|
|
170
|
+
patch?: never;
|
|
171
|
+
trace?: never;
|
|
172
|
+
};
|
|
173
|
+
"/v1/shipper/shipment/{orderNumber}/cancel": {
|
|
174
|
+
parameters: {
|
|
175
|
+
query?: never;
|
|
176
|
+
header?: never;
|
|
177
|
+
path?: never;
|
|
178
|
+
cookie?: never;
|
|
179
|
+
};
|
|
180
|
+
get?: never;
|
|
181
|
+
/**
|
|
182
|
+
* Cancel a shipment by order number
|
|
183
|
+
* @description Cancels an existing shipment using its order number (PRO number). Shipments can only be cancelled when they are in a cancellable state (e.g., before pickup).
|
|
184
|
+
*/
|
|
185
|
+
put: operations["cancelShipmentByOrderNumber"];
|
|
186
|
+
post?: never;
|
|
187
|
+
delete?: never;
|
|
188
|
+
options?: never;
|
|
189
|
+
head?: never;
|
|
190
|
+
patch?: never;
|
|
191
|
+
trace?: never;
|
|
192
|
+
};
|
|
193
|
+
"/v1/shipper/shipment": {
|
|
194
|
+
parameters: {
|
|
195
|
+
query?: never;
|
|
196
|
+
header?: never;
|
|
197
|
+
path?: never;
|
|
198
|
+
cookie?: never;
|
|
199
|
+
};
|
|
200
|
+
get?: never;
|
|
201
|
+
put?: never;
|
|
202
|
+
/**
|
|
203
|
+
* Create a new shipment
|
|
204
|
+
* @description Creates a new shipment order. Optionally reference a previously generated quote. The shipment must be confirmed after creation.
|
|
205
|
+
*
|
|
206
|
+
* **Note:** The `companyId` is automatically extracted from your API key.
|
|
207
|
+
* You do not need to provide this value in the request body.
|
|
208
|
+
*
|
|
209
|
+
* For M2M (machine-to-machine) integrations, no user context is required.
|
|
210
|
+
*/
|
|
211
|
+
post: operations["createShipment"];
|
|
212
|
+
delete?: never;
|
|
213
|
+
options?: never;
|
|
214
|
+
head?: never;
|
|
215
|
+
patch?: never;
|
|
216
|
+
trace?: never;
|
|
217
|
+
};
|
|
218
|
+
"/v1/shipper/quote": {
|
|
219
|
+
parameters: {
|
|
220
|
+
query?: never;
|
|
221
|
+
header?: never;
|
|
222
|
+
path?: never;
|
|
223
|
+
cookie?: never;
|
|
224
|
+
};
|
|
225
|
+
get?: never;
|
|
226
|
+
put?: never;
|
|
227
|
+
/**
|
|
228
|
+
* Request a shipping quote
|
|
229
|
+
* @description Generates a price quote for a shipment based on origin, destination, and cargo details. The quote is valid for 2 days.
|
|
230
|
+
*
|
|
231
|
+
* **Note:** The `companyId` is automatically extracted from your API key.
|
|
232
|
+
* You do not need to provide this value in the request body.
|
|
233
|
+
*
|
|
234
|
+
* For M2M (machine-to-machine) integrations, no user context is required.
|
|
235
|
+
*/
|
|
236
|
+
post: operations["requestQuote"];
|
|
237
|
+
delete?: never;
|
|
238
|
+
options?: never;
|
|
239
|
+
head?: never;
|
|
240
|
+
patch?: never;
|
|
241
|
+
trace?: never;
|
|
242
|
+
};
|
|
243
|
+
"/v1/shipper/shipment/{orderNumber}": {
|
|
244
|
+
parameters: {
|
|
245
|
+
query?: never;
|
|
246
|
+
header?: never;
|
|
247
|
+
path?: never;
|
|
248
|
+
cookie?: never;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Get a shipment by order number
|
|
252
|
+
* @description Retrieves a shipment by its order number (PRO number). The order number is a 5-character alphanumeric code (e.g., ZKYQ5) that uniquely identifies the shipment.
|
|
253
|
+
*/
|
|
254
|
+
get: operations["getShipmentByOrderNumber"];
|
|
255
|
+
put?: never;
|
|
256
|
+
post?: never;
|
|
257
|
+
delete?: never;
|
|
258
|
+
options?: never;
|
|
259
|
+
head?: never;
|
|
260
|
+
patch?: never;
|
|
261
|
+
trace?: never;
|
|
262
|
+
};
|
|
263
|
+
"/v1/shipper/shipment/{orderNumber}/tracking": {
|
|
264
|
+
parameters: {
|
|
265
|
+
query?: never;
|
|
266
|
+
header?: never;
|
|
267
|
+
path?: never;
|
|
268
|
+
cookie?: never;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Track a shipment by order number
|
|
272
|
+
* @description Retrieves tracking information for a shipment by its order number (PRO number). Returns status and estimated/actual pickup and delivery dates.
|
|
273
|
+
*/
|
|
274
|
+
get: operations["trackShipmentByOrderNumber"];
|
|
275
|
+
put?: never;
|
|
276
|
+
post?: never;
|
|
277
|
+
delete?: never;
|
|
278
|
+
options?: never;
|
|
279
|
+
head?: never;
|
|
280
|
+
patch?: never;
|
|
281
|
+
trace?: never;
|
|
282
|
+
};
|
|
283
|
+
"/v1/shipper/shipment/{orderNumber}/invoice": {
|
|
284
|
+
parameters: {
|
|
285
|
+
query?: never;
|
|
286
|
+
header?: never;
|
|
287
|
+
path?: never;
|
|
288
|
+
cookie?: never;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Get itemized invoice for a delivered shipment
|
|
292
|
+
* @description Retrieves the itemized invoice for a delivered shipment.
|
|
293
|
+
* The invoice includes all charges (base freight, accessorials) and line items.
|
|
294
|
+
*
|
|
295
|
+
* **Note:** This endpoint is only available for shipments in DELIVERED state.
|
|
296
|
+
* Invoices are finalized when a shipment is delivered.
|
|
297
|
+
*/
|
|
298
|
+
get: operations["getInvoice"];
|
|
299
|
+
put?: never;
|
|
300
|
+
post?: never;
|
|
301
|
+
delete?: never;
|
|
302
|
+
options?: never;
|
|
303
|
+
head?: never;
|
|
304
|
+
patch?: never;
|
|
305
|
+
trace?: never;
|
|
306
|
+
};
|
|
307
|
+
"/v1/shipper/shipment/{orderNumber}/document/{documentType}": {
|
|
308
|
+
parameters: {
|
|
309
|
+
query?: never;
|
|
310
|
+
header?: never;
|
|
311
|
+
path?: never;
|
|
312
|
+
cookie?: never;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Get a shipment document by order number
|
|
316
|
+
* @description Retrieves a download link for a shipment document using the order number (PRO number). Supported document types: BILL_OF_LADING, INVOICE, SHIPPING_LABEL.
|
|
317
|
+
*/
|
|
318
|
+
get: operations["getDocumentByOrderNumber"];
|
|
319
|
+
put?: never;
|
|
320
|
+
post?: never;
|
|
321
|
+
delete?: never;
|
|
322
|
+
options?: never;
|
|
323
|
+
head?: never;
|
|
324
|
+
patch?: never;
|
|
325
|
+
trace?: never;
|
|
326
|
+
};
|
|
327
|
+
"/v1/shipper/quote/{quoteId}": {
|
|
328
|
+
parameters: {
|
|
329
|
+
query?: never;
|
|
330
|
+
header?: never;
|
|
331
|
+
path?: never;
|
|
332
|
+
cookie?: never;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Get a quote by ID
|
|
336
|
+
* @description Retrieves an existing quote by its unique identifier. Quotes are valid for 2 days from creation.
|
|
337
|
+
*/
|
|
338
|
+
get: operations["getQuote"];
|
|
339
|
+
put?: never;
|
|
340
|
+
post?: never;
|
|
341
|
+
delete?: never;
|
|
342
|
+
options?: never;
|
|
343
|
+
head?: never;
|
|
344
|
+
patch?: never;
|
|
345
|
+
trace?: never;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
interface components {
|
|
349
|
+
schemas: {
|
|
350
|
+
/** @description Shipment/Order details */
|
|
351
|
+
Shipment: {
|
|
352
|
+
/**
|
|
353
|
+
* @description Unique identifier for the order
|
|
354
|
+
* @example 67b6c5fcfbf1be6b24127646
|
|
355
|
+
*/
|
|
356
|
+
id?: string;
|
|
357
|
+
/**
|
|
358
|
+
* @description Company ID that owns this order
|
|
359
|
+
* @example 67c0dfa95bff090747660465
|
|
360
|
+
*/
|
|
361
|
+
companyId?: string;
|
|
362
|
+
/**
|
|
363
|
+
* @description User ID who created this order
|
|
364
|
+
* @example 679410f5b074882a64b9ea7f
|
|
365
|
+
*/
|
|
366
|
+
userId?: string;
|
|
367
|
+
/**
|
|
368
|
+
* @description Human-readable PRO number for the shipment (5-character alphanumeric)
|
|
369
|
+
* @example ZKYQ5
|
|
370
|
+
*/
|
|
371
|
+
orderNumber?: string;
|
|
372
|
+
/**
|
|
373
|
+
* @description Current status of the order
|
|
374
|
+
* @example CONFIRMED
|
|
375
|
+
* @enum {string}
|
|
376
|
+
*/
|
|
377
|
+
orderStatus?: "INITIALIZED" | "CONFIRMED" | "ACCEPTED" | "ASSIGNED" | "PICKED_UP" | "IN_TRANSIT" | "DELIVERED" | "CANCELLED";
|
|
378
|
+
/**
|
|
379
|
+
* Format: int32
|
|
380
|
+
* @description Total price of the order in cents (USD)
|
|
381
|
+
* @example 125000
|
|
382
|
+
*/
|
|
383
|
+
totalPriceInCents?: number;
|
|
384
|
+
/**
|
|
385
|
+
* Format: date-time
|
|
386
|
+
* @description Time when the order was created (ISO 8601 format)
|
|
387
|
+
* @example 2025-02-20T17:31:10.43Z
|
|
388
|
+
*/
|
|
389
|
+
createdAt?: string;
|
|
390
|
+
/**
|
|
391
|
+
* Format: date-time
|
|
392
|
+
* @description Time when the order was last updated (ISO 8601 format)
|
|
393
|
+
* @example 2025-02-27T22:51:49.865Z
|
|
394
|
+
*/
|
|
395
|
+
updatedAt?: string;
|
|
396
|
+
};
|
|
397
|
+
/** @description Address information for pickup or delivery locations */
|
|
398
|
+
Address: {
|
|
399
|
+
/**
|
|
400
|
+
* @description Name of the location or business
|
|
401
|
+
* @example Fairgrounds Distribution Center
|
|
402
|
+
*/
|
|
403
|
+
name: string;
|
|
404
|
+
/**
|
|
405
|
+
* @description Primary street address
|
|
406
|
+
* @example 1531 Junipero Avenue
|
|
407
|
+
*/
|
|
408
|
+
address1: string;
|
|
409
|
+
/**
|
|
410
|
+
* @description Secondary address line (suite, unit, etc.)
|
|
411
|
+
* @example Dock 5
|
|
412
|
+
*/
|
|
413
|
+
address2?: string;
|
|
414
|
+
/**
|
|
415
|
+
* @description City name
|
|
416
|
+
* @example Long Beach
|
|
417
|
+
*/
|
|
418
|
+
city: string;
|
|
419
|
+
/**
|
|
420
|
+
* @description Two-letter state abbreviation
|
|
421
|
+
* @example CA
|
|
422
|
+
*/
|
|
423
|
+
state: string;
|
|
424
|
+
/**
|
|
425
|
+
* @description 5-digit ZIP code
|
|
426
|
+
* @example 90804
|
|
427
|
+
*/
|
|
428
|
+
zipCode: string;
|
|
429
|
+
/**
|
|
430
|
+
* @description Contact phone number in E.164 format
|
|
431
|
+
* @example +18087857650
|
|
432
|
+
*/
|
|
433
|
+
phoneNumber: string;
|
|
434
|
+
/**
|
|
435
|
+
* @description Name of the contact person at this location
|
|
436
|
+
* @example Mike Johnson
|
|
437
|
+
*/
|
|
438
|
+
contactPerson: string;
|
|
439
|
+
/**
|
|
440
|
+
* @description Opening time for the location in 24-hour format (HH:mm). Defaults to 10:00 if not provided.
|
|
441
|
+
* @example 10:00
|
|
442
|
+
*/
|
|
443
|
+
openTime?: string;
|
|
444
|
+
/**
|
|
445
|
+
* @description Closing time for the location in 24-hour format (HH:mm). Defaults to 16:00 if not provided.
|
|
446
|
+
* @example 16:00
|
|
447
|
+
*/
|
|
448
|
+
closeTime?: string;
|
|
449
|
+
/**
|
|
450
|
+
* @description Additional notes or instructions for the driver
|
|
451
|
+
* @example Dock 3, enter from back of building
|
|
452
|
+
*/
|
|
453
|
+
notes?: string;
|
|
454
|
+
/**
|
|
455
|
+
* @description Whether a liftgate is required at this location
|
|
456
|
+
* @example false
|
|
457
|
+
*/
|
|
458
|
+
liftgateRequired?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* @description Whether this is a limited access location (residential, construction site, etc.)
|
|
461
|
+
* @example false
|
|
462
|
+
*/
|
|
463
|
+
limitedAccess?: boolean;
|
|
464
|
+
/**
|
|
465
|
+
* @description Whether an appointment is required for pickup/delivery
|
|
466
|
+
* @example true
|
|
467
|
+
*/
|
|
468
|
+
appointmentRequired?: boolean;
|
|
469
|
+
};
|
|
470
|
+
/** @description Request to create a new shipment */
|
|
471
|
+
CreateShipmentRequest: {
|
|
472
|
+
/**
|
|
473
|
+
* @description Optional ID of a previously generated quote. If provided, the shipment must match the quote parameters.
|
|
474
|
+
* @example 507f1f77bcf86cd799439013
|
|
475
|
+
*/
|
|
476
|
+
quoteId?: string;
|
|
477
|
+
pickupAddress: components["schemas"]["Address"];
|
|
478
|
+
deliveryAddress: components["schemas"]["Address"];
|
|
479
|
+
/** @description List of cargo components in the shipment */
|
|
480
|
+
orderComponents: components["schemas"]["OrderComponent"][];
|
|
481
|
+
/**
|
|
482
|
+
* @description Description of the shipment contents
|
|
483
|
+
* @example Electronics - fragile
|
|
484
|
+
*/
|
|
485
|
+
description: string;
|
|
486
|
+
/**
|
|
487
|
+
* @description Purchase order number for reference
|
|
488
|
+
* @example PO-2024-12345
|
|
489
|
+
*/
|
|
490
|
+
poNumber?: string;
|
|
491
|
+
/**
|
|
492
|
+
* @description Additional reference number
|
|
493
|
+
* @example REF-ABC-123
|
|
494
|
+
*/
|
|
495
|
+
refNumber?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Format: date-time
|
|
498
|
+
* @description Required pickup date (ISO 8601 format)
|
|
499
|
+
* @example 2024-12-24T08:00:00Z
|
|
500
|
+
*/
|
|
501
|
+
requiredPickupDate?: string;
|
|
502
|
+
/**
|
|
503
|
+
* Format: date-time
|
|
504
|
+
* @description Required delivery by date (ISO 8601 format)
|
|
505
|
+
* @example 2024-12-26T17:00:00Z
|
|
506
|
+
*/
|
|
507
|
+
requiredDeliveryBy?: string;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* @description Individual cargo component in a shipment.
|
|
511
|
+
*
|
|
512
|
+
* **Validation Rules:**
|
|
513
|
+
* - Total weight across all components must equal order totalPoundsWeight
|
|
514
|
+
* - Total pallet count across all components must equal order totalPalletCount
|
|
515
|
+
* - Weight must be between 1 and 2,500 lbs per pallet
|
|
516
|
+
* - Dimensions must be within limits (see palletDimensions field)
|
|
517
|
+
*/
|
|
518
|
+
OrderComponent: {
|
|
519
|
+
/**
|
|
520
|
+
* Format: int32
|
|
521
|
+
* @description Number of pallets for this component
|
|
522
|
+
* @example 2
|
|
523
|
+
*/
|
|
524
|
+
palletCount: number;
|
|
525
|
+
/**
|
|
526
|
+
* Format: double
|
|
527
|
+
* @description Total weight for this component in pounds. Must be between 1 and 2,500 lbs per pallet (e.g., 2 pallets = max 5,000 lbs).
|
|
528
|
+
* @example 1000
|
|
529
|
+
*/
|
|
530
|
+
poundsWeight: number;
|
|
531
|
+
/**
|
|
532
|
+
* @description Pallet dimensions in inches as [length, width, height].
|
|
533
|
+
*
|
|
534
|
+
* **Dimension Limits:**
|
|
535
|
+
* - Standard shipments: max 95×95×94 inches
|
|
536
|
+
* - With liftgate accessorial: max 62×62×94 inches
|
|
537
|
+
* - Oversize rule: Both length AND width cannot exceed 60 inches
|
|
538
|
+
* - Minimum: 1×1×1 inches
|
|
539
|
+
* @example [
|
|
540
|
+
* 48,
|
|
541
|
+
* 40,
|
|
542
|
+
* 48
|
|
543
|
+
* ]
|
|
544
|
+
*/
|
|
545
|
+
palletDimensions: number[];
|
|
546
|
+
};
|
|
547
|
+
/** @description Request to generate a shipping quote. Quotes are valid for 2 days from creation. */
|
|
548
|
+
QuoteRequest: {
|
|
549
|
+
pickupAddress: components["schemas"]["Address"];
|
|
550
|
+
deliveryAddress: components["schemas"]["Address"];
|
|
551
|
+
/** @description List of pallets or freight pieces. Quote will be based on total pallet count and weight. */
|
|
552
|
+
orderComponents: components["schemas"]["OrderComponent"][];
|
|
553
|
+
};
|
|
554
|
+
/** @description Response containing quote details */
|
|
555
|
+
QuoteResponse: {
|
|
556
|
+
/**
|
|
557
|
+
* @description Unique identifier for the quote
|
|
558
|
+
* @example 507f1f77bcf86cd799439011
|
|
559
|
+
*/
|
|
560
|
+
id?: string;
|
|
561
|
+
/**
|
|
562
|
+
* Format: int32
|
|
563
|
+
* @description Total quoted price in cents (USD)
|
|
564
|
+
* @example 125000
|
|
565
|
+
*/
|
|
566
|
+
quotedPriceInCents?: number;
|
|
567
|
+
/**
|
|
568
|
+
* Format: date-time
|
|
569
|
+
* @description Time when the quote expires (ISO 8601 format). Quotes are valid for 2 days.
|
|
570
|
+
* @example 2024-12-25T00:00:00Z
|
|
571
|
+
*/
|
|
572
|
+
quoteExpirationTime?: string;
|
|
573
|
+
};
|
|
574
|
+
/** @description Shipment tracking information */
|
|
575
|
+
Tracking: {
|
|
576
|
+
/**
|
|
577
|
+
* @description Unique identifier for the order
|
|
578
|
+
* @example 507f1f77bcf86cd799439011
|
|
579
|
+
*/
|
|
580
|
+
id?: string;
|
|
581
|
+
/**
|
|
582
|
+
* @description Human-readable PRO number for the shipment (5-character alphanumeric)
|
|
583
|
+
* @example ZKYQ5
|
|
584
|
+
*/
|
|
585
|
+
orderNumber?: string;
|
|
586
|
+
/**
|
|
587
|
+
* @description Current status of the order
|
|
588
|
+
* @example PICKED_UP
|
|
589
|
+
* @enum {string}
|
|
590
|
+
*/
|
|
591
|
+
orderStatus?: "INITIALIZED" | "CONFIRMED" | "ACCEPTED" | "ASSIGNED" | "PICKED_UP" | "IN_TRANSIT" | "DELIVERED" | "CANCELLED";
|
|
592
|
+
/**
|
|
593
|
+
* Format: date-time
|
|
594
|
+
* @description Actual pickup date/time (ISO 8601 format)
|
|
595
|
+
* @example 2024-12-23T10:30:00Z
|
|
596
|
+
*/
|
|
597
|
+
actualPickupDate?: string;
|
|
598
|
+
/**
|
|
599
|
+
* Format: date-time
|
|
600
|
+
* @description Actual delivery date/time (ISO 8601 format)
|
|
601
|
+
* @example 2024-12-25T14:00:00Z
|
|
602
|
+
*/
|
|
603
|
+
actualDeliveryDate?: string;
|
|
604
|
+
/**
|
|
605
|
+
* Format: date-time
|
|
606
|
+
* @description Estimated pickup date/time (ISO 8601 format)
|
|
607
|
+
* @example 2024-12-23T09:00:00Z
|
|
608
|
+
*/
|
|
609
|
+
estimatedPickupDate?: string;
|
|
610
|
+
/**
|
|
611
|
+
* Format: date-time
|
|
612
|
+
* @description Estimated delivery date/time (ISO 8601 format)
|
|
613
|
+
* @example 2024-12-25T12:00:00Z
|
|
614
|
+
*/
|
|
615
|
+
estimatedDeliveryDate?: string;
|
|
616
|
+
};
|
|
617
|
+
/** @description An individual charge/fee on the invoice */
|
|
618
|
+
InvoiceCharge: {
|
|
619
|
+
/**
|
|
620
|
+
* @description Type of charge (e.g., BASE_FREIGHT, LIFTGATE_PICKUP, LIFTGATE_DELIVERY)
|
|
621
|
+
* @example LIFTGATE_PICKUP
|
|
622
|
+
*/
|
|
623
|
+
chargeType?: string;
|
|
624
|
+
/**
|
|
625
|
+
* @description Human-readable description of the charge
|
|
626
|
+
* @example Liftgate Pickup
|
|
627
|
+
*/
|
|
628
|
+
description?: string;
|
|
629
|
+
/**
|
|
630
|
+
* Format: int32
|
|
631
|
+
* @description Charge amount in cents (USD)
|
|
632
|
+
* @example 7500
|
|
633
|
+
*/
|
|
634
|
+
amountInCents?: number;
|
|
635
|
+
};
|
|
636
|
+
/** @description A line item on the invoice representing shipped goods */
|
|
637
|
+
InvoiceLineItem: {
|
|
638
|
+
/**
|
|
639
|
+
* @description Description of the goods
|
|
640
|
+
* @example General Freight
|
|
641
|
+
*/
|
|
642
|
+
description?: string;
|
|
643
|
+
/**
|
|
644
|
+
* @description Freight class (NMFC)
|
|
645
|
+
* @example 70
|
|
646
|
+
*/
|
|
647
|
+
freightClass?: string;
|
|
648
|
+
/**
|
|
649
|
+
* Format: int32
|
|
650
|
+
* @description Weight in pounds
|
|
651
|
+
* @example 1500
|
|
652
|
+
*/
|
|
653
|
+
weight?: number;
|
|
654
|
+
/**
|
|
655
|
+
* Format: int32
|
|
656
|
+
* @description Number of pieces/pallets
|
|
657
|
+
* @example 4
|
|
658
|
+
*/
|
|
659
|
+
quantity?: number;
|
|
660
|
+
/**
|
|
661
|
+
* @description Type of packaging (e.g., PLT for pallet, CTN for carton)
|
|
662
|
+
* @example PLT
|
|
663
|
+
*/
|
|
664
|
+
packageType?: string;
|
|
665
|
+
};
|
|
666
|
+
/** @description Itemized invoice for a delivered shipment */
|
|
667
|
+
InvoiceResponse: {
|
|
668
|
+
/**
|
|
669
|
+
* @description Unique identifier for the order
|
|
670
|
+
* @example 507f1f77bcf86cd799439011
|
|
671
|
+
*/
|
|
672
|
+
orderId?: string;
|
|
673
|
+
/**
|
|
674
|
+
* @description Order number (PRO number)
|
|
675
|
+
* @example ZKYQ5
|
|
676
|
+
*/
|
|
677
|
+
orderNumber?: string;
|
|
678
|
+
/**
|
|
679
|
+
* Format: date-time
|
|
680
|
+
* @description Invoice date (when the shipment was delivered)
|
|
681
|
+
* @example 2024-12-20T15:30:00Z
|
|
682
|
+
*/
|
|
683
|
+
invoiceDate?: string;
|
|
684
|
+
/**
|
|
685
|
+
* Format: date-time
|
|
686
|
+
* @description Ship date (when the shipment was picked up)
|
|
687
|
+
* @example 2024-12-18T09:00:00Z
|
|
688
|
+
*/
|
|
689
|
+
shipDate?: string;
|
|
690
|
+
/**
|
|
691
|
+
* Format: date-time
|
|
692
|
+
* @description Delivery date (when the shipment was delivered)
|
|
693
|
+
* @example 2024-12-20T15:30:00Z
|
|
694
|
+
*/
|
|
695
|
+
deliveryDate?: string;
|
|
696
|
+
/**
|
|
697
|
+
* @description Purchase order number (if provided)
|
|
698
|
+
* @example PO-12345
|
|
699
|
+
*/
|
|
700
|
+
poNumber?: string;
|
|
701
|
+
/**
|
|
702
|
+
* @description Reference number (BOL number)
|
|
703
|
+
* @example BOL-67890
|
|
704
|
+
*/
|
|
705
|
+
refNumber?: string;
|
|
706
|
+
/** @description Line items representing the shipped goods */
|
|
707
|
+
lineItems?: components["schemas"]["InvoiceLineItem"][];
|
|
708
|
+
/** @description Itemized charges and fees */
|
|
709
|
+
charges?: components["schemas"]["InvoiceCharge"][];
|
|
710
|
+
/**
|
|
711
|
+
* Format: int32
|
|
712
|
+
* @description Total of all charges in cents (USD)
|
|
713
|
+
* @example 125000
|
|
714
|
+
*/
|
|
715
|
+
totalChargesInCents?: number;
|
|
716
|
+
/**
|
|
717
|
+
* Format: int32
|
|
718
|
+
* @description Total weight of the shipment in pounds
|
|
719
|
+
* @example 1500
|
|
720
|
+
*/
|
|
721
|
+
totalWeight?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Format: int32
|
|
724
|
+
* @description Total number of pieces/pallets
|
|
725
|
+
* @example 4
|
|
726
|
+
*/
|
|
727
|
+
totalPieces?: number;
|
|
728
|
+
shipper?: components["schemas"]["Address"];
|
|
729
|
+
consignee?: components["schemas"]["Address"];
|
|
730
|
+
billTo?: components["schemas"]["Address"];
|
|
731
|
+
};
|
|
732
|
+
/** @description Response containing document download information */
|
|
733
|
+
DocumentResponse: {
|
|
734
|
+
/**
|
|
735
|
+
* @description Name of the document file
|
|
736
|
+
* @example BOL-12345.pdf
|
|
737
|
+
*/
|
|
738
|
+
filename?: string;
|
|
739
|
+
/**
|
|
740
|
+
* @description MIME type of the document
|
|
741
|
+
* @example application/pdf
|
|
742
|
+
*/
|
|
743
|
+
fileType?: string;
|
|
744
|
+
/**
|
|
745
|
+
* @description Pre-signed URL to download the document. Link expires after a short time.
|
|
746
|
+
* @example https://s3.amazonaws.com/bucket/file?...
|
|
747
|
+
*/
|
|
748
|
+
downloadLink?: string;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
responses: never;
|
|
752
|
+
parameters: never;
|
|
753
|
+
requestBodies: never;
|
|
754
|
+
headers: never;
|
|
755
|
+
pathItems: never;
|
|
756
|
+
}
|
|
757
|
+
interface operations {
|
|
758
|
+
confirmShipmentByOrderNumber: {
|
|
759
|
+
parameters: {
|
|
760
|
+
query?: never;
|
|
761
|
+
header?: never;
|
|
762
|
+
path: {
|
|
763
|
+
/**
|
|
764
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
765
|
+
* @example ZKYQ5
|
|
766
|
+
*/
|
|
767
|
+
orderNumber: string;
|
|
768
|
+
};
|
|
769
|
+
cookie?: never;
|
|
770
|
+
};
|
|
771
|
+
requestBody?: never;
|
|
772
|
+
responses: {
|
|
773
|
+
/** @description Shipment confirmed successfully. Verify the response contains `orderStatus: CONFIRMED` to ensure confirmation succeeded. */
|
|
774
|
+
200: {
|
|
775
|
+
headers: {
|
|
776
|
+
[name: string]: unknown;
|
|
777
|
+
};
|
|
778
|
+
content: {
|
|
779
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
/** @description Invalid request: orderNumber is required, order is not in INITIALIZED state, or is missing a quote */
|
|
783
|
+
400: {
|
|
784
|
+
headers: {
|
|
785
|
+
[name: string]: unknown;
|
|
786
|
+
};
|
|
787
|
+
content: {
|
|
788
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
792
|
+
401: {
|
|
793
|
+
headers: {
|
|
794
|
+
[name: string]: unknown;
|
|
795
|
+
};
|
|
796
|
+
content: {
|
|
797
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
801
|
+
403: {
|
|
802
|
+
headers: {
|
|
803
|
+
[name: string]: unknown;
|
|
804
|
+
};
|
|
805
|
+
content: {
|
|
806
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
/** @description Shipment not found */
|
|
810
|
+
404: {
|
|
811
|
+
headers: {
|
|
812
|
+
[name: string]: unknown;
|
|
813
|
+
};
|
|
814
|
+
content: {
|
|
815
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
/** @description Internal server error */
|
|
819
|
+
500: {
|
|
820
|
+
headers: {
|
|
821
|
+
[name: string]: unknown;
|
|
822
|
+
};
|
|
823
|
+
content: {
|
|
824
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
cancelShipmentByOrderNumber: {
|
|
830
|
+
parameters: {
|
|
831
|
+
query?: never;
|
|
832
|
+
header?: never;
|
|
833
|
+
path: {
|
|
834
|
+
/**
|
|
835
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
836
|
+
* @example ZKYQ5
|
|
837
|
+
*/
|
|
838
|
+
orderNumber: string;
|
|
839
|
+
};
|
|
840
|
+
cookie?: never;
|
|
841
|
+
};
|
|
842
|
+
requestBody?: never;
|
|
843
|
+
responses: {
|
|
844
|
+
/** @description Shipment cancelled successfully */
|
|
845
|
+
200: {
|
|
846
|
+
headers: {
|
|
847
|
+
[name: string]: unknown;
|
|
848
|
+
};
|
|
849
|
+
content: {
|
|
850
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
/** @description Invalid request: orderNumber is required, or order cannot be cancelled in its current state */
|
|
854
|
+
400: {
|
|
855
|
+
headers: {
|
|
856
|
+
[name: string]: unknown;
|
|
857
|
+
};
|
|
858
|
+
content: {
|
|
859
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
863
|
+
401: {
|
|
864
|
+
headers: {
|
|
865
|
+
[name: string]: unknown;
|
|
866
|
+
};
|
|
867
|
+
content: {
|
|
868
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
869
|
+
};
|
|
870
|
+
};
|
|
871
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
872
|
+
403: {
|
|
873
|
+
headers: {
|
|
874
|
+
[name: string]: unknown;
|
|
875
|
+
};
|
|
876
|
+
content: {
|
|
877
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
/** @description Shipment not found */
|
|
881
|
+
404: {
|
|
882
|
+
headers: {
|
|
883
|
+
[name: string]: unknown;
|
|
884
|
+
};
|
|
885
|
+
content: {
|
|
886
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
/** @description Internal server error */
|
|
890
|
+
500: {
|
|
891
|
+
headers: {
|
|
892
|
+
[name: string]: unknown;
|
|
893
|
+
};
|
|
894
|
+
content: {
|
|
895
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
896
|
+
};
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
createShipment: {
|
|
901
|
+
parameters: {
|
|
902
|
+
query?: never;
|
|
903
|
+
header?: never;
|
|
904
|
+
path?: never;
|
|
905
|
+
cookie?: never;
|
|
906
|
+
};
|
|
907
|
+
requestBody: {
|
|
908
|
+
content: {
|
|
909
|
+
"application/json": components["schemas"]["CreateShipmentRequest"];
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
responses: {
|
|
913
|
+
/** @description Shipment created successfully */
|
|
914
|
+
200: {
|
|
915
|
+
headers: {
|
|
916
|
+
[name: string]: unknown;
|
|
917
|
+
};
|
|
918
|
+
content: {
|
|
919
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
/** @description Invalid request: validation error, quote mismatch, or expired quote */
|
|
923
|
+
400: {
|
|
924
|
+
headers: {
|
|
925
|
+
[name: string]: unknown;
|
|
926
|
+
};
|
|
927
|
+
content: {
|
|
928
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
929
|
+
};
|
|
930
|
+
};
|
|
931
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
932
|
+
401: {
|
|
933
|
+
headers: {
|
|
934
|
+
[name: string]: unknown;
|
|
935
|
+
};
|
|
936
|
+
content: {
|
|
937
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
/** @description Forbidden: missing/invalid API key, user not in company, or quote not owned by company */
|
|
941
|
+
403: {
|
|
942
|
+
headers: {
|
|
943
|
+
[name: string]: unknown;
|
|
944
|
+
};
|
|
945
|
+
content: {
|
|
946
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
/** @description Internal server error */
|
|
950
|
+
500: {
|
|
951
|
+
headers: {
|
|
952
|
+
[name: string]: unknown;
|
|
953
|
+
};
|
|
954
|
+
content: {
|
|
955
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
956
|
+
};
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
requestQuote: {
|
|
961
|
+
parameters: {
|
|
962
|
+
query?: never;
|
|
963
|
+
header?: never;
|
|
964
|
+
path?: never;
|
|
965
|
+
cookie?: never;
|
|
966
|
+
};
|
|
967
|
+
requestBody: {
|
|
968
|
+
content: {
|
|
969
|
+
"application/json": components["schemas"]["QuoteRequest"];
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
responses: {
|
|
973
|
+
/** @description Quote generated successfully */
|
|
974
|
+
200: {
|
|
975
|
+
headers: {
|
|
976
|
+
[name: string]: unknown;
|
|
977
|
+
};
|
|
978
|
+
content: {
|
|
979
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
/** @description Invalid request: validation error */
|
|
983
|
+
400: {
|
|
984
|
+
headers: {
|
|
985
|
+
[name: string]: unknown;
|
|
986
|
+
};
|
|
987
|
+
content: {
|
|
988
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
992
|
+
401: {
|
|
993
|
+
headers: {
|
|
994
|
+
[name: string]: unknown;
|
|
995
|
+
};
|
|
996
|
+
content: {
|
|
997
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
998
|
+
};
|
|
999
|
+
};
|
|
1000
|
+
/** @description Forbidden: missing/invalid API key, or user does not belong to the authorized company */
|
|
1001
|
+
403: {
|
|
1002
|
+
headers: {
|
|
1003
|
+
[name: string]: unknown;
|
|
1004
|
+
};
|
|
1005
|
+
content: {
|
|
1006
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
/** @description Internal server error */
|
|
1010
|
+
500: {
|
|
1011
|
+
headers: {
|
|
1012
|
+
[name: string]: unknown;
|
|
1013
|
+
};
|
|
1014
|
+
content: {
|
|
1015
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
};
|
|
1020
|
+
getShipmentByOrderNumber: {
|
|
1021
|
+
parameters: {
|
|
1022
|
+
query?: never;
|
|
1023
|
+
header?: never;
|
|
1024
|
+
path: {
|
|
1025
|
+
/**
|
|
1026
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
1027
|
+
* @example ZKYQ5
|
|
1028
|
+
*/
|
|
1029
|
+
orderNumber: string;
|
|
1030
|
+
};
|
|
1031
|
+
cookie?: never;
|
|
1032
|
+
};
|
|
1033
|
+
requestBody?: never;
|
|
1034
|
+
responses: {
|
|
1035
|
+
/** @description Shipment retrieved successfully */
|
|
1036
|
+
200: {
|
|
1037
|
+
headers: {
|
|
1038
|
+
[name: string]: unknown;
|
|
1039
|
+
};
|
|
1040
|
+
content: {
|
|
1041
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
/** @description Invalid request: orderNumber is required */
|
|
1045
|
+
400: {
|
|
1046
|
+
headers: {
|
|
1047
|
+
[name: string]: unknown;
|
|
1048
|
+
};
|
|
1049
|
+
content: {
|
|
1050
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
1054
|
+
401: {
|
|
1055
|
+
headers: {
|
|
1056
|
+
[name: string]: unknown;
|
|
1057
|
+
};
|
|
1058
|
+
content: {
|
|
1059
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
1063
|
+
403: {
|
|
1064
|
+
headers: {
|
|
1065
|
+
[name: string]: unknown;
|
|
1066
|
+
};
|
|
1067
|
+
content: {
|
|
1068
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
1069
|
+
};
|
|
1070
|
+
};
|
|
1071
|
+
/** @description Shipment not found */
|
|
1072
|
+
404: {
|
|
1073
|
+
headers: {
|
|
1074
|
+
[name: string]: unknown;
|
|
1075
|
+
};
|
|
1076
|
+
content: {
|
|
1077
|
+
"application/hal+json": components["schemas"]["Shipment"];
|
|
1078
|
+
};
|
|
1079
|
+
};
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
trackShipmentByOrderNumber: {
|
|
1083
|
+
parameters: {
|
|
1084
|
+
query?: never;
|
|
1085
|
+
header?: never;
|
|
1086
|
+
path: {
|
|
1087
|
+
/**
|
|
1088
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
1089
|
+
* @example ZKYQ5
|
|
1090
|
+
*/
|
|
1091
|
+
orderNumber: string;
|
|
1092
|
+
};
|
|
1093
|
+
cookie?: never;
|
|
1094
|
+
};
|
|
1095
|
+
requestBody?: never;
|
|
1096
|
+
responses: {
|
|
1097
|
+
/** @description Tracking information retrieved successfully */
|
|
1098
|
+
200: {
|
|
1099
|
+
headers: {
|
|
1100
|
+
[name: string]: unknown;
|
|
1101
|
+
};
|
|
1102
|
+
content: {
|
|
1103
|
+
"application/hal+json": components["schemas"]["Tracking"];
|
|
1104
|
+
};
|
|
1105
|
+
};
|
|
1106
|
+
/** @description Invalid request: orderNumber is required */
|
|
1107
|
+
400: {
|
|
1108
|
+
headers: {
|
|
1109
|
+
[name: string]: unknown;
|
|
1110
|
+
};
|
|
1111
|
+
content: {
|
|
1112
|
+
"application/hal+json": components["schemas"]["Tracking"];
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
1116
|
+
401: {
|
|
1117
|
+
headers: {
|
|
1118
|
+
[name: string]: unknown;
|
|
1119
|
+
};
|
|
1120
|
+
content: {
|
|
1121
|
+
"application/hal+json": components["schemas"]["Tracking"];
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
1125
|
+
403: {
|
|
1126
|
+
headers: {
|
|
1127
|
+
[name: string]: unknown;
|
|
1128
|
+
};
|
|
1129
|
+
content: {
|
|
1130
|
+
"application/hal+json": components["schemas"]["Tracking"];
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
/** @description Shipment not found */
|
|
1134
|
+
404: {
|
|
1135
|
+
headers: {
|
|
1136
|
+
[name: string]: unknown;
|
|
1137
|
+
};
|
|
1138
|
+
content: {
|
|
1139
|
+
"application/hal+json": components["schemas"]["Tracking"];
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
};
|
|
1144
|
+
getInvoice: {
|
|
1145
|
+
parameters: {
|
|
1146
|
+
query?: never;
|
|
1147
|
+
header?: never;
|
|
1148
|
+
path: {
|
|
1149
|
+
/**
|
|
1150
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
1151
|
+
* @example ZKYQ5
|
|
1152
|
+
*/
|
|
1153
|
+
orderNumber: string;
|
|
1154
|
+
};
|
|
1155
|
+
cookie?: never;
|
|
1156
|
+
};
|
|
1157
|
+
requestBody?: never;
|
|
1158
|
+
responses: {
|
|
1159
|
+
/** @description Invoice retrieved successfully */
|
|
1160
|
+
200: {
|
|
1161
|
+
headers: {
|
|
1162
|
+
[name: string]: unknown;
|
|
1163
|
+
};
|
|
1164
|
+
content: {
|
|
1165
|
+
"application/hal+json": components["schemas"]["InvoiceResponse"];
|
|
1166
|
+
};
|
|
1167
|
+
};
|
|
1168
|
+
/** @description Invalid request: orderNumber is required, or shipment is not in DELIVERED state */
|
|
1169
|
+
400: {
|
|
1170
|
+
headers: {
|
|
1171
|
+
[name: string]: unknown;
|
|
1172
|
+
};
|
|
1173
|
+
content: {
|
|
1174
|
+
"application/hal+json": components["schemas"]["InvoiceResponse"];
|
|
1175
|
+
};
|
|
1176
|
+
};
|
|
1177
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
1178
|
+
401: {
|
|
1179
|
+
headers: {
|
|
1180
|
+
[name: string]: unknown;
|
|
1181
|
+
};
|
|
1182
|
+
content: {
|
|
1183
|
+
"application/hal+json": components["schemas"]["InvoiceResponse"];
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
1187
|
+
403: {
|
|
1188
|
+
headers: {
|
|
1189
|
+
[name: string]: unknown;
|
|
1190
|
+
};
|
|
1191
|
+
content: {
|
|
1192
|
+
"application/hal+json": components["schemas"]["InvoiceResponse"];
|
|
1193
|
+
};
|
|
1194
|
+
};
|
|
1195
|
+
/** @description Shipment not found */
|
|
1196
|
+
404: {
|
|
1197
|
+
headers: {
|
|
1198
|
+
[name: string]: unknown;
|
|
1199
|
+
};
|
|
1200
|
+
content: {
|
|
1201
|
+
"application/hal+json": components["schemas"]["InvoiceResponse"];
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
getDocumentByOrderNumber: {
|
|
1207
|
+
parameters: {
|
|
1208
|
+
query?: never;
|
|
1209
|
+
header?: never;
|
|
1210
|
+
path: {
|
|
1211
|
+
/**
|
|
1212
|
+
* @description Order number (5-character alphanumeric code, commonly called PRO number)
|
|
1213
|
+
* @example ZKYQ5
|
|
1214
|
+
*/
|
|
1215
|
+
orderNumber: string;
|
|
1216
|
+
/** @description Type of document to retrieve */
|
|
1217
|
+
documentType: "BILL_OF_LADING" | "INVOICE" | "SHIPPING_LABEL";
|
|
1218
|
+
};
|
|
1219
|
+
cookie?: never;
|
|
1220
|
+
};
|
|
1221
|
+
requestBody?: never;
|
|
1222
|
+
responses: {
|
|
1223
|
+
/** @description Document URL retrieved successfully */
|
|
1224
|
+
200: {
|
|
1225
|
+
headers: {
|
|
1226
|
+
[name: string]: unknown;
|
|
1227
|
+
};
|
|
1228
|
+
content: {
|
|
1229
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
/** @description Invalid request: orderNumber and documentType are required */
|
|
1233
|
+
400: {
|
|
1234
|
+
headers: {
|
|
1235
|
+
[name: string]: unknown;
|
|
1236
|
+
};
|
|
1237
|
+
content: {
|
|
1238
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1239
|
+
};
|
|
1240
|
+
};
|
|
1241
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
1242
|
+
401: {
|
|
1243
|
+
headers: {
|
|
1244
|
+
[name: string]: unknown;
|
|
1245
|
+
};
|
|
1246
|
+
content: {
|
|
1247
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
/** @description Forbidden: missing/invalid API key, or shipment does not belong to your company */
|
|
1251
|
+
403: {
|
|
1252
|
+
headers: {
|
|
1253
|
+
[name: string]: unknown;
|
|
1254
|
+
};
|
|
1255
|
+
content: {
|
|
1256
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
/** @description Shipment or document not found */
|
|
1260
|
+
404: {
|
|
1261
|
+
headers: {
|
|
1262
|
+
[name: string]: unknown;
|
|
1263
|
+
};
|
|
1264
|
+
content: {
|
|
1265
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1266
|
+
};
|
|
1267
|
+
};
|
|
1268
|
+
/** @description Internal server error */
|
|
1269
|
+
500: {
|
|
1270
|
+
headers: {
|
|
1271
|
+
[name: string]: unknown;
|
|
1272
|
+
};
|
|
1273
|
+
content: {
|
|
1274
|
+
"application/hal+json": components["schemas"]["DocumentResponse"];
|
|
1275
|
+
};
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1279
|
+
getQuote: {
|
|
1280
|
+
parameters: {
|
|
1281
|
+
query?: never;
|
|
1282
|
+
header?: never;
|
|
1283
|
+
path: {
|
|
1284
|
+
/** @description Unique quote ID */
|
|
1285
|
+
quoteId: string;
|
|
1286
|
+
};
|
|
1287
|
+
cookie?: never;
|
|
1288
|
+
};
|
|
1289
|
+
requestBody?: never;
|
|
1290
|
+
responses: {
|
|
1291
|
+
/** @description Quote retrieved successfully */
|
|
1292
|
+
200: {
|
|
1293
|
+
headers: {
|
|
1294
|
+
[name: string]: unknown;
|
|
1295
|
+
};
|
|
1296
|
+
content: {
|
|
1297
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1298
|
+
};
|
|
1299
|
+
};
|
|
1300
|
+
/** @description Invalid request: quote ID format is invalid */
|
|
1301
|
+
400: {
|
|
1302
|
+
headers: {
|
|
1303
|
+
[name: string]: unknown;
|
|
1304
|
+
};
|
|
1305
|
+
content: {
|
|
1306
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1307
|
+
};
|
|
1308
|
+
};
|
|
1309
|
+
/** @description Unauthorized: missing or invalid Bearer token (authentication failed) */
|
|
1310
|
+
401: {
|
|
1311
|
+
headers: {
|
|
1312
|
+
[name: string]: unknown;
|
|
1313
|
+
};
|
|
1314
|
+
content: {
|
|
1315
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
/** @description Forbidden: missing, invalid, or expired API key (authorization failed) */
|
|
1319
|
+
403: {
|
|
1320
|
+
headers: {
|
|
1321
|
+
[name: string]: unknown;
|
|
1322
|
+
};
|
|
1323
|
+
content: {
|
|
1324
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1325
|
+
};
|
|
1326
|
+
};
|
|
1327
|
+
/** @description Quote not found */
|
|
1328
|
+
404: {
|
|
1329
|
+
headers: {
|
|
1330
|
+
[name: string]: unknown;
|
|
1331
|
+
};
|
|
1332
|
+
content: {
|
|
1333
|
+
"application/hal+json": components["schemas"]["QuoteResponse"];
|
|
1334
|
+
};
|
|
1335
|
+
};
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* Clean type aliases for the Oway SDK
|
|
1342
|
+
*/
|
|
1343
|
+
|
|
1344
|
+
type QuoteRequest = paths['/v1/shipper/quote']['post']['requestBody']['content']['application/json'];
|
|
1345
|
+
type ShipmentRequest = paths['/v1/shipper/shipment']['post']['requestBody']['content']['application/json'];
|
|
1346
|
+
type Quote = paths['/v1/shipper/quote']['post']['responses']['200']['content']['application/hal+json'];
|
|
1347
|
+
type Shipment = paths['/v1/shipper/shipment']['post']['responses']['200']['content']['application/hal+json'];
|
|
1348
|
+
type Tracking = paths['/v1/shipper/shipment/{orderNumber}/tracking']['get']['responses']['200']['content']['application/hal+json'];
|
|
1349
|
+
type Invoice = paths['/v1/shipper/shipment/{orderNumber}/invoice']['get']['responses']['200']['content']['application/hal+json'];
|
|
1350
|
+
type Address = components['schemas']['Address'];
|
|
1351
|
+
|
|
1352
|
+
declare class Quotes {
|
|
1353
|
+
private client;
|
|
1354
|
+
constructor(client: HttpClient);
|
|
1355
|
+
/**
|
|
1356
|
+
* Request a shipping quote
|
|
1357
|
+
* @param params Quote parameters
|
|
1358
|
+
* @param companyApiKey Optional: Specify company API key for multi-tenant integrations
|
|
1359
|
+
*/
|
|
1360
|
+
create(params: QuoteRequest, companyApiKey?: string): Promise<Quote>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Retrieve a quote by ID
|
|
1363
|
+
* @param quoteId Quote ID
|
|
1364
|
+
* @param companyApiKey Optional: Specify company API key for multi-tenant integrations
|
|
1365
|
+
*/
|
|
1366
|
+
retrieve(quoteId: string, companyApiKey?: string): Promise<Quote>;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
declare class Shipments {
|
|
1370
|
+
private client;
|
|
1371
|
+
constructor(client: HttpClient);
|
|
1372
|
+
create(params: ShipmentRequest, companyApiKey?: string): Promise<Shipment>;
|
|
1373
|
+
retrieve(orderNumber: string, companyApiKey?: string): Promise<Shipment>;
|
|
1374
|
+
confirm(orderNumber: string, companyApiKey?: string): Promise<Shipment>;
|
|
1375
|
+
cancel(orderNumber: string, companyApiKey?: string): Promise<void>;
|
|
1376
|
+
tracking(orderNumber: string, companyApiKey?: string): Promise<Tracking>;
|
|
1377
|
+
document(orderNumber: string, documentType: 'BOL' | 'INVOICE' | 'LABEL', companyApiKey?: string): Promise<{
|
|
1378
|
+
url: string;
|
|
1379
|
+
}>;
|
|
1380
|
+
invoice(orderNumber: string, companyApiKey?: string): Promise<Invoice>;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Oway API environment URLs
|
|
1385
|
+
* Use these constants instead of hardcoding URLs
|
|
1386
|
+
*/
|
|
1387
|
+
declare const OwayEnvironments: {
|
|
1388
|
+
/**
|
|
1389
|
+
* Sandbox environment for development and testing
|
|
1390
|
+
* Safe to use - no real shipments created
|
|
1391
|
+
*/
|
|
1392
|
+
readonly SANDBOX: "https://rest-api.sandbox.oway.io";
|
|
1393
|
+
/**
|
|
1394
|
+
* Production environment for live traffic
|
|
1395
|
+
* Real shipments will be created and billed
|
|
1396
|
+
*/
|
|
1397
|
+
readonly PRODUCTION: "https://rest-api.oway.io";
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Official Oway SDK for JavaScript/TypeScript
|
|
1402
|
+
*/
|
|
1403
|
+
declare class Oway {
|
|
1404
|
+
private client;
|
|
1405
|
+
readonly quotes: Quotes;
|
|
1406
|
+
readonly shipments: Shipments;
|
|
1407
|
+
constructor(config: OwayConfig);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
export { type Address, type Invoice, Oway, type OwayConfig, OwayEnvironments, OwayError, type Quote, type QuoteRequest, type Shipment, type ShipmentRequest, type Tracking, type components, Oway as default, type paths };
|