@shipengine/js-api 0.32.0 → 0.33.0
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 +60 -1
- package/carriers/types.d.ts +4 -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 +290 -0
- package/index.mjs +290 -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 +25 -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,20 +1008,43 @@ 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
|
};
|
|
1041
|
+
/**
|
|
1042
|
+
* The `getZones` method retrieves a list of zones for which the attached carrier
|
|
1043
|
+
* provides support to.
|
|
1044
|
+
*/
|
|
1045
|
+
this.getZones = (carrierId) => {
|
|
1046
|
+
return this.client.get(`/v1/carriers/${carrierId}/zones`);
|
|
1047
|
+
};
|
|
976
1048
|
this.client = client;
|
|
977
1049
|
}
|
|
978
1050
|
}
|
|
@@ -3157,6 +3229,9 @@ var lib = {
|
|
|
3157
3229
|
class CustomPackagesAPI {
|
|
3158
3230
|
constructor(client) {
|
|
3159
3231
|
this.client = client;
|
|
3232
|
+
/**
|
|
3233
|
+
* The `list` method retrieves a list of custom packages a given user has created.
|
|
3234
|
+
*/
|
|
3160
3235
|
this.list = () => {
|
|
3161
3236
|
return this.client.get("/v1/packages");
|
|
3162
3237
|
};
|
|
@@ -3203,12 +3278,22 @@ var __async$2 = (__this, __arguments, generator) => {
|
|
|
3203
3278
|
class FundingSourcesAPI {
|
|
3204
3279
|
constructor(client) {
|
|
3205
3280
|
this.client = client;
|
|
3281
|
+
/**
|
|
3282
|
+
* The `list` method retrieves a list of funding sources for a given user.
|
|
3283
|
+
*/
|
|
3206
3284
|
this.list = () => {
|
|
3207
3285
|
return this.client.get("/v1/funding_sources");
|
|
3208
3286
|
};
|
|
3287
|
+
/**
|
|
3288
|
+
* The `get` method retrieves a specific funding source by `fundingSourceId`.
|
|
3289
|
+
*/
|
|
3209
3290
|
this.get = (fundingSourceId) => {
|
|
3210
3291
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
3211
3292
|
};
|
|
3293
|
+
/**
|
|
3294
|
+
* The `create` method creates a new funding source for a given user. This requires
|
|
3295
|
+
* payment information to be collected from the user.
|
|
3296
|
+
*/
|
|
3212
3297
|
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
3213
3298
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3214
3299
|
if (!endUserIpAddress)
|
|
@@ -3217,6 +3302,11 @@ class FundingSourcesAPI {
|
|
|
3217
3302
|
endUserIpAddress
|
|
3218
3303
|
}, createFundingSource));
|
|
3219
3304
|
});
|
|
3305
|
+
/**
|
|
3306
|
+
* The `update` method updates a funding source for a given user. This allows the
|
|
3307
|
+
* user to update the billing address or payment information associated with the
|
|
3308
|
+
* funding source.
|
|
3309
|
+
*/
|
|
3220
3310
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
3221
3311
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3222
3312
|
if (!endUserIpAddress)
|
|
@@ -3230,6 +3320,10 @@ class FundingSourcesAPI {
|
|
|
3230
3320
|
}
|
|
3231
3321
|
);
|
|
3232
3322
|
});
|
|
3323
|
+
/**
|
|
3324
|
+
* The `registerCarrier` method registers a carrier account and associates
|
|
3325
|
+
* it with a given funding source.
|
|
3326
|
+
*/
|
|
3233
3327
|
this.registerCarrier = (carrier) => __async$2(this, null, function* () {
|
|
3234
3328
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3235
3329
|
if (!endUserIpAddress)
|
|
@@ -3238,6 +3332,9 @@ class FundingSourcesAPI {
|
|
|
3238
3332
|
endUserIpAddress
|
|
3239
3333
|
}, carrier));
|
|
3240
3334
|
});
|
|
3335
|
+
/**
|
|
3336
|
+
* The `addFunds` method allows you to add funds to a funding source.
|
|
3337
|
+
*/
|
|
3241
3338
|
this.addFunds = (amount, fundingSourceId) => __async$2(this, null, function* () {
|
|
3242
3339
|
return yield this.client.put(
|
|
3243
3340
|
`/v1/funding_sources/${fundingSourceId}/add_funds`,
|
|
@@ -3251,6 +3348,10 @@ class FundingSourcesAPI {
|
|
|
3251
3348
|
class InsuranceAPI {
|
|
3252
3349
|
constructor(client) {
|
|
3253
3350
|
this.client = client;
|
|
3351
|
+
/**
|
|
3352
|
+
* The `get` method retrieves the insurance balance for a given `insuranceProvider`
|
|
3353
|
+
* by ID.
|
|
3354
|
+
*/
|
|
3254
3355
|
this.get = (insuranceProvider) => {
|
|
3255
3356
|
return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
|
|
3256
3357
|
};
|
|
@@ -3261,15 +3362,31 @@ class InsuranceAPI {
|
|
|
3261
3362
|
class LabelsAPI {
|
|
3262
3363
|
constructor(client) {
|
|
3263
3364
|
this.client = client;
|
|
3365
|
+
/**
|
|
3366
|
+
* The `get` method retrieves a specific label by `labelId`.
|
|
3367
|
+
*/
|
|
3264
3368
|
this.get = (labelId) => {
|
|
3265
3369
|
return this.client.get(`/v1/labels/${labelId}`);
|
|
3266
3370
|
};
|
|
3371
|
+
/**
|
|
3372
|
+
* The `list` method retrieves a list of labels created by a given user.
|
|
3373
|
+
*/
|
|
3267
3374
|
this.list = (params = {}) => {
|
|
3268
3375
|
return this.client.get("/v1/labels", { params });
|
|
3269
3376
|
};
|
|
3377
|
+
/**
|
|
3378
|
+
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
3379
|
+
* which is a unique identifier tied to a specific rate.
|
|
3380
|
+
*
|
|
3381
|
+
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
3382
|
+
* label for the price they were initially rated.
|
|
3383
|
+
*/
|
|
3270
3384
|
this.createByRateId = (rateId, options) => {
|
|
3271
3385
|
return this.client.post(`/v1/labels/rates/${rateId}`, options);
|
|
3272
3386
|
};
|
|
3387
|
+
/**
|
|
3388
|
+
* The `void` method allows a user to void a label by `labelId`.
|
|
3389
|
+
*/
|
|
3273
3390
|
this.void = (labelId) => {
|
|
3274
3391
|
return this.client.put(`/v1/labels/${labelId}/void`);
|
|
3275
3392
|
};
|
|
@@ -3280,12 +3397,22 @@ class LabelsAPI {
|
|
|
3280
3397
|
class OrderSourcesAPI {
|
|
3281
3398
|
constructor(client) {
|
|
3282
3399
|
this.client = client;
|
|
3400
|
+
/**
|
|
3401
|
+
* The `list` method retrieves a list of connected order sources for a given user.
|
|
3402
|
+
*/
|
|
3283
3403
|
this.list = () => {
|
|
3284
3404
|
return this.client.get("/v-beta/order_sources");
|
|
3285
3405
|
};
|
|
3406
|
+
/**
|
|
3407
|
+
* The `get` method retrieves a specific order source by `orderSourceId`.
|
|
3408
|
+
*/
|
|
3286
3409
|
this.get = (orderSourceId) => {
|
|
3287
3410
|
return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
|
|
3288
3411
|
};
|
|
3412
|
+
/**
|
|
3413
|
+
* The `refresh` method refreshes a specific order source by `orderSourceId`.
|
|
3414
|
+
* This will pull in any `new orders` since the last order import.
|
|
3415
|
+
*/
|
|
3289
3416
|
this.refresh = (orderSourceId) => {
|
|
3290
3417
|
return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
|
|
3291
3418
|
};
|
|
@@ -3296,20 +3423,36 @@ class OrderSourcesAPI {
|
|
|
3296
3423
|
class RateCardsAPI {
|
|
3297
3424
|
constructor(client) {
|
|
3298
3425
|
this.client = client;
|
|
3426
|
+
/**
|
|
3427
|
+
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
3428
|
+
*/
|
|
3299
3429
|
this.list = (carrierIds) => {
|
|
3300
3430
|
return this.client.get(
|
|
3301
3431
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
3302
3432
|
);
|
|
3303
3433
|
};
|
|
3434
|
+
/**
|
|
3435
|
+
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
3436
|
+
*/
|
|
3304
3437
|
this.get = (rateCardId) => {
|
|
3305
3438
|
return this.client.get(`/v1/rate_cards/${rateCardId}`);
|
|
3306
3439
|
};
|
|
3440
|
+
/**
|
|
3441
|
+
* The `create` method creates a new rate card for a given user.
|
|
3442
|
+
*/
|
|
3307
3443
|
this.create = (rateCardInput) => {
|
|
3308
3444
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3309
3445
|
};
|
|
3446
|
+
/**
|
|
3447
|
+
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
3448
|
+
* `RateCard`.
|
|
3449
|
+
*/
|
|
3310
3450
|
this.update = (rateCard) => {
|
|
3311
3451
|
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
3312
3452
|
};
|
|
3453
|
+
/**
|
|
3454
|
+
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
3455
|
+
*/
|
|
3313
3456
|
this.download = (rateCardId) => {
|
|
3314
3457
|
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
3315
3458
|
headers: {
|
|
@@ -3318,6 +3461,9 @@ class RateCardsAPI {
|
|
|
3318
3461
|
responseType: "blob"
|
|
3319
3462
|
});
|
|
3320
3463
|
};
|
|
3464
|
+
/**
|
|
3465
|
+
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
3466
|
+
*/
|
|
3321
3467
|
this.upload = (rateCardId, file) => {
|
|
3322
3468
|
const formData = new FormData();
|
|
3323
3469
|
formData.append("file", file);
|
|
@@ -3327,6 +3473,9 @@ class RateCardsAPI {
|
|
|
3327
3473
|
}
|
|
3328
3474
|
});
|
|
3329
3475
|
};
|
|
3476
|
+
/**
|
|
3477
|
+
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
3478
|
+
*/
|
|
3330
3479
|
this.publish = (rateCardId) => {
|
|
3331
3480
|
return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
|
|
3332
3481
|
};
|
|
@@ -3343,6 +3492,10 @@ class RateCardsAPI {
|
|
|
3343
3492
|
class RatesAPI {
|
|
3344
3493
|
constructor(client) {
|
|
3345
3494
|
this.client = client;
|
|
3495
|
+
/**
|
|
3496
|
+
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
3497
|
+
* on the shipment's options.
|
|
3498
|
+
*/
|
|
3346
3499
|
this.calculateByShipmentId = (shipmentId, options) => {
|
|
3347
3500
|
return this.client.post("/v1/rates", {
|
|
3348
3501
|
rateOptions: options,
|
|
@@ -3356,20 +3509,32 @@ class RatesAPI {
|
|
|
3356
3509
|
class SalesOrderShipmentsAPI {
|
|
3357
3510
|
constructor(client) {
|
|
3358
3511
|
this.client = client;
|
|
3512
|
+
/**
|
|
3513
|
+
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
3514
|
+
*/
|
|
3359
3515
|
this.list = (body = {}, params) => {
|
|
3360
3516
|
return this.client.post("/v-beta/shipments/list", body, {
|
|
3361
3517
|
params
|
|
3362
3518
|
});
|
|
3363
3519
|
};
|
|
3520
|
+
/**
|
|
3521
|
+
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
3522
|
+
*/
|
|
3364
3523
|
this.get = (shipmentId) => {
|
|
3365
3524
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
3366
3525
|
};
|
|
3526
|
+
/**
|
|
3527
|
+
* The `create` method creates a new shipment for a sales order.
|
|
3528
|
+
*/
|
|
3367
3529
|
this.create = (salesOrderId, shipment) => {
|
|
3368
3530
|
return this.client.post(
|
|
3369
3531
|
`/v-beta/shipments/sales_order/${salesOrderId}`,
|
|
3370
3532
|
shipment
|
|
3371
3533
|
);
|
|
3372
3534
|
};
|
|
3535
|
+
/**
|
|
3536
|
+
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
3537
|
+
*/
|
|
3373
3538
|
this.update = (shipmentId, shipment) => {
|
|
3374
3539
|
return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
|
|
3375
3540
|
};
|
|
@@ -3380,12 +3545,23 @@ class SalesOrderShipmentsAPI {
|
|
|
3380
3545
|
class SalesOrdersAPI {
|
|
3381
3546
|
constructor(client) {
|
|
3382
3547
|
this.client = client;
|
|
3548
|
+
/**
|
|
3549
|
+
* The `list` method retrieves a list of sales orders.
|
|
3550
|
+
*/
|
|
3383
3551
|
this.list = (params = {}) => {
|
|
3384
3552
|
return this.client.get("/v-beta/sales_orders", { params });
|
|
3385
3553
|
};
|
|
3554
|
+
/**
|
|
3555
|
+
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
3556
|
+
*/
|
|
3386
3557
|
this.get = (salesOrderId) => {
|
|
3387
3558
|
return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
|
|
3388
3559
|
};
|
|
3560
|
+
/**
|
|
3561
|
+
* The `notifyShipped` method notifies order source that the order has been
|
|
3562
|
+
* shipped. Typically, the order source will then notify the user based on
|
|
3563
|
+
* this update from ShipEngine API.
|
|
3564
|
+
*/
|
|
3389
3565
|
this.notifyShipped = (salesOrderId, tracking) => {
|
|
3390
3566
|
return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
|
|
3391
3567
|
};
|
|
@@ -3416,15 +3592,26 @@ var __async$1 = (__this, __arguments, generator) => {
|
|
|
3416
3592
|
class ShipmentsAPI {
|
|
3417
3593
|
constructor(client) {
|
|
3418
3594
|
this.client = client;
|
|
3595
|
+
/**
|
|
3596
|
+
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
3597
|
+
* shipment ID.
|
|
3598
|
+
*/
|
|
3419
3599
|
this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
|
|
3420
3600
|
return this.client.get(
|
|
3421
3601
|
`/v1/shipments/${shipmentId}/rates`,
|
|
3422
3602
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
3423
3603
|
);
|
|
3424
3604
|
};
|
|
3605
|
+
/**
|
|
3606
|
+
* The `list` method retrieves a list of shipments for a given user.
|
|
3607
|
+
*/
|
|
3425
3608
|
this.list = (options) => {
|
|
3426
3609
|
return this.client.get("/v1/shipments", { params: options });
|
|
3427
3610
|
};
|
|
3611
|
+
/**
|
|
3612
|
+
* The `create` method allows for creating shipments based on a list of shipment
|
|
3613
|
+
* items passed into this method.
|
|
3614
|
+
*/
|
|
3428
3615
|
this.create = (...shipments) => __async$1(this, null, function* () {
|
|
3429
3616
|
return this.client.post("/v1/shipments", {
|
|
3430
3617
|
shipments
|
|
@@ -3437,15 +3624,31 @@ class ShipmentsAPI {
|
|
|
3437
3624
|
class WarehousesAPI {
|
|
3438
3625
|
constructor(client) {
|
|
3439
3626
|
this.client = client;
|
|
3627
|
+
/**
|
|
3628
|
+
* The `list` method retrieves a list of `warehouses` (Ship From Locations)
|
|
3629
|
+
* for a given user.
|
|
3630
|
+
*/
|
|
3440
3631
|
this.list = () => {
|
|
3441
3632
|
return this.client.get("/v1/warehouses");
|
|
3442
3633
|
};
|
|
3634
|
+
/**
|
|
3635
|
+
* The `create` method allows for creation of warehouses (Ship From Locations)
|
|
3636
|
+
* on a users ShipEngine account.
|
|
3637
|
+
*/
|
|
3443
3638
|
this.create = (warehouse) => {
|
|
3444
3639
|
return this.client.post("/v1/warehouses", warehouse);
|
|
3445
3640
|
};
|
|
3641
|
+
/**
|
|
3642
|
+
* The `update` method updates a specific warehouse (Ship From Location) for a
|
|
3643
|
+
* given user by `warehouseId`.
|
|
3644
|
+
*/
|
|
3446
3645
|
this.update = (warehouseId, warehouse) => {
|
|
3447
3646
|
return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
|
|
3448
3647
|
};
|
|
3648
|
+
/**
|
|
3649
|
+
* The `delete` method deletes a specific warehouse (Ship From Location) by
|
|
3650
|
+
* `warehouseId` from a users ShipEngine account.
|
|
3651
|
+
*/
|
|
3449
3652
|
this.delete = (warehouseId) => {
|
|
3450
3653
|
return this.client.delete(`/v1/warehouses/${warehouseId}`);
|
|
3451
3654
|
};
|
|
@@ -3606,48 +3809,135 @@ class ShipEngineAPI {
|
|
|
3606
3809
|
);
|
|
3607
3810
|
this.client = client;
|
|
3608
3811
|
}
|
|
3812
|
+
/**
|
|
3813
|
+
* The `token` method takes in a string and sets it as the Authorization header for all requests.
|
|
3814
|
+
*/
|
|
3609
3815
|
set token(token) {
|
|
3610
3816
|
this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
3611
3817
|
}
|
|
3818
|
+
/**
|
|
3819
|
+
* The `accountSettings` method provides access to the Account Settings endpoints
|
|
3820
|
+
* in ShipEngine API.
|
|
3821
|
+
*
|
|
3822
|
+
* @see {@link AccountSettingsAPI | The Account Settings API module}
|
|
3823
|
+
*/
|
|
3612
3824
|
get accountSettings() {
|
|
3613
3825
|
return new AccountSettingsAPI(this.client);
|
|
3614
3826
|
}
|
|
3827
|
+
/**
|
|
3828
|
+
* The `addresses` method provides access to the Address Validation endpoints
|
|
3829
|
+
* in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
|
|
3830
|
+
*
|
|
3831
|
+
* @see {@link AddressesAPI | The Addresses API module}
|
|
3832
|
+
*/
|
|
3615
3833
|
get addresses() {
|
|
3616
3834
|
return new AddressesAPI(this.client);
|
|
3617
3835
|
}
|
|
3836
|
+
/**
|
|
3837
|
+
* The `carriers` method provides access to the Carrier endpoints in ShipEngine
|
|
3838
|
+
* API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
|
|
3839
|
+
*
|
|
3840
|
+
* @see {@link CarriersAPI | The Carriers API module}
|
|
3841
|
+
*/
|
|
3618
3842
|
get carriers() {
|
|
3619
3843
|
return new CarriersAPI(this.client);
|
|
3620
3844
|
}
|
|
3845
|
+
/**
|
|
3846
|
+
* The `customPackages` method provides access to the Packages endpoint in ShipEngine
|
|
3847
|
+
* API. e.g. List Packages
|
|
3848
|
+
*
|
|
3849
|
+
* @see {@link CustomPackagesAPI | The Custom Packages API module}
|
|
3850
|
+
*/
|
|
3621
3851
|
get customPackages() {
|
|
3622
3852
|
return new CustomPackagesAPI(this.client);
|
|
3623
3853
|
}
|
|
3854
|
+
/**
|
|
3855
|
+
* The `fundingSources` method provides access to the Funding Sources endpoints
|
|
3856
|
+
* in ShipEngine API.
|
|
3857
|
+
*
|
|
3858
|
+
* @see {@link FundingSourcesAPI | The Funding Sources API module}
|
|
3859
|
+
*/
|
|
3624
3860
|
get fundingSources() {
|
|
3625
3861
|
return new FundingSourcesAPI(this.client);
|
|
3626
3862
|
}
|
|
3863
|
+
/**
|
|
3864
|
+
* The `insurance` method provides access to the Insurance endpoint in ShipEngine
|
|
3865
|
+
* API. e.g. Get Insurance Balance
|
|
3866
|
+
*
|
|
3867
|
+
* @see {@link InsuranceAPI | The Insurance API module}
|
|
3868
|
+
*/
|
|
3627
3869
|
get insurance() {
|
|
3628
3870
|
return new InsuranceAPI(this.client);
|
|
3629
3871
|
}
|
|
3872
|
+
/**
|
|
3873
|
+
* The `labels` method provides access to the Label endpoints in ShipEngine API.
|
|
3874
|
+
* e.g. Create Label, Get Label, Void Label, etc.
|
|
3875
|
+
*
|
|
3876
|
+
* @see {@link LabelsAPI | The Labels API module}
|
|
3877
|
+
*/
|
|
3630
3878
|
get labels() {
|
|
3631
3879
|
return new LabelsAPI(this.client);
|
|
3632
3880
|
}
|
|
3881
|
+
/**
|
|
3882
|
+
* The `orderSources` method provides access to the Order Sources endpoints in
|
|
3883
|
+
* ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
|
|
3884
|
+
*
|
|
3885
|
+
* @see {@link OrderSourcesAPI | The Order Sources API module}
|
|
3886
|
+
*/
|
|
3633
3887
|
get orderSources() {
|
|
3634
3888
|
return new OrderSourcesAPI(this.client);
|
|
3635
3889
|
}
|
|
3890
|
+
/**
|
|
3891
|
+
* The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
|
|
3892
|
+
* API.
|
|
3893
|
+
*
|
|
3894
|
+
* @see {@link RateCardsAPI | The Rate Cards API module}
|
|
3895
|
+
*/
|
|
3636
3896
|
get rateCards() {
|
|
3637
3897
|
return new RateCardsAPI(this.client);
|
|
3638
3898
|
}
|
|
3899
|
+
/**
|
|
3900
|
+
* The `rates` method provides access to the Rate endpoints in ShipEngine API.
|
|
3901
|
+
* e.g. Get Rates
|
|
3902
|
+
*
|
|
3903
|
+
* @see {@link RatesAPI | The Rates API module}
|
|
3904
|
+
*/
|
|
3639
3905
|
get rates() {
|
|
3640
3906
|
return new RatesAPI(this.client);
|
|
3641
3907
|
}
|
|
3908
|
+
/**
|
|
3909
|
+
* The `salesOrderShipments` method provides access to the `v-beta` Sales
|
|
3910
|
+
* Order Shipments endpoints in ShipEngine API.
|
|
3911
|
+
*
|
|
3912
|
+
* @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
|
|
3913
|
+
*/
|
|
3642
3914
|
get salesOrderShipments() {
|
|
3643
3915
|
return new SalesOrderShipmentsAPI(this.client);
|
|
3644
3916
|
}
|
|
3917
|
+
/**
|
|
3918
|
+
* The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
|
|
3919
|
+
* in ShipEngine API.
|
|
3920
|
+
*
|
|
3921
|
+
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
3922
|
+
*/
|
|
3645
3923
|
get salesOrders() {
|
|
3646
3924
|
return new SalesOrdersAPI(this.client);
|
|
3647
3925
|
}
|
|
3926
|
+
/**
|
|
3927
|
+
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
3928
|
+
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
3929
|
+
*
|
|
3930
|
+
* @see {@link ShipmentsAPI | The Shipments API module}
|
|
3931
|
+
*/
|
|
3648
3932
|
get shipments() {
|
|
3649
3933
|
return new ShipmentsAPI(this.client);
|
|
3650
3934
|
}
|
|
3935
|
+
/**
|
|
3936
|
+
* The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
|
|
3937
|
+
* API. e.g. List Warehouses, Get Warehouse, etc.
|
|
3938
|
+
*
|
|
3939
|
+
* @see {@link WarehousesAPI | The Warehouses API module}
|
|
3940
|
+
*/
|
|
3651
3941
|
get warehouses() {
|
|
3652
3942
|
return new WarehousesAPI(this.client);
|
|
3653
3943
|
}
|