@chrt-inc/typescript-sdk 0.0.170-e → 0.0.170-g
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/dist/cjs/Client.d.ts +3 -6
- package/dist/cjs/Client.js +39 -44
- package/dist/cjs/api/index.d.ts +1 -1
- package/dist/cjs/api/index.js +1 -1
- package/dist/cjs/api/resources/index.d.ts +1 -5
- package/dist/cjs/api/resources/index.js +2 -6
- package/dist/cjs/api/resources/notifications/client/Client.d.ts +3 -37
- package/dist/cjs/api/resources/notifications/client/Client.js +7 -169
- package/dist/cjs/api/resources/notifications/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/notifications/client/index.js +0 -15
- package/dist/cjs/api/resources/notifications/resources/courier/client/Client.d.ts +57 -0
- package/dist/cjs/api/resources/{directory → notifications/resources/courier}/client/Client.js +69 -18
- package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.d.ts +1 -1
- package/dist/cjs/api/resources/notifications/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/notifications/resources/index.js +3 -1
- package/dist/cjs/api/resources/notifications/resources/shipper/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/notifications/resources/shipper/client/Client.js +12 -12
- package/dist/cjs/api/resources/oortOffChrtShipperOrgConnectionInfo/client/Client.d.ts +10 -0
- package/dist/cjs/api/resources/oortOffChrtShipperOrgConnectionInfo/client/Client.js +52 -0
- package/dist/cjs/api/resources/orgs/client/Client.d.ts +18 -18
- package/dist/cjs/api/resources/orgs/client/Client.js +30 -30
- package/dist/cjs/api/resources/payments/client/Client.d.ts +0 -8
- package/dist/cjs/api/resources/payments/client/Client.js +0 -47
- package/dist/cjs/api/resources/root/client/Client.d.ts +15 -34
- package/dist/cjs/api/resources/root/client/Client.js +20 -116
- package/dist/cjs/api/resources/root/index.d.ts +0 -1
- package/dist/cjs/api/resources/root/index.js +0 -1
- package/dist/cjs/api/resources/users/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/users/client/Client.js +4 -4
- package/dist/cjs/api/types/index.d.ts +0 -2
- package/dist/cjs/api/types/index.js +0 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -6
- package/dist/esm/Client.mjs +7 -12
- package/dist/esm/api/index.d.mts +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/resources/index.d.mts +1 -5
- package/dist/esm/api/resources/index.mjs +1 -5
- package/dist/esm/api/resources/notifications/client/Client.d.mts +3 -37
- package/dist/esm/api/resources/notifications/client/Client.mjs +5 -134
- package/dist/esm/api/resources/notifications/client/index.d.mts +0 -1
- package/dist/esm/api/resources/notifications/client/index.mjs +1 -1
- package/dist/esm/api/resources/notifications/resources/courier/client/Client.d.mts +57 -0
- package/dist/esm/api/resources/notifications/resources/courier/client/Client.mjs +142 -0
- package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.d.mts +1 -1
- package/dist/esm/api/resources/notifications/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/notifications/resources/index.mjs +2 -0
- package/dist/esm/api/resources/notifications/resources/shipper/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/notifications/resources/shipper/client/Client.mjs +12 -12
- package/dist/esm/api/resources/oortOffChrtShipperOrgConnectionInfo/client/Client.d.mts +10 -0
- package/dist/esm/api/resources/oortOffChrtShipperOrgConnectionInfo/client/Client.mjs +52 -0
- package/dist/esm/api/resources/orgs/client/Client.d.mts +18 -18
- package/dist/esm/api/resources/orgs/client/Client.mjs +30 -30
- package/dist/esm/api/resources/payments/client/Client.d.mts +0 -8
- package/dist/esm/api/resources/payments/client/Client.mjs +0 -47
- package/dist/esm/api/resources/root/client/Client.d.mts +15 -34
- package/dist/esm/api/resources/root/client/Client.mjs +20 -116
- package/dist/esm/api/resources/root/index.d.mts +0 -1
- package/dist/esm/api/resources/root/index.mjs +0 -1
- package/dist/esm/api/resources/users/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/users/client/Client.mjs +4 -4
- package/dist/esm/api/types/index.d.mts +0 -2
- package/dist/esm/api/types/index.mjs +0 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +170 -315
- package/dist/cjs/api/resources/directory/client/Client.d.ts +0 -45
- package/dist/cjs/api/resources/directory/client/requests/DbQueryParams.d.ts +0 -12
- package/dist/cjs/api/resources/directory/client/requests/DbQueryParams.js +0 -5
- package/dist/cjs/api/resources/directory/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/notifications/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/root/types/PydanticResponse.d.ts +0 -8
- package/dist/cjs/api/resources/root/types/PydanticResponse.js +0 -5
- package/dist/cjs/api/resources/root/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/root/types/index.js +0 -17
- package/dist/cjs/api/types/Shipper2.d.ts +0 -20
- package/dist/cjs/api/types/Shipper2.js +0 -5
- package/dist/cjs/api/types/StreetAddress1.d.ts +0 -18
- package/dist/cjs/api/types/StreetAddress1.js +0 -5
- package/dist/esm/api/resources/directory/client/Client.d.mts +0 -45
- package/dist/esm/api/resources/directory/client/Client.mjs +0 -91
- package/dist/esm/api/resources/directory/client/requests/DbQueryParams.d.mts +0 -12
- package/dist/esm/api/resources/directory/client/requests/DbQueryParams.mjs +0 -4
- package/dist/esm/api/resources/directory/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/notifications/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/root/types/PydanticResponse.d.mts +0 -8
- package/dist/esm/api/resources/root/types/PydanticResponse.mjs +0 -4
- package/dist/esm/api/resources/root/types/index.d.mts +0 -1
- package/dist/esm/api/resources/root/types/index.mjs +0 -1
- package/dist/esm/api/types/Shipper2.d.mts +0 -20
- package/dist/esm/api/types/Shipper2.mjs +0 -4
- package/dist/esm/api/types/StreetAddress1.d.mts +0 -18
- package/dist/esm/api/types/StreetAddress1.mjs +0 -4
- /package/dist/cjs/api/resources/{directory → notifications/resources/courier}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{directory → notifications/resources/courier}/client/index.js +0 -0
- /package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.js +0 -0
- /package/dist/cjs/api/resources/notifications/{client → resources/courier/client}/requests/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{directory → notifications/resources/courier}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{directory → notifications/resources/courier}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{directory → notifications/resources/courier}/index.js +0 -0
- /package/dist/esm/api/resources/{directory → notifications/resources/courier}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{directory → notifications/resources/courier}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/CourierNotificationPreferencesClientCreate1.mjs +0 -0
- /package/dist/esm/api/resources/notifications/{client → resources/courier/client}/requests/index.d.mts +0 -0
- /package/dist/esm/api/resources/{directory → notifications/resources/courier}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{directory → notifications/resources/courier}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{directory → notifications/resources/courier}/index.mjs +0 -0
package/README.md
CHANGED
|
@@ -23,7 +23,11 @@ Instantiate and use the client with the following:
|
|
|
23
23
|
import { ChrtClient } from "@chrt-inc/typescript-sdk";
|
|
24
24
|
|
|
25
25
|
const client = new ChrtClient({ token: "YOUR_TOKEN" });
|
|
26
|
-
await client.
|
|
26
|
+
await client.dev.postTemplate({
|
|
27
|
+
message: "message",
|
|
28
|
+
number: 1,
|
|
29
|
+
timestamp: "2024-01-15T09:30:00Z",
|
|
30
|
+
});
|
|
27
31
|
```
|
|
28
32
|
|
|
29
33
|
## Request And Response Types
|
|
@@ -48,7 +52,7 @@ will be thrown.
|
|
|
48
52
|
import { ChrtError } from "@chrt-inc/typescript-sdk";
|
|
49
53
|
|
|
50
54
|
try {
|
|
51
|
-
await client.
|
|
55
|
+
await client.dev.postTemplate(...);
|
|
52
56
|
} catch (err) {
|
|
53
57
|
if (err instanceof ChrtError) {
|
|
54
58
|
console.log(err.statusCode);
|
|
@@ -66,7 +70,7 @@ try {
|
|
|
66
70
|
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
67
71
|
|
|
68
72
|
```typescript
|
|
69
|
-
const response = await client.
|
|
73
|
+
const response = await client.dev.postTemplate(..., {
|
|
70
74
|
headers: {
|
|
71
75
|
'X-Custom-Header': 'custom value'
|
|
72
76
|
}
|
|
@@ -88,7 +92,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
|
|
|
88
92
|
Use the `maxRetries` request option to configure this behavior.
|
|
89
93
|
|
|
90
94
|
```typescript
|
|
91
|
-
const response = await client.
|
|
95
|
+
const response = await client.dev.postTemplate(..., {
|
|
92
96
|
maxRetries: 0 // override maxRetries at the request level
|
|
93
97
|
});
|
|
94
98
|
```
|
|
@@ -98,7 +102,7 @@ const response = await client.root.postAuthd(..., {
|
|
|
98
102
|
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
99
103
|
|
|
100
104
|
```typescript
|
|
101
|
-
const response = await client.
|
|
105
|
+
const response = await client.dev.postTemplate(..., {
|
|
102
106
|
timeoutInSeconds: 30 // override timeout to 30s
|
|
103
107
|
});
|
|
104
108
|
```
|
|
@@ -109,7 +113,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
|
|
|
109
113
|
|
|
110
114
|
```typescript
|
|
111
115
|
const controller = new AbortController();
|
|
112
|
-
const response = await client.
|
|
116
|
+
const response = await client.dev.postTemplate(..., {
|
|
113
117
|
abortSignal: controller.signal
|
|
114
118
|
});
|
|
115
119
|
controller.abort(); // aborts the request
|
|
@@ -121,7 +125,7 @@ The SDK provides access to raw response data, including headers, through the `.w
|
|
|
121
125
|
The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
|
|
122
126
|
|
|
123
127
|
```typescript
|
|
124
|
-
const { data, rawResponse } = await client.
|
|
128
|
+
const { data, rawResponse } = await client.dev.postTemplate(...).withRawResponse();
|
|
125
129
|
|
|
126
130
|
console.log(data);
|
|
127
131
|
console.log(rawResponse.headers['X-My-Header']);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import * as environments from "./environments.js";
|
|
|
5
5
|
import * as core from "./core/index.js";
|
|
6
6
|
import { Root } from "./api/resources/root/client/Client.js";
|
|
7
7
|
import { Dev } from "./api/resources/dev/client/Client.js";
|
|
8
|
-
import { Directory } from "./api/resources/directory/client/Client.js";
|
|
9
|
-
import { Notifications } from "./api/resources/notifications/client/Client.js";
|
|
10
8
|
import { OortConnections } from "./api/resources/oortConnections/client/Client.js";
|
|
11
9
|
import { OortCourierPayDriverLineItemGroups } from "./api/resources/oortCourierPayDriverLineItemGroups/client/Client.js";
|
|
12
10
|
import { OortCourierPayDriverPayouts } from "./api/resources/oortCourierPayDriverPayouts/client/Client.js";
|
|
@@ -23,6 +21,7 @@ import { OortTaskGroups } from "./api/resources/oortTaskGroups/client/Client.js"
|
|
|
23
21
|
import { Orgs } from "./api/resources/orgs/client/Client.js";
|
|
24
22
|
import { Payments } from "./api/resources/payments/client/Client.js";
|
|
25
23
|
import { Users } from "./api/resources/users/client/Client.js";
|
|
24
|
+
import { Notifications } from "./api/resources/notifications/client/Client.js";
|
|
26
25
|
export declare namespace ChrtClient {
|
|
27
26
|
interface Options {
|
|
28
27
|
environment?: core.Supplier<environments.ChrtEnvironment | string>;
|
|
@@ -48,8 +47,6 @@ export declare class ChrtClient {
|
|
|
48
47
|
protected readonly _options: ChrtClient.Options;
|
|
49
48
|
protected _root: Root | undefined;
|
|
50
49
|
protected _dev: Dev | undefined;
|
|
51
|
-
protected _directory: Directory | undefined;
|
|
52
|
-
protected _notifications: Notifications | undefined;
|
|
53
50
|
protected _oortConnections: OortConnections | undefined;
|
|
54
51
|
protected _oortCourierPayDriverLineItemGroups: OortCourierPayDriverLineItemGroups | undefined;
|
|
55
52
|
protected _oortCourierPayDriverPayouts: OortCourierPayDriverPayouts | undefined;
|
|
@@ -66,11 +63,10 @@ export declare class ChrtClient {
|
|
|
66
63
|
protected _orgs: Orgs | undefined;
|
|
67
64
|
protected _payments: Payments | undefined;
|
|
68
65
|
protected _users: Users | undefined;
|
|
66
|
+
protected _notifications: Notifications | undefined;
|
|
69
67
|
constructor(_options?: ChrtClient.Options);
|
|
70
68
|
get root(): Root;
|
|
71
69
|
get dev(): Dev;
|
|
72
|
-
get directory(): Directory;
|
|
73
|
-
get notifications(): Notifications;
|
|
74
70
|
get oortConnections(): OortConnections;
|
|
75
71
|
get oortCourierPayDriverLineItemGroups(): OortCourierPayDriverLineItemGroups;
|
|
76
72
|
get oortCourierPayDriverPayouts(): OortCourierPayDriverPayouts;
|
|
@@ -87,4 +83,5 @@ export declare class ChrtClient {
|
|
|
87
83
|
get orgs(): Orgs;
|
|
88
84
|
get payments(): Payments;
|
|
89
85
|
get users(): Users;
|
|
86
|
+
get notifications(): Notifications;
|
|
90
87
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -41,31 +41,30 @@ const core = __importStar(require("./core/index.js"));
|
|
|
41
41
|
const headers_js_1 = require("./core/headers.js");
|
|
42
42
|
const Client_js_1 = require("./api/resources/root/client/Client.js");
|
|
43
43
|
const Client_js_2 = require("./api/resources/dev/client/Client.js");
|
|
44
|
-
const Client_js_3 = require("./api/resources/
|
|
45
|
-
const Client_js_4 = require("./api/resources/
|
|
46
|
-
const Client_js_5 = require("./api/resources/
|
|
47
|
-
const Client_js_6 = require("./api/resources/
|
|
48
|
-
const Client_js_7 = require("./api/resources/
|
|
49
|
-
const Client_js_8 = require("./api/resources/
|
|
50
|
-
const Client_js_9 = require("./api/resources/
|
|
51
|
-
const Client_js_10 = require("./api/resources/
|
|
52
|
-
const Client_js_11 = require("./api/resources/
|
|
53
|
-
const Client_js_12 = require("./api/resources/
|
|
54
|
-
const Client_js_13 = require("./api/resources/
|
|
55
|
-
const Client_js_14 = require("./api/resources/
|
|
56
|
-
const Client_js_15 = require("./api/resources/
|
|
57
|
-
const Client_js_16 = require("./api/resources/
|
|
58
|
-
const Client_js_17 = require("./api/resources/
|
|
59
|
-
const Client_js_18 = require("./api/resources/
|
|
60
|
-
const Client_js_19 = require("./api/resources/
|
|
61
|
-
const Client_js_20 = require("./api/resources/users/client/Client.js");
|
|
44
|
+
const Client_js_3 = require("./api/resources/oortConnections/client/Client.js");
|
|
45
|
+
const Client_js_4 = require("./api/resources/oortCourierPayDriverLineItemGroups/client/Client.js");
|
|
46
|
+
const Client_js_5 = require("./api/resources/oortCourierPayDriverPayouts/client/Client.js");
|
|
47
|
+
const Client_js_6 = require("./api/resources/oortCourierPayDriverRateSheets/client/Client.js");
|
|
48
|
+
const Client_js_7 = require("./api/resources/oortDrivers/client/Client.js");
|
|
49
|
+
const Client_js_8 = require("./api/resources/oortMilestoneNotificationPreferences/client/Client.js");
|
|
50
|
+
const Client_js_9 = require("./api/resources/oortMilestones/client/Client.js");
|
|
51
|
+
const Client_js_10 = require("./api/resources/oortOffChrtShipperOrgConnectionInfo/client/Client.js");
|
|
52
|
+
const Client_js_11 = require("./api/resources/oortOrders/client/Client.js");
|
|
53
|
+
const Client_js_12 = require("./api/resources/oortOrgConnectionInfos/client/Client.js");
|
|
54
|
+
const Client_js_13 = require("./api/resources/oortOrgProfiles/client/Client.js");
|
|
55
|
+
const Client_js_14 = require("./api/resources/oortShipperContactInfo/client/Client.js");
|
|
56
|
+
const Client_js_15 = require("./api/resources/oortTaskGroups/client/Client.js");
|
|
57
|
+
const Client_js_16 = require("./api/resources/orgs/client/Client.js");
|
|
58
|
+
const Client_js_17 = require("./api/resources/payments/client/Client.js");
|
|
59
|
+
const Client_js_18 = require("./api/resources/users/client/Client.js");
|
|
60
|
+
const Client_js_19 = require("./api/resources/notifications/client/Client.js");
|
|
62
61
|
class ChrtClient {
|
|
63
62
|
constructor(_options = {}) {
|
|
64
63
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
65
64
|
"X-Fern-Language": "JavaScript",
|
|
66
65
|
"X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
|
|
67
|
-
"X-Fern-SDK-Version": "0.0.170-
|
|
68
|
-
"User-Agent": "@chrt-inc/typescript-sdk/0.0.170-
|
|
66
|
+
"X-Fern-SDK-Version": "0.0.170-g",
|
|
67
|
+
"User-Agent": "@chrt-inc/typescript-sdk/0.0.170-g",
|
|
69
68
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
70
69
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
71
70
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -78,77 +77,73 @@ class ChrtClient {
|
|
|
78
77
|
var _a;
|
|
79
78
|
return ((_a = this._dev) !== null && _a !== void 0 ? _a : (this._dev = new Client_js_2.Dev(this._options)));
|
|
80
79
|
}
|
|
81
|
-
get directory() {
|
|
82
|
-
var _a;
|
|
83
|
-
return ((_a = this._directory) !== null && _a !== void 0 ? _a : (this._directory = new Client_js_3.Directory(this._options)));
|
|
84
|
-
}
|
|
85
|
-
get notifications() {
|
|
86
|
-
var _a;
|
|
87
|
-
return ((_a = this._notifications) !== null && _a !== void 0 ? _a : (this._notifications = new Client_js_4.Notifications(this._options)));
|
|
88
|
-
}
|
|
89
80
|
get oortConnections() {
|
|
90
81
|
var _a;
|
|
91
|
-
return ((_a = this._oortConnections) !== null && _a !== void 0 ? _a : (this._oortConnections = new
|
|
82
|
+
return ((_a = this._oortConnections) !== null && _a !== void 0 ? _a : (this._oortConnections = new Client_js_3.OortConnections(this._options)));
|
|
92
83
|
}
|
|
93
84
|
get oortCourierPayDriverLineItemGroups() {
|
|
94
85
|
var _a;
|
|
95
|
-
return ((_a = this._oortCourierPayDriverLineItemGroups) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverLineItemGroups = new
|
|
86
|
+
return ((_a = this._oortCourierPayDriverLineItemGroups) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverLineItemGroups = new Client_js_4.OortCourierPayDriverLineItemGroups(this._options)));
|
|
96
87
|
}
|
|
97
88
|
get oortCourierPayDriverPayouts() {
|
|
98
89
|
var _a;
|
|
99
|
-
return ((_a = this._oortCourierPayDriverPayouts) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverPayouts = new
|
|
90
|
+
return ((_a = this._oortCourierPayDriverPayouts) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverPayouts = new Client_js_5.OortCourierPayDriverPayouts(this._options)));
|
|
100
91
|
}
|
|
101
92
|
get oortCourierPayDriverRateSheets() {
|
|
102
93
|
var _a;
|
|
103
|
-
return ((_a = this._oortCourierPayDriverRateSheets) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverRateSheets = new
|
|
94
|
+
return ((_a = this._oortCourierPayDriverRateSheets) !== null && _a !== void 0 ? _a : (this._oortCourierPayDriverRateSheets = new Client_js_6.OortCourierPayDriverRateSheets(this._options)));
|
|
104
95
|
}
|
|
105
96
|
get oortDrivers() {
|
|
106
97
|
var _a;
|
|
107
|
-
return ((_a = this._oortDrivers) !== null && _a !== void 0 ? _a : (this._oortDrivers = new
|
|
98
|
+
return ((_a = this._oortDrivers) !== null && _a !== void 0 ? _a : (this._oortDrivers = new Client_js_7.OortDrivers(this._options)));
|
|
108
99
|
}
|
|
109
100
|
get oortMilestoneNotificationPreferences() {
|
|
110
101
|
var _a;
|
|
111
|
-
return ((_a = this._oortMilestoneNotificationPreferences) !== null && _a !== void 0 ? _a : (this._oortMilestoneNotificationPreferences = new
|
|
102
|
+
return ((_a = this._oortMilestoneNotificationPreferences) !== null && _a !== void 0 ? _a : (this._oortMilestoneNotificationPreferences = new Client_js_8.OortMilestoneNotificationPreferences(this._options)));
|
|
112
103
|
}
|
|
113
104
|
get oortMilestones() {
|
|
114
105
|
var _a;
|
|
115
|
-
return ((_a = this._oortMilestones) !== null && _a !== void 0 ? _a : (this._oortMilestones = new
|
|
106
|
+
return ((_a = this._oortMilestones) !== null && _a !== void 0 ? _a : (this._oortMilestones = new Client_js_9.OortMilestones(this._options)));
|
|
116
107
|
}
|
|
117
108
|
get oortOffChrtShipperOrgConnectionInfo() {
|
|
118
109
|
var _a;
|
|
119
|
-
return ((_a = this._oortOffChrtShipperOrgConnectionInfo) !== null && _a !== void 0 ? _a : (this._oortOffChrtShipperOrgConnectionInfo = new
|
|
110
|
+
return ((_a = this._oortOffChrtShipperOrgConnectionInfo) !== null && _a !== void 0 ? _a : (this._oortOffChrtShipperOrgConnectionInfo = new Client_js_10.OortOffChrtShipperOrgConnectionInfo(this._options)));
|
|
120
111
|
}
|
|
121
112
|
get oortOrders() {
|
|
122
113
|
var _a;
|
|
123
|
-
return ((_a = this._oortOrders) !== null && _a !== void 0 ? _a : (this._oortOrders = new
|
|
114
|
+
return ((_a = this._oortOrders) !== null && _a !== void 0 ? _a : (this._oortOrders = new Client_js_11.OortOrders(this._options)));
|
|
124
115
|
}
|
|
125
116
|
get oortOrgConnectionInfos() {
|
|
126
117
|
var _a;
|
|
127
|
-
return ((_a = this._oortOrgConnectionInfos) !== null && _a !== void 0 ? _a : (this._oortOrgConnectionInfos = new
|
|
118
|
+
return ((_a = this._oortOrgConnectionInfos) !== null && _a !== void 0 ? _a : (this._oortOrgConnectionInfos = new Client_js_12.OortOrgConnectionInfos(this._options)));
|
|
128
119
|
}
|
|
129
120
|
get oortOrgProfiles() {
|
|
130
121
|
var _a;
|
|
131
|
-
return ((_a = this._oortOrgProfiles) !== null && _a !== void 0 ? _a : (this._oortOrgProfiles = new
|
|
122
|
+
return ((_a = this._oortOrgProfiles) !== null && _a !== void 0 ? _a : (this._oortOrgProfiles = new Client_js_13.OortOrgProfiles(this._options)));
|
|
132
123
|
}
|
|
133
124
|
get oortShipperContactInfo() {
|
|
134
125
|
var _a;
|
|
135
|
-
return ((_a = this._oortShipperContactInfo) !== null && _a !== void 0 ? _a : (this._oortShipperContactInfo = new
|
|
126
|
+
return ((_a = this._oortShipperContactInfo) !== null && _a !== void 0 ? _a : (this._oortShipperContactInfo = new Client_js_14.OortShipperContactInfo(this._options)));
|
|
136
127
|
}
|
|
137
128
|
get oortTaskGroups() {
|
|
138
129
|
var _a;
|
|
139
|
-
return ((_a = this._oortTaskGroups) !== null && _a !== void 0 ? _a : (this._oortTaskGroups = new
|
|
130
|
+
return ((_a = this._oortTaskGroups) !== null && _a !== void 0 ? _a : (this._oortTaskGroups = new Client_js_15.OortTaskGroups(this._options)));
|
|
140
131
|
}
|
|
141
132
|
get orgs() {
|
|
142
133
|
var _a;
|
|
143
|
-
return ((_a = this._orgs) !== null && _a !== void 0 ? _a : (this._orgs = new
|
|
134
|
+
return ((_a = this._orgs) !== null && _a !== void 0 ? _a : (this._orgs = new Client_js_16.Orgs(this._options)));
|
|
144
135
|
}
|
|
145
136
|
get payments() {
|
|
146
137
|
var _a;
|
|
147
|
-
return ((_a = this._payments) !== null && _a !== void 0 ? _a : (this._payments = new
|
|
138
|
+
return ((_a = this._payments) !== null && _a !== void 0 ? _a : (this._payments = new Client_js_17.Payments(this._options)));
|
|
148
139
|
}
|
|
149
140
|
get users() {
|
|
150
141
|
var _a;
|
|
151
|
-
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new
|
|
142
|
+
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_18.Users(this._options)));
|
|
143
|
+
}
|
|
144
|
+
get notifications() {
|
|
145
|
+
var _a;
|
|
146
|
+
return ((_a = this._notifications) !== null && _a !== void 0 ? _a : (this._notifications = new Client_js_19.Notifications(this._options)));
|
|
152
147
|
}
|
|
153
148
|
}
|
|
154
149
|
exports.ChrtClient = ChrtClient;
|
package/dist/cjs/api/index.d.ts
CHANGED
package/dist/cjs/api/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./resources/index.js"), exports);
|
|
18
17
|
__exportStar(require("./types/index.js"), exports);
|
|
19
18
|
__exportStar(require("./errors/index.js"), exports);
|
|
19
|
+
__exportStar(require("./resources/index.js"), exports);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export * as root from "./root/index.js";
|
|
2
|
-
export * from "./root/types/index.js";
|
|
3
2
|
export * as dev from "./dev/index.js";
|
|
4
|
-
export * as directory from "./directory/index.js";
|
|
5
|
-
export * as notifications from "./notifications/index.js";
|
|
6
3
|
export * as oortConnections from "./oortConnections/index.js";
|
|
7
4
|
export * as oortCourierPayDriverLineItemGroups from "./oortCourierPayDriverLineItemGroups/index.js";
|
|
8
5
|
export * as oortCourierPayDriverPayouts from "./oortCourierPayDriverPayouts/index.js";
|
|
@@ -19,9 +16,8 @@ export * as oortTaskGroups from "./oortTaskGroups/index.js";
|
|
|
19
16
|
export * as orgs from "./orgs/index.js";
|
|
20
17
|
export * as payments from "./payments/index.js";
|
|
21
18
|
export * as users from "./users/index.js";
|
|
19
|
+
export * as notifications from "./notifications/index.js";
|
|
22
20
|
export * from "./dev/client/requests/index.js";
|
|
23
|
-
export * from "./directory/client/requests/index.js";
|
|
24
|
-
export * from "./notifications/client/requests/index.js";
|
|
25
21
|
export * from "./oortConnections/client/requests/index.js";
|
|
26
22
|
export * from "./oortCourierPayDriverLineItemGroups/client/requests/index.js";
|
|
27
23
|
export * from "./oortCourierPayDriverPayouts/client/requests/index.js";
|
|
@@ -36,12 +36,9 @@ 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.users = exports.payments = exports.orgs = exports.oortTaskGroups = exports.oortShipperContactInfo = exports.oortOrgProfiles = exports.oortOrgConnectionInfos = exports.oortOrders = exports.oortOffChrtShipperOrgConnectionInfo = exports.oortMilestones = exports.oortMilestoneNotificationPreferences = exports.oortDrivers = exports.oortCourierPayDriverRateSheets = exports.oortCourierPayDriverPayouts = exports.oortCourierPayDriverLineItemGroups = exports.oortConnections = exports.
|
|
39
|
+
exports.notifications = exports.users = exports.payments = exports.orgs = exports.oortTaskGroups = exports.oortShipperContactInfo = exports.oortOrgProfiles = exports.oortOrgConnectionInfos = exports.oortOrders = exports.oortOffChrtShipperOrgConnectionInfo = exports.oortMilestones = exports.oortMilestoneNotificationPreferences = exports.oortDrivers = exports.oortCourierPayDriverRateSheets = exports.oortCourierPayDriverPayouts = exports.oortCourierPayDriverLineItemGroups = exports.oortConnections = exports.dev = exports.root = void 0;
|
|
40
40
|
exports.root = __importStar(require("./root/index.js"));
|
|
41
|
-
__exportStar(require("./root/types/index.js"), exports);
|
|
42
41
|
exports.dev = __importStar(require("./dev/index.js"));
|
|
43
|
-
exports.directory = __importStar(require("./directory/index.js"));
|
|
44
|
-
exports.notifications = __importStar(require("./notifications/index.js"));
|
|
45
42
|
exports.oortConnections = __importStar(require("./oortConnections/index.js"));
|
|
46
43
|
exports.oortCourierPayDriverLineItemGroups = __importStar(require("./oortCourierPayDriverLineItemGroups/index.js"));
|
|
47
44
|
exports.oortCourierPayDriverPayouts = __importStar(require("./oortCourierPayDriverPayouts/index.js"));
|
|
@@ -58,9 +55,8 @@ exports.oortTaskGroups = __importStar(require("./oortTaskGroups/index.js"));
|
|
|
58
55
|
exports.orgs = __importStar(require("./orgs/index.js"));
|
|
59
56
|
exports.payments = __importStar(require("./payments/index.js"));
|
|
60
57
|
exports.users = __importStar(require("./users/index.js"));
|
|
58
|
+
exports.notifications = __importStar(require("./notifications/index.js"));
|
|
61
59
|
__exportStar(require("./dev/client/requests/index.js"), exports);
|
|
62
|
-
__exportStar(require("./directory/client/requests/index.js"), exports);
|
|
63
|
-
__exportStar(require("./notifications/client/requests/index.js"), exports);
|
|
64
60
|
__exportStar(require("./oortConnections/client/requests/index.js"), exports);
|
|
65
61
|
__exportStar(require("./oortCourierPayDriverLineItemGroups/client/requests/index.js"), exports);
|
|
66
62
|
__exportStar(require("./oortCourierPayDriverPayouts/client/requests/index.js"), exports);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments.js";
|
|
5
5
|
import * as core from "../../../../core/index.js";
|
|
6
|
-
import
|
|
6
|
+
import { Courier } from "../resources/courier/client/Client.js";
|
|
7
7
|
import { Shipper } from "../resources/shipper/client/Client.js";
|
|
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
|
}
|
|
@@ -2,183 +2,21 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
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
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
6
|
exports.Notifications = void 0;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
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
|
-
const Client_js_1 = require("../resources/shipper/client/Client.js");
|
|
7
|
+
const Client_js_1 = require("../resources/courier/client/Client.js");
|
|
8
|
+
const Client_js_2 = require("../resources/shipper/client/Client.js");
|
|
55
9
|
class Notifications {
|
|
56
10
|
constructor(_options = {}) {
|
|
57
11
|
this._options = _options;
|
|
58
12
|
}
|
|
59
|
-
get
|
|
13
|
+
get courier() {
|
|
60
14
|
var _a;
|
|
61
|
-
return ((_a = this.
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Get notification preferences by org id from jwt
|
|
65
|
-
*
|
|
66
|
-
* @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* await client.notifications.getCourierNotificationsPreferencesByOrgId()
|
|
70
|
-
*/
|
|
71
|
-
getCourierNotificationsPreferencesByOrgId(requestOptions) {
|
|
72
|
-
return core.HttpResponsePromise.fromPromise(this.__getCourierNotificationsPreferencesByOrgId(requestOptions));
|
|
73
|
-
}
|
|
74
|
-
__getCourierNotificationsPreferencesByOrgId(requestOptions) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
var _a, _b, _c, _d;
|
|
77
|
-
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
78
|
-
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"),
|
|
79
|
-
method: "GET",
|
|
80
|
-
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),
|
|
81
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
82
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
83
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
84
|
-
});
|
|
85
|
-
if (_response.ok) {
|
|
86
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
87
|
-
}
|
|
88
|
-
if (_response.error.reason === "status-code") {
|
|
89
|
-
throw new errors.ChrtError({
|
|
90
|
-
statusCode: _response.error.statusCode,
|
|
91
|
-
body: _response.error.body,
|
|
92
|
-
rawResponse: _response.rawResponse,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
switch (_response.error.reason) {
|
|
96
|
-
case "non-json":
|
|
97
|
-
throw new errors.ChrtError({
|
|
98
|
-
statusCode: _response.error.statusCode,
|
|
99
|
-
body: _response.error.rawBody,
|
|
100
|
-
rawResponse: _response.rawResponse,
|
|
101
|
-
});
|
|
102
|
-
case "timeout":
|
|
103
|
-
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /notifications/courier_notification_preferences/by_org_id.");
|
|
104
|
-
case "unknown":
|
|
105
|
-
throw new errors.ChrtError({
|
|
106
|
-
message: _response.error.errorMessage,
|
|
107
|
-
rawResponse: _response.rawResponse,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
15
|
+
return ((_a = this._courier) !== null && _a !== void 0 ? _a : (this._courier = new Client_js_1.Courier(this._options)));
|
|
111
16
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @param {Chrt.CourierNotificationPreferencesClientCreate1} request
|
|
116
|
-
* @param {Notifications.RequestOptions} requestOptions - Request-specific configuration.
|
|
117
|
-
*
|
|
118
|
-
* @throws {@link Chrt.UnprocessableEntityError}
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* await client.notifications.postCourierNotificationsPreferencesByOrgId({
|
|
122
|
-
* schema_version: 1
|
|
123
|
-
* })
|
|
124
|
-
*/
|
|
125
|
-
postCourierNotificationsPreferencesByOrgId(request, requestOptions) {
|
|
126
|
-
return core.HttpResponsePromise.fromPromise(this.__postCourierNotificationsPreferencesByOrgId(request, requestOptions));
|
|
127
|
-
}
|
|
128
|
-
__postCourierNotificationsPreferencesByOrgId(request, requestOptions) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
var _a, _b, _c, _d;
|
|
131
|
-
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
132
|
-
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"),
|
|
133
|
-
method: "POST",
|
|
134
|
-
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),
|
|
135
|
-
contentType: "application/json",
|
|
136
|
-
requestType: "json",
|
|
137
|
-
body: request,
|
|
138
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
139
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
140
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
141
|
-
});
|
|
142
|
-
if (_response.ok) {
|
|
143
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
144
|
-
}
|
|
145
|
-
if (_response.error.reason === "status-code") {
|
|
146
|
-
switch (_response.error.statusCode) {
|
|
147
|
-
case 422:
|
|
148
|
-
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
149
|
-
default:
|
|
150
|
-
throw new errors.ChrtError({
|
|
151
|
-
statusCode: _response.error.statusCode,
|
|
152
|
-
body: _response.error.body,
|
|
153
|
-
rawResponse: _response.rawResponse,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
switch (_response.error.reason) {
|
|
158
|
-
case "non-json":
|
|
159
|
-
throw new errors.ChrtError({
|
|
160
|
-
statusCode: _response.error.statusCode,
|
|
161
|
-
body: _response.error.rawBody,
|
|
162
|
-
rawResponse: _response.rawResponse,
|
|
163
|
-
});
|
|
164
|
-
case "timeout":
|
|
165
|
-
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /notifications/courier_notification_preferences/create.");
|
|
166
|
-
case "unknown":
|
|
167
|
-
throw new errors.ChrtError({
|
|
168
|
-
message: _response.error.errorMessage,
|
|
169
|
-
rawResponse: _response.rawResponse,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
_getAuthorizationHeader() {
|
|
175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
const bearer = yield core.Supplier.get(this._options.token);
|
|
177
|
-
if (bearer != null) {
|
|
178
|
-
return `Bearer ${bearer}`;
|
|
179
|
-
}
|
|
180
|
-
return undefined;
|
|
181
|
-
});
|
|
17
|
+
get shipper() {
|
|
18
|
+
var _a;
|
|
19
|
+
return ((_a = this._shipper) !== null && _a !== void 0 ? _a : (this._shipper = new Client_js_2.Shipper(this._options)));
|
|
182
20
|
}
|
|
183
21
|
}
|
|
184
22
|
exports.Notifications = Notifications;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./requests/index.js"), exports);
|