@shipengine/js-api 1.0.0-next.4 → 1.0.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/README.md +30 -0
- package/account-billing-plan/api.d.ts +17 -0
- package/account-billing-plan/index.d.ts +2 -0
- package/account-billing-plan/types.d.ts +37 -0
- package/account-settings/api.d.ts +30 -2
- package/account-settings/types.d.ts +22 -2
- package/addresses/api.d.ts +11 -0
- package/carriers/api.d.ts +69 -2
- package/carriers/types.d.ts +22 -3
- package/client.d.ts +157 -3
- package/connections/api.d.ts +18 -0
- package/connections/index.d.ts +2 -0
- package/connections/types.d.ts +36 -0
- package/custom-packages/api.d.ts +6 -0
- package/dimensions/types.d.ts +5 -0
- package/errors/types.d.ts +2 -2
- package/errors/utils.d.ts +4 -0
- package/funding-sources/api.d.ts +56 -0
- package/funding-sources/index.d.ts +2 -0
- package/funding-sources/types.d.ts +159 -0
- package/index.d.ts +7 -0
- package/index.js +4212 -16
- package/index.mjs +4027 -2786
- package/insurance/api.d.ts +7 -0
- package/labels/api.d.ts +89 -5
- package/order-sources/api.d.ts +17 -0
- package/package.json +6 -2
- package/rate-cards/api.d.ts +44 -0
- package/rate-cards/index.d.ts +2 -0
- package/rate-cards/types.d.ts +88 -0
- package/rates/api.d.ts +26 -0
- package/resources/types.d.ts +40 -0
- package/sales-order-shipments/api.d.ts +94 -5
- package/sales-orders/api.d.ts +25 -0
- package/shipments/api.d.ts +72 -0
- package/shipments/index.d.ts +1 -0
- package/shipments/types.d.ts +85 -4
- package/shipping-rules/api.d.ts +36 -0
- package/shipping-rules/index.d.ts +2 -0
- package/shipping-rules/types.d.ts +77 -0
- package/themes/api.d.ts +13 -0
- package/themes/index.d.ts +2 -0
- package/themes/types.d.ts +21 -0
- package/types.d.ts +10 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/ip-address.d.ts +1 -0
- package/warehouses/api.d.ts +19 -0
- package/weight-band/index.d.ts +1 -0
- package/weight-band/types.d.ts +17 -0
- package/zones/index.d.ts +1 -0
- package/zones/types.d.ts +7 -0
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,106 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
+
import { CreationRangeQuery, PageableQuery, PageableResult, SortableQuery } from "../resources";
|
|
2
3
|
import { Label, LabelLayout, VoidRequest } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* # Labels API - Create Label Options
|
|
6
|
+
*/
|
|
3
7
|
export interface CreateLabelOptions {
|
|
8
|
+
/**
|
|
9
|
+
* `displayScheme` is an optional string to control the display scheme of the label.
|
|
10
|
+
*/
|
|
4
11
|
displayScheme?: string;
|
|
12
|
+
/**
|
|
13
|
+
* `labelDownloadType` is an optional string to control the download type of the label.
|
|
14
|
+
*
|
|
15
|
+
* e.g. `url` or `inline`
|
|
16
|
+
*/
|
|
5
17
|
labelDownloadType?: string;
|
|
18
|
+
/**
|
|
19
|
+
* `labelFormat` is an optional string to control the format of the label.
|
|
20
|
+
*
|
|
21
|
+
* e.g. `pdf` or `zpl`
|
|
22
|
+
*/
|
|
6
23
|
labelFormat?: string;
|
|
24
|
+
/**
|
|
25
|
+
* `labelLayout` is an optional string to control the layout of the label.
|
|
26
|
+
*
|
|
27
|
+
* e.g. `4x6` or `8.5x11`
|
|
28
|
+
*/
|
|
7
29
|
labelLayout?: LabelLayout;
|
|
30
|
+
/**
|
|
31
|
+
* `validateAddress` is an optional string to control address validation during
|
|
32
|
+
* label purchase.
|
|
33
|
+
*/
|
|
8
34
|
validateAddress?: string;
|
|
9
35
|
}
|
|
10
|
-
|
|
36
|
+
/**
|
|
37
|
+
* # Labels API - List Labels Params
|
|
38
|
+
*/
|
|
39
|
+
export type ListLabelsParams = {
|
|
40
|
+
/**
|
|
41
|
+
* `batchId` is an optional string to retrieve labels within a given batch.
|
|
42
|
+
*/
|
|
43
|
+
batchId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* `carrierId` is an optional string to limit results to only lables for
|
|
46
|
+
* a specific carrier.
|
|
47
|
+
*/
|
|
48
|
+
carrierId?: string;
|
|
49
|
+
/**
|
|
50
|
+
* `labelStatus` optionally allows filtering results to a specific status.
|
|
51
|
+
*/
|
|
52
|
+
labelStatus?: Label["status"];
|
|
53
|
+
/**
|
|
54
|
+
* `rateId` is an optional string to return labels purchased with a
|
|
55
|
+
* specific rate.
|
|
56
|
+
*/
|
|
57
|
+
rateId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* `serviceCode` is an optional string to limit results to only labels for
|
|
60
|
+
* a specific carrier service.
|
|
61
|
+
*/
|
|
62
|
+
serviceCode?: string;
|
|
63
|
+
/**
|
|
64
|
+
* `shipmentId` is an optional string to filter labels by shipment ID. This
|
|
65
|
+
* is a unique identifier that ShipEngine API associates with your shipment.
|
|
66
|
+
*/
|
|
11
67
|
shipmentId?: string;
|
|
12
|
-
|
|
68
|
+
/** `trackingNumber` is an optional string to retrieve labels for a specific
|
|
69
|
+
* tracking number
|
|
70
|
+
*/
|
|
71
|
+
trackingNumber?: string;
|
|
72
|
+
/** `warehouseId` is an optional string to limit results to only those
|
|
73
|
+
* originating from a specific warehouse.
|
|
74
|
+
*/
|
|
75
|
+
warehouseId?: string;
|
|
76
|
+
} & PageableQuery & CreationRangeQuery & SortableQuery<"created_at" | "modified_at" | "order_date">;
|
|
77
|
+
export type ListLabelsResult = {
|
|
78
|
+
labels: Label[];
|
|
79
|
+
} & PageableResult;
|
|
80
|
+
/**
|
|
81
|
+
* # Labels API module - /v1/labels
|
|
82
|
+
*/
|
|
13
83
|
export declare class LabelsAPI {
|
|
14
84
|
private client;
|
|
15
85
|
constructor(client: AxiosInstance);
|
|
86
|
+
/**
|
|
87
|
+
* The `get` method retrieves a specific label by `labelId`.
|
|
88
|
+
*/
|
|
16
89
|
get: (labelId: string) => Promise<import("axios").AxiosResponse<Label, any>>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
90
|
+
/**
|
|
91
|
+
* The `list` method retrieves a list of labels created by a given user.
|
|
92
|
+
*/
|
|
93
|
+
list: (params?: ListLabelsParams) => Promise<import("axios").AxiosResponse<ListLabelsResult, any>>;
|
|
94
|
+
/**
|
|
95
|
+
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
96
|
+
* which is a unique identifier tied to a specific rate.
|
|
97
|
+
*
|
|
98
|
+
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
99
|
+
* label for the price they were initially rated.
|
|
100
|
+
*/
|
|
20
101
|
createByRateId: (rateId: string, options: CreateLabelOptions) => Promise<import("axios").AxiosResponse<Label, any>>;
|
|
102
|
+
/**
|
|
103
|
+
* The `void` method allows a user to void a label by `labelId`.
|
|
104
|
+
*/
|
|
21
105
|
void: (labelId: string) => Promise<import("axios").AxiosResponse<VoidRequest, any>>;
|
|
22
106
|
}
|
package/order-sources/api.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
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>>;
|
|
24
|
+
/**
|
|
25
|
+
* The `deactivate` method remove a specific connected order source by `orderSourceId`.
|
|
26
|
+
*/
|
|
27
|
+
deactivate: (orderSourceId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
11
28
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipengine/js-api",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./index.mjs",
|
|
9
|
-
"require": "./index.js"
|
|
9
|
+
"require": "./index.js",
|
|
10
|
+
"types": "./index.d.ts"
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
"typedoc": {
|
|
@@ -14,5 +15,8 @@
|
|
|
14
15
|
"entryPoint": "./src/index.ts",
|
|
15
16
|
"readmeFile": "./README.md",
|
|
16
17
|
"tsconfig": "./tsconfig.lib.json"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"axios": "^0.26.1"
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { RateCard, RateCardInput } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* # Rate Cards API module - /v1/rate_cards
|
|
5
|
+
*/
|
|
6
|
+
export declare class RateCardsAPI {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
11
|
+
*/
|
|
12
|
+
list: (carrierIds: string[]) => Promise<import("axios").AxiosResponse<{
|
|
13
|
+
rateCards: RateCard[];
|
|
14
|
+
}, any>>;
|
|
15
|
+
/**
|
|
16
|
+
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
17
|
+
*/
|
|
18
|
+
get: (rateCardId: string) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
19
|
+
/**
|
|
20
|
+
* The `create` method creates a new rate card for a given user.
|
|
21
|
+
*/
|
|
22
|
+
create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
23
|
+
/**
|
|
24
|
+
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
25
|
+
* `RateCard`.
|
|
26
|
+
*/
|
|
27
|
+
update: (rateCard: RateCard) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
28
|
+
/**
|
|
29
|
+
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
30
|
+
*/
|
|
31
|
+
download: (rateCardId: string) => Promise<import("axios").AxiosResponse<Blob, any>>;
|
|
32
|
+
/**
|
|
33
|
+
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
34
|
+
*/
|
|
35
|
+
upload: (rateCardId: string, file: File) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
36
|
+
/**
|
|
37
|
+
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
38
|
+
*/
|
|
39
|
+
publish: (rateCardId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
|
+
/**
|
|
41
|
+
* @description https://auctane.atlassian.net/wiki/spaces/TE/pages/3837431603/Inc+1+3.+Rate+Card+Details#Delete-Rate-Card
|
|
42
|
+
*/
|
|
43
|
+
delete: (rateCardId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CarrierService, PackageRatingType } from "../carriers";
|
|
2
|
+
import { Currency } from "../payments";
|
|
3
|
+
import { ISOString } from "../resources";
|
|
4
|
+
import { WeightBandIncremental, WeightBandMinMax } from "../weight-band";
|
|
5
|
+
import { Zone } from "../zones";
|
|
6
|
+
/**
|
|
7
|
+
* @category Entities
|
|
8
|
+
*/
|
|
9
|
+
export interface ShipFromLocation {
|
|
10
|
+
countryCode: string;
|
|
11
|
+
postalCode?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @category Entities
|
|
15
|
+
*/
|
|
16
|
+
export type SurchargeType = "percentage" | "fixed";
|
|
17
|
+
/**
|
|
18
|
+
* @category Entities
|
|
19
|
+
*/
|
|
20
|
+
export interface RateSurcharge {
|
|
21
|
+
name: string;
|
|
22
|
+
type: SurchargeType;
|
|
23
|
+
value: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @category Entities
|
|
27
|
+
*/
|
|
28
|
+
export type RateService = Pick<CarrierService, "serviceCode" | "name"> & {
|
|
29
|
+
surcharges?: RateSurcharge[];
|
|
30
|
+
zones?: RateZone[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @category Entities
|
|
34
|
+
*/
|
|
35
|
+
export type RateZone = Zone & {
|
|
36
|
+
packageTypes?: RatePackageType[];
|
|
37
|
+
surcharges?: RateSurcharge[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @category Entities
|
|
41
|
+
*/
|
|
42
|
+
export type RateWeightBandMinMax = WeightBandMinMax & {
|
|
43
|
+
rate?: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @category Entities
|
|
47
|
+
*/
|
|
48
|
+
export type RateWeightBandIncremental = WeightBandIncremental & {
|
|
49
|
+
rate?: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @category Entities
|
|
53
|
+
*/
|
|
54
|
+
export type RatePackageType = Pick<PackageRatingType, "packageId" | "name" | "description" | "dimensions" | "maxWeight" | "carrierPackageTypeCode"> & {
|
|
55
|
+
weightBands?: {
|
|
56
|
+
incrementalBands?: RateWeightBandIncremental[];
|
|
57
|
+
minMaxBands?: RateWeightBandMinMax[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @category Entities
|
|
62
|
+
*/
|
|
63
|
+
export declare enum RateCardStatus {
|
|
64
|
+
DRAFT = "Draft",
|
|
65
|
+
DELETED = "Deleted",
|
|
66
|
+
PUBLISHED = "Published"
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @category Entities
|
|
70
|
+
*/
|
|
71
|
+
export interface RateCard {
|
|
72
|
+
carrierId: string;
|
|
73
|
+
createdAt?: ISOString;
|
|
74
|
+
currency?: Currency;
|
|
75
|
+
endDate?: ISOString;
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
publishedAt?: ISOString;
|
|
79
|
+
services?: RateService[];
|
|
80
|
+
shipFrom?: ShipFromLocation;
|
|
81
|
+
startDate?: ISOString;
|
|
82
|
+
status?: RateCardStatus;
|
|
83
|
+
surcharges?: RateSurcharge[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @category Entities
|
|
87
|
+
*/
|
|
88
|
+
export type RateCardInput = Partial<RateCard> & Pick<RateCard, "carrierId" | "name">;
|
package/rates/api.d.ts
CHANGED
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { Currency } from "../payments";
|
|
3
3
|
import { RateResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* # Rates API - Calculate Rates Options
|
|
6
|
+
*/
|
|
4
7
|
export interface CalculateRatesOptions {
|
|
8
|
+
/**
|
|
9
|
+
* `calculateTaxAmount` is an optional boolean that indicates rates returned
|
|
10
|
+
* should include the tax amount.
|
|
11
|
+
*/
|
|
5
12
|
calculateTaxAmount?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* `carrierIds` is an array of carrier IDs to filter rates by.
|
|
15
|
+
*/
|
|
6
16
|
carrierIds: string[];
|
|
17
|
+
/**
|
|
18
|
+
* `packageTypes` is an optional array of package types to filter rates by.
|
|
19
|
+
*/
|
|
7
20
|
packageTypes?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* `preferredCurrency` is an optional indicator of the currency to return rates in.
|
|
23
|
+
*/
|
|
8
24
|
preferredCurrency?: Currency;
|
|
25
|
+
/**
|
|
26
|
+
* `serviceCodes` is an optional array of specific carrier service codes to filter rates by.
|
|
27
|
+
*/
|
|
9
28
|
serviceCodes?: string[];
|
|
10
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* # Rates API module - /v1/rates
|
|
32
|
+
*/
|
|
11
33
|
export declare class RatesAPI {
|
|
12
34
|
private client;
|
|
13
35
|
constructor(client: AxiosInstance);
|
|
36
|
+
/**
|
|
37
|
+
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
38
|
+
* on the shipment's options.
|
|
39
|
+
*/
|
|
14
40
|
calculateByShipmentId: (shipmentId: string, options: CalculateRatesOptions) => Promise<import("axios").AxiosResponse<Omit<import("..").Shipment, "items"> & {
|
|
15
41
|
items: import("../sales-order-shipments").SalesOrderShipmentItem[];
|
|
16
42
|
salesOrderIds: string[];
|
package/resources/types.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export interface Download {
|
|
|
7
7
|
png: string;
|
|
8
8
|
zpl: string;
|
|
9
9
|
}
|
|
10
|
+
export type GenericObject = {
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
};
|
|
10
13
|
/**
|
|
11
14
|
* @category Entities
|
|
12
15
|
*/
|
|
@@ -14,3 +17,40 @@ export interface LinkedResource {
|
|
|
14
17
|
href: string;
|
|
15
18
|
type: string;
|
|
16
19
|
}
|
|
20
|
+
export type ISOString = string;
|
|
21
|
+
export type PageableQuery = {
|
|
22
|
+
page?: number;
|
|
23
|
+
pageSize?: number;
|
|
24
|
+
};
|
|
25
|
+
export type PageableResult = {
|
|
26
|
+
links: {
|
|
27
|
+
first: LinkedResource;
|
|
28
|
+
last: LinkedResource;
|
|
29
|
+
next: LinkedResource;
|
|
30
|
+
prev: LinkedResource;
|
|
31
|
+
};
|
|
32
|
+
page: number;
|
|
33
|
+
pages: number;
|
|
34
|
+
total: number;
|
|
35
|
+
};
|
|
36
|
+
export type BatchableQuery = {
|
|
37
|
+
batchId?: string;
|
|
38
|
+
};
|
|
39
|
+
export type TaggableQuery = {
|
|
40
|
+
tag?: string;
|
|
41
|
+
};
|
|
42
|
+
export type CreationRangeQuery = {
|
|
43
|
+
createdAtEnd?: ISOString;
|
|
44
|
+
createdAtStart?: ISOString;
|
|
45
|
+
};
|
|
46
|
+
export type ModificationRangeQuery = {
|
|
47
|
+
modifiedAtEnd?: ISOString;
|
|
48
|
+
modifiedAtStart?: ISOString;
|
|
49
|
+
};
|
|
50
|
+
export type SortableQuery<TSortKeys = "created_at" | "modified_at"> = {
|
|
51
|
+
sortBy?: TSortKeys;
|
|
52
|
+
sortDir?: "asc" | "desc";
|
|
53
|
+
};
|
|
54
|
+
export type LocaleBasedQuery = {
|
|
55
|
+
locale?: string;
|
|
56
|
+
};
|
|
@@ -1,15 +1,104 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
+
import { CreationRangeQuery, ISOString, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery } from "../resources";
|
|
3
|
+
import { FulfillmentStatus, PaymentStatus } from "../sales-orders";
|
|
2
4
|
import { SalesOrderShipment } from "./types";
|
|
3
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export type ListSalesOrderShipmentsParams = {
|
|
9
|
+
/**
|
|
10
|
+
* `cancelled` is an optional boolean indicating if cancelled shipments
|
|
11
|
+
* should be included in the response.
|
|
12
|
+
*/
|
|
13
|
+
cancelled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* `externalOrderId` is an optional unique ID that can be set by the user to
|
|
16
|
+
* associate shipments with an external system.
|
|
17
|
+
*/
|
|
18
|
+
externalOrderId?: string;
|
|
19
|
+
/**
|
|
20
|
+
* `externalOrderNumber` is an optional unique ID that can be set by the
|
|
21
|
+
* user to associate orders with an external system.
|
|
22
|
+
*/
|
|
23
|
+
externalOrderNumber?: string;
|
|
24
|
+
/**
|
|
25
|
+
* `fulfillmentStatus` is an optional string that indicates the fulfillment
|
|
26
|
+
* status of the shipments to be returned.
|
|
27
|
+
*/
|
|
28
|
+
fulfillmentStatus?: FulfillmentStatus;
|
|
29
|
+
/**
|
|
30
|
+
* `orderDateEnd` is an optional ISO 8601 string that indicates the end of the
|
|
31
|
+
* date range to query orders from.
|
|
32
|
+
*/
|
|
33
|
+
orderDateEnd?: ISOString;
|
|
34
|
+
/**
|
|
35
|
+
* `orderDateStart` is an optional ISO 8601 string that indicates the start of
|
|
36
|
+
* the date range to query orders from.
|
|
37
|
+
*/
|
|
38
|
+
orderDateStart?: ISOString;
|
|
39
|
+
/**
|
|
40
|
+
* `orderSourceId` is an optional string that indicates the order source ID
|
|
41
|
+
* to query orders from.
|
|
42
|
+
*/
|
|
43
|
+
orderSourceId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* `paymentStatus` is an optional string that indicates the payment status of
|
|
46
|
+
* the shipments to be returned.
|
|
47
|
+
*/
|
|
48
|
+
paymentStatus?: PaymentStatus;
|
|
49
|
+
/**
|
|
50
|
+
* `salesOrderIds` is an optional array of sales order IDs to be used when
|
|
51
|
+
* querying sales orders.
|
|
52
|
+
*/
|
|
4
53
|
salesOrderIds?: string[];
|
|
5
|
-
|
|
54
|
+
/**
|
|
55
|
+
* `shipmentIds` is an optional array of shipment IDs to fetch.
|
|
56
|
+
*/
|
|
57
|
+
shipmentIds?: string[];
|
|
58
|
+
} & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery<"created_at" | "modified_at" | "order_date">;
|
|
59
|
+
/**
|
|
60
|
+
* # Sales Order Shipments - List Sales Order Shipments Body
|
|
61
|
+
*/
|
|
62
|
+
export type ListSalesOrderShipmentBody = {
|
|
63
|
+
/**
|
|
64
|
+
* `salesOrderIds` is an array of sales order IDs to be used when listing sales
|
|
65
|
+
* orders.
|
|
66
|
+
*/
|
|
67
|
+
salesOrderIds?: string[];
|
|
68
|
+
/**
|
|
69
|
+
* `shipments` is an array of shipments associated with the sales orders.
|
|
70
|
+
*/
|
|
71
|
+
shipments?: SalesOrderShipment[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* # Sales Order Shipments - List Sales Order Shipments Result
|
|
75
|
+
*/
|
|
76
|
+
export type ListSalesOrderShipmentsResult = {
|
|
77
|
+
/**
|
|
78
|
+
* `shipments` is an array of sales order shipments.
|
|
79
|
+
*/
|
|
80
|
+
shipments: SalesOrderShipment[];
|
|
81
|
+
} & PageableResult;
|
|
82
|
+
/**
|
|
83
|
+
* # Sales Order Shipments API module - /v-beta/shipments
|
|
84
|
+
*/
|
|
6
85
|
export declare class SalesOrderShipmentsAPI {
|
|
7
86
|
private client;
|
|
8
87
|
constructor(client: AxiosInstance);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
90
|
+
*/
|
|
91
|
+
list: (body?: ListSalesOrderShipmentBody | undefined, params?: ListSalesOrderShipmentsParams) => Promise<import("axios").AxiosResponse<ListSalesOrderShipmentsResult, any>>;
|
|
92
|
+
/**
|
|
93
|
+
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
94
|
+
*/
|
|
12
95
|
get: (shipmentId: string) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
|
96
|
+
/**
|
|
97
|
+
* The `create` method creates a new shipment for a sales order.
|
|
98
|
+
*/
|
|
13
99
|
create: (salesOrderId: string, shipment: Partial<SalesOrderShipment>) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
|
100
|
+
/**
|
|
101
|
+
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
102
|
+
*/
|
|
14
103
|
update: (shipmentId: string, shipment: Partial<SalesOrderShipment>) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
|
15
104
|
}
|
package/sales-orders/api.d.ts
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { SalesOrder, SalesOrderTracking } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* # Sales Orders - List Sales Orders Params
|
|
5
|
+
*/
|
|
3
6
|
export interface ListSalesOrdersParams {
|
|
7
|
+
/**
|
|
8
|
+
* `externalOrderId` is an optional unique ID that can be set by the user to
|
|
9
|
+
* associate shipments with an external system.
|
|
10
|
+
*/
|
|
4
11
|
externalOrderId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* `externalOrderNumber` is an optional unique identifier that can be set by
|
|
14
|
+
* the user to associate shipments with an external order system.
|
|
15
|
+
*/
|
|
5
16
|
externalOrderNumber?: string;
|
|
6
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* # Sales Orders API module - /v-beta/sales_orders
|
|
20
|
+
*/
|
|
7
21
|
export declare class SalesOrdersAPI {
|
|
8
22
|
private client;
|
|
9
23
|
constructor(client: AxiosInstance);
|
|
24
|
+
/**
|
|
25
|
+
* The `list` method retrieves a list of sales orders.
|
|
26
|
+
*/
|
|
10
27
|
list: (params?: ListSalesOrdersParams) => Promise<import("axios").AxiosResponse<{
|
|
11
28
|
salesOrders: SalesOrder[];
|
|
12
29
|
}, any>>;
|
|
30
|
+
/**
|
|
31
|
+
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
32
|
+
*/
|
|
13
33
|
get: (salesOrderId: string) => Promise<import("axios").AxiosResponse<SalesOrder, any>>;
|
|
34
|
+
/**
|
|
35
|
+
* The `notifyShipped` method notifies order source that the order has been
|
|
36
|
+
* shipped. Typically, the order source will then notify the user based on
|
|
37
|
+
* this update from ShipEngine API.
|
|
38
|
+
*/
|
|
14
39
|
notifyShipped: (salesOrderId: string, tracking: SalesOrderTracking) => Promise<import("axios").AxiosResponse<SalesOrder, any>>;
|
|
15
40
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { BatchableQuery, CreationRangeQuery, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery, TaggableQuery } from "../resources";
|
|
3
|
+
import { Shipment, ShipmentRateResponse, ShipmentStatus } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* # Shipments - Get Shipment Rates Options
|
|
6
|
+
*/
|
|
7
|
+
export type GetShipmentRatesOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Date to filter rates by (they must be more recent than this date if passed)
|
|
10
|
+
* @example "2019-03-12T19:24:13.657Z"
|
|
11
|
+
*/
|
|
12
|
+
createdAtStart?: string;
|
|
13
|
+
/**
|
|
14
|
+
* `shipmentId` is the unique identifier of the shipment to retrieve.
|
|
15
|
+
*/
|
|
16
|
+
shipmentId: string;
|
|
17
|
+
};
|
|
18
|
+
export type ListShipmentOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* `salesOrderIds` is an array of sales order IDs to be used when listing sales
|
|
21
|
+
* orders.
|
|
22
|
+
*/
|
|
23
|
+
salesOrderId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* `shipmentStatus` is the current fulfillment status of the shipment.
|
|
26
|
+
*/
|
|
27
|
+
shipmentStatus?: ShipmentStatus;
|
|
28
|
+
} & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
|
|
29
|
+
/**
|
|
30
|
+
* # Shipments - List Shipments Result
|
|
31
|
+
*/
|
|
32
|
+
export type ListShipmentResult = {
|
|
33
|
+
/**
|
|
34
|
+
* `shipments` is an array of shipments to be returned.
|
|
35
|
+
*/
|
|
36
|
+
shipments: Shipment[];
|
|
37
|
+
} & PageableResult;
|
|
38
|
+
/**
|
|
39
|
+
* # Shipments - Create Shipments Result
|
|
40
|
+
*/
|
|
41
|
+
export type CreateShipmentResult = {
|
|
42
|
+
/**
|
|
43
|
+
* `hasErrors` is a boolean that indicates if any errors occurred during the
|
|
44
|
+
* creation of the shipments.
|
|
45
|
+
*/
|
|
46
|
+
hasErrors: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* `shipments` is an array of shipments that were created.
|
|
49
|
+
*/
|
|
50
|
+
shipments: Shipment[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* # Shipments API module - /v1/shipments
|
|
54
|
+
*/
|
|
55
|
+
export declare class ShipmentsAPI {
|
|
56
|
+
private client;
|
|
57
|
+
constructor(client: AxiosInstance);
|
|
58
|
+
/**
|
|
59
|
+
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
60
|
+
* shipment ID.
|
|
61
|
+
*/
|
|
62
|
+
getShipmentRates: ({ shipmentId, createdAtStart }: GetShipmentRatesOptions) => Promise<import("axios").AxiosResponse<ShipmentRateResponse, any>>;
|
|
63
|
+
/**
|
|
64
|
+
* The `list` method retrieves a list of shipments for a given user.
|
|
65
|
+
*/
|
|
66
|
+
list: (options?: ListShipmentOptions) => Promise<import("axios").AxiosResponse<ListShipmentResult, any>>;
|
|
67
|
+
/**
|
|
68
|
+
* The `create` method allows for creating shipments based on a list of shipment
|
|
69
|
+
* items passed into this method.
|
|
70
|
+
*/
|
|
71
|
+
create: (...shipments: Partial<Omit<Shipment, "items">>[]) => Promise<import("axios").AxiosResponse<CreateShipmentResult, any>>;
|
|
72
|
+
}
|
package/shipments/index.d.ts
CHANGED