@gleanwork/api-client 0.13.2 → 0.13.3

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