@shipengine/js-api 0.19.1 → 0.21.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/carriers/types.d.ts +6 -6
- package/index.d.ts +1 -0
- package/index.js +16 -3
- package/index.mjs +16 -3
- package/package.json +1 -1
- package/rate-cards/api.d.ts +2 -0
- package/rate-cards/types.d.ts +51 -7
- package/types.d.ts +1 -0
- package/zones/index.d.ts +1 -0
- package/zones/types.d.ts +8 -0
package/carriers/types.d.ts
CHANGED
|
@@ -52,15 +52,15 @@ export interface CarrierPackage {
|
|
|
52
52
|
* @category Entities
|
|
53
53
|
*/
|
|
54
54
|
export interface CarrierRatePackageFormat {
|
|
55
|
-
apiCode
|
|
56
|
-
carrierPackageTypeCode
|
|
57
|
-
description
|
|
58
|
-
dimensions
|
|
59
|
-
|
|
55
|
+
apiCode?: string;
|
|
56
|
+
carrierPackageTypeCode?: string;
|
|
57
|
+
description: string;
|
|
58
|
+
dimensions: DimensionsWithUnit;
|
|
59
|
+
maxWeight: WeightWithUnit;
|
|
60
60
|
name: string;
|
|
61
|
+
packageId: string;
|
|
61
62
|
packageTypeId?: string;
|
|
62
63
|
status: string;
|
|
63
|
-
weight: WeightWithUnit;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* @category Entities
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -3291,6 +3291,14 @@ class RateCardsAPI {
|
|
|
3291
3291
|
this.create = (rateCardInput) => {
|
|
3292
3292
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3293
3293
|
};
|
|
3294
|
+
this.update = (rateCard) => {
|
|
3295
|
+
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
3296
|
+
};
|
|
3297
|
+
this.download = (rateCardId) => {
|
|
3298
|
+
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
3299
|
+
responseType: "blob"
|
|
3300
|
+
});
|
|
3301
|
+
};
|
|
3294
3302
|
this.client = client;
|
|
3295
3303
|
}
|
|
3296
3304
|
}
|
|
@@ -3482,12 +3490,17 @@ class ShipEngineAPI {
|
|
|
3482
3490
|
transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
|
|
3483
3491
|
transformResponse: [
|
|
3484
3492
|
(data) => {
|
|
3485
|
-
if (data)
|
|
3493
|
+
if (data && !(data instanceof Blob))
|
|
3486
3494
|
return JSON.parse(data);
|
|
3487
3495
|
else
|
|
3488
|
-
return;
|
|
3496
|
+
return data;
|
|
3489
3497
|
},
|
|
3490
|
-
(data) =>
|
|
3498
|
+
(data) => {
|
|
3499
|
+
if (data && !(data instanceof Blob))
|
|
3500
|
+
return humpsExports.camelizeKeys(data);
|
|
3501
|
+
else
|
|
3502
|
+
return data;
|
|
3503
|
+
}
|
|
3491
3504
|
]
|
|
3492
3505
|
});
|
|
3493
3506
|
client.interceptors.response.use(
|
package/index.mjs
CHANGED
|
@@ -3287,6 +3287,14 @@ class RateCardsAPI {
|
|
|
3287
3287
|
this.create = (rateCardInput) => {
|
|
3288
3288
|
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3289
3289
|
};
|
|
3290
|
+
this.update = (rateCard) => {
|
|
3291
|
+
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
3292
|
+
};
|
|
3293
|
+
this.download = (rateCardId) => {
|
|
3294
|
+
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
3295
|
+
responseType: "blob"
|
|
3296
|
+
});
|
|
3297
|
+
};
|
|
3290
3298
|
this.client = client;
|
|
3291
3299
|
}
|
|
3292
3300
|
}
|
|
@@ -3478,12 +3486,17 @@ class ShipEngineAPI {
|
|
|
3478
3486
|
transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
|
|
3479
3487
|
transformResponse: [
|
|
3480
3488
|
(data) => {
|
|
3481
|
-
if (data)
|
|
3489
|
+
if (data && !(data instanceof Blob))
|
|
3482
3490
|
return JSON.parse(data);
|
|
3483
3491
|
else
|
|
3484
|
-
return;
|
|
3492
|
+
return data;
|
|
3485
3493
|
},
|
|
3486
|
-
(data) =>
|
|
3494
|
+
(data) => {
|
|
3495
|
+
if (data && !(data instanceof Blob))
|
|
3496
|
+
return humpsExports.camelizeKeys(data);
|
|
3497
|
+
else
|
|
3498
|
+
return data;
|
|
3499
|
+
}
|
|
3487
3500
|
]
|
|
3488
3501
|
});
|
|
3489
3502
|
client.interceptors.response.use(
|
package/package.json
CHANGED
package/rate-cards/api.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export declare class RateCardsAPI {
|
|
|
7
7
|
rateCards: RateCard[];
|
|
8
8
|
}, any>>;
|
|
9
9
|
create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
10
|
+
update: (rateCard: RateCard) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
11
|
+
download: (rateCardId: string) => Promise<import("axios").AxiosResponse<Blob, any>>;
|
|
10
12
|
}
|
package/rate-cards/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CarrierRatePackageFormat, CarrierService } from "../carriers";
|
|
2
2
|
import { Currency } from "../payments";
|
|
3
|
+
import { ISOString } from "../resources";
|
|
3
4
|
import { WeightBandIncremental, WeightBandMinMax } from "../weight-band";
|
|
5
|
+
import { Zone } from "../zones";
|
|
4
6
|
/**
|
|
5
7
|
* @category Entities
|
|
6
8
|
*/
|
|
@@ -8,19 +10,58 @@ export interface ShipFromLocation {
|
|
|
8
10
|
countryCode: string;
|
|
9
11
|
postalCode?: string;
|
|
10
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @category Entities
|
|
15
|
+
*/
|
|
16
|
+
export interface RateSurcharge {
|
|
17
|
+
fixedAmount: {
|
|
18
|
+
currency: Currency;
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
name: string;
|
|
22
|
+
surchargeCode: string;
|
|
23
|
+
surchargeId: string;
|
|
24
|
+
}
|
|
11
25
|
/**
|
|
12
26
|
* @category Entities
|
|
13
27
|
*/
|
|
14
28
|
export type RateService = Pick<CarrierService, "serviceCode" | "name"> & {
|
|
15
|
-
packageTypes
|
|
29
|
+
packageTypes?: RatePackageType[];
|
|
30
|
+
surcharges?: RateSurcharge[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @category Entities
|
|
34
|
+
*/
|
|
35
|
+
export type RateCardRate = {
|
|
36
|
+
currency: Currency;
|
|
37
|
+
value: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @category Entities
|
|
41
|
+
*/
|
|
42
|
+
export type ZoneWithRate = Zone & {
|
|
43
|
+
rate?: RateCardRate;
|
|
44
|
+
surcharges?: RateSurcharge[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* @category Entities
|
|
48
|
+
*/
|
|
49
|
+
export type RateWeightBandMinMax = WeightBandMinMax & {
|
|
50
|
+
zones?: ZoneWithRate[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @category Entities
|
|
54
|
+
*/
|
|
55
|
+
export type RateWeightBandIncremental = WeightBandIncremental & {
|
|
56
|
+
zones?: ZoneWithRate[];
|
|
16
57
|
};
|
|
17
58
|
/**
|
|
18
59
|
* @category Entities
|
|
19
60
|
*/
|
|
20
|
-
export type RatePackageType = CarrierRatePackageFormat & {
|
|
21
|
-
weightBands
|
|
22
|
-
incrementalBands
|
|
23
|
-
minMaxBands
|
|
61
|
+
export type RatePackageType = Pick<CarrierRatePackageFormat, "packageId" | "name" | "description" | "dimensions" | "maxWeight"> & {
|
|
62
|
+
weightBands?: {
|
|
63
|
+
incrementalBands?: RateWeightBandIncremental[];
|
|
64
|
+
minMaxBands?: RateWeightBandMinMax[];
|
|
24
65
|
};
|
|
25
66
|
};
|
|
26
67
|
/**
|
|
@@ -28,14 +69,17 @@ export type RatePackageType = CarrierRatePackageFormat & {
|
|
|
28
69
|
*/
|
|
29
70
|
export interface RateCard {
|
|
30
71
|
carrierId: string;
|
|
72
|
+
createdAt?: ISOString;
|
|
31
73
|
currency?: Currency;
|
|
32
|
-
endDate?:
|
|
74
|
+
endDate?: ISOString;
|
|
33
75
|
id: string;
|
|
34
76
|
name: string;
|
|
77
|
+
publishedAt?: ISOString;
|
|
35
78
|
services?: RateService[];
|
|
36
79
|
shipFrom?: ShipFromLocation;
|
|
37
|
-
startDate?:
|
|
80
|
+
startDate?: ISOString;
|
|
38
81
|
status?: string;
|
|
82
|
+
surcharges?: RateSurcharge[];
|
|
39
83
|
}
|
|
40
84
|
/**
|
|
41
85
|
* @category Entities
|
package/types.d.ts
CHANGED
package/zones/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|