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.
- package/README.md +24 -0
- package/docs/sdks/batches/README.md +4 -4
- package/docs/sdks/campaigns/README.md +18 -2
- package/docs/sdks/languagegroups/README.md +4 -4
- package/docs/sdks/numbers/README.md +164 -0
- package/docs/sdks/users/README.md +424 -1
- package/docs/sdks/v1/README.md +424 -1
- package/docs/sdks/workflows/README.md +8 -8
- package/funcs/channelsTwilioNumbersList.d.ts +17 -0
- package/funcs/channelsTwilioNumbersList.d.ts.map +1 -0
- package/funcs/channelsTwilioNumbersList.js +108 -0
- package/funcs/channelsTwilioNumbersList.js.map +1 -0
- package/funcs/channelsTwilioNumbersUpdate.d.ts +17 -0
- package/funcs/channelsTwilioNumbersUpdate.d.ts.map +1 -0
- package/funcs/channelsTwilioNumbersUpdate.js +111 -0
- package/funcs/channelsTwilioNumbersUpdate.js.map +1 -0
- package/funcs/usersCreate.d.ts +16 -0
- package/funcs/usersCreate.d.ts.map +1 -0
- package/funcs/usersCreate.js +102 -0
- package/funcs/usersCreate.js.map +1 -0
- package/funcs/usersDelete.d.ts +16 -0
- package/funcs/usersDelete.d.ts.map +1 -0
- package/funcs/usersDelete.js +103 -0
- package/funcs/usersDelete.js.map +1 -0
- package/funcs/usersList.d.ts +17 -0
- package/funcs/usersList.d.ts.map +1 -0
- package/funcs/usersList.js +114 -0
- package/funcs/usersList.js.map +1 -0
- package/funcs/usersUpdate.d.ts +16 -0
- package/funcs/usersUpdate.d.ts.map +1 -0
- package/funcs/usersUpdate.js +102 -0
- package/funcs/usersUpdate.js.map +1 -0
- package/funcs/usersUsersDeleteAccount.d.ts +4 -0
- package/funcs/usersUsersDeleteAccount.d.ts.map +1 -1
- package/funcs/usersUsersDeleteAccount.js +4 -0
- package/funcs/usersUsersDeleteAccount.js.map +1 -1
- package/funcs/usersUsersGetByEmail.d.ts +17 -0
- package/funcs/usersUsersGetByEmail.d.ts.map +1 -0
- package/funcs/usersUsersGetByEmail.js +108 -0
- package/funcs/usersUsersGetByEmail.js.map +1 -0
- package/funcs/v1Create.d.ts +16 -0
- package/funcs/v1Create.d.ts.map +1 -0
- package/funcs/v1Create.js +102 -0
- package/funcs/v1Create.js.map +1 -0
- package/funcs/v1Delete.d.ts +16 -0
- package/funcs/v1Delete.d.ts.map +1 -0
- package/funcs/v1Delete.js +103 -0
- package/funcs/v1Delete.js.map +1 -0
- package/funcs/v1List.d.ts +17 -0
- package/funcs/v1List.d.ts.map +1 -0
- package/funcs/v1List.js +114 -0
- package/funcs/v1List.js.map +1 -0
- package/funcs/v1Update.d.ts +16 -0
- package/funcs/v1Update.d.ts.map +1 -0
- package/funcs/v1Update.js +102 -0
- package/funcs/v1Update.js.map +1 -0
- package/funcs/v1UsersDeleteAccount.d.ts +4 -0
- package/funcs/v1UsersDeleteAccount.d.ts.map +1 -1
- package/funcs/v1UsersDeleteAccount.js +4 -0
- package/funcs/v1UsersDeleteAccount.js.map +1 -1
- package/funcs/v1UsersGetByEmail.d.ts +17 -0
- package/funcs/v1UsersGetByEmail.d.ts.map +1 -0
- package/funcs/v1UsersGetByEmail.js +108 -0
- package/funcs/v1UsersGetByEmail.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/campaignproperties.d.ts +3 -0
- package/models/components/campaignproperties.d.ts.map +1 -1
- package/models/components/campaignproperties.js +1 -0
- package/models/components/campaignproperties.js.map +1 -1
- package/models/components/index.d.ts +10 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +10 -0
- package/models/components/index.js.map +1 -1
- package/models/components/languagecode.d.ts +6 -0
- package/models/components/languagecode.d.ts.map +1 -1
- package/models/components/languagecode.js +2 -0
- package/models/components/languagecode.js.map +1 -1
- package/models/components/listresponseuserresponse.d.ts +53 -0
- package/models/components/listresponseuserresponse.d.ts.map +1 -0
- package/models/components/listresponseuserresponse.js +81 -0
- package/models/components/listresponseuserresponse.js.map +1 -0
- package/models/components/outboundcampaign.d.ts +8 -1
- package/models/components/outboundcampaign.d.ts.map +1 -1
- package/models/components/outboundcampaign.js +2 -0
- package/models/components/outboundcampaign.js.map +1 -1
- package/models/components/outboundcampaigninput.d.ts +8 -1
- package/models/components/outboundcampaigninput.d.ts.map +1 -1
- package/models/components/outboundcampaigninput.js +2 -0
- package/models/components/outboundcampaigninput.js.map +1 -1
- package/models/components/twiliolistnumbersresponse.d.ts +36 -0
- package/models/components/twiliolistnumbersresponse.d.ts.map +1 -0
- package/models/components/twiliolistnumbersresponse.js +69 -0
- package/models/components/twiliolistnumbersresponse.js.map +1 -0
- package/models/components/twilionumberupdaterequest.d.ts +40 -0
- package/models/components/twilionumberupdaterequest.d.ts.map +1 -0
- package/models/components/twilionumberupdaterequest.js +72 -0
- package/models/components/twilionumberupdaterequest.js.map +1 -0
- package/models/components/twilionumberupdateresponse.d.ts +35 -0
- package/models/components/twilionumberupdateresponse.d.ts.map +1 -0
- package/models/components/twilionumberupdateresponse.js +68 -0
- package/models/components/twilionumberupdateresponse.js.map +1 -0
- package/models/components/twiliophonenumber.d.ts +47 -0
- package/models/components/twiliophonenumber.d.ts.map +1 -0
- package/models/components/twiliophonenumber.js +78 -0
- package/models/components/twiliophonenumber.js.map +1 -0
- package/models/components/usercreaterequest.d.ts +50 -0
- package/models/components/usercreaterequest.d.ts.map +1 -0
- package/models/components/usercreaterequest.js +78 -0
- package/models/components/usercreaterequest.js.map +1 -0
- package/models/components/userdeleterequest.d.ts +40 -0
- package/models/components/userdeleterequest.d.ts.map +1 -0
- package/models/components/userdeleterequest.js +61 -0
- package/models/components/userdeleterequest.js.map +1 -0
- package/models/components/userproperties.d.ts +40 -0
- package/models/components/userproperties.d.ts.map +1 -0
- package/models/components/userproperties.js +55 -0
- package/models/components/userproperties.js.map +1 -0
- package/models/components/userresponse.d.ts +75 -0
- package/models/components/userresponse.d.ts.map +1 -0
- package/models/components/userresponse.js +97 -0
- package/models/components/userresponse.js.map +1 -0
- package/models/components/userupdaterequest.d.ts +55 -0
- package/models/components/userupdaterequest.d.ts.map +1 -0
- package/models/components/userupdaterequest.js +82 -0
- package/models/components/userupdaterequest.js.map +1 -0
- package/models/operations/channelstwilionumberslist.d.ts +29 -0
- package/models/operations/channelstwilionumberslist.d.ts.map +1 -0
- package/models/operations/channelstwilionumberslist.js +68 -0
- package/models/operations/channelstwilionumberslist.js.map +1 -0
- package/models/operations/channelstwilionumbersupdate.d.ts +32 -0
- package/models/operations/channelstwilionumbersupdate.d.ts.map +1 -0
- package/models/operations/channelstwilionumbersupdate.js +73 -0
- package/models/operations/channelstwilionumbersupdate.js.map +1 -0
- package/models/operations/index.d.ts +4 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +4 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/usersgetbyemail.d.ts +29 -0
- package/models/operations/usersgetbyemail.d.ts.map +1 -0
- package/models/operations/usersgetbyemail.js +68 -0
- package/models/operations/usersgetbyemail.js.map +1 -0
- package/models/operations/userslist.d.ts +73 -0
- package/models/operations/userslist.d.ts.map +1 -0
- package/models/operations/userslist.js +99 -0
- package/models/operations/userslist.js.map +1 -0
- package/openapi.json +1353 -343
- package/package.json +1 -1
- package/sdk/numbers.d.ts +14 -0
- package/sdk/numbers.d.ts.map +1 -1
- package/sdk/numbers.js +20 -0
- package/sdk/numbers.js.map +1 -1
- package/sdk/users.d.ts +41 -0
- package/sdk/users.d.ts.map +1 -1
- package/sdk/users.js +54 -0
- package/sdk/users.js.map +1 -1
- package/sdk/v1.d.ts +41 -0
- package/sdk/v1.d.ts.map +1 -1
- package/sdk/v1.js +54 -0
- package/sdk/v1.js.map +1 -1
- package/src/funcs/channelsTwilioNumbersList.ts +145 -0
- package/src/funcs/channelsTwilioNumbersUpdate.ts +148 -0
- package/src/funcs/usersCreate.ts +135 -0
- package/src/funcs/usersDelete.ts +136 -0
- package/src/funcs/usersList.ts +148 -0
- package/src/funcs/usersUpdate.ts +135 -0
- package/src/funcs/usersUsersDeleteAccount.ts +4 -0
- package/src/funcs/usersUsersGetByEmail.ts +142 -0
- package/src/funcs/v1Create.ts +135 -0
- package/src/funcs/v1Delete.ts +136 -0
- package/src/funcs/v1List.ts +148 -0
- package/src/funcs/v1Update.ts +135 -0
- package/src/funcs/v1UsersDeleteAccount.ts +4 -0
- package/src/funcs/v1UsersGetByEmail.ts +142 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/campaignproperties.ts +1 -0
- package/src/models/components/index.ts +10 -0
- package/src/models/components/languagecode.ts +2 -0
- package/src/models/components/listresponseuserresponse.ts +116 -0
- package/src/models/components/outboundcampaign.ts +10 -1
- package/src/models/components/outboundcampaigninput.ts +10 -1
- package/src/models/components/twiliolistnumbersresponse.ts +87 -0
- package/src/models/components/twilionumberupdaterequest.ts +90 -0
- package/src/models/components/twilionumberupdateresponse.ts +81 -0
- package/src/models/components/twiliophonenumber.ts +103 -0
- package/src/models/components/usercreaterequest.ts +106 -0
- package/src/models/components/userdeleterequest.ts +79 -0
- package/src/models/components/userproperties.ts +41 -0
- package/src/models/components/userresponse.ts +150 -0
- package/src/models/components/userupdaterequest.ts +115 -0
- package/src/models/operations/channelstwilionumberslist.ts +77 -0
- package/src/models/operations/channelstwilionumbersupdate.ts +87 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/usersgetbyemail.ts +75 -0
- package/src/models/operations/userslist.ts +149 -0
- package/src/sdk/numbers.ts +36 -0
- package/src/sdk/users.ts +96 -0
- 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
|
+
}
|