syllable-sdk 0.1.0-alpha.158 → 0.1.0-alpha.161

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 (54) hide show
  1. package/README.md +5 -0
  2. package/docs/sdks/batches/README.md +4 -4
  3. package/docs/sdks/permissions/README.md +81 -0
  4. package/docs/sdks/takeouts/README.md +1 -1
  5. package/docs/sdks/workflows/README.md +8 -8
  6. package/funcs/permissionsList.d.ts +15 -0
  7. package/funcs/permissionsList.d.ts.map +1 -0
  8. package/funcs/permissionsList.js +89 -0
  9. package/funcs/permissionsList.js.map +1 -0
  10. package/funcs/takeoutsTakeoutsGetFile.d.ts +1 -1
  11. package/funcs/takeoutsTakeoutsGetFile.d.ts.map +1 -1
  12. package/funcs/takeoutsTakeoutsGetFile.js +2 -2
  13. package/funcs/takeoutsTakeoutsGetFile.js.map +1 -1
  14. package/jsr.json +1 -1
  15. package/lib/config.d.ts +2 -2
  16. package/lib/config.js +2 -2
  17. package/models/components/index.d.ts +2 -0
  18. package/models/components/index.d.ts.map +1 -1
  19. package/models/components/index.js +2 -0
  20. package/models/components/index.js.map +1 -1
  21. package/models/components/insightworkflowcondition.d.ts +7 -4
  22. package/models/components/insightworkflowcondition.d.ts.map +1 -1
  23. package/models/components/insightworkflowcondition.js +4 -6
  24. package/models/components/insightworkflowcondition.js.map +1 -1
  25. package/models/components/permissionresponse.d.ts +38 -0
  26. package/models/components/permissionresponse.d.ts.map +1 -0
  27. package/models/components/permissionresponse.js +62 -0
  28. package/models/components/permissionresponse.js.map +1 -0
  29. package/models/components/permissions.d.ts +199 -0
  30. package/models/components/permissions.d.ts.map +1 -0
  31. package/models/components/permissions.js +108 -0
  32. package/models/components/permissions.js.map +1 -0
  33. package/openapi.json +170 -43
  34. package/package.json +1 -1
  35. package/sdk/permissions.d.ts +12 -0
  36. package/sdk/permissions.d.ts.map +1 -0
  37. package/sdk/permissions.js +22 -0
  38. package/sdk/permissions.js.map +1 -0
  39. package/sdk/sdk.d.ts +3 -0
  40. package/sdk/sdk.d.ts.map +1 -1
  41. package/sdk/sdk.js +4 -0
  42. package/sdk/sdk.js.map +1 -1
  43. package/sdk/takeouts.d.ts +1 -1
  44. package/sdk/takeouts.d.ts.map +1 -1
  45. package/src/funcs/permissionsList.ts +112 -0
  46. package/src/funcs/takeoutsTakeoutsGetFile.ts +4 -4
  47. package/src/lib/config.ts +2 -2
  48. package/src/models/components/index.ts +2 -0
  49. package/src/models/components/insightworkflowcondition.ts +15 -10
  50. package/src/models/components/permissionresponse.ts +81 -0
  51. package/src/models/components/permissions.ts +88 -0
  52. package/src/sdk/permissions.ts +25 -0
  53. package/src/sdk/sdk.ts +6 -0
  54. package/src/sdk/takeouts.ts +1 -1
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { SyllableSDKCore } from "../core.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as components from "../models/components/index.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKError } from "../models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import { Result } from "../types/fp.js";
23
+
24
+ /**
25
+ * List Permissions
26
+ *
27
+ * @remarks
28
+ * Get all available permissions in the system.
29
+ */
30
+ export async function permissionsList(
31
+ client: SyllableSDKCore,
32
+ options?: RequestOptions,
33
+ ): Promise<
34
+ Result<
35
+ Array<components.PermissionResponse>,
36
+ | SDKError
37
+ | SDKValidationError
38
+ | UnexpectedClientError
39
+ | InvalidRequestError
40
+ | RequestAbortedError
41
+ | RequestTimeoutError
42
+ | ConnectionError
43
+ >
44
+ > {
45
+ const path = pathToFunc("/api/v1/permissions/")();
46
+
47
+ const headers = new Headers(compactMap({
48
+ Accept: "application/json",
49
+ }));
50
+
51
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
52
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
53
+ const requestSecurity = resolveGlobalSecurity(securityInput);
54
+
55
+ const context = {
56
+ baseURL: options?.serverURL ?? "",
57
+ operationID: "permissions_list",
58
+ oAuth2Scopes: [],
59
+
60
+ resolvedSecurity: requestSecurity,
61
+
62
+ securitySource: client._options.apiKeyHeader,
63
+ retryConfig: options?.retries
64
+ || client._options.retryConfig
65
+ || { strategy: "none" },
66
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
67
+ };
68
+
69
+ const requestRes = client._createRequest(context, {
70
+ security: requestSecurity,
71
+ method: "GET",
72
+ baseURL: options?.serverURL,
73
+ path: path,
74
+ headers: headers,
75
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
76
+ }, options);
77
+ if (!requestRes.ok) {
78
+ return requestRes;
79
+ }
80
+ const req = requestRes.value;
81
+
82
+ const doResult = await client._do(req, {
83
+ context,
84
+ errorCodes: ["4XX", "5XX"],
85
+ retryConfig: context.retryConfig,
86
+ retryCodes: context.retryCodes,
87
+ });
88
+ if (!doResult.ok) {
89
+ return doResult;
90
+ }
91
+ const response = doResult.value;
92
+
93
+ const [result] = await M.match<
94
+ Array<components.PermissionResponse>,
95
+ | SDKError
96
+ | SDKValidationError
97
+ | UnexpectedClientError
98
+ | InvalidRequestError
99
+ | RequestAbortedError
100
+ | RequestTimeoutError
101
+ | ConnectionError
102
+ >(
103
+ M.json(200, z.array(components.PermissionResponse$inboundSchema)),
104
+ M.fail("4XX"),
105
+ M.fail("5XX"),
106
+ )(response);
107
+ if (!result.ok) {
108
+ return result;
109
+ }
110
+
111
+ return result;
112
+ }
@@ -33,7 +33,7 @@ export async function takeoutsTakeoutsGetFile(
33
33
  options?: RequestOptions,
34
34
  ): Promise<
35
35
  Result<
36
- any,
36
+ string,
37
37
  | errors.HTTPValidationError
38
38
  | SDKError
39
39
  | SDKValidationError
@@ -71,7 +71,7 @@ export async function takeoutsTakeoutsGetFile(
71
71
  );
72
72
 
73
73
  const headers = new Headers(compactMap({
74
- Accept: "application/json",
74
+ Accept: "application/zip",
75
75
  }));
76
76
 
77
77
  const secConfig = await extractSecurity(client._options.apiKeyHeader);
@@ -122,7 +122,7 @@ export async function takeoutsTakeoutsGetFile(
122
122
  };
123
123
 
124
124
  const [result] = await M.match<
125
- any,
125
+ string,
126
126
  | errors.HTTPValidationError
127
127
  | SDKError
128
128
  | SDKValidationError
@@ -132,7 +132,7 @@ export async function takeoutsTakeoutsGetFile(
132
132
  | RequestTimeoutError
133
133
  | ConnectionError
134
134
  >(
135
- M.json(200, z.any()),
135
+ M.text(200, z.string(), { ctype: "application/zip" }),
136
136
  M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
137
137
  M.fail("4XX"),
138
138
  M.fail("5XX"),
package/src/lib/config.ts CHANGED
@@ -57,8 +57,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
57
57
  export const SDK_METADATA = {
58
58
  language: "typescript",
59
59
  openapiDocVersion: "0.0.2",
60
- sdkVersion: "0.1.0-alpha.158",
60
+ sdkVersion: "0.1.0-alpha.161",
61
61
  genVersion: "2.512.4",
62
62
  userAgent:
63
- "speakeasy-sdk/typescript 0.1.0-alpha.158 2.512.4 0.0.2 syllable-sdk",
63
+ "speakeasy-sdk/typescript 0.1.0-alpha.161 2.512.4 0.0.2 syllable-sdk",
64
64
  } as const;
@@ -125,6 +125,8 @@ export * from "./listresponsetoolresponse.js";
125
125
  export * from "./orderbydirection.js";
126
126
  export * from "./outboundcampaign.js";
127
127
  export * from "./outboundcampaigninput.js";
128
+ export * from "./permissionresponse.js";
129
+ export * from "./permissions.js";
128
130
  export * from "./promptcreaterequest.js";
129
131
  export * from "./prompthistory.js";
130
132
  export * from "./promptllmconfig.js";
@@ -8,7 +8,10 @@ import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
10
 
11
- export type AgentList = string | number;
11
+ /**
12
+ * List of agent IDs
13
+ */
14
+ export type AgentList = Array<number> | Array<string>;
12
15
 
13
16
  /**
14
17
  * Model for the conditions that trigger an insight workflow.
@@ -29,7 +32,7 @@ export type InsightWorkflowCondition = {
29
32
  /**
30
33
  * List of agent IDs
31
34
  */
32
- agentList?: Array<string | number> | null | undefined;
35
+ agentList?: Array<number> | Array<string> | null | undefined;
33
36
  /**
34
37
  * List of prompts IDs
35
38
  */
@@ -45,17 +48,17 @@ export const AgentList$inboundSchema: z.ZodType<
45
48
  AgentList,
46
49
  z.ZodTypeDef,
47
50
  unknown
48
- > = z.union([z.string(), z.number().int()]);
51
+ > = z.union([z.array(z.number().int()), z.array(z.string())]);
49
52
 
50
53
  /** @internal */
51
- export type AgentList$Outbound = string | number;
54
+ export type AgentList$Outbound = Array<number> | Array<string>;
52
55
 
53
56
  /** @internal */
54
57
  export const AgentList$outboundSchema: z.ZodType<
55
58
  AgentList$Outbound,
56
59
  z.ZodTypeDef,
57
60
  AgentList
58
- > = z.union([z.string(), z.number().int()]);
61
+ > = z.union([z.array(z.number().int()), z.array(z.string())]);
59
62
 
60
63
  /**
61
64
  * @internal
@@ -93,8 +96,9 @@ export const InsightWorkflowCondition$inboundSchema: z.ZodType<
93
96
  min_duration: z.nullable(z.number().int()).optional(),
94
97
  max_duration: z.nullable(z.number().int()).optional(),
95
98
  sample_rate: z.nullable(z.number().int()).optional(),
96
- agent_list: z.nullable(z.array(z.union([z.string(), z.number().int()])))
97
- .optional(),
99
+ agent_list: z.nullable(
100
+ z.union([z.array(z.number().int()), z.array(z.string())]),
101
+ ).optional(),
98
102
  prompt_list: z.nullable(z.array(z.string())).optional(),
99
103
  folder_list: z.nullable(z.array(z.number().int())).optional(),
100
104
  }).transform((v) => {
@@ -113,7 +117,7 @@ export type InsightWorkflowCondition$Outbound = {
113
117
  min_duration?: number | null | undefined;
114
118
  max_duration?: number | null | undefined;
115
119
  sample_rate?: number | null | undefined;
116
- agent_list?: Array<string | number> | null | undefined;
120
+ agent_list?: Array<number> | Array<string> | null | undefined;
117
121
  prompt_list?: Array<string> | null | undefined;
118
122
  folder_list?: Array<number> | null | undefined;
119
123
  };
@@ -127,8 +131,9 @@ export const InsightWorkflowCondition$outboundSchema: z.ZodType<
127
131
  minDuration: z.nullable(z.number().int()).optional(),
128
132
  maxDuration: z.nullable(z.number().int()).optional(),
129
133
  sampleRate: z.nullable(z.number().int()).optional(),
130
- agentList: z.nullable(z.array(z.union([z.string(), z.number().int()])))
131
- .optional(),
134
+ agentList: z.nullable(
135
+ z.union([z.array(z.number().int()), z.array(z.string())]),
136
+ ).optional(),
132
137
  promptList: z.nullable(z.array(z.string())).optional(),
133
138
  folderList: z.nullable(z.array(z.number().int())).optional(),
134
139
  }).transform((v) => {
@@ -0,0 +1,81 @@
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
+ Permissions,
11
+ Permissions$inboundSchema,
12
+ Permissions$outboundSchema,
13
+ } from "./permissions.js";
14
+
15
+ /**
16
+ * Information about a permission.
17
+ */
18
+ export type PermissionResponse = {
19
+ name: Permissions;
20
+ /**
21
+ * Description of the permission
22
+ */
23
+ description: string;
24
+ };
25
+
26
+ /** @internal */
27
+ export const PermissionResponse$inboundSchema: z.ZodType<
28
+ PermissionResponse,
29
+ z.ZodTypeDef,
30
+ unknown
31
+ > = z.object({
32
+ name: Permissions$inboundSchema,
33
+ description: z.string(),
34
+ });
35
+
36
+ /** @internal */
37
+ export type PermissionResponse$Outbound = {
38
+ name: string;
39
+ description: string;
40
+ };
41
+
42
+ /** @internal */
43
+ export const PermissionResponse$outboundSchema: z.ZodType<
44
+ PermissionResponse$Outbound,
45
+ z.ZodTypeDef,
46
+ PermissionResponse
47
+ > = z.object({
48
+ name: Permissions$outboundSchema,
49
+ description: z.string(),
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace PermissionResponse$ {
57
+ /** @deprecated use `PermissionResponse$inboundSchema` instead. */
58
+ export const inboundSchema = PermissionResponse$inboundSchema;
59
+ /** @deprecated use `PermissionResponse$outboundSchema` instead. */
60
+ export const outboundSchema = PermissionResponse$outboundSchema;
61
+ /** @deprecated use `PermissionResponse$Outbound` instead. */
62
+ export type Outbound = PermissionResponse$Outbound;
63
+ }
64
+
65
+ export function permissionResponseToJSON(
66
+ permissionResponse: PermissionResponse,
67
+ ): string {
68
+ return JSON.stringify(
69
+ PermissionResponse$outboundSchema.parse(permissionResponse),
70
+ );
71
+ }
72
+
73
+ export function permissionResponseFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<PermissionResponse, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) => PermissionResponse$inboundSchema.parse(JSON.parse(x)),
79
+ `Failed to parse 'PermissionResponse' from JSON`,
80
+ );
81
+ }
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const Permissions = {
9
+ AgentsRead: "agents_read",
10
+ AgentsWrite: "agents_write",
11
+ AgentsDelete: "agents_delete",
12
+ ApiTokenRead: "api_token_read",
13
+ ApiTokenWrite: "api_token_write",
14
+ ApiTokenDelete: "api_token_delete",
15
+ ChannelsRead: "channels_read",
16
+ ChannelsWrite: "channels_write",
17
+ ChannelsDelete: "channels_delete",
18
+ Chat: "chat",
19
+ ConversationsRead: "conversations_read",
20
+ CustomMessagesRead: "custom_messages_read",
21
+ CustomMessagesWrite: "custom_messages_write",
22
+ CustomMessagesDelete: "custom_messages_delete",
23
+ DataSourcesRead: "data_sources_read",
24
+ DataSourcesWrite: "data_sources_write",
25
+ DataSourcesDelete: "data_sources_delete",
26
+ DirectoryRead: "directory_read",
27
+ DirectoryWrite: "directory_write",
28
+ DirectoryDelete: "directory_delete",
29
+ EventsRead: "events_read",
30
+ IncidentsRead: "incidents_read",
31
+ InsightsRead: "insights_read",
32
+ InsightsWrite: "insights_write",
33
+ InsightsDelete: "insights_delete",
34
+ IntegrationsRead: "integrations_read",
35
+ IntegrationsWrite: "integrations_write",
36
+ IntegrationsDelete: "integrations_delete",
37
+ LanguageGroupsRead: "language_groups_read",
38
+ LanguageGroupsWrite: "language_groups_write",
39
+ LanguageGroupsDelete: "language_groups_delete",
40
+ OrganizationsRead: "organizations_read",
41
+ OrganizationsWrite: "organizations_write",
42
+ OutboundRead: "outbound_read",
43
+ OutboundWrite: "outbound_write",
44
+ OutboundDelete: "outbound_delete",
45
+ PermissionsRead: "permissions_read",
46
+ PromptsRead: "prompts_read",
47
+ PromptsWrite: "prompts_write",
48
+ PromptsDelete: "prompts_delete",
49
+ RecordingDownload: "recording_download",
50
+ ReportsRead: "reports_read",
51
+ ServicesRead: "services_read",
52
+ ServicesWrite: "services_write",
53
+ ServicesDelete: "services_delete",
54
+ SessionLabelsRead: "session_labels_read",
55
+ SessionLabelsWrite: "session_labels_write",
56
+ SessionsRead: "sessions_read",
57
+ ToolsRead: "tools_read",
58
+ ToolsWrite: "tools_write",
59
+ ToolsDelete: "tools_delete",
60
+ UsersRead: "users_read",
61
+ UsersWrite: "users_write",
62
+ UsersDelete: "users_delete",
63
+ SaIncidentsRead: "sa_incidents_read",
64
+ SaIncidentsWrite: "sa_incidents_write",
65
+ SaIncidentsDelete: "sa_incidents_delete",
66
+ SaPermissionsRead: "sa_permissions_read",
67
+ SuperAdminGlobal: "super_admin_global",
68
+ } as const;
69
+ export type Permissions = ClosedEnum<typeof Permissions>;
70
+
71
+ /** @internal */
72
+ export const Permissions$inboundSchema: z.ZodNativeEnum<typeof Permissions> = z
73
+ .nativeEnum(Permissions);
74
+
75
+ /** @internal */
76
+ export const Permissions$outboundSchema: z.ZodNativeEnum<typeof Permissions> =
77
+ Permissions$inboundSchema;
78
+
79
+ /**
80
+ * @internal
81
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
82
+ */
83
+ export namespace Permissions$ {
84
+ /** @deprecated use `Permissions$inboundSchema` instead. */
85
+ export const inboundSchema = Permissions$inboundSchema;
86
+ /** @deprecated use `Permissions$outboundSchema` instead. */
87
+ export const outboundSchema = Permissions$outboundSchema;
88
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { permissionsList } from "../funcs/permissionsList.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as components from "../models/components/index.js";
8
+ import { unwrapAsync } from "../types/fp.js";
9
+
10
+ export class Permissions extends ClientSDK {
11
+ /**
12
+ * List Permissions
13
+ *
14
+ * @remarks
15
+ * Get all available permissions in the system.
16
+ */
17
+ async list(
18
+ options?: RequestOptions,
19
+ ): Promise<Array<components.PermissionResponse>> {
20
+ return unwrapAsync(permissionsList(
21
+ this,
22
+ options,
23
+ ));
24
+ }
25
+ }
package/src/sdk/sdk.ts CHANGED
@@ -14,6 +14,7 @@ import { Incidents } from "./incidents.js";
14
14
  import { Insights } from "./insights.js";
15
15
  import { LanguageGroups } from "./languagegroups.js";
16
16
  import { Outbound } from "./outbound.js";
17
+ import { Permissions } from "./permissions.js";
17
18
  import { Prompts } from "./prompts.js";
18
19
  import { Services } from "./services.js";
19
20
  import { SessionDebug } from "./sessiondebug.js";
@@ -65,6 +66,11 @@ export class SyllableSDK extends ClientSDK {
65
66
  return (this._customMessages ??= new CustomMessages(this._options));
66
67
  }
67
68
 
69
+ private _permissions?: Permissions;
70
+ get permissions(): Permissions {
71
+ return (this._permissions ??= new Permissions(this._options));
72
+ }
73
+
68
74
  private _prompts?: Prompts;
69
75
  get prompts(): Prompts {
70
76
  return (this._prompts ??= new Prompts(this._options));
@@ -43,7 +43,7 @@ export class Takeouts extends ClientSDK {
43
43
  async takeoutsGetFile(
44
44
  request: operations.TakeoutsGetFileRequest,
45
45
  options?: RequestOptions,
46
- ): Promise<any> {
46
+ ): Promise<string> {
47
47
  return unwrapAsync(takeoutsTakeoutsGetFile(
48
48
  this,
49
49
  request,