@gleanwork/api-client 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +3 -3
  2. package/dist/commonjs/__tests__/summarize.test.js +2 -3
  3. package/dist/commonjs/__tests__/summarize.test.js.map +1 -1
  4. package/dist/commonjs/funcs/clientInsightsRetrieve.d.ts +2 -2
  5. package/dist/commonjs/funcs/clientInsightsRetrieve.js +2 -2
  6. package/dist/commonjs/lib/config.d.ts +2 -2
  7. package/dist/commonjs/lib/config.js +2 -2
  8. package/dist/commonjs/models/components/agentsinsightsv2request.d.ts +40 -0
  9. package/dist/commonjs/models/components/agentsinsightsv2request.d.ts.map +1 -0
  10. package/dist/commonjs/models/components/agentsinsightsv2request.js +74 -0
  11. package/dist/commonjs/models/components/agentsinsightsv2request.js.map +1 -0
  12. package/dist/commonjs/models/components/index.d.ts +3 -0
  13. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/index.js +3 -0
  15. package/dist/commonjs/models/components/index.js.map +1 -1
  16. package/dist/commonjs/models/components/insightsassistantrequest.d.ts +35 -0
  17. package/dist/commonjs/models/components/insightsassistantrequest.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/insightsassistantrequest.js +72 -0
  19. package/dist/commonjs/models/components/insightsassistantrequest.js.map +1 -0
  20. package/dist/commonjs/models/components/insightsoverviewrequest.d.ts +35 -0
  21. package/dist/commonjs/models/components/insightsoverviewrequest.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/insightsoverviewrequest.js +72 -0
  23. package/dist/commonjs/models/components/insightsoverviewrequest.js.map +1 -0
  24. package/dist/commonjs/models/components/insightsrequest.d.ts +31 -7
  25. package/dist/commonjs/models/components/insightsrequest.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/insightsrequest.js +16 -4
  27. package/dist/commonjs/models/components/insightsrequest.js.map +1 -1
  28. package/dist/commonjs/react-query/clientInsightsRetrieve.d.ts +2 -2
  29. package/dist/commonjs/react-query/clientInsightsRetrieve.js +2 -2
  30. package/dist/commonjs/sdk/insights.d.ts +2 -2
  31. package/dist/commonjs/sdk/insights.js +2 -2
  32. package/dist/esm/__tests__/summarize.test.js +2 -3
  33. package/dist/esm/__tests__/summarize.test.js.map +1 -1
  34. package/dist/esm/funcs/clientInsightsRetrieve.d.ts +2 -2
  35. package/dist/esm/funcs/clientInsightsRetrieve.js +2 -2
  36. package/dist/esm/lib/config.d.ts +2 -2
  37. package/dist/esm/lib/config.js +2 -2
  38. package/dist/esm/models/components/agentsinsightsv2request.d.ts +40 -0
  39. package/dist/esm/models/components/agentsinsightsv2request.d.ts.map +1 -0
  40. package/dist/esm/models/components/agentsinsightsv2request.js +36 -0
  41. package/dist/esm/models/components/agentsinsightsv2request.js.map +1 -0
  42. package/dist/esm/models/components/index.d.ts +3 -0
  43. package/dist/esm/models/components/index.d.ts.map +1 -1
  44. package/dist/esm/models/components/index.js +3 -0
  45. package/dist/esm/models/components/index.js.map +1 -1
  46. package/dist/esm/models/components/insightsassistantrequest.d.ts +35 -0
  47. package/dist/esm/models/components/insightsassistantrequest.d.ts.map +1 -0
  48. package/dist/esm/models/components/insightsassistantrequest.js +34 -0
  49. package/dist/esm/models/components/insightsassistantrequest.js.map +1 -0
  50. package/dist/esm/models/components/insightsoverviewrequest.d.ts +35 -0
  51. package/dist/esm/models/components/insightsoverviewrequest.d.ts.map +1 -0
  52. package/dist/esm/models/components/insightsoverviewrequest.js +34 -0
  53. package/dist/esm/models/components/insightsoverviewrequest.js.map +1 -0
  54. package/dist/esm/models/components/insightsrequest.d.ts +31 -7
  55. package/dist/esm/models/components/insightsrequest.d.ts.map +1 -1
  56. package/dist/esm/models/components/insightsrequest.js +16 -4
  57. package/dist/esm/models/components/insightsrequest.js.map +1 -1
  58. package/dist/esm/react-query/clientInsightsRetrieve.d.ts +2 -2
  59. package/dist/esm/react-query/clientInsightsRetrieve.js +2 -2
  60. package/dist/esm/sdk/insights.d.ts +2 -2
  61. package/dist/esm/sdk/insights.js +2 -2
  62. package/docs/sdks/insights/README.md +4 -16
  63. package/jsr.json +1 -1
  64. package/package.json +1 -1
  65. package/src/__tests__/summarize.test.ts +2 -3
  66. package/src/funcs/clientInsightsRetrieve.ts +2 -2
  67. package/src/lib/config.ts +2 -2
  68. package/src/models/components/agentsinsightsv2request.ts +86 -0
  69. package/src/models/components/index.ts +3 -0
  70. package/src/models/components/insightsassistantrequest.ts +79 -0
  71. package/src/models/components/insightsoverviewrequest.ts +79 -0
  72. package/src/models/components/insightsrequest.ts +50 -11
  73. package/src/react-query/clientInsightsRetrieve.ts +2 -2
  74. package/src/sdk/insights.ts +2 -2
@@ -0,0 +1,79 @@
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
+ Period,
11
+ Period$inboundSchema,
12
+ Period$Outbound,
13
+ Period$outboundSchema,
14
+ } from "./period.js";
15
+
16
+ export type InsightsOverviewRequest = {
17
+ /**
18
+ * Departments for which Insights are requested.
19
+ */
20
+ departments?: Array<string> | undefined;
21
+ dayRange?: Period | undefined;
22
+ };
23
+
24
+ /** @internal */
25
+ export const InsightsOverviewRequest$inboundSchema: z.ZodType<
26
+ InsightsOverviewRequest,
27
+ z.ZodTypeDef,
28
+ unknown
29
+ > = z.object({
30
+ departments: z.array(z.string()).optional(),
31
+ dayRange: Period$inboundSchema.optional(),
32
+ });
33
+
34
+ /** @internal */
35
+ export type InsightsOverviewRequest$Outbound = {
36
+ departments?: Array<string> | undefined;
37
+ dayRange?: Period$Outbound | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export const InsightsOverviewRequest$outboundSchema: z.ZodType<
42
+ InsightsOverviewRequest$Outbound,
43
+ z.ZodTypeDef,
44
+ InsightsOverviewRequest
45
+ > = z.object({
46
+ departments: z.array(z.string()).optional(),
47
+ dayRange: Period$outboundSchema.optional(),
48
+ });
49
+
50
+ /**
51
+ * @internal
52
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
53
+ */
54
+ export namespace InsightsOverviewRequest$ {
55
+ /** @deprecated use `InsightsOverviewRequest$inboundSchema` instead. */
56
+ export const inboundSchema = InsightsOverviewRequest$inboundSchema;
57
+ /** @deprecated use `InsightsOverviewRequest$outboundSchema` instead. */
58
+ export const outboundSchema = InsightsOverviewRequest$outboundSchema;
59
+ /** @deprecated use `InsightsOverviewRequest$Outbound` instead. */
60
+ export type Outbound = InsightsOverviewRequest$Outbound;
61
+ }
62
+
63
+ export function insightsOverviewRequestToJSON(
64
+ insightsOverviewRequest: InsightsOverviewRequest,
65
+ ): string {
66
+ return JSON.stringify(
67
+ InsightsOverviewRequest$outboundSchema.parse(insightsOverviewRequest),
68
+ );
69
+ }
70
+
71
+ export function insightsOverviewRequestFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<InsightsOverviewRequest, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => InsightsOverviewRequest$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'InsightsOverviewRequest' from JSON`,
78
+ );
79
+ }
@@ -7,6 +7,12 @@ import { safeParse } from "../../lib/schemas.js";
7
7
  import { ClosedEnum } from "../../types/enums.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ AgentsInsightsV2Request,
12
+ AgentsInsightsV2Request$inboundSchema,
13
+ AgentsInsightsV2Request$Outbound,
14
+ AgentsInsightsV2Request$outboundSchema,
15
+ } from "./agentsinsightsv2request.js";
10
16
  import {
11
17
  InsightsAgentsRequestOptions,
12
18
  InsightsAgentsRequestOptions$inboundSchema,
@@ -19,6 +25,18 @@ import {
19
25
  InsightsAiAppRequestOptions$Outbound,
20
26
  InsightsAiAppRequestOptions$outboundSchema,
21
27
  } from "./insightsaiapprequestoptions.js";
28
+ import {
29
+ InsightsAssistantRequest,
30
+ InsightsAssistantRequest$inboundSchema,
31
+ InsightsAssistantRequest$Outbound,
32
+ InsightsAssistantRequest$outboundSchema,
33
+ } from "./insightsassistantrequest.js";
34
+ import {
35
+ InsightsOverviewRequest,
36
+ InsightsOverviewRequest$inboundSchema,
37
+ InsightsOverviewRequest$Outbound,
38
+ InsightsOverviewRequest$outboundSchema,
39
+ } from "./insightsoverviewrequest.js";
22
40
  import {
23
41
  Period,
24
42
  Period$inboundSchema,
@@ -28,6 +46,9 @@ import {
28
46
 
29
47
  export const InsightsRequestCategory = {
30
48
  Agents: "AGENTS",
49
+ AgentUsers: "AGENT_USERS",
50
+ TopAgents: "TOP_AGENTS",
51
+ AgentsUsageByDepartment: "AGENTS_USAGE_BY_DEPARTMENT",
31
52
  Ai: "AI",
32
53
  AiApps: "AI_APPS",
33
54
  Announcements: "ANNOUNCEMENTS",
@@ -52,12 +73,23 @@ export const AssistantActivityType = {
52
73
  export type AssistantActivityType = ClosedEnum<typeof AssistantActivityType>;
53
74
 
54
75
  export type InsightsRequest = {
76
+ overviewRequest?: InsightsOverviewRequest | undefined;
77
+ assistantRequest?: InsightsAssistantRequest | undefined;
78
+ agentsRequest?: AgentsInsightsV2Request | undefined;
79
+ /**
80
+ * If true, suppresses the generation of per-user Insights in the response. Default is false.
81
+ */
82
+ disablePerUserInsights?: boolean | undefined;
55
83
  /**
56
84
  * Categories of data requested. Request can include single or multiple types.
85
+ *
86
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
57
87
  */
58
- categories: Array<InsightsRequestCategory>;
88
+ categories?: Array<InsightsRequestCategory> | undefined;
59
89
  /**
60
90
  * Departments that the data is requested for. If this is empty, corresponds to whole company.
91
+ *
92
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
61
93
  */
62
94
  departments?: Array<string> | undefined;
63
95
  dayRange?: Period | undefined;
@@ -65,12 +97,10 @@ export type InsightsRequest = {
65
97
  agentsRequestOptions?: InsightsAgentsRequestOptions | undefined;
66
98
  /**
67
99
  * Types of activity that should count in the definition of an Assistant Active User. Affects only insights for AI category.
100
+ *
101
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
68
102
  */
69
103
  assistantActivityTypes?: Array<AssistantActivityType> | undefined;
70
- /**
71
- * If true, suppresses the generation of per-user Insights in the response. Default is false.
72
- */
73
- disablePerUserInsights?: boolean | undefined;
74
104
  };
75
105
 
76
106
  /** @internal */
@@ -121,25 +151,31 @@ export const InsightsRequest$inboundSchema: z.ZodType<
121
151
  z.ZodTypeDef,
122
152
  unknown
123
153
  > = z.object({
124
- categories: z.array(InsightsRequestCategory$inboundSchema),
154
+ overviewRequest: InsightsOverviewRequest$inboundSchema.optional(),
155
+ assistantRequest: InsightsAssistantRequest$inboundSchema.optional(),
156
+ agentsRequest: AgentsInsightsV2Request$inboundSchema.optional(),
157
+ disablePerUserInsights: z.boolean().optional(),
158
+ categories: z.array(InsightsRequestCategory$inboundSchema).optional(),
125
159
  departments: z.array(z.string()).optional(),
126
160
  dayRange: Period$inboundSchema.optional(),
127
161
  aiAppRequestOptions: InsightsAiAppRequestOptions$inboundSchema.optional(),
128
162
  agentsRequestOptions: InsightsAgentsRequestOptions$inboundSchema.optional(),
129
163
  assistantActivityTypes: z.array(AssistantActivityType$inboundSchema)
130
164
  .optional(),
131
- disablePerUserInsights: z.boolean().optional(),
132
165
  });
133
166
 
134
167
  /** @internal */
135
168
  export type InsightsRequest$Outbound = {
136
- categories: Array<string>;
169
+ overviewRequest?: InsightsOverviewRequest$Outbound | undefined;
170
+ assistantRequest?: InsightsAssistantRequest$Outbound | undefined;
171
+ agentsRequest?: AgentsInsightsV2Request$Outbound | undefined;
172
+ disablePerUserInsights?: boolean | undefined;
173
+ categories?: Array<string> | undefined;
137
174
  departments?: Array<string> | undefined;
138
175
  dayRange?: Period$Outbound | undefined;
139
176
  aiAppRequestOptions?: InsightsAiAppRequestOptions$Outbound | undefined;
140
177
  agentsRequestOptions?: InsightsAgentsRequestOptions$Outbound | undefined;
141
178
  assistantActivityTypes?: Array<string> | undefined;
142
- disablePerUserInsights?: boolean | undefined;
143
179
  };
144
180
 
145
181
  /** @internal */
@@ -148,14 +184,17 @@ export const InsightsRequest$outboundSchema: z.ZodType<
148
184
  z.ZodTypeDef,
149
185
  InsightsRequest
150
186
  > = z.object({
151
- categories: z.array(InsightsRequestCategory$outboundSchema),
187
+ overviewRequest: InsightsOverviewRequest$outboundSchema.optional(),
188
+ assistantRequest: InsightsAssistantRequest$outboundSchema.optional(),
189
+ agentsRequest: AgentsInsightsV2Request$outboundSchema.optional(),
190
+ disablePerUserInsights: z.boolean().optional(),
191
+ categories: z.array(InsightsRequestCategory$outboundSchema).optional(),
152
192
  departments: z.array(z.string()).optional(),
153
193
  dayRange: Period$outboundSchema.optional(),
154
194
  aiAppRequestOptions: InsightsAiAppRequestOptions$outboundSchema.optional(),
155
195
  agentsRequestOptions: InsightsAgentsRequestOptions$outboundSchema.optional(),
156
196
  assistantActivityTypes: z.array(AssistantActivityType$outboundSchema)
157
197
  .optional(),
158
- disablePerUserInsights: z.boolean().optional(),
159
198
  });
160
199
 
161
200
  /**
@@ -24,10 +24,10 @@ export type ClientInsightsRetrieveMutationVariables = {
24
24
  export type ClientInsightsRetrieveMutationData = components.InsightsResponse;
25
25
 
26
26
  /**
27
- * Read insights
27
+ * Get insights
28
28
  *
29
29
  * @remarks
30
- * Reads the aggregate information for each user, query, and content.
30
+ * Gets the aggregate usage insights data displayed in the Insights Dashboards.
31
31
  */
32
32
  export function useClientInsightsRetrieveMutation(
33
33
  options?: MutationHookOptions<
@@ -9,10 +9,10 @@ import { unwrapAsync } from "../types/fp.js";
9
9
 
10
10
  export class Insights extends ClientSDK {
11
11
  /**
12
- * Read insights
12
+ * Get insights
13
13
  *
14
14
  * @remarks
15
- * Reads the aggregate information for each user, query, and content.
15
+ * Gets the aggregate usage insights data displayed in the Insights Dashboards.
16
16
  */
17
17
  async retrieve(
18
18
  request: components.InsightsRequest,