@chrt-inc/typescript-sdk 1.733.0 → 1.734.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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/integrations/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/integrations/client/Client.js +9 -4
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/Client.d.ts +101 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/Client.js +377 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/index.js +17 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/CargoAiTrackAndTraceSubscribeReq.d.ts +14 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/CargoAiTrackAndTraceSubscribeReq.js +5 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/index.d.ts +1 -0
- package/dist/cjs/api/resources/integrations/resources/cargoaiTrackAndTrace/index.js +17 -0
- package/dist/cjs/api/resources/integrations/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/integrations/resources/index.js +3 -1
- package/dist/cjs/api/types/Cargo1.d.ts +2 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAdditionalInformation.d.ts +12 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAdditionalInformation.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAlert.d.ts +11 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAlert.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAlertLevelEnum.d.ts +12 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceAlertLevelEnum.js +11 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceEvent.d.ts +33 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceEvent.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceFlight.d.ts +25 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceFlight.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceSubscription1.d.ts +20 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceSubscription1.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUld.d.ts +10 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUld.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUpdate1.d.ts +27 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUpdate1.js +5 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUpdateSourceEnum.d.ts +8 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceUpdateSourceEnum.js +10 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceWebhookResponse.d.ts +7 -0
- package/dist/cjs/api/types/CargoAiTrackAndTraceWebhookResponse.js +5 -0
- package/dist/cjs/api/types/CargoClientCreate1.d.ts +2 -0
- package/dist/cjs/api/types/CargoClientUpdate1.d.ts +3 -0
- package/dist/cjs/api/types/OrderDraftValidationResult.d.ts +1 -0
- package/dist/cjs/api/types/TaskGroupExpanded.d.ts +1 -0
- package/dist/cjs/api/types/ValidationIssue.d.ts +8 -0
- package/dist/cjs/api/types/ValidationIssue.js +5 -0
- package/dist/cjs/api/types/ValidationIssueScope.d.ts +8 -0
- package/dist/cjs/api/types/ValidationIssueScope.js +5 -0
- package/dist/cjs/api/types/index.d.ts +12 -0
- package/dist/cjs/api/types/index.js +12 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/integrations/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/integrations/client/Client.mjs +5 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/Client.d.mts +101 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/Client.mjs +340 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/index.d.mts +2 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/index.mjs +1 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/CargoAiTrackAndTraceSubscribeReq.d.mts +14 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/CargoAiTrackAndTraceSubscribeReq.mjs +4 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/index.d.mts +1 -0
- package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/index.mjs +1 -0
- package/dist/esm/api/resources/integrations/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/integrations/resources/index.mjs +2 -0
- package/dist/esm/api/types/Cargo1.d.mts +2 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAdditionalInformation.d.mts +12 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAdditionalInformation.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAlert.d.mts +11 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAlert.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAlertLevelEnum.d.mts +12 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceAlertLevelEnum.mjs +8 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceEvent.d.mts +33 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceEvent.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceFlight.d.mts +25 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceFlight.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceSubscription1.d.mts +20 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceSubscription1.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUld.d.mts +10 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUld.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUpdate1.d.mts +27 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUpdate1.mjs +4 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUpdateSourceEnum.d.mts +8 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceUpdateSourceEnum.mjs +7 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceWebhookResponse.d.mts +7 -0
- package/dist/esm/api/types/CargoAiTrackAndTraceWebhookResponse.mjs +4 -0
- package/dist/esm/api/types/CargoClientCreate1.d.mts +2 -0
- package/dist/esm/api/types/CargoClientUpdate1.d.mts +3 -0
- package/dist/esm/api/types/OrderDraftValidationResult.d.mts +1 -0
- package/dist/esm/api/types/TaskGroupExpanded.d.mts +1 -0
- package/dist/esm/api/types/ValidationIssue.d.mts +8 -0
- package/dist/esm/api/types/ValidationIssue.mjs +4 -0
- package/dist/esm/api/types/ValidationIssueScope.d.mts +8 -0
- package/dist/esm/api/types/ValidationIssueScope.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +12 -0
- package/dist/esm/api/types/index.mjs +12 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +319 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
15
|
+
import * as Chrt from "../../../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
18
|
+
export class CargoaiTrackAndTrace {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the stored CargoAi tracking subscription for an AWB. | authz: order participant | () -> (CargoAiTrackAndTraceSubscription1)
|
|
24
|
+
*
|
|
25
|
+
* @param {string} awb
|
|
26
|
+
* @param {CargoaiTrackAndTrace.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.integrations.cargoaiTrackAndTrace.subscriptionV1("awb")
|
|
32
|
+
*/
|
|
33
|
+
subscriptionV1(awb, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__subscriptionV1(awb, requestOptions));
|
|
35
|
+
}
|
|
36
|
+
__subscriptionV1(awb, requestOptions) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
40
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
41
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `integrations/cargoai_track_and_trace/subscription/v1/${encodeURIComponent(awb)}`),
|
|
42
|
+
method: "GET",
|
|
43
|
+
headers: _headers,
|
|
44
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
45
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
46
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
47
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
48
|
+
});
|
|
49
|
+
if (_response.ok) {
|
|
50
|
+
return {
|
|
51
|
+
data: _response.body,
|
|
52
|
+
rawResponse: _response.rawResponse,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (_response.error.reason === "status-code") {
|
|
56
|
+
switch (_response.error.statusCode) {
|
|
57
|
+
case 422:
|
|
58
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
59
|
+
default:
|
|
60
|
+
throw new errors.ChrtError({
|
|
61
|
+
statusCode: _response.error.statusCode,
|
|
62
|
+
body: _response.error.body,
|
|
63
|
+
rawResponse: _response.rawResponse,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
switch (_response.error.reason) {
|
|
68
|
+
case "non-json":
|
|
69
|
+
throw new errors.ChrtError({
|
|
70
|
+
statusCode: _response.error.statusCode,
|
|
71
|
+
body: _response.error.rawBody,
|
|
72
|
+
rawResponse: _response.rawResponse,
|
|
73
|
+
});
|
|
74
|
+
case "timeout":
|
|
75
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /integrations/cargoai_track_and_trace/subscription/v1/{awb}.");
|
|
76
|
+
case "unknown":
|
|
77
|
+
throw new errors.ChrtError({
|
|
78
|
+
message: _response.error.errorMessage,
|
|
79
|
+
rawResponse: _response.rawResponse,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves stored CargoAi tracking updates for an AWB, latest first (the first item is the current state). | authz: order participant | () -> (list[CargoAiTrackAndTraceUpdate1])
|
|
86
|
+
*
|
|
87
|
+
* @param {string} awb
|
|
88
|
+
* @param {CargoaiTrackAndTrace.RequestOptions} requestOptions - Request-specific configuration.
|
|
89
|
+
*
|
|
90
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.integrations.cargoaiTrackAndTrace.updatesV1("awb")
|
|
94
|
+
*/
|
|
95
|
+
updatesV1(awb, requestOptions) {
|
|
96
|
+
return core.HttpResponsePromise.fromPromise(this.__updatesV1(awb, requestOptions));
|
|
97
|
+
}
|
|
98
|
+
__updatesV1(awb, requestOptions) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
102
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
103
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `integrations/cargoai_track_and_trace/updates/v1/${encodeURIComponent(awb)}`),
|
|
104
|
+
method: "GET",
|
|
105
|
+
headers: _headers,
|
|
106
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
107
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
108
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
109
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
110
|
+
});
|
|
111
|
+
if (_response.ok) {
|
|
112
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
113
|
+
}
|
|
114
|
+
if (_response.error.reason === "status-code") {
|
|
115
|
+
switch (_response.error.statusCode) {
|
|
116
|
+
case 422:
|
|
117
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
118
|
+
default:
|
|
119
|
+
throw new errors.ChrtError({
|
|
120
|
+
statusCode: _response.error.statusCode,
|
|
121
|
+
body: _response.error.body,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
switch (_response.error.reason) {
|
|
127
|
+
case "non-json":
|
|
128
|
+
throw new errors.ChrtError({
|
|
129
|
+
statusCode: _response.error.statusCode,
|
|
130
|
+
body: _response.error.rawBody,
|
|
131
|
+
rawResponse: _response.rawResponse,
|
|
132
|
+
});
|
|
133
|
+
case "timeout":
|
|
134
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /integrations/cargoai_track_and_trace/updates/v1/{awb}.");
|
|
135
|
+
case "unknown":
|
|
136
|
+
throw new errors.ChrtError({
|
|
137
|
+
message: _response.error.errorMessage,
|
|
138
|
+
rawResponse: _response.rawResponse,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Lists CargoAi tracking subscriptions for the AWBs recorded on a task group. | authz: order participant | () -> (list[CargoAiTrackAndTraceSubscription1])
|
|
145
|
+
*
|
|
146
|
+
* @param {string} taskGroupId
|
|
147
|
+
* @param {CargoaiTrackAndTrace.RequestOptions} requestOptions - Request-specific configuration.
|
|
148
|
+
*
|
|
149
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* await client.integrations.cargoaiTrackAndTrace.subscriptionsByTaskGroupV1("task_group_id")
|
|
153
|
+
*/
|
|
154
|
+
subscriptionsByTaskGroupV1(taskGroupId, requestOptions) {
|
|
155
|
+
return core.HttpResponsePromise.fromPromise(this.__subscriptionsByTaskGroupV1(taskGroupId, requestOptions));
|
|
156
|
+
}
|
|
157
|
+
__subscriptionsByTaskGroupV1(taskGroupId, requestOptions) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
var _a, _b, _c, _d;
|
|
160
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
161
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
162
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `integrations/cargoai_track_and_trace/subscriptions/by_task_group/v1/${encodeURIComponent(taskGroupId)}`),
|
|
163
|
+
method: "GET",
|
|
164
|
+
headers: _headers,
|
|
165
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
166
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
167
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
168
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
169
|
+
});
|
|
170
|
+
if (_response.ok) {
|
|
171
|
+
return {
|
|
172
|
+
data: _response.body,
|
|
173
|
+
rawResponse: _response.rawResponse,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (_response.error.reason === "status-code") {
|
|
177
|
+
switch (_response.error.statusCode) {
|
|
178
|
+
case 422:
|
|
179
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
180
|
+
default:
|
|
181
|
+
throw new errors.ChrtError({
|
|
182
|
+
statusCode: _response.error.statusCode,
|
|
183
|
+
body: _response.error.body,
|
|
184
|
+
rawResponse: _response.rawResponse,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
switch (_response.error.reason) {
|
|
189
|
+
case "non-json":
|
|
190
|
+
throw new errors.ChrtError({
|
|
191
|
+
statusCode: _response.error.statusCode,
|
|
192
|
+
body: _response.error.rawBody,
|
|
193
|
+
rawResponse: _response.rawResponse,
|
|
194
|
+
});
|
|
195
|
+
case "timeout":
|
|
196
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /integrations/cargoai_track_and_trace/subscriptions/by_task_group/v1/{task_group_id}.");
|
|
197
|
+
case "unknown":
|
|
198
|
+
throw new errors.ChrtError({
|
|
199
|
+
message: _response.error.errorMessage,
|
|
200
|
+
rawResponse: _response.rawResponse,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Starts CargoAi Track & Trace URL + e-mail updates for an AWB (which must already be recorded on a flight leg). Idempotent: re-subscribing a still-live AWB returns the existing subscription without calling CargoAi again. | authz: order participant operator | (CargoAiTrackAndTraceSubscribeReq) -> (CargoAiTrackAndTraceSubscription1)
|
|
207
|
+
*
|
|
208
|
+
* @param {Chrt.integrations.CargoAiTrackAndTraceSubscribeReq} request
|
|
209
|
+
* @param {CargoaiTrackAndTrace.RequestOptions} requestOptions - Request-specific configuration.
|
|
210
|
+
*
|
|
211
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* await client.integrations.cargoaiTrackAndTrace.subscribeV1({
|
|
215
|
+
* awb: "awb"
|
|
216
|
+
* })
|
|
217
|
+
*/
|
|
218
|
+
subscribeV1(request, requestOptions) {
|
|
219
|
+
return core.HttpResponsePromise.fromPromise(this.__subscribeV1(request, requestOptions));
|
|
220
|
+
}
|
|
221
|
+
__subscribeV1(request, requestOptions) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
var _a, _b, _c, _d;
|
|
224
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
225
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
226
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "integrations/cargoai_track_and_trace/subscribe/v1"),
|
|
227
|
+
method: "POST",
|
|
228
|
+
headers: _headers,
|
|
229
|
+
contentType: "application/json",
|
|
230
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
231
|
+
requestType: "json",
|
|
232
|
+
body: request,
|
|
233
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
234
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
235
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
236
|
+
});
|
|
237
|
+
if (_response.ok) {
|
|
238
|
+
return {
|
|
239
|
+
data: _response.body,
|
|
240
|
+
rawResponse: _response.rawResponse,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
if (_response.error.reason === "status-code") {
|
|
244
|
+
switch (_response.error.statusCode) {
|
|
245
|
+
case 422:
|
|
246
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
247
|
+
default:
|
|
248
|
+
throw new errors.ChrtError({
|
|
249
|
+
statusCode: _response.error.statusCode,
|
|
250
|
+
body: _response.error.body,
|
|
251
|
+
rawResponse: _response.rawResponse,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
switch (_response.error.reason) {
|
|
256
|
+
case "non-json":
|
|
257
|
+
throw new errors.ChrtError({
|
|
258
|
+
statusCode: _response.error.statusCode,
|
|
259
|
+
body: _response.error.rawBody,
|
|
260
|
+
rawResponse: _response.rawResponse,
|
|
261
|
+
});
|
|
262
|
+
case "timeout":
|
|
263
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /integrations/cargoai_track_and_trace/subscribe/v1.");
|
|
264
|
+
case "unknown":
|
|
265
|
+
throw new errors.ChrtError({
|
|
266
|
+
message: _response.error.errorMessage,
|
|
267
|
+
rawResponse: _response.rawResponse,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Polls CargoAi for the current tracking snapshot of an AWB and stores it as a new update (source=poll). No subscription required — any order participant can poll on demand. | authz: order participant | () -> (CargoAiTrackAndTraceUpdate1)
|
|
274
|
+
*
|
|
275
|
+
* @param {string} awb
|
|
276
|
+
* @param {CargoaiTrackAndTrace.RequestOptions} requestOptions - Request-specific configuration.
|
|
277
|
+
*
|
|
278
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* await client.integrations.cargoaiTrackAndTrace.refreshV1("awb")
|
|
282
|
+
*/
|
|
283
|
+
refreshV1(awb, requestOptions) {
|
|
284
|
+
return core.HttpResponsePromise.fromPromise(this.__refreshV1(awb, requestOptions));
|
|
285
|
+
}
|
|
286
|
+
__refreshV1(awb, requestOptions) {
|
|
287
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
288
|
+
var _a, _b, _c, _d;
|
|
289
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
290
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
291
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `integrations/cargoai_track_and_trace/refresh/v1/${encodeURIComponent(awb)}`),
|
|
292
|
+
method: "POST",
|
|
293
|
+
headers: _headers,
|
|
294
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
295
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
296
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
297
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
298
|
+
});
|
|
299
|
+
if (_response.ok) {
|
|
300
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
301
|
+
}
|
|
302
|
+
if (_response.error.reason === "status-code") {
|
|
303
|
+
switch (_response.error.statusCode) {
|
|
304
|
+
case 422:
|
|
305
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
306
|
+
default:
|
|
307
|
+
throw new errors.ChrtError({
|
|
308
|
+
statusCode: _response.error.statusCode,
|
|
309
|
+
body: _response.error.body,
|
|
310
|
+
rawResponse: _response.rawResponse,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
switch (_response.error.reason) {
|
|
315
|
+
case "non-json":
|
|
316
|
+
throw new errors.ChrtError({
|
|
317
|
+
statusCode: _response.error.statusCode,
|
|
318
|
+
body: _response.error.rawBody,
|
|
319
|
+
rawResponse: _response.rawResponse,
|
|
320
|
+
});
|
|
321
|
+
case "timeout":
|
|
322
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /integrations/cargoai_track_and_trace/refresh/v1/{awb}.");
|
|
323
|
+
case "unknown":
|
|
324
|
+
throw new errors.ChrtError({
|
|
325
|
+
message: _response.error.errorMessage,
|
|
326
|
+
rawResponse: _response.rawResponse,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
_getAuthorizationHeader() {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
333
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
334
|
+
if (bearer != null) {
|
|
335
|
+
return `Bearer ${bearer}`;
|
|
336
|
+
}
|
|
337
|
+
return undefined;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* awb: "awb"
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface CargoAiTrackAndTraceSubscribeReq {
|
|
11
|
+
/** IATA Air Waybill number: 3-digit airline prefix + 8-digit serial, e.g. '020-12345678'. */
|
|
12
|
+
awb: string;
|
|
13
|
+
emails?: string[];
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type CargoAiTrackAndTraceSubscribeReq } from "./CargoAiTrackAndTraceSubscribeReq.mjs";
|
package/dist/esm/api/resources/integrations/resources/cargoaiTrackAndTrace/client/requests/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * as airWaybills from "./airWaybills/index.mjs";
|
|
2
|
+
export * as cargoaiTrackAndTrace from "./cargoaiTrackAndTrace/index.mjs";
|
|
2
3
|
export * as webcargoBookings from "./webcargoBookings/index.mjs";
|
|
3
4
|
export * as webcargoEmbed from "./webcargoEmbed/index.mjs";
|
|
4
5
|
export * from "./airWaybills/client/requests/index.mjs";
|
|
6
|
+
export * from "./cargoaiTrackAndTrace/client/requests/index.mjs";
|
|
5
7
|
export * from "./webcargoEmbed/client/requests/index.mjs";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * as airWaybills from "./airWaybills/index.mjs";
|
|
2
|
+
export * as cargoaiTrackAndTrace from "./cargoaiTrackAndTrace/index.mjs";
|
|
2
3
|
export * as webcargoBookings from "./webcargoBookings/index.mjs";
|
|
3
4
|
export * as webcargoEmbed from "./webcargoEmbed/index.mjs";
|
|
4
5
|
export * from "./airWaybills/client/requests/index.mjs";
|
|
6
|
+
export * from "./cargoaiTrackAndTrace/client/requests/index.mjs";
|
|
5
7
|
export * from "./webcargoEmbed/client/requests/index.mjs";
|
|
@@ -13,6 +13,8 @@ export interface Cargo1 {
|
|
|
13
13
|
turnable?: boolean | null;
|
|
14
14
|
stackable?: boolean | null;
|
|
15
15
|
description?: string | null;
|
|
16
|
+
/** IATA Air Waybill number: 3-digit airline prefix + 8-digit serial, e.g. '020-12345678'. */
|
|
17
|
+
awb_number?: string | null;
|
|
16
18
|
_id: string;
|
|
17
19
|
order_id: string;
|
|
18
20
|
order_short_id: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Event `additionalInformation` (notifications, delivery, transfer).
|
|
6
|
+
*/
|
|
7
|
+
export interface CargoAiTrackAndTraceAdditionalInformation {
|
|
8
|
+
receivedFromName?: string | null;
|
|
9
|
+
notificationToName?: string | null;
|
|
10
|
+
deliveryToName?: string | null;
|
|
11
|
+
transferredToCarrier?: string | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* The `alerts` object — early warning signals on shipment execution.
|
|
7
|
+
*/
|
|
8
|
+
export interface CargoAiTrackAndTraceAlert {
|
|
9
|
+
level?: Chrt.CargoAiTrackAndTraceAlertLevelEnum | null;
|
|
10
|
+
message?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Early-warning signal level on shipment execution (alerts.level).
|
|
6
|
+
*/
|
|
7
|
+
export type CargoAiTrackAndTraceAlertLevelEnum = "OK" | "WATCH" | "AT_RISK";
|
|
8
|
+
export declare const CargoAiTrackAndTraceAlertLevelEnum: {
|
|
9
|
+
readonly Ok: "OK";
|
|
10
|
+
readonly Watch: "WATCH";
|
|
11
|
+
readonly AtRisk: "AT_RISK";
|
|
12
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* A single tracking event (BKD, RCS, DEP, ARR, RCF, NFD, DLV, ...).
|
|
7
|
+
*/
|
|
8
|
+
export interface CargoAiTrackAndTraceEvent {
|
|
9
|
+
code?: string | null;
|
|
10
|
+
description?: string | null;
|
|
11
|
+
eventDate?: string | null;
|
|
12
|
+
eventLocation?: string | null;
|
|
13
|
+
eventLocationCoord?: string | null;
|
|
14
|
+
flight?: Chrt.CargoAiTrackAndTraceFlight | null;
|
|
15
|
+
weight?: string | null;
|
|
16
|
+
volume?: string | null;
|
|
17
|
+
pieces?: string | null;
|
|
18
|
+
additionalInformation?: Chrt.CargoAiTrackAndTraceAdditionalInformation | null;
|
|
19
|
+
eventUlds?: Chrt.CargoAiTrackAndTraceUld[];
|
|
20
|
+
isPlanned?: boolean | null;
|
|
21
|
+
distance?: string | null;
|
|
22
|
+
origin?: string | null;
|
|
23
|
+
destination?: string | null;
|
|
24
|
+
time?: string | null;
|
|
25
|
+
flightNumber?: string | null;
|
|
26
|
+
scheduledDepartureDate?: string | null;
|
|
27
|
+
carbonEmission?: string | null;
|
|
28
|
+
originCoord?: string | null;
|
|
29
|
+
destinationCoord?: string | null;
|
|
30
|
+
isPredicted?: boolean | null;
|
|
31
|
+
predictedEventDate?: string | null;
|
|
32
|
+
predictedEventDateP90?: string | null;
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* The `flight` object nested inside a tracking event.
|
|
7
|
+
*/
|
|
8
|
+
export interface CargoAiTrackAndTraceFlight {
|
|
9
|
+
number?: string | null;
|
|
10
|
+
origin?: string | null;
|
|
11
|
+
destination?: string | null;
|
|
12
|
+
originCoord?: string | null;
|
|
13
|
+
destinationCoord?: string | null;
|
|
14
|
+
date?: string | null;
|
|
15
|
+
scheduledDeparture?: string | null;
|
|
16
|
+
estimatedDeparture?: string | null;
|
|
17
|
+
actualDeparture?: string | null;
|
|
18
|
+
scheduledArrival?: string | null;
|
|
19
|
+
estimatedArrival?: string | null;
|
|
20
|
+
actualArrival?: string | null;
|
|
21
|
+
carbonEmission?: string | null;
|
|
22
|
+
distance?: string | null;
|
|
23
|
+
duration?: string | null;
|
|
24
|
+
flightUlds?: Chrt.CargoAiTrackAndTraceUld[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface CargoAiTrackAndTraceSubscription1 {
|
|
5
|
+
schema_version: number;
|
|
6
|
+
_id: string;
|
|
7
|
+
/** IATA Air Waybill number: 3-digit airline prefix + 8-digit serial, e.g. '020-12345678'. */
|
|
8
|
+
awb: string;
|
|
9
|
+
/** Must be a string starting with `user_` */
|
|
10
|
+
created_by_user_id: string;
|
|
11
|
+
/** Must be a string starting with `org_` */
|
|
12
|
+
created_by_org_id: string;
|
|
13
|
+
subscribed_emails?: string[];
|
|
14
|
+
tracking_update_ids?: string[];
|
|
15
|
+
subscribed_at: string;
|
|
16
|
+
active_until: string;
|
|
17
|
+
last_update_received_at?: string | null;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* ULD details attached to an event (`eventUlds`) or flight (`flightUlds`).
|
|
6
|
+
*/
|
|
7
|
+
export interface CargoAiTrackAndTraceUld {
|
|
8
|
+
pieces?: string | null;
|
|
9
|
+
uld?: string | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.mjs";
|
|
5
|
+
export interface CargoAiTrackAndTraceUpdate1 {
|
|
6
|
+
schemaVersion?: number;
|
|
7
|
+
/** IATA Air Waybill number: 3-digit airline prefix + 8-digit serial, e.g. '020-12345678'. */
|
|
8
|
+
awb: string;
|
|
9
|
+
origin?: string | null;
|
|
10
|
+
destination?: string | null;
|
|
11
|
+
status?: string | null;
|
|
12
|
+
weight?: string | null;
|
|
13
|
+
pieces?: string | null;
|
|
14
|
+
volume?: string | null;
|
|
15
|
+
carbonEmission?: string | null;
|
|
16
|
+
alerts?: Chrt.CargoAiTrackAndTraceAlert | null;
|
|
17
|
+
oldEvents?: Chrt.CargoAiTrackAndTraceEvent[];
|
|
18
|
+
newEvents?: Chrt.CargoAiTrackAndTraceEvent[];
|
|
19
|
+
events?: Chrt.CargoAiTrackAndTraceEvent[];
|
|
20
|
+
_id: string;
|
|
21
|
+
receivedAt: string;
|
|
22
|
+
source: Chrt.CargoAiTrackAndTraceUpdateSourceEnum;
|
|
23
|
+
/** Must be a string starting with `user_` */
|
|
24
|
+
polledByUserId?: string | null;
|
|
25
|
+
/** Must be a string starting with `org_` */
|
|
26
|
+
polledByOrgId?: string | null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export type CargoAiTrackAndTraceUpdateSourceEnum = "webhook" | "poll";
|
|
5
|
+
export declare const CargoAiTrackAndTraceUpdateSourceEnum: {
|
|
6
|
+
readonly Webhook: "webhook";
|
|
7
|
+
readonly Poll: "poll";
|
|
8
|
+
};
|