@shipengine/js-api 0.23.0 → 0.25.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/errors/types.d.ts +2 -2
- package/index.js +23 -1
- package/index.mjs +23 -1
- package/package.json +1 -1
- package/rate-cards/api.d.ts +1 -0
- package/rate-cards/types.d.ts +2 -12
package/errors/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @category Entities
|
|
3
3
|
*/
|
|
4
|
-
export type CodedErrorCode = "auto_fund_not_supported" | "batch_cannot_be_modified" | "carrier_conflict" | "carrier_disconnected" | "carrier_not_connected" | "carrier_not_supported" | "confirmation_not_supported" | "default_warehouse_cannot_be_deleted" | "field_conflict" | "field_value_required" | "forbidden" | "identifier_conflict" | "identifiers_must_match" | "insufficient_funds" | "invalid_address" | "invalid_billing_plan" | "invalid_field_value" | "invalid_identifier" | "invalid_status" | "invalid_string_length" | "label_images_not_supported" | "meter_failure" | "order_source_not_active" | "rate_limit_exceeded" | "refresh_not_supported" | "request_body_required" | "return_label_not_supported" | "settings_not_supported" | "subscription_inactive" | "terms_not_accepted" | "tracking_not_supported" | "trial_expired" | "unauthorized" | "unknown" | "unspecified" | "verification_failure" | "warehouse_conflict" | "webhook_event_type_conflict";
|
|
4
|
+
export type CodedErrorCode = "auto_fund_not_supported" | "batch_cannot_be_modified" | "carrier_conflict" | "carrier_disconnected" | "carrier_not_connected" | "carrier_not_supported" | "confirmation_not_supported" | "default_warehouse_cannot_be_deleted" | "duplicated_rate_card" | "empty_file" | "field_conflict" | "field_value_required" | "forbidden" | "identifier_conflict" | "identifiers_must_match" | "insufficient_funds" | "insufficient_rate_card_data" | "invalid_address" | "invalid_billing_plan" | "invalid_field_value" | "invalid_file_type" | "invalid_identifier" | "invalid_status" | "invalid_string_length" | "invalid_zones" | "invalid_packages" | "invalid_weight_bands" | "invalid_rates" | "label_images_not_supported" | "meter_failure" | "not_found" | "order_source_not_active" | "rate_limit_exceeded" | "refresh_not_supported" | "request_body_required" | "return_label_not_supported" | "settings_not_supported" | "subscription_inactive" | "terms_not_accepted" | "tracking_not_supported" | "trial_expired" | "unauthorized" | "unknown" | "unspecified" | "verification_failure" | "warehouse_conflict" | "webhook_event_type_conflict";
|
|
5
5
|
/**
|
|
6
6
|
* @category Entities
|
|
7
7
|
*/
|
|
8
|
-
export type CodedErrorSource = "carrier" | "order_source" | "shipengine" | "elements" | "client";
|
|
8
|
+
export type CodedErrorSource = "carrier" | "order_source" | "shipengine" | "elements" | "client" | "rate_card_manager";
|
|
9
9
|
/**
|
|
10
10
|
* @category Entities
|
|
11
11
|
*/
|
package/index.js
CHANGED
|
@@ -3311,6 +3311,15 @@ class RateCardsAPI {
|
|
|
3311
3311
|
responseType: "blob"
|
|
3312
3312
|
});
|
|
3313
3313
|
};
|
|
3314
|
+
this.upload = (rateCardId, file) => {
|
|
3315
|
+
const formData = new FormData();
|
|
3316
|
+
formData.append("file", file);
|
|
3317
|
+
return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
|
|
3318
|
+
headers: {
|
|
3319
|
+
"Content-Type": "multipart/form-data"
|
|
3320
|
+
}
|
|
3321
|
+
});
|
|
3322
|
+
};
|
|
3314
3323
|
this.client = client;
|
|
3315
3324
|
}
|
|
3316
3325
|
}
|
|
@@ -3499,7 +3508,20 @@ class ShipEngineAPI {
|
|
|
3499
3508
|
"Content-Type": "application/json"
|
|
3500
3509
|
}),
|
|
3501
3510
|
paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
|
|
3502
|
-
transformRequest: [
|
|
3511
|
+
transformRequest: [
|
|
3512
|
+
(data) => {
|
|
3513
|
+
if (data && !(data instanceof FormData))
|
|
3514
|
+
return humpsExports.decamelizeKeys(data);
|
|
3515
|
+
else
|
|
3516
|
+
return data;
|
|
3517
|
+
},
|
|
3518
|
+
(data) => {
|
|
3519
|
+
if (data && !(data instanceof FormData))
|
|
3520
|
+
return JSON.stringify(data);
|
|
3521
|
+
else
|
|
3522
|
+
return data;
|
|
3523
|
+
}
|
|
3524
|
+
],
|
|
3503
3525
|
transformResponse: [
|
|
3504
3526
|
(data) => {
|
|
3505
3527
|
if (data && !(data instanceof Blob))
|
package/index.mjs
CHANGED
|
@@ -3307,6 +3307,15 @@ class RateCardsAPI {
|
|
|
3307
3307
|
responseType: "blob"
|
|
3308
3308
|
});
|
|
3309
3309
|
};
|
|
3310
|
+
this.upload = (rateCardId, file) => {
|
|
3311
|
+
const formData = new FormData();
|
|
3312
|
+
formData.append("file", file);
|
|
3313
|
+
return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
|
|
3314
|
+
headers: {
|
|
3315
|
+
"Content-Type": "multipart/form-data"
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3318
|
+
};
|
|
3310
3319
|
this.client = client;
|
|
3311
3320
|
}
|
|
3312
3321
|
}
|
|
@@ -3495,7 +3504,20 @@ class ShipEngineAPI {
|
|
|
3495
3504
|
"Content-Type": "application/json"
|
|
3496
3505
|
}),
|
|
3497
3506
|
paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
|
|
3498
|
-
transformRequest: [
|
|
3507
|
+
transformRequest: [
|
|
3508
|
+
(data) => {
|
|
3509
|
+
if (data && !(data instanceof FormData))
|
|
3510
|
+
return humpsExports.decamelizeKeys(data);
|
|
3511
|
+
else
|
|
3512
|
+
return data;
|
|
3513
|
+
},
|
|
3514
|
+
(data) => {
|
|
3515
|
+
if (data && !(data instanceof FormData))
|
|
3516
|
+
return JSON.stringify(data);
|
|
3517
|
+
else
|
|
3518
|
+
return data;
|
|
3519
|
+
}
|
|
3520
|
+
],
|
|
3499
3521
|
transformResponse: [
|
|
3500
3522
|
(data) => {
|
|
3501
3523
|
if (data && !(data instanceof Blob))
|
package/package.json
CHANGED
package/rate-cards/api.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export declare class RateCardsAPI {
|
|
|
10
10
|
create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
11
11
|
update: (rateCard: RateCard) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
12
12
|
download: (rateCardId: string) => Promise<import("axios").AxiosResponse<Blob, any>>;
|
|
13
|
+
upload: (rateCardId: string, file: File) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
13
14
|
}
|
package/rate-cards/types.d.ts
CHANGED
|
@@ -14,10 +14,7 @@ export interface ShipFromLocation {
|
|
|
14
14
|
* @category Entities
|
|
15
15
|
*/
|
|
16
16
|
export interface RateSurcharge {
|
|
17
|
-
fixedAmount:
|
|
18
|
-
currency: Currency;
|
|
19
|
-
value: number;
|
|
20
|
-
};
|
|
17
|
+
fixedAmount: number;
|
|
21
18
|
name: string;
|
|
22
19
|
surchargeCode: string;
|
|
23
20
|
surchargeId: string;
|
|
@@ -29,18 +26,11 @@ export type RateService = Pick<CarrierService, "serviceCode" | "name"> & {
|
|
|
29
26
|
packageTypes?: RatePackageType[];
|
|
30
27
|
surcharges?: RateSurcharge[];
|
|
31
28
|
};
|
|
32
|
-
/**
|
|
33
|
-
* @category Entities
|
|
34
|
-
*/
|
|
35
|
-
export type RateCardRate = {
|
|
36
|
-
currency: Currency;
|
|
37
|
-
value: number;
|
|
38
|
-
};
|
|
39
29
|
/**
|
|
40
30
|
* @category Entities
|
|
41
31
|
*/
|
|
42
32
|
export type ZoneWithRate = Zone & {
|
|
43
|
-
rate?:
|
|
33
|
+
rate?: number;
|
|
44
34
|
surcharges?: RateSurcharge[];
|
|
45
35
|
};
|
|
46
36
|
/**
|