@chrt-inc/typescript-sdk 0.0.170-e → 0.0.170-f

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 (46) hide show
  1. package/dist/cjs/Client.d.ts +3 -3
  2. package/dist/cjs/Client.js +39 -39
  3. package/dist/cjs/api/resources/index.d.ts +1 -2
  4. package/dist/cjs/api/resources/index.js +2 -3
  5. package/dist/cjs/api/resources/notifications/client/Client.d.ts +3 -37
  6. package/dist/cjs/api/resources/notifications/client/Client.js +7 -169
  7. package/dist/cjs/api/resources/notifications/client/index.d.ts +0 -1
  8. package/dist/cjs/api/resources/notifications/client/index.js +0 -15
  9. package/dist/cjs/api/resources/notifications/resources/courier/client/Client.d.ts +57 -0
  10. package/dist/cjs/api/resources/notifications/resources/courier/client/Client.js +179 -0
  11. package/dist/cjs/api/resources/notifications/resources/courier/client/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/notifications/resources/courier/client/index.js +17 -0
  13. package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.d.ts +1 -1
  14. package/dist/cjs/api/resources/notifications/resources/courier/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/notifications/resources/courier/index.js +17 -0
  16. package/dist/cjs/api/resources/notifications/resources/index.d.ts +2 -0
  17. package/dist/cjs/api/resources/notifications/resources/index.js +3 -1
  18. package/dist/cjs/version.d.ts +1 -1
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/esm/Client.d.mts +3 -3
  21. package/dist/esm/Client.mjs +7 -7
  22. package/dist/esm/api/resources/index.d.mts +1 -2
  23. package/dist/esm/api/resources/index.mjs +1 -2
  24. package/dist/esm/api/resources/notifications/client/Client.d.mts +3 -37
  25. package/dist/esm/api/resources/notifications/client/Client.mjs +5 -134
  26. package/dist/esm/api/resources/notifications/client/index.d.mts +0 -1
  27. package/dist/esm/api/resources/notifications/client/index.mjs +1 -1
  28. package/dist/esm/api/resources/notifications/resources/courier/client/Client.d.mts +57 -0
  29. package/dist/esm/api/resources/notifications/resources/courier/client/Client.mjs +142 -0
  30. package/dist/esm/api/resources/notifications/resources/courier/client/index.d.mts +2 -0
  31. package/dist/esm/api/resources/notifications/resources/courier/client/index.mjs +1 -0
  32. package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.d.mts +1 -1
  33. package/dist/esm/api/resources/notifications/resources/courier/index.d.mts +1 -0
  34. package/dist/esm/api/resources/notifications/resources/courier/index.mjs +1 -0
  35. package/dist/esm/api/resources/notifications/resources/index.d.mts +2 -0
  36. package/dist/esm/api/resources/notifications/resources/index.mjs +2 -0
  37. package/dist/esm/version.d.mts +1 -1
  38. package/dist/esm/version.mjs +1 -1
  39. package/package.json +1 -1
  40. package/reference.md +122 -122
  41. /package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.js +0 -0
  42. /package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/index.d.ts +0 -0
  43. /package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/index.js +0 -0
  44. /package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.mjs +0 -0
  45. /package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/index.d.mts +0 -0
  46. /package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/index.mjs +0 -0
@@ -0,0 +1,179 @@
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.Courier = 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 Courier {
55
+ constructor(_options = {}) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * Get notification preferences by org id from jwt
60
+ *
61
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
62
+ *
63
+ * @example
64
+ * await client.notifications.courier.getNotificationsPreferencesByOrgId()
65
+ */
66
+ getNotificationsPreferencesByOrgId(requestOptions) {
67
+ return core.HttpResponsePromise.fromPromise(this.__getNotificationsPreferencesByOrgId(requestOptions));
68
+ }
69
+ __getNotificationsPreferencesByOrgId(requestOptions) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ var _a, _b, _c, _d;
72
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
73
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "notifications/courier_notification_preferences/by_org_id"),
74
+ method: "GET",
75
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
76
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
77
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
78
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
79
+ });
80
+ if (_response.ok) {
81
+ return { data: _response.body, rawResponse: _response.rawResponse };
82
+ }
83
+ if (_response.error.reason === "status-code") {
84
+ throw new errors.ChrtError({
85
+ statusCode: _response.error.statusCode,
86
+ body: _response.error.body,
87
+ rawResponse: _response.rawResponse,
88
+ });
89
+ }
90
+ switch (_response.error.reason) {
91
+ case "non-json":
92
+ throw new errors.ChrtError({
93
+ statusCode: _response.error.statusCode,
94
+ body: _response.error.rawBody,
95
+ rawResponse: _response.rawResponse,
96
+ });
97
+ case "timeout":
98
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /notifications/courier_notification_preferences/by_org_id.");
99
+ case "unknown":
100
+ throw new errors.ChrtError({
101
+ message: _response.error.errorMessage,
102
+ rawResponse: _response.rawResponse,
103
+ });
104
+ }
105
+ });
106
+ }
107
+ /**
108
+ * Create/Update notification preferences for org in jwt
109
+ *
110
+ * @param {Chrt.notifications.CourierNotificationPreferencesClientCreate1} request
111
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link Chrt.UnprocessableEntityError}
114
+ *
115
+ * @example
116
+ * await client.notifications.courier.postNotificationsPreferencesByOrgId({
117
+ * schema_version: 1
118
+ * })
119
+ */
120
+ postNotificationsPreferencesByOrgId(request, requestOptions) {
121
+ return core.HttpResponsePromise.fromPromise(this.__postNotificationsPreferencesByOrgId(request, requestOptions));
122
+ }
123
+ __postNotificationsPreferencesByOrgId(request, requestOptions) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ var _a, _b, _c, _d;
126
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
127
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "notifications/courier_notification_preferences/create"),
128
+ method: "POST",
129
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
130
+ contentType: "application/json",
131
+ requestType: "json",
132
+ body: request,
133
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
134
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
135
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
136
+ });
137
+ if (_response.ok) {
138
+ return { data: _response.body, rawResponse: _response.rawResponse };
139
+ }
140
+ if (_response.error.reason === "status-code") {
141
+ switch (_response.error.statusCode) {
142
+ case 422:
143
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
144
+ default:
145
+ throw new errors.ChrtError({
146
+ statusCode: _response.error.statusCode,
147
+ body: _response.error.body,
148
+ rawResponse: _response.rawResponse,
149
+ });
150
+ }
151
+ }
152
+ switch (_response.error.reason) {
153
+ case "non-json":
154
+ throw new errors.ChrtError({
155
+ statusCode: _response.error.statusCode,
156
+ body: _response.error.rawBody,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ case "timeout":
160
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /notifications/courier_notification_preferences/create.");
161
+ case "unknown":
162
+ throw new errors.ChrtError({
163
+ message: _response.error.errorMessage,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ });
168
+ }
169
+ _getAuthorizationHeader() {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ const bearer = yield core.Supplier.get(this._options.token);
172
+ if (bearer != null) {
173
+ return `Bearer ${bearer}`;
174
+ }
175
+ return undefined;
176
+ });
177
+ }
178
+ }
179
+ exports.Courier = Courier;
@@ -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);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Chrt from "../../../../index.js";
4
+ import * as Chrt from "../../../../../../index.js";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -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);
@@ -1,2 +1,4 @@
1
+ export * as courier from "./courier/index.js";
1
2
  export * as shipper from "./shipper/index.js";
3
+ export * from "./courier/client/requests/index.js";
2
4
  export * from "./shipper/client/requests/index.js";
@@ -36,6 +36,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.shipper = void 0;
39
+ exports.shipper = exports.courier = void 0;
40
+ exports.courier = __importStar(require("./courier/index.js"));
40
41
  exports.shipper = __importStar(require("./shipper/index.js"));
42
+ __exportStar(require("./courier/client/requests/index.js"), exports);
41
43
  __exportStar(require("./shipper/client/requests/index.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.170-e";
1
+ export declare const SDK_VERSION = "0.0.170-f";
@@ -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 = "0.0.170-e";
4
+ exports.SDK_VERSION = "0.0.170-f";
@@ -6,7 +6,6 @@ import * as core from "./core/index.mjs";
6
6
  import { Root } from "./api/resources/root/client/Client.mjs";
7
7
  import { Dev } from "./api/resources/dev/client/Client.mjs";
8
8
  import { Directory } from "./api/resources/directory/client/Client.mjs";
9
- import { Notifications } from "./api/resources/notifications/client/Client.mjs";
10
9
  import { OortConnections } from "./api/resources/oortConnections/client/Client.mjs";
11
10
  import { OortCourierPayDriverLineItemGroups } from "./api/resources/oortCourierPayDriverLineItemGroups/client/Client.mjs";
12
11
  import { OortCourierPayDriverPayouts } from "./api/resources/oortCourierPayDriverPayouts/client/Client.mjs";
@@ -23,6 +22,7 @@ import { OortTaskGroups } from "./api/resources/oortTaskGroups/client/Client.mjs
23
22
  import { Orgs } from "./api/resources/orgs/client/Client.mjs";
24
23
  import { Payments } from "./api/resources/payments/client/Client.mjs";
25
24
  import { Users } from "./api/resources/users/client/Client.mjs";
25
+ import { Notifications } from "./api/resources/notifications/client/Client.mjs";
26
26
  export declare namespace ChrtClient {
27
27
  interface Options {
28
28
  environment?: core.Supplier<environments.ChrtEnvironment | string>;
@@ -49,7 +49,6 @@ export declare class ChrtClient {
49
49
  protected _root: Root | undefined;
50
50
  protected _dev: Dev | undefined;
51
51
  protected _directory: Directory | undefined;
52
- protected _notifications: Notifications | undefined;
53
52
  protected _oortConnections: OortConnections | undefined;
54
53
  protected _oortCourierPayDriverLineItemGroups: OortCourierPayDriverLineItemGroups | undefined;
55
54
  protected _oortCourierPayDriverPayouts: OortCourierPayDriverPayouts | undefined;
@@ -66,11 +65,11 @@ export declare class ChrtClient {
66
65
  protected _orgs: Orgs | undefined;
67
66
  protected _payments: Payments | undefined;
68
67
  protected _users: Users | undefined;
68
+ protected _notifications: Notifications | undefined;
69
69
  constructor(_options?: ChrtClient.Options);
70
70
  get root(): Root;
71
71
  get dev(): Dev;
72
72
  get directory(): Directory;
73
- get notifications(): Notifications;
74
73
  get oortConnections(): OortConnections;
75
74
  get oortCourierPayDriverLineItemGroups(): OortCourierPayDriverLineItemGroups;
76
75
  get oortCourierPayDriverPayouts(): OortCourierPayDriverPayouts;
@@ -87,4 +86,5 @@ export declare class ChrtClient {
87
86
  get orgs(): Orgs;
88
87
  get payments(): Payments;
89
88
  get users(): Users;
89
+ get notifications(): Notifications;
90
90
  }
@@ -6,7 +6,6 @@ import { mergeHeaders } from "./core/headers.mjs";
6
6
  import { Root } from "./api/resources/root/client/Client.mjs";
7
7
  import { Dev } from "./api/resources/dev/client/Client.mjs";
8
8
  import { Directory } from "./api/resources/directory/client/Client.mjs";
9
- import { Notifications } from "./api/resources/notifications/client/Client.mjs";
10
9
  import { OortConnections } from "./api/resources/oortConnections/client/Client.mjs";
11
10
  import { OortCourierPayDriverLineItemGroups } from "./api/resources/oortCourierPayDriverLineItemGroups/client/Client.mjs";
12
11
  import { OortCourierPayDriverPayouts } from "./api/resources/oortCourierPayDriverPayouts/client/Client.mjs";
@@ -23,13 +22,14 @@ import { OortTaskGroups } from "./api/resources/oortTaskGroups/client/Client.mjs
23
22
  import { Orgs } from "./api/resources/orgs/client/Client.mjs";
24
23
  import { Payments } from "./api/resources/payments/client/Client.mjs";
25
24
  import { Users } from "./api/resources/users/client/Client.mjs";
25
+ import { Notifications } from "./api/resources/notifications/client/Client.mjs";
26
26
  export class ChrtClient {
27
27
  constructor(_options = {}) {
28
28
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
29
29
  "X-Fern-Language": "JavaScript",
30
30
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
31
- "X-Fern-SDK-Version": "0.0.170-e",
32
- "User-Agent": "@chrt-inc/typescript-sdk/0.0.170-e",
31
+ "X-Fern-SDK-Version": "0.0.170-f",
32
+ "User-Agent": "@chrt-inc/typescript-sdk/0.0.170-f",
33
33
  "X-Fern-Runtime": core.RUNTIME.type,
34
34
  "X-Fern-Runtime-Version": core.RUNTIME.version,
35
35
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -46,10 +46,6 @@ export class ChrtClient {
46
46
  var _a;
47
47
  return ((_a = this._directory) !== null && _a !== void 0 ? _a : (this._directory = new Directory(this._options)));
48
48
  }
49
- get notifications() {
50
- var _a;
51
- return ((_a = this._notifications) !== null && _a !== void 0 ? _a : (this._notifications = new Notifications(this._options)));
52
- }
53
49
  get oortConnections() {
54
50
  var _a;
55
51
  return ((_a = this._oortConnections) !== null && _a !== void 0 ? _a : (this._oortConnections = new OortConnections(this._options)));
@@ -114,4 +110,8 @@ export class ChrtClient {
114
110
  var _a;
115
111
  return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Users(this._options)));
116
112
  }
113
+ get notifications() {
114
+ var _a;
115
+ return ((_a = this._notifications) !== null && _a !== void 0 ? _a : (this._notifications = new Notifications(this._options)));
116
+ }
117
117
  }
@@ -2,7 +2,6 @@ export * as root from "./root/index.mjs";
2
2
  export * from "./root/types/index.mjs";
3
3
  export * as dev from "./dev/index.mjs";
4
4
  export * as directory from "./directory/index.mjs";
5
- export * as notifications from "./notifications/index.mjs";
6
5
  export * as oortConnections from "./oortConnections/index.mjs";
7
6
  export * as oortCourierPayDriverLineItemGroups from "./oortCourierPayDriverLineItemGroups/index.mjs";
8
7
  export * as oortCourierPayDriverPayouts from "./oortCourierPayDriverPayouts/index.mjs";
@@ -19,9 +18,9 @@ export * as oortTaskGroups from "./oortTaskGroups/index.mjs";
19
18
  export * as orgs from "./orgs/index.mjs";
20
19
  export * as payments from "./payments/index.mjs";
21
20
  export * as users from "./users/index.mjs";
21
+ export * as notifications from "./notifications/index.mjs";
22
22
  export * from "./dev/client/requests/index.mjs";
23
23
  export * from "./directory/client/requests/index.mjs";
24
- export * from "./notifications/client/requests/index.mjs";
25
24
  export * from "./oortConnections/client/requests/index.mjs";
26
25
  export * from "./oortCourierPayDriverLineItemGroups/client/requests/index.mjs";
27
26
  export * from "./oortCourierPayDriverPayouts/client/requests/index.mjs";
@@ -2,7 +2,6 @@ export * as root from "./root/index.mjs";
2
2
  export * from "./root/types/index.mjs";
3
3
  export * as dev from "./dev/index.mjs";
4
4
  export * as directory from "./directory/index.mjs";
5
- export * as notifications from "./notifications/index.mjs";
6
5
  export * as oortConnections from "./oortConnections/index.mjs";
7
6
  export * as oortCourierPayDriverLineItemGroups from "./oortCourierPayDriverLineItemGroups/index.mjs";
8
7
  export * as oortCourierPayDriverPayouts from "./oortCourierPayDriverPayouts/index.mjs";
@@ -19,9 +18,9 @@ export * as oortTaskGroups from "./oortTaskGroups/index.mjs";
19
18
  export * as orgs from "./orgs/index.mjs";
20
19
  export * as payments from "./payments/index.mjs";
21
20
  export * as users from "./users/index.mjs";
21
+ export * as notifications from "./notifications/index.mjs";
22
22
  export * from "./dev/client/requests/index.mjs";
23
23
  export * from "./directory/client/requests/index.mjs";
24
- export * from "./notifications/client/requests/index.mjs";
25
24
  export * from "./oortConnections/client/requests/index.mjs";
26
25
  export * from "./oortCourierPayDriverLineItemGroups/client/requests/index.mjs";
27
26
  export * from "./oortCourierPayDriverPayouts/client/requests/index.mjs";
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as environments from "../../../../environments.mjs";
5
5
  import * as core from "../../../../core/index.mjs";
6
- import * as Chrt from "../../../index.mjs";
6
+ import { Courier } from "../resources/courier/client/Client.mjs";
7
7
  import { Shipper } from "../resources/shipper/client/Client.mjs";
8
8
  export declare namespace Notifications {
9
9
  interface Options {
@@ -15,46 +15,12 @@ export declare namespace Notifications {
15
15
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
16
  fetcher?: core.FetchFunction;
17
17
  }
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 headers to include in the request. */
26
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
- }
28
18
  }
29
19
  export declare class Notifications {
30
20
  protected readonly _options: Notifications.Options;
21
+ protected _courier: Courier | undefined;
31
22
  protected _shipper: Shipper | undefined;
32
23
  constructor(_options?: Notifications.Options);
24
+ get courier(): Courier;
33
25
  get shipper(): Shipper;
34
- /**
35
- * Get notification preferences by org id from jwt
36
- *
37
- * @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
38
- *
39
- * @example
40
- * await client.notifications.getCourierNotificationsPreferencesByOrgId()
41
- */
42
- getCourierNotificationsPreferencesByOrgId(requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<Chrt.CourierNotificationPreferences1>;
43
- private __getCourierNotificationsPreferencesByOrgId;
44
- /**
45
- * Create/Update notification preferences for org in jwt
46
- *
47
- * @param {Chrt.CourierNotificationPreferencesClientCreate1} request
48
- * @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
49
- *
50
- * @throws {@link Chrt.UnprocessableEntityError}
51
- *
52
- * @example
53
- * await client.notifications.postCourierNotificationsPreferencesByOrgId({
54
- * schema_version: 1
55
- * })
56
- */
57
- postCourierNotificationsPreferencesByOrgId(request: Chrt.CourierNotificationPreferencesClientCreate1, requestOptions?: Notifications.RequestOptions): core.HttpResponsePromise<string>;
58
- private __postCourierNotificationsPreferencesByOrgId;
59
- protected _getAuthorizationHeader(): Promise<string | undefined>;
60
26
  }
@@ -1,147 +1,18 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
- return new (P || (P = Promise))(function (resolve, reject) {
7
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
- step((generator = generator.apply(thisArg, _arguments || [])).next());
11
- });
12
- };
13
- import * as environments from "../../../../environments.mjs";
14
- import * as core from "../../../../core/index.mjs";
15
- import * as Chrt from "../../../index.mjs";
16
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
17
- import * as errors from "../../../../errors/index.mjs";
4
+ import { Courier } from "../resources/courier/client/Client.mjs";
18
5
  import { Shipper } from "../resources/shipper/client/Client.mjs";
19
6
  export class Notifications {
20
7
  constructor(_options = {}) {
21
8
  this._options = _options;
22
9
  }
10
+ get courier() {
11
+ var _a;
12
+ return ((_a = this._courier) !== null && _a !== void 0 ? _a : (this._courier = new Courier(this._options)));
13
+ }
23
14
  get shipper() {
24
15
  var _a;
25
16
  return ((_a = this._shipper) !== null && _a !== void 0 ? _a : (this._shipper = new Shipper(this._options)));
26
17
  }
27
- /**
28
- * Get notification preferences by org id from jwt
29
- *
30
- * @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
31
- *
32
- * @example
33
- * await client.notifications.getCourierNotificationsPreferencesByOrgId()
34
- */
35
- getCourierNotificationsPreferencesByOrgId(requestOptions) {
36
- return core.HttpResponsePromise.fromPromise(this.__getCourierNotificationsPreferencesByOrgId(requestOptions));
37
- }
38
- __getCourierNotificationsPreferencesByOrgId(requestOptions) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- var _a, _b, _c, _d;
41
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
42
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "notifications/courier_notification_preferences/by_org_id"),
43
- method: "GET",
44
- headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
45
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
46
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
47
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
48
- });
49
- if (_response.ok) {
50
- return { data: _response.body, rawResponse: _response.rawResponse };
51
- }
52
- if (_response.error.reason === "status-code") {
53
- throw new errors.ChrtError({
54
- statusCode: _response.error.statusCode,
55
- body: _response.error.body,
56
- rawResponse: _response.rawResponse,
57
- });
58
- }
59
- switch (_response.error.reason) {
60
- case "non-json":
61
- throw new errors.ChrtError({
62
- statusCode: _response.error.statusCode,
63
- body: _response.error.rawBody,
64
- rawResponse: _response.rawResponse,
65
- });
66
- case "timeout":
67
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /notifications/courier_notification_preferences/by_org_id.");
68
- case "unknown":
69
- throw new errors.ChrtError({
70
- message: _response.error.errorMessage,
71
- rawResponse: _response.rawResponse,
72
- });
73
- }
74
- });
75
- }
76
- /**
77
- * Create/Update notification preferences for org in jwt
78
- *
79
- * @param {Chrt.CourierNotificationPreferencesClientCreate1} request
80
- * @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
81
- *
82
- * @throws {@link Chrt.UnprocessableEntityError}
83
- *
84
- * @example
85
- * await client.notifications.postCourierNotificationsPreferencesByOrgId({
86
- * schema_version: 1
87
- * })
88
- */
89
- postCourierNotificationsPreferencesByOrgId(request, requestOptions) {
90
- return core.HttpResponsePromise.fromPromise(this.__postCourierNotificationsPreferencesByOrgId(request, requestOptions));
91
- }
92
- __postCourierNotificationsPreferencesByOrgId(request, requestOptions) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- var _a, _b, _c, _d;
95
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
96
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "notifications/courier_notification_preferences/create"),
97
- method: "POST",
98
- headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
99
- contentType: "application/json",
100
- requestType: "json",
101
- body: request,
102
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
103
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
104
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
105
- });
106
- if (_response.ok) {
107
- return { data: _response.body, rawResponse: _response.rawResponse };
108
- }
109
- if (_response.error.reason === "status-code") {
110
- switch (_response.error.statusCode) {
111
- case 422:
112
- throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
113
- default:
114
- throw new errors.ChrtError({
115
- statusCode: _response.error.statusCode,
116
- body: _response.error.body,
117
- rawResponse: _response.rawResponse,
118
- });
119
- }
120
- }
121
- switch (_response.error.reason) {
122
- case "non-json":
123
- throw new errors.ChrtError({
124
- statusCode: _response.error.statusCode,
125
- body: _response.error.rawBody,
126
- rawResponse: _response.rawResponse,
127
- });
128
- case "timeout":
129
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /notifications/courier_notification_preferences/create.");
130
- case "unknown":
131
- throw new errors.ChrtError({
132
- message: _response.error.errorMessage,
133
- rawResponse: _response.rawResponse,
134
- });
135
- }
136
- });
137
- }
138
- _getAuthorizationHeader() {
139
- return __awaiter(this, void 0, void 0, function* () {
140
- const bearer = yield core.Supplier.get(this._options.token);
141
- if (bearer != null) {
142
- return `Bearer ${bearer}`;
143
- }
144
- return undefined;
145
- });
146
- }
147
18
  }
@@ -1,2 +1 @@
1
1
  export {};
2
- export * from "./requests/index.mjs";
@@ -1 +1 @@
1
- export * from "./requests/index.mjs";
1
+ export {};