shipbob-node-sdk 0.0.1 → 0.0.3

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.
@@ -0,0 +1,1112 @@
1
+ export type Nullable<T> = T | null;
2
+ export declare enum WebhookTopic {
3
+ OrderShipped = "order_shipped",
4
+ ShipmentDelivered = "shipment_delivered",
5
+ ShipmentException = "shipment_exception",
6
+ ShipmentOnHold = "shipment_onhold",
7
+ ShipmentCancelled = "shipment_cancelled"
8
+ }
9
+ export type Credentials = {
10
+ token: string;
11
+ channelId?: number;
12
+ };
13
+ export type DataResponse<T> = ({
14
+ /**
15
+ * HTTP status code received was in 200's.
16
+ */
17
+ success: true;
18
+ data: T;
19
+ } | {
20
+ /**
21
+ * HTTP status code not in 200s (ie: 302 (auth redirect - check location header), 422 (validation), 524 (cloudflare))
22
+ */
23
+ success: false;
24
+ /**
25
+ * for 422 is Record<keyof T, string[]>?
26
+ */
27
+ data: object | string;
28
+ }) & {
29
+ statusCode: number;
30
+ };
31
+ export type ChannelsResponse = {
32
+ id: number;
33
+ name: string;
34
+ application_name: string;
35
+ scopes: string[];
36
+ }[];
37
+ export type Address = {
38
+ /**
39
+ * First line of the address
40
+ */
41
+ address1: string;
42
+ /**
43
+ * Second line of the address
44
+ */
45
+ address2?: Nullable<string>;
46
+ /**
47
+ * Name of the company receiving the shipment
48
+ */
49
+ company_name?: Nullable<string>;
50
+ /**
51
+ * The city
52
+ */
53
+ city: Required<string>;
54
+ /**
55
+ * The state or province
56
+ * Not required, but not all countries have state/province
57
+ */
58
+ state: Nullable<string>;
59
+ /**
60
+ * The country (Must be ISO Alpha-2 for estimates)
61
+ */
62
+ country: string;
63
+ /**
64
+ * The zip code or postal code
65
+ */
66
+ zip_code: string;
67
+ };
68
+ /**
69
+ * Returns also everything else including onhand, etc. Stuff that makes no sense at this point.
70
+ */
71
+ export type AddProductResponse = {
72
+ id: number;
73
+ reference_id: string;
74
+ };
75
+ /**
76
+ * This is missing practically all fields of actual result.
77
+ */
78
+ export type GetProduct1_0Result = {
79
+ id: number;
80
+ reference_id: string;
81
+ };
82
+ export type ActionName = 'Dispose' | 'Restock' | 'Quarantine';
83
+ 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;
92
+ /**
93
+ * Product Name
94
+ */
95
+ name: string;
96
+ type: ProductType;
97
+ category: Nullable<unknown>;
98
+ sub_category: Nullable<unknown>;
99
+ user_id: number;
100
+ created_on: string;
101
+ updated_on: string;
102
+ /**
103
+ * null | ?
104
+ */
105
+ taxonomy: null;
106
+ variants: {
107
+ /**
108
+ * The expected barcode to be found on the item and checked during the pick process
109
+ */
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
+ };
175
+ /**
176
+ * If the product needs to classified as a hazmat product with the shipping carrier
177
+ */
178
+ dangerous_goods: false;
179
+ /**
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
182
+ */
183
+ msds_url: string;
184
+ /**
185
+ * If the product should be picked as an entire case
186
+ */
187
+ is_case_pick: boolean;
188
+ /**
189
+ * Is Bound Printed Matter, must be set by the ShipBob internal team
190
+ */
191
+ is_bpm_parcel: boolean;
192
+ };
193
+ /**
194
+ * Global Trade Item Number
195
+ */
196
+ gtin: string;
197
+ /**
198
+ * Variant Id (used to alter product lot, packaging, etc.)
199
+ */
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
+ };
213
+ /**
214
+ * Name of the Variant (should match the Product name if a non-varying product)
215
+ */
216
+ name: string;
217
+ /**
218
+ * PDf has wrong field: The specific material to package the product in (box, poly mailer, bubble mailer, etc_
219
+ */
220
+ packaging_material_type: {
221
+ id: number;
222
+ /**
223
+ * Not sure what else can be here
224
+ */
225
+ name: 'Box';
226
+ };
227
+ /**
228
+ * PDF has wrong field. int The id of the packaging_requirement (No requirement, fragile, ship in own container, etc)
229
+ */
230
+ packaging_requirement: {
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
+ };
262
+ /**
263
+ * The SKU of the product. This is a required field and must be unique.
264
+ */
265
+ sku: string;
266
+ /**
267
+ * PDF is incorrect - it describes in int. Active (1) or Inactive (2)
268
+ */
269
+ status: 'Active' | 'Inactive';
270
+ /**
271
+ * Universal Product Code
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: [];
285
+ }[];
286
+ };
287
+ export type OrderType = 'DTC' | 'DropShip' | 'B2B' | 'Transportation';
288
+ export type AnyProduct = ({
289
+ /**
290
+ * Unique reference id of the product
291
+ */
292
+ reference_id: string;
293
+ /**
294
+ * Name of the product. Required if there is not an existing ShipBob product with a matching reference_id value.
295
+ */
296
+ name?: Nullable<string>;
297
+ /**
298
+ * Global Trade Item Number - unique and internationally recognized identifier assigned to item by company GS1 (0-50 chars)
299
+ */
300
+ gtin?: Nullable<string>;
301
+ /**
302
+ * Universal Product Code - Unique external identifier
303
+ */
304
+ upc?: Nullable<string>;
305
+ /**
306
+ * Price for one item
307
+ */
308
+ unit_price?: Nullable<number>;
309
+ /**
310
+ * Product SKU
311
+ */
312
+ sku?: Nullable<string>;
313
+ } & {
314
+ /**
315
+ * Unique Id of the product. Not sure who would track **their** product ids..
316
+ */
317
+ id: number;
318
+ }) | {
319
+ /**
320
+ * Numeric assignment per item. Used as a reference number for multiple purposes such as split orders, split containers, etc.
321
+ */
322
+ external_line_id?: number;
323
+ /**
324
+ * The quantity of this product ordered
325
+ * (< 2147483647 LOL)
326
+ */
327
+ quantity: number;
328
+ /**
329
+ * Defined standard for measure for an item (each, inner pack, case, pallet). Values: EA, INP, CS and PL
330
+ */
331
+ quantity_unit_of_measure_code?: Nullable<string>;
332
+ required_lot?: {
333
+ lot_number: Nullable<string>;
334
+ /**
335
+ * string or null <date-time>
336
+ * Manually specified lot date
337
+ */
338
+ lot_date: Nullable<string>;
339
+ };
340
+ };
341
+ export type CancelOrderResponse = {
342
+ order_id: number;
343
+ order: {
344
+ id: number;
345
+ reference_id: string;
346
+ order_number: string;
347
+ status: string;
348
+ };
349
+ /**
350
+ * ie: "Success"
351
+ */
352
+ status: string;
353
+ canceled_shipment_results: {
354
+ /**
355
+ * ie: "Cancel". The docs are wrong. This is actually a number like 6.
356
+ */
357
+ action: number;
358
+ shipment_id: number;
359
+ is_success: boolean;
360
+ /**
361
+ * ie: "Order cancelled"
362
+ */
363
+ reason: string;
364
+ }[];
365
+ };
366
+ export type PlaceOrderResponse = {
367
+ id: number;
368
+ /**
369
+ * ISO date. ie: "2019-08-24T14:15:22Z"
370
+ */
371
+ created_date: string;
372
+ /**
373
+ * ISO date. ie: "2019-08-24T14:15:22Z"
374
+ */
375
+ purchase_date: string;
376
+ reference_id: string;
377
+ order_number: string;
378
+ /**
379
+ * probably always "Processing" - we should be able to get order status updates via webhook
380
+ */
381
+ status: 'Processing';
382
+ type: OrderType;
383
+ channel: {
384
+ id: number;
385
+ /**
386
+ * ie: "ShipBobs-Shopify-Store"
387
+ */
388
+ name: string;
389
+ };
390
+ /**
391
+ * ie: "Free 2-day Shipping"
392
+ */
393
+ shipping_method: string;
394
+ recipient: {
395
+ name: string;
396
+ address: Address;
397
+ email: string;
398
+ phone_number: string;
399
+ };
400
+ products: {
401
+ id: number;
402
+ reference_id: string;
403
+ quantity: number;
404
+ quantity_unit_of_measure_code: string;
405
+ sku: string;
406
+ gtin: string;
407
+ upc: string;
408
+ unit_price: number;
409
+ external_line_id: number;
410
+ }[];
411
+ tags: string[];
412
+ shipments: {
413
+ id: number;
414
+ order_id: number;
415
+ reference_id: string;
416
+ recipient: {
417
+ name: string;
418
+ address: Address;
419
+ email: string;
420
+ phone_number: string;
421
+ };
422
+ }[];
423
+ gift_message: string;
424
+ shipping_terms: {
425
+ /**
426
+ * ie: "Parcel"
427
+ */
428
+ carrier_type: CarrierShipType;
429
+ payment_term: PaymentShipTerm;
430
+ };
431
+ };
432
+ export type PaymentShipTerm = 'Collect' | 'ThirdParty' | 'Prepaid' | 'MerchantResponsible';
433
+ export type CarrierShipType = 'Parcel' | 'Freight';
434
+ export type PlaceOrderRequest = {
435
+ /**
436
+ * User friendly orderId or store order number that will be shown on the Orders Page. If not provided, referenceId will be used (<= 400 characters)
437
+ */
438
+ order_number: Nullable<string>;
439
+ recipient: {
440
+ name: string;
441
+ address: Address;
442
+ /**
443
+ * Email address of the recipient
444
+ */
445
+ email?: Nullable<string>;
446
+ /**
447
+ * Phone number of the recipient (<= 50 characters)
448
+ */
449
+ phone_number?: Nullable<string>;
450
+ };
451
+ /**
452
+ * Products included in the order. Products identified by reference_id must also include the product name if there is no matching ShipBob product.
453
+ */
454
+ products: AnyProduct[];
455
+ /**
456
+ * Unique and immutable order identifier from your upstream system.
457
+ *
458
+ * Discussions with Simon. This is a forever unique identifier. ie: cannot be an IC order number like 18888888 - we could not reship.
459
+ *
460
+ * NOTE: reusing generates 422 error: "Cannot insert order with existing ReferenceId"
461
+ */
462
+ reference_id: string;
463
+ /**
464
+ * Contains properties that needs to be used for fulfilling B2B/Dropship orders.
465
+ */
466
+ retailer_program_data?: {
467
+ /**
468
+ * First initial documentation sent from buyer to seller with item(s) and quantities.
469
+ */
470
+ purchase_order_number: string;
471
+ /**
472
+ * Identifies retailer-merchant combination
473
+ */
474
+ retailer_program_type: string;
475
+ /**
476
+ * Store Number
477
+ */
478
+ mark_for_store?: Nullable<string>;
479
+ /**
480
+ * Identifies a merchant's store department
481
+ */
482
+ department?: Nullable<string>;
483
+ /**
484
+ * Expected delivery date
485
+ */
486
+ delivery_date?: Nullable<string>;
487
+ /**
488
+ * Customer Ticket Number
489
+ */
490
+ customer_ticket_number?: Nullable<string>;
491
+ /**
492
+ * The date the retailer has requested the order to ship by.
493
+ */
494
+ shipByDate?: Nullable<string>;
495
+ /**
496
+ * The date the retailer does not want the order shipped by.
497
+ */
498
+ doNotShipBeforeDate?: Nullable<string>;
499
+ };
500
+ /**
501
+ * Client-defined shipping method matching what the user has listed as the shipping method on the Ship Option Mapping setup page in the ShipBob Merchant Portal.
502
+ * If they don’t match, we will create a new one and default it to Standard
503
+ * (non-empty)
504
+ * ie: "Standard"
505
+ */
506
+ shipping_method: string;
507
+ /**
508
+ * Contains shipping properties that need to be used for fulfilling an order.
509
+ */
510
+ shipping_terms?: {
511
+ /**
512
+ * CarrierShipType: Enum: "Parcel" "Freight"
513
+ */
514
+ carrier_type: CarrierShipType;
515
+ /**
516
+ * PaymentShipTerm
517
+ */
518
+ payment_term: PaymentShipTerm;
519
+ };
520
+ /**
521
+ * Enum: "DTC" "DropShip" "B2B" "Transportation"
522
+ */
523
+ type: OrderType;
524
+ };
525
+ export type Webhook = {
526
+ id: number;
527
+ /**
528
+ * ISO date format: "2025-02-14T22:21:33.4911731"
529
+ */
530
+ created_at: string;
531
+ /**
532
+ * The subscription topic for the webhook
533
+ */
534
+ topic: WebhookTopic;
535
+ /**
536
+ * This is what we provided to them.
537
+ */
538
+ subscription_url: string;
539
+ };
540
+ export type FulfillmentCenter = {
541
+ id: number;
542
+ /**
543
+ * ie: "Cicero (IL)"
544
+ */
545
+ name: string;
546
+ /**
547
+ * ie: "Central Standard Time"
548
+ */
549
+ timezone: string;
550
+ address1: string;
551
+ address2: string;
552
+ city: string;
553
+ /**
554
+ * ie: "IL"
555
+ */
556
+ state: string;
557
+ /**
558
+ * ie: "USA"
559
+ */
560
+ country: string;
561
+ zip_code: string;
562
+ phone_number: string;
563
+ email: string;
564
+ };
565
+ export type PackageType = 'Package' | 'Pallet' | 'FloorLoadedContainer';
566
+ export type BoxPackagingType = 'EverythingInOneBox' | 'OneSkuPerBox' | 'MultipleSkuPerBox';
567
+ /**
568
+ * The receiving order to create
569
+ */
570
+ export type WarehouseReceivingOrderRequest = {
571
+ /**
572
+ * Model containing information that assigns a receiving order to a fulfillment center.
573
+ * If the fulfillment center provided is in a receiving hub region, then the response will be the receiving hub location.
574
+ */
575
+ fulfillment_center: {
576
+ /**
577
+ * ID of the fulfillment center to assign this receiving order to
578
+ */
579
+ id: number;
580
+ };
581
+ package_type: PackageType;
582
+ box_packaging_type: BoxPackagingType;
583
+ /**
584
+ * Box shipments to be added to this receiving order
585
+ */
586
+ boxes: {
587
+ /**
588
+ * Tracking number for the box shipment.
589
+ *
590
+ * The API docs say "string or null", but if you pass null will get a 400: Boxes[...] 'The TrackingNumber field is required.'
591
+ */
592
+ tracking_number: string;
593
+ /**
594
+ * Items contained in this box
595
+ */
596
+ box_items: {
597
+ /**
598
+ * Quantity of the items in the box
599
+ *
600
+ * NOTE: integer <int32> [ 1 .. 2147483647 ]. LOL. 2 billion
601
+ */
602
+ quantity: number;
603
+ /**
604
+ * Unique inventory id of the items in the box
605
+ */
606
+ inventory_id: number;
607
+ /**
608
+ * Lot number of the items in the box
609
+ */
610
+ lot_number?: Nullable<string>;
611
+ /**
612
+ * Lot expiration date for the items in the box
613
+ */
614
+ lot_date?: Nullable<string>;
615
+ }[];
616
+ }[];
617
+ /**
618
+ * Expected arrival date of all the box shipments in this receiving order
619
+ * ie: ISO date "2019-08-24T14:15:22Z"
620
+ */
621
+ expected_arrival_date: string;
622
+ /**
623
+ * Purchase order number for this receiving order,
624
+ *
625
+ * NOTE: Supporting idempotency this must be unique across WROs
626
+ * Otherwise 422: "Request could not be completed, PO reference already exists and must be a unique value"
627
+ */
628
+ purchase_order_number?: Nullable<string>;
629
+ };
630
+ export type ReceivingStatus = 'Awaiting' | 'Processing' | 'Completed' | 'Cancelled' | 'Incomplete' | 'Arrived' | 'PartiallyArrived' | 'PartiallyArrivedAtHub' | 'ArrivedAtHub' | 'ProcessingAtHub' | 'InternalTransfer';
631
+ export type WarehouseReceivingOrderResponse = {
632
+ id: number;
633
+ /**
634
+ * Not sure what these could be. "Awaiting" is a staging status.
635
+ */
636
+ status: ReceivingStatus;
637
+ /**
638
+ * What was sent in the request
639
+ */
640
+ package_type: PackageType;
641
+ /**
642
+ * What was sent in the request
643
+ */
644
+ box_packaging_type: BoxPackagingType;
645
+ /**
646
+ * What was sent in the request (ISO date)
647
+ */
648
+ expected_arrival_date: string;
649
+ /**
650
+ * ISO date: "2025-02-18T19:25:13.034265+00:00"
651
+ */
652
+ insert_date: string;
653
+ /**
654
+ * ISO date
655
+ */
656
+ last_updated_date: string;
657
+ /**
658
+ * ie: "/2.0/receiving/442945/labels"
659
+ */
660
+ box_labels_uri: string;
661
+ fulfillment_center: FulfillmentCenter;
662
+ purchase_order_number: Nullable<string>;
663
+ inventory_quantities: {
664
+ inventory_id: number;
665
+ sku: string;
666
+ expected_quantity: number;
667
+ received_quantity: number;
668
+ stowed_quantity: number;
669
+ }[];
670
+ /**
671
+ * The timestamp in UTC when a 3rd party integrator has set in ShipBob system
672
+ *
673
+ * We set this in their receiving-extended API endpoints. Use case is for acknowledging completed orders.
674
+ * Their API has example: "2019-08-24T14:15:22Z"
675
+ */
676
+ external_sync_timestamp: Nullable<string>;
677
+ };
678
+ /**
679
+ * The simulation will work on our SandBox Environment.
680
+ */
681
+ export type Simulation = {
682
+ /**
683
+ * Identifies what action to perform on shipment.
684
+ */
685
+ action: 'ShipOrder' | 'DeliverOrder';
686
+ /**
687
+ * Delay time for action in minutes to be triggered after.
688
+ *
689
+ * NOTE: anything over 2880 will be clamped
690
+ */
691
+ delay?: Nullable<number>;
692
+ /**
693
+ * Next simulation action to be performed after it.
694
+ */
695
+ next?: Nullable<SimulateShipmentRequest>;
696
+ };
697
+ export type SimulateShipmentRequest = {
698
+ /**
699
+ * Shipment Id for simulation.
700
+ */
701
+ shipment_id: number;
702
+ /**
703
+ * Simulation actions object.
704
+ */
705
+ simulation: Simulation;
706
+ };
707
+ export type SimulateShipmentResponse = {
708
+ /**
709
+ * Simulation id for register simulation request.
710
+ * UUID ie: 439a9dec-9bff-4339-9564-89975d3a8f5c
711
+ */
712
+ simulation_id: string;
713
+ /**
714
+ * ie: "Simulation registered successfully"
715
+ */
716
+ message: string;
717
+ };
718
+ export type SimulationDetails = {
719
+ /**
720
+ * Identifies the action that was performed.
721
+ */
722
+ action: 'ShipOrder' | 'DeliverOrder';
723
+ /**
724
+ * Status of the simulation action.
725
+ */
726
+ status: 'Success' | 'Failed' | 'Pending' | 'Skipped';
727
+ /**
728
+ * Additional message for the action.
729
+ *
730
+ * ie:
731
+ * - "This simulated action has been completed successfully."
732
+ * - "This simulation action is not executed yet."
733
+ */
734
+ message: string;
735
+ /**
736
+ * Scheduled time if the action had a delay.
737
+ * ie: ISO date '2025-02-19T00:09:53.77' or NULL
738
+ */
739
+ schedule_time: Nullable<string>;
740
+ /**
741
+ * Nested object with details of subsequent simulation actions. This value would be null if there is no subsequent action.
742
+ */
743
+ next: Nullable<SimulationDetails>;
744
+ };
745
+ export type SimulationResponse = {
746
+ /**
747
+ * Simulation id for register simulation request.
748
+ */
749
+ simulation_id: string;
750
+ /**
751
+ * ID of the entity for which the simulation was registered.
752
+ */
753
+ entity_id: string;
754
+ /**
755
+ * Type of entity for which the simulation was registered.
756
+ *
757
+ * ie: "Order"
758
+ */
759
+ entity_type: string;
760
+ /**
761
+ * Object with details of simulation actions
762
+ * type: SimulationDetails (not described in docs)
763
+ */
764
+ simulation: SimulationDetails;
765
+ };
766
+ /**
767
+ * For each WRO that was supplied, if ExternalSync was updated
768
+ */
769
+ export type SetExternalSyncResponse = {
770
+ results: {
771
+ id: number;
772
+ action: 'ExternalSync';
773
+ is_success: boolean;
774
+ /**
775
+ * Probably a reason if it didn't succeed. Empty when it does succeed.
776
+ * ie: ""
777
+ */
778
+ reason: string;
779
+ }[];
780
+ };
781
+ export type BoxStatus = 'Awaiting' | 'Arrived' | 'Completed' | 'Counting' | 'Stowing' | 'Cancelled' | 'InternalTransfer';
782
+ /**
783
+ * Get Warehouse Receiving Order Boxes response
784
+ */
785
+ export type WarehouseReceivingOrderBoxesResponse = {
786
+ box_id: number;
787
+ /**
788
+ * The number of the box in the receiving order
789
+ */
790
+ box_number: number;
791
+ box_status: BoxStatus;
792
+ /**
793
+ * Date the box arrived
794
+ */
795
+ arrived_date: Nullable<string>;
796
+ /**
797
+ * Date the box was received
798
+ */
799
+ received_date: Nullable<string>;
800
+ /**
801
+ * Date counting of the box's inventory items started
802
+ */
803
+ counting_started_date: Nullable<string>;
804
+ /**
805
+ * Tracking number of the box shipment
806
+ */
807
+ tracking_number: Nullable<string>;
808
+ /**
809
+ * type: BoxItemViewModel
810
+ */
811
+ box_items: {
812
+ /**
813
+ * Quantity of the item included
814
+ */
815
+ quantity: number;
816
+ /**
817
+ * Quantity of the item that was received after processing the receiving order
818
+ */
819
+ received_quantity: number;
820
+ /**
821
+ * Quantity of the item that has been stowed
822
+ */
823
+ stowed_quantity: number;
824
+ /**
825
+ * Unique identifier of the inventory item
826
+ */
827
+ inventory_id: number;
828
+ /**
829
+ * Lot number the item belongs to
830
+ */
831
+ lot_number: Nullable<string>;
832
+ /**
833
+ * Expiration date of the item's lot
834
+ */
835
+ lot_date: Nullable<string>;
836
+ }[];
837
+ }[];
838
+ export declare enum PackagingRequirement {
839
+ 'No Requirements' = 1,
840
+ Fragile = 2,
841
+ 'Is Foldable' = 3,
842
+ 'Is Media (Media mail)' = 4,
843
+ 'Is Book' = 5,
844
+ 'Is Poster' = 6,
845
+ 'Is Apparel' = 7,
846
+ 'Is Packaging Material (for custom boxes, marketing inserts, etc)' = 8,
847
+ 'Ship In Own Container' = 9
848
+ }
849
+ export declare enum PackagingMaterial {
850
+ 'Box' = 1,
851
+ 'Bubble Mailer' = 2,
852
+ 'Poly Mailer' = 3,
853
+ 'Poster Tube' = 5,
854
+ 'Custom Box' = 6,
855
+ 'Bookfold' = 7,
856
+ 'Ship In Own Container' = 8,
857
+ 'Custom Bubble Mailer' = 9,
858
+ 'Custom Poly Mailer' = 10
859
+ }
860
+ /**
861
+ * Restock (1)
862
+ * Quarantine (2)
863
+ * Dispose (3)
864
+ */
865
+ export declare enum ReturnAction {
866
+ /**
867
+ * Restock (1)
868
+ */
869
+ Restock = 1,
870
+ /**
871
+ * Quarantine (2)
872
+ */
873
+ Quarantine = 2,
874
+ /**
875
+ * Dispose (3)
876
+ */
877
+ Dispose = 3
878
+ }
879
+ export type ProductVariantRequest = {
880
+ /**
881
+ * Required for updates
882
+ */
883
+ id?: number;
884
+ name?: string;
885
+ sku?: string;
886
+ /**
887
+ * will serialize as a number
888
+ */
889
+ packaging_requirement_id?: PackagingRequirement;
890
+ /**
891
+ * will serialize as a number
892
+ */
893
+ packaging_material_type_id?: PackagingMaterial;
894
+ barcode?: string;
895
+ upc?: string;
896
+ gtin?: string;
897
+ customs?: {
898
+ /**
899
+ * 2 character country code
900
+ */
901
+ country_code_of_origin: 'US';
902
+ /**
903
+ * The customs code (6 digit)
904
+ * ie: “6103.22”
905
+ */
906
+ hs_tariff_code: string;
907
+ /**
908
+ * Value of object for customs (in USD)
909
+ * ie: “15”
910
+ */
911
+ value: string;
912
+ /**
913
+ * Description of product for customs purposes
914
+ */
915
+ description: string;
916
+ };
917
+ /**
918
+ * Not sure if these can be partially supplied.
919
+ */
920
+ return_preferences?: {
921
+ primary_action_id: Nullable<ReturnAction>;
922
+ backup_action_id: null;
923
+ instructions: Nullable<string>;
924
+ return_to_sender_primary_action_id: Nullable<ReturnAction>;
925
+ return_to_sender_backup_action_id: Nullable<ReturnAction>;
926
+ };
927
+ lot_information: {
928
+ /**
929
+ * If the product should use lot date based picking
930
+ */
931
+ is_lot: boolean;
932
+ minimum_shelf_life_days: Nullable<number>;
933
+ };
934
+ };
935
+ /**
936
+ * Create API with PAT (personal access token) - defaults to sandbox endpoints and "SMA" channel.
937
+ *
938
+ * NOTE: We used token based auth, so did not need to implement the other auth mechanism(s).
939
+ *
940
+ * TODO: Consider adding global parameters like timeout (or per method). Some endpoints are slower than others.
941
+ *
942
+ * @param personalAccessToken passing *undefined* or empty string has a guar clause that will throw
943
+ * @param apiBaseUrl
944
+ * @param channelApplicationName
945
+ * @returns
946
+ */
947
+ export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string) => Promise<{
948
+ getProductById: (productId: number) => Promise<DataResponse<GetProduct1_0Result>>;
949
+ getProducts1_0: (query: Partial<{
950
+ ReferenceIds: string;
951
+ Page: number;
952
+ Limit: number;
953
+ IDs: string;
954
+ Search: string;
955
+ ActiveStatus: "Any" | "Active" | "Inactive";
956
+ BundleStatus: "Any" | "Bundle" | "NotBundle";
957
+ }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
958
+ /**
959
+ * NOTE: we can probably pass more than "variants" prop. We could on the /1.0/product endpoint
960
+ * 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
+ */
962
+ updateProducts2_0: (productId: number, variants: ProductVariantRequest[]) => Promise<DataResponse<AddProductResponse>>;
963
+ /**
964
+ * Not supported here, but:
965
+ * 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:
966
+ * Example: /product?{filter}={operator}:{value}
967
+ * Example: /product?sku=any:shirt-a,shirt-b,shirt-c Find products that match any of these SKUs
968
+ * Example: /product?onHandQuantity=gt:0 Find products where OnHandQty greater than 0
969
+ */
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[]>>;
1020
+ createProduct1_0: (product: {
1021
+ reference_id: string;
1022
+ sku: string;
1023
+ name: string;
1024
+ barcode: string;
1025
+ }) => Promise<DataResponse<AddProductResponse>>;
1026
+ /**
1027
+ * The request part for variant is not accurate. This is just for testing - there are no official docs.
1028
+ */
1029
+ createProduct2_0: (product: {
1030
+ reference_id: string;
1031
+ sku: string;
1032
+ type_id: number;
1033
+ name: string;
1034
+ variants: ProductVariantRequest[];
1035
+ }) => Promise<DataResponse<AddProductResponse>>;
1036
+ placeOrder: (order: PlaceOrderRequest) => Promise<DataResponse<PlaceOrderResponse>>;
1037
+ /**
1038
+ * Cancel single Order by Order Id
1039
+ *
1040
+ * @param orderId The order Id to cancel
1041
+ */
1042
+ cancelSingleOrderByOrderId: (orderId: number) => Promise<DataResponse<CancelOrderResponse>>;
1043
+ getWebhooks: () => Promise<DataResponse<Webhook[][]>>;
1044
+ createWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">) => Promise<DataResponse<Webhook>>;
1045
+ getFulfillmentCenters: () => Promise<DataResponse<FulfillmentCenter[]>>;
1046
+ createWarehouseReceivingOrder: (request: WarehouseReceivingOrderRequest) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
1047
+ getWarehouseReceivingOrder: (orderId: number) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
1048
+ getWarehouseReceivingOrderBoxes: (orderId: number) => Promise<DataResponse<WarehouseReceivingOrderBoxesResponse>>;
1049
+ /**
1050
+ * NOTE: should verify that response matches 1.0 product endpoint
1051
+ */
1052
+ getReceivingExtended: (query: Partial<{
1053
+ Statuses: string;
1054
+ ExternalSync: boolean;
1055
+ }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
1056
+ /**
1057
+ * This must be for setting/clearing if it has been synced externally.
1058
+ *
1059
+ * Use case is interop via searching for "completed" that are not yet synced.
1060
+ *
1061
+ * NOTE: this is tagged experimental, so might change or be dropped
1062
+ */
1063
+ experimentalReceivingSetExternalSync: (ids: number[], isExternalSync: boolean) => Promise<DataResponse<SetExternalSyncResponse>>;
1064
+ /**
1065
+ * NOTE: should verify the response type matches the product 1.0 endpoint
1066
+ */
1067
+ listInventory: (query: Partial<{
1068
+ /**
1069
+ * Page of inventory items to get
1070
+ */
1071
+ Page: number;
1072
+ /**
1073
+ * Amount of inventory items per page to request
1074
+ */
1075
+ Limit: number;
1076
+ IsActive: boolean;
1077
+ IsDigital: boolean;
1078
+ IDs: number[];
1079
+ /**
1080
+ * Sort will default to ascending order for each field. To sort in descending order please pass a "-" in front of the field name. For example, Sort=-onHand,name will sort by onHand descending
1081
+ *
1082
+ * NOTE: if you sort a non-valid field will be a 422. ie: on_hand is not an available sort property
1083
+ *
1084
+ * NOTE: their API is a mix of pascalCase and snake_case.
1085
+ */
1086
+ Sort: string;
1087
+ /**
1088
+ * Search is available for 2 fields, Inventory ID and Name -
1089
+ *
1090
+ * Expected behavior for search by Inventory ID is exact match
1091
+ * Expected behavior for search by Inventory Name is partial match, i.e. does not have to be start of word, but must be consecutive characters. This is not case sensitive.
1092
+ */
1093
+ Search: string;
1094
+ /**
1095
+ * LocationType is valid for hub, spoke, or lts. LocationType will default to all locations.
1096
+ */
1097
+ LocationType: string;
1098
+ }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
1099
+ /**
1100
+ * Only for sandbox: https://developer.shipbob.com/sandbox-simulations/
1101
+ *
1102
+ * NOTE: generates a 200 instead of a 201 like everywhere else
1103
+ */
1104
+ simulateShipment: (request: SimulateShipmentRequest) => Promise<DataResponse<SimulateShipmentResponse>>;
1105
+ /**
1106
+ *
1107
+ * Only for sandbox: https://developer.shipbob.com/sandbox-simulations/
1108
+ *
1109
+ * @param simulationId UUID from "/2.0/simulate/shipment" call
1110
+ */
1111
+ getSimulationStatus: (simulationId: string) => Promise<DataResponse<SimulationResponse>>;
1112
+ }>;