@shipengine/alchemy 2.2.3 → 2.2.4
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/index.js +283 -0
- package/index.mjs +283 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2575,9 +2575,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2575
2575
|
class AccountSettingsAPI {
|
|
2576
2576
|
constructor(client) {
|
|
2577
2577
|
this.client = client;
|
|
2578
|
+
/**
|
|
2579
|
+
* The `get` method retrieves the account settings for a given user.
|
|
2580
|
+
*/
|
|
2578
2581
|
this.get = () => {
|
|
2579
2582
|
return this.client.get("/v1/account/settings");
|
|
2580
2583
|
};
|
|
2584
|
+
/**
|
|
2585
|
+
* The `update` method updates specific account settings for a given user.
|
|
2586
|
+
*
|
|
2587
|
+
* @params Partial<AccountSettings> The account settings to update.
|
|
2588
|
+
*/
|
|
2581
2589
|
this.update = (settings) => {
|
|
2582
2590
|
return this.client.put("/v1/account/settings", settings);
|
|
2583
2591
|
};
|
|
@@ -2588,9 +2596,17 @@ class AccountSettingsAPI {
|
|
|
2588
2596
|
class AddressesAPI {
|
|
2589
2597
|
constructor(client) {
|
|
2590
2598
|
this.client = client;
|
|
2599
|
+
/**
|
|
2600
|
+
* The `validate` method validates a list of addresses.
|
|
2601
|
+
*
|
|
2602
|
+
* @params Address[] The addresses to be validated.
|
|
2603
|
+
*/
|
|
2591
2604
|
this.validate = (addresses) => {
|
|
2592
2605
|
return this.client.post("/v1/addresses/validate", addresses);
|
|
2593
2606
|
};
|
|
2607
|
+
/**
|
|
2608
|
+
* The `parse` method parses a string of text to extract addresses.
|
|
2609
|
+
*/
|
|
2594
2610
|
this.parse = (text, address) => {
|
|
2595
2611
|
return this.client.put("/v1/addresses/recognize", {
|
|
2596
2612
|
address,
|
|
@@ -5324,12 +5340,21 @@ var __async$w = (__this, __arguments, generator) => {
|
|
|
5324
5340
|
class CarriersAPI {
|
|
5325
5341
|
constructor(client) {
|
|
5326
5342
|
this.client = client;
|
|
5343
|
+
/**
|
|
5344
|
+
* The `list` method retrieves a list of connected carriers for a given user.
|
|
5345
|
+
*/
|
|
5327
5346
|
this.list = () => {
|
|
5328
5347
|
return this.client.get("/v1/carriers");
|
|
5329
5348
|
};
|
|
5349
|
+
/**
|
|
5350
|
+
* The `get` method retrieves a specific carrier by `carrierId`.
|
|
5351
|
+
*/
|
|
5330
5352
|
this.get = (carrierId) => {
|
|
5331
5353
|
return this.client.get(`/v1/carriers/${carrierId}`);
|
|
5332
5354
|
};
|
|
5355
|
+
/**
|
|
5356
|
+
* The `connect` method connects a carrier account to a user's ShipEngine account.
|
|
5357
|
+
*/
|
|
5333
5358
|
this.connect = (_a) => __async$w(this, null, function* () {
|
|
5334
5359
|
var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
|
|
5335
5360
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
@@ -5339,20 +5364,44 @@ class CarriersAPI {
|
|
|
5339
5364
|
endUserIpAddress
|
|
5340
5365
|
}));
|
|
5341
5366
|
});
|
|
5367
|
+
/**
|
|
5368
|
+
* The `addFunds` method allows a user to add funds to their carrier account balance.
|
|
5369
|
+
* Not all carrier providers allow you to maintain a balance.
|
|
5370
|
+
*
|
|
5371
|
+
* - For example, FedEx does
|
|
5372
|
+
* not require you to maintain a balance that will be used when purchasing labels.
|
|
5373
|
+
*/
|
|
5342
5374
|
this.addFunds = (carrierId, funds) => {
|
|
5343
5375
|
return this.client.put(`/v1/carriers/${carrierId}/add_funds`, funds);
|
|
5344
5376
|
};
|
|
5377
|
+
/**
|
|
5378
|
+
* The `updateAutoFunding` method allows a user to update the auto-funding settings
|
|
5379
|
+
* on their ShipEngine account.
|
|
5380
|
+
*
|
|
5381
|
+
* e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
|
|
5382
|
+
* per day you wish to auto-fund your account.
|
|
5383
|
+
*/
|
|
5345
5384
|
this.updateAutoFunding = (carrierId, options) => {
|
|
5346
5385
|
return this.client.post(
|
|
5347
5386
|
`/v1/carriers/${carrierId}/auto_funding`,
|
|
5348
5387
|
options
|
|
5349
5388
|
);
|
|
5350
5389
|
};
|
|
5390
|
+
/**
|
|
5391
|
+
* The `getAutoFunding` method retrieves the current auto-funding settings.
|
|
5392
|
+
*
|
|
5393
|
+
* If no auto-funding rules have been set, the response will contain the default
|
|
5394
|
+
* values for auto-funding. Auto-funding is disabled by default.
|
|
5395
|
+
*/
|
|
5351
5396
|
this.getAutoFunding = (carrierId) => {
|
|
5352
5397
|
return this.client.get(
|
|
5353
5398
|
`/v1/carriers/${carrierId}/auto_funding`
|
|
5354
5399
|
);
|
|
5355
5400
|
};
|
|
5401
|
+
/**
|
|
5402
|
+
* The `getWalletHistory` method retrieves the wallet transaction history for
|
|
5403
|
+
* a ShipEngine wallet account.
|
|
5404
|
+
*/
|
|
5356
5405
|
this.getWalletHistory = (startDate, endDate, page) => {
|
|
5357
5406
|
return this.client.get(`/v1/carriers/wallet_history`, {
|
|
5358
5407
|
params: {
|
|
@@ -5362,17 +5411,33 @@ class CarriersAPI {
|
|
|
5362
5411
|
}
|
|
5363
5412
|
});
|
|
5364
5413
|
};
|
|
5414
|
+
/**
|
|
5415
|
+
* The `getServices` method retrieves a list of shipping services that a given carrier offers.
|
|
5416
|
+
*/
|
|
5365
5417
|
this.getServices = (carrierId) => {
|
|
5366
5418
|
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
5367
5419
|
};
|
|
5420
|
+
/**
|
|
5421
|
+
* The `getPackageRatingGroup` method retrieves a list of package rating groups.
|
|
5422
|
+
* This is primarily used for carriers that support negotiated rates, and a user
|
|
5423
|
+
* has a rate card with multiple package rating groups.
|
|
5424
|
+
*/
|
|
5368
5425
|
this.getPackageRatingGroup = (carrierId) => {
|
|
5369
5426
|
return this.client.get(
|
|
5370
5427
|
`/v1/carriers/${carrierId}/package_rating_group`
|
|
5371
5428
|
);
|
|
5372
5429
|
};
|
|
5430
|
+
/**
|
|
5431
|
+
* The `getCountries` method retrieves a list of countries that a given carrier
|
|
5432
|
+
* supports shipping to.
|
|
5433
|
+
*/
|
|
5373
5434
|
this.getCountries = (carrierId) => {
|
|
5374
5435
|
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
5375
5436
|
};
|
|
5437
|
+
/**
|
|
5438
|
+
* The `getCurrencies` method retrieves a list of currencies that a given carrier
|
|
5439
|
+
* supports the usage of.
|
|
5440
|
+
*/
|
|
5376
5441
|
this.getCurrencies = (carrierId) => {
|
|
5377
5442
|
return this.client.get(`/v1/carriers/${carrierId}/currencies`);
|
|
5378
5443
|
};
|
|
@@ -7560,6 +7625,9 @@ var lib = {
|
|
|
7560
7625
|
class CustomPackagesAPI {
|
|
7561
7626
|
constructor(client) {
|
|
7562
7627
|
this.client = client;
|
|
7628
|
+
/**
|
|
7629
|
+
* The `list` method retrieves a list of custom packages a given user has created.
|
|
7630
|
+
*/
|
|
7563
7631
|
this.list = () => {
|
|
7564
7632
|
return this.client.get("/v1/packages");
|
|
7565
7633
|
};
|
|
@@ -7606,12 +7674,22 @@ var __async$v = (__this, __arguments, generator) => {
|
|
|
7606
7674
|
class FundingSourcesAPI {
|
|
7607
7675
|
constructor(client) {
|
|
7608
7676
|
this.client = client;
|
|
7677
|
+
/**
|
|
7678
|
+
* The `list` method retrieves a list of funding sources for a given user.
|
|
7679
|
+
*/
|
|
7609
7680
|
this.list = () => {
|
|
7610
7681
|
return this.client.get("/v1/funding_sources");
|
|
7611
7682
|
};
|
|
7683
|
+
/**
|
|
7684
|
+
* The `get` method retrieves a specific funding source by `fundingSourceId`.
|
|
7685
|
+
*/
|
|
7612
7686
|
this.get = (fundingSourceId) => {
|
|
7613
7687
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
7614
7688
|
};
|
|
7689
|
+
/**
|
|
7690
|
+
* The `create` method creates a new funding source for a given user. This requires
|
|
7691
|
+
* payment information to be collected from the user.
|
|
7692
|
+
*/
|
|
7615
7693
|
this.create = (createFundingSource) => __async$v(this, null, function* () {
|
|
7616
7694
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7617
7695
|
if (!endUserIpAddress)
|
|
@@ -7620,6 +7698,11 @@ class FundingSourcesAPI {
|
|
|
7620
7698
|
endUserIpAddress
|
|
7621
7699
|
}, createFundingSource));
|
|
7622
7700
|
});
|
|
7701
|
+
/**
|
|
7702
|
+
* The `update` method updates a funding source for a given user. This allows the
|
|
7703
|
+
* user to update the billing address or payment information associated with the
|
|
7704
|
+
* funding source.
|
|
7705
|
+
*/
|
|
7623
7706
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
|
|
7624
7707
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7625
7708
|
if (!endUserIpAddress)
|
|
@@ -7633,6 +7716,10 @@ class FundingSourcesAPI {
|
|
|
7633
7716
|
}
|
|
7634
7717
|
);
|
|
7635
7718
|
});
|
|
7719
|
+
/**
|
|
7720
|
+
* The `registerCarrier` method registers a carrier account and associates
|
|
7721
|
+
* it with a given funding source.
|
|
7722
|
+
*/
|
|
7636
7723
|
this.registerCarrier = (carrier) => __async$v(this, null, function* () {
|
|
7637
7724
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7638
7725
|
if (!endUserIpAddress)
|
|
@@ -7641,6 +7728,9 @@ class FundingSourcesAPI {
|
|
|
7641
7728
|
endUserIpAddress
|
|
7642
7729
|
}, carrier));
|
|
7643
7730
|
});
|
|
7731
|
+
/**
|
|
7732
|
+
* The `addFunds` method allows you to add funds to a funding source.
|
|
7733
|
+
*/
|
|
7644
7734
|
this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
|
|
7645
7735
|
return yield this.client.put(
|
|
7646
7736
|
`/v1/funding_sources/${fundingSourceId}/add_funds`,
|
|
@@ -7654,6 +7744,10 @@ class FundingSourcesAPI {
|
|
|
7654
7744
|
class InsuranceAPI {
|
|
7655
7745
|
constructor(client) {
|
|
7656
7746
|
this.client = client;
|
|
7747
|
+
/**
|
|
7748
|
+
* The `get` method retrieves the insurance balance for a given `insuranceProvider`
|
|
7749
|
+
* by ID.
|
|
7750
|
+
*/
|
|
7657
7751
|
this.get = (insuranceProvider) => {
|
|
7658
7752
|
return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
|
|
7659
7753
|
};
|
|
@@ -7664,15 +7758,31 @@ class InsuranceAPI {
|
|
|
7664
7758
|
class LabelsAPI {
|
|
7665
7759
|
constructor(client) {
|
|
7666
7760
|
this.client = client;
|
|
7761
|
+
/**
|
|
7762
|
+
* The `get` method retrieves a specific label by `labelId`.
|
|
7763
|
+
*/
|
|
7667
7764
|
this.get = (labelId) => {
|
|
7668
7765
|
return this.client.get(`/v1/labels/${labelId}`);
|
|
7669
7766
|
};
|
|
7767
|
+
/**
|
|
7768
|
+
* The `list` method retrieves a list of labels created by a given user.
|
|
7769
|
+
*/
|
|
7670
7770
|
this.list = (params = {}) => {
|
|
7671
7771
|
return this.client.get("/v1/labels", { params });
|
|
7672
7772
|
};
|
|
7773
|
+
/**
|
|
7774
|
+
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
7775
|
+
* which is a unique identifier tied to a specific rate.
|
|
7776
|
+
*
|
|
7777
|
+
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
7778
|
+
* label for the price they were initially rated.
|
|
7779
|
+
*/
|
|
7673
7780
|
this.createByRateId = (rateId, options) => {
|
|
7674
7781
|
return this.client.post(`/v1/labels/rates/${rateId}`, options);
|
|
7675
7782
|
};
|
|
7783
|
+
/**
|
|
7784
|
+
* The `void` method allows a user to void a label by `labelId`.
|
|
7785
|
+
*/
|
|
7676
7786
|
this.void = (labelId) => {
|
|
7677
7787
|
return this.client.put(`/v1/labels/${labelId}/void`);
|
|
7678
7788
|
};
|
|
@@ -7683,12 +7793,22 @@ class LabelsAPI {
|
|
|
7683
7793
|
class OrderSourcesAPI {
|
|
7684
7794
|
constructor(client) {
|
|
7685
7795
|
this.client = client;
|
|
7796
|
+
/**
|
|
7797
|
+
* The `list` method retrieves a list of connected order sources for a given user.
|
|
7798
|
+
*/
|
|
7686
7799
|
this.list = () => {
|
|
7687
7800
|
return this.client.get("/v-beta/order_sources");
|
|
7688
7801
|
};
|
|
7802
|
+
/**
|
|
7803
|
+
* The `get` method retrieves a specific order source by `orderSourceId`.
|
|
7804
|
+
*/
|
|
7689
7805
|
this.get = (orderSourceId) => {
|
|
7690
7806
|
return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
|
|
7691
7807
|
};
|
|
7808
|
+
/**
|
|
7809
|
+
* The `refresh` method refreshes a specific order source by `orderSourceId`.
|
|
7810
|
+
* This will pull in any `new orders` since the last order import.
|
|
7811
|
+
*/
|
|
7692
7812
|
this.refresh = (orderSourceId) => {
|
|
7693
7813
|
return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
|
|
7694
7814
|
};
|
|
@@ -7699,20 +7819,36 @@ class OrderSourcesAPI {
|
|
|
7699
7819
|
class RateCardsAPI {
|
|
7700
7820
|
constructor(client) {
|
|
7701
7821
|
this.client = client;
|
|
7822
|
+
/**
|
|
7823
|
+
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
7824
|
+
*/
|
|
7702
7825
|
this.list = (carrierIds) => {
|
|
7703
7826
|
return this.client.get(
|
|
7704
7827
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
7705
7828
|
);
|
|
7706
7829
|
};
|
|
7830
|
+
/**
|
|
7831
|
+
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
7832
|
+
*/
|
|
7707
7833
|
this.get = (rateCardId) => {
|
|
7708
7834
|
return this.client.get(`/v1/rate_cards/${rateCardId}`);
|
|
7709
7835
|
};
|
|
7836
|
+
/**
|
|
7837
|
+
* The `create` method creates a new rate card for a given user.
|
|
7838
|
+
*/
|
|
7710
7839
|
this.create = (rateCardInput) => {
|
|
7711
7840
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
7712
7841
|
};
|
|
7842
|
+
/**
|
|
7843
|
+
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
7844
|
+
* `RateCard`.
|
|
7845
|
+
*/
|
|
7713
7846
|
this.update = (rateCard) => {
|
|
7714
7847
|
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
7715
7848
|
};
|
|
7849
|
+
/**
|
|
7850
|
+
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
7851
|
+
*/
|
|
7716
7852
|
this.download = (rateCardId) => {
|
|
7717
7853
|
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
7718
7854
|
headers: {
|
|
@@ -7721,6 +7857,9 @@ class RateCardsAPI {
|
|
|
7721
7857
|
responseType: "blob"
|
|
7722
7858
|
});
|
|
7723
7859
|
};
|
|
7860
|
+
/**
|
|
7861
|
+
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
7862
|
+
*/
|
|
7724
7863
|
this.upload = (rateCardId, file) => {
|
|
7725
7864
|
const formData = new FormData();
|
|
7726
7865
|
formData.append("file", file);
|
|
@@ -7730,6 +7869,9 @@ class RateCardsAPI {
|
|
|
7730
7869
|
}
|
|
7731
7870
|
});
|
|
7732
7871
|
};
|
|
7872
|
+
/**
|
|
7873
|
+
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
7874
|
+
*/
|
|
7733
7875
|
this.publish = (rateCardId) => {
|
|
7734
7876
|
return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
|
|
7735
7877
|
};
|
|
@@ -7746,6 +7888,10 @@ class RateCardsAPI {
|
|
|
7746
7888
|
class RatesAPI {
|
|
7747
7889
|
constructor(client) {
|
|
7748
7890
|
this.client = client;
|
|
7891
|
+
/**
|
|
7892
|
+
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
7893
|
+
* on the shipment's options.
|
|
7894
|
+
*/
|
|
7749
7895
|
this.calculateByShipmentId = (shipmentId, options) => {
|
|
7750
7896
|
return this.client.post("/v1/rates", {
|
|
7751
7897
|
rateOptions: options,
|
|
@@ -7759,20 +7905,32 @@ class RatesAPI {
|
|
|
7759
7905
|
class SalesOrderShipmentsAPI {
|
|
7760
7906
|
constructor(client) {
|
|
7761
7907
|
this.client = client;
|
|
7908
|
+
/**
|
|
7909
|
+
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
7910
|
+
*/
|
|
7762
7911
|
this.list = (body = {}, params) => {
|
|
7763
7912
|
return this.client.post("/v-beta/shipments/list", body, {
|
|
7764
7913
|
params
|
|
7765
7914
|
});
|
|
7766
7915
|
};
|
|
7916
|
+
/**
|
|
7917
|
+
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
7918
|
+
*/
|
|
7767
7919
|
this.get = (shipmentId) => {
|
|
7768
7920
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
7769
7921
|
};
|
|
7922
|
+
/**
|
|
7923
|
+
* The `create` method creates a new shipment for a sales order.
|
|
7924
|
+
*/
|
|
7770
7925
|
this.create = (salesOrderId, shipment) => {
|
|
7771
7926
|
return this.client.post(
|
|
7772
7927
|
`/v-beta/shipments/sales_order/${salesOrderId}`,
|
|
7773
7928
|
shipment
|
|
7774
7929
|
);
|
|
7775
7930
|
};
|
|
7931
|
+
/**
|
|
7932
|
+
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
7933
|
+
*/
|
|
7776
7934
|
this.update = (shipmentId, shipment) => {
|
|
7777
7935
|
return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
|
|
7778
7936
|
};
|
|
@@ -7783,12 +7941,23 @@ class SalesOrderShipmentsAPI {
|
|
|
7783
7941
|
class SalesOrdersAPI {
|
|
7784
7942
|
constructor(client) {
|
|
7785
7943
|
this.client = client;
|
|
7944
|
+
/**
|
|
7945
|
+
* The `list` method retrieves a list of sales orders.
|
|
7946
|
+
*/
|
|
7786
7947
|
this.list = (params = {}) => {
|
|
7787
7948
|
return this.client.get("/v-beta/sales_orders", { params });
|
|
7788
7949
|
};
|
|
7950
|
+
/**
|
|
7951
|
+
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
7952
|
+
*/
|
|
7789
7953
|
this.get = (salesOrderId) => {
|
|
7790
7954
|
return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
|
|
7791
7955
|
};
|
|
7956
|
+
/**
|
|
7957
|
+
* The `notifyShipped` method notifies order source that the order has been
|
|
7958
|
+
* shipped. Typically, the order source will then notify the user based on
|
|
7959
|
+
* this update from ShipEngine API.
|
|
7960
|
+
*/
|
|
7792
7961
|
this.notifyShipped = (salesOrderId, tracking) => {
|
|
7793
7962
|
return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
|
|
7794
7963
|
};
|
|
@@ -7819,15 +7988,26 @@ var __async$u = (__this, __arguments, generator) => {
|
|
|
7819
7988
|
class ShipmentsAPI {
|
|
7820
7989
|
constructor(client) {
|
|
7821
7990
|
this.client = client;
|
|
7991
|
+
/**
|
|
7992
|
+
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
7993
|
+
* shipment ID.
|
|
7994
|
+
*/
|
|
7822
7995
|
this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
|
|
7823
7996
|
return this.client.get(
|
|
7824
7997
|
`/v1/shipments/${shipmentId}/rates`,
|
|
7825
7998
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
7826
7999
|
);
|
|
7827
8000
|
};
|
|
8001
|
+
/**
|
|
8002
|
+
* The `list` method retrieves a list of shipments for a given user.
|
|
8003
|
+
*/
|
|
7828
8004
|
this.list = (options) => {
|
|
7829
8005
|
return this.client.get("/v1/shipments", { params: options });
|
|
7830
8006
|
};
|
|
8007
|
+
/**
|
|
8008
|
+
* The `create` method allows for creating shipments based on a list of shipment
|
|
8009
|
+
* items passed into this method.
|
|
8010
|
+
*/
|
|
7831
8011
|
this.create = (...shipments) => __async$u(this, null, function* () {
|
|
7832
8012
|
return this.client.post("/v1/shipments", {
|
|
7833
8013
|
shipments
|
|
@@ -7840,15 +8020,31 @@ class ShipmentsAPI {
|
|
|
7840
8020
|
class WarehousesAPI {
|
|
7841
8021
|
constructor(client) {
|
|
7842
8022
|
this.client = client;
|
|
8023
|
+
/**
|
|
8024
|
+
* The `list` method retrieves a list of `warehouses` (Ship From Locations)
|
|
8025
|
+
* for a given user.
|
|
8026
|
+
*/
|
|
7843
8027
|
this.list = () => {
|
|
7844
8028
|
return this.client.get("/v1/warehouses");
|
|
7845
8029
|
};
|
|
8030
|
+
/**
|
|
8031
|
+
* The `create` method allows for creation of warehouses (Ship From Locations)
|
|
8032
|
+
* on a users ShipEngine account.
|
|
8033
|
+
*/
|
|
7846
8034
|
this.create = (warehouse) => {
|
|
7847
8035
|
return this.client.post("/v1/warehouses", warehouse);
|
|
7848
8036
|
};
|
|
8037
|
+
/**
|
|
8038
|
+
* The `update` method updates a specific warehouse (Ship From Location) for a
|
|
8039
|
+
* given user by `warehouseId`.
|
|
8040
|
+
*/
|
|
7849
8041
|
this.update = (warehouseId, warehouse) => {
|
|
7850
8042
|
return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
|
|
7851
8043
|
};
|
|
8044
|
+
/**
|
|
8045
|
+
* The `delete` method deletes a specific warehouse (Ship From Location) by
|
|
8046
|
+
* `warehouseId` from a users ShipEngine account.
|
|
8047
|
+
*/
|
|
7852
8048
|
this.delete = (warehouseId) => {
|
|
7853
8049
|
return this.client.delete(`/v1/warehouses/${warehouseId}`);
|
|
7854
8050
|
};
|
|
@@ -8009,48 +8205,135 @@ class ShipEngineAPI {
|
|
|
8009
8205
|
);
|
|
8010
8206
|
this.client = client;
|
|
8011
8207
|
}
|
|
8208
|
+
/**
|
|
8209
|
+
* The `token` method takes in a string and sets it as the Authorization header for all requests.
|
|
8210
|
+
*/
|
|
8012
8211
|
set token(token) {
|
|
8013
8212
|
this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
8014
8213
|
}
|
|
8214
|
+
/**
|
|
8215
|
+
* The `accountSettings` method provides access to the Account Settings endpoints
|
|
8216
|
+
* in ShipEngine API.
|
|
8217
|
+
*
|
|
8218
|
+
* @see {@link AccountSettingsAPI | The Account Settings API module}
|
|
8219
|
+
*/
|
|
8015
8220
|
get accountSettings() {
|
|
8016
8221
|
return new AccountSettingsAPI(this.client);
|
|
8017
8222
|
}
|
|
8223
|
+
/**
|
|
8224
|
+
* The `addresses` method provides access to the Address Validation endpoints
|
|
8225
|
+
* in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
|
|
8226
|
+
*
|
|
8227
|
+
* @see {@link AddressesAPI | The Addresses API module}
|
|
8228
|
+
*/
|
|
8018
8229
|
get addresses() {
|
|
8019
8230
|
return new AddressesAPI(this.client);
|
|
8020
8231
|
}
|
|
8232
|
+
/**
|
|
8233
|
+
* The `carriers` method provides access to the Carrier endpoints in ShipEngine
|
|
8234
|
+
* API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
|
|
8235
|
+
*
|
|
8236
|
+
* @see {@link CarriersAPI | The Carriers API module}
|
|
8237
|
+
*/
|
|
8021
8238
|
get carriers() {
|
|
8022
8239
|
return new CarriersAPI(this.client);
|
|
8023
8240
|
}
|
|
8241
|
+
/**
|
|
8242
|
+
* The `customPackages` method provides access to the Packages endpoint in ShipEngine
|
|
8243
|
+
* API. e.g. List Packages
|
|
8244
|
+
*
|
|
8245
|
+
* @see {@link CustomPackagesAPI | The Custom Packages API module}
|
|
8246
|
+
*/
|
|
8024
8247
|
get customPackages() {
|
|
8025
8248
|
return new CustomPackagesAPI(this.client);
|
|
8026
8249
|
}
|
|
8250
|
+
/**
|
|
8251
|
+
* The `fundingSources` method provides access to the Funding Sources endpoints
|
|
8252
|
+
* in ShipEngine API.
|
|
8253
|
+
*
|
|
8254
|
+
* @see {@link FundingSourcesAPI | The Funding Sources API module}
|
|
8255
|
+
*/
|
|
8027
8256
|
get fundingSources() {
|
|
8028
8257
|
return new FundingSourcesAPI(this.client);
|
|
8029
8258
|
}
|
|
8259
|
+
/**
|
|
8260
|
+
* The `insurance` method provides access to the Insurance endpoint in ShipEngine
|
|
8261
|
+
* API. e.g. Get Insurance Balance
|
|
8262
|
+
*
|
|
8263
|
+
* @see {@link InsuranceAPI | The Insurance API module}
|
|
8264
|
+
*/
|
|
8030
8265
|
get insurance() {
|
|
8031
8266
|
return new InsuranceAPI(this.client);
|
|
8032
8267
|
}
|
|
8268
|
+
/**
|
|
8269
|
+
* The `labels` method provides access to the Label endpoints in ShipEngine API.
|
|
8270
|
+
* e.g. Create Label, Get Label, Void Label, etc.
|
|
8271
|
+
*
|
|
8272
|
+
* @see {@link LabelsAPI | The Labels API module}
|
|
8273
|
+
*/
|
|
8033
8274
|
get labels() {
|
|
8034
8275
|
return new LabelsAPI(this.client);
|
|
8035
8276
|
}
|
|
8277
|
+
/**
|
|
8278
|
+
* The `orderSources` method provides access to the Order Sources endpoints in
|
|
8279
|
+
* ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
|
|
8280
|
+
*
|
|
8281
|
+
* @see {@link OrderSourcesAPI | The Order Sources API module}
|
|
8282
|
+
*/
|
|
8036
8283
|
get orderSources() {
|
|
8037
8284
|
return new OrderSourcesAPI(this.client);
|
|
8038
8285
|
}
|
|
8286
|
+
/**
|
|
8287
|
+
* The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
|
|
8288
|
+
* API.
|
|
8289
|
+
*
|
|
8290
|
+
* @see {@link RateCardsAPI | The Rate Cards API module}
|
|
8291
|
+
*/
|
|
8039
8292
|
get rateCards() {
|
|
8040
8293
|
return new RateCardsAPI(this.client);
|
|
8041
8294
|
}
|
|
8295
|
+
/**
|
|
8296
|
+
* The `rates` method provides access to the Rate endpoints in ShipEngine API.
|
|
8297
|
+
* e.g. Get Rates
|
|
8298
|
+
*
|
|
8299
|
+
* @see {@link RatesAPI | The Rates API module}
|
|
8300
|
+
*/
|
|
8042
8301
|
get rates() {
|
|
8043
8302
|
return new RatesAPI(this.client);
|
|
8044
8303
|
}
|
|
8304
|
+
/**
|
|
8305
|
+
* The `salesOrderShipments` method provides access to the `v-beta` Sales
|
|
8306
|
+
* Order Shipments endpoints in ShipEngine API.
|
|
8307
|
+
*
|
|
8308
|
+
* @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
|
|
8309
|
+
*/
|
|
8045
8310
|
get salesOrderShipments() {
|
|
8046
8311
|
return new SalesOrderShipmentsAPI(this.client);
|
|
8047
8312
|
}
|
|
8313
|
+
/**
|
|
8314
|
+
* The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
|
|
8315
|
+
* in ShipEngine API.
|
|
8316
|
+
*
|
|
8317
|
+
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
8318
|
+
*/
|
|
8048
8319
|
get salesOrders() {
|
|
8049
8320
|
return new SalesOrdersAPI(this.client);
|
|
8050
8321
|
}
|
|
8322
|
+
/**
|
|
8323
|
+
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
8324
|
+
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
8325
|
+
*
|
|
8326
|
+
* @see {@link ShipmentsAPI | The Shipments API module}
|
|
8327
|
+
*/
|
|
8051
8328
|
get shipments() {
|
|
8052
8329
|
return new ShipmentsAPI(this.client);
|
|
8053
8330
|
}
|
|
8331
|
+
/**
|
|
8332
|
+
* The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
|
|
8333
|
+
* API. e.g. List Warehouses, Get Warehouse, etc.
|
|
8334
|
+
*
|
|
8335
|
+
* @see {@link WarehousesAPI | The Warehouses API module}
|
|
8336
|
+
*/
|
|
8054
8337
|
get warehouses() {
|
|
8055
8338
|
return new WarehousesAPI(this.client);
|
|
8056
8339
|
}
|
package/index.mjs
CHANGED
|
@@ -2553,9 +2553,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2553
2553
|
class AccountSettingsAPI {
|
|
2554
2554
|
constructor(client) {
|
|
2555
2555
|
this.client = client;
|
|
2556
|
+
/**
|
|
2557
|
+
* The `get` method retrieves the account settings for a given user.
|
|
2558
|
+
*/
|
|
2556
2559
|
this.get = () => {
|
|
2557
2560
|
return this.client.get("/v1/account/settings");
|
|
2558
2561
|
};
|
|
2562
|
+
/**
|
|
2563
|
+
* The `update` method updates specific account settings for a given user.
|
|
2564
|
+
*
|
|
2565
|
+
* @params Partial<AccountSettings> The account settings to update.
|
|
2566
|
+
*/
|
|
2559
2567
|
this.update = (settings) => {
|
|
2560
2568
|
return this.client.put("/v1/account/settings", settings);
|
|
2561
2569
|
};
|
|
@@ -2566,9 +2574,17 @@ class AccountSettingsAPI {
|
|
|
2566
2574
|
class AddressesAPI {
|
|
2567
2575
|
constructor(client) {
|
|
2568
2576
|
this.client = client;
|
|
2577
|
+
/**
|
|
2578
|
+
* The `validate` method validates a list of addresses.
|
|
2579
|
+
*
|
|
2580
|
+
* @params Address[] The addresses to be validated.
|
|
2581
|
+
*/
|
|
2569
2582
|
this.validate = (addresses) => {
|
|
2570
2583
|
return this.client.post("/v1/addresses/validate", addresses);
|
|
2571
2584
|
};
|
|
2585
|
+
/**
|
|
2586
|
+
* The `parse` method parses a string of text to extract addresses.
|
|
2587
|
+
*/
|
|
2572
2588
|
this.parse = (text, address) => {
|
|
2573
2589
|
return this.client.put("/v1/addresses/recognize", {
|
|
2574
2590
|
address,
|
|
@@ -5302,12 +5318,21 @@ var __async$w = (__this, __arguments, generator) => {
|
|
|
5302
5318
|
class CarriersAPI {
|
|
5303
5319
|
constructor(client) {
|
|
5304
5320
|
this.client = client;
|
|
5321
|
+
/**
|
|
5322
|
+
* The `list` method retrieves a list of connected carriers for a given user.
|
|
5323
|
+
*/
|
|
5305
5324
|
this.list = () => {
|
|
5306
5325
|
return this.client.get("/v1/carriers");
|
|
5307
5326
|
};
|
|
5327
|
+
/**
|
|
5328
|
+
* The `get` method retrieves a specific carrier by `carrierId`.
|
|
5329
|
+
*/
|
|
5308
5330
|
this.get = (carrierId) => {
|
|
5309
5331
|
return this.client.get(`/v1/carriers/${carrierId}`);
|
|
5310
5332
|
};
|
|
5333
|
+
/**
|
|
5334
|
+
* The `connect` method connects a carrier account to a user's ShipEngine account.
|
|
5335
|
+
*/
|
|
5311
5336
|
this.connect = (_a) => __async$w(this, null, function* () {
|
|
5312
5337
|
var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
|
|
5313
5338
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
@@ -5317,20 +5342,44 @@ class CarriersAPI {
|
|
|
5317
5342
|
endUserIpAddress
|
|
5318
5343
|
}));
|
|
5319
5344
|
});
|
|
5345
|
+
/**
|
|
5346
|
+
* The `addFunds` method allows a user to add funds to their carrier account balance.
|
|
5347
|
+
* Not all carrier providers allow you to maintain a balance.
|
|
5348
|
+
*
|
|
5349
|
+
* - For example, FedEx does
|
|
5350
|
+
* not require you to maintain a balance that will be used when purchasing labels.
|
|
5351
|
+
*/
|
|
5320
5352
|
this.addFunds = (carrierId, funds) => {
|
|
5321
5353
|
return this.client.put(`/v1/carriers/${carrierId}/add_funds`, funds);
|
|
5322
5354
|
};
|
|
5355
|
+
/**
|
|
5356
|
+
* The `updateAutoFunding` method allows a user to update the auto-funding settings
|
|
5357
|
+
* on their ShipEngine account.
|
|
5358
|
+
*
|
|
5359
|
+
* e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
|
|
5360
|
+
* per day you wish to auto-fund your account.
|
|
5361
|
+
*/
|
|
5323
5362
|
this.updateAutoFunding = (carrierId, options) => {
|
|
5324
5363
|
return this.client.post(
|
|
5325
5364
|
`/v1/carriers/${carrierId}/auto_funding`,
|
|
5326
5365
|
options
|
|
5327
5366
|
);
|
|
5328
5367
|
};
|
|
5368
|
+
/**
|
|
5369
|
+
* The `getAutoFunding` method retrieves the current auto-funding settings.
|
|
5370
|
+
*
|
|
5371
|
+
* If no auto-funding rules have been set, the response will contain the default
|
|
5372
|
+
* values for auto-funding. Auto-funding is disabled by default.
|
|
5373
|
+
*/
|
|
5329
5374
|
this.getAutoFunding = (carrierId) => {
|
|
5330
5375
|
return this.client.get(
|
|
5331
5376
|
`/v1/carriers/${carrierId}/auto_funding`
|
|
5332
5377
|
);
|
|
5333
5378
|
};
|
|
5379
|
+
/**
|
|
5380
|
+
* The `getWalletHistory` method retrieves the wallet transaction history for
|
|
5381
|
+
* a ShipEngine wallet account.
|
|
5382
|
+
*/
|
|
5334
5383
|
this.getWalletHistory = (startDate, endDate, page) => {
|
|
5335
5384
|
return this.client.get(`/v1/carriers/wallet_history`, {
|
|
5336
5385
|
params: {
|
|
@@ -5340,17 +5389,33 @@ class CarriersAPI {
|
|
|
5340
5389
|
}
|
|
5341
5390
|
});
|
|
5342
5391
|
};
|
|
5392
|
+
/**
|
|
5393
|
+
* The `getServices` method retrieves a list of shipping services that a given carrier offers.
|
|
5394
|
+
*/
|
|
5343
5395
|
this.getServices = (carrierId) => {
|
|
5344
5396
|
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
5345
5397
|
};
|
|
5398
|
+
/**
|
|
5399
|
+
* The `getPackageRatingGroup` method retrieves a list of package rating groups.
|
|
5400
|
+
* This is primarily used for carriers that support negotiated rates, and a user
|
|
5401
|
+
* has a rate card with multiple package rating groups.
|
|
5402
|
+
*/
|
|
5346
5403
|
this.getPackageRatingGroup = (carrierId) => {
|
|
5347
5404
|
return this.client.get(
|
|
5348
5405
|
`/v1/carriers/${carrierId}/package_rating_group`
|
|
5349
5406
|
);
|
|
5350
5407
|
};
|
|
5408
|
+
/**
|
|
5409
|
+
* The `getCountries` method retrieves a list of countries that a given carrier
|
|
5410
|
+
* supports shipping to.
|
|
5411
|
+
*/
|
|
5351
5412
|
this.getCountries = (carrierId) => {
|
|
5352
5413
|
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
5353
5414
|
};
|
|
5415
|
+
/**
|
|
5416
|
+
* The `getCurrencies` method retrieves a list of currencies that a given carrier
|
|
5417
|
+
* supports the usage of.
|
|
5418
|
+
*/
|
|
5354
5419
|
this.getCurrencies = (carrierId) => {
|
|
5355
5420
|
return this.client.get(`/v1/carriers/${carrierId}/currencies`);
|
|
5356
5421
|
};
|
|
@@ -7538,6 +7603,9 @@ var lib = {
|
|
|
7538
7603
|
class CustomPackagesAPI {
|
|
7539
7604
|
constructor(client) {
|
|
7540
7605
|
this.client = client;
|
|
7606
|
+
/**
|
|
7607
|
+
* The `list` method retrieves a list of custom packages a given user has created.
|
|
7608
|
+
*/
|
|
7541
7609
|
this.list = () => {
|
|
7542
7610
|
return this.client.get("/v1/packages");
|
|
7543
7611
|
};
|
|
@@ -7584,12 +7652,22 @@ var __async$v = (__this, __arguments, generator) => {
|
|
|
7584
7652
|
class FundingSourcesAPI {
|
|
7585
7653
|
constructor(client) {
|
|
7586
7654
|
this.client = client;
|
|
7655
|
+
/**
|
|
7656
|
+
* The `list` method retrieves a list of funding sources for a given user.
|
|
7657
|
+
*/
|
|
7587
7658
|
this.list = () => {
|
|
7588
7659
|
return this.client.get("/v1/funding_sources");
|
|
7589
7660
|
};
|
|
7661
|
+
/**
|
|
7662
|
+
* The `get` method retrieves a specific funding source by `fundingSourceId`.
|
|
7663
|
+
*/
|
|
7590
7664
|
this.get = (fundingSourceId) => {
|
|
7591
7665
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
7592
7666
|
};
|
|
7667
|
+
/**
|
|
7668
|
+
* The `create` method creates a new funding source for a given user. This requires
|
|
7669
|
+
* payment information to be collected from the user.
|
|
7670
|
+
*/
|
|
7593
7671
|
this.create = (createFundingSource) => __async$v(this, null, function* () {
|
|
7594
7672
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7595
7673
|
if (!endUserIpAddress)
|
|
@@ -7598,6 +7676,11 @@ class FundingSourcesAPI {
|
|
|
7598
7676
|
endUserIpAddress
|
|
7599
7677
|
}, createFundingSource));
|
|
7600
7678
|
});
|
|
7679
|
+
/**
|
|
7680
|
+
* The `update` method updates a funding source for a given user. This allows the
|
|
7681
|
+
* user to update the billing address or payment information associated with the
|
|
7682
|
+
* funding source.
|
|
7683
|
+
*/
|
|
7601
7684
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
|
|
7602
7685
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7603
7686
|
if (!endUserIpAddress)
|
|
@@ -7611,6 +7694,10 @@ class FundingSourcesAPI {
|
|
|
7611
7694
|
}
|
|
7612
7695
|
);
|
|
7613
7696
|
});
|
|
7697
|
+
/**
|
|
7698
|
+
* The `registerCarrier` method registers a carrier account and associates
|
|
7699
|
+
* it with a given funding source.
|
|
7700
|
+
*/
|
|
7614
7701
|
this.registerCarrier = (carrier) => __async$v(this, null, function* () {
|
|
7615
7702
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
7616
7703
|
if (!endUserIpAddress)
|
|
@@ -7619,6 +7706,9 @@ class FundingSourcesAPI {
|
|
|
7619
7706
|
endUserIpAddress
|
|
7620
7707
|
}, carrier));
|
|
7621
7708
|
});
|
|
7709
|
+
/**
|
|
7710
|
+
* The `addFunds` method allows you to add funds to a funding source.
|
|
7711
|
+
*/
|
|
7622
7712
|
this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
|
|
7623
7713
|
return yield this.client.put(
|
|
7624
7714
|
`/v1/funding_sources/${fundingSourceId}/add_funds`,
|
|
@@ -7632,6 +7722,10 @@ class FundingSourcesAPI {
|
|
|
7632
7722
|
class InsuranceAPI {
|
|
7633
7723
|
constructor(client) {
|
|
7634
7724
|
this.client = client;
|
|
7725
|
+
/**
|
|
7726
|
+
* The `get` method retrieves the insurance balance for a given `insuranceProvider`
|
|
7727
|
+
* by ID.
|
|
7728
|
+
*/
|
|
7635
7729
|
this.get = (insuranceProvider) => {
|
|
7636
7730
|
return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
|
|
7637
7731
|
};
|
|
@@ -7642,15 +7736,31 @@ class InsuranceAPI {
|
|
|
7642
7736
|
class LabelsAPI {
|
|
7643
7737
|
constructor(client) {
|
|
7644
7738
|
this.client = client;
|
|
7739
|
+
/**
|
|
7740
|
+
* The `get` method retrieves a specific label by `labelId`.
|
|
7741
|
+
*/
|
|
7645
7742
|
this.get = (labelId) => {
|
|
7646
7743
|
return this.client.get(`/v1/labels/${labelId}`);
|
|
7647
7744
|
};
|
|
7745
|
+
/**
|
|
7746
|
+
* The `list` method retrieves a list of labels created by a given user.
|
|
7747
|
+
*/
|
|
7648
7748
|
this.list = (params = {}) => {
|
|
7649
7749
|
return this.client.get("/v1/labels", { params });
|
|
7650
7750
|
};
|
|
7751
|
+
/**
|
|
7752
|
+
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
7753
|
+
* which is a unique identifier tied to a specific rate.
|
|
7754
|
+
*
|
|
7755
|
+
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
7756
|
+
* label for the price they were initially rated.
|
|
7757
|
+
*/
|
|
7651
7758
|
this.createByRateId = (rateId, options) => {
|
|
7652
7759
|
return this.client.post(`/v1/labels/rates/${rateId}`, options);
|
|
7653
7760
|
};
|
|
7761
|
+
/**
|
|
7762
|
+
* The `void` method allows a user to void a label by `labelId`.
|
|
7763
|
+
*/
|
|
7654
7764
|
this.void = (labelId) => {
|
|
7655
7765
|
return this.client.put(`/v1/labels/${labelId}/void`);
|
|
7656
7766
|
};
|
|
@@ -7661,12 +7771,22 @@ class LabelsAPI {
|
|
|
7661
7771
|
class OrderSourcesAPI {
|
|
7662
7772
|
constructor(client) {
|
|
7663
7773
|
this.client = client;
|
|
7774
|
+
/**
|
|
7775
|
+
* The `list` method retrieves a list of connected order sources for a given user.
|
|
7776
|
+
*/
|
|
7664
7777
|
this.list = () => {
|
|
7665
7778
|
return this.client.get("/v-beta/order_sources");
|
|
7666
7779
|
};
|
|
7780
|
+
/**
|
|
7781
|
+
* The `get` method retrieves a specific order source by `orderSourceId`.
|
|
7782
|
+
*/
|
|
7667
7783
|
this.get = (orderSourceId) => {
|
|
7668
7784
|
return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
|
|
7669
7785
|
};
|
|
7786
|
+
/**
|
|
7787
|
+
* The `refresh` method refreshes a specific order source by `orderSourceId`.
|
|
7788
|
+
* This will pull in any `new orders` since the last order import.
|
|
7789
|
+
*/
|
|
7670
7790
|
this.refresh = (orderSourceId) => {
|
|
7671
7791
|
return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
|
|
7672
7792
|
};
|
|
@@ -7677,20 +7797,36 @@ class OrderSourcesAPI {
|
|
|
7677
7797
|
class RateCardsAPI {
|
|
7678
7798
|
constructor(client) {
|
|
7679
7799
|
this.client = client;
|
|
7800
|
+
/**
|
|
7801
|
+
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
7802
|
+
*/
|
|
7680
7803
|
this.list = (carrierIds) => {
|
|
7681
7804
|
return this.client.get(
|
|
7682
7805
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
7683
7806
|
);
|
|
7684
7807
|
};
|
|
7808
|
+
/**
|
|
7809
|
+
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
7810
|
+
*/
|
|
7685
7811
|
this.get = (rateCardId) => {
|
|
7686
7812
|
return this.client.get(`/v1/rate_cards/${rateCardId}`);
|
|
7687
7813
|
};
|
|
7814
|
+
/**
|
|
7815
|
+
* The `create` method creates a new rate card for a given user.
|
|
7816
|
+
*/
|
|
7688
7817
|
this.create = (rateCardInput) => {
|
|
7689
7818
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
7690
7819
|
};
|
|
7820
|
+
/**
|
|
7821
|
+
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
7822
|
+
* `RateCard`.
|
|
7823
|
+
*/
|
|
7691
7824
|
this.update = (rateCard) => {
|
|
7692
7825
|
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
7693
7826
|
};
|
|
7827
|
+
/**
|
|
7828
|
+
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
7829
|
+
*/
|
|
7694
7830
|
this.download = (rateCardId) => {
|
|
7695
7831
|
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
7696
7832
|
headers: {
|
|
@@ -7699,6 +7835,9 @@ class RateCardsAPI {
|
|
|
7699
7835
|
responseType: "blob"
|
|
7700
7836
|
});
|
|
7701
7837
|
};
|
|
7838
|
+
/**
|
|
7839
|
+
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
7840
|
+
*/
|
|
7702
7841
|
this.upload = (rateCardId, file) => {
|
|
7703
7842
|
const formData = new FormData();
|
|
7704
7843
|
formData.append("file", file);
|
|
@@ -7708,6 +7847,9 @@ class RateCardsAPI {
|
|
|
7708
7847
|
}
|
|
7709
7848
|
});
|
|
7710
7849
|
};
|
|
7850
|
+
/**
|
|
7851
|
+
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
7852
|
+
*/
|
|
7711
7853
|
this.publish = (rateCardId) => {
|
|
7712
7854
|
return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
|
|
7713
7855
|
};
|
|
@@ -7724,6 +7866,10 @@ class RateCardsAPI {
|
|
|
7724
7866
|
class RatesAPI {
|
|
7725
7867
|
constructor(client) {
|
|
7726
7868
|
this.client = client;
|
|
7869
|
+
/**
|
|
7870
|
+
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
7871
|
+
* on the shipment's options.
|
|
7872
|
+
*/
|
|
7727
7873
|
this.calculateByShipmentId = (shipmentId, options) => {
|
|
7728
7874
|
return this.client.post("/v1/rates", {
|
|
7729
7875
|
rateOptions: options,
|
|
@@ -7737,20 +7883,32 @@ class RatesAPI {
|
|
|
7737
7883
|
class SalesOrderShipmentsAPI {
|
|
7738
7884
|
constructor(client) {
|
|
7739
7885
|
this.client = client;
|
|
7886
|
+
/**
|
|
7887
|
+
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
7888
|
+
*/
|
|
7740
7889
|
this.list = (body = {}, params) => {
|
|
7741
7890
|
return this.client.post("/v-beta/shipments/list", body, {
|
|
7742
7891
|
params
|
|
7743
7892
|
});
|
|
7744
7893
|
};
|
|
7894
|
+
/**
|
|
7895
|
+
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
7896
|
+
*/
|
|
7745
7897
|
this.get = (shipmentId) => {
|
|
7746
7898
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
7747
7899
|
};
|
|
7900
|
+
/**
|
|
7901
|
+
* The `create` method creates a new shipment for a sales order.
|
|
7902
|
+
*/
|
|
7748
7903
|
this.create = (salesOrderId, shipment) => {
|
|
7749
7904
|
return this.client.post(
|
|
7750
7905
|
`/v-beta/shipments/sales_order/${salesOrderId}`,
|
|
7751
7906
|
shipment
|
|
7752
7907
|
);
|
|
7753
7908
|
};
|
|
7909
|
+
/**
|
|
7910
|
+
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
7911
|
+
*/
|
|
7754
7912
|
this.update = (shipmentId, shipment) => {
|
|
7755
7913
|
return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
|
|
7756
7914
|
};
|
|
@@ -7761,12 +7919,23 @@ class SalesOrderShipmentsAPI {
|
|
|
7761
7919
|
class SalesOrdersAPI {
|
|
7762
7920
|
constructor(client) {
|
|
7763
7921
|
this.client = client;
|
|
7922
|
+
/**
|
|
7923
|
+
* The `list` method retrieves a list of sales orders.
|
|
7924
|
+
*/
|
|
7764
7925
|
this.list = (params = {}) => {
|
|
7765
7926
|
return this.client.get("/v-beta/sales_orders", { params });
|
|
7766
7927
|
};
|
|
7928
|
+
/**
|
|
7929
|
+
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
7930
|
+
*/
|
|
7767
7931
|
this.get = (salesOrderId) => {
|
|
7768
7932
|
return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
|
|
7769
7933
|
};
|
|
7934
|
+
/**
|
|
7935
|
+
* The `notifyShipped` method notifies order source that the order has been
|
|
7936
|
+
* shipped. Typically, the order source will then notify the user based on
|
|
7937
|
+
* this update from ShipEngine API.
|
|
7938
|
+
*/
|
|
7770
7939
|
this.notifyShipped = (salesOrderId, tracking) => {
|
|
7771
7940
|
return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
|
|
7772
7941
|
};
|
|
@@ -7797,15 +7966,26 @@ var __async$u = (__this, __arguments, generator) => {
|
|
|
7797
7966
|
class ShipmentsAPI {
|
|
7798
7967
|
constructor(client) {
|
|
7799
7968
|
this.client = client;
|
|
7969
|
+
/**
|
|
7970
|
+
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
7971
|
+
* shipment ID.
|
|
7972
|
+
*/
|
|
7800
7973
|
this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
|
|
7801
7974
|
return this.client.get(
|
|
7802
7975
|
`/v1/shipments/${shipmentId}/rates`,
|
|
7803
7976
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
7804
7977
|
);
|
|
7805
7978
|
};
|
|
7979
|
+
/**
|
|
7980
|
+
* The `list` method retrieves a list of shipments for a given user.
|
|
7981
|
+
*/
|
|
7806
7982
|
this.list = (options) => {
|
|
7807
7983
|
return this.client.get("/v1/shipments", { params: options });
|
|
7808
7984
|
};
|
|
7985
|
+
/**
|
|
7986
|
+
* The `create` method allows for creating shipments based on a list of shipment
|
|
7987
|
+
* items passed into this method.
|
|
7988
|
+
*/
|
|
7809
7989
|
this.create = (...shipments) => __async$u(this, null, function* () {
|
|
7810
7990
|
return this.client.post("/v1/shipments", {
|
|
7811
7991
|
shipments
|
|
@@ -7818,15 +7998,31 @@ class ShipmentsAPI {
|
|
|
7818
7998
|
class WarehousesAPI {
|
|
7819
7999
|
constructor(client) {
|
|
7820
8000
|
this.client = client;
|
|
8001
|
+
/**
|
|
8002
|
+
* The `list` method retrieves a list of `warehouses` (Ship From Locations)
|
|
8003
|
+
* for a given user.
|
|
8004
|
+
*/
|
|
7821
8005
|
this.list = () => {
|
|
7822
8006
|
return this.client.get("/v1/warehouses");
|
|
7823
8007
|
};
|
|
8008
|
+
/**
|
|
8009
|
+
* The `create` method allows for creation of warehouses (Ship From Locations)
|
|
8010
|
+
* on a users ShipEngine account.
|
|
8011
|
+
*/
|
|
7824
8012
|
this.create = (warehouse) => {
|
|
7825
8013
|
return this.client.post("/v1/warehouses", warehouse);
|
|
7826
8014
|
};
|
|
8015
|
+
/**
|
|
8016
|
+
* The `update` method updates a specific warehouse (Ship From Location) for a
|
|
8017
|
+
* given user by `warehouseId`.
|
|
8018
|
+
*/
|
|
7827
8019
|
this.update = (warehouseId, warehouse) => {
|
|
7828
8020
|
return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
|
|
7829
8021
|
};
|
|
8022
|
+
/**
|
|
8023
|
+
* The `delete` method deletes a specific warehouse (Ship From Location) by
|
|
8024
|
+
* `warehouseId` from a users ShipEngine account.
|
|
8025
|
+
*/
|
|
7830
8026
|
this.delete = (warehouseId) => {
|
|
7831
8027
|
return this.client.delete(`/v1/warehouses/${warehouseId}`);
|
|
7832
8028
|
};
|
|
@@ -7987,48 +8183,135 @@ class ShipEngineAPI {
|
|
|
7987
8183
|
);
|
|
7988
8184
|
this.client = client;
|
|
7989
8185
|
}
|
|
8186
|
+
/**
|
|
8187
|
+
* The `token` method takes in a string and sets it as the Authorization header for all requests.
|
|
8188
|
+
*/
|
|
7990
8189
|
set token(token) {
|
|
7991
8190
|
this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
7992
8191
|
}
|
|
8192
|
+
/**
|
|
8193
|
+
* The `accountSettings` method provides access to the Account Settings endpoints
|
|
8194
|
+
* in ShipEngine API.
|
|
8195
|
+
*
|
|
8196
|
+
* @see {@link AccountSettingsAPI | The Account Settings API module}
|
|
8197
|
+
*/
|
|
7993
8198
|
get accountSettings() {
|
|
7994
8199
|
return new AccountSettingsAPI(this.client);
|
|
7995
8200
|
}
|
|
8201
|
+
/**
|
|
8202
|
+
* The `addresses` method provides access to the Address Validation endpoints
|
|
8203
|
+
* in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
|
|
8204
|
+
*
|
|
8205
|
+
* @see {@link AddressesAPI | The Addresses API module}
|
|
8206
|
+
*/
|
|
7996
8207
|
get addresses() {
|
|
7997
8208
|
return new AddressesAPI(this.client);
|
|
7998
8209
|
}
|
|
8210
|
+
/**
|
|
8211
|
+
* The `carriers` method provides access to the Carrier endpoints in ShipEngine
|
|
8212
|
+
* API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
|
|
8213
|
+
*
|
|
8214
|
+
* @see {@link CarriersAPI | The Carriers API module}
|
|
8215
|
+
*/
|
|
7999
8216
|
get carriers() {
|
|
8000
8217
|
return new CarriersAPI(this.client);
|
|
8001
8218
|
}
|
|
8219
|
+
/**
|
|
8220
|
+
* The `customPackages` method provides access to the Packages endpoint in ShipEngine
|
|
8221
|
+
* API. e.g. List Packages
|
|
8222
|
+
*
|
|
8223
|
+
* @see {@link CustomPackagesAPI | The Custom Packages API module}
|
|
8224
|
+
*/
|
|
8002
8225
|
get customPackages() {
|
|
8003
8226
|
return new CustomPackagesAPI(this.client);
|
|
8004
8227
|
}
|
|
8228
|
+
/**
|
|
8229
|
+
* The `fundingSources` method provides access to the Funding Sources endpoints
|
|
8230
|
+
* in ShipEngine API.
|
|
8231
|
+
*
|
|
8232
|
+
* @see {@link FundingSourcesAPI | The Funding Sources API module}
|
|
8233
|
+
*/
|
|
8005
8234
|
get fundingSources() {
|
|
8006
8235
|
return new FundingSourcesAPI(this.client);
|
|
8007
8236
|
}
|
|
8237
|
+
/**
|
|
8238
|
+
* The `insurance` method provides access to the Insurance endpoint in ShipEngine
|
|
8239
|
+
* API. e.g. Get Insurance Balance
|
|
8240
|
+
*
|
|
8241
|
+
* @see {@link InsuranceAPI | The Insurance API module}
|
|
8242
|
+
*/
|
|
8008
8243
|
get insurance() {
|
|
8009
8244
|
return new InsuranceAPI(this.client);
|
|
8010
8245
|
}
|
|
8246
|
+
/**
|
|
8247
|
+
* The `labels` method provides access to the Label endpoints in ShipEngine API.
|
|
8248
|
+
* e.g. Create Label, Get Label, Void Label, etc.
|
|
8249
|
+
*
|
|
8250
|
+
* @see {@link LabelsAPI | The Labels API module}
|
|
8251
|
+
*/
|
|
8011
8252
|
get labels() {
|
|
8012
8253
|
return new LabelsAPI(this.client);
|
|
8013
8254
|
}
|
|
8255
|
+
/**
|
|
8256
|
+
* The `orderSources` method provides access to the Order Sources endpoints in
|
|
8257
|
+
* ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
|
|
8258
|
+
*
|
|
8259
|
+
* @see {@link OrderSourcesAPI | The Order Sources API module}
|
|
8260
|
+
*/
|
|
8014
8261
|
get orderSources() {
|
|
8015
8262
|
return new OrderSourcesAPI(this.client);
|
|
8016
8263
|
}
|
|
8264
|
+
/**
|
|
8265
|
+
* The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
|
|
8266
|
+
* API.
|
|
8267
|
+
*
|
|
8268
|
+
* @see {@link RateCardsAPI | The Rate Cards API module}
|
|
8269
|
+
*/
|
|
8017
8270
|
get rateCards() {
|
|
8018
8271
|
return new RateCardsAPI(this.client);
|
|
8019
8272
|
}
|
|
8273
|
+
/**
|
|
8274
|
+
* The `rates` method provides access to the Rate endpoints in ShipEngine API.
|
|
8275
|
+
* e.g. Get Rates
|
|
8276
|
+
*
|
|
8277
|
+
* @see {@link RatesAPI | The Rates API module}
|
|
8278
|
+
*/
|
|
8020
8279
|
get rates() {
|
|
8021
8280
|
return new RatesAPI(this.client);
|
|
8022
8281
|
}
|
|
8282
|
+
/**
|
|
8283
|
+
* The `salesOrderShipments` method provides access to the `v-beta` Sales
|
|
8284
|
+
* Order Shipments endpoints in ShipEngine API.
|
|
8285
|
+
*
|
|
8286
|
+
* @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
|
|
8287
|
+
*/
|
|
8023
8288
|
get salesOrderShipments() {
|
|
8024
8289
|
return new SalesOrderShipmentsAPI(this.client);
|
|
8025
8290
|
}
|
|
8291
|
+
/**
|
|
8292
|
+
* The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
|
|
8293
|
+
* in ShipEngine API.
|
|
8294
|
+
*
|
|
8295
|
+
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
8296
|
+
*/
|
|
8026
8297
|
get salesOrders() {
|
|
8027
8298
|
return new SalesOrdersAPI(this.client);
|
|
8028
8299
|
}
|
|
8300
|
+
/**
|
|
8301
|
+
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
8302
|
+
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
8303
|
+
*
|
|
8304
|
+
* @see {@link ShipmentsAPI | The Shipments API module}
|
|
8305
|
+
*/
|
|
8029
8306
|
get shipments() {
|
|
8030
8307
|
return new ShipmentsAPI(this.client);
|
|
8031
8308
|
}
|
|
8309
|
+
/**
|
|
8310
|
+
* The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
|
|
8311
|
+
* API. e.g. List Warehouses, Get Warehouse, etc.
|
|
8312
|
+
*
|
|
8313
|
+
* @see {@link WarehousesAPI | The Warehouses API module}
|
|
8314
|
+
*/
|
|
8032
8315
|
get warehouses() {
|
|
8033
8316
|
return new WarehousesAPI(this.client);
|
|
8034
8317
|
}
|