@gleanwork/api-client 0.4.2 → 0.4.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.
- package/README.md +9 -0
- package/dist/commonjs/__tests__/indexing.test-d.d.ts +2 -0
- package/dist/commonjs/__tests__/indexing.test-d.d.ts.map +1 -0
- package/dist/commonjs/__tests__/indexing.test-d.js +39 -0
- package/dist/commonjs/__tests__/indexing.test-d.js.map +1 -0
- package/dist/commonjs/__tests__/policies.test.js +8 -5
- package/dist/commonjs/__tests__/policies.test.js.map +1 -1
- package/dist/commonjs/__tests__/tools.test.d.ts +2 -0
- package/dist/commonjs/__tests__/tools.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/tools.test.js +37 -0
- package/dist/commonjs/__tests__/tools.test.js.map +1 -0
- package/dist/commonjs/funcs/clientGovernanceDataPoliciesList.js +2 -2
- package/dist/commonjs/funcs/clientGovernanceDataPoliciesList.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.js +2 -4
- package/dist/commonjs/funcs/clientSearchQuery.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.js +2 -4
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.js +2 -4
- package/dist/commonjs/funcs/clientSearchRecommendations.js.map +1 -1
- package/dist/commonjs/funcs/clientToolsList.d.ts +16 -0
- package/dist/commonjs/funcs/clientToolsList.d.ts.map +1 -0
- package/dist/commonjs/funcs/clientToolsList.js +119 -0
- package/dist/commonjs/funcs/clientToolsList.js.map +1 -0
- package/dist/commonjs/funcs/clientToolsRun.d.ts +16 -0
- package/dist/commonjs/funcs/clientToolsRun.d.ts.map +1 -0
- package/dist/commonjs/funcs/clientToolsRun.js +112 -0
- package/dist/commonjs/funcs/clientToolsRun.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/agentrun.d.ts +6 -26
- package/dist/commonjs/models/components/agentrun.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentrun.js +3 -26
- package/dist/commonjs/models/components/agentrun.js.map +1 -1
- package/dist/commonjs/models/components/agentruncreate.d.ts +6 -26
- package/dist/commonjs/models/components/agentruncreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentruncreate.js +3 -26
- package/dist/commonjs/models/components/agentruncreate.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +6 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +6 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/textrange.d.ts +3 -0
- package/dist/commonjs/models/components/textrange.d.ts.map +1 -1
- package/dist/commonjs/models/components/textrange.js +1 -0
- package/dist/commonjs/models/components/textrange.js.map +1 -1
- package/dist/commonjs/models/components/tool.d.ts +89 -0
- package/dist/commonjs/models/components/tool.d.ts.map +1 -0
- package/dist/commonjs/models/components/tool.js +102 -0
- package/dist/commonjs/models/components/tool.js.map +1 -0
- package/dist/commonjs/models/components/toolparameter.d.ts +104 -0
- package/dist/commonjs/models/components/toolparameter.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolparameter.js +106 -0
- package/dist/commonjs/models/components/toolparameter.js.map +1 -0
- package/dist/commonjs/models/components/toolscallparameter.d.ts +51 -0
- package/dist/commonjs/models/components/toolscallparameter.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallparameter.js +77 -0
- package/dist/commonjs/models/components/toolscallparameter.js.map +1 -0
- package/dist/commonjs/models/components/toolscallrequest.d.ts +42 -0
- package/dist/commonjs/models/components/toolscallrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallrequest.js +72 -0
- package/dist/commonjs/models/components/toolscallrequest.js.map +1 -0
- package/dist/commonjs/models/components/toolscallresponse.d.ts +41 -0
- package/dist/commonjs/models/components/toolscallresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallresponse.js +71 -0
- package/dist/commonjs/models/components/toolscallresponse.js.map +1 -0
- package/dist/commonjs/models/components/toolslistresponse.d.ts +30 -0
- package/dist/commonjs/models/components/toolslistresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolslistresponse.js +70 -0
- package/dist/commonjs/models/components/toolslistresponse.js.map +1 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.d.ts +32 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.js +69 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -1
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -1
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listpolicies.d.ts +37 -0
- package/dist/commonjs/models/operations/listpolicies.d.ts.map +1 -0
- package/dist/commonjs/models/operations/{getpolicies.js → listpolicies.js} +17 -17
- package/dist/commonjs/models/operations/listpolicies.js.map +1 -0
- package/dist/commonjs/react-query/clientSearchQuery.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchQuery.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientSearchRecommendations.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientToolsList.d.ts +38 -0
- package/dist/commonjs/react-query/clientToolsList.d.ts.map +1 -0
- package/dist/commonjs/react-query/clientToolsList.js +82 -0
- package/dist/commonjs/react-query/clientToolsList.js.map +1 -0
- package/dist/commonjs/react-query/clientToolsRun.d.ts +23 -0
- package/dist/commonjs/react-query/clientToolsRun.d.ts.map +1 -0
- package/dist/commonjs/react-query/clientToolsRun.js +47 -0
- package/dist/commonjs/react-query/clientToolsRun.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/client.d.ts +3 -0
- package/dist/commonjs/sdk/client.d.ts.map +1 -1
- package/dist/commonjs/sdk/client.js +4 -0
- package/dist/commonjs/sdk/client.js.map +1 -1
- package/dist/commonjs/sdk/search.d.ts +3 -3
- package/dist/commonjs/sdk/search.d.ts.map +1 -1
- package/dist/commonjs/sdk/search.js.map +1 -1
- package/dist/commonjs/sdk/tools.d.ts +19 -0
- package/dist/commonjs/sdk/tools.d.ts.map +1 -0
- package/dist/commonjs/sdk/tools.js +32 -0
- package/dist/commonjs/sdk/tools.js.map +1 -0
- package/dist/esm/__tests__/indexing.test-d.d.ts +2 -0
- package/dist/esm/__tests__/indexing.test-d.d.ts.map +1 -0
- package/dist/esm/__tests__/indexing.test-d.js +37 -0
- package/dist/esm/__tests__/indexing.test-d.js.map +1 -0
- package/dist/esm/__tests__/policies.test.js +8 -5
- package/dist/esm/__tests__/policies.test.js.map +1 -1
- package/dist/esm/__tests__/tools.test.d.ts +2 -0
- package/dist/esm/__tests__/tools.test.d.ts.map +1 -0
- package/dist/esm/__tests__/tools.test.js +35 -0
- package/dist/esm/__tests__/tools.test.js.map +1 -0
- package/dist/esm/funcs/clientGovernanceDataPoliciesList.js +2 -2
- package/dist/esm/funcs/clientGovernanceDataPoliciesList.js.map +1 -1
- package/dist/esm/funcs/clientSearchQuery.d.ts +1 -1
- package/dist/esm/funcs/clientSearchQuery.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchQuery.js +2 -4
- package/dist/esm/funcs/clientSearchQuery.js.map +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.js +2 -4
- package/dist/esm/funcs/clientSearchQueryAsAdmin.js.map +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.d.ts +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.js +2 -4
- package/dist/esm/funcs/clientSearchRecommendations.js.map +1 -1
- package/dist/esm/funcs/clientToolsList.d.ts +16 -0
- package/dist/esm/funcs/clientToolsList.d.ts.map +1 -0
- package/dist/esm/funcs/clientToolsList.js +83 -0
- package/dist/esm/funcs/clientToolsList.js.map +1 -0
- package/dist/esm/funcs/clientToolsRun.d.ts +16 -0
- package/dist/esm/funcs/clientToolsRun.d.ts.map +1 -0
- package/dist/esm/funcs/clientToolsRun.js +76 -0
- package/dist/esm/funcs/clientToolsRun.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/agentrun.d.ts +6 -26
- package/dist/esm/models/components/agentrun.d.ts.map +1 -1
- package/dist/esm/models/components/agentrun.js +2 -23
- package/dist/esm/models/components/agentrun.js.map +1 -1
- package/dist/esm/models/components/agentruncreate.d.ts +6 -26
- package/dist/esm/models/components/agentruncreate.d.ts.map +1 -1
- package/dist/esm/models/components/agentruncreate.js +2 -23
- package/dist/esm/models/components/agentruncreate.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +6 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +6 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/textrange.d.ts +3 -0
- package/dist/esm/models/components/textrange.d.ts.map +1 -1
- package/dist/esm/models/components/textrange.js +1 -0
- package/dist/esm/models/components/textrange.js.map +1 -1
- package/dist/esm/models/components/tool.d.ts +89 -0
- package/dist/esm/models/components/tool.d.ts.map +1 -0
- package/dist/esm/models/components/tool.js +64 -0
- package/dist/esm/models/components/tool.js.map +1 -0
- package/dist/esm/models/components/toolparameter.d.ts +104 -0
- package/dist/esm/models/components/toolparameter.d.ts.map +1 -0
- package/dist/esm/models/components/toolparameter.js +68 -0
- package/dist/esm/models/components/toolparameter.js.map +1 -0
- package/dist/esm/models/components/toolscallparameter.d.ts +51 -0
- package/dist/esm/models/components/toolscallparameter.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallparameter.js +39 -0
- package/dist/esm/models/components/toolscallparameter.js.map +1 -0
- package/dist/esm/models/components/toolscallrequest.d.ts +42 -0
- package/dist/esm/models/components/toolscallrequest.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallrequest.js +34 -0
- package/dist/esm/models/components/toolscallrequest.js.map +1 -0
- package/dist/esm/models/components/toolscallresponse.d.ts +41 -0
- package/dist/esm/models/components/toolscallresponse.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallresponse.js +33 -0
- package/dist/esm/models/components/toolscallresponse.js.map +1 -0
- package/dist/esm/models/components/toolslistresponse.d.ts +30 -0
- package/dist/esm/models/components/toolslistresponse.d.ts.map +1 -0
- package/dist/esm/models/components/toolslistresponse.js +32 -0
- package/dist/esm/models/components/toolslistresponse.js.map +1 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.d.ts +32 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.d.ts.map +1 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.js +31 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -1
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -1
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listpolicies.d.ts +37 -0
- package/dist/esm/models/operations/listpolicies.d.ts.map +1 -0
- package/dist/esm/models/operations/listpolicies.js +33 -0
- package/dist/esm/models/operations/listpolicies.js.map +1 -0
- package/dist/esm/react-query/clientSearchQuery.d.ts +1 -1
- package/dist/esm/react-query/clientSearchQuery.d.ts.map +1 -1
- package/dist/esm/react-query/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/esm/react-query/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/esm/react-query/clientSearchRecommendations.d.ts +1 -1
- package/dist/esm/react-query/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/esm/react-query/clientToolsList.d.ts +38 -0
- package/dist/esm/react-query/clientToolsList.d.ts.map +1 -0
- package/dist/esm/react-query/clientToolsList.js +72 -0
- package/dist/esm/react-query/clientToolsList.js.map +1 -0
- package/dist/esm/react-query/clientToolsRun.d.ts +23 -0
- package/dist/esm/react-query/clientToolsRun.d.ts.map +1 -0
- package/dist/esm/react-query/clientToolsRun.js +42 -0
- package/dist/esm/react-query/clientToolsRun.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/client.d.ts +3 -0
- package/dist/esm/sdk/client.d.ts.map +1 -1
- package/dist/esm/sdk/client.js +4 -0
- package/dist/esm/sdk/client.js.map +1 -1
- package/dist/esm/sdk/search.d.ts +3 -3
- package/dist/esm/sdk/search.d.ts.map +1 -1
- package/dist/esm/sdk/search.js.map +1 -1
- package/dist/esm/sdk/tools.d.ts +19 -0
- package/dist/esm/sdk/tools.d.ts.map +1 -0
- package/dist/esm/sdk/tools.js +28 -0
- package/dist/esm/sdk/tools.js.map +1 -0
- package/docs/sdks/search/README.md +310 -22882
- package/docs/sdks/tools/README.md +214 -0
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/__tests__/indexing.test-d.ts +40 -0
- package/src/__tests__/policies.test.ts +14 -8
- package/src/__tests__/tools.test.ts +41 -0
- package/src/funcs/clientGovernanceDataPoliciesList.ts +3 -3
- package/src/funcs/clientSearchQuery.ts +4 -6
- package/src/funcs/clientSearchQueryAsAdmin.ts +4 -6
- package/src/funcs/clientSearchRecommendations.ts +4 -7
- package/src/funcs/clientToolsList.ts +164 -0
- package/src/funcs/clientToolsRun.ts +154 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/agentrun.ts +4 -53
- package/src/models/components/agentruncreate.ts +4 -57
- package/src/models/components/index.ts +6 -0
- package/src/models/components/textrange.ts +1 -0
- package/src/models/components/tool.ts +125 -0
- package/src/models/components/toolparameter.ts +141 -0
- package/src/models/components/toolscallparameter.ts +92 -0
- package/src/models/components/toolscallrequest.ts +82 -0
- package/src/models/components/toolscallresponse.ts +76 -0
- package/src/models/components/toolslistresponse.ts +72 -0
- package/src/models/operations/getrestapiv1toolslist.ts +71 -0
- package/src/models/operations/index.ts +2 -1
- package/src/models/operations/{getpolicies.ts → listpolicies.ts} +21 -21
- package/src/react-query/clientSearchQuery.ts +1 -1
- package/src/react-query/clientSearchQueryAsAdmin.ts +1 -1
- package/src/react-query/clientSearchRecommendations.ts +1 -1
- package/src/react-query/clientToolsList.ts +150 -0
- package/src/react-query/clientToolsRun.ts +88 -0
- package/src/react-query/index.ts +2 -0
- package/src/sdk/client.ts +6 -0
- package/src/sdk/search.ts +3 -3
- package/src/sdk/tools.ts +45 -0
- package/dist/commonjs/models/operations/getpolicies.d.ts +0 -37
- package/dist/commonjs/models/operations/getpolicies.d.ts.map +0 -1
- package/dist/commonjs/models/operations/getpolicies.js.map +0 -1
- package/dist/esm/models/operations/getpolicies.d.ts +0 -37
- package/dist/esm/models/operations/getpolicies.d.ts.map +0 -1
- package/dist/esm/models/operations/getpolicies.js +0 -33
- package/dist/esm/models/operations/getpolicies.js.map +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Tools
|
|
2
|
+
(*client.tools*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [list](#list) - List available tools
|
|
9
|
+
* [run](#run) - Execute the specified tool
|
|
10
|
+
|
|
11
|
+
## list
|
|
12
|
+
|
|
13
|
+
Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.
|
|
14
|
+
|
|
15
|
+
### Example Usage
|
|
16
|
+
|
|
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.tools.list();
|
|
26
|
+
|
|
27
|
+
// Handle the result
|
|
28
|
+
console.log(result);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
run();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Standalone function
|
|
35
|
+
|
|
36
|
+
The standalone function version of this method:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
40
|
+
import { clientToolsList } from "@gleanwork/api-client/funcs/clientToolsList.js";
|
|
41
|
+
|
|
42
|
+
// Use `GleanCore` for best tree-shaking performance.
|
|
43
|
+
// You can create one instance of it to use across an application.
|
|
44
|
+
const glean = new GleanCore({
|
|
45
|
+
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
async function run() {
|
|
49
|
+
const res = await clientToolsList(glean);
|
|
50
|
+
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
throw res.error;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const { value: result } = res;
|
|
56
|
+
|
|
57
|
+
// Handle the result
|
|
58
|
+
console.log(result);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
run();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### React hooks and utilities
|
|
65
|
+
|
|
66
|
+
This method can be used in React components through the following hooks and
|
|
67
|
+
associated utilities.
|
|
68
|
+
|
|
69
|
+
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
70
|
+
> below and how to get started using React hooks.
|
|
71
|
+
|
|
72
|
+
[hook-guide]: ../../../REACT_QUERY.md
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import {
|
|
76
|
+
// Query hooks for fetching data.
|
|
77
|
+
useClientToolsList,
|
|
78
|
+
useClientToolsListSuspense,
|
|
79
|
+
|
|
80
|
+
// Utility for prefetching data during server-side rendering and in React
|
|
81
|
+
// Server Components that will be immediately available to client components
|
|
82
|
+
// using the hooks.
|
|
83
|
+
prefetchClientToolsList,
|
|
84
|
+
|
|
85
|
+
// Utilities to invalidate the query cache for this query in response to
|
|
86
|
+
// mutations and other user actions.
|
|
87
|
+
invalidateClientToolsList,
|
|
88
|
+
invalidateAllClientToolsList,
|
|
89
|
+
} from "@gleanwork/api-client/react-query/clientToolsList.js";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Parameters
|
|
93
|
+
|
|
94
|
+
| Parameter | Type | Required | Description |
|
|
95
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
96
|
+
| `toolNames` | *string*[] | :heavy_minus_sign: | Optional array of tool names to filter by |
|
|
97
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
98
|
+
| `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. |
|
|
99
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
100
|
+
|
|
101
|
+
### Response
|
|
102
|
+
|
|
103
|
+
**Promise\<[components.ToolsListResponse](../../models/components/toolslistresponse.md)\>**
|
|
104
|
+
|
|
105
|
+
### Errors
|
|
106
|
+
|
|
107
|
+
| Error Type | Status Code | Content Type |
|
|
108
|
+
| ----------------- | ----------------- | ----------------- |
|
|
109
|
+
| errors.GleanError | 4XX, 5XX | \*/\* |
|
|
110
|
+
|
|
111
|
+
## run
|
|
112
|
+
|
|
113
|
+
Execute the specified tool with provided parameters
|
|
114
|
+
|
|
115
|
+
### Example Usage
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { Glean } from "@gleanwork/api-client";
|
|
119
|
+
|
|
120
|
+
const glean = new Glean({
|
|
121
|
+
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
async function run() {
|
|
125
|
+
const result = await glean.client.tools.run({
|
|
126
|
+
name: "<value>",
|
|
127
|
+
parameters: {
|
|
128
|
+
"key": {
|
|
129
|
+
name: "<value>",
|
|
130
|
+
value: "<value>",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Handle the result
|
|
136
|
+
console.log(result);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
run();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Standalone function
|
|
143
|
+
|
|
144
|
+
The standalone function version of this method:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { GleanCore } from "@gleanwork/api-client/core.js";
|
|
148
|
+
import { clientToolsRun } from "@gleanwork/api-client/funcs/clientToolsRun.js";
|
|
149
|
+
|
|
150
|
+
// Use `GleanCore` for best tree-shaking performance.
|
|
151
|
+
// You can create one instance of it to use across an application.
|
|
152
|
+
const glean = new GleanCore({
|
|
153
|
+
apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
async function run() {
|
|
157
|
+
const res = await clientToolsRun(glean, {
|
|
158
|
+
name: "<value>",
|
|
159
|
+
parameters: {
|
|
160
|
+
"key": {
|
|
161
|
+
name: "<value>",
|
|
162
|
+
value: "<value>",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
if (!res.ok) {
|
|
168
|
+
throw res.error;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const { value: result } = res;
|
|
172
|
+
|
|
173
|
+
// Handle the result
|
|
174
|
+
console.log(result);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
run();
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### React hooks and utilities
|
|
181
|
+
|
|
182
|
+
This method can be used in React components through the following hooks and
|
|
183
|
+
associated utilities.
|
|
184
|
+
|
|
185
|
+
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
186
|
+
> below and how to get started using React hooks.
|
|
187
|
+
|
|
188
|
+
[hook-guide]: ../../../REACT_QUERY.md
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import {
|
|
192
|
+
// Mutation hook for triggering the API call.
|
|
193
|
+
useClientToolsRunMutation
|
|
194
|
+
} from "@gleanwork/api-client/react-query/clientToolsRun.js";
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Parameters
|
|
198
|
+
|
|
199
|
+
| Parameter | Type | Required | Description |
|
|
200
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
201
|
+
| `request` | [components.ToolsCallRequest](../../models/components/toolscallrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
202
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
203
|
+
| `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. |
|
|
204
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
205
|
+
|
|
206
|
+
### Response
|
|
207
|
+
|
|
208
|
+
**Promise\<[components.ToolsCallResponse](../../models/components/toolscallresponse.md)\>**
|
|
209
|
+
|
|
210
|
+
### Errors
|
|
211
|
+
|
|
212
|
+
| Error Type | Status Code | Content Type |
|
|
213
|
+
| ----------------- | ----------------- | ----------------- |
|
|
214
|
+
| errors.GleanError | 4XX, 5XX | \*/\* |
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gleanwork/api-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"author": "Speakeasy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"tshy": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"typescript": "^5.4.5",
|
|
60
60
|
"typescript-eslint": "^8.22.0",
|
|
61
61
|
"vitest": "^3.0.2",
|
|
62
|
-
"zod": "^3.
|
|
62
|
+
"zod": "^3.25.17"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {},
|
|
65
65
|
"exports": {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { expectTypeOf, test } from "vitest";
|
|
2
|
+
import { Glean } from "../index.js";
|
|
3
|
+
|
|
4
|
+
test("type test for `Glean` constructor", () => {
|
|
5
|
+
// @ts-expect-error - Function is defined but never used (only for type checking)
|
|
6
|
+
async function run() {
|
|
7
|
+
const glean = new Glean({
|
|
8
|
+
apiToken: process.env["GLEAN_API_TOKEN"],
|
|
9
|
+
instance: process.env["GLEAN_INSTANCE"],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const response = await glean.indexing.documents.index({
|
|
13
|
+
datasource: "my-datasource",
|
|
14
|
+
documents: [
|
|
15
|
+
{
|
|
16
|
+
datasource: "my-datasource",
|
|
17
|
+
id: "doc-123",
|
|
18
|
+
title: "Sample Document",
|
|
19
|
+
body: {
|
|
20
|
+
mimeType: "text/plain",
|
|
21
|
+
textContent: "This is a sample document to index in Glean.",
|
|
22
|
+
},
|
|
23
|
+
viewURL: "https://example.com/documents/123",
|
|
24
|
+
permissions: {
|
|
25
|
+
allowedUsers: [{ email: "user@example.com" }],
|
|
26
|
+
allowedGroups: ["everyone@example.com"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const correctClient = new Glean({
|
|
36
|
+
apiToken: "token",
|
|
37
|
+
instance: "example-instance",
|
|
38
|
+
});
|
|
39
|
+
expectTypeOf(correctClient).toEqualTypeOf<Glean>();
|
|
40
|
+
});
|
|
@@ -19,8 +19,20 @@ test("Policies Getpolicy", async () => {
|
|
|
19
19
|
expect(result).toBeDefined();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
it.skip("Policies Getpolicies", async () => {
|
|
23
|
+
assert.fail(
|
|
24
|
+
"incomplete test found please make sure to address the following errors: [`workflow step getpolicies.test referencing operation getpolicies not found in document`]",
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it.skip("Policies Downloadpolicycsv", async () => {
|
|
29
|
+
assert.fail(
|
|
30
|
+
"incomplete test found please make sure to address the following errors: [`workflow step downloadpolicycsv.test contains criterion simple with invalid condition`, `workflow step downloadpolicycsv.test does not contain $contentType successCriteria and required for response body assertion`]",
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("Policies Listpolicies", async () => {
|
|
35
|
+
const testHttpClient = createTestHTTPClient("listpolicies");
|
|
24
36
|
|
|
25
37
|
const glean = new Glean({
|
|
26
38
|
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
@@ -31,9 +43,3 @@ test("Policies Getpolicies", async () => {
|
|
|
31
43
|
const result = await glean.client.governance.data.policies.list();
|
|
32
44
|
expect(result).toBeDefined();
|
|
33
45
|
});
|
|
34
|
-
|
|
35
|
-
it.skip("Policies Downloadpolicycsv", async () => {
|
|
36
|
-
assert.fail(
|
|
37
|
-
"incomplete test found please make sure to address the following errors: [`workflow step downloadpolicycsv.test contains criterion simple with invalid condition`, `workflow step downloadpolicycsv.test does not contain $contentType successCriteria and required for response body assertion`]",
|
|
38
|
-
);
|
|
39
|
-
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
|
+
import { Glean } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("Tools Get /Rest/api/v1 /Tools/list", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("get_/rest/api/v1/tools/list");
|
|
11
|
+
|
|
12
|
+
const glean = new Glean({
|
|
13
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
14
|
+
httpClient: testHttpClient,
|
|
15
|
+
apiToken: process.env["GLEAN_API_TOKEN"] ?? "value",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const result = await glean.client.tools.list();
|
|
19
|
+
expect(result).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("Tools Post /Rest/api/v1 /Tools/call", async () => {
|
|
23
|
+
const testHttpClient = createTestHTTPClient("post_/rest/api/v1/tools/call");
|
|
24
|
+
|
|
25
|
+
const glean = new Glean({
|
|
26
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
27
|
+
httpClient: testHttpClient,
|
|
28
|
+
apiToken: process.env["GLEAN_API_TOKEN"] ?? "value",
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const result = await glean.client.tools.run({
|
|
32
|
+
name: "<value>",
|
|
33
|
+
parameters: {
|
|
34
|
+
"key": {
|
|
35
|
+
name: "<value>",
|
|
36
|
+
value: "<value>",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
expect(result).toBeDefined();
|
|
41
|
+
});
|
|
@@ -75,14 +75,14 @@ async function $do(
|
|
|
75
75
|
APICall,
|
|
76
76
|
]
|
|
77
77
|
> {
|
|
78
|
-
const input: operations.
|
|
78
|
+
const input: operations.ListpoliciesRequest = {
|
|
79
79
|
autoHide: autoHide,
|
|
80
80
|
frequency: frequency,
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const parsed = safeParse(
|
|
84
84
|
input,
|
|
85
|
-
(value) => operations.
|
|
85
|
+
(value) => operations.ListpoliciesRequest$outboundSchema.parse(value),
|
|
86
86
|
"Input validation failed",
|
|
87
87
|
);
|
|
88
88
|
if (!parsed.ok) {
|
|
@@ -108,7 +108,7 @@ async function $do(
|
|
|
108
108
|
|
|
109
109
|
const context = {
|
|
110
110
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
111
|
-
operationID: "
|
|
111
|
+
operationID: "listpolicies",
|
|
112
112
|
oAuth2Scopes: [],
|
|
113
113
|
|
|
114
114
|
resolvedSecurity: requestSecurity,
|
|
@@ -32,7 +32,7 @@ import { Result } from "../types/fp.js";
|
|
|
32
32
|
*/
|
|
33
33
|
export function clientSearchQuery(
|
|
34
34
|
client: GleanCore,
|
|
35
|
-
request
|
|
35
|
+
request: components.SearchRequest,
|
|
36
36
|
options?: RequestOptions,
|
|
37
37
|
): APIPromise<
|
|
38
38
|
Result<
|
|
@@ -56,7 +56,7 @@ export function clientSearchQuery(
|
|
|
56
56
|
|
|
57
57
|
async function $do(
|
|
58
58
|
client: GleanCore,
|
|
59
|
-
request
|
|
59
|
+
request: components.SearchRequest,
|
|
60
60
|
options?: RequestOptions,
|
|
61
61
|
): Promise<
|
|
62
62
|
[
|
|
@@ -76,16 +76,14 @@ async function $do(
|
|
|
76
76
|
> {
|
|
77
77
|
const parsed = safeParse(
|
|
78
78
|
request,
|
|
79
|
-
(value) => components.SearchRequest$outboundSchema.
|
|
79
|
+
(value) => components.SearchRequest$outboundSchema.parse(value),
|
|
80
80
|
"Input validation failed",
|
|
81
81
|
);
|
|
82
82
|
if (!parsed.ok) {
|
|
83
83
|
return [parsed, { status: "invalid" }];
|
|
84
84
|
}
|
|
85
85
|
const payload = parsed.value;
|
|
86
|
-
const body = payload
|
|
87
|
-
? null
|
|
88
|
-
: encodeJSON("body", payload, { explode: true });
|
|
86
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
89
87
|
|
|
90
88
|
const path = pathToFunc("/rest/api/v1/search")();
|
|
91
89
|
|
|
@@ -32,7 +32,7 @@ import { Result } from "../types/fp.js";
|
|
|
32
32
|
*/
|
|
33
33
|
export function clientSearchQueryAsAdmin(
|
|
34
34
|
client: GleanCore,
|
|
35
|
-
request
|
|
35
|
+
request: components.SearchRequest,
|
|
36
36
|
options?: RequestOptions,
|
|
37
37
|
): APIPromise<
|
|
38
38
|
Result<
|
|
@@ -56,7 +56,7 @@ export function clientSearchQueryAsAdmin(
|
|
|
56
56
|
|
|
57
57
|
async function $do(
|
|
58
58
|
client: GleanCore,
|
|
59
|
-
request
|
|
59
|
+
request: components.SearchRequest,
|
|
60
60
|
options?: RequestOptions,
|
|
61
61
|
): Promise<
|
|
62
62
|
[
|
|
@@ -76,16 +76,14 @@ async function $do(
|
|
|
76
76
|
> {
|
|
77
77
|
const parsed = safeParse(
|
|
78
78
|
request,
|
|
79
|
-
(value) => components.SearchRequest$outboundSchema.
|
|
79
|
+
(value) => components.SearchRequest$outboundSchema.parse(value),
|
|
80
80
|
"Input validation failed",
|
|
81
81
|
);
|
|
82
82
|
if (!parsed.ok) {
|
|
83
83
|
return [parsed, { status: "invalid" }];
|
|
84
84
|
}
|
|
85
85
|
const payload = parsed.value;
|
|
86
|
-
const body = payload
|
|
87
|
-
? null
|
|
88
|
-
: encodeJSON("body", payload, { explode: true });
|
|
86
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
89
87
|
|
|
90
88
|
const path = pathToFunc("/rest/api/v1/adminsearch")();
|
|
91
89
|
|
|
@@ -31,7 +31,7 @@ import { Result } from "../types/fp.js";
|
|
|
31
31
|
*/
|
|
32
32
|
export function clientSearchRecommendations(
|
|
33
33
|
client: GleanCore,
|
|
34
|
-
request
|
|
34
|
+
request: components.RecommendationsRequest,
|
|
35
35
|
options?: RequestOptions,
|
|
36
36
|
): APIPromise<
|
|
37
37
|
Result<
|
|
@@ -54,7 +54,7 @@ export function clientSearchRecommendations(
|
|
|
54
54
|
|
|
55
55
|
async function $do(
|
|
56
56
|
client: GleanCore,
|
|
57
|
-
request
|
|
57
|
+
request: components.RecommendationsRequest,
|
|
58
58
|
options?: RequestOptions,
|
|
59
59
|
): Promise<
|
|
60
60
|
[
|
|
@@ -73,17 +73,14 @@ async function $do(
|
|
|
73
73
|
> {
|
|
74
74
|
const parsed = safeParse(
|
|
75
75
|
request,
|
|
76
|
-
(value) =>
|
|
77
|
-
components.RecommendationsRequest$outboundSchema.optional().parse(value),
|
|
76
|
+
(value) => components.RecommendationsRequest$outboundSchema.parse(value),
|
|
78
77
|
"Input validation failed",
|
|
79
78
|
);
|
|
80
79
|
if (!parsed.ok) {
|
|
81
80
|
return [parsed, { status: "invalid" }];
|
|
82
81
|
}
|
|
83
82
|
const payload = parsed.value;
|
|
84
|
-
const body = payload
|
|
85
|
-
? null
|
|
86
|
-
: encodeJSON("body", payload, { explode: true });
|
|
83
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
87
84
|
|
|
88
85
|
const path = pathToFunc("/rest/api/v1/recommendations")();
|
|
89
86
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GleanCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { GleanError } from "../models/errors/gleanerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* List available tools
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.
|
|
32
|
+
*/
|
|
33
|
+
export function clientToolsList(
|
|
34
|
+
client: GleanCore,
|
|
35
|
+
toolNames?: Array<string> | undefined,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
components.ToolsListResponse,
|
|
40
|
+
| GleanError
|
|
41
|
+
| SDKValidationError
|
|
42
|
+
| UnexpectedClientError
|
|
43
|
+
| InvalidRequestError
|
|
44
|
+
| RequestAbortedError
|
|
45
|
+
| RequestTimeoutError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
>
|
|
48
|
+
> {
|
|
49
|
+
return new APIPromise($do(
|
|
50
|
+
client,
|
|
51
|
+
toolNames,
|
|
52
|
+
options,
|
|
53
|
+
));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function $do(
|
|
57
|
+
client: GleanCore,
|
|
58
|
+
toolNames?: Array<string> | undefined,
|
|
59
|
+
options?: RequestOptions,
|
|
60
|
+
): Promise<
|
|
61
|
+
[
|
|
62
|
+
Result<
|
|
63
|
+
components.ToolsListResponse,
|
|
64
|
+
| GleanError
|
|
65
|
+
| SDKValidationError
|
|
66
|
+
| UnexpectedClientError
|
|
67
|
+
| InvalidRequestError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
>,
|
|
72
|
+
APICall,
|
|
73
|
+
]
|
|
74
|
+
> {
|
|
75
|
+
const input: operations.GetRestApiV1ToolsListRequest = {
|
|
76
|
+
toolNames: toolNames,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const parsed = safeParse(
|
|
80
|
+
input,
|
|
81
|
+
(value) =>
|
|
82
|
+
operations.GetRestApiV1ToolsListRequest$outboundSchema.parse(value),
|
|
83
|
+
"Input validation failed",
|
|
84
|
+
);
|
|
85
|
+
if (!parsed.ok) {
|
|
86
|
+
return [parsed, { status: "invalid" }];
|
|
87
|
+
}
|
|
88
|
+
const payload = parsed.value;
|
|
89
|
+
const body = null;
|
|
90
|
+
|
|
91
|
+
const path = pathToFunc("/rest/api/v1/tools/list")();
|
|
92
|
+
|
|
93
|
+
const query = encodeFormQuery({
|
|
94
|
+
"toolNames": payload.toolNames,
|
|
95
|
+
}, { explode: false });
|
|
96
|
+
|
|
97
|
+
const headers = new Headers(compactMap({
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiToken);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiToken: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
107
|
+
operationID: "get_/rest/api/v1/tools/list",
|
|
108
|
+
oAuth2Scopes: [],
|
|
109
|
+
|
|
110
|
+
resolvedSecurity: requestSecurity,
|
|
111
|
+
|
|
112
|
+
securitySource: client._options.apiToken,
|
|
113
|
+
retryConfig: options?.retries
|
|
114
|
+
|| client._options.retryConfig
|
|
115
|
+
|| { strategy: "none" },
|
|
116
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const requestRes = client._createRequest(context, {
|
|
120
|
+
security: requestSecurity,
|
|
121
|
+
method: "GET",
|
|
122
|
+
baseURL: options?.serverURL,
|
|
123
|
+
path: path,
|
|
124
|
+
headers: headers,
|
|
125
|
+
query: query,
|
|
126
|
+
body: body,
|
|
127
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
128
|
+
}, options);
|
|
129
|
+
if (!requestRes.ok) {
|
|
130
|
+
return [requestRes, { status: "invalid" }];
|
|
131
|
+
}
|
|
132
|
+
const req = requestRes.value;
|
|
133
|
+
|
|
134
|
+
const doResult = await client._do(req, {
|
|
135
|
+
context,
|
|
136
|
+
errorCodes: ["400", "401", "404", "429", "4XX", "5XX"],
|
|
137
|
+
retryConfig: context.retryConfig,
|
|
138
|
+
retryCodes: context.retryCodes,
|
|
139
|
+
});
|
|
140
|
+
if (!doResult.ok) {
|
|
141
|
+
return [doResult, { status: "request-error", request: req }];
|
|
142
|
+
}
|
|
143
|
+
const response = doResult.value;
|
|
144
|
+
|
|
145
|
+
const [result] = await M.match<
|
|
146
|
+
components.ToolsListResponse,
|
|
147
|
+
| GleanError
|
|
148
|
+
| SDKValidationError
|
|
149
|
+
| UnexpectedClientError
|
|
150
|
+
| InvalidRequestError
|
|
151
|
+
| RequestAbortedError
|
|
152
|
+
| RequestTimeoutError
|
|
153
|
+
| ConnectionError
|
|
154
|
+
>(
|
|
155
|
+
M.json(200, components.ToolsListResponse$inboundSchema),
|
|
156
|
+
M.fail([400, 401, 404, 429, "4XX"]),
|
|
157
|
+
M.fail("5XX"),
|
|
158
|
+
)(response);
|
|
159
|
+
if (!result.ok) {
|
|
160
|
+
return [result, { status: "complete", request: req, response }];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return [result, { status: "complete", request: req, response }];
|
|
164
|
+
}
|