syllable-sdk 0.1.0-alpha.46 → 0.1.0-alpha.48

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 (202) hide show
  1. package/README.md +34 -0
  2. package/docs/sdks/insights/README.md +6 -0
  3. package/docs/sdks/summary/README.md +85 -0
  4. package/docs/sdks/syllablesdktools/README.md +411 -0
  5. package/docs/sdks/workflows/README.md +429 -0
  6. package/funcs/insightsToolsCreate.d.ts +16 -0
  7. package/funcs/insightsToolsCreate.d.ts.map +1 -0
  8. package/funcs/insightsToolsCreate.js +102 -0
  9. package/funcs/insightsToolsCreate.js.map +1 -0
  10. package/funcs/insightsToolsGetById.d.ts +17 -0
  11. package/funcs/insightsToolsGetById.d.ts.map +1 -0
  12. package/funcs/insightsToolsGetById.js +108 -0
  13. package/funcs/insightsToolsGetById.js.map +1 -0
  14. package/funcs/insightsToolsInsightToolGetDefinitions.d.ts +15 -0
  15. package/funcs/insightsToolsInsightToolGetDefinitions.d.ts.map +1 -0
  16. package/funcs/insightsToolsInsightToolGetDefinitions.js +89 -0
  17. package/funcs/insightsToolsInsightToolGetDefinitions.js.map +1 -0
  18. package/funcs/insightsToolsList.d.ts +17 -0
  19. package/funcs/insightsToolsList.d.ts.map +1 -0
  20. package/funcs/insightsToolsList.js +114 -0
  21. package/funcs/insightsToolsList.js.map +1 -0
  22. package/funcs/insightsToolsUpdate.d.ts +17 -0
  23. package/funcs/insightsToolsUpdate.d.ts.map +1 -0
  24. package/funcs/insightsToolsUpdate.js +109 -0
  25. package/funcs/insightsToolsUpdate.js.map +1 -0
  26. package/funcs/insightsWorkflowsCreate.d.ts +16 -0
  27. package/funcs/insightsWorkflowsCreate.d.ts.map +1 -0
  28. package/funcs/insightsWorkflowsCreate.js +102 -0
  29. package/funcs/insightsWorkflowsCreate.js.map +1 -0
  30. package/funcs/insightsWorkflowsDelete.d.ts +16 -0
  31. package/funcs/insightsWorkflowsDelete.d.ts.map +1 -0
  32. package/funcs/insightsWorkflowsDelete.js +108 -0
  33. package/funcs/insightsWorkflowsDelete.js.map +1 -0
  34. package/funcs/insightsWorkflowsGetById.d.ts +17 -0
  35. package/funcs/insightsWorkflowsGetById.d.ts.map +1 -0
  36. package/funcs/insightsWorkflowsGetById.js +108 -0
  37. package/funcs/insightsWorkflowsGetById.js.map +1 -0
  38. package/funcs/insightsWorkflowsList.d.ts +17 -0
  39. package/funcs/insightsWorkflowsList.d.ts.map +1 -0
  40. package/funcs/insightsWorkflowsList.js +114 -0
  41. package/funcs/insightsWorkflowsList.js.map +1 -0
  42. package/funcs/insightsWorkflowsUpdate.d.ts +17 -0
  43. package/funcs/insightsWorkflowsUpdate.d.ts.map +1 -0
  44. package/funcs/insightsWorkflowsUpdate.js +111 -0
  45. package/funcs/insightsWorkflowsUpdate.js.map +1 -0
  46. package/funcs/sessionsSummaryGetById.d.ts +13 -0
  47. package/funcs/sessionsSummaryGetById.d.ts.map +1 -0
  48. package/funcs/sessionsSummaryGetById.js +105 -0
  49. package/funcs/sessionsSummaryGetById.js.map +1 -0
  50. package/jsr.json +1 -1
  51. package/lib/config.d.ts +2 -2
  52. package/lib/config.js +2 -2
  53. package/mintlify/mint.json +4 -2
  54. package/models/components/index.d.ts +9 -0
  55. package/models/components/index.d.ts.map +1 -1
  56. package/models/components/index.js +9 -0
  57. package/models/components/index.js.map +1 -1
  58. package/models/components/insighttooldefinition.d.ts +105 -0
  59. package/models/components/insighttooldefinition.d.ts.map +1 -0
  60. package/models/components/insighttooldefinition.js +126 -0
  61. package/models/components/insighttooldefinition.js.map +1 -0
  62. package/models/components/insighttoolinput.d.ts +76 -0
  63. package/models/components/insighttoolinput.d.ts.map +1 -0
  64. package/models/components/insighttoolinput.js +101 -0
  65. package/models/components/insighttoolinput.js.map +1 -0
  66. package/models/components/insighttooloutput.d.ts +102 -0
  67. package/models/components/insighttooloutput.d.ts.map +1 -0
  68. package/models/components/insighttooloutput.js +124 -0
  69. package/models/components/insighttooloutput.js.map +1 -0
  70. package/models/components/insighttoolproperties.d.ts +40 -0
  71. package/models/components/insighttoolproperties.d.ts.map +1 -0
  72. package/models/components/insighttoolproperties.js +54 -0
  73. package/models/components/insighttoolproperties.js.map +1 -0
  74. package/models/components/insightworkflowinput.d.ts +76 -0
  75. package/models/components/insightworkflowinput.d.ts.map +1 -0
  76. package/models/components/insightworkflowinput.js +99 -0
  77. package/models/components/insightworkflowinput.js.map +1 -0
  78. package/models/components/insightworkflowoutput.d.ts +102 -0
  79. package/models/components/insightworkflowoutput.d.ts.map +1 -0
  80. package/models/components/insightworkflowoutput.js +120 -0
  81. package/models/components/insightworkflowoutput.js.map +1 -0
  82. package/models/components/insightworkflowproperties.d.ts +43 -0
  83. package/models/components/insightworkflowproperties.d.ts.map +1 -0
  84. package/models/components/insightworkflowproperties.js +55 -0
  85. package/models/components/insightworkflowproperties.js.map +1 -0
  86. package/models/components/listresponseinsighttooloutput.d.ts +38 -0
  87. package/models/components/listresponseinsighttooloutput.d.ts.map +1 -0
  88. package/models/components/listresponseinsighttooloutput.js +81 -0
  89. package/models/components/listresponseinsighttooloutput.js.map +1 -0
  90. package/models/components/listresponseinsightworkflowoutput.d.ts +38 -0
  91. package/models/components/listresponseinsightworkflowoutput.d.ts.map +1 -0
  92. package/models/components/listresponseinsightworkflowoutput.js +81 -0
  93. package/models/components/listresponseinsightworkflowoutput.js.map +1 -0
  94. package/models/components/promptcreaterequest.d.ts +5 -0
  95. package/models/components/promptcreaterequest.d.ts.map +1 -1
  96. package/models/components/promptcreaterequest.js +4 -0
  97. package/models/components/promptcreaterequest.js.map +1 -1
  98. package/models/components/promptupdaterequest.d.ts +5 -0
  99. package/models/components/promptupdaterequest.d.ts.map +1 -1
  100. package/models/components/promptupdaterequest.js +4 -0
  101. package/models/components/promptupdaterequest.js.map +1 -1
  102. package/models/operations/directoryworkflowdelete.d.ts +29 -0
  103. package/models/operations/directoryworkflowdelete.d.ts.map +1 -0
  104. package/models/operations/directoryworkflowdelete.js +68 -0
  105. package/models/operations/directoryworkflowdelete.js.map +1 -0
  106. package/models/operations/index.d.ts +8 -0
  107. package/models/operations/index.d.ts.map +1 -1
  108. package/models/operations/index.js +8 -0
  109. package/models/operations/index.js.map +1 -1
  110. package/models/operations/insightstoolupdate.d.ts +32 -0
  111. package/models/operations/insightstoolupdate.d.ts.map +1 -0
  112. package/models/operations/insightstoolupdate.js +73 -0
  113. package/models/operations/insightstoolupdate.js.map +1 -0
  114. package/models/operations/insightsworkflowgetbyid.d.ts +29 -0
  115. package/models/operations/insightsworkflowgetbyid.d.ts.map +1 -0
  116. package/models/operations/insightsworkflowgetbyid.js +68 -0
  117. package/models/operations/insightsworkflowgetbyid.js.map +1 -0
  118. package/models/operations/insightsworkflowlist.d.ts +46 -0
  119. package/models/operations/insightsworkflowlist.d.ts.map +1 -0
  120. package/models/operations/insightsworkflowlist.js +101 -0
  121. package/models/operations/insightsworkflowlist.js.map +1 -0
  122. package/models/operations/insightsworkflowupdate.d.ts +32 -0
  123. package/models/operations/insightsworkflowupdate.d.ts.map +1 -0
  124. package/models/operations/insightsworkflowupdate.js +73 -0
  125. package/models/operations/insightsworkflowupdate.js.map +1 -0
  126. package/models/operations/insighttoolgetbyid.d.ts +29 -0
  127. package/models/operations/insighttoolgetbyid.d.ts.map +1 -0
  128. package/models/operations/insighttoolgetbyid.js +68 -0
  129. package/models/operations/insighttoolgetbyid.js.map +1 -0
  130. package/models/operations/insighttoollist.d.ts +46 -0
  131. package/models/operations/insighttoollist.d.ts.map +1 -0
  132. package/models/operations/insighttoollist.js +103 -0
  133. package/models/operations/insighttoollist.js.map +1 -0
  134. package/models/operations/sessionsummarygetbyid.d.ts +29 -0
  135. package/models/operations/sessionsummarygetbyid.d.ts.map +1 -0
  136. package/models/operations/sessionsummarygetbyid.js +68 -0
  137. package/models/operations/sessionsummarygetbyid.js.map +1 -0
  138. package/openapi.json +1267 -35
  139. package/package.json +1 -1
  140. package/sdk/insights.d.ts +10 -0
  141. package/sdk/insights.d.ts.map +1 -0
  142. package/sdk/insights.js +19 -0
  143. package/sdk/insights.js.map +1 -0
  144. package/sdk/sdk.d.ts +3 -0
  145. package/sdk/sdk.d.ts.map +1 -1
  146. package/sdk/sdk.js +4 -0
  147. package/sdk/sdk.js.map +1 -1
  148. package/sdk/sessions.d.ts +3 -0
  149. package/sdk/sessions.d.ts.map +1 -1
  150. package/sdk/sessions.js +4 -0
  151. package/sdk/sessions.js.map +1 -1
  152. package/sdk/summary.d.ts +9 -0
  153. package/sdk/summary.d.ts.map +1 -0
  154. package/sdk/summary.js +19 -0
  155. package/sdk/summary.js.map +1 -0
  156. package/sdk/syllablesdktools.d.ts +41 -0
  157. package/sdk/syllablesdktools.d.ts.map +1 -0
  158. package/sdk/syllablesdktools.js +62 -0
  159. package/sdk/syllablesdktools.js.map +1 -0
  160. package/sdk/workflows.d.ts +41 -0
  161. package/sdk/workflows.d.ts.map +1 -0
  162. package/sdk/workflows.js +62 -0
  163. package/sdk/workflows.js.map +1 -0
  164. package/src/funcs/insightsToolsCreate.ts +135 -0
  165. package/src/funcs/insightsToolsGetById.ts +142 -0
  166. package/src/funcs/insightsToolsInsightToolGetDefinitions.ts +112 -0
  167. package/src/funcs/insightsToolsList.ts +148 -0
  168. package/src/funcs/insightsToolsUpdate.ts +143 -0
  169. package/src/funcs/insightsWorkflowsCreate.ts +135 -0
  170. package/src/funcs/insightsWorkflowsDelete.ts +145 -0
  171. package/src/funcs/insightsWorkflowsGetById.ts +145 -0
  172. package/src/funcs/insightsWorkflowsList.ts +149 -0
  173. package/src/funcs/insightsWorkflowsUpdate.ts +148 -0
  174. package/src/funcs/sessionsSummaryGetById.ts +140 -0
  175. package/src/lib/config.ts +2 -2
  176. package/src/models/components/index.ts +9 -0
  177. package/src/models/components/insighttooldefinition.ts +213 -0
  178. package/src/models/components/insighttoolinput.ts +163 -0
  179. package/src/models/components/insighttooloutput.ts +210 -0
  180. package/src/models/components/insighttoolproperties.ts +37 -0
  181. package/src/models/components/insightworkflowinput.ts +161 -0
  182. package/src/models/components/insightworkflowoutput.ts +206 -0
  183. package/src/models/components/insightworkflowproperties.ts +40 -0
  184. package/src/models/components/listresponseinsighttooloutput.ts +103 -0
  185. package/src/models/components/listresponseinsightworkflowoutput.ts +104 -0
  186. package/src/models/components/promptcreaterequest.ts +9 -0
  187. package/src/models/components/promptupdaterequest.ts +9 -0
  188. package/src/models/operations/directoryworkflowdelete.ts +77 -0
  189. package/src/models/operations/index.ts +8 -0
  190. package/src/models/operations/insightstoolupdate.ts +82 -0
  191. package/src/models/operations/insightsworkflowgetbyid.ts +77 -0
  192. package/src/models/operations/insightsworkflowlist.ts +130 -0
  193. package/src/models/operations/insightsworkflowupdate.ts +84 -0
  194. package/src/models/operations/insighttoolgetbyid.ts +75 -0
  195. package/src/models/operations/insighttoollist.ts +126 -0
  196. package/src/models/operations/sessionsummarygetbyid.ts +77 -0
  197. package/src/sdk/insights.ts +19 -0
  198. package/src/sdk/sdk.ts +6 -0
  199. package/src/sdk/sessions.ts +6 -0
  200. package/src/sdk/summary.ts +24 -0
  201. package/src/sdk/syllablesdktools.ts +98 -0
  202. package/src/sdk/workflows.ts +100 -0
@@ -0,0 +1,145 @@
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 { encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Delete Insights Workflow
29
+ *
30
+ * @remarks
31
+ * Delete a Insights workflow.
32
+ */
33
+ export async function insightsWorkflowsDelete(
34
+ client: SyllableSDKCore,
35
+ request: operations.DirectoryWorkflowDeleteRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ any,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.DirectoryWorkflowDeleteRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = null;
61
+
62
+ const pathParams = {
63
+ workflow_id: encodeSimple("workflow_id", payload.workflow_id, {
64
+ explode: false,
65
+ charEncoding: "percent",
66
+ }),
67
+ };
68
+
69
+ const path = pathToFunc("/api/v1/insights/workflows/{workflow_id}")(
70
+ pathParams,
71
+ );
72
+
73
+ const headers = new Headers(compactMap({
74
+ Accept: "application/json",
75
+ }));
76
+
77
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
78
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
79
+ const requestSecurity = resolveGlobalSecurity(securityInput);
80
+
81
+ const context = {
82
+ baseURL: options?.serverURL ?? "",
83
+ operationID: "directory_workflow_delete",
84
+ oAuth2Scopes: [],
85
+
86
+ resolvedSecurity: requestSecurity,
87
+
88
+ securitySource: client._options.apiKeyHeader,
89
+ retryConfig: options?.retries
90
+ || client._options.retryConfig
91
+ || { strategy: "none" },
92
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
93
+ };
94
+
95
+ const requestRes = client._createRequest(context, {
96
+ security: requestSecurity,
97
+ method: "DELETE",
98
+ baseURL: options?.serverURL,
99
+ path: path,
100
+ headers: headers,
101
+ body: body,
102
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
103
+ }, options);
104
+ if (!requestRes.ok) {
105
+ return requestRes;
106
+ }
107
+ const req = requestRes.value;
108
+
109
+ const doResult = await client._do(req, {
110
+ context,
111
+ errorCodes: ["400", "404", "422", "4XX", "500", "5XX"],
112
+ retryConfig: context.retryConfig,
113
+ retryCodes: context.retryCodes,
114
+ });
115
+ if (!doResult.ok) {
116
+ return doResult;
117
+ }
118
+ const response = doResult.value;
119
+
120
+ const responseFields = {
121
+ HttpMeta: { Response: response, Request: req },
122
+ };
123
+
124
+ const [result] = await M.match<
125
+ any,
126
+ | errors.HTTPValidationError
127
+ | SDKError
128
+ | SDKValidationError
129
+ | UnexpectedClientError
130
+ | InvalidRequestError
131
+ | RequestAbortedError
132
+ | RequestTimeoutError
133
+ | ConnectionError
134
+ >(
135
+ M.json(200, z.any()),
136
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
137
+ M.fail([400, 404, "4XX"]),
138
+ M.fail([500, "5XX"]),
139
+ )(response, { extraFields: responseFields });
140
+ if (!result.ok) {
141
+ return result;
142
+ }
143
+
144
+ return result;
145
+ }
@@ -0,0 +1,145 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeSimple } 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 {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Get Insight Workflow By Id
29
+ *
30
+ * @remarks
31
+ * Get a InsightWorkflow by ID.
32
+ */
33
+ export async function insightsWorkflowsGetById(
34
+ client: SyllableSDKCore,
35
+ request: operations.InsightsWorkflowGetByIdRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.InsightWorkflowOutput,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.InsightsWorkflowGetByIdRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = null;
61
+
62
+ const pathParams = {
63
+ workflow_id: encodeSimple("workflow_id", payload.workflow_id, {
64
+ explode: false,
65
+ charEncoding: "percent",
66
+ }),
67
+ };
68
+
69
+ const path = pathToFunc("/api/v1/insights/workflows/{workflow_id}")(
70
+ pathParams,
71
+ );
72
+
73
+ const headers = new Headers(compactMap({
74
+ Accept: "application/json",
75
+ }));
76
+
77
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
78
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
79
+ const requestSecurity = resolveGlobalSecurity(securityInput);
80
+
81
+ const context = {
82
+ baseURL: options?.serverURL ?? "",
83
+ operationID: "insights_workflow_get_by_id",
84
+ oAuth2Scopes: [],
85
+
86
+ resolvedSecurity: requestSecurity,
87
+
88
+ securitySource: client._options.apiKeyHeader,
89
+ retryConfig: options?.retries
90
+ || client._options.retryConfig
91
+ || { strategy: "none" },
92
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
93
+ };
94
+
95
+ const requestRes = client._createRequest(context, {
96
+ security: requestSecurity,
97
+ method: "GET",
98
+ baseURL: options?.serverURL,
99
+ path: path,
100
+ headers: headers,
101
+ body: body,
102
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
103
+ }, options);
104
+ if (!requestRes.ok) {
105
+ return requestRes;
106
+ }
107
+ const req = requestRes.value;
108
+
109
+ const doResult = await client._do(req, {
110
+ context,
111
+ errorCodes: ["422", "4XX", "5XX"],
112
+ retryConfig: context.retryConfig,
113
+ retryCodes: context.retryCodes,
114
+ });
115
+ if (!doResult.ok) {
116
+ return doResult;
117
+ }
118
+ const response = doResult.value;
119
+
120
+ const responseFields = {
121
+ HttpMeta: { Response: response, Request: req },
122
+ };
123
+
124
+ const [result] = await M.match<
125
+ components.InsightWorkflowOutput,
126
+ | errors.HTTPValidationError
127
+ | SDKError
128
+ | SDKValidationError
129
+ | UnexpectedClientError
130
+ | InvalidRequestError
131
+ | RequestAbortedError
132
+ | RequestTimeoutError
133
+ | ConnectionError
134
+ >(
135
+ M.json(200, components.InsightWorkflowOutput$inboundSchema),
136
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
137
+ M.fail("4XX"),
138
+ M.fail("5XX"),
139
+ )(response, { extraFields: responseFields });
140
+ if (!result.ok) {
141
+ return result;
142
+ }
143
+
144
+ return result;
145
+ }
@@ -0,0 +1,149 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } 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 {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Insight Workflow List
29
+ *
30
+ * @remarks
31
+ * List the existing insight_workflows
32
+ */
33
+ export async function insightsWorkflowsList(
34
+ client: SyllableSDKCore,
35
+ request: operations.InsightsWorkflowListRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.ListResponseInsightWorkflowOutput,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.InsightsWorkflowListRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = null;
61
+
62
+ const path = pathToFunc("/api/v1/insights/workflows/")();
63
+
64
+ const query = encodeFormQuery({
65
+ "end_datetime": payload.end_datetime,
66
+ "fields": payload.fields,
67
+ "limit": payload.limit,
68
+ "order_by": payload.order_by,
69
+ "order_by_direction": payload.order_by_direction,
70
+ "page": payload.page,
71
+ "search_field_values": payload.search_field_values,
72
+ "search_fields": payload.search_fields,
73
+ "start_datetime": payload.start_datetime,
74
+ });
75
+
76
+ const headers = new Headers(compactMap({
77
+ Accept: "application/json",
78
+ }));
79
+
80
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
81
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
82
+ const requestSecurity = resolveGlobalSecurity(securityInput);
83
+
84
+ const context = {
85
+ baseURL: options?.serverURL ?? "",
86
+ operationID: "insights_workflow_list",
87
+ oAuth2Scopes: [],
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyHeader,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "GET",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ query: query,
105
+ body: body,
106
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
107
+ }, options);
108
+ if (!requestRes.ok) {
109
+ return requestRes;
110
+ }
111
+ const req = requestRes.value;
112
+
113
+ const doResult = await client._do(req, {
114
+ context,
115
+ errorCodes: ["422", "4XX", "5XX"],
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return doResult;
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const responseFields = {
125
+ HttpMeta: { Response: response, Request: req },
126
+ };
127
+
128
+ const [result] = await M.match<
129
+ components.ListResponseInsightWorkflowOutput,
130
+ | errors.HTTPValidationError
131
+ | SDKError
132
+ | SDKValidationError
133
+ | UnexpectedClientError
134
+ | InvalidRequestError
135
+ | RequestAbortedError
136
+ | RequestTimeoutError
137
+ | ConnectionError
138
+ >(
139
+ M.json(200, components.ListResponseInsightWorkflowOutput$inboundSchema),
140
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
141
+ M.fail("4XX"),
142
+ M.fail("5XX"),
143
+ )(response, { extraFields: responseFields });
144
+ if (!result.ok) {
145
+ return result;
146
+ }
147
+
148
+ return result;
149
+ }
@@ -0,0 +1,148 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } 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 {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Update Insights Workflow
29
+ *
30
+ * @remarks
31
+ * Update a InsightWorkflow.
32
+ */
33
+ export async function insightsWorkflowsUpdate(
34
+ client: SyllableSDKCore,
35
+ request: operations.InsightsWorkflowUpdateRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.InsightWorkflowOutput,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.InsightsWorkflowUpdateRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = encodeJSON("body", payload.InsightWorkflowInput, {
61
+ explode: true,
62
+ });
63
+
64
+ const pathParams = {
65
+ workflow_id: encodeSimple("workflow_id", payload.workflow_id, {
66
+ explode: false,
67
+ charEncoding: "percent",
68
+ }),
69
+ };
70
+
71
+ const path = pathToFunc("/api/v1/insights/workflows/{workflow_id}")(
72
+ pathParams,
73
+ );
74
+
75
+ const headers = new Headers(compactMap({
76
+ "Content-Type": "application/json",
77
+ Accept: "application/json",
78
+ }));
79
+
80
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
81
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
82
+ const requestSecurity = resolveGlobalSecurity(securityInput);
83
+
84
+ const context = {
85
+ baseURL: options?.serverURL ?? "",
86
+ operationID: "insights_workflow_update",
87
+ oAuth2Scopes: [],
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyHeader,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "PUT",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ body: body,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return requestRes;
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ errorCodes: ["400", "404", "412", "422", "4XX", "500", "5XX"],
115
+ retryConfig: context.retryConfig,
116
+ retryCodes: context.retryCodes,
117
+ });
118
+ if (!doResult.ok) {
119
+ return doResult;
120
+ }
121
+ const response = doResult.value;
122
+
123
+ const responseFields = {
124
+ HttpMeta: { Response: response, Request: req },
125
+ };
126
+
127
+ const [result] = await M.match<
128
+ components.InsightWorkflowOutput,
129
+ | errors.HTTPValidationError
130
+ | SDKError
131
+ | SDKValidationError
132
+ | UnexpectedClientError
133
+ | InvalidRequestError
134
+ | RequestAbortedError
135
+ | RequestTimeoutError
136
+ | ConnectionError
137
+ >(
138
+ M.json(200, components.InsightWorkflowOutput$inboundSchema),
139
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
140
+ M.fail([400, 404, 412, "4XX"]),
141
+ M.fail([500, "5XX"]),
142
+ )(response, { extraFields: responseFields });
143
+ if (!result.ok) {
144
+ return result;
145
+ }
146
+
147
+ return result;
148
+ }