@shipengine/js-api 0.31.0 → 0.32.1
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/account-settings/api.d.ts +11 -0
- package/addresses/api.d.ts +11 -0
- package/carriers/api.d.ts +52 -0
- package/client.d.ts +108 -0
- package/custom-packages/api.d.ts +6 -0
- package/funding-sources/api.d.ts +25 -0
- package/index.js +289 -0
- package/index.mjs +289 -0
- package/insurance/api.d.ts +7 -0
- package/labels/api.d.ts +51 -0
- package/order-sources/api.d.ts +13 -0
- package/package.json +1 -1
- package/rate-cards/api.d.ts +29 -0
- package/rates/api.d.ts +26 -0
- package/sales-order-shipments/api.d.ts +70 -0
- package/sales-orders/api.d.ts +25 -0
- package/shipments/api.d.ts +43 -0
- package/warehouses/api.d.ts +19 -0
package/index.js
CHANGED
|
@@ -102,9 +102,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
102
102
|
class AccountSettingsAPI {
|
|
103
103
|
constructor(client) {
|
|
104
104
|
this.client = client;
|
|
105
|
+
/**
|
|
106
|
+
* The `get` method retrieves the account settings for a given user.
|
|
107
|
+
*/
|
|
105
108
|
this.get = () => {
|
|
106
109
|
return this.client.get("/v1/account/settings");
|
|
107
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* The `update` method updates specific account settings for a given user.
|
|
113
|
+
*
|
|
114
|
+
* @params Partial<AccountSettings> The account settings to update.
|
|
115
|
+
*/
|
|
108
116
|
this.update = (settings) => {
|
|
109
117
|
return this.client.put("/v1/account/settings", settings);
|
|
110
118
|
};
|
|
@@ -115,9 +123,17 @@ class AccountSettingsAPI {
|
|
|
115
123
|
class AddressesAPI {
|
|
116
124
|
constructor(client) {
|
|
117
125
|
this.client = client;
|
|
126
|
+
/**
|
|
127
|
+
* The `validate` method validates a list of addresses.
|
|
128
|
+
*
|
|
129
|
+
* @params Address[] The addresses to be validated.
|
|
130
|
+
*/
|
|
118
131
|
this.validate = (addresses) => {
|
|
119
132
|
return this.client.post("/v1/addresses/validate", addresses);
|
|
120
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* The `parse` method parses a string of text to extract addresses.
|
|
136
|
+
*/
|
|
121
137
|
this.parse = (text, address) => {
|
|
122
138
|
return this.client.put("/v1/addresses/recognize", {
|
|
123
139
|
address,
|
|
@@ -921,12 +937,21 @@ var __async$3 = (__this, __arguments, generator) => {
|
|
|
921
937
|
class CarriersAPI {
|
|
922
938
|
constructor(client) {
|
|
923
939
|
this.client = client;
|
|
940
|
+
/**
|
|
941
|
+
* The `list` method retrieves a list of connected carriers for a given user.
|
|
942
|
+
*/
|
|
924
943
|
this.list = () => {
|
|
925
944
|
return this.client.get("/v1/carriers");
|
|
926
945
|
};
|
|
946
|
+
/**
|
|
947
|
+
* The `get` method retrieves a specific carrier by `carrierId`.
|
|
948
|
+
*/
|
|
927
949
|
this.get = (carrierId) => {
|
|
928
950
|
return this.client.get(`/v1/carriers/${carrierId}`);
|
|
929
951
|
};
|
|
952
|
+
/**
|
|
953
|
+
* The `connect` method connects a carrier account to a user's ShipEngine account.
|
|
954
|
+
*/
|
|
930
955
|
this.connect = (_a) => __async$3(this, null, function* () {
|
|
931
956
|
var _b = _a, { carrierCode } = _b, connection = __objRest(_b, ["carrierCode"]);
|
|
932
957
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
@@ -936,20 +961,44 @@ class CarriersAPI {
|
|
|
936
961
|
endUserIpAddress
|
|
937
962
|
}));
|
|
938
963
|
});
|
|
964
|
+
/**
|
|
965
|
+
* The `addFunds` method allows a user to add funds to their carrier account balance.
|
|
966
|
+
* Not all carrier providers allow you to maintain a balance.
|
|
967
|
+
*
|
|
968
|
+
* - For example, FedEx does
|
|
969
|
+
* not require you to maintain a balance that will be used when purchasing labels.
|
|
970
|
+
*/
|
|
939
971
|
this.addFunds = (carrierId, funds) => {
|
|
940
972
|
return this.client.put(`/v1/carriers/${carrierId}/add_funds`, funds);
|
|
941
973
|
};
|
|
974
|
+
/**
|
|
975
|
+
* The `updateAutoFunding` method allows a user to update the auto-funding settings
|
|
976
|
+
* on their ShipEngine account.
|
|
977
|
+
*
|
|
978
|
+
* e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
|
|
979
|
+
* per day you wish to auto-fund your account.
|
|
980
|
+
*/
|
|
942
981
|
this.updateAutoFunding = (carrierId, options) => {
|
|
943
982
|
return this.client.post(
|
|
944
983
|
`/v1/carriers/${carrierId}/auto_funding`,
|
|
945
984
|
options
|
|
946
985
|
);
|
|
947
986
|
};
|
|
987
|
+
/**
|
|
988
|
+
* The `getAutoFunding` method retrieves the current auto-funding settings.
|
|
989
|
+
*
|
|
990
|
+
* If no auto-funding rules have been set, the response will contain the default
|
|
991
|
+
* values for auto-funding. Auto-funding is disabled by default.
|
|
992
|
+
*/
|
|
948
993
|
this.getAutoFunding = (carrierId) => {
|
|
949
994
|
return this.client.get(
|
|
950
995
|
`/v1/carriers/${carrierId}/auto_funding`
|
|
951
996
|
);
|
|
952
997
|
};
|
|
998
|
+
/**
|
|
999
|
+
* The `getWalletHistory` method retrieves the wallet transaction history for
|
|
1000
|
+
* a ShipEngine wallet account.
|
|
1001
|
+
*/
|
|
953
1002
|
this.getWalletHistory = (startDate, endDate, page) => {
|
|
954
1003
|
return this.client.get(`/v1/carriers/wallet_history`, {
|
|
955
1004
|
params: {
|
|
@@ -959,17 +1008,33 @@ class CarriersAPI {
|
|
|
959
1008
|
}
|
|
960
1009
|
});
|
|
961
1010
|
};
|
|
1011
|
+
/**
|
|
1012
|
+
* The `getServices` method retrieves a list of shipping services that a given carrier offers.
|
|
1013
|
+
*/
|
|
962
1014
|
this.getServices = (carrierId) => {
|
|
963
1015
|
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
964
1016
|
};
|
|
1017
|
+
/**
|
|
1018
|
+
* The `getPackageRatingGroup` method retrieves a list of package rating groups.
|
|
1019
|
+
* This is primarily used for carriers that support negotiated rates, and a user
|
|
1020
|
+
* has a rate card with multiple package rating groups.
|
|
1021
|
+
*/
|
|
965
1022
|
this.getPackageRatingGroup = (carrierId) => {
|
|
966
1023
|
return this.client.get(
|
|
967
1024
|
`/v1/carriers/${carrierId}/package_rating_group`
|
|
968
1025
|
);
|
|
969
1026
|
};
|
|
1027
|
+
/**
|
|
1028
|
+
* The `getCountries` method retrieves a list of countries that a given carrier
|
|
1029
|
+
* supports shipping to.
|
|
1030
|
+
*/
|
|
970
1031
|
this.getCountries = (carrierId) => {
|
|
971
1032
|
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
972
1033
|
};
|
|
1034
|
+
/**
|
|
1035
|
+
* The `getCurrencies` method retrieves a list of currencies that a given carrier
|
|
1036
|
+
* supports the usage of.
|
|
1037
|
+
*/
|
|
973
1038
|
this.getCurrencies = (carrierId) => {
|
|
974
1039
|
return this.client.get(`/v1/carriers/${carrierId}/currencies`);
|
|
975
1040
|
};
|
|
@@ -3157,6 +3222,9 @@ var lib = {
|
|
|
3157
3222
|
class CustomPackagesAPI {
|
|
3158
3223
|
constructor(client) {
|
|
3159
3224
|
this.client = client;
|
|
3225
|
+
/**
|
|
3226
|
+
* The `list` method retrieves a list of custom packages a given user has created.
|
|
3227
|
+
*/
|
|
3160
3228
|
this.list = () => {
|
|
3161
3229
|
return this.client.get("/v1/packages");
|
|
3162
3230
|
};
|
|
@@ -3203,12 +3271,22 @@ var __async$2 = (__this, __arguments, generator) => {
|
|
|
3203
3271
|
class FundingSourcesAPI {
|
|
3204
3272
|
constructor(client) {
|
|
3205
3273
|
this.client = client;
|
|
3274
|
+
/**
|
|
3275
|
+
* The `list` method retrieves a list of funding sources for a given user.
|
|
3276
|
+
*/
|
|
3206
3277
|
this.list = () => {
|
|
3207
3278
|
return this.client.get("/v1/funding_sources");
|
|
3208
3279
|
};
|
|
3280
|
+
/**
|
|
3281
|
+
* The `get` method retrieves a specific funding source by `fundingSourceId`.
|
|
3282
|
+
*/
|
|
3209
3283
|
this.get = (fundingSourceId) => {
|
|
3210
3284
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
3211
3285
|
};
|
|
3286
|
+
/**
|
|
3287
|
+
* The `create` method creates a new funding source for a given user. This requires
|
|
3288
|
+
* payment information to be collected from the user.
|
|
3289
|
+
*/
|
|
3212
3290
|
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
3213
3291
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3214
3292
|
if (!endUserIpAddress)
|
|
@@ -3217,6 +3295,11 @@ class FundingSourcesAPI {
|
|
|
3217
3295
|
endUserIpAddress
|
|
3218
3296
|
}, createFundingSource));
|
|
3219
3297
|
});
|
|
3298
|
+
/**
|
|
3299
|
+
* The `update` method updates a funding source for a given user. This allows the
|
|
3300
|
+
* user to update the billing address or payment information associated with the
|
|
3301
|
+
* funding source.
|
|
3302
|
+
*/
|
|
3220
3303
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
3221
3304
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3222
3305
|
if (!endUserIpAddress)
|
|
@@ -3230,6 +3313,10 @@ class FundingSourcesAPI {
|
|
|
3230
3313
|
}
|
|
3231
3314
|
);
|
|
3232
3315
|
});
|
|
3316
|
+
/**
|
|
3317
|
+
* The `registerCarrier` method registers a carrier account and associates
|
|
3318
|
+
* it with a given funding source.
|
|
3319
|
+
*/
|
|
3233
3320
|
this.registerCarrier = (carrier) => __async$2(this, null, function* () {
|
|
3234
3321
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3235
3322
|
if (!endUserIpAddress)
|
|
@@ -3238,6 +3325,9 @@ class FundingSourcesAPI {
|
|
|
3238
3325
|
endUserIpAddress
|
|
3239
3326
|
}, carrier));
|
|
3240
3327
|
});
|
|
3328
|
+
/**
|
|
3329
|
+
* The `addFunds` method allows you to add funds to a funding source.
|
|
3330
|
+
*/
|
|
3241
3331
|
this.addFunds = (amount, fundingSourceId) => __async$2(this, null, function* () {
|
|
3242
3332
|
return yield this.client.put(
|
|
3243
3333
|
`/v1/funding_sources/${fundingSourceId}/add_funds`,
|
|
@@ -3251,6 +3341,10 @@ class FundingSourcesAPI {
|
|
|
3251
3341
|
class InsuranceAPI {
|
|
3252
3342
|
constructor(client) {
|
|
3253
3343
|
this.client = client;
|
|
3344
|
+
/**
|
|
3345
|
+
* The `get` method retrieves the insurance balance for a given `insuranceProvider`
|
|
3346
|
+
* by ID.
|
|
3347
|
+
*/
|
|
3254
3348
|
this.get = (insuranceProvider) => {
|
|
3255
3349
|
return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
|
|
3256
3350
|
};
|
|
@@ -3261,15 +3355,31 @@ class InsuranceAPI {
|
|
|
3261
3355
|
class LabelsAPI {
|
|
3262
3356
|
constructor(client) {
|
|
3263
3357
|
this.client = client;
|
|
3358
|
+
/**
|
|
3359
|
+
* The `get` method retrieves a specific label by `labelId`.
|
|
3360
|
+
*/
|
|
3264
3361
|
this.get = (labelId) => {
|
|
3265
3362
|
return this.client.get(`/v1/labels/${labelId}`);
|
|
3266
3363
|
};
|
|
3364
|
+
/**
|
|
3365
|
+
* The `list` method retrieves a list of labels created by a given user.
|
|
3366
|
+
*/
|
|
3267
3367
|
this.list = (params = {}) => {
|
|
3268
3368
|
return this.client.get("/v1/labels", { params });
|
|
3269
3369
|
};
|
|
3370
|
+
/**
|
|
3371
|
+
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
3372
|
+
* which is a unique identifier tied to a specific rate.
|
|
3373
|
+
*
|
|
3374
|
+
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
3375
|
+
* label for the price they were initially rated.
|
|
3376
|
+
*/
|
|
3270
3377
|
this.createByRateId = (rateId, options) => {
|
|
3271
3378
|
return this.client.post(`/v1/labels/rates/${rateId}`, options);
|
|
3272
3379
|
};
|
|
3380
|
+
/**
|
|
3381
|
+
* The `void` method allows a user to void a label by `labelId`.
|
|
3382
|
+
*/
|
|
3273
3383
|
this.void = (labelId) => {
|
|
3274
3384
|
return this.client.put(`/v1/labels/${labelId}/void`);
|
|
3275
3385
|
};
|
|
@@ -3280,12 +3390,22 @@ class LabelsAPI {
|
|
|
3280
3390
|
class OrderSourcesAPI {
|
|
3281
3391
|
constructor(client) {
|
|
3282
3392
|
this.client = client;
|
|
3393
|
+
/**
|
|
3394
|
+
* The `list` method retrieves a list of connected order sources for a given user.
|
|
3395
|
+
*/
|
|
3283
3396
|
this.list = () => {
|
|
3284
3397
|
return this.client.get("/v-beta/order_sources");
|
|
3285
3398
|
};
|
|
3399
|
+
/**
|
|
3400
|
+
* The `get` method retrieves a specific order source by `orderSourceId`.
|
|
3401
|
+
*/
|
|
3286
3402
|
this.get = (orderSourceId) => {
|
|
3287
3403
|
return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
|
|
3288
3404
|
};
|
|
3405
|
+
/**
|
|
3406
|
+
* The `refresh` method refreshes a specific order source by `orderSourceId`.
|
|
3407
|
+
* This will pull in any `new orders` since the last order import.
|
|
3408
|
+
*/
|
|
3289
3409
|
this.refresh = (orderSourceId) => {
|
|
3290
3410
|
return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
|
|
3291
3411
|
};
|
|
@@ -3296,20 +3416,36 @@ class OrderSourcesAPI {
|
|
|
3296
3416
|
class RateCardsAPI {
|
|
3297
3417
|
constructor(client) {
|
|
3298
3418
|
this.client = client;
|
|
3419
|
+
/**
|
|
3420
|
+
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
3421
|
+
*/
|
|
3299
3422
|
this.list = (carrierIds) => {
|
|
3300
3423
|
return this.client.get(
|
|
3301
3424
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
3302
3425
|
);
|
|
3303
3426
|
};
|
|
3427
|
+
/**
|
|
3428
|
+
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
3429
|
+
*/
|
|
3304
3430
|
this.get = (rateCardId) => {
|
|
3305
3431
|
return this.client.get(`/v1/rate_cards/${rateCardId}`);
|
|
3306
3432
|
};
|
|
3433
|
+
/**
|
|
3434
|
+
* The `create` method creates a new rate card for a given user.
|
|
3435
|
+
*/
|
|
3307
3436
|
this.create = (rateCardInput) => {
|
|
3308
3437
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3309
3438
|
};
|
|
3439
|
+
/**
|
|
3440
|
+
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
3441
|
+
* `RateCard`.
|
|
3442
|
+
*/
|
|
3310
3443
|
this.update = (rateCard) => {
|
|
3311
3444
|
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
3312
3445
|
};
|
|
3446
|
+
/**
|
|
3447
|
+
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
3448
|
+
*/
|
|
3313
3449
|
this.download = (rateCardId) => {
|
|
3314
3450
|
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
3315
3451
|
headers: {
|
|
@@ -3318,6 +3454,9 @@ class RateCardsAPI {
|
|
|
3318
3454
|
responseType: "blob"
|
|
3319
3455
|
});
|
|
3320
3456
|
};
|
|
3457
|
+
/**
|
|
3458
|
+
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
3459
|
+
*/
|
|
3321
3460
|
this.upload = (rateCardId, file) => {
|
|
3322
3461
|
const formData = new FormData();
|
|
3323
3462
|
formData.append("file", file);
|
|
@@ -3327,9 +3466,18 @@ class RateCardsAPI {
|
|
|
3327
3466
|
}
|
|
3328
3467
|
});
|
|
3329
3468
|
};
|
|
3469
|
+
/**
|
|
3470
|
+
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
3471
|
+
*/
|
|
3330
3472
|
this.publish = (rateCardId) => {
|
|
3331
3473
|
return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
|
|
3332
3474
|
};
|
|
3475
|
+
/**
|
|
3476
|
+
* @description https://auctane.atlassian.net/wiki/spaces/TE/pages/3837431603/Inc+1+3.+Rate+Card+Details#Delete-Rate-Card
|
|
3477
|
+
*/
|
|
3478
|
+
this.delete = (rateCardId) => {
|
|
3479
|
+
return this.client.delete(`/v1/rate_cards/${rateCardId}`);
|
|
3480
|
+
};
|
|
3333
3481
|
this.client = client;
|
|
3334
3482
|
}
|
|
3335
3483
|
}
|
|
@@ -3337,6 +3485,10 @@ class RateCardsAPI {
|
|
|
3337
3485
|
class RatesAPI {
|
|
3338
3486
|
constructor(client) {
|
|
3339
3487
|
this.client = client;
|
|
3488
|
+
/**
|
|
3489
|
+
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
3490
|
+
* on the shipment's options.
|
|
3491
|
+
*/
|
|
3340
3492
|
this.calculateByShipmentId = (shipmentId, options) => {
|
|
3341
3493
|
return this.client.post("/v1/rates", {
|
|
3342
3494
|
rateOptions: options,
|
|
@@ -3350,20 +3502,32 @@ class RatesAPI {
|
|
|
3350
3502
|
class SalesOrderShipmentsAPI {
|
|
3351
3503
|
constructor(client) {
|
|
3352
3504
|
this.client = client;
|
|
3505
|
+
/**
|
|
3506
|
+
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
3507
|
+
*/
|
|
3353
3508
|
this.list = (body = {}, params) => {
|
|
3354
3509
|
return this.client.post("/v-beta/shipments/list", body, {
|
|
3355
3510
|
params
|
|
3356
3511
|
});
|
|
3357
3512
|
};
|
|
3513
|
+
/**
|
|
3514
|
+
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
3515
|
+
*/
|
|
3358
3516
|
this.get = (shipmentId) => {
|
|
3359
3517
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
3360
3518
|
};
|
|
3519
|
+
/**
|
|
3520
|
+
* The `create` method creates a new shipment for a sales order.
|
|
3521
|
+
*/
|
|
3361
3522
|
this.create = (salesOrderId, shipment) => {
|
|
3362
3523
|
return this.client.post(
|
|
3363
3524
|
`/v-beta/shipments/sales_order/${salesOrderId}`,
|
|
3364
3525
|
shipment
|
|
3365
3526
|
);
|
|
3366
3527
|
};
|
|
3528
|
+
/**
|
|
3529
|
+
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
3530
|
+
*/
|
|
3367
3531
|
this.update = (shipmentId, shipment) => {
|
|
3368
3532
|
return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
|
|
3369
3533
|
};
|
|
@@ -3374,12 +3538,23 @@ class SalesOrderShipmentsAPI {
|
|
|
3374
3538
|
class SalesOrdersAPI {
|
|
3375
3539
|
constructor(client) {
|
|
3376
3540
|
this.client = client;
|
|
3541
|
+
/**
|
|
3542
|
+
* The `list` method retrieves a list of sales orders.
|
|
3543
|
+
*/
|
|
3377
3544
|
this.list = (params = {}) => {
|
|
3378
3545
|
return this.client.get("/v-beta/sales_orders", { params });
|
|
3379
3546
|
};
|
|
3547
|
+
/**
|
|
3548
|
+
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
3549
|
+
*/
|
|
3380
3550
|
this.get = (salesOrderId) => {
|
|
3381
3551
|
return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
|
|
3382
3552
|
};
|
|
3553
|
+
/**
|
|
3554
|
+
* The `notifyShipped` method notifies order source that the order has been
|
|
3555
|
+
* shipped. Typically, the order source will then notify the user based on
|
|
3556
|
+
* this update from ShipEngine API.
|
|
3557
|
+
*/
|
|
3383
3558
|
this.notifyShipped = (salesOrderId, tracking) => {
|
|
3384
3559
|
return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
|
|
3385
3560
|
};
|
|
@@ -3410,15 +3585,26 @@ var __async$1 = (__this, __arguments, generator) => {
|
|
|
3410
3585
|
class ShipmentsAPI {
|
|
3411
3586
|
constructor(client) {
|
|
3412
3587
|
this.client = client;
|
|
3588
|
+
/**
|
|
3589
|
+
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
3590
|
+
* shipment ID.
|
|
3591
|
+
*/
|
|
3413
3592
|
this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
|
|
3414
3593
|
return this.client.get(
|
|
3415
3594
|
`/v1/shipments/${shipmentId}/rates`,
|
|
3416
3595
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
3417
3596
|
);
|
|
3418
3597
|
};
|
|
3598
|
+
/**
|
|
3599
|
+
* The `list` method retrieves a list of shipments for a given user.
|
|
3600
|
+
*/
|
|
3419
3601
|
this.list = (options) => {
|
|
3420
3602
|
return this.client.get("/v1/shipments", { params: options });
|
|
3421
3603
|
};
|
|
3604
|
+
/**
|
|
3605
|
+
* The `create` method allows for creating shipments based on a list of shipment
|
|
3606
|
+
* items passed into this method.
|
|
3607
|
+
*/
|
|
3422
3608
|
this.create = (...shipments) => __async$1(this, null, function* () {
|
|
3423
3609
|
return this.client.post("/v1/shipments", {
|
|
3424
3610
|
shipments
|
|
@@ -3431,15 +3617,31 @@ class ShipmentsAPI {
|
|
|
3431
3617
|
class WarehousesAPI {
|
|
3432
3618
|
constructor(client) {
|
|
3433
3619
|
this.client = client;
|
|
3620
|
+
/**
|
|
3621
|
+
* The `list` method retrieves a list of `warehouses` (Ship From Locations)
|
|
3622
|
+
* for a given user.
|
|
3623
|
+
*/
|
|
3434
3624
|
this.list = () => {
|
|
3435
3625
|
return this.client.get("/v1/warehouses");
|
|
3436
3626
|
};
|
|
3627
|
+
/**
|
|
3628
|
+
* The `create` method allows for creation of warehouses (Ship From Locations)
|
|
3629
|
+
* on a users ShipEngine account.
|
|
3630
|
+
*/
|
|
3437
3631
|
this.create = (warehouse) => {
|
|
3438
3632
|
return this.client.post("/v1/warehouses", warehouse);
|
|
3439
3633
|
};
|
|
3634
|
+
/**
|
|
3635
|
+
* The `update` method updates a specific warehouse (Ship From Location) for a
|
|
3636
|
+
* given user by `warehouseId`.
|
|
3637
|
+
*/
|
|
3440
3638
|
this.update = (warehouseId, warehouse) => {
|
|
3441
3639
|
return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
|
|
3442
3640
|
};
|
|
3641
|
+
/**
|
|
3642
|
+
* The `delete` method deletes a specific warehouse (Ship From Location) by
|
|
3643
|
+
* `warehouseId` from a users ShipEngine account.
|
|
3644
|
+
*/
|
|
3443
3645
|
this.delete = (warehouseId) => {
|
|
3444
3646
|
return this.client.delete(`/v1/warehouses/${warehouseId}`);
|
|
3445
3647
|
};
|
|
@@ -3600,48 +3802,135 @@ class ShipEngineAPI {
|
|
|
3600
3802
|
);
|
|
3601
3803
|
this.client = client;
|
|
3602
3804
|
}
|
|
3805
|
+
/**
|
|
3806
|
+
* The `token` method takes in a string and sets it as the Authorization header for all requests.
|
|
3807
|
+
*/
|
|
3603
3808
|
set token(token) {
|
|
3604
3809
|
this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
3605
3810
|
}
|
|
3811
|
+
/**
|
|
3812
|
+
* The `accountSettings` method provides access to the Account Settings endpoints
|
|
3813
|
+
* in ShipEngine API.
|
|
3814
|
+
*
|
|
3815
|
+
* @see {@link AccountSettingsAPI | The Account Settings API module}
|
|
3816
|
+
*/
|
|
3606
3817
|
get accountSettings() {
|
|
3607
3818
|
return new AccountSettingsAPI(this.client);
|
|
3608
3819
|
}
|
|
3820
|
+
/**
|
|
3821
|
+
* The `addresses` method provides access to the Address Validation endpoints
|
|
3822
|
+
* in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
|
|
3823
|
+
*
|
|
3824
|
+
* @see {@link AddressesAPI | The Addresses API module}
|
|
3825
|
+
*/
|
|
3609
3826
|
get addresses() {
|
|
3610
3827
|
return new AddressesAPI(this.client);
|
|
3611
3828
|
}
|
|
3829
|
+
/**
|
|
3830
|
+
* The `carriers` method provides access to the Carrier endpoints in ShipEngine
|
|
3831
|
+
* API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
|
|
3832
|
+
*
|
|
3833
|
+
* @see {@link CarriersAPI | The Carriers API module}
|
|
3834
|
+
*/
|
|
3612
3835
|
get carriers() {
|
|
3613
3836
|
return new CarriersAPI(this.client);
|
|
3614
3837
|
}
|
|
3838
|
+
/**
|
|
3839
|
+
* The `customPackages` method provides access to the Packages endpoint in ShipEngine
|
|
3840
|
+
* API. e.g. List Packages
|
|
3841
|
+
*
|
|
3842
|
+
* @see {@link CustomPackagesAPI | The Custom Packages API module}
|
|
3843
|
+
*/
|
|
3615
3844
|
get customPackages() {
|
|
3616
3845
|
return new CustomPackagesAPI(this.client);
|
|
3617
3846
|
}
|
|
3847
|
+
/**
|
|
3848
|
+
* The `fundingSources` method provides access to the Funding Sources endpoints
|
|
3849
|
+
* in ShipEngine API.
|
|
3850
|
+
*
|
|
3851
|
+
* @see {@link FundingSourcesAPI | The Funding Sources API module}
|
|
3852
|
+
*/
|
|
3618
3853
|
get fundingSources() {
|
|
3619
3854
|
return new FundingSourcesAPI(this.client);
|
|
3620
3855
|
}
|
|
3856
|
+
/**
|
|
3857
|
+
* The `insurance` method provides access to the Insurance endpoint in ShipEngine
|
|
3858
|
+
* API. e.g. Get Insurance Balance
|
|
3859
|
+
*
|
|
3860
|
+
* @see {@link InsuranceAPI | The Insurance API module}
|
|
3861
|
+
*/
|
|
3621
3862
|
get insurance() {
|
|
3622
3863
|
return new InsuranceAPI(this.client);
|
|
3623
3864
|
}
|
|
3865
|
+
/**
|
|
3866
|
+
* The `labels` method provides access to the Label endpoints in ShipEngine API.
|
|
3867
|
+
* e.g. Create Label, Get Label, Void Label, etc.
|
|
3868
|
+
*
|
|
3869
|
+
* @see {@link LabelsAPI | The Labels API module}
|
|
3870
|
+
*/
|
|
3624
3871
|
get labels() {
|
|
3625
3872
|
return new LabelsAPI(this.client);
|
|
3626
3873
|
}
|
|
3874
|
+
/**
|
|
3875
|
+
* The `orderSources` method provides access to the Order Sources endpoints in
|
|
3876
|
+
* ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
|
|
3877
|
+
*
|
|
3878
|
+
* @see {@link OrderSourcesAPI | The Order Sources API module}
|
|
3879
|
+
*/
|
|
3627
3880
|
get orderSources() {
|
|
3628
3881
|
return new OrderSourcesAPI(this.client);
|
|
3629
3882
|
}
|
|
3883
|
+
/**
|
|
3884
|
+
* The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
|
|
3885
|
+
* API.
|
|
3886
|
+
*
|
|
3887
|
+
* @see {@link RateCardsAPI | The Rate Cards API module}
|
|
3888
|
+
*/
|
|
3630
3889
|
get rateCards() {
|
|
3631
3890
|
return new RateCardsAPI(this.client);
|
|
3632
3891
|
}
|
|
3892
|
+
/**
|
|
3893
|
+
* The `rates` method provides access to the Rate endpoints in ShipEngine API.
|
|
3894
|
+
* e.g. Get Rates
|
|
3895
|
+
*
|
|
3896
|
+
* @see {@link RatesAPI | The Rates API module}
|
|
3897
|
+
*/
|
|
3633
3898
|
get rates() {
|
|
3634
3899
|
return new RatesAPI(this.client);
|
|
3635
3900
|
}
|
|
3901
|
+
/**
|
|
3902
|
+
* The `salesOrderShipments` method provides access to the `v-beta` Sales
|
|
3903
|
+
* Order Shipments endpoints in ShipEngine API.
|
|
3904
|
+
*
|
|
3905
|
+
* @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
|
|
3906
|
+
*/
|
|
3636
3907
|
get salesOrderShipments() {
|
|
3637
3908
|
return new SalesOrderShipmentsAPI(this.client);
|
|
3638
3909
|
}
|
|
3910
|
+
/**
|
|
3911
|
+
* The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
|
|
3912
|
+
* in ShipEngine API.
|
|
3913
|
+
*
|
|
3914
|
+
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
3915
|
+
*/
|
|
3639
3916
|
get salesOrders() {
|
|
3640
3917
|
return new SalesOrdersAPI(this.client);
|
|
3641
3918
|
}
|
|
3919
|
+
/**
|
|
3920
|
+
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
3921
|
+
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
3922
|
+
*
|
|
3923
|
+
* @see {@link ShipmentsAPI | The Shipments API module}
|
|
3924
|
+
*/
|
|
3642
3925
|
get shipments() {
|
|
3643
3926
|
return new ShipmentsAPI(this.client);
|
|
3644
3927
|
}
|
|
3928
|
+
/**
|
|
3929
|
+
* The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
|
|
3930
|
+
* API. e.g. List Warehouses, Get Warehouse, etc.
|
|
3931
|
+
*
|
|
3932
|
+
* @see {@link WarehousesAPI | The Warehouses API module}
|
|
3933
|
+
*/
|
|
3645
3934
|
get warehouses() {
|
|
3646
3935
|
return new WarehousesAPI(this.client);
|
|
3647
3936
|
}
|