@chrt-inc/typescript-sdk 1.302.0 → 1.303.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.
Files changed (155) hide show
  1. package/README.md +29 -8
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +25 -20
  4. package/dist/cjs/api/resources/index.d.ts +2 -0
  5. package/dist/cjs/api/resources/index.js +3 -1
  6. package/dist/cjs/api/resources/orderDrafts/client/Client.d.ts +100 -0
  7. package/dist/cjs/api/resources/orderDrafts/client/Client.js +332 -0
  8. package/dist/cjs/api/resources/orderDrafts/client/index.d.ts +2 -0
  9. package/dist/cjs/api/resources/orderDrafts/client/index.js +17 -0
  10. package/dist/cjs/api/resources/orderDrafts/client/requests/index.d.ts +2 -0
  11. package/dist/cjs/api/resources/orderDrafts/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/orderDrafts/index.js +18 -0
  13. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/Client.d.ts +99 -0
  14. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/Client.js +326 -0
  15. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/index.js +17 -0
  17. package/dist/cjs/api/resources/{orders/resources/draft/client/requests/OrderDraftCreateCargoReq.d.ts → orderDrafts/resources/cargo/client/requests/OrderDraftAddCargoReq.d.ts} +1 -1
  18. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/requests/index.d.ts +3 -0
  19. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/requests/index.js +2 -0
  20. package/dist/cjs/api/resources/orderDrafts/resources/cargo/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/orderDrafts/resources/cargo/index.js +17 -0
  22. package/dist/cjs/api/resources/orderDrafts/resources/index.d.ts +8 -0
  23. package/dist/cjs/api/resources/orderDrafts/resources/index.js +47 -0
  24. package/dist/cjs/api/resources/orderDrafts/resources/task/client/Client.d.ts +81 -0
  25. package/dist/cjs/api/resources/orderDrafts/resources/task/client/Client.js +259 -0
  26. package/dist/cjs/api/resources/orderDrafts/resources/task/client/index.d.ts +2 -0
  27. package/dist/cjs/api/resources/orderDrafts/resources/task/client/index.js +17 -0
  28. package/dist/cjs/api/resources/orderDrafts/resources/task/client/requests/index.d.ts +2 -0
  29. package/dist/cjs/api/resources/orderDrafts/resources/task/client/requests/index.js +2 -0
  30. package/dist/cjs/api/resources/orderDrafts/resources/task/index.d.ts +1 -0
  31. package/dist/cjs/api/resources/orderDrafts/resources/task/index.js +17 -0
  32. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/Client.d.ts +63 -0
  33. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/Client.js +192 -0
  34. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/index.d.ts +2 -0
  35. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/index.js +17 -0
  36. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/requests/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/requests/index.js +2 -0
  38. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/index.d.ts +1 -0
  39. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/index.js +17 -0
  40. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/Client.d.ts +63 -0
  41. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/Client.js +192 -0
  42. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/index.d.ts +2 -0
  43. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/index.js +17 -0
  44. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/requests/index.d.ts +1 -0
  45. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/requests/index.js +2 -0
  46. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/index.js +17 -0
  48. package/dist/cjs/api/resources/orders/resources/draft/client/Client.d.ts +0 -238
  49. package/dist/cjs/api/resources/orders/resources/draft/client/Client.js +0 -997
  50. package/dist/cjs/api/resources/orders/resources/draft/client/index.d.ts +0 -1
  51. package/dist/cjs/api/resources/orders/resources/draft/client/index.js +0 -15
  52. package/dist/cjs/api/resources/orders/resources/draft/resources/expanded/client/Client.js +4 -4
  53. package/dist/cjs/api/resources/orders/resources/index.d.ts +0 -1
  54. package/dist/cjs/api/resources/orders/resources/index.js +0 -1
  55. package/dist/cjs/api/resources/payments/client/Client.d.ts +20 -20
  56. package/dist/cjs/api/resources/payments/client/Client.js +83 -83
  57. package/dist/cjs/version.d.ts +1 -1
  58. package/dist/cjs/version.js +1 -1
  59. package/dist/esm/Client.d.mts +3 -0
  60. package/dist/esm/Client.mjs +7 -2
  61. package/dist/esm/api/resources/index.d.mts +2 -0
  62. package/dist/esm/api/resources/index.mjs +2 -0
  63. package/dist/esm/api/resources/orderDrafts/client/Client.d.mts +100 -0
  64. package/dist/esm/api/resources/orderDrafts/client/Client.mjs +295 -0
  65. package/dist/esm/api/resources/orderDrafts/client/index.d.mts +2 -0
  66. package/dist/esm/api/resources/orderDrafts/client/index.mjs +1 -0
  67. package/dist/esm/api/resources/orderDrafts/client/requests/index.d.mts +2 -0
  68. package/dist/esm/api/resources/orderDrafts/index.d.mts +2 -0
  69. package/dist/esm/api/resources/orderDrafts/index.mjs +2 -0
  70. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/Client.d.mts +99 -0
  71. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/Client.mjs +289 -0
  72. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/index.d.mts +2 -0
  73. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/index.mjs +1 -0
  74. package/dist/esm/api/resources/{orders/resources/draft/client/requests/OrderDraftCreateCargoReq.d.mts → orderDrafts/resources/cargo/client/requests/OrderDraftAddCargoReq.d.mts} +1 -1
  75. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/requests/index.d.mts +3 -0
  76. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/requests/index.mjs +1 -0
  77. package/dist/esm/api/resources/orderDrafts/resources/cargo/index.d.mts +1 -0
  78. package/dist/esm/api/resources/orderDrafts/resources/cargo/index.mjs +1 -0
  79. package/dist/esm/api/resources/orderDrafts/resources/index.d.mts +8 -0
  80. package/dist/esm/api/resources/orderDrafts/resources/index.mjs +8 -0
  81. package/dist/esm/api/resources/orderDrafts/resources/task/client/Client.d.mts +81 -0
  82. package/dist/esm/api/resources/orderDrafts/resources/task/client/Client.mjs +222 -0
  83. package/dist/esm/api/resources/orderDrafts/resources/task/client/index.d.mts +2 -0
  84. package/dist/esm/api/resources/orderDrafts/resources/task/client/index.mjs +1 -0
  85. package/dist/esm/api/resources/orderDrafts/resources/task/client/requests/index.d.mts +2 -0
  86. package/dist/esm/api/resources/orderDrafts/resources/task/client/requests/index.mjs +1 -0
  87. package/dist/esm/api/resources/orderDrafts/resources/task/index.d.mts +1 -0
  88. package/dist/esm/api/resources/orderDrafts/resources/task/index.mjs +1 -0
  89. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/Client.d.mts +63 -0
  90. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/Client.mjs +155 -0
  91. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/index.d.mts +2 -0
  92. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/index.mjs +1 -0
  93. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/requests/index.d.mts +1 -0
  94. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/requests/index.mjs +1 -0
  95. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/index.d.mts +1 -0
  96. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/index.mjs +1 -0
  97. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/Client.d.mts +63 -0
  98. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/Client.mjs +155 -0
  99. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/index.d.mts +2 -0
  100. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/index.mjs +1 -0
  101. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/requests/index.d.mts +1 -0
  102. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/requests/index.mjs +1 -0
  103. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/index.d.mts +1 -0
  104. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/index.mjs +1 -0
  105. package/dist/esm/api/resources/orders/resources/draft/client/Client.d.mts +0 -238
  106. package/dist/esm/api/resources/orders/resources/draft/client/Client.mjs +0 -964
  107. package/dist/esm/api/resources/orders/resources/draft/client/index.d.mts +0 -1
  108. package/dist/esm/api/resources/orders/resources/draft/client/index.mjs +1 -1
  109. package/dist/esm/api/resources/orders/resources/draft/resources/expanded/client/Client.mjs +4 -4
  110. package/dist/esm/api/resources/orders/resources/index.d.mts +0 -1
  111. package/dist/esm/api/resources/orders/resources/index.mjs +0 -1
  112. package/dist/esm/api/resources/payments/client/Client.d.mts +20 -20
  113. package/dist/esm/api/resources/payments/client/Client.mjs +83 -83
  114. package/dist/esm/version.d.mts +1 -1
  115. package/dist/esm/version.mjs +1 -1
  116. package/package.json +1 -1
  117. package/reference.md +511 -503
  118. package/dist/cjs/api/resources/orders/resources/draft/client/requests/index.d.ts +0 -9
  119. package/dist/esm/api/resources/orders/resources/draft/client/requests/index.d.mts +0 -9
  120. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersDraftUpdateReq.d.ts +0 -0
  121. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersDraftUpdateReq.js +0 -0
  122. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersNewDraftReq.d.ts +0 -0
  123. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersNewDraftReq.js +0 -0
  124. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts}/client/requests/index.js +0 -0
  125. /package/dist/cjs/api/resources/{orders/resources/draft/client/requests/OrderDraftAddTaskArtifactReq.js → orderDrafts/resources/cargo/client/requests/OrderDraftAddCargoReq.js} +0 -0
  126. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftAssociateCargoWithTaskReq.d.ts +0 -0
  127. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftAssociateCargoWithTaskReq.js +0 -0
  128. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftUpdateCargoReq.d.ts +0 -0
  129. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftUpdateCargoReq.js +0 -0
  130. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftAddTaskReqV1.d.ts +0 -0
  131. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftAddTaskReqV1.js +0 -0
  132. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftUpdateTaskReq.d.ts +0 -0
  133. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftUpdateTaskReq.js +0 -0
  134. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/taskArtifact}/client/requests/OrderDraftAddTaskArtifactReq.d.ts +0 -0
  135. /package/dist/cjs/api/resources/{orders/resources/draft/client/requests/OrderDraftAddTaskGroupReq.js → orderDrafts/resources/taskArtifact/client/requests/OrderDraftAddTaskArtifactReq.js} +0 -0
  136. /package/dist/cjs/api/resources/{orders/resources/draft → orderDrafts/resources/taskGroup}/client/requests/OrderDraftAddTaskGroupReq.d.ts +0 -0
  137. /package/dist/cjs/api/resources/{orders/resources/draft/client/requests/OrderDraftCreateCargoReq.js → orderDrafts/resources/taskGroup/client/requests/OrderDraftAddTaskGroupReq.js} +0 -0
  138. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersDraftUpdateReq.d.mts +0 -0
  139. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersDraftUpdateReq.mjs +0 -0
  140. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersNewDraftReq.d.mts +0 -0
  141. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts}/client/requests/OrdersNewDraftReq.mjs +0 -0
  142. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts}/client/requests/index.mjs +0 -0
  143. /package/dist/esm/api/resources/{orders/resources/draft/client/requests/OrderDraftAddTaskArtifactReq.mjs → orderDrafts/resources/cargo/client/requests/OrderDraftAddCargoReq.mjs} +0 -0
  144. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftAssociateCargoWithTaskReq.d.mts +0 -0
  145. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftAssociateCargoWithTaskReq.mjs +0 -0
  146. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftUpdateCargoReq.d.mts +0 -0
  147. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/cargo}/client/requests/OrderDraftUpdateCargoReq.mjs +0 -0
  148. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftAddTaskReqV1.d.mts +0 -0
  149. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftAddTaskReqV1.mjs +0 -0
  150. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftUpdateTaskReq.d.mts +0 -0
  151. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/task}/client/requests/OrderDraftUpdateTaskReq.mjs +0 -0
  152. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/taskArtifact}/client/requests/OrderDraftAddTaskArtifactReq.d.mts +0 -0
  153. /package/dist/esm/api/resources/{orders/resources/draft/client/requests/OrderDraftAddTaskGroupReq.mjs → orderDrafts/resources/taskArtifact/client/requests/OrderDraftAddTaskArtifactReq.mjs} +0 -0
  154. /package/dist/esm/api/resources/{orders/resources/draft → orderDrafts/resources/taskGroup}/client/requests/OrderDraftAddTaskGroupReq.d.mts +0 -0
  155. /package/dist/esm/api/resources/{orders/resources/draft/client/requests/OrderDraftCreateCargoReq.mjs → orderDrafts/resources/taskGroup/client/requests/OrderDraftAddTaskGroupReq.mjs} +0 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.js";
5
+ import * as core from "../../../../../../core/index.js";
6
+ import * as Chrt from "../../../../../index.js";
7
+ export declare namespace TaskGroup {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.ChrtEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
+ fetcher?: core.FetchFunction;
16
+ }
17
+ interface RequestOptions {
18
+ /** The maximum time to wait for a response in seconds. */
19
+ timeoutInSeconds?: number;
20
+ /** The number of times to retry the request. Defaults to 2. */
21
+ maxRetries?: number;
22
+ /** A hook to abort the request. */
23
+ abortSignal?: AbortSignal;
24
+ /** Additional query string parameters to include in the request. */
25
+ queryParams?: Record<string, unknown>;
26
+ /** Additional headers to include in the request. */
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
+ }
29
+ }
30
+ export declare class TaskGroup {
31
+ protected readonly _options: TaskGroup.Options;
32
+ constructor(_options?: TaskGroup.Options);
33
+ /**
34
+ * Adds a task group to an existing order draft. Validates order is in DRAFT status and owned by caller.
35
+ *
36
+ * @param {Chrt.orderDrafts.OrderDraftAddTaskGroupReq} request
37
+ * @param {TaskGroup.RequestOptions} requestOptions - Request-specific configuration.
38
+ *
39
+ * @throws {@link Chrt.UnprocessableEntityError}
40
+ *
41
+ * @example
42
+ * await client.orderDrafts.taskGroup.addV1({
43
+ * task_group_type: "chrt_ground_courier",
44
+ * order_id: "order_id"
45
+ * })
46
+ */
47
+ addV1(request: Chrt.orderDrafts.OrderDraftAddTaskGroupReq, requestOptions?: TaskGroup.RequestOptions): core.HttpResponsePromise<string>;
48
+ private __addV1;
49
+ /**
50
+ * Deletes a task group and all associated entities (tasks, task artifacts, S3 metadata). The task group must belong to a DRAFT order.
51
+ *
52
+ * @param {string} taskGroupId
53
+ * @param {TaskGroup.RequestOptions} requestOptions - Request-specific configuration.
54
+ *
55
+ * @throws {@link Chrt.UnprocessableEntityError}
56
+ *
57
+ * @example
58
+ * await client.orderDrafts.taskGroup.deleteV1("task_group_id")
59
+ */
60
+ deleteV1(taskGroupId: string, requestOptions?: TaskGroup.RequestOptions): core.HttpResponsePromise<boolean>;
61
+ private __deleteV1;
62
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
63
+ }
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.TaskGroup = void 0;
49
+ const environments = __importStar(require("../../../../../../environments.js"));
50
+ const core = __importStar(require("../../../../../../core/index.js"));
51
+ const Chrt = __importStar(require("../../../../../index.js"));
52
+ const headers_js_1 = require("../../../../../../core/headers.js");
53
+ const errors = __importStar(require("../../../../../../errors/index.js"));
54
+ class TaskGroup {
55
+ constructor(_options = {}) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * Adds a task group to an existing order draft. Validates order is in DRAFT status and owned by caller.
60
+ *
61
+ * @param {Chrt.orderDrafts.OrderDraftAddTaskGroupReq} request
62
+ * @param {TaskGroup.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Chrt.UnprocessableEntityError}
65
+ *
66
+ * @example
67
+ * await client.orderDrafts.taskGroup.addV1({
68
+ * task_group_type: "chrt_ground_courier",
69
+ * order_id: "order_id"
70
+ * })
71
+ */
72
+ addV1(request, requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__addV1(request, requestOptions));
74
+ }
75
+ __addV1(request, requestOptions) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ var _a, _b, _c, _d;
78
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
80
+ 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, "oort/order_drafts/task_group/add/v1"),
81
+ method: "POST",
82
+ headers: _headers,
83
+ contentType: "application/json",
84
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
85
+ requestType: "json",
86
+ body: request,
87
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
88
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
89
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
90
+ });
91
+ if (_response.ok) {
92
+ return { data: _response.body, rawResponse: _response.rawResponse };
93
+ }
94
+ if (_response.error.reason === "status-code") {
95
+ switch (_response.error.statusCode) {
96
+ case 422:
97
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
98
+ default:
99
+ throw new errors.ChrtError({
100
+ statusCode: _response.error.statusCode,
101
+ body: _response.error.body,
102
+ rawResponse: _response.rawResponse,
103
+ });
104
+ }
105
+ }
106
+ switch (_response.error.reason) {
107
+ case "non-json":
108
+ throw new errors.ChrtError({
109
+ statusCode: _response.error.statusCode,
110
+ body: _response.error.rawBody,
111
+ rawResponse: _response.rawResponse,
112
+ });
113
+ case "timeout":
114
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /oort/order_drafts/task_group/add/v1.");
115
+ case "unknown":
116
+ throw new errors.ChrtError({
117
+ message: _response.error.errorMessage,
118
+ rawResponse: _response.rawResponse,
119
+ });
120
+ }
121
+ });
122
+ }
123
+ /**
124
+ * Deletes a task group and all associated entities (tasks, task artifacts, S3 metadata). The task group must belong to a DRAFT order.
125
+ *
126
+ * @param {string} taskGroupId
127
+ * @param {TaskGroup.RequestOptions} requestOptions - Request-specific configuration.
128
+ *
129
+ * @throws {@link Chrt.UnprocessableEntityError}
130
+ *
131
+ * @example
132
+ * await client.orderDrafts.taskGroup.deleteV1("task_group_id")
133
+ */
134
+ deleteV1(taskGroupId, requestOptions) {
135
+ return core.HttpResponsePromise.fromPromise(this.__deleteV1(taskGroupId, requestOptions));
136
+ }
137
+ __deleteV1(taskGroupId, requestOptions) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ var _a, _b, _c, _d;
140
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
141
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
142
+ 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, `oort/order_drafts/task_group/delete/v1/${encodeURIComponent(taskGroupId)}`),
143
+ method: "DELETE",
144
+ headers: _headers,
145
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
146
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
147
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ });
150
+ if (_response.ok) {
151
+ return { data: _response.body, rawResponse: _response.rawResponse };
152
+ }
153
+ if (_response.error.reason === "status-code") {
154
+ switch (_response.error.statusCode) {
155
+ case 422:
156
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
157
+ default:
158
+ throw new errors.ChrtError({
159
+ statusCode: _response.error.statusCode,
160
+ body: _response.error.body,
161
+ rawResponse: _response.rawResponse,
162
+ });
163
+ }
164
+ }
165
+ switch (_response.error.reason) {
166
+ case "non-json":
167
+ throw new errors.ChrtError({
168
+ statusCode: _response.error.statusCode,
169
+ body: _response.error.rawBody,
170
+ rawResponse: _response.rawResponse,
171
+ });
172
+ case "timeout":
173
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling DELETE /oort/order_drafts/task_group/delete/v1/{task_group_id}.");
174
+ case "unknown":
175
+ throw new errors.ChrtError({
176
+ message: _response.error.errorMessage,
177
+ rawResponse: _response.rawResponse,
178
+ });
179
+ }
180
+ });
181
+ }
182
+ _getAuthorizationHeader() {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ const bearer = yield core.Supplier.get(this._options.token);
185
+ if (bearer != null) {
186
+ return `Bearer ${bearer}`;
187
+ }
188
+ return undefined;
189
+ });
190
+ }
191
+ }
192
+ exports.TaskGroup = TaskGroup;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1 @@
1
+ export { type OrderDraftAddTaskGroupReq } from "./OrderDraftAddTaskGroupReq.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import * as environments from "../../../../../../environments.js";
5
5
  import * as core from "../../../../../../core/index.js";
6
- import * as Chrt from "../../../../../index.js";
7
6
  import { Expanded } from "../resources/expanded/client/Client.js";
8
7
  export declare namespace Draft {
9
8
  interface Options {
@@ -15,247 +14,10 @@ export declare namespace Draft {
15
14
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
16
15
  fetcher?: core.FetchFunction;
17
16
  }
18
- interface RequestOptions {
19
- /** The maximum time to wait for a response in seconds. */
20
- timeoutInSeconds?: number;
21
- /** The number of times to retry the request. Defaults to 2. */
22
- maxRetries?: number;
23
- /** A hook to abort the request. */
24
- abortSignal?: AbortSignal;
25
- /** Additional query string parameters to include in the request. */
26
- queryParams?: Record<string, unknown>;
27
- /** Additional headers to include in the request. */
28
- headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
29
- }
30
17
  }
31
18
  export declare class Draft {
32
19
  protected readonly _options: Draft.Options;
33
20
  protected _expanded: Expanded | undefined;
34
21
  constructor(_options?: Draft.Options);
35
22
  get expanded(): Expanded;
36
- /**
37
- * Creates a new draft order with org assignments based on caller's organization type.
38
- *
39
- * @param {Chrt.orders.OrdersNewDraftReq} request
40
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
41
- *
42
- * @throws {@link Chrt.UnprocessableEntityError}
43
- *
44
- * @example
45
- * await client.orders.draft.newV1()
46
- */
47
- newV1(request?: Chrt.orders.OrdersNewDraftReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<Chrt.OrdersNewDraftRes>;
48
- private __newV1;
49
- /**
50
- * Updates forwarder and/or shipper org assignments for a draft order
51
- *
52
- * @param {Chrt.orders.OrdersDraftUpdateReq} request
53
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
54
- *
55
- * @throws {@link Chrt.UnprocessableEntityError}
56
- *
57
- * @example
58
- * await client.orders.draft.updateV1({
59
- * order_id: "order_id"
60
- * })
61
- */
62
- updateV1(request: Chrt.orders.OrdersDraftUpdateReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<Chrt.OrdersDraftUpdateRes>;
63
- private __updateV1;
64
- /**
65
- * Deletes a draft order and all associated entities
66
- *
67
- * @param {string} orderId
68
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
69
- *
70
- * @throws {@link Chrt.UnprocessableEntityError}
71
- *
72
- * @example
73
- * await client.orders.draft.deleteV1("order_id")
74
- */
75
- deleteV1(orderId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
76
- private __deleteV1;
77
- /**
78
- * Adds a task group to an existing draft order. Validates order is in DRAFT status and owned by caller.
79
- *
80
- * @param {Chrt.orders.OrderDraftAddTaskGroupReq} request
81
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
82
- *
83
- * @throws {@link Chrt.UnprocessableEntityError}
84
- *
85
- * @example
86
- * await client.orders.draft.addTaskGroupV1({
87
- * task_group_type: "chrt_ground_courier",
88
- * order_id: "order_id"
89
- * })
90
- */
91
- addTaskGroupV1(request: Chrt.orders.OrderDraftAddTaskGroupReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
92
- private __addTaskGroupV1;
93
- /**
94
- * Deletes a task group and all associated entities (tasks, task artifacts, S3 metadata). The task group must belong to a DRAFT order.
95
- *
96
- * @param {string} taskGroupId
97
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
98
- *
99
- * @throws {@link Chrt.UnprocessableEntityError}
100
- *
101
- * @example
102
- * await client.orders.draft.deleteTaskGroupV1("task_group_id")
103
- */
104
- deleteTaskGroupV1(taskGroupId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
105
- private __deleteTaskGroupV1;
106
- /**
107
- * Adds a task to an existing task group in a draft order. Validates order is in DRAFT status and task action type matches task group type.
108
- *
109
- * @param {Chrt.orders.OrderDraftAddTaskReqV1} request
110
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
111
- *
112
- * @throws {@link Chrt.UnprocessableEntityError}
113
- *
114
- * @example
115
- * await client.orders.draft.addTaskV1({
116
- * task_group_id: "task_group_id",
117
- * task: {
118
- * schema_version: 1
119
- * }
120
- * })
121
- */
122
- addTaskV1(request: Chrt.orders.OrderDraftAddTaskReqV1, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
123
- private __addTaskV1;
124
- /**
125
- * Updates a task in an existing draft order
126
- *
127
- * @param {Chrt.orders.OrderDraftUpdateTaskReq} request
128
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
129
- *
130
- * @throws {@link Chrt.UnprocessableEntityError}
131
- *
132
- * @example
133
- * await client.orders.draft.updateTaskV1({
134
- * task_id: "task_id",
135
- * task_update: {}
136
- * })
137
- */
138
- updateTaskV1(request: Chrt.orders.OrderDraftUpdateTaskReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
139
- private __updateTaskV1;
140
- /**
141
- * Deletes a task from a draft order, including all task artifacts. Cargo is preserved. Task is removed from task group.
142
- *
143
- * @param {string} taskId
144
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
145
- *
146
- * @throws {@link Chrt.UnprocessableEntityError}
147
- *
148
- * @example
149
- * await client.orders.draft.deleteTaskV1("task_id")
150
- */
151
- deleteTaskV1(taskId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
152
- private __deleteTaskV1;
153
- /**
154
- * Adds a task artifact to an existing task in a draft order.
155
- *
156
- * @param {Chrt.orders.OrderDraftAddTaskArtifactReq} request
157
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
158
- *
159
- * @throws {@link Chrt.UnprocessableEntityError}
160
- *
161
- * @example
162
- * await client.orders.draft.addTaskArtifactV1({
163
- * task_id: "task_id",
164
- * task_artifact_type: "image"
165
- * })
166
- */
167
- addTaskArtifactV1(request: Chrt.orders.OrderDraftAddTaskArtifactReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
168
- private __addTaskArtifactV1;
169
- /**
170
- * Deletes a task artifact from a draft order and removes it from the associated task.
171
- *
172
- * @param {string} taskArtifactId
173
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
174
- *
175
- * @throws {@link Chrt.UnprocessableEntityError}
176
- *
177
- * @example
178
- * await client.orders.draft.deleteTaskArtifactV1("task_artifact_id")
179
- */
180
- deleteTaskArtifactV1(taskArtifactId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
181
- private __deleteTaskArtifactV1;
182
- /**
183
- * Creates a cargo item in an existing draft order. Validates order is in DRAFT status and owned by caller.
184
- *
185
- * @param {Chrt.orders.OrderDraftCreateCargoReq} request
186
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
187
- *
188
- * @throws {@link Chrt.UnprocessableEntityError}
189
- *
190
- * @example
191
- * await client.orders.draft.createCargoV1({
192
- * order_id: "order_id",
193
- * cargo: {
194
- * schema_version: 1,
195
- * cargo_type: "spare_parts"
196
- * }
197
- * })
198
- */
199
- createCargoV1(request: Chrt.orders.OrderDraftCreateCargoReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
200
- private __createCargoV1;
201
- /**
202
- * Associates existing cargo with a task in a draft order.
203
- *
204
- * @param {Chrt.orders.OrderDraftAssociateCargoWithTaskReq} request
205
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
206
- *
207
- * @throws {@link Chrt.UnprocessableEntityError}
208
- *
209
- * @example
210
- * await client.orders.draft.associateCargoWithTaskV1({
211
- * order_id: "order_id",
212
- * task_id: "task_id",
213
- * cargo_id: "cargo_id"
214
- * })
215
- */
216
- associateCargoWithTaskV1(request: Chrt.orders.OrderDraftAssociateCargoWithTaskReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
217
- private __associateCargoWithTaskV1;
218
- /**
219
- * Updates a cargo item in an existing draft order. Validates order is in DRAFT status and owned by caller.
220
- *
221
- * @param {Chrt.orders.OrderDraftUpdateCargoReq} request
222
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
223
- *
224
- * @throws {@link Chrt.UnprocessableEntityError}
225
- *
226
- * @example
227
- * await client.orders.draft.updateCargoV1({
228
- * cargo_id: "cargo_id",
229
- * cargo_update: {}
230
- * })
231
- */
232
- updateCargoV1(request: Chrt.orders.OrderDraftUpdateCargoReq, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<string>;
233
- private __updateCargoV1;
234
- /**
235
- * Deletes a cargo item from a draft order and removes references from associated tasks
236
- *
237
- * @param {string} cargoId
238
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
239
- *
240
- * @throws {@link Chrt.UnprocessableEntityError}
241
- *
242
- * @example
243
- * await client.orders.draft.deleteCargoV1("cargo_id")
244
- */
245
- deleteCargoV1(cargoId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
246
- private __deleteCargoV1;
247
- /**
248
- * Checks whether the draft order satisfies all requirements to move into staging.
249
- *
250
- * @param {string} orderId
251
- * @param {Draft.RequestOptions} requestOptions - Request-specific configuration.
252
- *
253
- * @throws {@link Chrt.UnprocessableEntityError}
254
- *
255
- * @example
256
- * await client.orders.draft.getDraftValidateV1("order_id")
257
- */
258
- getDraftValidateV1(orderId: string, requestOptions?: Draft.RequestOptions): core.HttpResponsePromise<boolean>;
259
- private __getDraftValidateV1;
260
- protected _getAuthorizationHeader(): Promise<string | undefined>;
261
23
  }