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