syllable-sdk 0.1.0-alpha.169 → 0.1.0-alpha.174

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 (199) hide show
  1. package/README.md +24 -0
  2. package/docs/sdks/batches/README.md +4 -4
  3. package/docs/sdks/campaigns/README.md +18 -2
  4. package/docs/sdks/languagegroups/README.md +4 -4
  5. package/docs/sdks/numbers/README.md +164 -0
  6. package/docs/sdks/users/README.md +424 -1
  7. package/docs/sdks/v1/README.md +424 -1
  8. package/docs/sdks/workflows/README.md +8 -8
  9. package/funcs/channelsTwilioNumbersList.d.ts +17 -0
  10. package/funcs/channelsTwilioNumbersList.d.ts.map +1 -0
  11. package/funcs/channelsTwilioNumbersList.js +108 -0
  12. package/funcs/channelsTwilioNumbersList.js.map +1 -0
  13. package/funcs/channelsTwilioNumbersUpdate.d.ts +17 -0
  14. package/funcs/channelsTwilioNumbersUpdate.d.ts.map +1 -0
  15. package/funcs/channelsTwilioNumbersUpdate.js +111 -0
  16. package/funcs/channelsTwilioNumbersUpdate.js.map +1 -0
  17. package/funcs/usersCreate.d.ts +16 -0
  18. package/funcs/usersCreate.d.ts.map +1 -0
  19. package/funcs/usersCreate.js +102 -0
  20. package/funcs/usersCreate.js.map +1 -0
  21. package/funcs/usersDelete.d.ts +16 -0
  22. package/funcs/usersDelete.d.ts.map +1 -0
  23. package/funcs/usersDelete.js +103 -0
  24. package/funcs/usersDelete.js.map +1 -0
  25. package/funcs/usersList.d.ts +17 -0
  26. package/funcs/usersList.d.ts.map +1 -0
  27. package/funcs/usersList.js +114 -0
  28. package/funcs/usersList.js.map +1 -0
  29. package/funcs/usersUpdate.d.ts +16 -0
  30. package/funcs/usersUpdate.d.ts.map +1 -0
  31. package/funcs/usersUpdate.js +102 -0
  32. package/funcs/usersUpdate.js.map +1 -0
  33. package/funcs/usersUsersDeleteAccount.d.ts +4 -0
  34. package/funcs/usersUsersDeleteAccount.d.ts.map +1 -1
  35. package/funcs/usersUsersDeleteAccount.js +4 -0
  36. package/funcs/usersUsersDeleteAccount.js.map +1 -1
  37. package/funcs/usersUsersGetByEmail.d.ts +17 -0
  38. package/funcs/usersUsersGetByEmail.d.ts.map +1 -0
  39. package/funcs/usersUsersGetByEmail.js +108 -0
  40. package/funcs/usersUsersGetByEmail.js.map +1 -0
  41. package/funcs/v1Create.d.ts +16 -0
  42. package/funcs/v1Create.d.ts.map +1 -0
  43. package/funcs/v1Create.js +102 -0
  44. package/funcs/v1Create.js.map +1 -0
  45. package/funcs/v1Delete.d.ts +16 -0
  46. package/funcs/v1Delete.d.ts.map +1 -0
  47. package/funcs/v1Delete.js +103 -0
  48. package/funcs/v1Delete.js.map +1 -0
  49. package/funcs/v1List.d.ts +17 -0
  50. package/funcs/v1List.d.ts.map +1 -0
  51. package/funcs/v1List.js +114 -0
  52. package/funcs/v1List.js.map +1 -0
  53. package/funcs/v1Update.d.ts +16 -0
  54. package/funcs/v1Update.d.ts.map +1 -0
  55. package/funcs/v1Update.js +102 -0
  56. package/funcs/v1Update.js.map +1 -0
  57. package/funcs/v1UsersDeleteAccount.d.ts +4 -0
  58. package/funcs/v1UsersDeleteAccount.d.ts.map +1 -1
  59. package/funcs/v1UsersDeleteAccount.js +4 -0
  60. package/funcs/v1UsersDeleteAccount.js.map +1 -1
  61. package/funcs/v1UsersGetByEmail.d.ts +17 -0
  62. package/funcs/v1UsersGetByEmail.d.ts.map +1 -0
  63. package/funcs/v1UsersGetByEmail.js +108 -0
  64. package/funcs/v1UsersGetByEmail.js.map +1 -0
  65. package/jsr.json +1 -1
  66. package/lib/config.d.ts +2 -2
  67. package/lib/config.js +2 -2
  68. package/models/components/campaignproperties.d.ts +3 -0
  69. package/models/components/campaignproperties.d.ts.map +1 -1
  70. package/models/components/campaignproperties.js +1 -0
  71. package/models/components/campaignproperties.js.map +1 -1
  72. package/models/components/index.d.ts +10 -0
  73. package/models/components/index.d.ts.map +1 -1
  74. package/models/components/index.js +10 -0
  75. package/models/components/index.js.map +1 -1
  76. package/models/components/languagecode.d.ts +6 -0
  77. package/models/components/languagecode.d.ts.map +1 -1
  78. package/models/components/languagecode.js +2 -0
  79. package/models/components/languagecode.js.map +1 -1
  80. package/models/components/listresponseuserresponse.d.ts +53 -0
  81. package/models/components/listresponseuserresponse.d.ts.map +1 -0
  82. package/models/components/listresponseuserresponse.js +81 -0
  83. package/models/components/listresponseuserresponse.js.map +1 -0
  84. package/models/components/outboundcampaign.d.ts +8 -1
  85. package/models/components/outboundcampaign.d.ts.map +1 -1
  86. package/models/components/outboundcampaign.js +2 -0
  87. package/models/components/outboundcampaign.js.map +1 -1
  88. package/models/components/outboundcampaigninput.d.ts +8 -1
  89. package/models/components/outboundcampaigninput.d.ts.map +1 -1
  90. package/models/components/outboundcampaigninput.js +2 -0
  91. package/models/components/outboundcampaigninput.js.map +1 -1
  92. package/models/components/twiliolistnumbersresponse.d.ts +36 -0
  93. package/models/components/twiliolistnumbersresponse.d.ts.map +1 -0
  94. package/models/components/twiliolistnumbersresponse.js +69 -0
  95. package/models/components/twiliolistnumbersresponse.js.map +1 -0
  96. package/models/components/twilionumberupdaterequest.d.ts +40 -0
  97. package/models/components/twilionumberupdaterequest.d.ts.map +1 -0
  98. package/models/components/twilionumberupdaterequest.js +72 -0
  99. package/models/components/twilionumberupdaterequest.js.map +1 -0
  100. package/models/components/twilionumberupdateresponse.d.ts +35 -0
  101. package/models/components/twilionumberupdateresponse.d.ts.map +1 -0
  102. package/models/components/twilionumberupdateresponse.js +68 -0
  103. package/models/components/twilionumberupdateresponse.js.map +1 -0
  104. package/models/components/twiliophonenumber.d.ts +47 -0
  105. package/models/components/twiliophonenumber.d.ts.map +1 -0
  106. package/models/components/twiliophonenumber.js +78 -0
  107. package/models/components/twiliophonenumber.js.map +1 -0
  108. package/models/components/usercreaterequest.d.ts +50 -0
  109. package/models/components/usercreaterequest.d.ts.map +1 -0
  110. package/models/components/usercreaterequest.js +78 -0
  111. package/models/components/usercreaterequest.js.map +1 -0
  112. package/models/components/userdeleterequest.d.ts +40 -0
  113. package/models/components/userdeleterequest.d.ts.map +1 -0
  114. package/models/components/userdeleterequest.js +61 -0
  115. package/models/components/userdeleterequest.js.map +1 -0
  116. package/models/components/userproperties.d.ts +40 -0
  117. package/models/components/userproperties.d.ts.map +1 -0
  118. package/models/components/userproperties.js +55 -0
  119. package/models/components/userproperties.js.map +1 -0
  120. package/models/components/userresponse.d.ts +75 -0
  121. package/models/components/userresponse.d.ts.map +1 -0
  122. package/models/components/userresponse.js +97 -0
  123. package/models/components/userresponse.js.map +1 -0
  124. package/models/components/userupdaterequest.d.ts +55 -0
  125. package/models/components/userupdaterequest.d.ts.map +1 -0
  126. package/models/components/userupdaterequest.js +82 -0
  127. package/models/components/userupdaterequest.js.map +1 -0
  128. package/models/operations/channelstwilionumberslist.d.ts +29 -0
  129. package/models/operations/channelstwilionumberslist.d.ts.map +1 -0
  130. package/models/operations/channelstwilionumberslist.js +68 -0
  131. package/models/operations/channelstwilionumberslist.js.map +1 -0
  132. package/models/operations/channelstwilionumbersupdate.d.ts +32 -0
  133. package/models/operations/channelstwilionumbersupdate.d.ts.map +1 -0
  134. package/models/operations/channelstwilionumbersupdate.js +73 -0
  135. package/models/operations/channelstwilionumbersupdate.js.map +1 -0
  136. package/models/operations/index.d.ts +4 -0
  137. package/models/operations/index.d.ts.map +1 -1
  138. package/models/operations/index.js +4 -0
  139. package/models/operations/index.js.map +1 -1
  140. package/models/operations/usersgetbyemail.d.ts +29 -0
  141. package/models/operations/usersgetbyemail.d.ts.map +1 -0
  142. package/models/operations/usersgetbyemail.js +68 -0
  143. package/models/operations/usersgetbyemail.js.map +1 -0
  144. package/models/operations/userslist.d.ts +73 -0
  145. package/models/operations/userslist.d.ts.map +1 -0
  146. package/models/operations/userslist.js +99 -0
  147. package/models/operations/userslist.js.map +1 -0
  148. package/openapi.json +1353 -343
  149. package/package.json +1 -1
  150. package/sdk/numbers.d.ts +14 -0
  151. package/sdk/numbers.d.ts.map +1 -1
  152. package/sdk/numbers.js +20 -0
  153. package/sdk/numbers.js.map +1 -1
  154. package/sdk/users.d.ts +41 -0
  155. package/sdk/users.d.ts.map +1 -1
  156. package/sdk/users.js +54 -0
  157. package/sdk/users.js.map +1 -1
  158. package/sdk/v1.d.ts +41 -0
  159. package/sdk/v1.d.ts.map +1 -1
  160. package/sdk/v1.js +54 -0
  161. package/sdk/v1.js.map +1 -1
  162. package/src/funcs/channelsTwilioNumbersList.ts +145 -0
  163. package/src/funcs/channelsTwilioNumbersUpdate.ts +148 -0
  164. package/src/funcs/usersCreate.ts +135 -0
  165. package/src/funcs/usersDelete.ts +136 -0
  166. package/src/funcs/usersList.ts +148 -0
  167. package/src/funcs/usersUpdate.ts +135 -0
  168. package/src/funcs/usersUsersDeleteAccount.ts +4 -0
  169. package/src/funcs/usersUsersGetByEmail.ts +142 -0
  170. package/src/funcs/v1Create.ts +135 -0
  171. package/src/funcs/v1Delete.ts +136 -0
  172. package/src/funcs/v1List.ts +148 -0
  173. package/src/funcs/v1Update.ts +135 -0
  174. package/src/funcs/v1UsersDeleteAccount.ts +4 -0
  175. package/src/funcs/v1UsersGetByEmail.ts +142 -0
  176. package/src/lib/config.ts +2 -2
  177. package/src/models/components/campaignproperties.ts +1 -0
  178. package/src/models/components/index.ts +10 -0
  179. package/src/models/components/languagecode.ts +2 -0
  180. package/src/models/components/listresponseuserresponse.ts +116 -0
  181. package/src/models/components/outboundcampaign.ts +10 -1
  182. package/src/models/components/outboundcampaigninput.ts +10 -1
  183. package/src/models/components/twiliolistnumbersresponse.ts +87 -0
  184. package/src/models/components/twilionumberupdaterequest.ts +90 -0
  185. package/src/models/components/twilionumberupdateresponse.ts +81 -0
  186. package/src/models/components/twiliophonenumber.ts +103 -0
  187. package/src/models/components/usercreaterequest.ts +106 -0
  188. package/src/models/components/userdeleterequest.ts +79 -0
  189. package/src/models/components/userproperties.ts +41 -0
  190. package/src/models/components/userresponse.ts +150 -0
  191. package/src/models/components/userupdaterequest.ts +115 -0
  192. package/src/models/operations/channelstwilionumberslist.ts +77 -0
  193. package/src/models/operations/channelstwilionumbersupdate.ts +87 -0
  194. package/src/models/operations/index.ts +4 -0
  195. package/src/models/operations/usersgetbyemail.ts +75 -0
  196. package/src/models/operations/userslist.ts +149 -0
  197. package/src/sdk/numbers.ts +36 -0
  198. package/src/sdk/users.ts +96 -0
  199. package/src/sdk/v1.ts +96 -0
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeJSON } 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 { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Create User
28
+ *
29
+ * @remarks
30
+ * Create a new user.
31
+ */
32
+ export async function v1Create(
33
+ client: SyllableSDKCore,
34
+ request: components.UserCreateRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<
37
+ Result<
38
+ components.UserResponse,
39
+ | errors.HTTPValidationError
40
+ | SDKError
41
+ | SDKValidationError
42
+ | UnexpectedClientError
43
+ | InvalidRequestError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | ConnectionError
47
+ >
48
+ > {
49
+ const parsed = safeParse(
50
+ request,
51
+ (value) => components.UserCreateRequest$outboundSchema.parse(value),
52
+ "Input validation failed",
53
+ );
54
+ if (!parsed.ok) {
55
+ return parsed;
56
+ }
57
+ const payload = parsed.value;
58
+ const body = encodeJSON("body", payload, { explode: true });
59
+
60
+ const path = pathToFunc("/api/v1/users/")();
61
+
62
+ const headers = new Headers(compactMap({
63
+ "Content-Type": "application/json",
64
+ Accept: "application/json",
65
+ }));
66
+
67
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
68
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
69
+ const requestSecurity = resolveGlobalSecurity(securityInput);
70
+
71
+ const context = {
72
+ baseURL: options?.serverURL ?? "",
73
+ operationID: "users_create",
74
+ oAuth2Scopes: [],
75
+
76
+ resolvedSecurity: requestSecurity,
77
+
78
+ securitySource: client._options.apiKeyHeader,
79
+ retryConfig: options?.retries
80
+ || client._options.retryConfig
81
+ || { strategy: "none" },
82
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
83
+ };
84
+
85
+ const requestRes = client._createRequest(context, {
86
+ security: requestSecurity,
87
+ method: "POST",
88
+ baseURL: options?.serverURL,
89
+ path: path,
90
+ headers: headers,
91
+ body: body,
92
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
93
+ }, options);
94
+ if (!requestRes.ok) {
95
+ return requestRes;
96
+ }
97
+ const req = requestRes.value;
98
+
99
+ const doResult = await client._do(req, {
100
+ context,
101
+ errorCodes: ["422", "4XX", "5XX"],
102
+ retryConfig: context.retryConfig,
103
+ retryCodes: context.retryCodes,
104
+ });
105
+ if (!doResult.ok) {
106
+ return doResult;
107
+ }
108
+ const response = doResult.value;
109
+
110
+ const responseFields = {
111
+ HttpMeta: { Response: response, Request: req },
112
+ };
113
+
114
+ const [result] = await M.match<
115
+ components.UserResponse,
116
+ | errors.HTTPValidationError
117
+ | SDKError
118
+ | SDKValidationError
119
+ | UnexpectedClientError
120
+ | InvalidRequestError
121
+ | RequestAbortedError
122
+ | RequestTimeoutError
123
+ | ConnectionError
124
+ >(
125
+ M.json(200, components.UserResponse$inboundSchema),
126
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
127
+ M.fail("4XX"),
128
+ M.fail("5XX"),
129
+ )(response, { extraFields: responseFields });
130
+ if (!result.ok) {
131
+ return result;
132
+ }
133
+
134
+ return result;
135
+ }
@@ -0,0 +1,136 @@
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 { encodeJSON } 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 * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { SDKError } from "../models/errors/sdkerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Delete User
29
+ *
30
+ * @remarks
31
+ * Delete a user.
32
+ */
33
+ export async function v1Delete(
34
+ client: SyllableSDKCore,
35
+ request: components.UserDeleteRequest,
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) => components.UserDeleteRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = encodeJSON("body", payload, { explode: true });
60
+
61
+ const path = pathToFunc("/api/v1/users/")();
62
+
63
+ const headers = new Headers(compactMap({
64
+ "Content-Type": "application/json",
65
+ Accept: "application/json",
66
+ }));
67
+
68
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
69
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
70
+ const requestSecurity = resolveGlobalSecurity(securityInput);
71
+
72
+ const context = {
73
+ baseURL: options?.serverURL ?? "",
74
+ operationID: "users_delete",
75
+ oAuth2Scopes: [],
76
+
77
+ resolvedSecurity: requestSecurity,
78
+
79
+ securitySource: client._options.apiKeyHeader,
80
+ retryConfig: options?.retries
81
+ || client._options.retryConfig
82
+ || { strategy: "none" },
83
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
84
+ };
85
+
86
+ const requestRes = client._createRequest(context, {
87
+ security: requestSecurity,
88
+ method: "DELETE",
89
+ baseURL: options?.serverURL,
90
+ path: path,
91
+ headers: headers,
92
+ body: body,
93
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
94
+ }, options);
95
+ if (!requestRes.ok) {
96
+ return requestRes;
97
+ }
98
+ const req = requestRes.value;
99
+
100
+ const doResult = await client._do(req, {
101
+ context,
102
+ errorCodes: ["422", "4XX", "5XX"],
103
+ retryConfig: context.retryConfig,
104
+ retryCodes: context.retryCodes,
105
+ });
106
+ if (!doResult.ok) {
107
+ return doResult;
108
+ }
109
+ const response = doResult.value;
110
+
111
+ const responseFields = {
112
+ HttpMeta: { Response: response, Request: req },
113
+ };
114
+
115
+ const [result] = await M.match<
116
+ any,
117
+ | errors.HTTPValidationError
118
+ | SDKError
119
+ | SDKValidationError
120
+ | UnexpectedClientError
121
+ | InvalidRequestError
122
+ | RequestAbortedError
123
+ | RequestTimeoutError
124
+ | ConnectionError
125
+ >(
126
+ M.json(200, z.any()),
127
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
128
+ M.fail("4XX"),
129
+ M.fail("5XX"),
130
+ )(response, { extraFields: responseFields });
131
+ if (!result.ok) {
132
+ return result;
133
+ }
134
+
135
+ return result;
136
+ }
@@ -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 { 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
+ * List Users
29
+ *
30
+ * @remarks
31
+ * List the existing users.
32
+ */
33
+ export async function v1List(
34
+ client: SyllableSDKCore,
35
+ request: operations.UsersListRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.ListResponseUserResponse,
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) => operations.UsersListRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = null;
60
+
61
+ const path = pathToFunc("/api/v1/users/")();
62
+
63
+ const query = encodeFormQuery({
64
+ "end_datetime": payload.end_datetime,
65
+ "fields": payload.fields,
66
+ "limit": payload.limit,
67
+ "order_by": payload.order_by,
68
+ "order_by_direction": payload.order_by_direction,
69
+ "page": payload.page,
70
+ "search_field_values": payload.search_field_values,
71
+ "search_fields": payload.search_fields,
72
+ "start_datetime": payload.start_datetime,
73
+ });
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
80
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ baseURL: options?.serverURL ?? "",
85
+ operationID: "users_list",
86
+ oAuth2Scopes: [],
87
+
88
+ resolvedSecurity: requestSecurity,
89
+
90
+ securitySource: client._options.apiKeyHeader,
91
+ retryConfig: options?.retries
92
+ || client._options.retryConfig
93
+ || { strategy: "none" },
94
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
95
+ };
96
+
97
+ const requestRes = client._createRequest(context, {
98
+ security: requestSecurity,
99
+ method: "GET",
100
+ baseURL: options?.serverURL,
101
+ path: path,
102
+ headers: headers,
103
+ query: query,
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: ["422", "4XX", "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.ListResponseUserResponse,
129
+ | errors.HTTPValidationError
130
+ | SDKError
131
+ | SDKValidationError
132
+ | UnexpectedClientError
133
+ | InvalidRequestError
134
+ | RequestAbortedError
135
+ | RequestTimeoutError
136
+ | ConnectionError
137
+ >(
138
+ M.json(200, components.ListResponseUserResponse$inboundSchema),
139
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
140
+ M.fail("4XX"),
141
+ M.fail("5XX"),
142
+ )(response, { extraFields: responseFields });
143
+ if (!result.ok) {
144
+ return result;
145
+ }
146
+
147
+ return result;
148
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeJSON } 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 { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Update User
28
+ *
29
+ * @remarks
30
+ * Update an existing user.
31
+ */
32
+ export async function v1Update(
33
+ client: SyllableSDKCore,
34
+ request: components.UserUpdateRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<
37
+ Result<
38
+ components.UserResponse,
39
+ | errors.HTTPValidationError
40
+ | SDKError
41
+ | SDKValidationError
42
+ | UnexpectedClientError
43
+ | InvalidRequestError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | ConnectionError
47
+ >
48
+ > {
49
+ const parsed = safeParse(
50
+ request,
51
+ (value) => components.UserUpdateRequest$outboundSchema.parse(value),
52
+ "Input validation failed",
53
+ );
54
+ if (!parsed.ok) {
55
+ return parsed;
56
+ }
57
+ const payload = parsed.value;
58
+ const body = encodeJSON("body", payload, { explode: true });
59
+
60
+ const path = pathToFunc("/api/v1/users/")();
61
+
62
+ const headers = new Headers(compactMap({
63
+ "Content-Type": "application/json",
64
+ Accept: "application/json",
65
+ }));
66
+
67
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
68
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
69
+ const requestSecurity = resolveGlobalSecurity(securityInput);
70
+
71
+ const context = {
72
+ baseURL: options?.serverURL ?? "",
73
+ operationID: "users_update",
74
+ oAuth2Scopes: [],
75
+
76
+ resolvedSecurity: requestSecurity,
77
+
78
+ securitySource: client._options.apiKeyHeader,
79
+ retryConfig: options?.retries
80
+ || client._options.retryConfig
81
+ || { strategy: "none" },
82
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
83
+ };
84
+
85
+ const requestRes = client._createRequest(context, {
86
+ security: requestSecurity,
87
+ method: "PUT",
88
+ baseURL: options?.serverURL,
89
+ path: path,
90
+ headers: headers,
91
+ body: body,
92
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
93
+ }, options);
94
+ if (!requestRes.ok) {
95
+ return requestRes;
96
+ }
97
+ const req = requestRes.value;
98
+
99
+ const doResult = await client._do(req, {
100
+ context,
101
+ errorCodes: ["422", "4XX", "5XX"],
102
+ retryConfig: context.retryConfig,
103
+ retryCodes: context.retryCodes,
104
+ });
105
+ if (!doResult.ok) {
106
+ return doResult;
107
+ }
108
+ const response = doResult.value;
109
+
110
+ const responseFields = {
111
+ HttpMeta: { Response: response, Request: req },
112
+ };
113
+
114
+ const [result] = await M.match<
115
+ components.UserResponse,
116
+ | errors.HTTPValidationError
117
+ | SDKError
118
+ | SDKValidationError
119
+ | UnexpectedClientError
120
+ | InvalidRequestError
121
+ | RequestAbortedError
122
+ | RequestTimeoutError
123
+ | ConnectionError
124
+ >(
125
+ M.json(200, components.UserResponse$inboundSchema),
126
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
127
+ M.fail("4XX"),
128
+ M.fail("5XX"),
129
+ )(response, { extraFields: responseFields });
130
+ if (!result.ok) {
131
+ return result;
132
+ }
133
+
134
+ return result;
135
+ }
@@ -22,6 +22,10 @@ import { Result } from "../types/fp.js";
22
22
 
23
23
  /**
24
24
  * Request Removal Of This Account
25
+ *
26
+ * @remarks
27
+ * Request removal of the account of the user calling this endpoint. Intended for removing trial
28
+ * accounts.
25
29
  */
26
30
  export async function v1UsersDeleteAccount(
27
31
  client: SyllableSDKCore,
@@ -0,0 +1,142 @@
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 User
29
+ *
30
+ * @remarks
31
+ * Fetch a given user.
32
+ */
33
+ export async function v1UsersGetByEmail(
34
+ client: SyllableSDKCore,
35
+ request: operations.UsersGetByEmailRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.UserResponse,
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) => operations.UsersGetByEmailRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = null;
60
+
61
+ const pathParams = {
62
+ user_email: encodeSimple("user_email", payload.user_email, {
63
+ explode: false,
64
+ charEncoding: "percent",
65
+ }),
66
+ };
67
+
68
+ const path = pathToFunc("/api/v1/users/{user_email}")(pathParams);
69
+
70
+ const headers = new Headers(compactMap({
71
+ Accept: "application/json",
72
+ }));
73
+
74
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
75
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
76
+ const requestSecurity = resolveGlobalSecurity(securityInput);
77
+
78
+ const context = {
79
+ baseURL: options?.serverURL ?? "",
80
+ operationID: "users_get_by_email",
81
+ oAuth2Scopes: [],
82
+
83
+ resolvedSecurity: requestSecurity,
84
+
85
+ securitySource: client._options.apiKeyHeader,
86
+ retryConfig: options?.retries
87
+ || client._options.retryConfig
88
+ || { strategy: "none" },
89
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
90
+ };
91
+
92
+ const requestRes = client._createRequest(context, {
93
+ security: requestSecurity,
94
+ method: "GET",
95
+ baseURL: options?.serverURL,
96
+ path: path,
97
+ headers: headers,
98
+ body: body,
99
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
100
+ }, options);
101
+ if (!requestRes.ok) {
102
+ return requestRes;
103
+ }
104
+ const req = requestRes.value;
105
+
106
+ const doResult = await client._do(req, {
107
+ context,
108
+ errorCodes: ["422", "4XX", "5XX"],
109
+ retryConfig: context.retryConfig,
110
+ retryCodes: context.retryCodes,
111
+ });
112
+ if (!doResult.ok) {
113
+ return doResult;
114
+ }
115
+ const response = doResult.value;
116
+
117
+ const responseFields = {
118
+ HttpMeta: { Response: response, Request: req },
119
+ };
120
+
121
+ const [result] = await M.match<
122
+ components.UserResponse,
123
+ | errors.HTTPValidationError
124
+ | SDKError
125
+ | SDKValidationError
126
+ | UnexpectedClientError
127
+ | InvalidRequestError
128
+ | RequestAbortedError
129
+ | RequestTimeoutError
130
+ | ConnectionError
131
+ >(
132
+ M.json(200, components.UserResponse$inboundSchema),
133
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
134
+ M.fail("4XX"),
135
+ M.fail("5XX"),
136
+ )(response, { extraFields: responseFields });
137
+ if (!result.ok) {
138
+ return result;
139
+ }
140
+
141
+ return result;
142
+ }