@flexops/sdk 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 +449 -0
- package/dist/index.d.mts +1220 -0
- package/dist/index.d.ts +1220 -0
- package/dist/index.js +1317 -0
- package/dist/index.mjs +1274 -0
- package/package.json +63 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/types.ts
|
|
9
|
+
var FlexOpsError = class extends Error {
|
|
10
|
+
constructor(message, status, code, errors) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.errors = errors;
|
|
15
|
+
this.name = "FlexOpsError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var FlexOpsRateLimitError = class extends FlexOpsError {
|
|
19
|
+
constructor(message, retryAfter) {
|
|
20
|
+
super(message, 429, "RATE_LIMITED");
|
|
21
|
+
this.retryAfter = retryAfter;
|
|
22
|
+
this.name = "FlexOpsRateLimitError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var FlexOpsAuthError = class extends FlexOpsError {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(message, 401, "UNAUTHORIZED");
|
|
28
|
+
this.name = "FlexOpsAuthError";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/http.ts
|
|
33
|
+
var DEFAULT_BASE_URL = "https://gateway.flexops.io";
|
|
34
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
35
|
+
var DEFAULT_RETRY = {
|
|
36
|
+
maxRetries: 3,
|
|
37
|
+
baseDelay: 1e3,
|
|
38
|
+
retryableStatusCodes: [429, 500, 502, 503, 504]
|
|
39
|
+
};
|
|
40
|
+
var HttpClient = class {
|
|
41
|
+
baseUrl;
|
|
42
|
+
timeout;
|
|
43
|
+
retry;
|
|
44
|
+
customHeaders;
|
|
45
|
+
fetchFn;
|
|
46
|
+
accessToken;
|
|
47
|
+
apiKey;
|
|
48
|
+
constructor(config) {
|
|
49
|
+
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
50
|
+
this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
51
|
+
this.retry = { ...DEFAULT_RETRY, ...config.retry };
|
|
52
|
+
this.customHeaders = config.headers ?? {};
|
|
53
|
+
this.fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
54
|
+
this.accessToken = config.accessToken;
|
|
55
|
+
this.apiKey = config.apiKey;
|
|
56
|
+
}
|
|
57
|
+
setAccessToken(token) {
|
|
58
|
+
this.accessToken = token;
|
|
59
|
+
}
|
|
60
|
+
setApiKey(key) {
|
|
61
|
+
this.apiKey = key;
|
|
62
|
+
}
|
|
63
|
+
async request(method, path, options) {
|
|
64
|
+
const url = this.buildUrl(path, options?.query);
|
|
65
|
+
const headers = this.buildHeaders(options?.headers);
|
|
66
|
+
const body = options?.body ? JSON.stringify(options.body) : void 0;
|
|
67
|
+
const timeout = options?.timeout ?? this.timeout;
|
|
68
|
+
let lastError;
|
|
69
|
+
for (let attempt = 0; attempt <= this.retry.maxRetries; attempt++) {
|
|
70
|
+
if (attempt > 0) {
|
|
71
|
+
const delay = this.calculateBackoff(attempt);
|
|
72
|
+
await sleep(delay);
|
|
73
|
+
}
|
|
74
|
+
const controller = new AbortController();
|
|
75
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
76
|
+
try {
|
|
77
|
+
const response = await this.fetchFn(url, {
|
|
78
|
+
method,
|
|
79
|
+
headers,
|
|
80
|
+
body,
|
|
81
|
+
signal: controller.signal
|
|
82
|
+
});
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
if (response.ok) {
|
|
85
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
86
|
+
if (contentType.includes("application/json")) {
|
|
87
|
+
return await response.json();
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
if (response.status === 429) {
|
|
92
|
+
const retryAfter = parseInt(response.headers.get("retry-after") ?? "0", 10);
|
|
93
|
+
lastError = new FlexOpsRateLimitError(
|
|
94
|
+
`Rate limited. Retry after ${retryAfter}s`,
|
|
95
|
+
retryAfter
|
|
96
|
+
);
|
|
97
|
+
if (this.retry.retryableStatusCodes.includes(429)) continue;
|
|
98
|
+
throw lastError;
|
|
99
|
+
}
|
|
100
|
+
if (response.status === 401) {
|
|
101
|
+
throw new FlexOpsAuthError("Authentication required. Check your access token or API key.");
|
|
102
|
+
}
|
|
103
|
+
if (response.status === 403) {
|
|
104
|
+
throw new FlexOpsError("Access denied. Check your plan tier and feature entitlements.", 403, "FORBIDDEN");
|
|
105
|
+
}
|
|
106
|
+
let errorBody = {};
|
|
107
|
+
try {
|
|
108
|
+
errorBody = await response.json();
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
const error = new FlexOpsError(
|
|
112
|
+
errorBody.message ?? `HTTP ${response.status}: ${response.statusText}`,
|
|
113
|
+
response.status,
|
|
114
|
+
void 0,
|
|
115
|
+
errorBody.errors
|
|
116
|
+
);
|
|
117
|
+
if (this.retry.retryableStatusCodes.includes(response.status)) {
|
|
118
|
+
lastError = error;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
throw error;
|
|
122
|
+
} catch (err) {
|
|
123
|
+
clearTimeout(timer);
|
|
124
|
+
if (err instanceof FlexOpsError) {
|
|
125
|
+
if (err instanceof FlexOpsRateLimitError && attempt < this.retry.maxRetries) continue;
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
if (err instanceof DOMException && err.name === "AbortError") {
|
|
129
|
+
lastError = new FlexOpsError(`Request timed out after ${timeout}ms`, 0, "TIMEOUT");
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
133
|
+
if (attempt < this.retry.maxRetries) continue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
throw lastError ?? new FlexOpsError("Request failed after retries", 0, "RETRY_EXHAUSTED");
|
|
137
|
+
}
|
|
138
|
+
async get(path, query) {
|
|
139
|
+
return this.request("GET", path, { query });
|
|
140
|
+
}
|
|
141
|
+
async post(path, body, query) {
|
|
142
|
+
return this.request("POST", path, { body, query });
|
|
143
|
+
}
|
|
144
|
+
async put(path, body) {
|
|
145
|
+
return this.request("PUT", path, { body });
|
|
146
|
+
}
|
|
147
|
+
async patch(path, body) {
|
|
148
|
+
return this.request("PATCH", path, { body });
|
|
149
|
+
}
|
|
150
|
+
async delete(path) {
|
|
151
|
+
return this.request("DELETE", path);
|
|
152
|
+
}
|
|
153
|
+
buildUrl(path, query) {
|
|
154
|
+
const url = new URL(path.startsWith("/") ? path : `/${path}`, this.baseUrl);
|
|
155
|
+
if (query) {
|
|
156
|
+
for (const [key, value] of Object.entries(query)) {
|
|
157
|
+
if (value !== void 0) {
|
|
158
|
+
url.searchParams.set(key, String(value));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return url.toString();
|
|
163
|
+
}
|
|
164
|
+
buildHeaders(extra) {
|
|
165
|
+
const headers = {
|
|
166
|
+
"Content-Type": "application/json",
|
|
167
|
+
Accept: "application/json",
|
|
168
|
+
...this.customHeaders,
|
|
169
|
+
...extra
|
|
170
|
+
};
|
|
171
|
+
if (this.apiKey) {
|
|
172
|
+
headers["X-Api-Key"] = this.apiKey;
|
|
173
|
+
} else if (this.accessToken) {
|
|
174
|
+
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
175
|
+
}
|
|
176
|
+
return headers;
|
|
177
|
+
}
|
|
178
|
+
calculateBackoff(attempt) {
|
|
179
|
+
const jitter = Math.random() * 0.3 + 0.85;
|
|
180
|
+
return Math.min(this.retry.baseDelay * Math.pow(2, attempt - 1) * jitter, 3e4);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
function sleep(ms) {
|
|
184
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// src/resources/auth.ts
|
|
188
|
+
var AuthResource = class {
|
|
189
|
+
constructor(http) {
|
|
190
|
+
this.http = http;
|
|
191
|
+
}
|
|
192
|
+
/** Authenticate with email and password. Returns JWT tokens. */
|
|
193
|
+
async login(request) {
|
|
194
|
+
const result = await this.http.post(
|
|
195
|
+
"/api/Account/login",
|
|
196
|
+
request
|
|
197
|
+
);
|
|
198
|
+
if (result.data?.accessToken) {
|
|
199
|
+
this.http.setAccessToken(result.data.accessToken);
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
/** Register a new account. */
|
|
204
|
+
async register(request) {
|
|
205
|
+
return this.http.post("/api/Account/register", request);
|
|
206
|
+
}
|
|
207
|
+
/** Refresh an expired access token. */
|
|
208
|
+
async refreshToken(refreshToken) {
|
|
209
|
+
const response = await this.http.request(
|
|
210
|
+
"POST",
|
|
211
|
+
"/api/Account/refresh-token",
|
|
212
|
+
{ headers: { "X-Current-Session-Token": refreshToken } }
|
|
213
|
+
);
|
|
214
|
+
if (response.data?.accessToken) {
|
|
215
|
+
this.http.setAccessToken(response.data.accessToken);
|
|
216
|
+
}
|
|
217
|
+
return response;
|
|
218
|
+
}
|
|
219
|
+
/** Log out and invalidate the current session. */
|
|
220
|
+
async logout() {
|
|
221
|
+
return this.http.post("/api/Account/logout");
|
|
222
|
+
}
|
|
223
|
+
/** Get the current user's profile. */
|
|
224
|
+
async getProfile() {
|
|
225
|
+
return this.http.get("/api/Account/profile");
|
|
226
|
+
}
|
|
227
|
+
/** Update the current user's profile. */
|
|
228
|
+
async updateProfile(data) {
|
|
229
|
+
return this.http.put("/api/Account/profile", data);
|
|
230
|
+
}
|
|
231
|
+
/** Change the current user's password. */
|
|
232
|
+
async changePassword(currentPassword, newPassword) {
|
|
233
|
+
return this.http.post("/api/Account/change-password", {
|
|
234
|
+
currentPassword,
|
|
235
|
+
newPassword
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/** Request a password reset email. */
|
|
239
|
+
async forgotPassword(email) {
|
|
240
|
+
return this.http.post("/api/Account/forgot-password", { email });
|
|
241
|
+
}
|
|
242
|
+
/** Reset password using a reset token. */
|
|
243
|
+
async resetPassword(token, newPassword) {
|
|
244
|
+
return this.http.post("/api/Account/reset-password", { token, newPassword });
|
|
245
|
+
}
|
|
246
|
+
/** Verify email with the verification token. */
|
|
247
|
+
async verifyEmail(token) {
|
|
248
|
+
return this.http.post("/api/Account/verify-email", { token });
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// src/resources/workspaces.ts
|
|
253
|
+
var WorkspacesResource = class {
|
|
254
|
+
constructor(http, getWorkspaceId) {
|
|
255
|
+
this.http = http;
|
|
256
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
257
|
+
}
|
|
258
|
+
wsPath(suffix) {
|
|
259
|
+
const id = this.getWorkspaceId();
|
|
260
|
+
if (!id) throw new Error("workspaceId is required. Set it via client.workspaceId or config.");
|
|
261
|
+
return suffix ? `/api/workspaces/${id}/${suffix}` : `/api/workspaces/${id}`;
|
|
262
|
+
}
|
|
263
|
+
/** List all workspaces the current user belongs to. */
|
|
264
|
+
async list() {
|
|
265
|
+
return this.http.get("/api/workspaces");
|
|
266
|
+
}
|
|
267
|
+
/** Get details for a specific workspace. */
|
|
268
|
+
async get(workspaceId) {
|
|
269
|
+
const id = workspaceId ?? this.getWorkspaceId();
|
|
270
|
+
return this.http.get(`/api/workspaces/${id}`);
|
|
271
|
+
}
|
|
272
|
+
/** Create a new workspace. */
|
|
273
|
+
async create(request) {
|
|
274
|
+
return this.http.post("/api/workspaces", request);
|
|
275
|
+
}
|
|
276
|
+
/** Update workspace settings. */
|
|
277
|
+
async update(data) {
|
|
278
|
+
return this.http.put(this.wsPath(), data);
|
|
279
|
+
}
|
|
280
|
+
/** List members of the current workspace. */
|
|
281
|
+
async listMembers() {
|
|
282
|
+
return this.http.get(this.wsPath("members"));
|
|
283
|
+
}
|
|
284
|
+
/** Invite a user to the workspace. */
|
|
285
|
+
async inviteMember(email, role = "Member") {
|
|
286
|
+
return this.http.post(this.wsPath("members/invite"), { email, role });
|
|
287
|
+
}
|
|
288
|
+
/** Remove a member from the workspace. */
|
|
289
|
+
async removeMember(userId) {
|
|
290
|
+
return this.http.delete(this.wsPath(`members/${userId}`));
|
|
291
|
+
}
|
|
292
|
+
/** Update a member's role. */
|
|
293
|
+
async updateMemberRole(userId, role) {
|
|
294
|
+
return this.http.put(this.wsPath(`members/${userId}/role`), { role });
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// src/resources/shipping.ts
|
|
299
|
+
var ShippingResource = class {
|
|
300
|
+
constructor(http, getWorkspaceId) {
|
|
301
|
+
this.http = http;
|
|
302
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
303
|
+
}
|
|
304
|
+
wsPath(suffix) {
|
|
305
|
+
const id = this.getWorkspaceId();
|
|
306
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
307
|
+
return `/api/workspaces/${id}/${suffix}`;
|
|
308
|
+
}
|
|
309
|
+
// -----------------------------------------------------------------------
|
|
310
|
+
// Rate Shopping
|
|
311
|
+
// -----------------------------------------------------------------------
|
|
312
|
+
/** Get shipping rates from all configured carriers. */
|
|
313
|
+
async getRates(request) {
|
|
314
|
+
return this.http.post(this.wsPath("shipping/rates"), request);
|
|
315
|
+
}
|
|
316
|
+
/** Get the single cheapest rate across all carriers. */
|
|
317
|
+
async getCheapestRate(request) {
|
|
318
|
+
return this.http.post(this.wsPath("shipping/rates/cheapest"), request);
|
|
319
|
+
}
|
|
320
|
+
/** Get the single fastest rate across all carriers. */
|
|
321
|
+
async getFastestRate(request) {
|
|
322
|
+
return this.http.post(this.wsPath("shipping/rates/fastest"), request);
|
|
323
|
+
}
|
|
324
|
+
// -----------------------------------------------------------------------
|
|
325
|
+
// Labels
|
|
326
|
+
// -----------------------------------------------------------------------
|
|
327
|
+
/** Create a shipping label. */
|
|
328
|
+
async createLabel(request) {
|
|
329
|
+
return this.http.post(this.wsPath("shipping/labels"), request, void 0);
|
|
330
|
+
}
|
|
331
|
+
/** Cancel (void) a shipping label. */
|
|
332
|
+
async cancelLabel(labelId) {
|
|
333
|
+
return this.http.delete(this.wsPath(`shipping/labels/${labelId}`));
|
|
334
|
+
}
|
|
335
|
+
// -----------------------------------------------------------------------
|
|
336
|
+
// Tracking
|
|
337
|
+
// -----------------------------------------------------------------------
|
|
338
|
+
/** Track a shipment by tracking number. */
|
|
339
|
+
async track(trackingNumber) {
|
|
340
|
+
return this.http.get(this.wsPath(`shipping/track/${trackingNumber}`));
|
|
341
|
+
}
|
|
342
|
+
// -----------------------------------------------------------------------
|
|
343
|
+
// Address Validation
|
|
344
|
+
// -----------------------------------------------------------------------
|
|
345
|
+
/** Validate and correct a shipping address. */
|
|
346
|
+
async validateAddress(address) {
|
|
347
|
+
return this.http.post(this.wsPath("shipping/addresses/validate"), address);
|
|
348
|
+
}
|
|
349
|
+
// -----------------------------------------------------------------------
|
|
350
|
+
// Batch Labels
|
|
351
|
+
// -----------------------------------------------------------------------
|
|
352
|
+
/** Create labels in batch. */
|
|
353
|
+
async createBatch(request) {
|
|
354
|
+
return this.http.post(this.wsPath("labels/batch"), request);
|
|
355
|
+
}
|
|
356
|
+
/** Preview a batch without purchasing (dry-run). */
|
|
357
|
+
async previewBatch(request) {
|
|
358
|
+
return this.http.post(this.wsPath("labels/batch/preview"), request);
|
|
359
|
+
}
|
|
360
|
+
/** Get batch job status. */
|
|
361
|
+
async getBatchStatus(jobId) {
|
|
362
|
+
return this.http.get(this.wsPath(`labels/batch/${jobId}`));
|
|
363
|
+
}
|
|
364
|
+
/** Download a label from a batch job. */
|
|
365
|
+
async downloadBatchLabel(jobId, itemId) {
|
|
366
|
+
return this.http.get(this.wsPath(`labels/batch/${jobId}/items/${itemId}/label`));
|
|
367
|
+
}
|
|
368
|
+
// -----------------------------------------------------------------------
|
|
369
|
+
// Carriers
|
|
370
|
+
// -----------------------------------------------------------------------
|
|
371
|
+
/** List available carriers and their services. */
|
|
372
|
+
async getCarriers() {
|
|
373
|
+
return this.http.get(this.wsPath("shipping/carriers"));
|
|
374
|
+
}
|
|
375
|
+
// -----------------------------------------------------------------------
|
|
376
|
+
// AI Shipping — requires Professional plan or higher
|
|
377
|
+
// -----------------------------------------------------------------------
|
|
378
|
+
/** Get AI-ranked carrier recommendations for a lane, scored by cost, speed, and reliability. */
|
|
379
|
+
async getRecommendations(request) {
|
|
380
|
+
return this.http.post(this.wsPath("shipping/recommendations"), request);
|
|
381
|
+
}
|
|
382
|
+
/** Predict delivery dates (P25/P50/P75/P95) for a carrier/service/lane combination. */
|
|
383
|
+
async predictDelivery(request) {
|
|
384
|
+
return this.http.post(this.wsPath("shipping/predictions/delivery"), request);
|
|
385
|
+
}
|
|
386
|
+
/** Get cost-saving opportunities: lanes where switching carriers saves money without sacrificing reliability. */
|
|
387
|
+
async getSavings() {
|
|
388
|
+
return this.http.get(this.wsPath("shipping/savings"));
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
// src/resources/carriers.ts
|
|
393
|
+
var CarriersResource = class {
|
|
394
|
+
constructor(http) {
|
|
395
|
+
this.http = http;
|
|
396
|
+
}
|
|
397
|
+
proxy(path) {
|
|
398
|
+
return `/api/ApiProxy/${path.replace(/^\//, "")}`;
|
|
399
|
+
}
|
|
400
|
+
// -----------------------------------------------------------------------
|
|
401
|
+
// USPS (V3 endpoints)
|
|
402
|
+
// -----------------------------------------------------------------------
|
|
403
|
+
usps = {
|
|
404
|
+
/** Validate and correct a US address via USPS. */
|
|
405
|
+
validateAddress: (params) => this.http.get(this.proxy("api/v3/AddressValidation/getUspsValidateAndCorrectAddress"), params),
|
|
406
|
+
/** City/State lookup by ZIP code. */
|
|
407
|
+
cityStateLookup: (zipCode) => this.http.get(this.proxy("api/v3/AddressValidation/getUspsCityStateLookupByZipCode"), { zipCode }),
|
|
408
|
+
/** ZIP code lookup by address. */
|
|
409
|
+
zipCodeLookup: (params) => this.http.get(this.proxy("api/v3/AddressValidation/getUspsZipCodeLookupByAddress"), params),
|
|
410
|
+
/** Search domestic shipping rates. */
|
|
411
|
+
getDomesticRates: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postUspsSearchDomesticBaseRates"), body),
|
|
412
|
+
/** Search domestic product eligibility. */
|
|
413
|
+
getDomesticProducts: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postUspsSearchEligibleDomesticProducts"), body),
|
|
414
|
+
/** Search domestic prices. */
|
|
415
|
+
getDomesticPrices: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postUspsSearchEligibleDomesticPrices"), body),
|
|
416
|
+
/** Search international rates. */
|
|
417
|
+
getInternationalRates: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postUspsSearchInternationalBaseRates"), body),
|
|
418
|
+
/** Search international prices. */
|
|
419
|
+
getInternationalPrices: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postUspsSearchEligibleInternationalPrices"), body),
|
|
420
|
+
/** Generate a domestic shipping label. */
|
|
421
|
+
createDomesticLabel: (body) => this.http.post(this.proxy("api/v3/Shipping/postUspsGenerateDomesticShippingLabel"), body),
|
|
422
|
+
/** Generate a domestic return label. */
|
|
423
|
+
createReturnLabel: (body) => this.http.post(this.proxy("api/v3/Shipping/postUspsGenerateDomesticReturnsShippingLabel"), body),
|
|
424
|
+
/** Generate an international shipping label. */
|
|
425
|
+
createInternationalLabel: (body) => this.http.post(this.proxy("api/v3/Shipping/postUspsGenerateInternationalShippingLabel"), body),
|
|
426
|
+
/** Cancel a domestic label. */
|
|
427
|
+
cancelDomesticLabel: () => this.http.delete(this.proxy("api/v3/Shipping/cancelUspsDomesticShipmentLabel")),
|
|
428
|
+
/** Cancel an international label. */
|
|
429
|
+
cancelInternationalLabel: () => this.http.delete(this.proxy("api/v3/Shipping/cancelUspsInternationalShipmentLabel")),
|
|
430
|
+
/** Get tracking summary. */
|
|
431
|
+
trackSummary: (params) => this.http.get(this.proxy("api/v3/Tracking/getUspsTrackingSummaryInformation"), params),
|
|
432
|
+
/** Get detailed tracking info. */
|
|
433
|
+
trackDetail: (params) => this.http.get(this.proxy("api/v3/Tracking/getUspsTrackingDetailInformation"), params),
|
|
434
|
+
/** Schedule a carrier pickup. */
|
|
435
|
+
createPickup: (body) => this.http.post(this.proxy("api/v3/CarrierPickup/postUspsCreateCarrierPickupSchedule"), body),
|
|
436
|
+
/** Cancel a pickup. */
|
|
437
|
+
cancelPickup: () => this.http.delete(this.proxy("api/v3/CarrierPickup/cancelUspsCarrierPickupSchedule")),
|
|
438
|
+
/** Create a scan form. */
|
|
439
|
+
createScanForm: (body) => this.http.post(this.proxy("api/v3/ScanForm/postUspsCreateScanFormLabelShipment"), body),
|
|
440
|
+
/** Get delivery standards estimates. */
|
|
441
|
+
deliveryStandards: (params) => this.http.get(this.proxy("api/v3/ServiceStandards/getUspsGetDeliveryStandardsEstimates"), params),
|
|
442
|
+
/** Find drop-off locations. */
|
|
443
|
+
findDropOffLocations: (params) => this.http.get(this.proxy("api/v3/LocationSearch/getUspsFindValidDropOffLocations"), params),
|
|
444
|
+
/** Find post office locations. */
|
|
445
|
+
findPostOffices: (params) => this.http.get(this.proxy("api/v3/LocationSearch/getUspsFindValidPostOfficeLocations"), params)
|
|
446
|
+
};
|
|
447
|
+
// -----------------------------------------------------------------------
|
|
448
|
+
// UPS (V2 endpoints)
|
|
449
|
+
// -----------------------------------------------------------------------
|
|
450
|
+
ups = {
|
|
451
|
+
/** Verify an address via UPS. */
|
|
452
|
+
validateAddress: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsVerifyAddress"), body),
|
|
453
|
+
/** Get UPS rate quotes. */
|
|
454
|
+
getRates: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsRateCheck"), body),
|
|
455
|
+
/** Generate a UPS shipping label. */
|
|
456
|
+
createLabel: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/generateNewUpsShipLabel"), body),
|
|
457
|
+
/** Track a UPS shipment. */
|
|
458
|
+
track: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getSingleUpsTrackingDetail"), params),
|
|
459
|
+
/** Create a UPS pickup. */
|
|
460
|
+
createPickup: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsCreatePickup"), body),
|
|
461
|
+
/** Cancel a UPS pickup. */
|
|
462
|
+
cancelPickup: () => this.http.delete(this.proxy("api/v2/ShippingLabel/deleteUpsPickup")),
|
|
463
|
+
/** Get UPS transit times. */
|
|
464
|
+
getTransitTimes: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsGetTransitTimes"), body),
|
|
465
|
+
/** Get UPS landed cost quote (international). */
|
|
466
|
+
getLandedCost: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsGetLandedCostQuote"), body),
|
|
467
|
+
/** Search UPS locations. */
|
|
468
|
+
searchLocations: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsSearchLocations"), body),
|
|
469
|
+
/** Upload paperless trade document. */
|
|
470
|
+
uploadDocument: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsUploadPaperlessDocument"), body),
|
|
471
|
+
/** Create UPS freight shipment. */
|
|
472
|
+
createFreightShipment: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsCreateFreightShipment"), body),
|
|
473
|
+
/** Get UPS freight rate. */
|
|
474
|
+
getFreightRate: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postUpsGetFreightRate"), body)
|
|
475
|
+
};
|
|
476
|
+
// -----------------------------------------------------------------------
|
|
477
|
+
// FedEx (V3 endpoints)
|
|
478
|
+
// -----------------------------------------------------------------------
|
|
479
|
+
fedex = {
|
|
480
|
+
/** Validate a domestic address via FedEx. */
|
|
481
|
+
validateAddress: (body) => this.http.post(this.proxy("api/v3/AddressValidation/postFedExValidateAndCorrectDomesticAddress"), body),
|
|
482
|
+
/** Validate a postal code. */
|
|
483
|
+
validatePostalCode: (body) => this.http.post(this.proxy("api/v3/AddressValidation/postFedExValidatePostalCode"), body),
|
|
484
|
+
/** Get FedEx rate and transit times. */
|
|
485
|
+
getRates: (body) => this.http.post(this.proxy("api/v3/RateCalculator/postRetrieveFedExRateAndTransitTimesAsync"), body),
|
|
486
|
+
/** Create a FedEx shipment. */
|
|
487
|
+
createShipment: (body) => this.http.post(this.proxy("api/v3/Shipping/postFedExCreateNewShipment"), body),
|
|
488
|
+
/** Cancel a FedEx shipment. */
|
|
489
|
+
cancelShipment: (body) => this.http.put(this.proxy("api/v3/Shipping/putFedExCancelShipment"), body),
|
|
490
|
+
/** Validate a shipment (dry run). */
|
|
491
|
+
validateShipment: (body) => this.http.post(this.proxy("api/v3/Shipping/postFedExValidateShipment"), body),
|
|
492
|
+
/** Create a return shipment. */
|
|
493
|
+
createReturnShipment: (body) => this.http.post(this.proxy("api/v3/Shipping/postFedExCreateNewReturnShipment"), body),
|
|
494
|
+
/** Track by tracking number. */
|
|
495
|
+
track: (body) => this.http.post(this.proxy("api/v3/Tracking/postFedExRetrieveTrackingInfoByTrackingNumber"), body),
|
|
496
|
+
/** Track multi-piece shipment. */
|
|
497
|
+
trackMultiPiece: (body) => this.http.post(this.proxy("api/v3/Tracking/postFedExRetrieveTrackingInfoForMultiPieceShipment"), body),
|
|
498
|
+
/** Register for tracking notifications. */
|
|
499
|
+
registerTrackingNotification: (body) => this.http.post(this.proxy("api/v3/Tracking/postFedExRegisterForTrackingNotification"), body),
|
|
500
|
+
/** Create a carrier pickup. */
|
|
501
|
+
createPickup: (body) => this.http.post(this.proxy("api/v3/CarrierPickup/postFedExCreateCarrierPickupRequest"), body),
|
|
502
|
+
/** Cancel a pickup. */
|
|
503
|
+
cancelPickup: (body) => this.http.put(this.proxy("api/v3/CarrierPickup/putFedExCancelCarrierPickupRequest"), body),
|
|
504
|
+
/** Search valid locations. */
|
|
505
|
+
searchLocations: (body) => this.http.post(this.proxy("api/v3/LocationSearch/postFedExSearchValidLocations"), body),
|
|
506
|
+
/** Get service standards and transit times. */
|
|
507
|
+
getServiceStandards: (body) => this.http.post(this.proxy("api/v3/ServiceStandards/postFedExRetrieveServicesAndTransitTimes"), body),
|
|
508
|
+
/** Get freight rate quote. */
|
|
509
|
+
getFreightRate: (body) => this.http.post(this.proxy("api/v3/Freight/postFedExGetFreightRateQuote"), body),
|
|
510
|
+
/** Create freight shipment. */
|
|
511
|
+
createFreightShipment: (body) => this.http.post(this.proxy("api/v3/Freight/postFedExCreateFreightShipment"), body),
|
|
512
|
+
/** Ground close with documents. */
|
|
513
|
+
groundClose: (body) => this.http.post(this.proxy("api/v3/GroundClose/postFedExCloseWithDocuments"), body),
|
|
514
|
+
/** Upload trade documents. */
|
|
515
|
+
uploadTradeDocuments: (body) => this.http.post(this.proxy("api/v3/Trade/postFedExUploadTradeDocuments"), body),
|
|
516
|
+
// --- Open Ship (multi-package) ---
|
|
517
|
+
/** Create an open shipment. */
|
|
518
|
+
createOpenShipment: (body) => this.http.post(this.proxy("api/v3/OpenShip/postFedExCreateOpenShipment"), body),
|
|
519
|
+
/** Add packages to an open shipment. */
|
|
520
|
+
addPackagesToOpenShipment: (body) => this.http.post(this.proxy("api/v3/OpenShip/postFedExAddPackagesToOpenShipment"), body),
|
|
521
|
+
/** Confirm and finalize an open shipment. */
|
|
522
|
+
confirmOpenShipment: (body) => this.http.post(this.proxy("api/v3/OpenShip/postFedExConfirmOpenShipment"), body)
|
|
523
|
+
};
|
|
524
|
+
// -----------------------------------------------------------------------
|
|
525
|
+
// DHL (V2 endpoints)
|
|
526
|
+
// -----------------------------------------------------------------------
|
|
527
|
+
dhl = {
|
|
528
|
+
/** Validate an address via DHL. */
|
|
529
|
+
validateAddress: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlValidateAddress"), params),
|
|
530
|
+
/** Get DHL shipping rates. */
|
|
531
|
+
getRates: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlRates"), params),
|
|
532
|
+
/** Get multi-piece rates. */
|
|
533
|
+
getMultiPieceRates: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlMultiPieceRates"), body),
|
|
534
|
+
/** Get DHL products/services. */
|
|
535
|
+
getProducts: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlProducts"), params),
|
|
536
|
+
/** Create a DHL shipment (label). */
|
|
537
|
+
createShipment: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlCreateShipment"), body),
|
|
538
|
+
/** Track a DHL shipment. */
|
|
539
|
+
track: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlTrackSingleShipment"), params),
|
|
540
|
+
/** Track multiple DHL shipments. */
|
|
541
|
+
trackMultiple: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlTrackMultipleShipments"), params),
|
|
542
|
+
/** Create a DHL pickup. */
|
|
543
|
+
createPickup: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlCreatePickup"), body),
|
|
544
|
+
/** Update a DHL pickup. */
|
|
545
|
+
updatePickup: (body) => this.http.patch(this.proxy("api/v2/ShippingLabel/patchDhlUpdatePickup"), body),
|
|
546
|
+
/** Cancel a DHL pickup. */
|
|
547
|
+
cancelPickup: () => this.http.delete(this.proxy("api/v2/ShippingLabel/deleteDhlPickup")),
|
|
548
|
+
/** Calculate landed cost (duties/taxes). */
|
|
549
|
+
calculateLandedCost: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlCalculateLandedCost"), body),
|
|
550
|
+
/** Screen a shipment for compliance. */
|
|
551
|
+
screenShipment: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlScreenShipment"), body),
|
|
552
|
+
/** Upload an invoice. */
|
|
553
|
+
uploadInvoice: (body) => this.http.post(this.proxy("api/v2/ShippingLabel/postDhlUploadInvoice"), body),
|
|
554
|
+
/** Get electronic proof of delivery. */
|
|
555
|
+
getProofOfDelivery: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlElectronicProofOfDelivery"), params),
|
|
556
|
+
/** Get reference data (countries, services, etc.). */
|
|
557
|
+
getReferenceData: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlReferenceData"), params),
|
|
558
|
+
/** Find DHL service points. */
|
|
559
|
+
findServicePoints: (params) => this.http.get(this.proxy("api/v2/ShippingLabel/getDhlServicePoints"), params)
|
|
560
|
+
};
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// src/resources/webhooks.ts
|
|
564
|
+
var WebhooksResource = class {
|
|
565
|
+
constructor(http, getWorkspaceId) {
|
|
566
|
+
this.http = http;
|
|
567
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
568
|
+
}
|
|
569
|
+
wsPath(suffix) {
|
|
570
|
+
const id = this.getWorkspaceId();
|
|
571
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
572
|
+
return `/api/workspaces/${id}/webhooks${suffix ? `/${suffix}` : ""}`;
|
|
573
|
+
}
|
|
574
|
+
/** List all webhook subscriptions for the workspace. */
|
|
575
|
+
async list() {
|
|
576
|
+
return this.http.get(this.wsPath(""));
|
|
577
|
+
}
|
|
578
|
+
/** Get a webhook subscription by ID. */
|
|
579
|
+
async get(webhookId) {
|
|
580
|
+
return this.http.get(this.wsPath(webhookId));
|
|
581
|
+
}
|
|
582
|
+
/** Create a webhook subscription. */
|
|
583
|
+
async create(request) {
|
|
584
|
+
return this.http.post(this.wsPath(""), request);
|
|
585
|
+
}
|
|
586
|
+
/** Update a webhook subscription. */
|
|
587
|
+
async update(webhookId, data) {
|
|
588
|
+
return this.http.put(this.wsPath(webhookId), data);
|
|
589
|
+
}
|
|
590
|
+
/** Delete a webhook subscription. */
|
|
591
|
+
async delete(webhookId) {
|
|
592
|
+
return this.http.delete(this.wsPath(webhookId));
|
|
593
|
+
}
|
|
594
|
+
/** Rotate the signing secret for a webhook. */
|
|
595
|
+
async rotateSecret(webhookId) {
|
|
596
|
+
return this.http.post(this.wsPath(`${webhookId}/rotate-secret`));
|
|
597
|
+
}
|
|
598
|
+
/** List delivery logs for a webhook. */
|
|
599
|
+
async listDeliveryLogs(webhookId) {
|
|
600
|
+
return this.http.get(this.wsPath(`${webhookId}/deliveries`));
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Verify a webhook signature from an incoming request.
|
|
604
|
+
* Use this in your webhook handler to validate authenticity.
|
|
605
|
+
*/
|
|
606
|
+
static verifySignature(payload, signature, secret) {
|
|
607
|
+
try {
|
|
608
|
+
const crypto = __require("crypto");
|
|
609
|
+
const expected = crypto.createHmac("sha256", secret).update(payload, "utf-8").digest("hex");
|
|
610
|
+
return crypto.timingSafeEqual(
|
|
611
|
+
Buffer.from(signature, "hex"),
|
|
612
|
+
Buffer.from(expected, "hex")
|
|
613
|
+
);
|
|
614
|
+
} catch {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// src/resources/wallet.ts
|
|
621
|
+
var WalletResource = class {
|
|
622
|
+
constructor(http, getWorkspaceId) {
|
|
623
|
+
this.http = http;
|
|
624
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
625
|
+
}
|
|
626
|
+
wsPath(suffix) {
|
|
627
|
+
const id = this.getWorkspaceId();
|
|
628
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
629
|
+
return `/api/workspaces/${id}/wallet/${suffix}`;
|
|
630
|
+
}
|
|
631
|
+
/** Get the current wallet balance. */
|
|
632
|
+
async getBalance() {
|
|
633
|
+
return this.http.get(this.wsPath("balance"));
|
|
634
|
+
}
|
|
635
|
+
/** Add funds to the wallet. */
|
|
636
|
+
async addFunds(amount) {
|
|
637
|
+
return this.http.post(this.wsPath("add-funds"), { amount });
|
|
638
|
+
}
|
|
639
|
+
/** List wallet transactions. */
|
|
640
|
+
async listTransactions(query) {
|
|
641
|
+
return this.http.get(
|
|
642
|
+
this.wsPath("transactions"),
|
|
643
|
+
query
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
/** Configure auto-reload settings. */
|
|
647
|
+
async configureAutoReload(config) {
|
|
648
|
+
return this.http.put(this.wsPath("auto-reload"), config);
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
// src/resources/insurance.ts
|
|
653
|
+
var InsuranceResource = class {
|
|
654
|
+
constructor(http, getWorkspaceId) {
|
|
655
|
+
this.http = http;
|
|
656
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
657
|
+
}
|
|
658
|
+
wsPath(suffix) {
|
|
659
|
+
const id = this.getWorkspaceId();
|
|
660
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
661
|
+
return `/api/workspaces/${id}/insurance/${suffix}`;
|
|
662
|
+
}
|
|
663
|
+
/** Get available insurance providers for this workspace. */
|
|
664
|
+
async getProviders() {
|
|
665
|
+
return this.http.get(this.wsPath("providers"));
|
|
666
|
+
}
|
|
667
|
+
/** Get an insurance quote. */
|
|
668
|
+
async getQuote(request) {
|
|
669
|
+
return this.http.post(this.wsPath("quote"), request);
|
|
670
|
+
}
|
|
671
|
+
/** Purchase insurance for a shipment. */
|
|
672
|
+
async purchase(request) {
|
|
673
|
+
return this.http.post(this.wsPath("purchase"), request);
|
|
674
|
+
}
|
|
675
|
+
/** Void an insurance policy. */
|
|
676
|
+
async void(policyId) {
|
|
677
|
+
return this.http.delete(this.wsPath(`policies/${policyId}`));
|
|
678
|
+
}
|
|
679
|
+
/** File an insurance claim. */
|
|
680
|
+
async fileClaim(policyId, claim) {
|
|
681
|
+
return this.http.post(this.wsPath(`policies/${policyId}/claims`), claim);
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// src/resources/returns.ts
|
|
686
|
+
var ReturnsResource = class {
|
|
687
|
+
constructor(http, getWorkspaceId) {
|
|
688
|
+
this.http = http;
|
|
689
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
690
|
+
}
|
|
691
|
+
wsPath(suffix) {
|
|
692
|
+
const id = this.getWorkspaceId();
|
|
693
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
694
|
+
return `/api/workspaces/${id}/returns/${suffix}`;
|
|
695
|
+
}
|
|
696
|
+
/** List all return authorizations. */
|
|
697
|
+
async list(query) {
|
|
698
|
+
return this.http.get(
|
|
699
|
+
this.wsPath(""),
|
|
700
|
+
query
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
/** Get a return authorization by ID. */
|
|
704
|
+
async get(returnId) {
|
|
705
|
+
return this.http.get(this.wsPath(returnId));
|
|
706
|
+
}
|
|
707
|
+
/** Create a return authorization (RMA). */
|
|
708
|
+
async create(request) {
|
|
709
|
+
return this.http.post(this.wsPath(""), request);
|
|
710
|
+
}
|
|
711
|
+
/** Approve a return authorization. */
|
|
712
|
+
async approve(returnId) {
|
|
713
|
+
return this.http.post(this.wsPath(`${returnId}/approve`));
|
|
714
|
+
}
|
|
715
|
+
/** Reject a return authorization. */
|
|
716
|
+
async reject(returnId, reason) {
|
|
717
|
+
return this.http.post(this.wsPath(`${returnId}/reject`), { reason });
|
|
718
|
+
}
|
|
719
|
+
/** Cancel a return authorization. */
|
|
720
|
+
async cancel(returnId) {
|
|
721
|
+
return this.http.post(this.wsPath(`${returnId}/cancel`));
|
|
722
|
+
}
|
|
723
|
+
/** Generate a return label for an approved RMA. */
|
|
724
|
+
async generateLabel(returnId) {
|
|
725
|
+
return this.http.post(this.wsPath(`${returnId}/label`));
|
|
726
|
+
}
|
|
727
|
+
/** Mark items as received. */
|
|
728
|
+
async markReceived(returnId, items) {
|
|
729
|
+
return this.http.post(this.wsPath(`${returnId}/receive`), { items });
|
|
730
|
+
}
|
|
731
|
+
/** Process refund for a return. */
|
|
732
|
+
async processRefund(returnId) {
|
|
733
|
+
return this.http.post(this.wsPath(`${returnId}/refund`));
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// src/resources/api-keys.ts
|
|
738
|
+
var ApiKeysResource = class {
|
|
739
|
+
constructor(http, getWorkspaceId) {
|
|
740
|
+
this.http = http;
|
|
741
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
742
|
+
}
|
|
743
|
+
wsPath(suffix) {
|
|
744
|
+
const id = this.getWorkspaceId();
|
|
745
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
746
|
+
return `/api/workspaces/${id}/api-keys${suffix ? `/${suffix}` : ""}`;
|
|
747
|
+
}
|
|
748
|
+
/** List all API keys for the workspace. */
|
|
749
|
+
async list() {
|
|
750
|
+
return this.http.get(this.wsPath(""));
|
|
751
|
+
}
|
|
752
|
+
/** Create a new API key. The full key is only returned once. */
|
|
753
|
+
async create(request) {
|
|
754
|
+
return this.http.post(this.wsPath(""), request);
|
|
755
|
+
}
|
|
756
|
+
/** Revoke an API key. */
|
|
757
|
+
async revoke(keyId) {
|
|
758
|
+
return this.http.delete(this.wsPath(keyId));
|
|
759
|
+
}
|
|
760
|
+
/** Rotate an API key (revoke + create new). */
|
|
761
|
+
async rotate(keyId) {
|
|
762
|
+
return this.http.post(this.wsPath(`${keyId}/rotate`));
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// src/resources/analytics.ts
|
|
767
|
+
var AnalyticsResource = class {
|
|
768
|
+
constructor(http) {
|
|
769
|
+
this.http = http;
|
|
770
|
+
}
|
|
771
|
+
path(endpoint) {
|
|
772
|
+
return `/api/ApiProxy/api/v4/Analytics/${endpoint}`;
|
|
773
|
+
}
|
|
774
|
+
/** Shipments trend over time. */
|
|
775
|
+
async shipmentsTrend(params) {
|
|
776
|
+
return this.http.get(this.path("ShipmentsTrend"), params);
|
|
777
|
+
}
|
|
778
|
+
/** Carrier usage summary. */
|
|
779
|
+
async carrierSummary(params) {
|
|
780
|
+
return this.http.get(this.path("CarrierSummary"), params);
|
|
781
|
+
}
|
|
782
|
+
/** Top shipping destinations. */
|
|
783
|
+
async topDestinations(params) {
|
|
784
|
+
return this.http.get(this.path("TopDestinations"), params);
|
|
785
|
+
}
|
|
786
|
+
/** Inventory metrics (stock levels, low-stock alerts). */
|
|
787
|
+
async inventoryMetrics() {
|
|
788
|
+
return this.http.get(this.path("InventoryMetrics"));
|
|
789
|
+
}
|
|
790
|
+
/** Stock levels by warehouse. */
|
|
791
|
+
async stockByWarehouse() {
|
|
792
|
+
return this.http.get(this.path("StockByWarehouse"));
|
|
793
|
+
}
|
|
794
|
+
/** Order metrics (volume, revenue). */
|
|
795
|
+
async orderMetrics(params) {
|
|
796
|
+
return this.http.get(this.path("OrderMetrics"), params);
|
|
797
|
+
}
|
|
798
|
+
/** Order trend over time. */
|
|
799
|
+
async orderTrend(params) {
|
|
800
|
+
return this.http.get(this.path("OrderTrend"), params);
|
|
801
|
+
}
|
|
802
|
+
/** Top selling products. */
|
|
803
|
+
async topSellingProducts(params) {
|
|
804
|
+
return this.http.get(this.path("TopSellingProducts"), params);
|
|
805
|
+
}
|
|
806
|
+
/** Returns metrics. */
|
|
807
|
+
async returnsMetrics(params) {
|
|
808
|
+
return this.http.get(this.path("ReturnsMetrics"), params);
|
|
809
|
+
}
|
|
810
|
+
/** Returns trend over time. */
|
|
811
|
+
async returnsTrend(params) {
|
|
812
|
+
return this.http.get(this.path("ReturnsTrend"), params);
|
|
813
|
+
}
|
|
814
|
+
/** Return reasons breakdown. */
|
|
815
|
+
async returnReasons(params) {
|
|
816
|
+
return this.http.get(this.path("ReturnReasons"), params);
|
|
817
|
+
}
|
|
818
|
+
/** Fulfillment performance metrics. */
|
|
819
|
+
async performanceMetrics(params) {
|
|
820
|
+
return this.http.get(this.path("PerformanceMetrics"), params);
|
|
821
|
+
}
|
|
822
|
+
/** Carrier delivery performance. */
|
|
823
|
+
async carrierPerformance(params) {
|
|
824
|
+
return this.http.get(this.path("CarrierPerformance"), params);
|
|
825
|
+
}
|
|
826
|
+
/** Shipping cost analytics. */
|
|
827
|
+
async shippingCostAnalytics(params) {
|
|
828
|
+
return this.http.get(this.path("ShippingCostAnalytics"), params);
|
|
829
|
+
}
|
|
830
|
+
/** Delivery performance (on-time %). */
|
|
831
|
+
async deliveryPerformance(params) {
|
|
832
|
+
return this.http.get(this.path("DeliveryPerformance"), params);
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
// src/resources/orders.ts
|
|
837
|
+
var OrdersResource = class {
|
|
838
|
+
constructor(http) {
|
|
839
|
+
this.http = http;
|
|
840
|
+
}
|
|
841
|
+
path(endpoint) {
|
|
842
|
+
return `/api/ApiProxy/api/v1/Order/${endpoint}`;
|
|
843
|
+
}
|
|
844
|
+
/** Create a new order. */
|
|
845
|
+
async create(order) {
|
|
846
|
+
return this.http.post(this.path("postNewOrder"), order);
|
|
847
|
+
}
|
|
848
|
+
/** Get new orders awaiting processing. */
|
|
849
|
+
async getNewOrders(params) {
|
|
850
|
+
return this.http.get(this.path("getNewOrderList"), params);
|
|
851
|
+
}
|
|
852
|
+
/** Get all orders filtered by status. */
|
|
853
|
+
async getByStatus(params) {
|
|
854
|
+
return this.http.get(this.path("getAllOrderListByStatus"), params);
|
|
855
|
+
}
|
|
856
|
+
/** Get complete order details by order number. */
|
|
857
|
+
async getDetails(orderNumber) {
|
|
858
|
+
return this.http.get(this.path("getCompleteOrderDetailsByOrderNumber"), { orderNumber });
|
|
859
|
+
}
|
|
860
|
+
/** Get extended order details by order number. */
|
|
861
|
+
async getExtendedDetails(orderNumber) {
|
|
862
|
+
return this.http.get(this.path("getExtendedOrderDetailsByOrderNumber"), { orderNumber });
|
|
863
|
+
}
|
|
864
|
+
/** Get order status by order number. */
|
|
865
|
+
async getStatus(orderNumber) {
|
|
866
|
+
return this.http.get(this.path("getIndividualOrderStatusByOrderNumber"), { orderNumber });
|
|
867
|
+
}
|
|
868
|
+
/** Cancel an order. */
|
|
869
|
+
async cancel(orderNumber) {
|
|
870
|
+
return this.http.post(this.path("cancelOrderByOrderNumber"), { orderNumber });
|
|
871
|
+
}
|
|
872
|
+
/** Get all items for an order. */
|
|
873
|
+
async getItems(orderNumber) {
|
|
874
|
+
return this.http.get(this.path("getAllOrderItemsByOrderNumber"), { orderNumber });
|
|
875
|
+
}
|
|
876
|
+
/** Get available ship methods. */
|
|
877
|
+
async getShipMethods() {
|
|
878
|
+
return this.http.get(this.path("getAvailableShipMethodsList"));
|
|
879
|
+
}
|
|
880
|
+
/** Get active warehouse list. */
|
|
881
|
+
async getWarehouses() {
|
|
882
|
+
return this.http.get(this.path("getActiveWarehouseList"));
|
|
883
|
+
}
|
|
884
|
+
/** Get country codes. */
|
|
885
|
+
async getCountryCodes() {
|
|
886
|
+
return this.http.get(this.path("getCountryNameCodeList"));
|
|
887
|
+
}
|
|
888
|
+
/** Get order status types. */
|
|
889
|
+
async getStatusTypes() {
|
|
890
|
+
return this.http.get(this.path("getOrderStatusTypesList"));
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
// src/resources/inventory.ts
|
|
895
|
+
var InventoryResource = class {
|
|
896
|
+
constructor(http) {
|
|
897
|
+
this.http = http;
|
|
898
|
+
}
|
|
899
|
+
/** Post a new ASN (Advance Shipment Notice) receipt. */
|
|
900
|
+
async postAsnReceipt(receipt) {
|
|
901
|
+
return this.http.post("/api/ApiProxy/api/v1/Inventory/postNewAsnReceipt", receipt);
|
|
902
|
+
}
|
|
903
|
+
/** Get a warehouse inventory snapshot. */
|
|
904
|
+
async getWarehouseSnapshot(params) {
|
|
905
|
+
return this.http.get("/api/ApiProxy/api/v1/Inventory/getWarehouseInventorySnapshot", params);
|
|
906
|
+
}
|
|
907
|
+
/** Get a complete inventory snapshot across all warehouses. */
|
|
908
|
+
async getCompleteSnapshot(params) {
|
|
909
|
+
return this.http.get("/api/ApiProxy/api/v1/Inventory/getCompleteInventorySnapshot", params);
|
|
910
|
+
}
|
|
911
|
+
/** Get the list of all part numbers. */
|
|
912
|
+
async getPartNumbers(params) {
|
|
913
|
+
return this.http.get("/api/ApiProxy/api/v1/Inventory/getPartNumberList", params);
|
|
914
|
+
}
|
|
915
|
+
/** Update customer inventory (V2). */
|
|
916
|
+
async updateInventory(data) {
|
|
917
|
+
return this.http.post("/api/ApiProxy/api/v2/Inventory/postCustomerInventoryUpdate", data);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// src/resources/pickups.ts
|
|
922
|
+
var PickupsResource = class {
|
|
923
|
+
constructor(http, getWorkspaceId) {
|
|
924
|
+
this.http = http;
|
|
925
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
926
|
+
}
|
|
927
|
+
wsPath(suffix) {
|
|
928
|
+
const id = this.getWorkspaceId();
|
|
929
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
930
|
+
return `/api/workspaces/${id}/pickups${suffix ? `/${suffix}` : ""}`;
|
|
931
|
+
}
|
|
932
|
+
/** Schedule a carrier pickup. */
|
|
933
|
+
async schedule(request) {
|
|
934
|
+
return this.http.post(this.wsPath(""), request);
|
|
935
|
+
}
|
|
936
|
+
/** List scheduled pickups. */
|
|
937
|
+
async list() {
|
|
938
|
+
return this.http.get(this.wsPath(""));
|
|
939
|
+
}
|
|
940
|
+
/** Get pickup details. */
|
|
941
|
+
async get(pickupId) {
|
|
942
|
+
return this.http.get(this.wsPath(pickupId));
|
|
943
|
+
}
|
|
944
|
+
/** Cancel a scheduled pickup. */
|
|
945
|
+
async cancel(pickupId) {
|
|
946
|
+
return this.http.delete(this.wsPath(pickupId));
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
// src/resources/scan-forms.ts
|
|
951
|
+
var ScanFormsResource = class {
|
|
952
|
+
constructor(http, getWorkspaceId) {
|
|
953
|
+
this.http = http;
|
|
954
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
955
|
+
}
|
|
956
|
+
wsPath(suffix) {
|
|
957
|
+
const id = this.getWorkspaceId();
|
|
958
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
959
|
+
return `/api/workspaces/${id}/scan-forms${suffix ? `/${suffix}` : ""}`;
|
|
960
|
+
}
|
|
961
|
+
/** Create a USPS scan form (SCAN/manifest). */
|
|
962
|
+
async create(request) {
|
|
963
|
+
return this.http.post(this.wsPath(""), request);
|
|
964
|
+
}
|
|
965
|
+
/** List scan forms. */
|
|
966
|
+
async list() {
|
|
967
|
+
return this.http.get(this.wsPath(""));
|
|
968
|
+
}
|
|
969
|
+
/** Get a scan form by ID. */
|
|
970
|
+
async get(scanFormId) {
|
|
971
|
+
return this.http.get(this.wsPath(scanFormId));
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
// src/resources/rules.ts
|
|
976
|
+
var RulesResource = class {
|
|
977
|
+
constructor(http, getWorkspaceId) {
|
|
978
|
+
this.http = http;
|
|
979
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
980
|
+
}
|
|
981
|
+
wsPath(suffix) {
|
|
982
|
+
const id = this.getWorkspaceId();
|
|
983
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
984
|
+
return `/api/workspaces/${id}/shipping-rules${suffix ? `/${suffix}` : ""}`;
|
|
985
|
+
}
|
|
986
|
+
/** List all shipping automation rules. Max 100 per workspace. */
|
|
987
|
+
async list() {
|
|
988
|
+
return this.http.get(this.wsPath(""));
|
|
989
|
+
}
|
|
990
|
+
/** Get a rule by ID. */
|
|
991
|
+
async get(ruleId) {
|
|
992
|
+
return this.http.get(this.wsPath(ruleId));
|
|
993
|
+
}
|
|
994
|
+
/** Create a shipping rule. */
|
|
995
|
+
async create(rule) {
|
|
996
|
+
return this.http.post(this.wsPath(""), rule);
|
|
997
|
+
}
|
|
998
|
+
/** Update a shipping rule. */
|
|
999
|
+
async update(ruleId, rule) {
|
|
1000
|
+
return this.http.put(this.wsPath(ruleId), rule);
|
|
1001
|
+
}
|
|
1002
|
+
/** Delete a shipping rule. */
|
|
1003
|
+
async delete(ruleId) {
|
|
1004
|
+
return this.http.delete(this.wsPath(ruleId));
|
|
1005
|
+
}
|
|
1006
|
+
/** Reorder rules (set priority). */
|
|
1007
|
+
async reorder(ruleIds) {
|
|
1008
|
+
return this.http.put(this.wsPath("reorder"), { ruleIds });
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
// src/resources/offsets.ts
|
|
1013
|
+
var OffsetResource = class {
|
|
1014
|
+
constructor(http, getWorkspaceId) {
|
|
1015
|
+
this.http = http;
|
|
1016
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
1017
|
+
}
|
|
1018
|
+
wsPath(suffix) {
|
|
1019
|
+
const id = this.getWorkspaceId();
|
|
1020
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
1021
|
+
return `/api/workspaces/${id}/${suffix}`;
|
|
1022
|
+
}
|
|
1023
|
+
/** Purchase a certified carbon offset for a label. */
|
|
1024
|
+
async offset(labelId) {
|
|
1025
|
+
return this.http.post(this.wsPath(`shipping/labels/${labelId}/offset`));
|
|
1026
|
+
}
|
|
1027
|
+
/** Get the estimated CO2 emissions for a label before purchasing an offset. */
|
|
1028
|
+
async getEmissions(labelId) {
|
|
1029
|
+
return this.http.get(this.wsPath(`shipping/labels/${labelId}/emissions`));
|
|
1030
|
+
}
|
|
1031
|
+
/** Purchase carbon offsets for multiple labels in a single request. */
|
|
1032
|
+
async batchOffset(labelIds) {
|
|
1033
|
+
return this.http.post(this.wsPath("shipping/labels/offset/batch"), { labelIds });
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
// src/resources/hs-codes.ts
|
|
1038
|
+
var HsCodesResource = class {
|
|
1039
|
+
constructor(http, getWorkspaceId) {
|
|
1040
|
+
this.http = http;
|
|
1041
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
1042
|
+
}
|
|
1043
|
+
wsPath(suffix) {
|
|
1044
|
+
const id = this.getWorkspaceId();
|
|
1045
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
1046
|
+
return `/api/workspaces/${id}/${suffix}`;
|
|
1047
|
+
}
|
|
1048
|
+
/** Search for HS codes by product description. Requires Enterprise plan. */
|
|
1049
|
+
async search(query, options) {
|
|
1050
|
+
return this.http.get(this.wsPath("shipping/hs-codes/search"), {
|
|
1051
|
+
query,
|
|
1052
|
+
...options
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
/** Look up a specific HS code by its tariff number. Requires Enterprise plan. */
|
|
1056
|
+
async lookup(code) {
|
|
1057
|
+
return this.http.get(this.wsPath(`shipping/hs-codes/${code}`));
|
|
1058
|
+
}
|
|
1059
|
+
/** Estimate the total landed cost (duty + tax + shipping) for a shipment. Requires Enterprise plan. */
|
|
1060
|
+
async estimateLandedCost(request) {
|
|
1061
|
+
return this.http.post(this.wsPath("shipping/landed-cost"), request);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
// src/resources/recurring-shipments.ts
|
|
1066
|
+
var RecurringShipmentsResource = class {
|
|
1067
|
+
constructor(http, getWorkspaceId) {
|
|
1068
|
+
this.http = http;
|
|
1069
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
1070
|
+
}
|
|
1071
|
+
wsPath(suffix) {
|
|
1072
|
+
const id = this.getWorkspaceId();
|
|
1073
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
1074
|
+
return `/api/workspaces/${id}/recurring-shipments/${suffix}`;
|
|
1075
|
+
}
|
|
1076
|
+
/** List all recurring shipment schedules. */
|
|
1077
|
+
async list(query) {
|
|
1078
|
+
return this.http.get(
|
|
1079
|
+
this.wsPath(""),
|
|
1080
|
+
query
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
/** Get a recurring shipment schedule by ID. */
|
|
1084
|
+
async get(id) {
|
|
1085
|
+
return this.http.get(this.wsPath(id));
|
|
1086
|
+
}
|
|
1087
|
+
/** Create a recurring shipment schedule. */
|
|
1088
|
+
async create(request) {
|
|
1089
|
+
return this.http.post(this.wsPath(""), request);
|
|
1090
|
+
}
|
|
1091
|
+
/** Update a recurring shipment schedule. */
|
|
1092
|
+
async update(id, request) {
|
|
1093
|
+
return this.http.put(this.wsPath(id), request);
|
|
1094
|
+
}
|
|
1095
|
+
/** Delete a recurring shipment schedule. */
|
|
1096
|
+
async delete(id) {
|
|
1097
|
+
return this.http.delete(this.wsPath(id));
|
|
1098
|
+
}
|
|
1099
|
+
/** Pause a recurring shipment (stops automatic execution without deleting). */
|
|
1100
|
+
async pause(id) {
|
|
1101
|
+
return this.http.post(this.wsPath(`${id}/pause`));
|
|
1102
|
+
}
|
|
1103
|
+
/** Resume a paused recurring shipment. */
|
|
1104
|
+
async resume(id) {
|
|
1105
|
+
return this.http.post(this.wsPath(`${id}/resume`));
|
|
1106
|
+
}
|
|
1107
|
+
/** Trigger an immediate execution outside the normal schedule. */
|
|
1108
|
+
async trigger(id) {
|
|
1109
|
+
return this.http.post(this.wsPath(`${id}/trigger`));
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
// src/resources/email-templates.ts
|
|
1114
|
+
var EmailTemplatesResource = class {
|
|
1115
|
+
constructor(http, getWorkspaceId) {
|
|
1116
|
+
this.http = http;
|
|
1117
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
1118
|
+
}
|
|
1119
|
+
wsPath(suffix) {
|
|
1120
|
+
const id = this.getWorkspaceId();
|
|
1121
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
1122
|
+
return `/api/workspaces/${id}/shipment-email-templates/${suffix}`;
|
|
1123
|
+
}
|
|
1124
|
+
/** List all email templates. */
|
|
1125
|
+
async list() {
|
|
1126
|
+
return this.http.get(this.wsPath(""));
|
|
1127
|
+
}
|
|
1128
|
+
/** Get an email template by ID. */
|
|
1129
|
+
async get(id) {
|
|
1130
|
+
return this.http.get(this.wsPath(id));
|
|
1131
|
+
}
|
|
1132
|
+
/** Create an email template. */
|
|
1133
|
+
async create(request) {
|
|
1134
|
+
return this.http.post(this.wsPath(""), request);
|
|
1135
|
+
}
|
|
1136
|
+
/** Update an email template. */
|
|
1137
|
+
async update(id, request) {
|
|
1138
|
+
return this.http.put(this.wsPath(id), request);
|
|
1139
|
+
}
|
|
1140
|
+
/** Delete an email template. */
|
|
1141
|
+
async delete(id) {
|
|
1142
|
+
return this.http.delete(this.wsPath(id));
|
|
1143
|
+
}
|
|
1144
|
+
/** Preview a rendered email template with optional sample data. */
|
|
1145
|
+
async preview(id, context) {
|
|
1146
|
+
return this.http.post(this.wsPath(`${id}/preview`), context ?? {});
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
// src/resources/reports.ts
|
|
1151
|
+
var ReportsResource = class {
|
|
1152
|
+
constructor(http, getWorkspaceId) {
|
|
1153
|
+
this.http = http;
|
|
1154
|
+
this.getWorkspaceId = getWorkspaceId;
|
|
1155
|
+
}
|
|
1156
|
+
wsPath(suffix) {
|
|
1157
|
+
const id = this.getWorkspaceId();
|
|
1158
|
+
if (!id) throw new Error("workspaceId is required.");
|
|
1159
|
+
return `/api/workspaces/${id}/report-schedules/${suffix}`;
|
|
1160
|
+
}
|
|
1161
|
+
/** List all scheduled report configurations. */
|
|
1162
|
+
async list() {
|
|
1163
|
+
return this.http.get(this.wsPath(""));
|
|
1164
|
+
}
|
|
1165
|
+
/** Get a report schedule by ID. */
|
|
1166
|
+
async get(id) {
|
|
1167
|
+
return this.http.get(this.wsPath(id));
|
|
1168
|
+
}
|
|
1169
|
+
/** Create a scheduled report. */
|
|
1170
|
+
async create(request) {
|
|
1171
|
+
return this.http.post(this.wsPath(""), request);
|
|
1172
|
+
}
|
|
1173
|
+
/** Update a scheduled report. */
|
|
1174
|
+
async update(id, request) {
|
|
1175
|
+
return this.http.put(this.wsPath(id), request);
|
|
1176
|
+
}
|
|
1177
|
+
/** Delete a scheduled report. */
|
|
1178
|
+
async delete(id) {
|
|
1179
|
+
return this.http.delete(this.wsPath(id));
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
// src/client.ts
|
|
1184
|
+
var FlexOps = class {
|
|
1185
|
+
http;
|
|
1186
|
+
_workspaceId;
|
|
1187
|
+
// Domain resources
|
|
1188
|
+
auth;
|
|
1189
|
+
workspaces;
|
|
1190
|
+
shipping;
|
|
1191
|
+
carriers;
|
|
1192
|
+
webhooks;
|
|
1193
|
+
wallet;
|
|
1194
|
+
insurance;
|
|
1195
|
+
returns;
|
|
1196
|
+
apiKeys;
|
|
1197
|
+
analytics;
|
|
1198
|
+
orders;
|
|
1199
|
+
inventory;
|
|
1200
|
+
pickups;
|
|
1201
|
+
scanForms;
|
|
1202
|
+
rules;
|
|
1203
|
+
offsets;
|
|
1204
|
+
hsCodes;
|
|
1205
|
+
recurringShipments;
|
|
1206
|
+
emailTemplates;
|
|
1207
|
+
reports;
|
|
1208
|
+
constructor(config = {}) {
|
|
1209
|
+
this.http = new HttpClient(config);
|
|
1210
|
+
this._workspaceId = config.workspaceId;
|
|
1211
|
+
const getWsId = () => this._workspaceId;
|
|
1212
|
+
this.auth = new AuthResource(this.http);
|
|
1213
|
+
this.workspaces = new WorkspacesResource(this.http, getWsId);
|
|
1214
|
+
this.shipping = new ShippingResource(this.http, getWsId);
|
|
1215
|
+
this.carriers = new CarriersResource(this.http);
|
|
1216
|
+
this.webhooks = new WebhooksResource(this.http, getWsId);
|
|
1217
|
+
this.wallet = new WalletResource(this.http, getWsId);
|
|
1218
|
+
this.insurance = new InsuranceResource(this.http, getWsId);
|
|
1219
|
+
this.returns = new ReturnsResource(this.http, getWsId);
|
|
1220
|
+
this.apiKeys = new ApiKeysResource(this.http, getWsId);
|
|
1221
|
+
this.analytics = new AnalyticsResource(this.http);
|
|
1222
|
+
this.orders = new OrdersResource(this.http);
|
|
1223
|
+
this.inventory = new InventoryResource(this.http);
|
|
1224
|
+
this.pickups = new PickupsResource(this.http, getWsId);
|
|
1225
|
+
this.scanForms = new ScanFormsResource(this.http, getWsId);
|
|
1226
|
+
this.rules = new RulesResource(this.http, getWsId);
|
|
1227
|
+
this.offsets = new OffsetResource(this.http, getWsId);
|
|
1228
|
+
this.hsCodes = new HsCodesResource(this.http, getWsId);
|
|
1229
|
+
this.recurringShipments = new RecurringShipmentsResource(this.http, getWsId);
|
|
1230
|
+
this.emailTemplates = new EmailTemplatesResource(this.http, getWsId);
|
|
1231
|
+
this.reports = new ReportsResource(this.http, getWsId);
|
|
1232
|
+
}
|
|
1233
|
+
/** Get or set the active workspace ID. */
|
|
1234
|
+
get workspaceId() {
|
|
1235
|
+
return this._workspaceId;
|
|
1236
|
+
}
|
|
1237
|
+
set workspaceId(id) {
|
|
1238
|
+
this._workspaceId = id;
|
|
1239
|
+
}
|
|
1240
|
+
/** Set the JWT access token for authentication. */
|
|
1241
|
+
setAccessToken(token) {
|
|
1242
|
+
this.http.setAccessToken(token);
|
|
1243
|
+
}
|
|
1244
|
+
/** Set the API key for authentication. */
|
|
1245
|
+
setApiKey(key) {
|
|
1246
|
+
this.http.setApiKey(key);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
export {
|
|
1250
|
+
AnalyticsResource,
|
|
1251
|
+
ApiKeysResource,
|
|
1252
|
+
AuthResource,
|
|
1253
|
+
CarriersResource,
|
|
1254
|
+
EmailTemplatesResource,
|
|
1255
|
+
FlexOps,
|
|
1256
|
+
FlexOpsAuthError,
|
|
1257
|
+
FlexOpsError,
|
|
1258
|
+
FlexOpsRateLimitError,
|
|
1259
|
+
HsCodesResource,
|
|
1260
|
+
InsuranceResource,
|
|
1261
|
+
InventoryResource,
|
|
1262
|
+
OffsetResource,
|
|
1263
|
+
OrdersResource,
|
|
1264
|
+
PickupsResource,
|
|
1265
|
+
RecurringShipmentsResource,
|
|
1266
|
+
ReportsResource,
|
|
1267
|
+
ReturnsResource,
|
|
1268
|
+
RulesResource,
|
|
1269
|
+
ScanFormsResource,
|
|
1270
|
+
ShippingResource,
|
|
1271
|
+
WalletResource,
|
|
1272
|
+
WebhooksResource,
|
|
1273
|
+
WorkspacesResource
|
|
1274
|
+
};
|