shipbob-node-sdk 0.0.3 → 0.0.5

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/dist/index.d.ts CHANGED
@@ -26,7 +26,21 @@ export type DataResponse<T> = ({
26
26
  */
27
27
  data: object | string;
28
28
  }) & {
29
+ headers: Record<string, string>;
29
30
  statusCode: number;
31
+ rateLimit: {
32
+ /**
33
+ * There are 150 calls in a sliding window of 1 minute.
34
+ *
35
+ * Retrieved from x-remaining-calls header in response.
36
+ * null when not found.
37
+ */
38
+ remainingCalls: Nullable<number>;
39
+ /**
40
+ * Seconds remaining in sliding window once rate limit has been exhausted.
41
+ */
42
+ retryAfter: Nullable<number>;
43
+ };
30
44
  };
31
45
  export type ChannelsResponse = {
32
46
  id: number;
@@ -81,209 +95,222 @@ export type GetProduct1_0Result = {
81
95
  };
82
96
  export type ActionName = 'Dispose' | 'Restock' | 'Quarantine';
83
97
  export type ProductType = 'Regular' | 'Bundle';
84
- /**
85
- * This is just some guessing based on a response
86
- */
87
- export type GetProduct2_0Result = {
88
- /**
89
- * Product Id
90
- */
91
- id: number;
98
+ type GetProduct2_0Variant = {
92
99
  /**
93
- * Product Name
100
+ * The expected barcode to be found on the item and checked during the pick process
94
101
  */
95
- name: string;
96
- type: ProductType;
97
- category: Nullable<unknown>;
98
- sub_category: Nullable<unknown>;
99
- user_id: number;
102
+ barcode: string;
103
+ barcode_sticker_url: Nullable<string>;
104
+ channel_metadata: unknown[];
105
+ reviews_pending: unknown[];
106
+ associated_bundles: unknown[];
107
+ bundle_definition: unknown[];
100
108
  created_on: string;
101
- updated_on: string;
102
- /**
103
- * null | ?
104
- */
105
- taxonomy: null;
106
- variants: {
109
+ customs: {
107
110
  /**
108
- * The expected barcode to be found on the item and checked during the pick process
111
+ * The customs code (6 digit)
109
112
  */
110
- barcode: string;
111
- barcode_sticker_url: Nullable<string>;
112
- channel_metadata: unknown[];
113
- reviews_pending: unknown[];
114
- associated_bundles: unknown[];
115
- bundle_definition: unknown[];
116
- created_on: string;
117
- customs: {
118
- /**
119
- * The customs code (6 digit)
120
- */
121
- hs_tariff_code: string;
122
- /**
123
- * 2 character country code
124
- */
125
- country_code_of_origin: string;
126
- /**
127
- * Value of object for customs (in USD)
128
- */
129
- value: Nullable<string>;
130
- currency: 'USD';
131
- /**
132
- * Description of product for customs purposes
133
- */
134
- description: string;
135
- is321_eligible: boolean;
136
- };
137
- dimension: {
138
- length: number;
139
- width: number;
140
- height: number;
141
- /**
142
- * "inch"
143
- */
144
- unit: string;
145
- is_locked: boolean;
146
- /**
147
- * ie: "UserEntry"
148
- */
149
- source: string;
150
- };
151
- fulfillment_settings: {
152
- /**
153
- * If the product requires a prop65 label in the box
154
- */
155
- requires_prop65: false;
156
- serial_scan: {
157
- /**
158
- * Indicates if a Serial Scan is required during the pack process.
159
- * Note: Serial scan requires either a prefix or a suffix to be defined
160
- */
161
- is_enabled: false;
162
- /**
163
- * The prefix expected on the serial number
164
- */
165
- prefix: string;
166
- /**
167
- * The suffix expected on the serial number
168
- */
169
- suffix: string;
170
- /**
171
- * The exact number of characters expected in the serial number
172
- */
173
- exact_character_length: Nullable<number>;
174
- };
113
+ hs_tariff_code: string;
114
+ /**
115
+ * 2 character country code
116
+ */
117
+ country_code_of_origin: string;
118
+ /**
119
+ * Value of object for customs (in USD)
120
+ */
121
+ value: Nullable<string>;
122
+ currency: 'USD';
123
+ /**
124
+ * Description of product for customs purposes
125
+ */
126
+ description: string;
127
+ is321_eligible: boolean;
128
+ };
129
+ dimension: {
130
+ length: number;
131
+ width: number;
132
+ height: number;
133
+ /**
134
+ * "inch"
135
+ */
136
+ unit: string;
137
+ is_locked: boolean;
138
+ /**
139
+ * ie: "UserEntry"
140
+ */
141
+ source: string;
142
+ };
143
+ fulfillment_settings: {
144
+ /**
145
+ * If the product requires a prop65 label in the box
146
+ */
147
+ requires_prop65: false;
148
+ serial_scan: {
175
149
  /**
176
- * If the product needs to classified as a hazmat product with the shipping carrier
150
+ * Indicates if a Serial Scan is required during the pack process.
151
+ * Note: Serial scan requires either a prefix or a suffix to be defined
177
152
  */
178
- dangerous_goods: false;
153
+ is_enabled: false;
179
154
  /**
180
- * URL of the Safety Data Sheet for this product.
181
- * Note: should be populated by ShipBob system via the UI, should not reference a URL outside of the ShipBob domain
155
+ * The prefix expected on the serial number
182
156
  */
183
- msds_url: string;
157
+ prefix: string;
184
158
  /**
185
- * If the product should be picked as an entire case
159
+ * The suffix expected on the serial number
186
160
  */
187
- is_case_pick: boolean;
161
+ suffix: string;
188
162
  /**
189
- * Is Bound Printed Matter, must be set by the ShipBob internal team
163
+ * The exact number of characters expected in the serial number
190
164
  */
191
- is_bpm_parcel: boolean;
165
+ exact_character_length: Nullable<number>;
192
166
  };
193
167
  /**
194
- * Global Trade Item Number
168
+ * If the product needs to classified as a hazmat product with the shipping carrier
195
169
  */
196
- gtin: string;
170
+ dangerous_goods: false;
197
171
  /**
198
- * Variant Id (used to alter product lot, packaging, etc.)
172
+ * URL of the Safety Data Sheet for this product.
173
+ * Note: should be populated by ShipBob system via the UI, should not reference a URL outside of the ShipBob domain
199
174
  */
200
- id: number;
201
- inventory: {
202
- inventory_id: number;
203
- on_hand_qty: number;
204
- };
205
- is_digital: boolean;
206
- lot_information: {
207
- /**
208
- * If the product should use lot date based picking
209
- */
210
- is_lot: boolean;
211
- minimum_shelf_life_days: Nullable<number>;
212
- };
175
+ msds_url: string;
213
176
  /**
214
- * Name of the Variant (should match the Product name if a non-varying product)
177
+ * If the product should be picked as an entire case
215
178
  */
216
- name: string;
179
+ is_case_pick: boolean;
217
180
  /**
218
- * PDf has wrong field: The specific material to package the product in (box, poly mailer, bubble mailer, etc_
181
+ * Is Bound Printed Matter, must be set by the ShipBob internal team
219
182
  */
220
- packaging_material_type: {
221
- id: number;
222
- /**
223
- * Not sure what else can be here
224
- */
225
- name: 'Box';
226
- };
183
+ is_bpm_parcel: boolean;
184
+ };
185
+ /**
186
+ * Global Trade Item Number
187
+ */
188
+ gtin: string;
189
+ /**
190
+ * Variant Id (used to alter product lot, packaging, etc.)
191
+ */
192
+ id: number;
193
+ inventory: {
194
+ inventory_id: number;
195
+ on_hand_qty: number;
196
+ };
197
+ is_digital: boolean;
198
+ lot_information: {
199
+ /**
200
+ * If the product should use lot date based picking
201
+ */
202
+ is_lot: boolean;
203
+ minimum_shelf_life_days: Nullable<number>;
204
+ };
205
+ /**
206
+ * Name of the Variant (should match the Product name if a non-varying product)
207
+ */
208
+ name: string;
209
+ /**
210
+ * PDf has wrong field: The specific material to package the product in (box, poly mailer, bubble mailer, etc_
211
+ */
212
+ packaging_material_type: {
213
+ id: number;
227
214
  /**
228
- * PDF has wrong field. int The id of the packaging_requirement (No requirement, fragile, ship in own container, etc)
215
+ * Not sure what else can be here
229
216
  */
230
- packaging_requirement: {
217
+ name: 'Box';
218
+ };
219
+ /**
220
+ * PDF has wrong field. int The id of the packaging_requirement (No requirement, fragile, ship in own container, etc)
221
+ */
222
+ packaging_requirement: {
223
+ id: number;
224
+ name: 'NoRequirements' | 'Fragile';
225
+ };
226
+ return_preferences: {
227
+ /**
228
+ * Restock (1) Quarantine (2) Dispose (3)
229
+ */
230
+ primary_action: Nullable<{
231
231
  id: number;
232
- name: 'NoRequirements' | 'Fragile';
233
- };
234
- return_preferences: {
235
- /**
236
- * Restock (1) Quarantine (2) Dispose (3)
237
- */
238
- primary_action: Nullable<{
239
- id: number;
240
- name: ActionName;
241
- }>;
242
- /**
243
- * Restock (1) Quarantine (2) Dispose (3)
244
- */
245
- backup_action: Nullable<{
246
- id: number;
247
- name: ActionName;
248
- }>;
249
- /**
250
- * Instructions for inspecting returns
251
- */
252
- instructions: Nullable<string>;
253
- return_to_sender_primary_action: Nullable<{
254
- id: number;
255
- name: ActionName;
256
- }>;
257
- return_to_sender_backup_action: Nullable<{
258
- id: number;
259
- name: ActionName;
260
- }>;
261
- };
232
+ name: ActionName;
233
+ }>;
262
234
  /**
263
- * The SKU of the product. This is a required field and must be unique.
235
+ * Restock (1) Quarantine (2) Dispose (3)
264
236
  */
265
- sku: string;
237
+ backup_action: Nullable<{
238
+ id: number;
239
+ name: ActionName;
240
+ }>;
266
241
  /**
267
- * PDF is incorrect - it describes in int. Active (1) or Inactive (2)
242
+ * Instructions for inspecting returns
268
243
  */
269
- status: 'Active' | 'Inactive';
244
+ instructions: Nullable<string>;
245
+ return_to_sender_primary_action: Nullable<{
246
+ id: number;
247
+ name: ActionName;
248
+ }>;
249
+ return_to_sender_backup_action: Nullable<{
250
+ id: number;
251
+ name: ActionName;
252
+ }>;
253
+ };
254
+ /**
255
+ * The SKU of the product. This is a required field and must be unique.
256
+ */
257
+ sku: string;
258
+ /**
259
+ * PDF is incorrect - it describes in int. Active (1) or Inactive (2)
260
+ */
261
+ status: 'Active' | 'Inactive';
262
+ /**
263
+ * Universal Product Code
264
+ */
265
+ upc: string;
266
+ is_image_uploaded: false;
267
+ updated_on: string;
268
+ weight: {
269
+ weight: number;
270
270
  /**
271
- * Universal Product Code
271
+ * ie: "oz"
272
272
  */
273
- upc: string;
274
- is_image_uploaded: false;
275
- updated_on: string;
276
- weight: {
277
- weight: number;
278
- /**
279
- * ie: "oz"
280
- */
281
- unit: string;
282
- };
283
- additional_hazmat_attributes: Nullable<unknown>;
284
- merge_children: [];
273
+ unit: string;
274
+ };
275
+ additional_hazmat_attributes: Nullable<unknown>;
276
+ merge_children: [];
277
+ };
278
+ /**
279
+ * This is just some guessing based on found responses
280
+ */
281
+ export type GetProduct2_0Response = {
282
+ /**
283
+ * Product Id
284
+ */
285
+ id: number;
286
+ /**
287
+ * Product Name
288
+ */
289
+ name: string;
290
+ type: ProductType;
291
+ category: Nullable<unknown>;
292
+ sub_category: Nullable<unknown>;
293
+ user_id: number;
294
+ created_on: string;
295
+ updated_on: string;
296
+ /**
297
+ * null | ?
298
+ */
299
+ taxonomy: null;
300
+ variants: GetProduct2_0Variant[];
301
+ };
302
+ export type GetProductExperimentalVariant = Omit<GetProduct2_0Variant, 'barcode'> & {
303
+ barcodes: {
304
+ value: string;
305
+ sticker_url: Nullable<string>;
285
306
  }[];
286
307
  };
308
+ /**
309
+ * Just the barcode -> barcodes on the variant seems like the only difference so far.
310
+ */
311
+ export type GetProductExperimentalResponse = Omit<GetProduct2_0Response, 'variants'> & {
312
+ variants: GetProductExperimentalVariant[];
313
+ };
287
314
  export type OrderType = 'DTC' | 'DropShip' | 'B2B' | 'Transportation';
288
315
  export type AnyProduct = ({
289
316
  /**
@@ -363,23 +390,53 @@ export type CancelOrderResponse = {
363
390
  reason: string;
364
391
  }[];
365
392
  };
366
- export type PlaceOrderResponse = {
393
+ /**
394
+ * ShipBob.Orders.StatusResolver.OrderStatus
395
+ */
396
+ export type OrderStatusType = 'Processing' | 'Exception' | 'PartiallyFulfilled' | 'Fulfilled' | 'Cancelled' | 'ImportReview';
397
+ /**
398
+ * Shipbob.CoreModels.OrderStateResolver.OrderStatusEnum
399
+ */
400
+ export type ShipmentStatusType = 'None' | 'Processing' | 'Completed' | 'Exception' | 'OnHold' | 'Cancelled' | 'CleanSweeped' | 'LabeledCreated' | 'ImportReview';
401
+ export type Order = {
402
+ /**
403
+ * Unique id of the order
404
+ */
367
405
  id: number;
368
406
  /**
407
+ * Date this order was created
408
+ *
369
409
  * ISO date. ie: "2019-08-24T14:15:22Z"
370
410
  */
371
411
  created_date: string;
372
412
  /**
413
+ * Date this order was purchase by the end user
414
+ *
373
415
  * ISO date. ie: "2019-08-24T14:15:22Z"
374
416
  */
375
- purchase_date: string;
417
+ purchase_date: Nullable<string>;
418
+ /**
419
+ * Client-defined external unique id of the order
420
+ */
376
421
  reference_id: string;
422
+ /**
423
+ * User friendly orderId or store order number that will be shown on the Orders Page. If not provided, referenceId will be used
424
+ */
377
425
  order_number: string;
378
426
  /**
379
- * probably always "Processing" - we should be able to get order status updates via webhook
427
+ * ie "Processing" when created. We should be able to get order status updates via webhook
428
+ *
429
+ * ShipBob.Orders.StatusResolver.OrderStatus
430
+ * "Processing" "Exception" "PartiallyFulfilled" "Fulfilled" "Cancelled" "ImportReview"
431
+ */
432
+ status: OrderStatusType;
433
+ /**
434
+ * Shipbob.Orders.Common.OrderType
380
435
  */
381
- status: 'Processing';
382
436
  type: OrderType;
437
+ /**
438
+ * Created by channel metadata
439
+ */
383
440
  channel: {
384
441
  id: number;
385
442
  /**
@@ -388,37 +445,125 @@ export type PlaceOrderResponse = {
388
445
  name: string;
389
446
  };
390
447
  /**
448
+ * Client-defined shipping method
449
+ *
391
450
  * ie: "Free 2-day Shipping"
392
451
  */
393
452
  shipping_method: string;
453
+ /**
454
+ * Information about the recipient of an order
455
+ */
394
456
  recipient: {
395
457
  name: string;
396
458
  address: Address;
397
459
  email: string;
398
460
  phone_number: string;
399
461
  };
462
+ /**
463
+ * List of products included in the order
464
+ *
465
+ * ShipBob.Orders.Presentation.ViewModels.ProductInfoViewModel
466
+ */
400
467
  products: {
468
+ /**
469
+ * Unique id of the product
470
+ */
401
471
  id: number;
472
+ /**
473
+ * Unique reference id of the product
474
+ */
402
475
  reference_id: string;
476
+ /**
477
+ * The quantity of this product ordered
478
+ */
403
479
  quantity: number;
404
- quantity_unit_of_measure_code: string;
480
+ /**
481
+ * Defined standard for measure for an item (each, inner pack, case, pallet). Values: EA, INP, CS and PL
482
+ */
483
+ quantity_unit_of_measure_code: Nullable<string>;
484
+ /**
485
+ * Stock keeping unit for the product
486
+ */
405
487
  sku: string;
488
+ /**
489
+ * Global Trade Item Number - unique and internationally recognized identifier assigned to item by company GS1
490
+ */
406
491
  gtin: string;
492
+ /**
493
+ * Universal Product Code - Unique external identifier
494
+ */
407
495
  upc: string;
496
+ /**
497
+ * Price for one item
498
+ */
408
499
  unit_price: number;
500
+ /**
501
+ * Numeric assignment per item. Used as a reference number for multiple purposes such as split orders, split containers, etc.
502
+ */
409
503
  external_line_id: number;
410
504
  }[];
505
+ /**
506
+ * Client-defined order tags
507
+ */
411
508
  tags: string[];
509
+ /**
510
+ * Shipments affiliated with the order
511
+ * TODO: redo this as it's a union of 2 types.
512
+ * - ShipBob.Orders.Presentation.ViewModels.ShipmentViewModel
513
+ * - ShipBob.Orders.Presentation.ViewModels.InternalShipmentViewModel
514
+ * probably good idea to use what is generated from the OpenAPI and reference here - the generated has lots of TS errors.
515
+ */
412
516
  shipments: {
517
+ /**
518
+ * The datetime of Shipment delivered to customer.
519
+ */
520
+ delivery_date: Nullable<string>;
521
+ /**
522
+ * Unique id of the shipment
523
+ */
413
524
  id: number;
525
+ /**
526
+ * Id of the order this shipment belongs to
527
+ */
414
528
  order_id: number;
529
+ /**
530
+ * Client-defined external unique id of the order this shipment belongs to
531
+ */
415
532
  reference_id: string;
533
+ /**
534
+ * Information about the recipient of a shipment
535
+ */
416
536
  recipient: {
417
537
  name: string;
418
538
  address: Address;
419
539
  email: string;
420
540
  phone_number: string;
421
541
  };
542
+ /**
543
+ * OrderStateResolver.OrderStatusEnum
544
+ */
545
+ status: ShipmentStatusType;
546
+ /**
547
+ * Tracking information for a shipment (null on creation)
548
+ */
549
+ tracking: Nullable<{
550
+ /**
551
+ * Carrier of the shipment
552
+ */
553
+ carrier: Nullable<string>;
554
+ /**
555
+ * Tracking number of the shipment
556
+ */
557
+ tracking_number: Nullable<string>;
558
+ /**
559
+ * The carrier's service which was used for this shipment
560
+ */
561
+ carrier_service: Nullable<string>;
562
+ /**
563
+ * URL to the website where a shipment can be tracked
564
+ */
565
+ tracking_url: Nullable<string>;
566
+ }[]>;
422
567
  }[];
423
568
  gift_message: string;
424
569
  shipping_terms: {
@@ -522,6 +667,39 @@ export type PlaceOrderRequest = {
522
667
  */
523
668
  type: OrderType;
524
669
  };
670
+ export type ShippingMethod = {
671
+ /**
672
+ * Unique id for shipping method
673
+ */
674
+ id: number;
675
+ /**
676
+ * Indicates if the shipping method is active
677
+ */
678
+ active: boolean;
679
+ /**
680
+ * Indicates the shipping method is a ShipBob default shipping method.
681
+ */
682
+ default: boolean;
683
+ /**
684
+ * Name of the ship method as selected by the merchant and saved in ShipBob’s database (i.e. “ground”).
685
+ *
686
+ * Corresponds to the shipping_method field in the Orders API.
687
+ */
688
+ name: string;
689
+ /**
690
+ * ShipBob.Orders.Presentation.ViewModels.ServiceLevelDetailViewModel)
691
+ */
692
+ service_level: {
693
+ /**
694
+ * Unique id for the service level
695
+ */
696
+ id: number;
697
+ /**
698
+ * The name or title of the service level
699
+ */
700
+ name: string;
701
+ };
702
+ };
525
703
  export type Webhook = {
526
704
  id: number;
527
705
  /**
@@ -605,7 +783,8 @@ export type WarehouseReceivingOrderRequest = {
605
783
  */
606
784
  inventory_id: number;
607
785
  /**
608
- * Lot number of the items in the box
786
+ * Lot number of the items in the box. Must be supplied for products that have lot set, otherwise will be:
787
+ * 422 status code "Wrong Lot Information Provided For Inventory IDs: 8619859,8619860, etc."
609
788
  */
610
789
  lot_number?: Nullable<string>;
611
790
  /**
@@ -617,6 +796,8 @@ export type WarehouseReceivingOrderRequest = {
617
796
  /**
618
797
  * Expected arrival date of all the box shipments in this receiving order
619
798
  * ie: ISO date "2019-08-24T14:15:22Z"
799
+ *
800
+ * NOTE: Must be in the future or it will generate a 422 error.
620
801
  */
621
802
  expected_arrival_date: string;
622
803
  /**
@@ -876,7 +1057,13 @@ export declare enum ReturnAction {
876
1057
  */
877
1058
  Dispose = 3
878
1059
  }
879
- export type ProductVariantRequest = {
1060
+ export type VariantRequestProductExperimental = Omit<VariantRequestProduct2_0, 'barcode'> & {
1061
+ barcodes: {
1062
+ value: string;
1063
+ sticker_url: Nullable<string>;
1064
+ }[];
1065
+ };
1066
+ export type VariantRequestProduct2_0 = {
880
1067
  /**
881
1068
  * Required for updates
882
1069
  */
@@ -920,6 +1107,10 @@ export type ProductVariantRequest = {
920
1107
  return_preferences?: {
921
1108
  primary_action_id: Nullable<ReturnAction>;
922
1109
  backup_action_id: null;
1110
+ /**
1111
+ * Cannot be set when "primary_action_id" has certain values (ie: Quarantine)
1112
+ * error: variants.return_preferences.instructions cannot be set for the selected primary action
1113
+ */
923
1114
  instructions: Nullable<string>;
924
1115
  return_to_sender_primary_action_id: Nullable<ReturnAction>;
925
1116
  return_to_sender_backup_action_id: Nullable<ReturnAction>;
@@ -932,6 +1123,212 @@ export type ProductVariantRequest = {
932
1123
  minimum_shelf_life_days: Nullable<number>;
933
1124
  };
934
1125
  };
1126
+ export type GetProductQueryStrings = {
1127
+ Page: number;
1128
+ Limit: number;
1129
+ /**
1130
+ * Regular product (1) or Bundle (2)
1131
+ */
1132
+ productTypeId: 1 | 2;
1133
+ /**
1134
+ * Active (1) or Inactive (2)
1135
+ */
1136
+ variantStatus: 1 | 2;
1137
+ /**
1138
+ * True -> at least one variant is digital
1139
+ * False -> at least one variant is not-digital
1140
+ */
1141
+ hasDigitalVariants: boolean;
1142
+ /**
1143
+ * Search by one or more Product Ids (comma separated) to return multiple products
1144
+ */
1145
+ Ids: string;
1146
+ /**
1147
+ * Search by one or more Variant Ids (comma separated) to return multiple products
1148
+ */
1149
+ VariantIds: string;
1150
+ /**
1151
+ * Search by product barcode
1152
+ */
1153
+ barcode: string;
1154
+ /**
1155
+ * Search by an exact sku
1156
+ */
1157
+ sku: string;
1158
+ /**
1159
+ * Search for products that vary or non-varying products
1160
+ */
1161
+ hasVariants: boolean;
1162
+ /**
1163
+ * Search by one or more InventoryIds (comma separated) to return multiple barcodes
1164
+ */
1165
+ InventoryId: string;
1166
+ /**
1167
+ * Search by Variant Name.
1168
+ * NOTE: Query parameters should be URL encoded such as "Green%20Shirt"
1169
+ */
1170
+ Name: string;
1171
+ /**
1172
+ * Search by matching Taxonomy (category) of the product (comma separated)
1173
+ */
1174
+ TaxonomyIds: string;
1175
+ };
1176
+ export type GetOrdersQueryStrings = {
1177
+ Page: number;
1178
+ Limit: number;
1179
+ /**
1180
+ * order ids to filter by, comma separated
1181
+ */
1182
+ Ids: string;
1183
+ /**
1184
+ * Reference ids to filter by, comma separated
1185
+ */
1186
+ ReferenceIds: string;
1187
+ /**
1188
+ * Start date to filter orders inserted later than
1189
+ */
1190
+ StartDate: string;
1191
+ /**
1192
+ * End date to filter orders inserted earlier than
1193
+ */
1194
+ EndDate: string;
1195
+ /**
1196
+ * Order to sort results in
1197
+ */
1198
+ SortOrder: 'Newest' | 'Oldest';
1199
+ /**
1200
+ * Has any portion of this order been assigned a tracking number
1201
+ */
1202
+ HasTracking: boolean;
1203
+ /**
1204
+ * Start date to filter orders updated later than
1205
+ */
1206
+ LastUpdateStartDate: string;
1207
+ /**
1208
+ * End date to filter orders updated later than
1209
+ */
1210
+ LastUpdateEndDate: string;
1211
+ /**
1212
+ * Filter orders that their tracking information was fully uploaded
1213
+ */
1214
+ IsTrackingUploaded: boolean;
1215
+ /**
1216
+ * Start date to filter orders with tracking updates later than the supplied date. Will only return orders that have tracking information
1217
+ */
1218
+ LastTrackingUpdateStartDate: string;
1219
+ /**
1220
+ * End date to filter orders updated later than the supplied date. Will only return orders that have tracking information
1221
+ */
1222
+ LastTrackingUpdateEndDate: string;
1223
+ };
1224
+ export type ExperimentalPagedResult<T> = {
1225
+ /**
1226
+ * Will be null when there are no items
1227
+ */
1228
+ first: Nullable<string>;
1229
+ next: Nullable<string>;
1230
+ items: T[];
1231
+ prev: Nullable<string>;
1232
+ /**
1233
+ * Will be null when there are no items.
1234
+ */
1235
+ last: Nullable<string>;
1236
+ };
1237
+ export type GetInventory1_0Result = {
1238
+ id: number;
1239
+ name: string;
1240
+ is_digital: boolean;
1241
+ is_case_pick: boolean;
1242
+ is_lot: boolean;
1243
+ dimensions: {
1244
+ weight: number;
1245
+ length: number;
1246
+ width: number;
1247
+ depth: number;
1248
+ };
1249
+ /**
1250
+ * Total fulfillable quantity of this inventory item
1251
+ */
1252
+ total_fulfillable_quantity: number;
1253
+ /**
1254
+ * Total onhand quantity of this inventory item
1255
+ */
1256
+ total_onhand_quantity: number;
1257
+ /**
1258
+ * Total committed quantity of this inventory item
1259
+ */
1260
+ total_committed_quantity: number;
1261
+ /**
1262
+ * Total quantity that can be sold without overselling the inventory item. This is calculated by subtracting the total exception quantity from the fulfillable quantity.
1263
+ */
1264
+ total_sellable_quantity: number;
1265
+ /**
1266
+ * Total quantity in unreceived receiving orders for this inventory item
1267
+ */
1268
+ total_awaiting_quantity: number;
1269
+ /**
1270
+ * The total quantity of all items that are contained within orders that are in exception/out of stock status. Out of stock orders have not been processed and therefore do not have lot or fulfillment centers assigned.
1271
+ */
1272
+ total_exception_quantity: number;
1273
+ /**
1274
+ * The total quantity of all items that are in the process of internal transit between ShipBob fulfillment centers. These items are not pickable or fulfillable until they have been received and moved to the "On Hand" quantity of the destination FC. Internal transit quantities for each FC represent the incoming transfer stock for that specific location.
1275
+ */
1276
+ total_internal_transfer_quantity: number;
1277
+ /**
1278
+ * The amount of the item you need to send to ShipBob to fulfill all exception orders containing the item. This is the exception_quantity less the fulfillable_quantity of the item.
1279
+ */
1280
+ total_backordered_quantity: number;
1281
+ /**
1282
+ * Whether the inventory is active or not
1283
+ */
1284
+ is_active: boolean;
1285
+ /**
1286
+ * Fulfillable quantity of this inventory item broken down by fulfillment center location
1287
+ */
1288
+ fulfillable_quantity_by_fulfillment_center: {
1289
+ id: number;
1290
+ name: string;
1291
+ fulfillable_quantity: number;
1292
+ onhand_quantity: number;
1293
+ committed_quantity: number;
1294
+ awaiting_quantity: number;
1295
+ internal_transfer_quantity: number;
1296
+ }[];
1297
+ /**
1298
+ * Fulfillable quantity of this inventory item broken down by lot
1299
+ */
1300
+ fulfillable_quantity_by_lot: {
1301
+ lot_number: string;
1302
+ /**
1303
+ * ie: "2019-08-24T14:15:22Z"
1304
+ */
1305
+ expiration_date: string;
1306
+ fulfillable_quantity: number;
1307
+ onhand_quantity: number;
1308
+ committed_quantity: number;
1309
+ awaiting_quantity: number;
1310
+ internal_transfer_quantity: number;
1311
+ fulfillable_quantity_by_fulfillment_center: {
1312
+ id: number;
1313
+ name: string;
1314
+ fulfillable_quantity: number;
1315
+ onhand_quantity: number;
1316
+ committed_quantity: number;
1317
+ awaiting_quantity: number;
1318
+ internal_transfer_quantity: number;
1319
+ }[];
1320
+ }[];
1321
+ /**
1322
+ * ie: "None" "Fragile" "Foldable" "Stackable" "Book" "CustomPackaging" "CustomDunnage" "MarketingInsert" or "Poster"
1323
+ */
1324
+ packaging_attribute: 'None' | 'Fragile' | 'Foldable' | 'Stackable' | 'Book' | 'CustomPackaging' | 'CustomDunnage' | 'MarketingInsert' | 'Poster';
1325
+ };
1326
+ export type CreateOptions = {
1327
+ /**
1328
+ * console.log HTTP traffic (http verb + endpoint)
1329
+ */
1330
+ logTraffic: boolean;
1331
+ };
935
1332
  /**
936
1333
  * Create API with PAT (personal access token) - defaults to sandbox endpoints and "SMA" channel.
937
1334
  *
@@ -942,9 +1339,14 @@ export type ProductVariantRequest = {
942
1339
  * @param personalAccessToken passing *undefined* or empty string has a guar clause that will throw
943
1340
  * @param apiBaseUrl
944
1341
  * @param channelApplicationName
1342
+ * @param options
945
1343
  * @returns
946
1344
  */
947
- export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string) => Promise<{
1345
+ export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string, options?: CreateOptions) => Promise<{
1346
+ /**
1347
+ * You would need a product id on your side. Not sure how useful this is in all practicality unless
1348
+ * you maintain the association on your side.
1349
+ */
948
1350
  getProductById: (productId: number) => Promise<DataResponse<GetProduct1_0Result>>;
949
1351
  getProducts1_0: (query: Partial<{
950
1352
  ReferenceIds: string;
@@ -956,10 +1358,20 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
956
1358
  BundleStatus: "Any" | "Bundle" | "NotBundle";
957
1359
  }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
958
1360
  /**
1361
+ * NOTE: you need to use the headers (part of this client response) to page the results.
1362
+ * page-number='1'
1363
+ * page-size='50'
1364
+ * total-count='1'
1365
+ * total-pages='1'
1366
+ *
959
1367
  * NOTE: we can probably pass more than "variants" prop. We could on the /1.0/product endpoint
960
1368
  * NOTE: This PATCH functionality will be available in the next version available in ShipBob next large release January 2025, it may require extra scope.
961
1369
  */
962
- updateProducts2_0: (productId: number, variants: ProductVariantRequest[]) => Promise<DataResponse<AddProductResponse>>;
1370
+ updateProduct2_0: (productId: number, variants: VariantRequestProduct2_0[]) => Promise<DataResponse<AddProductResponse>>;
1371
+ /**
1372
+ * Unsure how this is different from /2.0/product except for "barcode" -> "barcodes"
1373
+ */
1374
+ updateProductExperimental: (productId: number, variants: VariantRequestProductExperimental[]) => Promise<DataResponse<AddProductResponse>>;
963
1375
  /**
964
1376
  * Not supported here, but:
965
1377
  * Some search filters allow for operators (equals, not equals, starts with, ends with, contains, etc) to get more exact values. When filtering with an operator, the query string will look like the below:
@@ -967,56 +1379,11 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
967
1379
  * Example: /product?sku=any:shirt-a,shirt-b,shirt-c Find products that match any of these SKUs
968
1380
  * Example: /product?onHandQuantity=gt:0 Find products where OnHandQty greater than 0
969
1381
  */
970
- getProducts2_0: (query: Partial<{
971
- Page: number;
972
- Limit: number;
973
- /**
974
- * Regular product (1) or Bundle (2)
975
- */
976
- productTypeId: 1 | 2;
977
- /**
978
- * Active (1) or Inactive (2)
979
- */
980
- variantStatus: 1 | 2;
981
- /**
982
- * True -> at least one variant is digital
983
- * False -> at least one variant is not-digital
984
- */
985
- hasDigitalVariants: boolean;
986
- /**
987
- * Search by one or more Product Ids (comma separated) to return multiple products
988
- */
989
- Ids: string;
990
- /**
991
- * Search by one or more Variant Ids (comma separated) to return multiple products
992
- */
993
- VariantIds: string;
994
- /**
995
- * Search by product barcode
996
- */
997
- barcode: string;
998
- /**
999
- * Search by an exact sku
1000
- */
1001
- sku: string;
1002
- /**
1003
- * Search for products that vary or non-varying products
1004
- */
1005
- hasVariants: boolean;
1006
- /**
1007
- * Search by one or more InventoryIds (comma separated) to return multiple barcodes
1008
- */
1009
- InventoryId: string;
1010
- /**
1011
- * Search by Variant Name.
1012
- * NOTE: Query parameters should be URL encoded such as "Green%20Shirt"
1013
- */
1014
- Name: string;
1015
- /**
1016
- * Search by matching Taxonomy (category) of the product (comma separated)
1017
- */
1018
- TaxonomyIds: string;
1019
- }>) => Promise<DataResponse<GetProduct2_0Result[]>>;
1382
+ getProducts2_0: (query: Partial<GetProductQueryStrings>) => Promise<DataResponse<GetProduct2_0Response[]>>;
1383
+ /**
1384
+ * Note sure how this is different from /2.0/product. Only notable difference is "barcodes" type from string to object.
1385
+ */
1386
+ getProductsExperimental: (query: Partial<GetProductQueryStrings>) => Promise<DataResponse<ExperimentalPagedResult<GetProductExperimentalResponse>>>;
1020
1387
  createProduct1_0: (product: {
1021
1388
  reference_id: string;
1022
1389
  sku: string;
@@ -1027,21 +1394,46 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1027
1394
  * The request part for variant is not accurate. This is just for testing - there are no official docs.
1028
1395
  */
1029
1396
  createProduct2_0: (product: {
1030
- reference_id: string;
1031
- sku: string;
1032
1397
  type_id: number;
1033
1398
  name: string;
1034
- variants: ProductVariantRequest[];
1399
+ variants: VariantRequestProduct2_0[];
1400
+ }) => Promise<DataResponse<AddProductResponse>>;
1401
+ /**
1402
+ * Unsure how this is different from '2.0/product' except for "barcode" -> "barcodes"
1403
+ */
1404
+ createProductExperimental: (product: {
1405
+ type_id: number;
1406
+ name: string;
1407
+ variants: VariantRequestProductExperimental[];
1035
1408
  }) => Promise<DataResponse<AddProductResponse>>;
1036
- placeOrder: (order: PlaceOrderRequest) => Promise<DataResponse<PlaceOrderResponse>>;
1409
+ /**
1410
+ * Look in the returned headers to get paging information.
1411
+ */
1412
+ getOrders: (query: Partial<GetOrdersQueryStrings>) => Promise<DataResponse<Order[]>>;
1413
+ placeOrder: (order: PlaceOrderRequest) => Promise<DataResponse<Order>>;
1037
1414
  /**
1038
1415
  * Cancel single Order by Order Id
1039
1416
  *
1040
1417
  * @param orderId The order Id to cancel
1041
1418
  */
1042
1419
  cancelSingleOrderByOrderId: (orderId: number) => Promise<DataResponse<CancelOrderResponse>>;
1043
- getWebhooks: () => Promise<DataResponse<Webhook[][]>>;
1044
- createWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">) => Promise<DataResponse<Webhook>>;
1420
+ getShippingMethods: () => Promise<DataResponse<ShippingMethod[]>>;
1421
+ getWebhooks: () => Promise<DataResponse<Webhook[]>>;
1422
+ /**
1423
+ *
1424
+ * @param webhook
1425
+ * @param sendChannelId defaults `true`. Not providing channel id will (I think) subscribe to all channels. You need to match when unsubscribing.
1426
+ * @returns
1427
+ */
1428
+ registerWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
1429
+ /**
1430
+ * Can generate 500 response with data: "The wait operation timed out." If so, check your channel id (or lack thereof) matches the subscription registration.
1431
+ *
1432
+ * @param id channelId from getWebhooks()
1433
+ * @param sendChannelId defaults `true`. You need to match this with when you subscribed. There's no way to see this anywhere.
1434
+ * @returns
1435
+ */
1436
+ unregisterWebhookSubscription: (id: number, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
1045
1437
  getFulfillmentCenters: () => Promise<DataResponse<FulfillmentCenter[]>>;
1046
1438
  createWarehouseReceivingOrder: (request: WarehouseReceivingOrderRequest) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
1047
1439
  getWarehouseReceivingOrder: (orderId: number) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
@@ -1095,7 +1487,7 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1095
1487
  * LocationType is valid for hub, spoke, or lts. LocationType will default to all locations.
1096
1488
  */
1097
1489
  LocationType: string;
1098
- }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
1490
+ }>) => Promise<DataResponse<GetInventory1_0Result[]>>;
1099
1491
  /**
1100
1492
  * Only for sandbox: https://developer.shipbob.com/sandbox-simulations/
1101
1493
  *
@@ -1110,3 +1502,4 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1110
1502
  */
1111
1503
  getSimulationStatus: (simulationId: string) => Promise<DataResponse<SimulationResponse>>;
1112
1504
  }>;
1505
+ export {};