@chrt-inc/typescript-sdk 1.304.0 → 1.306.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +585 -0
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/drivers/client/Client.d.ts +10 -10
  4. package/dist/cjs/api/resources/drivers/client/Client.js +10 -10
  5. package/dist/cjs/api/resources/offChrtShipperOrg/client/Client.d.ts +5 -5
  6. package/dist/cjs/api/resources/offChrtShipperOrg/client/Client.js +5 -5
  7. package/dist/cjs/api/resources/orderDrafts/client/Client.d.ts +6 -6
  8. package/dist/cjs/api/resources/orderDrafts/client/Client.js +6 -6
  9. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/Client.d.ts +4 -4
  10. package/dist/cjs/api/resources/orderDrafts/resources/cargo/client/Client.js +4 -4
  11. package/dist/cjs/api/resources/orderDrafts/resources/task/client/Client.d.ts +3 -3
  12. package/dist/cjs/api/resources/orderDrafts/resources/task/client/Client.js +3 -3
  13. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/Client.d.ts +2 -2
  14. package/dist/cjs/api/resources/orderDrafts/resources/taskArtifact/client/Client.js +2 -2
  15. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/Client.d.ts +16 -2
  16. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/Client.js +65 -2
  17. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/requests/UpdateTaskGroupDraftReq.d.ts +13 -0
  18. package/dist/cjs/api/resources/orderDrafts/resources/taskGroup/client/requests/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/orders/client/Client.d.ts +1 -1
  20. package/dist/cjs/api/resources/orders/client/Client.js +1 -1
  21. package/dist/cjs/api/resources/orders/resources/expanded/client/Client.d.ts +2 -2
  22. package/dist/cjs/api/resources/orders/resources/expanded/client/Client.js +2 -2
  23. package/dist/cjs/api/resources/orders/resources/expandedList/client/Client.d.ts +2 -2
  24. package/dist/cjs/api/resources/orders/resources/expandedList/client/Client.js +2 -2
  25. package/dist/cjs/api/resources/orgs/client/Client.d.ts +28 -5
  26. package/dist/cjs/api/resources/orgs/client/Client.js +122 -9
  27. package/dist/cjs/api/resources/orgs/client/requests/CreateOrgPublicDataReq.d.ts +1 -5
  28. package/dist/cjs/api/resources/orgs/client/requests/SetOrgTypeReq.d.ts +13 -0
  29. package/dist/cjs/api/resources/orgs/client/requests/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/shipperContactInfo/client/Client.d.ts +9 -9
  31. package/dist/cjs/api/resources/shipperContactInfo/client/Client.js +9 -9
  32. package/dist/cjs/api/resources/taskArtifacts/client/Client.d.ts +3 -3
  33. package/dist/cjs/api/resources/taskArtifacts/client/Client.js +3 -3
  34. package/dist/cjs/api/resources/taskArtifacts/resources/blurhash/client/Client.d.ts +1 -1
  35. package/dist/cjs/api/resources/taskArtifacts/resources/blurhash/client/Client.js +1 -1
  36. package/dist/cjs/api/resources/taskArtifacts/resources/images/client/Client.d.ts +3 -3
  37. package/dist/cjs/api/resources/taskArtifacts/resources/images/client/Client.js +3 -3
  38. package/dist/cjs/api/resources/taskGroups/client/Client.d.ts +47 -19
  39. package/dist/cjs/api/resources/taskGroups/client/Client.js +157 -31
  40. package/dist/cjs/api/resources/taskGroups/client/requests/SetFlightNumberReq.d.ts +12 -0
  41. package/dist/cjs/api/resources/taskGroups/client/requests/SetFlightNumberReq.js +5 -0
  42. package/dist/cjs/api/resources/taskGroups/client/requests/SetTaskOrderingReq.d.ts +12 -0
  43. package/dist/cjs/api/resources/taskGroups/client/requests/SetTaskOrderingReq.js +5 -0
  44. package/dist/cjs/api/resources/taskGroups/client/requests/UpdateTaskGroupCourierOrgReq.d.ts +12 -0
  45. package/dist/cjs/api/resources/taskGroups/client/requests/UpdateTaskGroupCourierOrgReq.js +5 -0
  46. package/dist/cjs/api/resources/taskGroups/client/requests/UpdateTaskGroupDriverReq.d.ts +11 -0
  47. package/dist/cjs/api/resources/taskGroups/client/requests/UpdateTaskGroupDriverReq.js +5 -0
  48. package/dist/cjs/api/resources/taskGroups/client/requests/index.d.ts +4 -2
  49. package/dist/cjs/api/resources/taskGroups/resources/expanded/client/Client.d.ts +3 -3
  50. package/dist/cjs/api/resources/taskGroups/resources/expanded/client/Client.js +3 -3
  51. package/dist/cjs/api/resources/taskGroups/resources/expandedList/client/Client.d.ts +2 -2
  52. package/dist/cjs/api/resources/taskGroups/resources/expandedList/client/Client.js +2 -2
  53. package/dist/cjs/api/resources/users/client/Client.d.ts +4 -4
  54. package/dist/cjs/api/resources/users/client/Client.js +5 -5
  55. package/dist/cjs/api/types/ClerkOrgData.d.ts +2 -1
  56. package/dist/cjs/api/types/CreateOrgPublicDataRes.d.ts +7 -0
  57. package/dist/cjs/api/types/CreateOrgPublicDataRes.js +5 -0
  58. package/dist/cjs/api/types/OrderDraftExpandedRes.d.ts +1 -0
  59. package/dist/cjs/api/types/OrgPublicData1.d.ts +1 -1
  60. package/dist/cjs/api/types/OrgRoleEnum.d.ts +28 -0
  61. package/dist/cjs/api/types/OrgRoleEnum.js +12 -0
  62. package/dist/cjs/api/types/TaskClientUpdate1.d.ts +1 -0
  63. package/dist/cjs/api/types/TaskGroup1.d.ts +1 -0
  64. package/dist/cjs/api/types/UserPublicData1.d.ts +1 -2
  65. package/dist/cjs/api/types/index.d.ts +2 -0
  66. package/dist/cjs/api/types/index.js +2 -0
  67. package/dist/cjs/version.d.ts +1 -1
  68. package/dist/cjs/version.js +1 -1
  69. package/dist/esm/Client.mjs +2 -2
  70. package/dist/esm/api/resources/drivers/client/Client.d.mts +10 -10
  71. package/dist/esm/api/resources/drivers/client/Client.mjs +10 -10
  72. package/dist/esm/api/resources/offChrtShipperOrg/client/Client.d.mts +5 -5
  73. package/dist/esm/api/resources/offChrtShipperOrg/client/Client.mjs +5 -5
  74. package/dist/esm/api/resources/orderDrafts/client/Client.d.mts +6 -6
  75. package/dist/esm/api/resources/orderDrafts/client/Client.mjs +6 -6
  76. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/Client.d.mts +4 -4
  77. package/dist/esm/api/resources/orderDrafts/resources/cargo/client/Client.mjs +4 -4
  78. package/dist/esm/api/resources/orderDrafts/resources/task/client/Client.d.mts +3 -3
  79. package/dist/esm/api/resources/orderDrafts/resources/task/client/Client.mjs +3 -3
  80. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/Client.d.mts +2 -2
  81. package/dist/esm/api/resources/orderDrafts/resources/taskArtifact/client/Client.mjs +2 -2
  82. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/Client.d.mts +16 -2
  83. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/Client.mjs +65 -2
  84. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/requests/UpdateTaskGroupDraftReq.d.mts +13 -0
  85. package/dist/esm/api/resources/orderDrafts/resources/taskGroup/client/requests/index.d.mts +1 -0
  86. package/dist/esm/api/resources/orders/client/Client.d.mts +1 -1
  87. package/dist/esm/api/resources/orders/client/Client.mjs +1 -1
  88. package/dist/esm/api/resources/orders/resources/expanded/client/Client.d.mts +2 -2
  89. package/dist/esm/api/resources/orders/resources/expanded/client/Client.mjs +2 -2
  90. package/dist/esm/api/resources/orders/resources/expandedList/client/Client.d.mts +2 -2
  91. package/dist/esm/api/resources/orders/resources/expandedList/client/Client.mjs +2 -2
  92. package/dist/esm/api/resources/orgs/client/Client.d.mts +28 -5
  93. package/dist/esm/api/resources/orgs/client/Client.mjs +122 -9
  94. package/dist/esm/api/resources/orgs/client/requests/CreateOrgPublicDataReq.d.mts +1 -5
  95. package/dist/esm/api/resources/orgs/client/requests/SetOrgTypeReq.d.mts +13 -0
  96. package/dist/esm/api/resources/orgs/client/requests/index.d.mts +1 -0
  97. package/dist/esm/api/resources/shipperContactInfo/client/Client.d.mts +9 -9
  98. package/dist/esm/api/resources/shipperContactInfo/client/Client.mjs +9 -9
  99. package/dist/esm/api/resources/taskArtifacts/client/Client.d.mts +3 -3
  100. package/dist/esm/api/resources/taskArtifacts/client/Client.mjs +3 -3
  101. package/dist/esm/api/resources/taskArtifacts/resources/blurhash/client/Client.d.mts +1 -1
  102. package/dist/esm/api/resources/taskArtifacts/resources/blurhash/client/Client.mjs +1 -1
  103. package/dist/esm/api/resources/taskArtifacts/resources/images/client/Client.d.mts +3 -3
  104. package/dist/esm/api/resources/taskArtifacts/resources/images/client/Client.mjs +3 -3
  105. package/dist/esm/api/resources/taskGroups/client/Client.d.mts +47 -19
  106. package/dist/esm/api/resources/taskGroups/client/Client.mjs +157 -31
  107. package/dist/esm/api/resources/taskGroups/client/requests/SetFlightNumberReq.d.mts +12 -0
  108. package/dist/esm/api/resources/taskGroups/client/requests/SetFlightNumberReq.mjs +4 -0
  109. package/dist/esm/api/resources/taskGroups/client/requests/SetTaskOrderingReq.d.mts +12 -0
  110. package/dist/esm/api/resources/taskGroups/client/requests/SetTaskOrderingReq.mjs +4 -0
  111. package/dist/esm/api/resources/taskGroups/client/requests/UpdateTaskGroupCourierOrgReq.d.mts +12 -0
  112. package/dist/esm/api/resources/taskGroups/client/requests/UpdateTaskGroupCourierOrgReq.mjs +4 -0
  113. package/dist/esm/api/resources/taskGroups/client/requests/UpdateTaskGroupDriverReq.d.mts +11 -0
  114. package/dist/esm/api/resources/taskGroups/client/requests/UpdateTaskGroupDriverReq.mjs +4 -0
  115. package/dist/esm/api/resources/taskGroups/client/requests/index.d.mts +4 -2
  116. package/dist/esm/api/resources/taskGroups/resources/expanded/client/Client.d.mts +3 -3
  117. package/dist/esm/api/resources/taskGroups/resources/expanded/client/Client.mjs +3 -3
  118. package/dist/esm/api/resources/taskGroups/resources/expandedList/client/Client.d.mts +2 -2
  119. package/dist/esm/api/resources/taskGroups/resources/expandedList/client/Client.mjs +2 -2
  120. package/dist/esm/api/resources/users/client/Client.d.mts +4 -4
  121. package/dist/esm/api/resources/users/client/Client.mjs +5 -5
  122. package/dist/esm/api/types/ClerkOrgData.d.mts +2 -1
  123. package/dist/esm/api/types/CreateOrgPublicDataRes.d.mts +7 -0
  124. package/dist/esm/api/types/CreateOrgPublicDataRes.mjs +4 -0
  125. package/dist/esm/api/types/OrderDraftExpandedRes.d.mts +1 -0
  126. package/dist/esm/api/types/OrgPublicData1.d.mts +1 -1
  127. package/dist/esm/api/types/OrgRoleEnum.d.mts +28 -0
  128. package/dist/esm/api/types/OrgRoleEnum.mjs +9 -0
  129. package/dist/esm/api/types/TaskClientUpdate1.d.mts +1 -0
  130. package/dist/esm/api/types/TaskGroup1.d.mts +1 -0
  131. package/dist/esm/api/types/UserPublicData1.d.mts +1 -2
  132. package/dist/esm/api/types/index.d.mts +2 -0
  133. package/dist/esm/api/types/index.mjs +2 -0
  134. package/dist/esm/version.d.mts +1 -1
  135. package/dist/esm/version.mjs +1 -1
  136. package/package.json +1 -1
  137. package/reference.md +420 -82
  138. package/dist/cjs/api/resources/taskGroups/client/requests/SetTaskGroupPauseReq.d.ts +0 -14
  139. package/dist/cjs/api/resources/taskGroups/client/requests/UpdateTaskGroupReq.d.ts +0 -14
  140. package/dist/esm/api/resources/taskGroups/client/requests/SetTaskGroupPauseReq.d.mts +0 -14
  141. package/dist/esm/api/resources/taskGroups/client/requests/UpdateTaskGroupReq.d.mts +0 -14
  142. /package/dist/cjs/api/resources/{taskGroups/client/requests/SetTaskGroupPauseReq.js → orderDrafts/resources/taskGroup/client/requests/UpdateTaskGroupDraftReq.js} +0 -0
  143. /package/dist/cjs/api/resources/{taskGroups/client/requests/UpdateTaskGroupReq.js → orgs/client/requests/SetOrgTypeReq.js} +0 -0
  144. /package/dist/esm/api/resources/{taskGroups/client/requests/SetTaskGroupPauseReq.mjs → orderDrafts/resources/taskGroup/client/requests/UpdateTaskGroupDraftReq.mjs} +0 -0
  145. /package/dist/esm/api/resources/{taskGroups/client/requests/UpdateTaskGroupReq.mjs → orgs/client/requests/SetOrgTypeReq.mjs} +0 -0
package/README.md CHANGED
@@ -0,0 +1,585 @@
1
+ # Chrt TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fchrt-inc%2Ftypescript-sdk)
4
+ [![npm shield](https://img.shields.io/npm/v/@chrt-inc/typescript-sdk)](https://www.npmjs.com/package/@chrt-inc/typescript-sdk)
5
+
6
+ The Chrt TypeScript library provides convenient access to the Chrt APIs from TypeScript.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Request and Response Types](#request-and-response-types)
14
+ - [Exception Handling](#exception-handling)
15
+ - [Binary Response](#binary-response)
16
+ - [Advanced](#advanced)
17
+ - [Additional Headers](#additional-headers)
18
+ - [Additional Query String Parameters](#additional-query-string-parameters)
19
+ - [Retries](#retries)
20
+ - [Timeouts](#timeouts)
21
+ - [Aborting Requests](#aborting-requests)
22
+ - [Access Raw Response Data](#access-raw-response-data)
23
+ - [Runtime Compatibility](#runtime-compatibility)
24
+ - [Contributing](#contributing)
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ npm i -s @chrt-inc/typescript-sdk
30
+ ```
31
+
32
+ ## Reference
33
+
34
+ A full reference for this library is available [here](https://github.com/chrt-inc/typescript-sdk/blob/HEAD/./reference.md).
35
+
36
+ ## Usage
37
+
38
+ Instantiate and use the client with the following:
39
+
40
+ ```typescript
41
+ import { ChrtClient } from "@chrt-inc/typescript-sdk";
42
+
43
+ const client = new ChrtClient({ token: "YOUR_TOKEN" });
44
+ await client.payments.generateInvoiceV1({
45
+ shipper_pay_courier_statement_id: "shipper_pay_courier_statement_id",
46
+ });
47
+ ```
48
+
49
+ ## Request and Response Types
50
+
51
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
52
+ following namespace:
53
+
54
+ ```typescript
55
+ import { Chrt } from "@chrt-inc/typescript-sdk";
56
+
57
+ const request: Chrt.GenerateInvoiceReq = {
58
+ ...
59
+ };
60
+ ```
61
+
62
+ ## Exception Handling
63
+
64
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
65
+ will be thrown.
66
+
67
+ ```typescript
68
+ import { ChrtError } from "@chrt-inc/typescript-sdk";
69
+
70
+ try {
71
+ await client.payments.generateInvoiceV1(...);
72
+ } catch (err) {
73
+ if (err instanceof ChrtError) {
74
+ console.log(err.statusCode);
75
+ console.log(err.message);
76
+ console.log(err.body);
77
+ console.log(err.rawResponse);
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Binary Response
83
+
84
+ You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
85
+
86
+ ```typescript
87
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
88
+ const stream: ReadableStream<Uint8Array> = response.stream();
89
+ // const arrayBuffer: ArrayBuffer = await response.arrayBuffer();
90
+ // const blob: Blob = response.blob();
91
+ // const bytes: Uint8Array = response.bytes();
92
+ // You can only use the response body once, so you must choose one of the above methods.
93
+ // If you want to check if the response body has been used, you can use the following property.
94
+ const bodyUsed = response.bodyUsed;
95
+ ```
96
+
97
+ <details>
98
+ <summary>Save binary response to a file</summary>
99
+
100
+ <blockquote>
101
+ <details>
102
+ <summary>Node.js</summary>
103
+
104
+ <blockquote>
105
+ <details>
106
+ <summary>ReadableStream (most-efficient)</summary>
107
+
108
+ ```ts
109
+ import { createWriteStream } from 'fs';
110
+ import { Readable } from 'stream';
111
+ import { pipeline } from 'stream/promises';
112
+
113
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
114
+
115
+ const stream = response.stream();
116
+ const nodeStream = Readable.fromWeb(stream);
117
+ const writeStream = createWriteStream('path/to/file');
118
+
119
+ await pipeline(nodeStream, writeStream);
120
+ ```
121
+
122
+ </details>
123
+ </blockquote>
124
+
125
+ <blockquote>
126
+ <details>
127
+ <summary>ArrayBuffer</summary>
128
+
129
+ ```ts
130
+ import { writeFile } from 'fs/promises';
131
+
132
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
133
+
134
+ const arrayBuffer = await response.arrayBuffer();
135
+ await writeFile('path/to/file', Buffer.from(arrayBuffer));
136
+ ```
137
+
138
+ </details>
139
+ </blockquote>
140
+
141
+ <blockquote>
142
+ <details>
143
+ <summary>Blob</summary>
144
+
145
+ ```ts
146
+ import { writeFile } from 'fs/promises';
147
+
148
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
149
+
150
+ const blob = await response.blob();
151
+ const arrayBuffer = await blob.arrayBuffer();
152
+ await writeFile('output.bin', Buffer.from(arrayBuffer));
153
+ ```
154
+
155
+ </details>
156
+ </blockquote>
157
+
158
+ <blockquote>
159
+ <details>
160
+ <summary>Bytes (UIntArray8)</summary>
161
+
162
+ ```ts
163
+ import { writeFile } from 'fs/promises';
164
+
165
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
166
+
167
+ const bytes = await response.bytes();
168
+ await writeFile('path/to/file', bytes);
169
+ ```
170
+
171
+ </details>
172
+ </blockquote>
173
+
174
+ </details>
175
+ </blockquote>
176
+
177
+ <blockquote>
178
+ <details>
179
+ <summary>Bun</summary>
180
+
181
+ <blockquote>
182
+ <details>
183
+ <summary>ReadableStream (most-efficient)</summary>
184
+
185
+ ```ts
186
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
187
+
188
+ const stream = response.stream();
189
+ await Bun.write('path/to/file', stream);
190
+ ```
191
+
192
+ </details>
193
+ </blockquote>
194
+
195
+ <blockquote>
196
+ <details>
197
+ <summary>ArrayBuffer</summary>
198
+
199
+ ```ts
200
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
201
+
202
+ const arrayBuffer = await response.arrayBuffer();
203
+ await Bun.write('path/to/file', arrayBuffer);
204
+ ```
205
+
206
+ </details>
207
+ </blockquote>
208
+
209
+ <blockquote>
210
+ <details>
211
+ <summary>Blob</summary>
212
+
213
+ ```ts
214
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
215
+
216
+ const blob = await response.blob();
217
+ await Bun.write('path/to/file', blob);
218
+ ```
219
+
220
+ </details>
221
+ </blockquote>
222
+
223
+ <blockquote>
224
+ <details>
225
+ <summary>Bytes (UIntArray8)</summary>
226
+
227
+ ```ts
228
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
229
+
230
+ const bytes = await response.bytes();
231
+ await Bun.write('path/to/file', bytes);
232
+ ```
233
+
234
+ </details>
235
+ </blockquote>
236
+
237
+ </details>
238
+ </blockquote>
239
+
240
+ <blockquote>
241
+ <details>
242
+ <summary>Deno</summary>
243
+
244
+ <blockquote>
245
+ <details>
246
+ <summary>ReadableStream (most-efficient)</summary>
247
+
248
+ ```ts
249
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
250
+
251
+ const stream = response.stream();
252
+ const file = await Deno.open('path/to/file', { write: true, create: true });
253
+ await stream.pipeTo(file.writable);
254
+ ```
255
+
256
+ </details>
257
+ </blockquote>
258
+
259
+ <blockquote>
260
+ <details>
261
+ <summary>ArrayBuffer</summary>
262
+
263
+ ```ts
264
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
265
+
266
+ const arrayBuffer = await response.arrayBuffer();
267
+ await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
268
+ ```
269
+
270
+ </details>
271
+ </blockquote>
272
+
273
+ <blockquote>
274
+ <details>
275
+ <summary>Blob</summary>
276
+
277
+ ```ts
278
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
279
+
280
+ const blob = await response.blob();
281
+ const arrayBuffer = await blob.arrayBuffer();
282
+ await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
283
+ ```
284
+
285
+ </details>
286
+ </blockquote>
287
+
288
+ <blockquote>
289
+ <details>
290
+ <summary>Bytes (UIntArray8)</summary>
291
+
292
+ ```ts
293
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
294
+
295
+ const bytes = await response.bytes();
296
+ await Deno.writeFile('path/to/file', bytes);
297
+ ```
298
+
299
+ </details>
300
+ </blockquote>
301
+
302
+ </details>
303
+ </blockquote>
304
+
305
+ <blockquote>
306
+ <details>
307
+ <summary>Browser</summary>
308
+
309
+ <blockquote>
310
+ <details>
311
+ <summary>Blob (most-efficient)</summary>
312
+
313
+ ```ts
314
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
315
+
316
+ const blob = await response.blob();
317
+ const url = URL.createObjectURL(blob);
318
+
319
+ // trigger download
320
+ const a = document.createElement('a');
321
+ a.href = url;
322
+ a.download = 'filename';
323
+ a.click();
324
+ URL.revokeObjectURL(url);
325
+ ```
326
+
327
+ </details>
328
+ </blockquote>
329
+
330
+ <blockquote>
331
+ <details>
332
+ <summary>ReadableStream</summary>
333
+
334
+ ```ts
335
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
336
+
337
+ const stream = response.stream();
338
+ const reader = stream.getReader();
339
+ const chunks = [];
340
+
341
+ while (true) {
342
+ const { done, value } = await reader.read();
343
+ if (done) break;
344
+ chunks.push(value);
345
+ }
346
+
347
+ const blob = new Blob(chunks);
348
+ const url = URL.createObjectURL(blob);
349
+
350
+ // trigger download
351
+ const a = document.createElement('a');
352
+ a.href = url;
353
+ a.download = 'filename';
354
+ a.click();
355
+ URL.revokeObjectURL(url);
356
+ ```
357
+
358
+ </details>
359
+ </blockquote>
360
+
361
+ <blockquote>
362
+ <details>
363
+ <summary>ArrayBuffer</summary>
364
+
365
+ ```ts
366
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
367
+
368
+ const arrayBuffer = await response.arrayBuffer();
369
+ const blob = new Blob([arrayBuffer]);
370
+ const url = URL.createObjectURL(blob);
371
+
372
+ // trigger download
373
+ const a = document.createElement('a');
374
+ a.href = url;
375
+ a.download = 'filename';
376
+ a.click();
377
+ URL.revokeObjectURL(url);
378
+ ```
379
+
380
+ </details>
381
+ </blockquote>
382
+
383
+ <blockquote>
384
+ <details>
385
+ <summary>Bytes (UIntArray8)</summary>
386
+
387
+ ```ts
388
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
389
+
390
+ const bytes = await response.bytes();
391
+ const blob = new Blob([bytes]);
392
+ const url = URL.createObjectURL(blob);
393
+
394
+ // trigger download
395
+ const a = document.createElement('a');
396
+ a.href = url;
397
+ a.download = 'filename';
398
+ a.click();
399
+ URL.revokeObjectURL(url);
400
+ ```
401
+
402
+ </details>
403
+ </blockquote>
404
+
405
+ </details>
406
+ </blockquote>
407
+
408
+ </details>
409
+ </blockquote>
410
+
411
+ <details>
412
+ <summary>Convert binary response to text</summary>
413
+
414
+ <blockquote>
415
+ <details>
416
+ <summary>ReadableStream</summary>
417
+
418
+ ```ts
419
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
420
+
421
+ const stream = response.stream();
422
+ const text = await new Response(stream).text();
423
+ ```
424
+
425
+ </details>
426
+ </blockquote>
427
+
428
+ <blockquote>
429
+ <details>
430
+ <summary>ArrayBuffer</summary>
431
+
432
+ ```ts
433
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
434
+
435
+ const arrayBuffer = await response.arrayBuffer();
436
+ const text = new TextDecoder().decode(arrayBuffer);
437
+ ```
438
+
439
+ </details>
440
+ </blockquote>
441
+
442
+ <blockquote>
443
+ <details>
444
+ <summary>Blob</summary>
445
+
446
+ ```ts
447
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
448
+
449
+ const blob = await response.blob();
450
+ const text = await blob.text();
451
+ ```
452
+
453
+ </details>
454
+ </blockquote>
455
+
456
+ <blockquote>
457
+ <details>
458
+ <summary>Bytes (UIntArray8)</summary>
459
+
460
+ ```ts
461
+ const response = await client.taskArtifacts.images.getByMetadataIdV1(...);
462
+
463
+ const bytes = await response.bytes();
464
+ const text = new TextDecoder().decode(bytes);
465
+ ```
466
+
467
+ </details>
468
+ </blockquote>
469
+
470
+ </details>
471
+
472
+ ## Advanced
473
+
474
+ ### Additional Headers
475
+
476
+ If you would like to send additional headers as part of the request, use the `headers` request option.
477
+
478
+ ```typescript
479
+ const response = await client.payments.generateInvoiceV1(..., {
480
+ headers: {
481
+ 'X-Custom-Header': 'custom value'
482
+ }
483
+ });
484
+ ```
485
+
486
+ ### Additional Query String Parameters
487
+
488
+ If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
489
+
490
+ ```typescript
491
+ const response = await client.payments.generateInvoiceV1(..., {
492
+ queryParams: {
493
+ 'customQueryParamKey': 'custom query param value'
494
+ }
495
+ });
496
+ ```
497
+
498
+ ### Retries
499
+
500
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
501
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
502
+ retry limit (default: 2).
503
+
504
+ A request is deemed retryable when any of the following HTTP status codes is returned:
505
+
506
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
507
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
508
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
509
+
510
+ Use the `maxRetries` request option to configure this behavior.
511
+
512
+ ```typescript
513
+ const response = await client.payments.generateInvoiceV1(..., {
514
+ maxRetries: 0 // override maxRetries at the request level
515
+ });
516
+ ```
517
+
518
+ ### Timeouts
519
+
520
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
521
+
522
+ ```typescript
523
+ const response = await client.payments.generateInvoiceV1(..., {
524
+ timeoutInSeconds: 30 // override timeout to 30s
525
+ });
526
+ ```
527
+
528
+ ### Aborting Requests
529
+
530
+ The SDK allows users to abort requests at any point by passing in an abort signal.
531
+
532
+ ```typescript
533
+ const controller = new AbortController();
534
+ const response = await client.payments.generateInvoiceV1(..., {
535
+ abortSignal: controller.signal
536
+ });
537
+ controller.abort(); // aborts the request
538
+ ```
539
+
540
+ ### Access Raw Response Data
541
+
542
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
543
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
544
+
545
+ ```typescript
546
+ const { data, rawResponse } = await client.payments.generateInvoiceV1(...).withRawResponse();
547
+
548
+ console.log(data);
549
+ console.log(rawResponse.headers['X-My-Header']);
550
+ ```
551
+
552
+ ### Runtime Compatibility
553
+
554
+ The SDK works in the following runtimes:
555
+
556
+ - Node.js 18+
557
+ - Vercel
558
+ - Cloudflare Workers
559
+ - Deno v1.25+
560
+ - Bun 1.0+
561
+ - React Native
562
+
563
+ ### Customizing Fetch Client
564
+
565
+ The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
566
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
567
+
568
+ ```typescript
569
+ import { ChrtClient } from "@chrt-inc/typescript-sdk";
570
+
571
+ const client = new ChrtClient({
572
+ ...
573
+ fetcher: // provide your implementation here
574
+ });
575
+ ```
576
+
577
+ ## Contributing
578
+
579
+ While we value open-source contributions to this SDK, this library is generated programmatically.
580
+ Additions made directly to this library would have to be moved over to our generation code,
581
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
582
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
583
+ an issue first to discuss with us!
584
+
585
+ On the other hand, contributions to the README are always very welcome!
@@ -71,8 +71,8 @@ class ChrtClient {
71
71
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
72
72
  "X-Fern-Language": "JavaScript",
73
73
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
74
- "X-Fern-SDK-Version": "1.304.0",
75
- "User-Agent": "@chrt-inc/typescript-sdk/1.304.0",
74
+ "X-Fern-SDK-Version": "1.306.0",
75
+ "User-Agent": "@chrt-inc/typescript-sdk/1.306.0",
76
76
  "X-Fern-Runtime": core.RUNTIME.type,
77
77
  "X-Fern-Runtime-Version": core.RUNTIME.version,
78
78
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -31,7 +31,7 @@ export declare class Drivers {
31
31
  protected readonly _options: Drivers.Options;
32
32
  constructor(_options?: Drivers.Options);
33
33
  /**
34
- * Lists all organization members paired with their driver information if they are drivers.
34
+ * Lists all organization members paired with their driver information if they are drivers. | () -> (list[OrgMembersAndDrivers])
35
35
  *
36
36
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
37
37
  *
@@ -41,7 +41,7 @@ export declare class Drivers {
41
41
  listOrgMembersAndDriversV1(requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<Chrt.OrgMembersAndDrivers[]>;
42
42
  private __listOrgMembersAndDriversV1;
43
43
  /**
44
- * Lists all drivers belonging to the authenticated organization.
44
+ * Lists all drivers belonging to the authenticated organization. | () -> (list[Driver1])
45
45
  *
46
46
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
47
47
  *
@@ -51,7 +51,7 @@ export declare class Drivers {
51
51
  listV1(requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<Chrt.Driver1[]>;
52
52
  private __listV1;
53
53
  /**
54
- * Creates a new driver profile for an organization member with optional vehicle type assignments.
54
+ * Creates a new driver profile for an organization member with optional vehicle type assignments. | (DriverCreateReq) -> (PydanticObjectId)
55
55
  *
56
56
  * @param {Chrt.DriverCreateReq} request
57
57
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
@@ -69,7 +69,7 @@ export declare class Drivers {
69
69
  createV1(request: Chrt.DriverCreateReq, requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<string>;
70
70
  private __createV1;
71
71
  /**
72
- * Retrieves driver information for the authenticated user within their organization.
72
+ * Retrieves driver information for the authenticated user within their organization. | () -> (Driver1)
73
73
  *
74
74
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
75
75
  *
@@ -79,7 +79,7 @@ export declare class Drivers {
79
79
  getV1(requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<Chrt.Driver1>;
80
80
  private __getV1;
81
81
  /**
82
- * Retrieves detailed driver information by driver ID within the organization.
82
+ * Retrieves detailed driver information by driver ID within the organization. | () -> (Driver1)
83
83
  *
84
84
  * @param {string} driverId
85
85
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
@@ -92,7 +92,7 @@ export declare class Drivers {
92
92
  getByDriverIdV1(driverId: string, requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<Chrt.Driver1>;
93
93
  private __getByDriverIdV1;
94
94
  /**
95
- * Deletes a driver from the organization and removes them from associated rate sheets.
95
+ * Deletes a driver from the organization and removes them from associated rate sheets. | () -> (bool)
96
96
  *
97
97
  * @param {string} driverId
98
98
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
@@ -105,7 +105,7 @@ export declare class Drivers {
105
105
  deleteV1(driverId: string, requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<boolean>;
106
106
  private __deleteV1;
107
107
  /**
108
- * Sets the activation status of a driver (active/inactive) within the organization.
108
+ * Sets the activation status of a driver (active/inactive) within the organization. | (SetDriverActivationReq) -> (bool)
109
109
  *
110
110
  * @param {Chrt.SetDriverActivationReq} request
111
111
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
@@ -121,7 +121,7 @@ export declare class Drivers {
121
121
  setActivationV1(request: Chrt.SetDriverActivationReq, requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<boolean>;
122
122
  private __setActivationV1;
123
123
  /**
124
- * Updates the driver's last known location and timestamp for tracking purposes.
124
+ * Updates the driver's last known location and timestamp for tracking purposes. | (DriverLastSeenReq) -> (bool)
125
125
  *
126
126
  * @param {Chrt.DriverLastSeenReq} request
127
127
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
@@ -145,7 +145,7 @@ export declare class Drivers {
145
145
  lastSeenV1(request: Chrt.DriverLastSeenReq, requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<boolean>;
146
146
  private __lastSeenV1;
147
147
  /**
148
- * Clears the driver's last known location and timestamp.
148
+ * Clears the driver's last known location and timestamp. | () -> (bool)
149
149
  *
150
150
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.
151
151
  *
@@ -155,7 +155,7 @@ export declare class Drivers {
155
155
  lastSeenClearV1(requestOptions?: Drivers.RequestOptions): core.HttpResponsePromise<boolean>;
156
156
  private __lastSeenClearV1;
157
157
  /**
158
- * Updates driver contact details and vehicle type assignments within the organization.
158
+ * Updates driver contact details and vehicle type assignments within the organization. | (UpdateDriverDetailsReq) -> (bool)
159
159
  *
160
160
  * @param {Chrt.UpdateDriverDetailsReq} request
161
161
  * @param {Drivers.RequestOptions} requestOptions - Request-specific configuration.