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