@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,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ToolsCallParameter = {
|
|
11
|
+
/**
|
|
12
|
+
* The name of the parameter
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* The value of the parameter (for primitive types)
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* The value of the parameter (for array types)
|
|
21
|
+
*/
|
|
22
|
+
items?: Array<ToolsCallParameter> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The value of the parameter (for object types)
|
|
25
|
+
*/
|
|
26
|
+
properties?: { [k: string]: ToolsCallParameter } | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const ToolsCallParameter$inboundSchema: z.ZodType<
|
|
31
|
+
ToolsCallParameter,
|
|
32
|
+
z.ZodTypeDef,
|
|
33
|
+
unknown
|
|
34
|
+
> = z.object({
|
|
35
|
+
name: z.string(),
|
|
36
|
+
value: z.string(),
|
|
37
|
+
items: z.array(z.lazy(() => ToolsCallParameter$inboundSchema)).optional(),
|
|
38
|
+
properties: z.record(z.lazy(() => ToolsCallParameter$inboundSchema))
|
|
39
|
+
.optional(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type ToolsCallParameter$Outbound = {
|
|
44
|
+
name: string;
|
|
45
|
+
value: string;
|
|
46
|
+
items?: Array<ToolsCallParameter$Outbound> | undefined;
|
|
47
|
+
properties?: { [k: string]: ToolsCallParameter$Outbound } | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const ToolsCallParameter$outboundSchema: z.ZodType<
|
|
52
|
+
ToolsCallParameter$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
ToolsCallParameter
|
|
55
|
+
> = z.object({
|
|
56
|
+
name: z.string(),
|
|
57
|
+
value: z.string(),
|
|
58
|
+
items: z.array(z.lazy(() => ToolsCallParameter$outboundSchema)).optional(),
|
|
59
|
+
properties: z.record(z.lazy(() => ToolsCallParameter$outboundSchema))
|
|
60
|
+
.optional(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
66
|
+
*/
|
|
67
|
+
export namespace ToolsCallParameter$ {
|
|
68
|
+
/** @deprecated use `ToolsCallParameter$inboundSchema` instead. */
|
|
69
|
+
export const inboundSchema = ToolsCallParameter$inboundSchema;
|
|
70
|
+
/** @deprecated use `ToolsCallParameter$outboundSchema` instead. */
|
|
71
|
+
export const outboundSchema = ToolsCallParameter$outboundSchema;
|
|
72
|
+
/** @deprecated use `ToolsCallParameter$Outbound` instead. */
|
|
73
|
+
export type Outbound = ToolsCallParameter$Outbound;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function toolsCallParameterToJSON(
|
|
77
|
+
toolsCallParameter: ToolsCallParameter,
|
|
78
|
+
): string {
|
|
79
|
+
return JSON.stringify(
|
|
80
|
+
ToolsCallParameter$outboundSchema.parse(toolsCallParameter),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function toolsCallParameterFromJSON(
|
|
85
|
+
jsonString: string,
|
|
86
|
+
): SafeParseResult<ToolsCallParameter, SDKValidationError> {
|
|
87
|
+
return safeParse(
|
|
88
|
+
jsonString,
|
|
89
|
+
(x) => ToolsCallParameter$inboundSchema.parse(JSON.parse(x)),
|
|
90
|
+
`Failed to parse 'ToolsCallParameter' from JSON`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
ToolsCallParameter,
|
|
11
|
+
ToolsCallParameter$inboundSchema,
|
|
12
|
+
ToolsCallParameter$Outbound,
|
|
13
|
+
ToolsCallParameter$outboundSchema,
|
|
14
|
+
} from "./toolscallparameter.js";
|
|
15
|
+
|
|
16
|
+
export type ToolsCallRequest = {
|
|
17
|
+
/**
|
|
18
|
+
* Required name of the tool to execute
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* The parameters for the tool. Each key is the name of the parameter and the value is the parameter object.
|
|
23
|
+
*/
|
|
24
|
+
parameters: { [k: string]: ToolsCallParameter };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const ToolsCallRequest$inboundSchema: z.ZodType<
|
|
29
|
+
ToolsCallRequest,
|
|
30
|
+
z.ZodTypeDef,
|
|
31
|
+
unknown
|
|
32
|
+
> = z.object({
|
|
33
|
+
name: z.string(),
|
|
34
|
+
parameters: z.record(ToolsCallParameter$inboundSchema),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type ToolsCallRequest$Outbound = {
|
|
39
|
+
name: string;
|
|
40
|
+
parameters: { [k: string]: ToolsCallParameter$Outbound };
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const ToolsCallRequest$outboundSchema: z.ZodType<
|
|
45
|
+
ToolsCallRequest$Outbound,
|
|
46
|
+
z.ZodTypeDef,
|
|
47
|
+
ToolsCallRequest
|
|
48
|
+
> = z.object({
|
|
49
|
+
name: z.string(),
|
|
50
|
+
parameters: z.record(ToolsCallParameter$outboundSchema),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
56
|
+
*/
|
|
57
|
+
export namespace ToolsCallRequest$ {
|
|
58
|
+
/** @deprecated use `ToolsCallRequest$inboundSchema` instead. */
|
|
59
|
+
export const inboundSchema = ToolsCallRequest$inboundSchema;
|
|
60
|
+
/** @deprecated use `ToolsCallRequest$outboundSchema` instead. */
|
|
61
|
+
export const outboundSchema = ToolsCallRequest$outboundSchema;
|
|
62
|
+
/** @deprecated use `ToolsCallRequest$Outbound` instead. */
|
|
63
|
+
export type Outbound = ToolsCallRequest$Outbound;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function toolsCallRequestToJSON(
|
|
67
|
+
toolsCallRequest: ToolsCallRequest,
|
|
68
|
+
): string {
|
|
69
|
+
return JSON.stringify(
|
|
70
|
+
ToolsCallRequest$outboundSchema.parse(toolsCallRequest),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function toolsCallRequestFromJSON(
|
|
75
|
+
jsonString: string,
|
|
76
|
+
): SafeParseResult<ToolsCallRequest, SDKValidationError> {
|
|
77
|
+
return safeParse(
|
|
78
|
+
jsonString,
|
|
79
|
+
(x) => ToolsCallRequest$inboundSchema.parse(JSON.parse(x)),
|
|
80
|
+
`Failed to parse 'ToolsCallRequest' from JSON`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ToolsCallResponse = {
|
|
11
|
+
/**
|
|
12
|
+
* The raw response from the tool
|
|
13
|
+
*/
|
|
14
|
+
rawResponse?: { [k: string]: any } | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The error message if applicable
|
|
17
|
+
*/
|
|
18
|
+
error?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const ToolsCallResponse$inboundSchema: z.ZodType<
|
|
23
|
+
ToolsCallResponse,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
rawResponse: z.record(z.any()).optional(),
|
|
28
|
+
error: z.string().optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export type ToolsCallResponse$Outbound = {
|
|
33
|
+
rawResponse?: { [k: string]: any } | undefined;
|
|
34
|
+
error?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const ToolsCallResponse$outboundSchema: z.ZodType<
|
|
39
|
+
ToolsCallResponse$Outbound,
|
|
40
|
+
z.ZodTypeDef,
|
|
41
|
+
ToolsCallResponse
|
|
42
|
+
> = z.object({
|
|
43
|
+
rawResponse: z.record(z.any()).optional(),
|
|
44
|
+
error: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
50
|
+
*/
|
|
51
|
+
export namespace ToolsCallResponse$ {
|
|
52
|
+
/** @deprecated use `ToolsCallResponse$inboundSchema` instead. */
|
|
53
|
+
export const inboundSchema = ToolsCallResponse$inboundSchema;
|
|
54
|
+
/** @deprecated use `ToolsCallResponse$outboundSchema` instead. */
|
|
55
|
+
export const outboundSchema = ToolsCallResponse$outboundSchema;
|
|
56
|
+
/** @deprecated use `ToolsCallResponse$Outbound` instead. */
|
|
57
|
+
export type Outbound = ToolsCallResponse$Outbound;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function toolsCallResponseToJSON(
|
|
61
|
+
toolsCallResponse: ToolsCallResponse,
|
|
62
|
+
): string {
|
|
63
|
+
return JSON.stringify(
|
|
64
|
+
ToolsCallResponse$outboundSchema.parse(toolsCallResponse),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function toolsCallResponseFromJSON(
|
|
69
|
+
jsonString: string,
|
|
70
|
+
): SafeParseResult<ToolsCallResponse, SDKValidationError> {
|
|
71
|
+
return safeParse(
|
|
72
|
+
jsonString,
|
|
73
|
+
(x) => ToolsCallResponse$inboundSchema.parse(JSON.parse(x)),
|
|
74
|
+
`Failed to parse 'ToolsCallResponse' from JSON`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
Tool,
|
|
11
|
+
Tool$inboundSchema,
|
|
12
|
+
Tool$Outbound,
|
|
13
|
+
Tool$outboundSchema,
|
|
14
|
+
} from "./tool.js";
|
|
15
|
+
|
|
16
|
+
export type ToolsListResponse = {
|
|
17
|
+
tools?: Array<Tool> | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const ToolsListResponse$inboundSchema: z.ZodType<
|
|
22
|
+
ToolsListResponse,
|
|
23
|
+
z.ZodTypeDef,
|
|
24
|
+
unknown
|
|
25
|
+
> = z.object({
|
|
26
|
+
tools: z.array(Tool$inboundSchema).optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type ToolsListResponse$Outbound = {
|
|
31
|
+
tools?: Array<Tool$Outbound> | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const ToolsListResponse$outboundSchema: z.ZodType<
|
|
36
|
+
ToolsListResponse$Outbound,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
ToolsListResponse
|
|
39
|
+
> = z.object({
|
|
40
|
+
tools: z.array(Tool$outboundSchema).optional(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
46
|
+
*/
|
|
47
|
+
export namespace ToolsListResponse$ {
|
|
48
|
+
/** @deprecated use `ToolsListResponse$inboundSchema` instead. */
|
|
49
|
+
export const inboundSchema = ToolsListResponse$inboundSchema;
|
|
50
|
+
/** @deprecated use `ToolsListResponse$outboundSchema` instead. */
|
|
51
|
+
export const outboundSchema = ToolsListResponse$outboundSchema;
|
|
52
|
+
/** @deprecated use `ToolsListResponse$Outbound` instead. */
|
|
53
|
+
export type Outbound = ToolsListResponse$Outbound;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function toolsListResponseToJSON(
|
|
57
|
+
toolsListResponse: ToolsListResponse,
|
|
58
|
+
): string {
|
|
59
|
+
return JSON.stringify(
|
|
60
|
+
ToolsListResponse$outboundSchema.parse(toolsListResponse),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function toolsListResponseFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<ToolsListResponse, SDKValidationError> {
|
|
67
|
+
return safeParse(
|
|
68
|
+
jsonString,
|
|
69
|
+
(x) => ToolsListResponse$inboundSchema.parse(JSON.parse(x)),
|
|
70
|
+
`Failed to parse 'ToolsListResponse' from JSON`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type GetRestApiV1ToolsListRequest = {
|
|
11
|
+
/**
|
|
12
|
+
* Optional array of tool names to filter by
|
|
13
|
+
*/
|
|
14
|
+
toolNames?: Array<string> | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const GetRestApiV1ToolsListRequest$inboundSchema: z.ZodType<
|
|
19
|
+
GetRestApiV1ToolsListRequest,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z.object({
|
|
23
|
+
toolNames: z.array(z.string()).optional(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type GetRestApiV1ToolsListRequest$Outbound = {
|
|
28
|
+
toolNames?: Array<string> | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const GetRestApiV1ToolsListRequest$outboundSchema: z.ZodType<
|
|
33
|
+
GetRestApiV1ToolsListRequest$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
GetRestApiV1ToolsListRequest
|
|
36
|
+
> = z.object({
|
|
37
|
+
toolNames: z.array(z.string()).optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
+
*/
|
|
44
|
+
export namespace GetRestApiV1ToolsListRequest$ {
|
|
45
|
+
/** @deprecated use `GetRestApiV1ToolsListRequest$inboundSchema` instead. */
|
|
46
|
+
export const inboundSchema = GetRestApiV1ToolsListRequest$inboundSchema;
|
|
47
|
+
/** @deprecated use `GetRestApiV1ToolsListRequest$outboundSchema` instead. */
|
|
48
|
+
export const outboundSchema = GetRestApiV1ToolsListRequest$outboundSchema;
|
|
49
|
+
/** @deprecated use `GetRestApiV1ToolsListRequest$Outbound` instead. */
|
|
50
|
+
export type Outbound = GetRestApiV1ToolsListRequest$Outbound;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function getRestApiV1ToolsListRequestToJSON(
|
|
54
|
+
getRestApiV1ToolsListRequest: GetRestApiV1ToolsListRequest,
|
|
55
|
+
): string {
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
GetRestApiV1ToolsListRequest$outboundSchema.parse(
|
|
58
|
+
getRestApiV1ToolsListRequest,
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function getRestApiV1ToolsListRequestFromJSON(
|
|
64
|
+
jsonString: string,
|
|
65
|
+
): SafeParseResult<GetRestApiV1ToolsListRequest, SDKValidationError> {
|
|
66
|
+
return safeParse(
|
|
67
|
+
jsonString,
|
|
68
|
+
(x) => GetRestApiV1ToolsListRequest$inboundSchema.parse(JSON.parse(x)),
|
|
69
|
+
`Failed to parse 'GetRestApiV1ToolsListRequest' from JSON`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -16,11 +16,12 @@ export * from "./getchat.js";
|
|
|
16
16
|
export * from "./getchatapplication.js";
|
|
17
17
|
export * from "./getchatfiles.js";
|
|
18
18
|
export * from "./getdocvisibility.js";
|
|
19
|
-
export * from "./getpolicies.js";
|
|
20
19
|
export * from "./getpolicy.js";
|
|
21
20
|
export * from "./getreportstatus.js";
|
|
21
|
+
export * from "./getrestapiv1toolslist.js";
|
|
22
22
|
export * from "./listchats.js";
|
|
23
23
|
export * from "./listpins.js";
|
|
24
|
+
export * from "./listpolicies.js";
|
|
24
25
|
export * from "./listverifications.js";
|
|
25
26
|
export * from "./postapiindexv1debugdatasourcedocument.js";
|
|
26
27
|
export * from "./postapiindexv1debugdatasourcedocuments.js";
|
|
@@ -7,7 +7,7 @@ import { safeParse } from "../../lib/schemas.js";
|
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type ListpoliciesRequest = {
|
|
11
11
|
/**
|
|
12
12
|
* Filter to return reports with a given value of auto-hide.
|
|
13
13
|
*/
|
|
@@ -19,8 +19,8 @@ export type GetpoliciesRequest = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/** @internal */
|
|
22
|
-
export const
|
|
23
|
-
|
|
22
|
+
export const ListpoliciesRequest$inboundSchema: z.ZodType<
|
|
23
|
+
ListpoliciesRequest,
|
|
24
24
|
z.ZodTypeDef,
|
|
25
25
|
unknown
|
|
26
26
|
> = z.object({
|
|
@@ -29,16 +29,16 @@ export const GetpoliciesRequest$inboundSchema: z.ZodType<
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
/** @internal */
|
|
32
|
-
export type
|
|
32
|
+
export type ListpoliciesRequest$Outbound = {
|
|
33
33
|
autoHide?: boolean | undefined;
|
|
34
34
|
frequency?: string | undefined;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/** @internal */
|
|
38
|
-
export const
|
|
39
|
-
|
|
38
|
+
export const ListpoliciesRequest$outboundSchema: z.ZodType<
|
|
39
|
+
ListpoliciesRequest$Outbound,
|
|
40
40
|
z.ZodTypeDef,
|
|
41
|
-
|
|
41
|
+
ListpoliciesRequest
|
|
42
42
|
> = z.object({
|
|
43
43
|
autoHide: z.boolean().optional(),
|
|
44
44
|
frequency: z.string().optional(),
|
|
@@ -48,29 +48,29 @@ export const GetpoliciesRequest$outboundSchema: z.ZodType<
|
|
|
48
48
|
* @internal
|
|
49
49
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
50
50
|
*/
|
|
51
|
-
export namespace
|
|
52
|
-
/** @deprecated use `
|
|
53
|
-
export const inboundSchema =
|
|
54
|
-
/** @deprecated use `
|
|
55
|
-
export const outboundSchema =
|
|
56
|
-
/** @deprecated use `
|
|
57
|
-
export type Outbound =
|
|
51
|
+
export namespace ListpoliciesRequest$ {
|
|
52
|
+
/** @deprecated use `ListpoliciesRequest$inboundSchema` instead. */
|
|
53
|
+
export const inboundSchema = ListpoliciesRequest$inboundSchema;
|
|
54
|
+
/** @deprecated use `ListpoliciesRequest$outboundSchema` instead. */
|
|
55
|
+
export const outboundSchema = ListpoliciesRequest$outboundSchema;
|
|
56
|
+
/** @deprecated use `ListpoliciesRequest$Outbound` instead. */
|
|
57
|
+
export type Outbound = ListpoliciesRequest$Outbound;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function
|
|
61
|
-
|
|
60
|
+
export function listpoliciesRequestToJSON(
|
|
61
|
+
listpoliciesRequest: ListpoliciesRequest,
|
|
62
62
|
): string {
|
|
63
63
|
return JSON.stringify(
|
|
64
|
-
|
|
64
|
+
ListpoliciesRequest$outboundSchema.parse(listpoliciesRequest),
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export function
|
|
68
|
+
export function listpoliciesRequestFromJSON(
|
|
69
69
|
jsonString: string,
|
|
70
|
-
): SafeParseResult<
|
|
70
|
+
): SafeParseResult<ListpoliciesRequest, SDKValidationError> {
|
|
71
71
|
return safeParse(
|
|
72
72
|
jsonString,
|
|
73
|
-
(x) =>
|
|
74
|
-
`Failed to parse '
|
|
73
|
+
(x) => ListpoliciesRequest$inboundSchema.parse(JSON.parse(x)),
|
|
74
|
+
`Failed to parse 'ListpoliciesRequest' from JSON`,
|
|
75
75
|
);
|
|
76
76
|
}
|
|
@@ -17,7 +17,7 @@ import { useGleanContext } from "./_context.js";
|
|
|
17
17
|
import { MutationHookOptions } from "./_types.js";
|
|
18
18
|
|
|
19
19
|
export type ClientSearchQueryMutationVariables = {
|
|
20
|
-
request
|
|
20
|
+
request: components.SearchRequest;
|
|
21
21
|
options?: RequestOptions;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -17,7 +17,7 @@ import { useGleanContext } from "./_context.js";
|
|
|
17
17
|
import { MutationHookOptions } from "./_types.js";
|
|
18
18
|
|
|
19
19
|
export type ClientSearchQueryAsAdminMutationVariables = {
|
|
20
|
-
request
|
|
20
|
+
request: components.SearchRequest;
|
|
21
21
|
options?: RequestOptions;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -17,7 +17,7 @@ import { useGleanContext } from "./_context.js";
|
|
|
17
17
|
import { MutationHookOptions } from "./_types.js";
|
|
18
18
|
|
|
19
19
|
export type ClientSearchRecommendationsMutationVariables = {
|
|
20
|
-
request
|
|
20
|
+
request: components.RecommendationsRequest;
|
|
21
21
|
options?: RequestOptions;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
InvalidateQueryFilters,
|
|
7
|
+
QueryClient,
|
|
8
|
+
QueryFunctionContext,
|
|
9
|
+
QueryKey,
|
|
10
|
+
useQuery,
|
|
11
|
+
UseQueryResult,
|
|
12
|
+
useSuspenseQuery,
|
|
13
|
+
UseSuspenseQueryResult,
|
|
14
|
+
} from "@tanstack/react-query";
|
|
15
|
+
import { GleanCore } from "../core.js";
|
|
16
|
+
import { clientToolsList } from "../funcs/clientToolsList.js";
|
|
17
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
18
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
19
|
+
import * as components from "../models/components/index.js";
|
|
20
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
21
|
+
import { useGleanContext } from "./_context.js";
|
|
22
|
+
import {
|
|
23
|
+
QueryHookOptions,
|
|
24
|
+
SuspenseQueryHookOptions,
|
|
25
|
+
TupleToPrefixes,
|
|
26
|
+
} from "./_types.js";
|
|
27
|
+
|
|
28
|
+
export type ClientToolsListQueryData = components.ToolsListResponse;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* List available tools
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.
|
|
35
|
+
*/
|
|
36
|
+
export function useClientToolsList(
|
|
37
|
+
toolNames?: Array<string> | undefined,
|
|
38
|
+
options?: QueryHookOptions<ClientToolsListQueryData>,
|
|
39
|
+
): UseQueryResult<ClientToolsListQueryData, Error> {
|
|
40
|
+
const client = useGleanContext();
|
|
41
|
+
return useQuery({
|
|
42
|
+
...buildClientToolsListQuery(
|
|
43
|
+
client,
|
|
44
|
+
toolNames,
|
|
45
|
+
options,
|
|
46
|
+
),
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List available tools
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.
|
|
56
|
+
*/
|
|
57
|
+
export function useClientToolsListSuspense(
|
|
58
|
+
toolNames?: Array<string> | undefined,
|
|
59
|
+
options?: SuspenseQueryHookOptions<ClientToolsListQueryData>,
|
|
60
|
+
): UseSuspenseQueryResult<ClientToolsListQueryData, Error> {
|
|
61
|
+
const client = useGleanContext();
|
|
62
|
+
return useSuspenseQuery({
|
|
63
|
+
...buildClientToolsListQuery(
|
|
64
|
+
client,
|
|
65
|
+
toolNames,
|
|
66
|
+
options,
|
|
67
|
+
),
|
|
68
|
+
...options,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function prefetchClientToolsList(
|
|
73
|
+
queryClient: QueryClient,
|
|
74
|
+
client$: GleanCore,
|
|
75
|
+
toolNames?: Array<string> | undefined,
|
|
76
|
+
): Promise<void> {
|
|
77
|
+
return queryClient.prefetchQuery({
|
|
78
|
+
...buildClientToolsListQuery(
|
|
79
|
+
client$,
|
|
80
|
+
toolNames,
|
|
81
|
+
),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function setClientToolsListData(
|
|
86
|
+
client: QueryClient,
|
|
87
|
+
queryKeyBase: [parameters: { toolNames?: Array<string> | undefined }],
|
|
88
|
+
data: ClientToolsListQueryData,
|
|
89
|
+
): ClientToolsListQueryData | undefined {
|
|
90
|
+
const key = queryKeyClientToolsList(...queryKeyBase);
|
|
91
|
+
|
|
92
|
+
return client.setQueryData<ClientToolsListQueryData>(key, data);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function invalidateClientToolsList(
|
|
96
|
+
client: QueryClient,
|
|
97
|
+
queryKeyBase: TupleToPrefixes<
|
|
98
|
+
[parameters: { toolNames?: Array<string> | undefined }]
|
|
99
|
+
>,
|
|
100
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
101
|
+
): Promise<void> {
|
|
102
|
+
return client.invalidateQueries({
|
|
103
|
+
...filters,
|
|
104
|
+
queryKey: ["@gleanwork/api-client", "tools", "list", ...queryKeyBase],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function invalidateAllClientToolsList(
|
|
109
|
+
client: QueryClient,
|
|
110
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
111
|
+
): Promise<void> {
|
|
112
|
+
return client.invalidateQueries({
|
|
113
|
+
...filters,
|
|
114
|
+
queryKey: ["@gleanwork/api-client", "tools", "list"],
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function buildClientToolsListQuery(
|
|
119
|
+
client$: GleanCore,
|
|
120
|
+
toolNames?: Array<string> | undefined,
|
|
121
|
+
options?: RequestOptions,
|
|
122
|
+
): {
|
|
123
|
+
queryKey: QueryKey;
|
|
124
|
+
queryFn: (context: QueryFunctionContext) => Promise<ClientToolsListQueryData>;
|
|
125
|
+
} {
|
|
126
|
+
return {
|
|
127
|
+
queryKey: queryKeyClientToolsList({ toolNames }),
|
|
128
|
+
queryFn: async function clientToolsListQueryFn(
|
|
129
|
+
ctx,
|
|
130
|
+
): Promise<ClientToolsListQueryData> {
|
|
131
|
+
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
132
|
+
const mergedOptions = {
|
|
133
|
+
...options,
|
|
134
|
+
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return unwrapAsync(clientToolsList(
|
|
138
|
+
client$,
|
|
139
|
+
toolNames,
|
|
140
|
+
mergedOptions,
|
|
141
|
+
));
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function queryKeyClientToolsList(
|
|
147
|
+
parameters: { toolNames?: Array<string> | undefined },
|
|
148
|
+
): QueryKey {
|
|
149
|
+
return ["@gleanwork/api-client", "tools", "list", parameters];
|
|
150
|
+
}
|