shipbob-node-sdk 0.0.4 → 0.0.6

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
@@ -1,11 +1,6 @@
1
+ import { AddProductResponse, CancelOrderResponse, ExperimentalPagedResult, FulfillmentCenter, GetInventory1_0Result, GetOrdersQueryStrings, GetProduct1_0Result, GetProduct2_0Response, GetProductExperimentalResponse, GetProductQueryStrings, GetProducts1_0QueryString, ListInventoryQueryStrings, Order, PlaceOrderRequest, SetExternalSyncResponse, ShippingMethod, SimulateShipmentRequest, SimulateShipmentResponse, SimulationResponse, VariantRequestProduct2_0, VariantRequestProductExperimental, WarehouseReceivingOrderBoxesResponse, WarehouseReceivingOrderRequest, WarehouseReceivingOrderResponse, Webhook } from './types';
2
+ export * from './types';
1
3
  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
4
  export type Credentials = {
10
5
  token: string;
11
6
  channelId?: number;
@@ -42,1120 +37,11 @@ export type DataResponse<T> = ({
42
37
  retryAfter: Nullable<number>;
43
38
  };
44
39
  };
45
- export type ChannelsResponse = {
46
- id: number;
47
- name: string;
48
- application_name: string;
49
- scopes: string[];
50
- }[];
51
- export type Address = {
40
+ export type CreateOptions = {
52
41
  /**
53
- * First line of the address
42
+ * console.log HTTP traffic (http verb + endpoint)
54
43
  */
55
- address1: string;
56
- /**
57
- * Second line of the address
58
- */
59
- address2?: Nullable<string>;
60
- /**
61
- * Name of the company receiving the shipment
62
- */
63
- company_name?: Nullable<string>;
64
- /**
65
- * The city
66
- */
67
- city: Required<string>;
68
- /**
69
- * The state or province
70
- * Not required, but not all countries have state/province
71
- */
72
- state: Nullable<string>;
73
- /**
74
- * The country (Must be ISO Alpha-2 for estimates)
75
- */
76
- country: string;
77
- /**
78
- * The zip code or postal code
79
- */
80
- zip_code: string;
81
- };
82
- /**
83
- * Returns also everything else including onhand, etc. Stuff that makes no sense at this point.
84
- */
85
- export type AddProductResponse = {
86
- id: number;
87
- reference_id: string;
88
- };
89
- /**
90
- * This is missing practically all fields of actual result.
91
- */
92
- export type GetProduct1_0Result = {
93
- id: number;
94
- reference_id: string;
95
- };
96
- export type ActionName = 'Dispose' | 'Restock' | 'Quarantine';
97
- export type ProductType = 'Regular' | 'Bundle';
98
- type GetProduct2_0Variant = {
99
- /**
100
- * The expected barcode to be found on the item and checked during the pick process
101
- */
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[];
108
- created_on: string;
109
- customs: {
110
- /**
111
- * The customs code (6 digit)
112
- */
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: {
149
- /**
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
152
- */
153
- is_enabled: false;
154
- /**
155
- * The prefix expected on the serial number
156
- */
157
- prefix: string;
158
- /**
159
- * The suffix expected on the serial number
160
- */
161
- suffix: string;
162
- /**
163
- * The exact number of characters expected in the serial number
164
- */
165
- exact_character_length: Nullable<number>;
166
- };
167
- /**
168
- * If the product needs to classified as a hazmat product with the shipping carrier
169
- */
170
- dangerous_goods: false;
171
- /**
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
174
- */
175
- msds_url: string;
176
- /**
177
- * If the product should be picked as an entire case
178
- */
179
- is_case_pick: boolean;
180
- /**
181
- * Is Bound Printed Matter, must be set by the ShipBob internal team
182
- */
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;
214
- /**
215
- * Not sure what else can be here
216
- */
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
- id: number;
232
- name: ActionName;
233
- }>;
234
- /**
235
- * Restock (1) Quarantine (2) Dispose (3)
236
- */
237
- backup_action: Nullable<{
238
- id: number;
239
- name: ActionName;
240
- }>;
241
- /**
242
- * Instructions for inspecting returns
243
- */
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
- /**
271
- * ie: "oz"
272
- */
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>;
306
- }[];
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
- };
314
- export type OrderType = 'DTC' | 'DropShip' | 'B2B' | 'Transportation';
315
- export type AnyProduct = ({
316
- /**
317
- * Unique reference id of the product
318
- */
319
- reference_id: string;
320
- /**
321
- * Name of the product. Required if there is not an existing ShipBob product with a matching reference_id value.
322
- */
323
- name?: Nullable<string>;
324
- /**
325
- * Global Trade Item Number - unique and internationally recognized identifier assigned to item by company GS1 (0-50 chars)
326
- */
327
- gtin?: Nullable<string>;
328
- /**
329
- * Universal Product Code - Unique external identifier
330
- */
331
- upc?: Nullable<string>;
332
- /**
333
- * Price for one item
334
- */
335
- unit_price?: Nullable<number>;
336
- /**
337
- * Product SKU
338
- */
339
- sku?: Nullable<string>;
340
- } & {
341
- /**
342
- * Unique Id of the product. Not sure who would track **their** product ids..
343
- */
344
- id: number;
345
- }) | {
346
- /**
347
- * Numeric assignment per item. Used as a reference number for multiple purposes such as split orders, split containers, etc.
348
- */
349
- external_line_id?: number;
350
- /**
351
- * The quantity of this product ordered
352
- * (< 2147483647 LOL)
353
- */
354
- quantity: number;
355
- /**
356
- * Defined standard for measure for an item (each, inner pack, case, pallet). Values: EA, INP, CS and PL
357
- */
358
- quantity_unit_of_measure_code?: Nullable<string>;
359
- required_lot?: {
360
- lot_number: Nullable<string>;
361
- /**
362
- * string or null <date-time>
363
- * Manually specified lot date
364
- */
365
- lot_date: Nullable<string>;
366
- };
367
- };
368
- export type CancelOrderResponse = {
369
- order_id: number;
370
- order: {
371
- id: number;
372
- reference_id: string;
373
- order_number: string;
374
- status: string;
375
- };
376
- /**
377
- * ie: "Success"
378
- */
379
- status: string;
380
- canceled_shipment_results: {
381
- /**
382
- * ie: "Cancel". The docs are wrong. This is actually a number like 6.
383
- */
384
- action: number;
385
- shipment_id: number;
386
- is_success: boolean;
387
- /**
388
- * ie: "Order cancelled"
389
- */
390
- reason: string;
391
- }[];
392
- };
393
- export type PlaceOrderResponse = {
394
- id: number;
395
- /**
396
- * ISO date. ie: "2019-08-24T14:15:22Z"
397
- */
398
- created_date: string;
399
- /**
400
- * ISO date. ie: "2019-08-24T14:15:22Z"
401
- */
402
- purchase_date: string;
403
- reference_id: string;
404
- order_number: string;
405
- /**
406
- * probably always "Processing" - we should be able to get order status updates via webhook
407
- */
408
- status: 'Processing';
409
- type: OrderType;
410
- channel: {
411
- id: number;
412
- /**
413
- * ie: "ShipBobs-Shopify-Store"
414
- */
415
- name: string;
416
- };
417
- /**
418
- * ie: "Free 2-day Shipping"
419
- */
420
- shipping_method: string;
421
- recipient: {
422
- name: string;
423
- address: Address;
424
- email: string;
425
- phone_number: string;
426
- };
427
- products: {
428
- id: number;
429
- reference_id: string;
430
- quantity: number;
431
- quantity_unit_of_measure_code: string;
432
- sku: string;
433
- gtin: string;
434
- upc: string;
435
- unit_price: number;
436
- external_line_id: number;
437
- }[];
438
- tags: string[];
439
- shipments: {
440
- id: number;
441
- order_id: number;
442
- reference_id: string;
443
- recipient: {
444
- name: string;
445
- address: Address;
446
- email: string;
447
- phone_number: string;
448
- };
449
- }[];
450
- gift_message: string;
451
- shipping_terms: {
452
- /**
453
- * ie: "Parcel"
454
- */
455
- carrier_type: CarrierShipType;
456
- payment_term: PaymentShipTerm;
457
- };
458
- };
459
- export type PaymentShipTerm = 'Collect' | 'ThirdParty' | 'Prepaid' | 'MerchantResponsible';
460
- export type CarrierShipType = 'Parcel' | 'Freight';
461
- export type PlaceOrderRequest = {
462
- /**
463
- * User friendly orderId or store order number that will be shown on the Orders Page. If not provided, referenceId will be used (<= 400 characters)
464
- */
465
- order_number: Nullable<string>;
466
- recipient: {
467
- name: string;
468
- address: Address;
469
- /**
470
- * Email address of the recipient
471
- */
472
- email?: Nullable<string>;
473
- /**
474
- * Phone number of the recipient (<= 50 characters)
475
- */
476
- phone_number?: Nullable<string>;
477
- };
478
- /**
479
- * Products included in the order. Products identified by reference_id must also include the product name if there is no matching ShipBob product.
480
- */
481
- products: AnyProduct[];
482
- /**
483
- * Unique and immutable order identifier from your upstream system.
484
- *
485
- * Discussions with Simon. This is a forever unique identifier. ie: cannot be an IC order number like 18888888 - we could not reship.
486
- *
487
- * NOTE: reusing generates 422 error: "Cannot insert order with existing ReferenceId"
488
- */
489
- reference_id: string;
490
- /**
491
- * Contains properties that needs to be used for fulfilling B2B/Dropship orders.
492
- */
493
- retailer_program_data?: {
494
- /**
495
- * First initial documentation sent from buyer to seller with item(s) and quantities.
496
- */
497
- purchase_order_number: string;
498
- /**
499
- * Identifies retailer-merchant combination
500
- */
501
- retailer_program_type: string;
502
- /**
503
- * Store Number
504
- */
505
- mark_for_store?: Nullable<string>;
506
- /**
507
- * Identifies a merchant's store department
508
- */
509
- department?: Nullable<string>;
510
- /**
511
- * Expected delivery date
512
- */
513
- delivery_date?: Nullable<string>;
514
- /**
515
- * Customer Ticket Number
516
- */
517
- customer_ticket_number?: Nullable<string>;
518
- /**
519
- * The date the retailer has requested the order to ship by.
520
- */
521
- shipByDate?: Nullable<string>;
522
- /**
523
- * The date the retailer does not want the order shipped by.
524
- */
525
- doNotShipBeforeDate?: Nullable<string>;
526
- };
527
- /**
528
- * 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.
529
- * If they don’t match, we will create a new one and default it to Standard
530
- * (non-empty)
531
- * ie: "Standard"
532
- */
533
- shipping_method: string;
534
- /**
535
- * Contains shipping properties that need to be used for fulfilling an order.
536
- */
537
- shipping_terms?: {
538
- /**
539
- * CarrierShipType: Enum: "Parcel" "Freight"
540
- */
541
- carrier_type: CarrierShipType;
542
- /**
543
- * PaymentShipTerm
544
- */
545
- payment_term: PaymentShipTerm;
546
- };
547
- /**
548
- * Enum: "DTC" "DropShip" "B2B" "Transportation"
549
- */
550
- type: OrderType;
551
- };
552
- export type ShippingMethod = {
553
- /**
554
- * Unique id for shipping method
555
- */
556
- id: number;
557
- /**
558
- * Indicates if the shipping method is active
559
- */
560
- active: boolean;
561
- /**
562
- * Indicates the shipping method is a ShipBob default shipping method.
563
- */
564
- default: boolean;
565
- /**
566
- * Name of the ship method as selected by the merchant and saved in ShipBob’s database (i.e. “ground”).
567
- *
568
- * Corresponds to the shipping_method field in the Orders API.
569
- */
570
- name: string;
571
- /**
572
- * ShipBob.Orders.Presentation.ViewModels.ServiceLevelDetailViewModel)
573
- */
574
- service_level: {
575
- /**
576
- * Unique id for the service level
577
- */
578
- id: number;
579
- /**
580
- * The name or title of the service level
581
- */
582
- name: string;
583
- };
584
- };
585
- export type Webhook = {
586
- id: number;
587
- /**
588
- * ISO date format: "2025-02-14T22:21:33.4911731"
589
- */
590
- created_at: string;
591
- /**
592
- * The subscription topic for the webhook
593
- */
594
- topic: WebhookTopic;
595
- /**
596
- * This is what we provided to them.
597
- */
598
- subscription_url: string;
599
- };
600
- export type FulfillmentCenter = {
601
- id: number;
602
- /**
603
- * ie: "Cicero (IL)"
604
- */
605
- name: string;
606
- /**
607
- * ie: "Central Standard Time"
608
- */
609
- timezone: string;
610
- address1: string;
611
- address2: string;
612
- city: string;
613
- /**
614
- * ie: "IL"
615
- */
616
- state: string;
617
- /**
618
- * ie: "USA"
619
- */
620
- country: string;
621
- zip_code: string;
622
- phone_number: string;
623
- email: string;
624
- };
625
- export type PackageType = 'Package' | 'Pallet' | 'FloorLoadedContainer';
626
- export type BoxPackagingType = 'EverythingInOneBox' | 'OneSkuPerBox' | 'MultipleSkuPerBox';
627
- /**
628
- * The receiving order to create
629
- */
630
- export type WarehouseReceivingOrderRequest = {
631
- /**
632
- * Model containing information that assigns a receiving order to a fulfillment center.
633
- * If the fulfillment center provided is in a receiving hub region, then the response will be the receiving hub location.
634
- */
635
- fulfillment_center: {
636
- /**
637
- * ID of the fulfillment center to assign this receiving order to
638
- */
639
- id: number;
640
- };
641
- package_type: PackageType;
642
- box_packaging_type: BoxPackagingType;
643
- /**
644
- * Box shipments to be added to this receiving order
645
- */
646
- boxes: {
647
- /**
648
- * Tracking number for the box shipment.
649
- *
650
- * The API docs say "string or null", but if you pass null will get a 400: Boxes[...] 'The TrackingNumber field is required.'
651
- */
652
- tracking_number: string;
653
- /**
654
- * Items contained in this box
655
- */
656
- box_items: {
657
- /**
658
- * Quantity of the items in the box
659
- *
660
- * NOTE: integer <int32> [ 1 .. 2147483647 ]. LOL. 2 billion
661
- */
662
- quantity: number;
663
- /**
664
- * Unique inventory id of the items in the box
665
- */
666
- inventory_id: number;
667
- /**
668
- * Lot number of the items in the box. Must be supplied for products that have lot set, otherwise will be:
669
- * 422 status code "Wrong Lot Information Provided For Inventory IDs: 8619859,8619860, etc."
670
- */
671
- lot_number?: Nullable<string>;
672
- /**
673
- * Lot expiration date for the items in the box
674
- */
675
- lot_date?: Nullable<string>;
676
- }[];
677
- }[];
678
- /**
679
- * Expected arrival date of all the box shipments in this receiving order
680
- * ie: ISO date "2019-08-24T14:15:22Z"
681
- *
682
- * NOTE: Must be in the future or it will generate a 422 error.
683
- */
684
- expected_arrival_date: string;
685
- /**
686
- * Purchase order number for this receiving order,
687
- *
688
- * NOTE: Supporting idempotency this must be unique across WROs
689
- * Otherwise 422: "Request could not be completed, PO reference already exists and must be a unique value"
690
- */
691
- purchase_order_number?: Nullable<string>;
692
- };
693
- export type ReceivingStatus = 'Awaiting' | 'Processing' | 'Completed' | 'Cancelled' | 'Incomplete' | 'Arrived' | 'PartiallyArrived' | 'PartiallyArrivedAtHub' | 'ArrivedAtHub' | 'ProcessingAtHub' | 'InternalTransfer';
694
- export type WarehouseReceivingOrderResponse = {
695
- id: number;
696
- /**
697
- * Not sure what these could be. "Awaiting" is a staging status.
698
- */
699
- status: ReceivingStatus;
700
- /**
701
- * What was sent in the request
702
- */
703
- package_type: PackageType;
704
- /**
705
- * What was sent in the request
706
- */
707
- box_packaging_type: BoxPackagingType;
708
- /**
709
- * What was sent in the request (ISO date)
710
- */
711
- expected_arrival_date: string;
712
- /**
713
- * ISO date: "2025-02-18T19:25:13.034265+00:00"
714
- */
715
- insert_date: string;
716
- /**
717
- * ISO date
718
- */
719
- last_updated_date: string;
720
- /**
721
- * ie: "/2.0/receiving/442945/labels"
722
- */
723
- box_labels_uri: string;
724
- fulfillment_center: FulfillmentCenter;
725
- purchase_order_number: Nullable<string>;
726
- inventory_quantities: {
727
- inventory_id: number;
728
- sku: string;
729
- expected_quantity: number;
730
- received_quantity: number;
731
- stowed_quantity: number;
732
- }[];
733
- /**
734
- * The timestamp in UTC when a 3rd party integrator has set in ShipBob system
735
- *
736
- * We set this in their receiving-extended API endpoints. Use case is for acknowledging completed orders.
737
- * Their API has example: "2019-08-24T14:15:22Z"
738
- */
739
- external_sync_timestamp: Nullable<string>;
740
- };
741
- /**
742
- * The simulation will work on our SandBox Environment.
743
- */
744
- export type Simulation = {
745
- /**
746
- * Identifies what action to perform on shipment.
747
- */
748
- action: 'ShipOrder' | 'DeliverOrder';
749
- /**
750
- * Delay time for action in minutes to be triggered after.
751
- *
752
- * NOTE: anything over 2880 will be clamped
753
- */
754
- delay?: Nullable<number>;
755
- /**
756
- * Next simulation action to be performed after it.
757
- */
758
- next?: Nullable<SimulateShipmentRequest>;
759
- };
760
- export type SimulateShipmentRequest = {
761
- /**
762
- * Shipment Id for simulation.
763
- */
764
- shipment_id: number;
765
- /**
766
- * Simulation actions object.
767
- */
768
- simulation: Simulation;
769
- };
770
- export type SimulateShipmentResponse = {
771
- /**
772
- * Simulation id for register simulation request.
773
- * UUID ie: 439a9dec-9bff-4339-9564-89975d3a8f5c
774
- */
775
- simulation_id: string;
776
- /**
777
- * ie: "Simulation registered successfully"
778
- */
779
- message: string;
780
- };
781
- export type SimulationDetails = {
782
- /**
783
- * Identifies the action that was performed.
784
- */
785
- action: 'ShipOrder' | 'DeliverOrder';
786
- /**
787
- * Status of the simulation action.
788
- */
789
- status: 'Success' | 'Failed' | 'Pending' | 'Skipped';
790
- /**
791
- * Additional message for the action.
792
- *
793
- * ie:
794
- * - "This simulated action has been completed successfully."
795
- * - "This simulation action is not executed yet."
796
- */
797
- message: string;
798
- /**
799
- * Scheduled time if the action had a delay.
800
- * ie: ISO date '2025-02-19T00:09:53.77' or NULL
801
- */
802
- schedule_time: Nullable<string>;
803
- /**
804
- * Nested object with details of subsequent simulation actions. This value would be null if there is no subsequent action.
805
- */
806
- next: Nullable<SimulationDetails>;
807
- };
808
- export type SimulationResponse = {
809
- /**
810
- * Simulation id for register simulation request.
811
- */
812
- simulation_id: string;
813
- /**
814
- * ID of the entity for which the simulation was registered.
815
- */
816
- entity_id: string;
817
- /**
818
- * Type of entity for which the simulation was registered.
819
- *
820
- * ie: "Order"
821
- */
822
- entity_type: string;
823
- /**
824
- * Object with details of simulation actions
825
- * type: SimulationDetails (not described in docs)
826
- */
827
- simulation: SimulationDetails;
828
- };
829
- /**
830
- * For each WRO that was supplied, if ExternalSync was updated
831
- */
832
- export type SetExternalSyncResponse = {
833
- results: {
834
- id: number;
835
- action: 'ExternalSync';
836
- is_success: boolean;
837
- /**
838
- * Probably a reason if it didn't succeed. Empty when it does succeed.
839
- * ie: ""
840
- */
841
- reason: string;
842
- }[];
843
- };
844
- export type BoxStatus = 'Awaiting' | 'Arrived' | 'Completed' | 'Counting' | 'Stowing' | 'Cancelled' | 'InternalTransfer';
845
- /**
846
- * Get Warehouse Receiving Order Boxes response
847
- */
848
- export type WarehouseReceivingOrderBoxesResponse = {
849
- box_id: number;
850
- /**
851
- * The number of the box in the receiving order
852
- */
853
- box_number: number;
854
- box_status: BoxStatus;
855
- /**
856
- * Date the box arrived
857
- */
858
- arrived_date: Nullable<string>;
859
- /**
860
- * Date the box was received
861
- */
862
- received_date: Nullable<string>;
863
- /**
864
- * Date counting of the box's inventory items started
865
- */
866
- counting_started_date: Nullable<string>;
867
- /**
868
- * Tracking number of the box shipment
869
- */
870
- tracking_number: Nullable<string>;
871
- /**
872
- * type: BoxItemViewModel
873
- */
874
- box_items: {
875
- /**
876
- * Quantity of the item included
877
- */
878
- quantity: number;
879
- /**
880
- * Quantity of the item that was received after processing the receiving order
881
- */
882
- received_quantity: number;
883
- /**
884
- * Quantity of the item that has been stowed
885
- */
886
- stowed_quantity: number;
887
- /**
888
- * Unique identifier of the inventory item
889
- */
890
- inventory_id: number;
891
- /**
892
- * Lot number the item belongs to
893
- */
894
- lot_number: Nullable<string>;
895
- /**
896
- * Expiration date of the item's lot
897
- */
898
- lot_date: Nullable<string>;
899
- }[];
900
- }[];
901
- export declare enum PackagingRequirement {
902
- 'No Requirements' = 1,
903
- Fragile = 2,
904
- 'Is Foldable' = 3,
905
- 'Is Media (Media mail)' = 4,
906
- 'Is Book' = 5,
907
- 'Is Poster' = 6,
908
- 'Is Apparel' = 7,
909
- 'Is Packaging Material (for custom boxes, marketing inserts, etc)' = 8,
910
- 'Ship In Own Container' = 9
911
- }
912
- export declare enum PackagingMaterial {
913
- 'Box' = 1,
914
- 'Bubble Mailer' = 2,
915
- 'Poly Mailer' = 3,
916
- 'Poster Tube' = 5,
917
- 'Custom Box' = 6,
918
- 'Bookfold' = 7,
919
- 'Ship In Own Container' = 8,
920
- 'Custom Bubble Mailer' = 9,
921
- 'Custom Poly Mailer' = 10
922
- }
923
- /**
924
- * Restock (1)
925
- * Quarantine (2)
926
- * Dispose (3)
927
- */
928
- export declare enum ReturnAction {
929
- /**
930
- * Restock (1)
931
- */
932
- Restock = 1,
933
- /**
934
- * Quarantine (2)
935
- */
936
- Quarantine = 2,
937
- /**
938
- * Dispose (3)
939
- */
940
- Dispose = 3
941
- }
942
- export type VariantRequestProductExperimental = Omit<VariantRequestProduct2_0, 'barcode'> & {
943
- barcodes: {
944
- value: string;
945
- sticker_url: Nullable<string>;
946
- }[];
947
- };
948
- export type VariantRequestProduct2_0 = {
949
- /**
950
- * Required for updates
951
- */
952
- id?: number;
953
- name?: string;
954
- sku?: string;
955
- /**
956
- * will serialize as a number
957
- */
958
- packaging_requirement_id?: PackagingRequirement;
959
- /**
960
- * will serialize as a number
961
- */
962
- packaging_material_type_id?: PackagingMaterial;
963
- barcode?: string;
964
- upc?: string;
965
- gtin?: string;
966
- customs?: {
967
- /**
968
- * 2 character country code
969
- */
970
- country_code_of_origin: 'US';
971
- /**
972
- * The customs code (6 digit)
973
- * ie: “6103.22”
974
- */
975
- hs_tariff_code: string;
976
- /**
977
- * Value of object for customs (in USD)
978
- * ie: “15”
979
- */
980
- value: string;
981
- /**
982
- * Description of product for customs purposes
983
- */
984
- description: string;
985
- };
986
- /**
987
- * Not sure if these can be partially supplied.
988
- */
989
- return_preferences?: {
990
- primary_action_id: Nullable<ReturnAction>;
991
- backup_action_id: null;
992
- /**
993
- * Cannot be set when "primary_action_id" has certain values (ie: Quarantine)
994
- * error: variants.return_preferences.instructions cannot be set for the selected primary action
995
- */
996
- instructions: Nullable<string>;
997
- return_to_sender_primary_action_id: Nullable<ReturnAction>;
998
- return_to_sender_backup_action_id: Nullable<ReturnAction>;
999
- };
1000
- lot_information: {
1001
- /**
1002
- * If the product should use lot date based picking
1003
- */
1004
- is_lot: boolean;
1005
- minimum_shelf_life_days: Nullable<number>;
1006
- };
1007
- };
1008
- export type GetProductQueryStrings = {
1009
- Page: number;
1010
- Limit: number;
1011
- /**
1012
- * Regular product (1) or Bundle (2)
1013
- */
1014
- productTypeId: 1 | 2;
1015
- /**
1016
- * Active (1) or Inactive (2)
1017
- */
1018
- variantStatus: 1 | 2;
1019
- /**
1020
- * True -> at least one variant is digital
1021
- * False -> at least one variant is not-digital
1022
- */
1023
- hasDigitalVariants: boolean;
1024
- /**
1025
- * Search by one or more Product Ids (comma separated) to return multiple products
1026
- */
1027
- Ids: string;
1028
- /**
1029
- * Search by one or more Variant Ids (comma separated) to return multiple products
1030
- */
1031
- VariantIds: string;
1032
- /**
1033
- * Search by product barcode
1034
- */
1035
- barcode: string;
1036
- /**
1037
- * Search by an exact sku
1038
- */
1039
- sku: string;
1040
- /**
1041
- * Search for products that vary or non-varying products
1042
- */
1043
- hasVariants: boolean;
1044
- /**
1045
- * Search by one or more InventoryIds (comma separated) to return multiple barcodes
1046
- */
1047
- InventoryId: string;
1048
- /**
1049
- * Search by Variant Name.
1050
- * NOTE: Query parameters should be URL encoded such as "Green%20Shirt"
1051
- */
1052
- Name: string;
1053
- /**
1054
- * Search by matching Taxonomy (category) of the product (comma separated)
1055
- */
1056
- TaxonomyIds: string;
1057
- };
1058
- export type ExperimentalPagedResult<T> = {
1059
- /**
1060
- * Will be null when there are no items
1061
- */
1062
- first: Nullable<string>;
1063
- next: Nullable<string>;
1064
- items: T[];
1065
- prev: Nullable<string>;
1066
- /**
1067
- * Will be null when there are no items.
1068
- */
1069
- last: Nullable<string>;
1070
- };
1071
- export type GetInventory1_0Result = {
1072
- id: number;
1073
- name: string;
1074
- is_digital: boolean;
1075
- is_case_pick: boolean;
1076
- is_lot: boolean;
1077
- dimensions: {
1078
- weight: number;
1079
- length: number;
1080
- width: number;
1081
- depth: number;
1082
- };
1083
- /**
1084
- * Total fulfillable quantity of this inventory item
1085
- */
1086
- total_fulfillable_quantity: number;
1087
- /**
1088
- * Total onhand quantity of this inventory item
1089
- */
1090
- total_onhand_quantity: number;
1091
- /**
1092
- * Total committed quantity of this inventory item
1093
- */
1094
- total_committed_quantity: number;
1095
- /**
1096
- * Total quantity that can be sold without overselling the inventory item. This is calculated by subtracting the total exception quantity from the fulfillable quantity.
1097
- */
1098
- total_sellable_quantity: number;
1099
- /**
1100
- * Total quantity in unreceived receiving orders for this inventory item
1101
- */
1102
- total_awaiting_quantity: number;
1103
- /**
1104
- * 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.
1105
- */
1106
- total_exception_quantity: number;
1107
- /**
1108
- * 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.
1109
- */
1110
- total_internal_transfer_quantity: number;
1111
- /**
1112
- * 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.
1113
- */
1114
- total_backordered_quantity: number;
1115
- /**
1116
- * Whether the inventory is active or not
1117
- */
1118
- is_active: boolean;
1119
- /**
1120
- * Fulfillable quantity of this inventory item broken down by fulfillment center location
1121
- */
1122
- fulfillable_quantity_by_fulfillment_center: {
1123
- id: number;
1124
- name: string;
1125
- fulfillable_quantity: number;
1126
- onhand_quantity: number;
1127
- committed_quantity: number;
1128
- awaiting_quantity: number;
1129
- internal_transfer_quantity: number;
1130
- }[];
1131
- /**
1132
- * Fulfillable quantity of this inventory item broken down by lot
1133
- */
1134
- fulfillable_quantity_by_lot: {
1135
- lot_number: string;
1136
- /**
1137
- * ie: "2019-08-24T14:15:22Z"
1138
- */
1139
- expiration_date: string;
1140
- fulfillable_quantity: number;
1141
- onhand_quantity: number;
1142
- committed_quantity: number;
1143
- awaiting_quantity: number;
1144
- internal_transfer_quantity: number;
1145
- fulfillable_quantity_by_fulfillment_center: {
1146
- id: number;
1147
- name: string;
1148
- fulfillable_quantity: number;
1149
- onhand_quantity: number;
1150
- committed_quantity: number;
1151
- awaiting_quantity: number;
1152
- internal_transfer_quantity: number;
1153
- }[];
1154
- }[];
1155
- /**
1156
- * ie: "None" "Fragile" "Foldable" "Stackable" "Book" "CustomPackaging" "CustomDunnage" "MarketingInsert" or "Poster"
1157
- */
1158
- packaging_attribute: 'None' | 'Fragile' | 'Foldable' | 'Stackable' | 'Book' | 'CustomPackaging' | 'CustomDunnage' | 'MarketingInsert' | 'Poster';
44
+ logTraffic: boolean;
1159
45
  };
1160
46
  /**
1161
47
  * Create API with PAT (personal access token) - defaults to sandbox endpoints and "SMA" channel.
@@ -1165,28 +51,16 @@ export type GetInventory1_0Result = {
1165
51
  * TODO: Consider adding global parameters like timeout (or per method). Some endpoints are slower than others.
1166
52
  *
1167
53
  * @param personalAccessToken passing *undefined* or empty string has a guar clause that will throw
1168
- * @param apiBaseUrl
1169
- * @param channelApplicationName
54
+ * @param apiBaseUrl must pass "api.shipbob.com" otherwise sandbox will be used.
55
+ * @param channelApplicationName will default to SMA account, otherwise provide your application_name here
1170
56
  * @param options
1171
- * @returns
1172
57
  */
1173
- export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string, options?: {
1174
- logTraffic: boolean;
1175
- }) => Promise<{
58
+ export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string, options?: CreateOptions) => Promise<{
1176
59
  /**
1177
- * You would need a product id on your side. Not sure how useful this is in all practicality unless
1178
- * you maintain the association on your side.
60
+ * Gets by *their* product id
1179
61
  */
1180
62
  getProductById: (productId: number) => Promise<DataResponse<GetProduct1_0Result>>;
1181
- getProducts1_0: (query: Partial<{
1182
- ReferenceIds: string;
1183
- Page: number;
1184
- Limit: number;
1185
- IDs: string;
1186
- Search: string;
1187
- ActiveStatus: "Any" | "Active" | "Inactive";
1188
- BundleStatus: "Any" | "Bundle" | "NotBundle";
1189
- }>) => Promise<DataResponse<GetProduct1_0Result[]>>;
63
+ getProducts1_0: (query: GetProducts1_0QueryString) => Promise<DataResponse<GetProduct1_0Result[]>>;
1190
64
  /**
1191
65
  * NOTE: you need to use the headers (part of this client response) to page the results.
1192
66
  * page-number='1'
@@ -1209,7 +83,7 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1209
83
  * Example: /product?sku=any:shirt-a,shirt-b,shirt-c Find products that match any of these SKUs
1210
84
  * Example: /product?onHandQuantity=gt:0 Find products where OnHandQty greater than 0
1211
85
  */
1212
- getProducts2_0: (query: Partial<GetProductQueryStrings>) => Promise<DataResponse<GetProduct2_0Response[]>>;
86
+ getProducts2_0: (query: GetProductQueryStrings) => Promise<DataResponse<GetProduct2_0Response[]>>;
1213
87
  /**
1214
88
  * Note sure how this is different from /2.0/product. Only notable difference is "barcodes" type from string to object.
1215
89
  */
@@ -1236,7 +110,11 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1236
110
  name: string;
1237
111
  variants: VariantRequestProductExperimental[];
1238
112
  }) => Promise<DataResponse<AddProductResponse>>;
1239
- placeOrder: (order: PlaceOrderRequest) => Promise<DataResponse<PlaceOrderResponse>>;
113
+ /**
114
+ * Look in the returned headers to get paging information.
115
+ */
116
+ getOrders: (query: Partial<GetOrdersQueryStrings>) => Promise<DataResponse<Order[]>>;
117
+ placeOrder: (order: PlaceOrderRequest) => Promise<DataResponse<Order>>;
1240
118
  /**
1241
119
  * Cancel single Order by Order Id
1242
120
  *
@@ -1246,15 +124,20 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1246
124
  getShippingMethods: () => Promise<DataResponse<ShippingMethod[]>>;
1247
125
  getWebhooks: () => Promise<DataResponse<Webhook[]>>;
1248
126
  /**
1249
- * NOTE: can consider option to add without providing channel id (would need matching unregister)
127
+ *
128
+ * @param webhook just needs topic and subscription url.
129
+ * @param sendChannelId defaults `true`. Not providing channel id will (I think) subscribe to all channels. You need to match when unsubscribing.
130
+ * @returns
1250
131
  */
1251
- registerWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">) => Promise<DataResponse<Webhook>>;
132
+ registerWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
1252
133
  /**
1253
- * Can generate 500 response with data: "The wait operation timed out." If so, check your channel id matches.
134
+ * Can generate 500 response with data: "The wait operation timed out." If so, check your channel id (or lack thereof) matches the subscription registration.
1254
135
  *
1255
- * NOTE: can consider option to add without providing channel id (would need matching register)
136
+ * @param id channelId from getWebhooks()
137
+ * @param sendChannelId defaults `true`. You need to match this with when you subscribed. There's no way to see this anywhere.
138
+ * @returns
1256
139
  */
1257
- unregisterWebhookSubscription: (id: number) => Promise<DataResponse<Webhook>>;
140
+ unregisterWebhookSubscription: (id: number, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
1258
141
  getFulfillmentCenters: () => Promise<DataResponse<FulfillmentCenter[]>>;
1259
142
  createWarehouseReceivingOrder: (request: WarehouseReceivingOrderRequest) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
1260
143
  getWarehouseReceivingOrder: (orderId: number) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
@@ -1277,42 +160,9 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1277
160
  /**
1278
161
  * NOTE: should verify the response type matches the product 1.0 endpoint
1279
162
  */
1280
- listInventory: (query: Partial<{
1281
- /**
1282
- * Page of inventory items to get
1283
- */
1284
- Page: number;
1285
- /**
1286
- * Amount of inventory items per page to request
1287
- */
1288
- Limit: number;
1289
- IsActive: boolean;
1290
- IsDigital: boolean;
1291
- IDs: number[];
1292
- /**
1293
- * 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
1294
- *
1295
- * NOTE: if you sort a non-valid field will be a 422. ie: on_hand is not an available sort property
1296
- *
1297
- * NOTE: their API is a mix of pascalCase and snake_case.
1298
- */
1299
- Sort: string;
1300
- /**
1301
- * Search is available for 2 fields, Inventory ID and Name -
1302
- *
1303
- * Expected behavior for search by Inventory ID is exact match
1304
- * 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.
1305
- */
1306
- Search: string;
1307
- /**
1308
- * LocationType is valid for hub, spoke, or lts. LocationType will default to all locations.
1309
- */
1310
- LocationType: string;
1311
- }>) => Promise<DataResponse<GetInventory1_0Result[]>>;
163
+ listInventory: (query: Partial<ListInventoryQueryStrings>) => Promise<DataResponse<GetInventory1_0Result[]>>;
1312
164
  /**
1313
165
  * Only for sandbox: https://developer.shipbob.com/sandbox-simulations/
1314
- *
1315
- * NOTE: generates a 200 instead of a 201 like everywhere else
1316
166
  */
1317
167
  simulateShipment: (request: SimulateShipmentRequest) => Promise<DataResponse<SimulateShipmentResponse>>;
1318
168
  /**
@@ -1323,4 +173,3 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
1323
173
  */
1324
174
  getSimulationStatus: (simulationId: string) => Promise<DataResponse<SimulationResponse>>;
1325
175
  }>;
1326
- export {};