@gleanwork/api-client 0.13.1 → 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.
- package/README.md +2 -1
- package/dist/commonjs/__tests__/messages.test.js +1 -1
- package/dist/commonjs/__tests__/messages.test.js.map +1 -1
- package/dist/commonjs/__tests__/summarize.test.js +4 -3
- package/dist/commonjs/__tests__/summarize.test.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/agentsinsightsv2response.d.ts +4 -0
- package/dist/commonjs/models/components/agentsinsightsv2response.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentsinsightsv2response.js +4 -0
- package/dist/commonjs/models/components/agentsinsightsv2response.js.map +1 -1
- package/dist/commonjs/models/components/chatmessagefragment.d.ts +1 -1
- package/dist/commonjs/models/components/debugdatasourcestatusresponse.d.ts +3 -1
- package/dist/commonjs/models/components/debugdatasourcestatusresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/debugdatasourcestatusresponse.js.map +1 -1
- package/dist/commonjs/models/components/peragentinsight.d.ts +10 -0
- package/dist/commonjs/models/components/peragentinsight.d.ts.map +1 -1
- package/dist/commonjs/models/components/peragentinsight.js +4 -0
- package/dist/commonjs/models/components/peragentinsight.js.map +1 -1
- package/dist/esm/__tests__/messages.test.js +1 -1
- package/dist/esm/__tests__/messages.test.js.map +1 -1
- package/dist/esm/__tests__/summarize.test.js +4 -3
- package/dist/esm/__tests__/summarize.test.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/agentsinsightsv2response.d.ts +4 -0
- package/dist/esm/models/components/agentsinsightsv2response.d.ts.map +1 -1
- package/dist/esm/models/components/agentsinsightsv2response.js +4 -0
- package/dist/esm/models/components/agentsinsightsv2response.js.map +1 -1
- package/dist/esm/models/components/chatmessagefragment.d.ts +1 -1
- package/dist/esm/models/components/debugdatasourcestatusresponse.d.ts +3 -1
- package/dist/esm/models/components/debugdatasourcestatusresponse.d.ts.map +1 -1
- package/dist/esm/models/components/debugdatasourcestatusresponse.js.map +1 -1
- package/dist/esm/models/components/peragentinsight.d.ts +10 -0
- package/dist/esm/models/components/peragentinsight.d.ts.map +1 -1
- package/dist/esm/models/components/peragentinsight.js +4 -0
- package/dist/esm/models/components/peragentinsight.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/messages.test.ts +1 -1
- package/src/__tests__/summarize.test.ts +4 -3
- package/src/lib/config.ts +3 -3
- package/src/models/components/agentsinsightsv2response.ts +8 -0
- package/src/models/components/chatmessagefragment.ts +1 -1
- package/src/models/components/debugdatasourcestatusresponse.ts +3 -1
- package/src/models/components/peragentinsight.ts +14 -0
- package/.devcontainer/README.md +0 -35
- package/docs/sdks/activity/README.md +0 -242
- package/docs/sdks/agents/README.md +0 -498
- package/docs/sdks/announcements/README.md +0 -137560
- package/docs/sdks/answers/README.md +0 -4966
- package/docs/sdks/chat/README.md +0 -967
- package/docs/sdks/clientauthentication/README.md +0 -98
- package/docs/sdks/clientdocuments/README.md +0 -457
- package/docs/sdks/clientshortcuts/README.md +0 -9340
- package/docs/sdks/collections/README.md +0 -4148
- package/docs/sdks/datasource/README.md +0 -98
- package/docs/sdks/datasources/README.md +0 -211
- package/docs/sdks/entities/README.md +0 -225
- package/docs/sdks/indexingauthentication/README.md +0 -93
- package/docs/sdks/indexingdocuments/README.md +0 -983
- package/docs/sdks/indexingshortcuts/README.md +0 -251
- package/docs/sdks/insights/README.md +0 -94
- package/docs/sdks/messages/README.md +0 -102
- package/docs/sdks/people/README.md +0 -1052
- package/docs/sdks/permissions/README.md +0 -1198
- package/docs/sdks/pins/README.md +0 -506
- package/docs/sdks/policies/README.md +0 -478
- package/docs/sdks/reports/README.md +0 -290
- package/docs/sdks/search/README.md +0 -986
- package/docs/sdks/tools/README.md +0 -208
- package/docs/sdks/verification/README.md +0 -276
- package/docs/sdks/visibilityoverrides/README.md +0 -192
- package/examples/README.md +0 -31
- package/src/__tests__/mockserver/README.md +0 -52
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
# IndexingShortcuts
|
|
2
|
-
(*indexing.shortcuts*)
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
### Available Operations
|
|
7
|
-
|
|
8
|
-
* [bulkIndex](#bulkindex) - Bulk index external shortcuts
|
|
9
|
-
* [upload](#upload) - Upload shortcuts
|
|
10
|
-
|
|
11
|
-
## bulkIndex
|
|
12
|
-
|
|
13
|
-
Replaces all the currently indexed shortcuts using paginated batch API calls. Note that this endpoint is used for indexing shortcuts not hosted by Glean. If you want to upload shortcuts that would be hosted by Glean, please use the `/uploadshortcuts` endpoint. For information on what you can do with Golinks, which are Glean-hosted shortcuts, please refer to [this](https://help.glean.com/en/articles/5628838-how-go-links-work) page.
|
|
14
|
-
|
|
15
|
-
### Example Usage
|
|
16
|
-
|
|
17
|
-
<!-- UsageSnippet language="typescript" operationID="post_/api/index/v1/bulkindexshortcuts" method="post" path="/api/index/v1/bulkindexshortcuts" -->
|
|
18
|
-
```typescript
|
|
19
|
-
import { Glean } from "@gleanwork/api-client";
|
|
20
|
-
|
|
21
|
-
const glean = new Glean({
|
|
22
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
async function run() {
|
|
26
|
-
await glean.indexing.shortcuts.bulkIndex({
|
|
27
|
-
uploadId: "<id>",
|
|
28
|
-
shortcuts: [
|
|
29
|
-
{
|
|
30
|
-
inputAlias: "<value>",
|
|
31
|
-
destinationUrl: "https://plump-tune-up.biz/",
|
|
32
|
-
createdBy: "<value>",
|
|
33
|
-
intermediateUrl: "https://lean-sightseeing.net",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
inputAlias: "<value>",
|
|
37
|
-
destinationUrl: "https://plump-tune-up.biz/",
|
|
38
|
-
createdBy: "<value>",
|
|
39
|
-
intermediateUrl: "https://lean-sightseeing.net",
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
run();
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Standalone function
|
|
51
|
-
|
|
52
|
-
The standalone function version of this method:
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
56
|
-
import { indexingShortcutsBulkIndex } from "@gleanwork/api-client/funcs/indexingShortcutsBulkIndex.js";
|
|
57
|
-
|
|
58
|
-
// Use `GleanCore` for best tree-shaking performance.
|
|
59
|
-
// You can create one instance of it to use across an application.
|
|
60
|
-
const glean = new GleanCore({
|
|
61
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
async function run() {
|
|
65
|
-
const res = await indexingShortcutsBulkIndex(glean, {
|
|
66
|
-
uploadId: "<id>",
|
|
67
|
-
shortcuts: [
|
|
68
|
-
{
|
|
69
|
-
inputAlias: "<value>",
|
|
70
|
-
destinationUrl: "https://plump-tune-up.biz/",
|
|
71
|
-
createdBy: "<value>",
|
|
72
|
-
intermediateUrl: "https://lean-sightseeing.net",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
inputAlias: "<value>",
|
|
76
|
-
destinationUrl: "https://plump-tune-up.biz/",
|
|
77
|
-
createdBy: "<value>",
|
|
78
|
-
intermediateUrl: "https://lean-sightseeing.net",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
if (res.ok) {
|
|
83
|
-
const { value: result } = res;
|
|
84
|
-
|
|
85
|
-
} else {
|
|
86
|
-
console.log("indexingShortcutsBulkIndex failed:", res.error);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
run();
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### React hooks and utilities
|
|
94
|
-
|
|
95
|
-
This method can be used in React components through the following hooks and
|
|
96
|
-
associated utilities.
|
|
97
|
-
|
|
98
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
99
|
-
> below and how to get started using React hooks.
|
|
100
|
-
|
|
101
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
import {
|
|
105
|
-
// Mutation hook for triggering the API call.
|
|
106
|
-
useIndexingShortcutsBulkIndexMutation
|
|
107
|
-
} from "@gleanwork/api-client/react-query/indexingShortcutsBulkIndex.js";
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Parameters
|
|
111
|
-
|
|
112
|
-
| Parameter | Type | Required | Description |
|
|
113
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
114
|
-
| `request` | [components.BulkIndexShortcutsRequest](../../models/components/bulkindexshortcutsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
115
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
116
|
-
| `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. |
|
|
117
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
118
|
-
|
|
119
|
-
### Response
|
|
120
|
-
|
|
121
|
-
**Promise\<void\>**
|
|
122
|
-
|
|
123
|
-
### Errors
|
|
124
|
-
|
|
125
|
-
| Error Type | Status Code | Content Type |
|
|
126
|
-
| ----------------- | ----------------- | ----------------- |
|
|
127
|
-
| errors.GleanError | 4XX, 5XX | \*/\* |
|
|
128
|
-
|
|
129
|
-
## upload
|
|
130
|
-
|
|
131
|
-
Creates glean shortcuts for uploaded shortcuts info. Glean would host the shortcuts, and they can be managed in the knowledge tab once uploaded.
|
|
132
|
-
|
|
133
|
-
### Example Usage
|
|
134
|
-
|
|
135
|
-
<!-- UsageSnippet language="typescript" operationID="post_/api/index/v1/uploadshortcuts" method="post" path="/api/index/v1/uploadshortcuts" -->
|
|
136
|
-
```typescript
|
|
137
|
-
import { Glean } from "@gleanwork/api-client";
|
|
138
|
-
|
|
139
|
-
const glean = new Glean({
|
|
140
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
async function run() {
|
|
144
|
-
await glean.indexing.shortcuts.upload({
|
|
145
|
-
uploadId: "<id>",
|
|
146
|
-
shortcuts: [
|
|
147
|
-
{
|
|
148
|
-
inputAlias: "<value>",
|
|
149
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
150
|
-
createdBy: "<value>",
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
inputAlias: "<value>",
|
|
154
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
155
|
-
createdBy: "<value>",
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
inputAlias: "<value>",
|
|
159
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
160
|
-
createdBy: "<value>",
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
run();
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Standalone function
|
|
172
|
-
|
|
173
|
-
The standalone function version of this method:
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
177
|
-
import { indexingShortcutsUpload } from "@gleanwork/api-client/funcs/indexingShortcutsUpload.js";
|
|
178
|
-
|
|
179
|
-
// Use `GleanCore` for best tree-shaking performance.
|
|
180
|
-
// You can create one instance of it to use across an application.
|
|
181
|
-
const glean = new GleanCore({
|
|
182
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
async function run() {
|
|
186
|
-
const res = await indexingShortcutsUpload(glean, {
|
|
187
|
-
uploadId: "<id>",
|
|
188
|
-
shortcuts: [
|
|
189
|
-
{
|
|
190
|
-
inputAlias: "<value>",
|
|
191
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
192
|
-
createdBy: "<value>",
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
inputAlias: "<value>",
|
|
196
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
197
|
-
createdBy: "<value>",
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
inputAlias: "<value>",
|
|
201
|
-
destinationUrl: "https://majestic-pharmacopoeia.info/",
|
|
202
|
-
createdBy: "<value>",
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
});
|
|
206
|
-
if (res.ok) {
|
|
207
|
-
const { value: result } = res;
|
|
208
|
-
|
|
209
|
-
} else {
|
|
210
|
-
console.log("indexingShortcutsUpload failed:", res.error);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
run();
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### React hooks and utilities
|
|
218
|
-
|
|
219
|
-
This method can be used in React components through the following hooks and
|
|
220
|
-
associated utilities.
|
|
221
|
-
|
|
222
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
223
|
-
> below and how to get started using React hooks.
|
|
224
|
-
|
|
225
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
226
|
-
|
|
227
|
-
```tsx
|
|
228
|
-
import {
|
|
229
|
-
// Mutation hook for triggering the API call.
|
|
230
|
-
useIndexingShortcutsUploadMutation
|
|
231
|
-
} from "@gleanwork/api-client/react-query/indexingShortcutsUpload.js";
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Parameters
|
|
235
|
-
|
|
236
|
-
| Parameter | Type | Required | Description |
|
|
237
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
238
|
-
| `request` | [components.UploadShortcutsRequest](../../models/components/uploadshortcutsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
239
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
240
|
-
| `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. |
|
|
241
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
242
|
-
|
|
243
|
-
### Response
|
|
244
|
-
|
|
245
|
-
**Promise\<void\>**
|
|
246
|
-
|
|
247
|
-
### Errors
|
|
248
|
-
|
|
249
|
-
| Error Type | Status Code | Content Type |
|
|
250
|
-
| ----------------- | ----------------- | ----------------- |
|
|
251
|
-
| errors.GleanError | 4XX, 5XX | \*/\* |
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Insights
|
|
2
|
-
(*client.insights*)
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
### Available Operations
|
|
7
|
-
|
|
8
|
-
* [retrieve](#retrieve) - Get insights
|
|
9
|
-
|
|
10
|
-
## retrieve
|
|
11
|
-
|
|
12
|
-
Gets the aggregate usage insights data displayed in the Insights Dashboards.
|
|
13
|
-
|
|
14
|
-
### Example Usage
|
|
15
|
-
|
|
16
|
-
<!-- UsageSnippet language="typescript" operationID="insights" method="post" path="/rest/api/v1/insights" -->
|
|
17
|
-
```typescript
|
|
18
|
-
import { Glean } from "@gleanwork/api-client";
|
|
19
|
-
|
|
20
|
-
const glean = new Glean({
|
|
21
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
async function run() {
|
|
25
|
-
const result = await glean.client.insights.retrieve({});
|
|
26
|
-
|
|
27
|
-
console.log(result);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
run();
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Standalone function
|
|
34
|
-
|
|
35
|
-
The standalone function version of this method:
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
39
|
-
import { clientInsightsRetrieve } from "@gleanwork/api-client/funcs/clientInsightsRetrieve.js";
|
|
40
|
-
|
|
41
|
-
// Use `GleanCore` for best tree-shaking performance.
|
|
42
|
-
// You can create one instance of it to use across an application.
|
|
43
|
-
const glean = new GleanCore({
|
|
44
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
async function run() {
|
|
48
|
-
const res = await clientInsightsRetrieve(glean, {});
|
|
49
|
-
if (res.ok) {
|
|
50
|
-
const { value: result } = res;
|
|
51
|
-
console.log(result);
|
|
52
|
-
} else {
|
|
53
|
-
console.log("clientInsightsRetrieve failed:", res.error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
run();
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### React hooks and utilities
|
|
61
|
-
|
|
62
|
-
This method can be used in React components through the following hooks and
|
|
63
|
-
associated utilities.
|
|
64
|
-
|
|
65
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
66
|
-
> below and how to get started using React hooks.
|
|
67
|
-
|
|
68
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
import {
|
|
72
|
-
// Mutation hook for triggering the API call.
|
|
73
|
-
useClientInsightsRetrieveMutation
|
|
74
|
-
} from "@gleanwork/api-client/react-query/clientInsightsRetrieve.js";
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Parameters
|
|
78
|
-
|
|
79
|
-
| Parameter | Type | Required | Description |
|
|
80
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
81
|
-
| `request` | [components.InsightsRequest](../../models/components/insightsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
82
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
83
|
-
| `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. |
|
|
84
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
85
|
-
|
|
86
|
-
### Response
|
|
87
|
-
|
|
88
|
-
**Promise\<[components.InsightsResponse](../../models/components/insightsresponse.md)\>**
|
|
89
|
-
|
|
90
|
-
### Errors
|
|
91
|
-
|
|
92
|
-
| Error Type | Status Code | Content Type |
|
|
93
|
-
| ----------------- | ----------------- | ----------------- |
|
|
94
|
-
| errors.GleanError | 4XX, 5XX | \*/\* |
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Messages
|
|
2
|
-
(*client.messages*)
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
### Available Operations
|
|
7
|
-
|
|
8
|
-
* [retrieve](#retrieve) - Read messages
|
|
9
|
-
|
|
10
|
-
## retrieve
|
|
11
|
-
|
|
12
|
-
Retrieves list of messages from messaging/chat datasources (e.g. Slack, Teams).
|
|
13
|
-
|
|
14
|
-
### Example Usage
|
|
15
|
-
|
|
16
|
-
<!-- UsageSnippet language="typescript" operationID="messages" method="post" path="/rest/api/v1/messages" -->
|
|
17
|
-
```typescript
|
|
18
|
-
import { Glean } from "@gleanwork/api-client";
|
|
19
|
-
|
|
20
|
-
const glean = new Glean({
|
|
21
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
async function run() {
|
|
25
|
-
const result = await glean.client.messages.retrieve({
|
|
26
|
-
idType: "CONVERSATION_ID",
|
|
27
|
-
id: "<id>",
|
|
28
|
-
datasource: "GCHAT",
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
console.log(result);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
run();
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Standalone function
|
|
38
|
-
|
|
39
|
-
The standalone function version of this method:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
43
|
-
import { clientMessagesRetrieve } from "@gleanwork/api-client/funcs/clientMessagesRetrieve.js";
|
|
44
|
-
|
|
45
|
-
// Use `GleanCore` for best tree-shaking performance.
|
|
46
|
-
// You can create one instance of it to use across an application.
|
|
47
|
-
const glean = new GleanCore({
|
|
48
|
-
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
async function run() {
|
|
52
|
-
const res = await clientMessagesRetrieve(glean, {
|
|
53
|
-
idType: "CONVERSATION_ID",
|
|
54
|
-
id: "<id>",
|
|
55
|
-
datasource: "GCHAT",
|
|
56
|
-
});
|
|
57
|
-
if (res.ok) {
|
|
58
|
-
const { value: result } = res;
|
|
59
|
-
console.log(result);
|
|
60
|
-
} else {
|
|
61
|
-
console.log("clientMessagesRetrieve failed:", res.error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
run();
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### React hooks and utilities
|
|
69
|
-
|
|
70
|
-
This method can be used in React components through the following hooks and
|
|
71
|
-
associated utilities.
|
|
72
|
-
|
|
73
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
74
|
-
> below and how to get started using React hooks.
|
|
75
|
-
|
|
76
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
import {
|
|
80
|
-
// Mutation hook for triggering the API call.
|
|
81
|
-
useClientMessagesRetrieveMutation
|
|
82
|
-
} from "@gleanwork/api-client/react-query/clientMessagesRetrieve.js";
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Parameters
|
|
86
|
-
|
|
87
|
-
| Parameter | Type | Required | Description |
|
|
88
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
89
|
-
| `request` | [components.MessagesRequest](../../models/components/messagesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
90
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
91
|
-
| `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. |
|
|
92
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
93
|
-
|
|
94
|
-
### Response
|
|
95
|
-
|
|
96
|
-
**Promise\<[components.MessagesResponse](../../models/components/messagesresponse.md)\>**
|
|
97
|
-
|
|
98
|
-
### Errors
|
|
99
|
-
|
|
100
|
-
| Error Type | Status Code | Content Type |
|
|
101
|
-
| ----------------- | ----------------- | ----------------- |
|
|
102
|
-
| errors.GleanError | 4XX, 5XX | \*/\* |
|