@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,57 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.mjs";
5
+ import * as core from "../../../../../../core/index.mjs";
6
+ import * as Chrt from "../../../../../index.mjs";
7
+ export declare namespace Courier {
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 | undefined> | 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 headers to include in the request. */
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
+ }
27
+ }
28
+ export declare class Courier {
29
+ protected readonly _options: Courier.Options;
30
+ constructor(_options?: Courier.Options);
31
+ /**
32
+ * Get notification preferences by org id from jwt
33
+ *
34
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.notifications.courier.getNotificationsPreferencesByOrgId()
38
+ */
39
+ getNotificationsPreferencesByOrgId(requestOptions?: Courier.RequestOptions): core.HttpResponsePromise<Chrt.CourierNotificationPreferences1>;
40
+ private __getNotificationsPreferencesByOrgId;
41
+ /**
42
+ * Create/Update notification preferences for org in jwt
43
+ *
44
+ * @param {Chrt.notifications.CourierNotificationPreferencesClientCreate1} request
45
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
46
+ *
47
+ * @throws {@link Chrt.UnprocessableEntityError}
48
+ *
49
+ * @example
50
+ * await client.notifications.courier.postNotificationsPreferencesByOrgId({
51
+ * schema_version: 1
52
+ * })
53
+ */
54
+ postNotificationsPreferencesByOrgId(request: Chrt.notifications.CourierNotificationPreferencesClientCreate1, requestOptions?: Courier.RequestOptions): core.HttpResponsePromise<string>;
55
+ private __postNotificationsPreferencesByOrgId;
56
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
57
+ }
@@ -0,0 +1,142 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ import * as environments from "../../../../../../environments.mjs";
14
+ import * as core from "../../../../../../core/index.mjs";
15
+ import * as Chrt from "../../../../../index.mjs";
16
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
17
+ import * as errors from "../../../../../../errors/index.mjs";
18
+ export class Courier {
19
+ constructor(_options = {}) {
20
+ this._options = _options;
21
+ }
22
+ /**
23
+ * Get notification preferences by org id from jwt
24
+ *
25
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
26
+ *
27
+ * @example
28
+ * await client.notifications.courier.getNotificationsPreferencesByOrgId()
29
+ */
30
+ getNotificationsPreferencesByOrgId(requestOptions) {
31
+ return core.HttpResponsePromise.fromPromise(this.__getNotificationsPreferencesByOrgId(requestOptions));
32
+ }
33
+ __getNotificationsPreferencesByOrgId(requestOptions) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ var _a, _b, _c, _d;
36
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
37
+ 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"),
38
+ method: "GET",
39
+ 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),
40
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
41
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
42
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
43
+ });
44
+ if (_response.ok) {
45
+ return { data: _response.body, rawResponse: _response.rawResponse };
46
+ }
47
+ if (_response.error.reason === "status-code") {
48
+ throw new errors.ChrtError({
49
+ statusCode: _response.error.statusCode,
50
+ body: _response.error.body,
51
+ rawResponse: _response.rawResponse,
52
+ });
53
+ }
54
+ switch (_response.error.reason) {
55
+ case "non-json":
56
+ throw new errors.ChrtError({
57
+ statusCode: _response.error.statusCode,
58
+ body: _response.error.rawBody,
59
+ rawResponse: _response.rawResponse,
60
+ });
61
+ case "timeout":
62
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /notifications/courier_notification_preferences/by_org_id.");
63
+ case "unknown":
64
+ throw new errors.ChrtError({
65
+ message: _response.error.errorMessage,
66
+ rawResponse: _response.rawResponse,
67
+ });
68
+ }
69
+ });
70
+ }
71
+ /**
72
+ * Create/Update notification preferences for org in jwt
73
+ *
74
+ * @param {Chrt.notifications.CourierNotificationPreferencesClientCreate1} request
75
+ * @param {Courier.RequestOptions} requestOptions - Request-specific configuration.
76
+ *
77
+ * @throws {@link Chrt.UnprocessableEntityError}
78
+ *
79
+ * @example
80
+ * await client.notifications.courier.postNotificationsPreferencesByOrgId({
81
+ * schema_version: 1
82
+ * })
83
+ */
84
+ postNotificationsPreferencesByOrgId(request, requestOptions) {
85
+ return core.HttpResponsePromise.fromPromise(this.__postNotificationsPreferencesByOrgId(request, requestOptions));
86
+ }
87
+ __postNotificationsPreferencesByOrgId(request, requestOptions) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ var _a, _b, _c, _d;
90
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
91
+ 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"),
92
+ method: "POST",
93
+ 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),
94
+ contentType: "application/json",
95
+ requestType: "json",
96
+ body: request,
97
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
98
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
99
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
100
+ });
101
+ if (_response.ok) {
102
+ return { data: _response.body, rawResponse: _response.rawResponse };
103
+ }
104
+ if (_response.error.reason === "status-code") {
105
+ switch (_response.error.statusCode) {
106
+ case 422:
107
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
108
+ default:
109
+ throw new errors.ChrtError({
110
+ statusCode: _response.error.statusCode,
111
+ body: _response.error.body,
112
+ rawResponse: _response.rawResponse,
113
+ });
114
+ }
115
+ }
116
+ switch (_response.error.reason) {
117
+ case "non-json":
118
+ throw new errors.ChrtError({
119
+ statusCode: _response.error.statusCode,
120
+ body: _response.error.rawBody,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ case "timeout":
124
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /notifications/courier_notification_preferences/create.");
125
+ case "unknown":
126
+ throw new errors.ChrtError({
127
+ message: _response.error.errorMessage,
128
+ rawResponse: _response.rawResponse,
129
+ });
130
+ }
131
+ });
132
+ }
133
+ _getAuthorizationHeader() {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ const bearer = yield core.Supplier.get(this._options.token);
136
+ if (bearer != null) {
137
+ return `Bearer ${bearer}`;
138
+ }
139
+ return undefined;
140
+ });
141
+ }
142
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -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.mjs";
4
+ import * as Chrt from "../../../../../../index.mjs";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -1,2 +1,4 @@
1
+ export * as courier from "./courier/index.mjs";
1
2
  export * as shipper from "./shipper/index.mjs";
3
+ export * from "./courier/client/requests/index.mjs";
2
4
  export * from "./shipper/client/requests/index.mjs";
@@ -1,2 +1,4 @@
1
+ export * as courier from "./courier/index.mjs";
1
2
  export * as shipper from "./shipper/index.mjs";
3
+ export * from "./courier/client/requests/index.mjs";
2
4
  export * from "./shipper/client/requests/index.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.170-e";
1
+ export declare const SDK_VERSION = "0.0.170-f";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.170-e";
1
+ export const SDK_VERSION = "0.0.170-f";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrt-inc/typescript-sdk",
3
- "version": "0.0.170-e",
3
+ "version": "0.0.170-f",
4
4
  "private": false,
5
5
  "repository": "github:chrt-inc/typescript-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -606,128 +606,6 @@ await client.directory.postShippers();
606
606
  </dl>
607
607
  </details>
608
608
 
609
- ## Notifications
610
-
611
- <details><summary><code>client.notifications.<a href="/src/api/resources/notifications/client/Client.ts">getCourierNotificationsPreferencesByOrgId</a>() -> Chrt.CourierNotificationPreferences1</code></summary>
612
- <dl>
613
- <dd>
614
-
615
- #### 📝 Description
616
-
617
- <dl>
618
- <dd>
619
-
620
- <dl>
621
- <dd>
622
-
623
- Get notification preferences by org id from jwt
624
-
625
- </dd>
626
- </dl>
627
- </dd>
628
- </dl>
629
-
630
- #### 🔌 Usage
631
-
632
- <dl>
633
- <dd>
634
-
635
- <dl>
636
- <dd>
637
-
638
- ```typescript
639
- await client.notifications.getCourierNotificationsPreferencesByOrgId();
640
- ```
641
-
642
- </dd>
643
- </dl>
644
- </dd>
645
- </dl>
646
-
647
- #### ⚙️ Parameters
648
-
649
- <dl>
650
- <dd>
651
-
652
- <dl>
653
- <dd>
654
-
655
- **requestOptions:** `Notifications.RequestOptions`
656
-
657
- </dd>
658
- </dl>
659
- </dd>
660
- </dl>
661
-
662
- </dd>
663
- </dl>
664
- </details>
665
-
666
- <details><summary><code>client.notifications.<a href="/src/api/resources/notifications/client/Client.ts">postCourierNotificationsPreferencesByOrgId</a>({ ...params }) -> string</code></summary>
667
- <dl>
668
- <dd>
669
-
670
- #### 📝 Description
671
-
672
- <dl>
673
- <dd>
674
-
675
- <dl>
676
- <dd>
677
-
678
- Create/Update notification preferences for org in jwt
679
-
680
- </dd>
681
- </dl>
682
- </dd>
683
- </dl>
684
-
685
- #### 🔌 Usage
686
-
687
- <dl>
688
- <dd>
689
-
690
- <dl>
691
- <dd>
692
-
693
- ```typescript
694
- await client.notifications.postCourierNotificationsPreferencesByOrgId({
695
- schema_version: 1,
696
- });
697
- ```
698
-
699
- </dd>
700
- </dl>
701
- </dd>
702
- </dl>
703
-
704
- #### ⚙️ Parameters
705
-
706
- <dl>
707
- <dd>
708
-
709
- <dl>
710
- <dd>
711
-
712
- **request:** `Chrt.CourierNotificationPreferencesClientCreate1`
713
-
714
- </dd>
715
- </dl>
716
-
717
- <dl>
718
- <dd>
719
-
720
- **requestOptions:** `Notifications.RequestOptions`
721
-
722
- </dd>
723
- </dl>
724
- </dd>
725
- </dl>
726
-
727
- </dd>
728
- </dl>
729
- </details>
730
-
731
609
  ## OortConnections
732
610
 
733
611
  <details><summary><code>client.oortConnections.<a href="/src/api/resources/oortConnections/client/Client.ts">getConnectionsInfoForCouriers</a>() -> Chrt.ShipperOrgConnectionInfo1[]</code></summary>
@@ -5738,6 +5616,128 @@ await client.users.getUserPublicData();
5738
5616
  </dl>
5739
5617
  </details>
5740
5618
 
5619
+ ## Notifications Courier
5620
+
5621
+ <details><summary><code>client.notifications.courier.<a href="/src/api/resources/notifications/resources/courier/client/Client.ts">getNotificationsPreferencesByOrgId</a>() -> Chrt.CourierNotificationPreferences1</code></summary>
5622
+ <dl>
5623
+ <dd>
5624
+
5625
+ #### 📝 Description
5626
+
5627
+ <dl>
5628
+ <dd>
5629
+
5630
+ <dl>
5631
+ <dd>
5632
+
5633
+ Get notification preferences by org id from jwt
5634
+
5635
+ </dd>
5636
+ </dl>
5637
+ </dd>
5638
+ </dl>
5639
+
5640
+ #### 🔌 Usage
5641
+
5642
+ <dl>
5643
+ <dd>
5644
+
5645
+ <dl>
5646
+ <dd>
5647
+
5648
+ ```typescript
5649
+ await client.notifications.courier.getNotificationsPreferencesByOrgId();
5650
+ ```
5651
+
5652
+ </dd>
5653
+ </dl>
5654
+ </dd>
5655
+ </dl>
5656
+
5657
+ #### ⚙️ Parameters
5658
+
5659
+ <dl>
5660
+ <dd>
5661
+
5662
+ <dl>
5663
+ <dd>
5664
+
5665
+ **requestOptions:** `Courier.RequestOptions`
5666
+
5667
+ </dd>
5668
+ </dl>
5669
+ </dd>
5670
+ </dl>
5671
+
5672
+ </dd>
5673
+ </dl>
5674
+ </details>
5675
+
5676
+ <details><summary><code>client.notifications.courier.<a href="/src/api/resources/notifications/resources/courier/client/Client.ts">postNotificationsPreferencesByOrgId</a>({ ...params }) -> string</code></summary>
5677
+ <dl>
5678
+ <dd>
5679
+
5680
+ #### 📝 Description
5681
+
5682
+ <dl>
5683
+ <dd>
5684
+
5685
+ <dl>
5686
+ <dd>
5687
+
5688
+ Create/Update notification preferences for org in jwt
5689
+
5690
+ </dd>
5691
+ </dl>
5692
+ </dd>
5693
+ </dl>
5694
+
5695
+ #### 🔌 Usage
5696
+
5697
+ <dl>
5698
+ <dd>
5699
+
5700
+ <dl>
5701
+ <dd>
5702
+
5703
+ ```typescript
5704
+ await client.notifications.courier.postNotificationsPreferencesByOrgId({
5705
+ schema_version: 1,
5706
+ });
5707
+ ```
5708
+
5709
+ </dd>
5710
+ </dl>
5711
+ </dd>
5712
+ </dl>
5713
+
5714
+ #### ⚙️ Parameters
5715
+
5716
+ <dl>
5717
+ <dd>
5718
+
5719
+ <dl>
5720
+ <dd>
5721
+
5722
+ **request:** `Chrt.notifications.CourierNotificationPreferencesClientCreate1`
5723
+
5724
+ </dd>
5725
+ </dl>
5726
+
5727
+ <dl>
5728
+ <dd>
5729
+
5730
+ **requestOptions:** `Courier.RequestOptions`
5731
+
5732
+ </dd>
5733
+ </dl>
5734
+ </dd>
5735
+ </dl>
5736
+
5737
+ </dd>
5738
+ </dl>
5739
+ </details>
5740
+
5741
5741
  ## Notifications Shipper
5742
5742
 
5743
5743
  <details><summary><code>client.notifications.shipper.<a href="/src/api/resources/notifications/resources/shipper/client/Client.ts">getNotificationsPreferencesByOrgId</a>() -> Chrt.ShipperNotificationPreferences1</code></summary>