@gleanwork/api-client 0.1.0-beta.2 → 0.1.0-beta.4

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 (110) hide show
  1. package/README.md +34 -28
  2. package/dist/commonjs/__tests__/chat.test.js +233 -414
  3. package/dist/commonjs/__tests__/chat.test.js.map +1 -1
  4. package/dist/commonjs/funcs/chatChatStream.d.ts +16 -0
  5. package/dist/commonjs/funcs/chatChatStream.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/chatChatStream.js +121 -0
  7. package/dist/commonjs/funcs/chatChatStream.js.map +1 -0
  8. package/dist/commonjs/funcs/clientChatStart.d.ts +1 -1
  9. package/dist/commonjs/funcs/clientChatStart.d.ts.map +1 -1
  10. package/dist/commonjs/funcs/clientChatStart.js +3 -3
  11. package/dist/commonjs/funcs/clientChatStart.js.map +1 -1
  12. package/dist/commonjs/lib/config.d.ts +3 -3
  13. package/dist/commonjs/lib/config.js +3 -3
  14. package/dist/commonjs/models/operations/chatstream.d.ts +38 -0
  15. package/dist/commonjs/models/operations/chatstream.d.ts.map +1 -0
  16. package/dist/commonjs/models/operations/chatstream.js +81 -0
  17. package/dist/commonjs/models/operations/chatstream.js.map +1 -0
  18. package/dist/commonjs/models/operations/index.d.ts +1 -0
  19. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  20. package/dist/commonjs/models/operations/index.js +1 -0
  21. package/dist/commonjs/models/operations/index.js.map +1 -1
  22. package/dist/commonjs/react-query/chatChatStream.d.ts +24 -0
  23. package/dist/commonjs/react-query/chatChatStream.d.ts.map +1 -0
  24. package/dist/commonjs/react-query/chatChatStream.js +47 -0
  25. package/dist/commonjs/react-query/chatChatStream.js.map +1 -0
  26. package/dist/commonjs/react-query/clientChatStart.d.ts +1 -1
  27. package/dist/commonjs/react-query/clientChatStart.d.ts.map +1 -1
  28. package/dist/commonjs/react-query/index.d.ts +1 -0
  29. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  30. package/dist/commonjs/react-query/index.js +1 -0
  31. package/dist/commonjs/react-query/index.js.map +1 -1
  32. package/dist/commonjs/sdk/chat.d.ts +1 -57
  33. package/dist/commonjs/sdk/chat.d.ts.map +1 -1
  34. package/dist/commonjs/sdk/chat.js +3 -83
  35. package/dist/commonjs/sdk/chat.js.map +1 -1
  36. package/dist/commonjs/sdk/client.d.ts +2 -2
  37. package/dist/commonjs/sdk/client.d.ts.map +1 -1
  38. package/dist/commonjs/sdk/client.js +2 -2
  39. package/dist/commonjs/sdk/client.js.map +1 -1
  40. package/dist/commonjs/sdk/clientchat.d.ts +68 -0
  41. package/dist/commonjs/sdk/clientchat.d.ts.map +1 -0
  42. package/dist/commonjs/sdk/clientchat.js +102 -0
  43. package/dist/commonjs/sdk/clientchat.js.map +1 -0
  44. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  45. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  46. package/dist/commonjs/sdk/sdk.js +4 -0
  47. package/dist/commonjs/sdk/sdk.js.map +1 -1
  48. package/dist/esm/__tests__/chat.test.js +234 -415
  49. package/dist/esm/__tests__/chat.test.js.map +1 -1
  50. package/dist/esm/funcs/chatChatStream.d.ts +16 -0
  51. package/dist/esm/funcs/chatChatStream.d.ts.map +1 -0
  52. package/dist/esm/funcs/chatChatStream.js +85 -0
  53. package/dist/esm/funcs/chatChatStream.js.map +1 -0
  54. package/dist/esm/funcs/clientChatStart.d.ts +1 -1
  55. package/dist/esm/funcs/clientChatStart.d.ts.map +1 -1
  56. package/dist/esm/funcs/clientChatStart.js +3 -3
  57. package/dist/esm/funcs/clientChatStart.js.map +1 -1
  58. package/dist/esm/lib/config.d.ts +3 -3
  59. package/dist/esm/lib/config.js +3 -3
  60. package/dist/esm/models/operations/chatstream.d.ts +38 -0
  61. package/dist/esm/models/operations/chatstream.d.ts.map +1 -0
  62. package/dist/esm/models/operations/chatstream.js +43 -0
  63. package/dist/esm/models/operations/chatstream.js.map +1 -0
  64. package/dist/esm/models/operations/index.d.ts +1 -0
  65. package/dist/esm/models/operations/index.d.ts.map +1 -1
  66. package/dist/esm/models/operations/index.js +1 -0
  67. package/dist/esm/models/operations/index.js.map +1 -1
  68. package/dist/esm/react-query/chatChatStream.d.ts +24 -0
  69. package/dist/esm/react-query/chatChatStream.d.ts.map +1 -0
  70. package/dist/esm/react-query/chatChatStream.js +42 -0
  71. package/dist/esm/react-query/chatChatStream.js.map +1 -0
  72. package/dist/esm/react-query/clientChatStart.d.ts +1 -1
  73. package/dist/esm/react-query/clientChatStart.d.ts.map +1 -1
  74. package/dist/esm/react-query/index.d.ts +1 -0
  75. package/dist/esm/react-query/index.d.ts.map +1 -1
  76. package/dist/esm/react-query/index.js +1 -0
  77. package/dist/esm/react-query/index.js.map +1 -1
  78. package/dist/esm/sdk/chat.d.ts +1 -57
  79. package/dist/esm/sdk/chat.d.ts.map +1 -1
  80. package/dist/esm/sdk/chat.js +3 -83
  81. package/dist/esm/sdk/chat.js.map +1 -1
  82. package/dist/esm/sdk/client.d.ts +2 -2
  83. package/dist/esm/sdk/client.d.ts.map +1 -1
  84. package/dist/esm/sdk/client.js +2 -2
  85. package/dist/esm/sdk/client.js.map +1 -1
  86. package/dist/esm/sdk/clientchat.d.ts +68 -0
  87. package/dist/esm/sdk/clientchat.d.ts.map +1 -0
  88. package/dist/esm/sdk/clientchat.js +98 -0
  89. package/dist/esm/sdk/clientchat.js.map +1 -0
  90. package/dist/esm/sdk/sdk.d.ts +3 -0
  91. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  92. package/dist/esm/sdk/sdk.js +4 -0
  93. package/dist/esm/sdk/sdk.js.map +1 -1
  94. package/docs/sdks/chat/README.md +8 -768
  95. package/docs/sdks/clientchat/README.md +878 -0
  96. package/jsr.json +1 -1
  97. package/package.json +1 -1
  98. package/src/__tests__/chat.test.ts +292 -457
  99. package/src/funcs/chatChatStream.ts +169 -0
  100. package/src/funcs/clientChatStart.ts +5 -6
  101. package/src/lib/config.ts +3 -3
  102. package/src/models/operations/chatstream.ts +86 -0
  103. package/src/models/operations/index.ts +1 -0
  104. package/src/react-query/chatChatStream.ts +91 -0
  105. package/src/react-query/clientChatStart.ts +1 -1
  106. package/src/react-query/index.ts +1 -0
  107. package/src/sdk/chat.ts +3 -159
  108. package/src/sdk/client.ts +4 -4
  109. package/src/sdk/clientchat.ts +185 -0
  110. package/src/sdk/sdk.ts +6 -0
@@ -1,21 +1,13 @@
1
1
  # Chat
2
- (*client.chat*)
2
+ (*chat*)
3
3
 
4
4
  ## Overview
5
5
 
6
6
  ### Available Operations
7
7
 
8
- * [start](#start) - Chat
9
- * [deleteAll](#deleteall) - Deletes all saved Chats owned by a user
10
- * [delete](#delete) - Deletes saved Chats
11
- * [get](#get) - Retrieves a Chat
12
- * [list](#list) - Retrieves all saved Chats
13
- * [getApplication](#getapplication) - Gets the metadata for a custom Chat application
14
- * [uploadFiles](#uploadfiles) - Upload files for Chat.
15
- * [getFiles](#getfiles) - Get files uploaded by a user for Chat.
16
- * [deleteFiles](#deletefiles) - Delete files uploaded by a user for chat.
8
+ * [chatStream](#chatstream) - Chat
17
9
 
18
- ## start
10
+ ## chatStream
19
11
 
20
12
  Have a conversation with Glean AI.
21
13
 
@@ -29,7 +21,7 @@ const glean = new Glean({
29
21
  });
30
22
 
31
23
  async function run() {
32
- const result = await glean.client.chat.start({
24
+ const result = await glean.chat.chatStream({
33
25
  messages: [
34
26
  {
35
27
  fragments: [
@@ -54,7 +46,7 @@ The standalone function version of this method:
54
46
 
55
47
  ```typescript
56
48
  import { GleanCore } from "@gleanwork/api-client/core.js";
57
- import { clientChatStart } from "@gleanwork/api-client/funcs/clientChatStart.js";
49
+ import { chatChatStream } from "@gleanwork/api-client/funcs/chatChatStream.js";
58
50
 
59
51
  // Use `GleanCore` for best tree-shaking performance.
60
52
  // You can create one instance of it to use across an application.
@@ -63,7 +55,7 @@ const glean = new GleanCore({
63
55
  });
64
56
 
65
57
  async function run() {
66
- const res = await clientChatStart(glean, {
58
+ const res = await chatChatStream(glean, {
67
59
  messages: [
68
60
  {
69
61
  fragments: [
@@ -101,8 +93,8 @@ associated utilities.
101
93
  ```tsx
102
94
  import {
103
95
  // Mutation hook for triggering the API call.
104
- useClientChatStartMutation
105
- } from "@gleanwork/api-client/react-query/clientChatStart.js";
96
+ useChatChatStreamMutation
97
+ } from "@gleanwork/api-client/react-query/chatChatStream.js";
106
98
  ```
107
99
 
108
100
  ### Parameters
@@ -121,758 +113,6 @@ import {
121
113
 
122
114
  ### Errors
123
115
 
124
- | Error Type | Status Code | Content Type |
125
- | ----------------- | ----------------- | ----------------- |
126
- | errors.GleanError | 4XX, 5XX | \*/\* |
127
-
128
- ## deleteAll
129
-
130
- Deletes all saved Chats a user has had and all their contained conversational content.
131
-
132
- ### Example Usage
133
-
134
- ```typescript
135
- import { Glean } from "@gleanwork/api-client";
136
-
137
- const glean = new Glean({
138
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
139
- });
140
-
141
- async function run() {
142
- await glean.client.chat.deleteAll();
143
-
144
-
145
- }
146
-
147
- run();
148
- ```
149
-
150
- ### Standalone function
151
-
152
- The standalone function version of this method:
153
-
154
- ```typescript
155
- import { GleanCore } from "@gleanwork/api-client/core.js";
156
- import { clientChatDeleteAll } from "@gleanwork/api-client/funcs/clientChatDeleteAll.js";
157
-
158
- // Use `GleanCore` for best tree-shaking performance.
159
- // You can create one instance of it to use across an application.
160
- const glean = new GleanCore({
161
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
162
- });
163
-
164
- async function run() {
165
- const res = await clientChatDeleteAll(glean);
166
-
167
- if (!res.ok) {
168
- throw res.error;
169
- }
170
-
171
- const { value: result } = res;
172
-
173
-
174
- }
175
-
176
- run();
177
- ```
178
-
179
- ### React hooks and utilities
180
-
181
- This method can be used in React components through the following hooks and
182
- associated utilities.
183
-
184
- > Check out [this guide][hook-guide] for information about each of the utilities
185
- > below and how to get started using React hooks.
186
-
187
- [hook-guide]: ../../../REACT_QUERY.md
188
-
189
- ```tsx
190
- import {
191
- // Mutation hook for triggering the API call.
192
- useClientChatDeleteAllMutation
193
- } from "@gleanwork/api-client/react-query/clientChatDeleteAll.js";
194
- ```
195
-
196
- ### Parameters
197
-
198
- | Parameter | Type | Required | Description |
199
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
200
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
201
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
202
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
203
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
204
-
205
- ### Response
206
-
207
- **Promise\<void\>**
208
-
209
- ### Errors
210
-
211
- | Error Type | Status Code | Content Type |
212
- | ----------------- | ----------------- | ----------------- |
213
- | errors.GleanError | 4XX, 5XX | \*/\* |
214
-
215
- ## delete
216
-
217
- Deletes saved Chats and all their contained conversational content.
218
-
219
- ### Example Usage
220
-
221
- ```typescript
222
- import { Glean } from "@gleanwork/api-client";
223
-
224
- const glean = new Glean({
225
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
226
- });
227
-
228
- async function run() {
229
- await glean.client.chat.delete({
230
- ids: [
231
- "<value>",
232
- "<value>",
233
- ],
234
- });
235
-
236
-
237
- }
238
-
239
- run();
240
- ```
241
-
242
- ### Standalone function
243
-
244
- The standalone function version of this method:
245
-
246
- ```typescript
247
- import { GleanCore } from "@gleanwork/api-client/core.js";
248
- import { clientChatDelete } from "@gleanwork/api-client/funcs/clientChatDelete.js";
249
-
250
- // Use `GleanCore` for best tree-shaking performance.
251
- // You can create one instance of it to use across an application.
252
- const glean = new GleanCore({
253
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
254
- });
255
-
256
- async function run() {
257
- const res = await clientChatDelete(glean, {
258
- ids: [
259
- "<value>",
260
- "<value>",
261
- ],
262
- });
263
-
264
- if (!res.ok) {
265
- throw res.error;
266
- }
267
-
268
- const { value: result } = res;
269
-
270
-
271
- }
272
-
273
- run();
274
- ```
275
-
276
- ### React hooks and utilities
277
-
278
- This method can be used in React components through the following hooks and
279
- associated utilities.
280
-
281
- > Check out [this guide][hook-guide] for information about each of the utilities
282
- > below and how to get started using React hooks.
283
-
284
- [hook-guide]: ../../../REACT_QUERY.md
285
-
286
- ```tsx
287
- import {
288
- // Mutation hook for triggering the API call.
289
- useClientChatDeleteMutation
290
- } from "@gleanwork/api-client/react-query/clientChatDelete.js";
291
- ```
292
-
293
- ### Parameters
294
-
295
- | Parameter | Type | Required | Description |
296
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
297
- | `deleteChatsRequest` | [components.DeleteChatsRequest](../../models/components/deletechatsrequest.md) | :heavy_check_mark: | N/A |
298
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
299
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
300
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
301
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
302
-
303
- ### Response
304
-
305
- **Promise\<void\>**
306
-
307
- ### Errors
308
-
309
- | Error Type | Status Code | Content Type |
310
- | ----------------- | ----------------- | ----------------- |
311
- | errors.GleanError | 4XX, 5XX | \*/\* |
312
-
313
- ## get
314
-
315
- Retrieves the chat history between Glean Assistant and the user for a given Chat.
316
-
317
- ### Example Usage
318
-
319
- ```typescript
320
- import { Glean } from "@gleanwork/api-client";
321
-
322
- const glean = new Glean({
323
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
324
- });
325
-
326
- async function run() {
327
- const result = await glean.client.chat.get({
328
- id: "<id>",
329
- });
330
-
331
- // Handle the result
332
- console.log(result);
333
- }
334
-
335
- run();
336
- ```
337
-
338
- ### Standalone function
339
-
340
- The standalone function version of this method:
341
-
342
- ```typescript
343
- import { GleanCore } from "@gleanwork/api-client/core.js";
344
- import { clientChatGet } from "@gleanwork/api-client/funcs/clientChatGet.js";
345
-
346
- // Use `GleanCore` for best tree-shaking performance.
347
- // You can create one instance of it to use across an application.
348
- const glean = new GleanCore({
349
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
350
- });
351
-
352
- async function run() {
353
- const res = await clientChatGet(glean, {
354
- id: "<id>",
355
- });
356
-
357
- if (!res.ok) {
358
- throw res.error;
359
- }
360
-
361
- const { value: result } = res;
362
-
363
- // Handle the result
364
- console.log(result);
365
- }
366
-
367
- run();
368
- ```
369
-
370
- ### React hooks and utilities
371
-
372
- This method can be used in React components through the following hooks and
373
- associated utilities.
374
-
375
- > Check out [this guide][hook-guide] for information about each of the utilities
376
- > below and how to get started using React hooks.
377
-
378
- [hook-guide]: ../../../REACT_QUERY.md
379
-
380
- ```tsx
381
- import {
382
- // Mutation hook for triggering the API call.
383
- useClientChatGetMutation
384
- } from "@gleanwork/api-client/react-query/clientChatGet.js";
385
- ```
386
-
387
- ### Parameters
388
-
389
- | Parameter | Type | Required | Description |
390
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
391
- | `getChatRequest` | [components.GetChatRequest](../../models/components/getchatrequest.md) | :heavy_check_mark: | N/A |
392
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
393
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
394
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
395
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
396
-
397
- ### Response
398
-
399
- **Promise\<[components.GetChatResponse](../../models/components/getchatresponse.md)\>**
400
-
401
- ### Errors
402
-
403
- | Error Type | Status Code | Content Type |
404
- | ----------------- | ----------------- | ----------------- |
405
- | errors.GleanError | 4XX, 5XX | \*/\* |
406
-
407
- ## list
408
-
409
- Retrieves all the saved Chats between Glean Assistant and the user. The returned Chats contain only metadata and no conversational content.
410
-
411
- ### Example Usage
412
-
413
- ```typescript
414
- import { Glean } from "@gleanwork/api-client";
415
-
416
- const glean = new Glean({
417
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
418
- });
419
-
420
- async function run() {
421
- const result = await glean.client.chat.list();
422
-
423
- // Handle the result
424
- console.log(result);
425
- }
426
-
427
- run();
428
- ```
429
-
430
- ### Standalone function
431
-
432
- The standalone function version of this method:
433
-
434
- ```typescript
435
- import { GleanCore } from "@gleanwork/api-client/core.js";
436
- import { clientChatList } from "@gleanwork/api-client/funcs/clientChatList.js";
437
-
438
- // Use `GleanCore` for best tree-shaking performance.
439
- // You can create one instance of it to use across an application.
440
- const glean = new GleanCore({
441
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
442
- });
443
-
444
- async function run() {
445
- const res = await clientChatList(glean);
446
-
447
- if (!res.ok) {
448
- throw res.error;
449
- }
450
-
451
- const { value: result } = res;
452
-
453
- // Handle the result
454
- console.log(result);
455
- }
456
-
457
- run();
458
- ```
459
-
460
- ### React hooks and utilities
461
-
462
- This method can be used in React components through the following hooks and
463
- associated utilities.
464
-
465
- > Check out [this guide][hook-guide] for information about each of the utilities
466
- > below and how to get started using React hooks.
467
-
468
- [hook-guide]: ../../../REACT_QUERY.md
469
-
470
- ```tsx
471
- import {
472
- // Mutation hook for triggering the API call.
473
- useClientChatListMutation
474
- } from "@gleanwork/api-client/react-query/clientChatList.js";
475
- ```
476
-
477
- ### Parameters
478
-
479
- | Parameter | Type | Required | Description |
480
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
481
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
482
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
483
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
484
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
485
-
486
- ### Response
487
-
488
- **Promise\<[components.ListChatsResponse](../../models/components/listchatsresponse.md)\>**
489
-
490
- ### Errors
491
-
492
- | Error Type | Status Code | Content Type |
493
- | ----------------- | ----------------- | ----------------- |
494
- | errors.GleanError | 4XX, 5XX | \*/\* |
495
-
496
- ## getApplication
497
-
498
- Gets the Chat application details for the specified application ID.
499
-
500
- ### Example Usage
501
-
502
- ```typescript
503
- import { Glean } from "@gleanwork/api-client";
504
-
505
- const glean = new Glean({
506
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
507
- });
508
-
509
- async function run() {
510
- const result = await glean.client.chat.getApplication({
511
- id: "<id>",
512
- });
513
-
514
- // Handle the result
515
- console.log(result);
516
- }
517
-
518
- run();
519
- ```
520
-
521
- ### Standalone function
522
-
523
- The standalone function version of this method:
524
-
525
- ```typescript
526
- import { GleanCore } from "@gleanwork/api-client/core.js";
527
- import { clientChatGetApplication } from "@gleanwork/api-client/funcs/clientChatGetApplication.js";
528
-
529
- // Use `GleanCore` for best tree-shaking performance.
530
- // You can create one instance of it to use across an application.
531
- const glean = new GleanCore({
532
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
533
- });
534
-
535
- async function run() {
536
- const res = await clientChatGetApplication(glean, {
537
- id: "<id>",
538
- });
539
-
540
- if (!res.ok) {
541
- throw res.error;
542
- }
543
-
544
- const { value: result } = res;
545
-
546
- // Handle the result
547
- console.log(result);
548
- }
549
-
550
- run();
551
- ```
552
-
553
- ### React hooks and utilities
554
-
555
- This method can be used in React components through the following hooks and
556
- associated utilities.
557
-
558
- > Check out [this guide][hook-guide] for information about each of the utilities
559
- > below and how to get started using React hooks.
560
-
561
- [hook-guide]: ../../../REACT_QUERY.md
562
-
563
- ```tsx
564
- import {
565
- // Mutation hook for triggering the API call.
566
- useClientChatGetApplicationMutation
567
- } from "@gleanwork/api-client/react-query/clientChatGetApplication.js";
568
- ```
569
-
570
- ### Parameters
571
-
572
- | Parameter | Type | Required | Description |
573
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
574
- | `getChatApplicationRequest` | [components.GetChatApplicationRequest](../../models/components/getchatapplicationrequest.md) | :heavy_check_mark: | N/A |
575
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
576
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
577
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
578
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
579
-
580
- ### Response
581
-
582
- **Promise\<[components.GetChatApplicationResponse](../../models/components/getchatapplicationresponse.md)\>**
583
-
584
- ### Errors
585
-
586
- | Error Type | Status Code | Content Type |
587
- | ----------------- | ----------------- | ----------------- |
588
- | errors.GleanError | 4XX, 5XX | \*/\* |
589
-
590
- ## uploadFiles
591
-
592
- Upload files for Chat.
593
-
594
- ### Example Usage
595
-
596
- ```typescript
597
- import { Glean } from "@gleanwork/api-client";
598
-
599
- const glean = new Glean({
600
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
601
- });
602
-
603
- async function run() {
604
- const result = await glean.client.chat.uploadFiles({
605
- files: [],
606
- });
607
-
608
- // Handle the result
609
- console.log(result);
610
- }
611
-
612
- run();
613
- ```
614
-
615
- ### Standalone function
616
-
617
- The standalone function version of this method:
618
-
619
- ```typescript
620
- import { GleanCore } from "@gleanwork/api-client/core.js";
621
- import { clientChatUploadFiles } from "@gleanwork/api-client/funcs/clientChatUploadFiles.js";
622
-
623
- // Use `GleanCore` for best tree-shaking performance.
624
- // You can create one instance of it to use across an application.
625
- const glean = new GleanCore({
626
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
627
- });
628
-
629
- async function run() {
630
- const res = await clientChatUploadFiles(glean, {
631
- files: [],
632
- });
633
-
634
- if (!res.ok) {
635
- throw res.error;
636
- }
637
-
638
- const { value: result } = res;
639
-
640
- // Handle the result
641
- console.log(result);
642
- }
643
-
644
- run();
645
- ```
646
-
647
- ### React hooks and utilities
648
-
649
- This method can be used in React components through the following hooks and
650
- associated utilities.
651
-
652
- > Check out [this guide][hook-guide] for information about each of the utilities
653
- > below and how to get started using React hooks.
654
-
655
- [hook-guide]: ../../../REACT_QUERY.md
656
-
657
- ```tsx
658
- import {
659
- // Mutation hook for triggering the API call.
660
- useClientChatUploadFilesMutation
661
- } from "@gleanwork/api-client/react-query/clientChatUploadFiles.js";
662
- ```
663
-
664
- ### Parameters
665
-
666
- | Parameter | Type | Required | Description |
667
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
668
- | `uploadChatFilesRequest` | [components.UploadChatFilesRequest](../../models/components/uploadchatfilesrequest.md) | :heavy_check_mark: | N/A |
669
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
670
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
671
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
672
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
673
-
674
- ### Response
675
-
676
- **Promise\<[components.UploadChatFilesResponse](../../models/components/uploadchatfilesresponse.md)\>**
677
-
678
- ### Errors
679
-
680
- | Error Type | Status Code | Content Type |
681
- | ----------------- | ----------------- | ----------------- |
682
- | errors.GleanError | 4XX, 5XX | \*/\* |
683
-
684
- ## getFiles
685
-
686
- Get files uploaded by a user for Chat.
687
-
688
- ### Example Usage
689
-
690
- ```typescript
691
- import { Glean } from "@gleanwork/api-client";
692
-
693
- const glean = new Glean({
694
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
695
- });
696
-
697
- async function run() {
698
- const result = await glean.client.chat.getFiles({
699
- fileIds: [
700
- "<value>",
701
- "<value>",
702
- ],
703
- });
704
-
705
- // Handle the result
706
- console.log(result);
707
- }
708
-
709
- run();
710
- ```
711
-
712
- ### Standalone function
713
-
714
- The standalone function version of this method:
715
-
716
- ```typescript
717
- import { GleanCore } from "@gleanwork/api-client/core.js";
718
- import { clientChatGetFiles } from "@gleanwork/api-client/funcs/clientChatGetFiles.js";
719
-
720
- // Use `GleanCore` for best tree-shaking performance.
721
- // You can create one instance of it to use across an application.
722
- const glean = new GleanCore({
723
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
724
- });
725
-
726
- async function run() {
727
- const res = await clientChatGetFiles(glean, {
728
- fileIds: [
729
- "<value>",
730
- "<value>",
731
- ],
732
- });
733
-
734
- if (!res.ok) {
735
- throw res.error;
736
- }
737
-
738
- const { value: result } = res;
739
-
740
- // Handle the result
741
- console.log(result);
742
- }
743
-
744
- run();
745
- ```
746
-
747
- ### React hooks and utilities
748
-
749
- This method can be used in React components through the following hooks and
750
- associated utilities.
751
-
752
- > Check out [this guide][hook-guide] for information about each of the utilities
753
- > below and how to get started using React hooks.
754
-
755
- [hook-guide]: ../../../REACT_QUERY.md
756
-
757
- ```tsx
758
- import {
759
- // Mutation hook for triggering the API call.
760
- useClientChatGetFilesMutation
761
- } from "@gleanwork/api-client/react-query/clientChatGetFiles.js";
762
- ```
763
-
764
- ### Parameters
765
-
766
- | Parameter | Type | Required | Description |
767
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
768
- | `getChatFilesRequest` | [components.GetChatFilesRequest](../../models/components/getchatfilesrequest.md) | :heavy_check_mark: | N/A |
769
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
770
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
771
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
772
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
773
-
774
- ### Response
775
-
776
- **Promise\<[components.GetChatFilesResponse](../../models/components/getchatfilesresponse.md)\>**
777
-
778
- ### Errors
779
-
780
- | Error Type | Status Code | Content Type |
781
- | ----------------- | ----------------- | ----------------- |
782
- | errors.GleanError | 4XX, 5XX | \*/\* |
783
-
784
- ## deleteFiles
785
-
786
- Delete files uploaded by a user for Chat.
787
-
788
- ### Example Usage
789
-
790
- ```typescript
791
- import { Glean } from "@gleanwork/api-client";
792
-
793
- const glean = new Glean({
794
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
795
- });
796
-
797
- async function run() {
798
- await glean.client.chat.deleteFiles({
799
- fileIds: [
800
- "<value>",
801
- ],
802
- });
803
-
804
-
805
- }
806
-
807
- run();
808
- ```
809
-
810
- ### Standalone function
811
-
812
- The standalone function version of this method:
813
-
814
- ```typescript
815
- import { GleanCore } from "@gleanwork/api-client/core.js";
816
- import { clientChatDeleteFiles } from "@gleanwork/api-client/funcs/clientChatDeleteFiles.js";
817
-
818
- // Use `GleanCore` for best tree-shaking performance.
819
- // You can create one instance of it to use across an application.
820
- const glean = new GleanCore({
821
- bearerAuth: process.env["GLEAN_BEARER_AUTH"] ?? "",
822
- });
823
-
824
- async function run() {
825
- const res = await clientChatDeleteFiles(glean, {
826
- fileIds: [
827
- "<value>",
828
- ],
829
- });
830
-
831
- if (!res.ok) {
832
- throw res.error;
833
- }
834
-
835
- const { value: result } = res;
836
-
837
-
838
- }
839
-
840
- run();
841
- ```
842
-
843
- ### React hooks and utilities
844
-
845
- This method can be used in React components through the following hooks and
846
- associated utilities.
847
-
848
- > Check out [this guide][hook-guide] for information about each of the utilities
849
- > below and how to get started using React hooks.
850
-
851
- [hook-guide]: ../../../REACT_QUERY.md
852
-
853
- ```tsx
854
- import {
855
- // Mutation hook for triggering the API call.
856
- useClientChatDeleteFilesMutation
857
- } from "@gleanwork/api-client/react-query/clientChatDeleteFiles.js";
858
- ```
859
-
860
- ### Parameters
861
-
862
- | Parameter | Type | Required | Description |
863
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
864
- | `deleteChatFilesRequest` | [components.DeleteChatFilesRequest](../../models/components/deletechatfilesrequest.md) | :heavy_check_mark: | N/A |
865
- | `timezoneOffset` | *number* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. |
866
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
867
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
868
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
869
-
870
- ### Response
871
-
872
- **Promise\<void\>**
873
-
874
- ### Errors
875
-
876
116
  | Error Type | Status Code | Content Type |
877
117
  | ----------------- | ----------------- | ----------------- |
878
118
  | errors.GleanError | 4XX, 5XX | \*/\* |