@chrt-inc/typescript-sdk 1.887.0 → 1.888.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 (56) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/orgs/resources/accounts/client/Client.d.ts +1 -0
  3. package/dist/cjs/api/resources/orgs/resources/accounts/client/Client.js +5 -1
  4. package/dist/cjs/api/resources/orgs/resources/accounts/client/requests/AccountsListV1Request.d.ts +3 -0
  5. package/dist/cjs/api/resources/orgs/resources/contacts/client/Client.d.ts +30 -0
  6. package/dist/cjs/api/resources/orgs/resources/contacts/client/Client.js +125 -0
  7. package/dist/cjs/api/resources/orgs/resources/contacts/client/requests/ContactAccountAddReq.d.ts +12 -0
  8. package/dist/cjs/api/resources/orgs/resources/contacts/client/requests/ContactAccountAddReq.js +5 -0
  9. package/dist/cjs/api/resources/orgs/resources/contacts/client/requests/ContactClientCreate1.d.ts +1 -1
  10. package/dist/cjs/api/resources/orgs/resources/contacts/client/requests/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/shipping/resources/cargos/client/Client.d.ts +53 -0
  12. package/dist/cjs/api/resources/shipping/resources/cargos/client/Client.js +200 -0
  13. package/dist/cjs/api/resources/shipping/resources/cargos/client/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/shipping/resources/cargos/client/index.js +15 -0
  15. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoAddToOrderReq.d.ts +18 -0
  16. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoAddToOrderReq.js +5 -0
  17. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoAssociateWithTaskReq.d.ts +16 -0
  18. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoAssociateWithTaskReq.js +5 -0
  19. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoUnassociateWithTaskReq.d.ts +16 -0
  20. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/CargoUnassociateWithTaskReq.js +5 -0
  21. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/index.d.ts +3 -0
  22. package/dist/cjs/api/resources/shipping/resources/cargos/client/requests/index.js +2 -0
  23. package/dist/cjs/api/resources/shipping/resources/index.d.ts +1 -0
  24. package/dist/cjs/api/resources/shipping/resources/index.js +1 -0
  25. package/dist/cjs/api/types/Contact1.d.ts +1 -1
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/Client.mjs +2 -2
  29. package/dist/esm/api/resources/orgs/resources/accounts/client/Client.d.mts +1 -0
  30. package/dist/esm/api/resources/orgs/resources/accounts/client/Client.mjs +5 -1
  31. package/dist/esm/api/resources/orgs/resources/accounts/client/requests/AccountsListV1Request.d.mts +3 -0
  32. package/dist/esm/api/resources/orgs/resources/contacts/client/Client.d.mts +30 -0
  33. package/dist/esm/api/resources/orgs/resources/contacts/client/Client.mjs +125 -0
  34. package/dist/esm/api/resources/orgs/resources/contacts/client/requests/ContactAccountAddReq.d.mts +12 -0
  35. package/dist/esm/api/resources/orgs/resources/contacts/client/requests/ContactAccountAddReq.mjs +4 -0
  36. package/dist/esm/api/resources/orgs/resources/contacts/client/requests/ContactClientCreate1.d.mts +1 -1
  37. package/dist/esm/api/resources/orgs/resources/contacts/client/requests/index.d.mts +1 -0
  38. package/dist/esm/api/resources/shipping/resources/cargos/client/Client.d.mts +53 -0
  39. package/dist/esm/api/resources/shipping/resources/cargos/client/Client.mjs +200 -0
  40. package/dist/esm/api/resources/shipping/resources/cargos/client/index.d.mts +1 -0
  41. package/dist/esm/api/resources/shipping/resources/cargos/client/index.mjs +1 -1
  42. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoAddToOrderReq.d.mts +18 -0
  43. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoAddToOrderReq.mjs +4 -0
  44. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoAssociateWithTaskReq.d.mts +16 -0
  45. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoAssociateWithTaskReq.mjs +4 -0
  46. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoUnassociateWithTaskReq.d.mts +16 -0
  47. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/CargoUnassociateWithTaskReq.mjs +4 -0
  48. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/index.d.mts +3 -0
  49. package/dist/esm/api/resources/shipping/resources/cargos/client/requests/index.mjs +1 -0
  50. package/dist/esm/api/resources/shipping/resources/index.d.mts +1 -0
  51. package/dist/esm/api/resources/shipping/resources/index.mjs +1 -0
  52. package/dist/esm/api/types/Contact1.d.mts +1 -1
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +1 -1
  56. package/reference.md +348 -0
@@ -10,6 +10,7 @@ export * as ordersAndOrderGroups from "./ordersAndOrderGroups/index.js";
10
10
  export * as taskArtifacts from "./taskArtifacts/index.js";
11
11
  export * as taskGroups from "./taskGroups/index.js";
12
12
  export * as tasks from "./tasks/index.js";
13
+ export * from "./cargos/client/requests/index.js";
13
14
  export * from "./drivers/client/requests/index.js";
14
15
  export * from "./orderGroups/client/requests/index.js";
15
16
  export * from "./orderSchedules/client/requests/index.js";
@@ -49,6 +49,7 @@ exports.ordersAndOrderGroups = __importStar(require("./ordersAndOrderGroups/inde
49
49
  exports.taskArtifacts = __importStar(require("./taskArtifacts/index.js"));
50
50
  exports.taskGroups = __importStar(require("./taskGroups/index.js"));
51
51
  exports.tasks = __importStar(require("./tasks/index.js"));
52
+ __exportStar(require("./cargos/client/requests/index.js"), exports);
52
53
  __exportStar(require("./drivers/client/requests/index.js"), exports);
53
54
  __exportStar(require("./orderGroups/client/requests/index.js"), exports);
54
55
  __exportStar(require("./orderSchedules/client/requests/index.js"), exports);
@@ -4,7 +4,7 @@
4
4
  import * as Chrt from "../index.js";
5
5
  export interface Contact1 {
6
6
  _id: string;
7
- account_id?: string | null;
7
+ account_ids?: string[];
8
8
  /** Must be a string starting with `org_` */
9
9
  created_by_org_id: string;
10
10
  email_address?: string | null;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.887.0";
1
+ export declare const SDK_VERSION = "1.888.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.887.0";
4
+ exports.SDK_VERSION = "1.888.0";
@@ -21,8 +21,8 @@ export class ChrtClient {
21
21
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
22
22
  "X-Fern-Language": "JavaScript",
23
23
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
24
- "X-Fern-SDK-Version": "1.887.0",
25
- "User-Agent": "@chrt-inc/typescript-sdk/1.887.0",
24
+ "X-Fern-SDK-Version": "1.888.0",
25
+ "User-Agent": "@chrt-inc/typescript-sdk/1.888.0",
26
26
  "X-Fern-Runtime": core.RUNTIME.type,
27
27
  "X-Fern-Runtime-Version": core.RUNTIME.version,
28
28
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -57,6 +57,7 @@ export declare class Accounts {
57
57
  * @example
58
58
  * await client.orgs.accounts.listV1({
59
59
  * search: "search",
60
+ * filter_account_id: "filter_account_id",
60
61
  * filter_org_id: "filter_org_id",
61
62
  * filter_off_chrt_org_data_id: "filter_off_chrt_org_data_id",
62
63
  * sort_by: "name",
@@ -95,6 +95,7 @@ export class Accounts {
95
95
  * @example
96
96
  * await client.orgs.accounts.listV1({
97
97
  * search: "search",
98
+ * filter_account_id: "filter_account_id",
98
99
  * filter_org_id: "filter_org_id",
99
100
  * filter_off_chrt_org_data_id: "filter_off_chrt_org_data_id",
100
101
  * sort_by: "name",
@@ -109,11 +110,14 @@ export class Accounts {
109
110
  __listV1() {
110
111
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
111
112
  var _a, _b, _c, _d, _e, _f;
112
- const { search, filter_org_id: filterOrgId, filter_off_chrt_org_data_id: filterOffChrtOrgDataId, sort_by: sortBy, sort_order: sortOrder, page, page_size: pageSize, } = request;
113
+ const { search, filter_account_id: filterAccountId, filter_org_id: filterOrgId, filter_off_chrt_org_data_id: filterOffChrtOrgDataId, sort_by: sortBy, sort_order: sortOrder, page, page_size: pageSize, } = request;
113
114
  const _queryParams = {};
114
115
  if (search !== undefined) {
115
116
  _queryParams["search"] = search;
116
117
  }
118
+ if (filterAccountId !== undefined) {
119
+ _queryParams["filter_account_id"] = filterAccountId;
120
+ }
117
121
  if (filterOrgId !== undefined) {
118
122
  _queryParams["filter_org_id"] = filterOrgId;
119
123
  }
@@ -6,6 +6,7 @@ import * as Chrt from "../../../../../../index.mjs";
6
6
  * @example
7
7
  * {
8
8
  * search: "search",
9
+ * filter_account_id: "filter_account_id",
9
10
  * filter_org_id: "filter_org_id",
10
11
  * filter_off_chrt_org_data_id: "filter_off_chrt_org_data_id",
11
12
  * sort_by: "name",
@@ -17,6 +18,8 @@ import * as Chrt from "../../../../../../index.mjs";
17
18
  export interface AccountsListV1Request {
18
19
  /** Full-text account name search query */
19
20
  search?: string | null;
21
+ /** Filter by account ID */
22
+ filter_account_id?: string | null;
20
23
  /** Filter by associated on-CHRT shipper organization */
21
24
  filter_org_id?: string | null;
22
25
  /** Filter by associated off-CHRT shipper organization data */
@@ -30,6 +30,36 @@ export declare namespace Contacts {
30
30
  export declare class Contacts {
31
31
  protected readonly _options: Contacts.Options;
32
32
  constructor(_options?: Contacts.Options);
33
+ /**
34
+ * Associates an account from the contact's organization. | authz: min_org_role=operator | (ContactAccountAddReq) -> (bool)
35
+ *
36
+ * @param {string} contactId
37
+ * @param {Chrt.orgs.ContactAccountAddReq} request
38
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
39
+ *
40
+ * @throws {@link Chrt.UnprocessableEntityError}
41
+ *
42
+ * @example
43
+ * await client.orgs.contacts.accountAddV1("contact_id", {
44
+ * account_id: "account_id"
45
+ * })
46
+ */
47
+ accountAddV1(contactId: string, request: Chrt.orgs.ContactAccountAddReq, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<boolean>;
48
+ private __accountAddV1;
49
+ /**
50
+ * Removes an account association from an organization-created contact. | authz: min_org_role=operator | () -> (bool)
51
+ *
52
+ * @param {string} contactId
53
+ * @param {string} accountId
54
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
55
+ *
56
+ * @throws {@link Chrt.UnprocessableEntityError}
57
+ *
58
+ * @example
59
+ * await client.orgs.contacts.accountRemoveV1("contact_id", "account_id")
60
+ */
61
+ accountRemoveV1(contactId: string, accountId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<boolean>;
62
+ private __accountRemoveV1;
33
63
  /**
34
64
  * Creates an organization-created contact. | authz: min_org_role=operator | (ContactClientCreate1) -> (PydanticObjectId)
35
65
  *
@@ -19,6 +19,131 @@ export class Contacts {
19
19
  constructor(_options = {}) {
20
20
  this._options = _options;
21
21
  }
22
+ /**
23
+ * Associates an account from the contact's organization. | authz: min_org_role=operator | (ContactAccountAddReq) -> (bool)
24
+ *
25
+ * @param {string} contactId
26
+ * @param {Chrt.orgs.ContactAccountAddReq} request
27
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link Chrt.UnprocessableEntityError}
30
+ *
31
+ * @example
32
+ * await client.orgs.contacts.accountAddV1("contact_id", {
33
+ * account_id: "account_id"
34
+ * })
35
+ */
36
+ accountAddV1(contactId, request, requestOptions) {
37
+ return core.HttpResponsePromise.fromPromise(this.__accountAddV1(contactId, request, requestOptions));
38
+ }
39
+ __accountAddV1(contactId, request, requestOptions) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ var _a, _b, _c, _d;
42
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
43
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
44
+ 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, `orgs/contacts/accounts/add/v1/${encodeURIComponent(contactId)}`),
45
+ method: "POST",
46
+ headers: _headers,
47
+ contentType: "application/json",
48
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
49
+ requestType: "json",
50
+ body: request,
51
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
52
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
53
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
54
+ });
55
+ if (_response.ok) {
56
+ return { data: _response.body, rawResponse: _response.rawResponse };
57
+ }
58
+ if (_response.error.reason === "status-code") {
59
+ switch (_response.error.statusCode) {
60
+ case 422:
61
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
62
+ default:
63
+ throw new errors.ChrtError({
64
+ statusCode: _response.error.statusCode,
65
+ body: _response.error.body,
66
+ rawResponse: _response.rawResponse,
67
+ });
68
+ }
69
+ }
70
+ switch (_response.error.reason) {
71
+ case "non-json":
72
+ throw new errors.ChrtError({
73
+ statusCode: _response.error.statusCode,
74
+ body: _response.error.rawBody,
75
+ rawResponse: _response.rawResponse,
76
+ });
77
+ case "timeout":
78
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /orgs/contacts/accounts/add/v1/{contact_id}.");
79
+ case "unknown":
80
+ throw new errors.ChrtError({
81
+ message: _response.error.errorMessage,
82
+ rawResponse: _response.rawResponse,
83
+ });
84
+ }
85
+ });
86
+ }
87
+ /**
88
+ * Removes an account association from an organization-created contact. | authz: min_org_role=operator | () -> (bool)
89
+ *
90
+ * @param {string} contactId
91
+ * @param {string} accountId
92
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @throws {@link Chrt.UnprocessableEntityError}
95
+ *
96
+ * @example
97
+ * await client.orgs.contacts.accountRemoveV1("contact_id", "account_id")
98
+ */
99
+ accountRemoveV1(contactId, accountId, requestOptions) {
100
+ return core.HttpResponsePromise.fromPromise(this.__accountRemoveV1(contactId, accountId, requestOptions));
101
+ }
102
+ __accountRemoveV1(contactId, accountId, requestOptions) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ var _a, _b, _c, _d;
105
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
106
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
107
+ 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, `orgs/contacts/accounts/remove/v1/${encodeURIComponent(contactId)}/${encodeURIComponent(accountId)}`),
108
+ method: "DELETE",
109
+ headers: _headers,
110
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
111
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
112
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
113
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
114
+ });
115
+ if (_response.ok) {
116
+ return { data: _response.body, rawResponse: _response.rawResponse };
117
+ }
118
+ if (_response.error.reason === "status-code") {
119
+ switch (_response.error.statusCode) {
120
+ case 422:
121
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
122
+ default:
123
+ throw new errors.ChrtError({
124
+ statusCode: _response.error.statusCode,
125
+ body: _response.error.body,
126
+ rawResponse: _response.rawResponse,
127
+ });
128
+ }
129
+ }
130
+ switch (_response.error.reason) {
131
+ case "non-json":
132
+ throw new errors.ChrtError({
133
+ statusCode: _response.error.statusCode,
134
+ body: _response.error.rawBody,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ case "timeout":
138
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling DELETE /orgs/contacts/accounts/remove/v1/{contact_id}/{account_id}.");
139
+ case "unknown":
140
+ throw new errors.ChrtError({
141
+ message: _response.error.errorMessage,
142
+ rawResponse: _response.rawResponse,
143
+ });
144
+ }
145
+ });
146
+ }
22
147
  /**
23
148
  * Creates an organization-created contact. | authz: min_org_role=operator | (ContactClientCreate1) -> (PydanticObjectId)
24
149
  *
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * account_id: "account_id"
8
+ * }
9
+ */
10
+ export interface ContactAccountAddReq {
11
+ account_id: string;
12
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -10,7 +10,7 @@ import * as Chrt from "../../../../../../index.mjs";
10
10
  * }
11
11
  */
12
12
  export interface ContactClientCreate1 {
13
- account_id?: string | null;
13
+ account_ids?: string[];
14
14
  email_address?: string | null;
15
15
  job_title?: string | null;
16
16
  location?: Chrt.LocationFeature | null;
@@ -1,3 +1,4 @@
1
+ export { type ContactAccountAddReq } from "./ContactAccountAddReq.mjs";
1
2
  export { type ContactClientCreate1 } from "./ContactClientCreate1.mjs";
2
3
  export { type ContactsListV1Request } from "./ContactsListV1Request.mjs";
3
4
  export { type ContactClientUpdate1 } from "./ContactClientUpdate1.mjs";
@@ -30,6 +30,59 @@ export declare namespace Cargos {
30
30
  export declare class Cargos {
31
31
  protected readonly _options: Cargos.Options;
32
32
  constructor(_options?: Cargos.Options);
33
+ /**
34
+ * Adds cargo to a non-DRAFT order. Cargo added to a terminal order starts terminal; otherwise it starts STAGED. | authz_personas=[coordinator_org_operators] | (CargoAddToOrderReq) -> (PydanticObjectId)
35
+ *
36
+ * @param {Chrt.shipping.CargoAddToOrderReq} request
37
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
38
+ *
39
+ * @throws {@link Chrt.UnprocessableEntityError}
40
+ *
41
+ * @example
42
+ * await client.shipping.cargos.addV1({
43
+ * cargo: {
44
+ * cargo_type: "spare_parts",
45
+ * schema_version: 1
46
+ * },
47
+ * order_id: "order_id"
48
+ * })
49
+ */
50
+ addV1(request: Chrt.shipping.CargoAddToOrderReq, requestOptions?: Cargos.RequestOptions): core.HttpResponsePromise<string>;
51
+ private __addV1;
52
+ /**
53
+ * Associates cargo with a task on a non-DRAFT order, then derives cargo status from all associated tasks in the order's task sequence. | authz_personas=[coordinator_org_operators] | (CargoAssociateWithTaskReq) -> (bool)
54
+ *
55
+ * @param {Chrt.shipping.CargoAssociateWithTaskReq} request
56
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link Chrt.UnprocessableEntityError}
59
+ *
60
+ * @example
61
+ * await client.shipping.cargos.associateWithTaskV1({
62
+ * cargo_id: "cargo_id",
63
+ * order_id: "order_id",
64
+ * task_id: "task_id"
65
+ * })
66
+ */
67
+ associateWithTaskV1(request: Chrt.shipping.CargoAssociateWithTaskReq, requestOptions?: Cargos.RequestOptions): core.HttpResponsePromise<boolean>;
68
+ private __associateWithTaskV1;
69
+ /**
70
+ * Removes a cargo association from a task on a non-DRAFT order, then derives cargo status from the remaining associated tasks in the order's task sequence. | authz_personas=[coordinator_org_operators] | (CargoUnassociateWithTaskReq) -> (bool)
71
+ *
72
+ * @param {Chrt.shipping.CargoUnassociateWithTaskReq} request
73
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link Chrt.UnprocessableEntityError}
76
+ *
77
+ * @example
78
+ * await client.shipping.cargos.unassociateWithTaskV1({
79
+ * cargo_id: "cargo_id",
80
+ * order_id: "order_id",
81
+ * task_id: "task_id"
82
+ * })
83
+ */
84
+ unassociateWithTaskV1(request: Chrt.shipping.CargoUnassociateWithTaskReq, requestOptions?: Cargos.RequestOptions): core.HttpResponsePromise<boolean>;
85
+ private __unassociateWithTaskV1;
33
86
  /**
34
87
  * Updates cargo details and synchronizes its parent order's AWB list. Cargo must be in STAGED, IN_TRANSIT, DELIVERED, SKIPPED, or EXCEPTION status. | authz_personas=[lig_owner_operators] | (CargoClientUpdate1) -> (PydanticObjectId)
35
88
  *
@@ -19,6 +19,206 @@ export class Cargos {
19
19
  constructor(_options = {}) {
20
20
  this._options = _options;
21
21
  }
22
+ /**
23
+ * Adds cargo to a non-DRAFT order. Cargo added to a terminal order starts terminal; otherwise it starts STAGED. | authz_personas=[coordinator_org_operators] | (CargoAddToOrderReq) -> (PydanticObjectId)
24
+ *
25
+ * @param {Chrt.shipping.CargoAddToOrderReq} request
26
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link Chrt.UnprocessableEntityError}
29
+ *
30
+ * @example
31
+ * await client.shipping.cargos.addV1({
32
+ * cargo: {
33
+ * cargo_type: "spare_parts",
34
+ * schema_version: 1
35
+ * },
36
+ * order_id: "order_id"
37
+ * })
38
+ */
39
+ addV1(request, requestOptions) {
40
+ return core.HttpResponsePromise.fromPromise(this.__addV1(request, requestOptions));
41
+ }
42
+ __addV1(request, requestOptions) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ var _a, _b, _c, _d;
45
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
46
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
47
+ 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, "shipping/cargos/add/v1"),
48
+ method: "POST",
49
+ headers: _headers,
50
+ contentType: "application/json",
51
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
52
+ requestType: "json",
53
+ body: request,
54
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
55
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
56
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
57
+ });
58
+ if (_response.ok) {
59
+ return { data: _response.body, rawResponse: _response.rawResponse };
60
+ }
61
+ if (_response.error.reason === "status-code") {
62
+ switch (_response.error.statusCode) {
63
+ case 422:
64
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
65
+ default:
66
+ throw new errors.ChrtError({
67
+ statusCode: _response.error.statusCode,
68
+ body: _response.error.body,
69
+ rawResponse: _response.rawResponse,
70
+ });
71
+ }
72
+ }
73
+ switch (_response.error.reason) {
74
+ case "non-json":
75
+ throw new errors.ChrtError({
76
+ statusCode: _response.error.statusCode,
77
+ body: _response.error.rawBody,
78
+ rawResponse: _response.rawResponse,
79
+ });
80
+ case "timeout":
81
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /shipping/cargos/add/v1.");
82
+ case "unknown":
83
+ throw new errors.ChrtError({
84
+ message: _response.error.errorMessage,
85
+ rawResponse: _response.rawResponse,
86
+ });
87
+ }
88
+ });
89
+ }
90
+ /**
91
+ * Associates cargo with a task on a non-DRAFT order, then derives cargo status from all associated tasks in the order's task sequence. | authz_personas=[coordinator_org_operators] | (CargoAssociateWithTaskReq) -> (bool)
92
+ *
93
+ * @param {Chrt.shipping.CargoAssociateWithTaskReq} request
94
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
95
+ *
96
+ * @throws {@link Chrt.UnprocessableEntityError}
97
+ *
98
+ * @example
99
+ * await client.shipping.cargos.associateWithTaskV1({
100
+ * cargo_id: "cargo_id",
101
+ * order_id: "order_id",
102
+ * task_id: "task_id"
103
+ * })
104
+ */
105
+ associateWithTaskV1(request, requestOptions) {
106
+ return core.HttpResponsePromise.fromPromise(this.__associateWithTaskV1(request, requestOptions));
107
+ }
108
+ __associateWithTaskV1(request, requestOptions) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ var _a, _b, _c, _d;
111
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
112
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
113
+ 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, "shipping/cargos/associate_with_task/v1"),
114
+ method: "POST",
115
+ headers: _headers,
116
+ contentType: "application/json",
117
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
118
+ requestType: "json",
119
+ body: request,
120
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
121
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
122
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
123
+ });
124
+ if (_response.ok) {
125
+ return { data: _response.body, rawResponse: _response.rawResponse };
126
+ }
127
+ if (_response.error.reason === "status-code") {
128
+ switch (_response.error.statusCode) {
129
+ case 422:
130
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
131
+ default:
132
+ throw new errors.ChrtError({
133
+ statusCode: _response.error.statusCode,
134
+ body: _response.error.body,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ }
138
+ }
139
+ switch (_response.error.reason) {
140
+ case "non-json":
141
+ throw new errors.ChrtError({
142
+ statusCode: _response.error.statusCode,
143
+ body: _response.error.rawBody,
144
+ rawResponse: _response.rawResponse,
145
+ });
146
+ case "timeout":
147
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /shipping/cargos/associate_with_task/v1.");
148
+ case "unknown":
149
+ throw new errors.ChrtError({
150
+ message: _response.error.errorMessage,
151
+ rawResponse: _response.rawResponse,
152
+ });
153
+ }
154
+ });
155
+ }
156
+ /**
157
+ * Removes a cargo association from a task on a non-DRAFT order, then derives cargo status from the remaining associated tasks in the order's task sequence. | authz_personas=[coordinator_org_operators] | (CargoUnassociateWithTaskReq) -> (bool)
158
+ *
159
+ * @param {Chrt.shipping.CargoUnassociateWithTaskReq} request
160
+ * @param {Cargos.RequestOptions} requestOptions - Request-specific configuration.
161
+ *
162
+ * @throws {@link Chrt.UnprocessableEntityError}
163
+ *
164
+ * @example
165
+ * await client.shipping.cargos.unassociateWithTaskV1({
166
+ * cargo_id: "cargo_id",
167
+ * order_id: "order_id",
168
+ * task_id: "task_id"
169
+ * })
170
+ */
171
+ unassociateWithTaskV1(request, requestOptions) {
172
+ return core.HttpResponsePromise.fromPromise(this.__unassociateWithTaskV1(request, requestOptions));
173
+ }
174
+ __unassociateWithTaskV1(request, requestOptions) {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ var _a, _b, _c, _d;
177
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
178
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
179
+ 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, "shipping/cargos/unassociate_with_task/v1"),
180
+ method: "POST",
181
+ headers: _headers,
182
+ contentType: "application/json",
183
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
184
+ requestType: "json",
185
+ body: request,
186
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
187
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
188
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
189
+ });
190
+ if (_response.ok) {
191
+ return { data: _response.body, rawResponse: _response.rawResponse };
192
+ }
193
+ if (_response.error.reason === "status-code") {
194
+ switch (_response.error.statusCode) {
195
+ case 422:
196
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
197
+ default:
198
+ throw new errors.ChrtError({
199
+ statusCode: _response.error.statusCode,
200
+ body: _response.error.body,
201
+ rawResponse: _response.rawResponse,
202
+ });
203
+ }
204
+ }
205
+ switch (_response.error.reason) {
206
+ case "non-json":
207
+ throw new errors.ChrtError({
208
+ statusCode: _response.error.statusCode,
209
+ body: _response.error.rawBody,
210
+ rawResponse: _response.rawResponse,
211
+ });
212
+ case "timeout":
213
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /shipping/cargos/unassociate_with_task/v1.");
214
+ case "unknown":
215
+ throw new errors.ChrtError({
216
+ message: _response.error.errorMessage,
217
+ rawResponse: _response.rawResponse,
218
+ });
219
+ }
220
+ });
221
+ }
22
222
  /**
23
223
  * Updates cargo details and synchronizes its parent order's AWB list. Cargo must be in STAGED, IN_TRANSIT, DELIVERED, SKIPPED, or EXCEPTION status. | authz_personas=[lig_owner_operators] | (CargoClientUpdate1) -> (PydanticObjectId)
24
224
  *
@@ -1 +1,2 @@
1
1
  export {};
2
+ export * from "./requests/index.mjs";
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../../../../../../index.mjs";
5
+ /**
6
+ * @example
7
+ * {
8
+ * cargo: {
9
+ * cargo_type: "spare_parts",
10
+ * schema_version: 1
11
+ * },
12
+ * order_id: "order_id"
13
+ * }
14
+ */
15
+ export interface CargoAddToOrderReq {
16
+ cargo: Chrt.CargoClientCreate1;
17
+ order_id: string;
18
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * cargo_id: "cargo_id",
8
+ * order_id: "order_id",
9
+ * task_id: "task_id"
10
+ * }
11
+ */
12
+ export interface CargoAssociateWithTaskReq {
13
+ cargo_id: string;
14
+ order_id: string;
15
+ task_id: string;
16
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * cargo_id: "cargo_id",
8
+ * order_id: "order_id",
9
+ * task_id: "task_id"
10
+ * }
11
+ */
12
+ export interface CargoUnassociateWithTaskReq {
13
+ cargo_id: string;
14
+ order_id: string;
15
+ task_id: string;
16
+ }