@unlimited-messaging/sdk 0.1.25 → 0.1.27
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/package.json +1 -1
- package/src/api/resources/accounts/client/Client.d.ts +182 -1
- package/src/api/resources/accounts/client/Client.js +437 -1
- package/src/api/resources/accounts/client/requests/AccountConnectEmailRequest.d.ts +39 -0
- package/src/api/resources/accounts/client/requests/AccountConnectEmailRequest.js +5 -0
- package/src/api/resources/accounts/client/requests/AccountEmailAutoconfigRequest.d.ts +12 -0
- package/src/api/resources/accounts/client/requests/AccountEmailAutoconfigRequest.js +5 -0
- package/src/api/resources/accounts/client/requests/AccountReconnectEmailRequest.d.ts +22 -0
- package/src/api/resources/accounts/client/requests/AccountReconnectEmailRequest.js +5 -0
- package/src/api/resources/accounts/client/requests/AccountTestEmailRequest.d.ts +35 -0
- package/src/api/resources/accounts/client/requests/AccountTestEmailRequest.js +5 -0
- package/src/api/resources/accounts/client/requests/index.d.ts +4 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestImap.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestImap.js +5 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestImapSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestImapSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestSmtp.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestSmtp.js +5 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestSmtpSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountConnectEmailRequestSmtpSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponse.d.ts +26 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponse.js +5 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseChannel.d.ts +10 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseChannel.js +12 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseOwner.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseOwner.js +10 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseStatus.d.ts +12 -0
- package/src/api/resources/accounts/types/AccountConnectEmailResponseStatus.js +14 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponse.d.ts +16 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponse.js +5 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseImap.d.ts +12 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseImap.js +5 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseImapSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseImapSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseSmtp.d.ts +12 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseSmtp.js +5 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseSmtpSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountEmailAutoconfigResponseSmtpSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestImap.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestImap.js +5 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestImapSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestImapSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestSmtp.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestSmtp.js +5 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestSmtpSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailRequestSmtpSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponse.d.ts +26 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponse.js +5 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseChannel.d.ts +10 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseChannel.js +12 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseOwner.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseOwner.js +10 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseStatus.d.ts +12 -0
- package/src/api/resources/accounts/types/AccountReconnectEmailResponseStatus.js +14 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestImap.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestImap.js +5 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestImapSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestImapSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestSmtp.d.ts +15 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestSmtp.js +5 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestSmtpSecurity.d.ts +11 -0
- package/src/api/resources/accounts/types/AccountTestEmailRequestSmtpSecurity.js +10 -0
- package/src/api/resources/accounts/types/AccountTestEmailResponse.d.ts +8 -0
- package/src/api/resources/accounts/types/AccountTestEmailResponse.js +5 -0
- package/src/api/resources/accounts/types/index.d.ts +26 -0
- package/src/api/resources/accounts/types/index.js +26 -0
- package/src/api/resources/messages/client/Client.d.ts +1 -1
- package/src/api/resources/messages/client/Client.js +1 -1
- package/src/api/resources/messages/types/MessageSendRequestChannelsItemChannel.d.ts +2 -1
- package/src/api/resources/messages/types/MessageSendRequestChannelsItemChannel.js +1 -0
- package/src/serialization/resources/accounts/client/requests/AccountConnectEmailRequest.d.ts +21 -0
- package/src/serialization/resources/accounts/client/requests/AccountConnectEmailRequest.js +52 -0
- package/src/serialization/resources/accounts/client/requests/AccountReconnectEmailRequest.d.ts +18 -0
- package/src/serialization/resources/accounts/client/requests/AccountReconnectEmailRequest.js +49 -0
- package/src/serialization/resources/accounts/client/requests/AccountTestEmailRequest.d.ts +19 -0
- package/src/serialization/resources/accounts/client/requests/AccountTestEmailRequest.js +50 -0
- package/src/serialization/resources/accounts/client/requests/index.d.ts +3 -0
- package/src/serialization/resources/accounts/client/requests/index.js +7 -1
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestImap.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestImap.js +46 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestImapSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestImapSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestSmtp.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestSmtp.js +46 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestSmtpSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailRequestSmtpSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponse.d.ts +28 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponse.js +59 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseChannel.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseChannel.js +41 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseOwner.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseOwner.js +41 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseStatus.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountConnectEmailResponseStatus.js +41 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponse.d.ts +19 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponse.js +50 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseImap.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseImap.js +46 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseImapSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseImapSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseSmtp.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseSmtp.js +46 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseSmtpSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountEmailAutoconfigResponseSmtpSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestImap.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestImap.js +46 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestImapSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestImapSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestSmtp.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestSmtp.js +46 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestSmtpSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailRequestSmtpSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponse.d.ts +28 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponse.js +59 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseChannel.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseChannel.js +41 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseOwner.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseOwner.js +41 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseStatus.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountReconnectEmailResponseStatus.js +41 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestImap.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestImap.js +46 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestImapSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestImapSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestSmtp.d.ts +15 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestSmtp.js +46 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestSmtpSecurity.d.ts +10 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailRequestSmtpSecurity.js +41 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailResponse.d.ts +13 -0
- package/src/serialization/resources/accounts/types/AccountTestEmailResponse.js +44 -0
- package/src/serialization/resources/accounts/types/index.d.ts +26 -0
- package/src/serialization/resources/accounts/types/index.js +26 -0
- package/src/serialization/resources/messages/types/MessageSendRequestChannelsItemChannel.d.ts +1 -1
- package/src/serialization/resources/messages/types/MessageSendRequestChannelsItemChannel.js +1 -1
|
@@ -55,6 +55,82 @@ const UnlimitedMessagingApi = __importStar(require("../../../index"));
|
|
|
55
55
|
const url_join_1 = __importDefault(require("url-join"));
|
|
56
56
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
57
57
|
const errors = __importStar(require("../../../../errors/index"));
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* An account is one of your own messaging identities: a WhatsApp number, a mailbox, or an Android
|
|
61
|
+
* phone sending SMS. Every message is sent from and received on an account. Link as many as your
|
|
62
|
+
* plan allows, then send with `POST /message` (pass `accountId`, or omit it to let the API pick one
|
|
63
|
+
* for the channel).
|
|
64
|
+
*
|
|
65
|
+
* | Channel | How it is linked | Through the API |
|
|
66
|
+
* | ------- | ---------------- | --------------- |
|
|
67
|
+
* | `WHATSAPP_WHATSMEOW` | Scan a QR code with the phone | `GET /account/link`, then poll `GET /account/{accountId}/challenge` |
|
|
68
|
+
* | `EMAIL` | IMAP/SMTP credentials of the mailbox | `POST /account/email` |
|
|
69
|
+
* | `SMS` | The free Android app, signed in to your account | Not linkable through the API |
|
|
70
|
+
*
|
|
71
|
+
* All of these work with an API key (`Authorization: Bearer <key>`). Status changes of every account
|
|
72
|
+
* (linked, disconnected, credentials refused...) are also sent as `account.status_changed` webhooks.
|
|
73
|
+
*
|
|
74
|
+
* ### Linking a WhatsApp number
|
|
75
|
+
*
|
|
76
|
+
* 1. `GET /account/link` creates the account in status `LINKING` and returns its `accountId`.
|
|
77
|
+
* 2. Poll `GET /account/{accountId}/challenge` every second. It returns
|
|
78
|
+
* `{ "challenge": { "kind": "qr", "data": "2@..." } }`: render `data` as a QR code (any QR library).
|
|
79
|
+
* It rotates about every 20 seconds, so keep polling and re-rendering.
|
|
80
|
+
* 3. The user scans it in WhatsApp: **Settings > Linked devices > Link a device**.
|
|
81
|
+
* 4. Once scanned, `challenge` becomes `null` and `GET /account/{accountId}` shows status `ACTIVE`.
|
|
82
|
+
*
|
|
83
|
+
* If the attempt expires, call `GET /account/link` again: the pending account is resumed, not
|
|
84
|
+
* duplicated. Linking numbers for several of your customers? Pass `externalRef` (your id for the
|
|
85
|
+
* customer) so each one resumes only their own attempt.
|
|
86
|
+
*
|
|
87
|
+
* ```bash
|
|
88
|
+
* curl -H "Authorization: Bearer $UM_API_KEY" https://api.unlimitedmessaging.app/account/link
|
|
89
|
+
* # { "accountId": "6f1c..." }
|
|
90
|
+
* curl -H "Authorization: Bearer $UM_API_KEY" https://api.unlimitedmessaging.app/account/6f1c.../challenge
|
|
91
|
+
* # { "challenge": { "kind": "qr", "data": "2@AbC..." } }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* ### Connecting a mailbox
|
|
95
|
+
*
|
|
96
|
+
* No QR code: a mailbox connects from its credentials alone and is `ACTIVE` as soon as the call returns.
|
|
97
|
+
*
|
|
98
|
+
* 1. `GET /account/email/autoconfig?email=jane@example.com` suggests the IMAP and SMTP servers.
|
|
99
|
+
* If `oauthRequired` is true (Outlook.com, Hotmail, Microsoft 365), the mailbox cannot be connected yet.
|
|
100
|
+
* 2. Optional: `POST /account/email/test` checks the credentials without saving anything.
|
|
101
|
+
* 3. `POST /account/email` with the address, the password and the servers connects it and returns the account.
|
|
102
|
+
*
|
|
103
|
+
* Gmail, iCloud and Yahoo refuse the normal account password over IMAP: create an **app password**
|
|
104
|
+
* in the provider's security settings and send that instead. The password is stored encrypted by the
|
|
105
|
+
* mail service and never returned by the API.
|
|
106
|
+
*
|
|
107
|
+
* ```bash
|
|
108
|
+
* curl -X POST https://api.unlimitedmessaging.app/account/email \
|
|
109
|
+
* -H "Authorization: Bearer $UM_API_KEY" -H "Content-Type: application/json" \
|
|
110
|
+
* -d '{
|
|
111
|
+
* "address": "jane@example.com",
|
|
112
|
+
* "password": "app-password",
|
|
113
|
+
* "imap": { "host": "imap.gmail.com", "port": 993, "security": "tls" },
|
|
114
|
+
* "smtp": { "host": "smtp.gmail.com", "port": 465, "security": "tls" }
|
|
115
|
+
* }'
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* Failures answer `422` with `context.code`: `AUTH_FAILED` (wrong password, or an app password is
|
|
119
|
+
* required), `OAUTH_REQUIRED`, `HOST_UNREACHABLE`, `TLS_ERROR`.
|
|
120
|
+
* When the password changes, or the server starts refusing it (status `INACTIVE`), send the new one
|
|
121
|
+
* with `PUT /account/{accountId}/email`.
|
|
122
|
+
*
|
|
123
|
+
* ### Through the MCP server
|
|
124
|
+
*
|
|
125
|
+
* An AI assistant connected to the MCP server (`https://api.unlimitedmessaging.app/mcp`) links
|
|
126
|
+
* both channels too:
|
|
127
|
+
*
|
|
128
|
+
* - **WhatsApp**: the `add-account` tool shows the QR code in the chat, to scan like above.
|
|
129
|
+
* - **Email**: `add-email-account` first recommends the dashboard, where the user types the password
|
|
130
|
+
* themselves and it never goes through the conversation. If the user prefers, they can give their
|
|
131
|
+
* address and password (or app password) in the chat instead: the tool finds the servers and
|
|
132
|
+
* connects the mailbox directly.
|
|
133
|
+
*/
|
|
58
134
|
class Accounts {
|
|
59
135
|
constructor(_options) {
|
|
60
136
|
this._options = _options;
|
|
@@ -134,7 +210,7 @@ class Accounts {
|
|
|
134
210
|
/**
|
|
135
211
|
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
136
212
|
*
|
|
137
|
-
* Creates a new account in
|
|
213
|
+
* Creates a new WHATSAPP account in LINKING status and starts a WhatsApp session. Poll GET /account/{accountId}/challenge every second: it returns `{ kind: "qr", data }`, the string to render as a QR code. The user scans it in WhatsApp > Settings > Linked devices > Link a device. The QR rotates about every 20 seconds, keep polling and re-rendering it. Once scanned the challenge becomes null and GET /account/{accountId} shows status ACTIVE (an `account.status_changed` webhook is also sent). If the attempt expires before it is scanned, call this endpoint again: the pending attempt is resumed. `mode` is kept for backwards compatibility, `stable` and `beta` now use the same connection. A pending attempt is resumed rather than duplicated. When you link numbers on behalf of several customers, pass `externalRef` (your own id for the customer, stored on the account and returned with it) so only that customer's pending attempt is resumed, or `new=true` to always start a fresh one.
|
|
138
214
|
*
|
|
139
215
|
* @param {UnlimitedMessagingApi.AccountLinkAccountRequest} request
|
|
140
216
|
* @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -224,6 +300,366 @@ class Accounts {
|
|
|
224
300
|
}
|
|
225
301
|
});
|
|
226
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
305
|
+
*
|
|
306
|
+
* First step of connecting a mailbox: looks up the IMAP and SMTP servers for an address (provider autoconfig, Mozilla ISP database, DNS, probing). Pass the result to POST /account/email/test or POST /account/email along with the password. When `oauthRequired` is true (Outlook.com, Hotmail, Microsoft 365) the mailbox cannot be connected yet.
|
|
307
|
+
*
|
|
308
|
+
* @param {UnlimitedMessagingApi.AccountEmailAutoconfigRequest} request
|
|
309
|
+
* @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
|
|
310
|
+
*
|
|
311
|
+
* @throws {@link UnlimitedMessagingApi.BadRequestError}
|
|
312
|
+
* @throws {@link UnlimitedMessagingApi.UnauthorizedError}
|
|
313
|
+
* @throws {@link UnlimitedMessagingApi.ForbiddenError}
|
|
314
|
+
* @throws {@link UnlimitedMessagingApi.ServiceUnavailableError}
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* await client.accounts.accountEmailAutoconfig({
|
|
318
|
+
* email: "email"
|
|
319
|
+
* })
|
|
320
|
+
*/
|
|
321
|
+
accountEmailAutoconfig(request, requestOptions) {
|
|
322
|
+
return core.HttpResponsePromise.fromPromise(this.__accountEmailAutoconfig(request, requestOptions));
|
|
323
|
+
}
|
|
324
|
+
__accountEmailAutoconfig(request, requestOptions) {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
+
var _a, _b;
|
|
327
|
+
const { email } = request;
|
|
328
|
+
const _queryParams = {};
|
|
329
|
+
_queryParams["email"] = email;
|
|
330
|
+
const _response = yield core.fetcher({
|
|
331
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.UnlimitedMessagingApiEnvironment.Production, "account/email/autoconfig"),
|
|
332
|
+
method: "GET",
|
|
333
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
334
|
+
contentType: "application/json",
|
|
335
|
+
queryParameters: _queryParams,
|
|
336
|
+
requestType: "json",
|
|
337
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
338
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
339
|
+
withCredentials: true,
|
|
340
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
341
|
+
});
|
|
342
|
+
if (_response.ok) {
|
|
343
|
+
return {
|
|
344
|
+
data: serializers.AccountEmailAutoconfigResponse.parseOrThrow(_response.body, {
|
|
345
|
+
unrecognizedObjectKeys: "passthrough",
|
|
346
|
+
allowUnrecognizedUnionMembers: true,
|
|
347
|
+
allowUnrecognizedEnumValues: true,
|
|
348
|
+
breadcrumbsPrefix: ["response"],
|
|
349
|
+
}),
|
|
350
|
+
rawResponse: _response.rawResponse,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
if (_response.error.reason === "status-code") {
|
|
354
|
+
switch (_response.error.statusCode) {
|
|
355
|
+
case 400:
|
|
356
|
+
throw new UnlimitedMessagingApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
357
|
+
case 401:
|
|
358
|
+
throw new UnlimitedMessagingApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
359
|
+
case 403:
|
|
360
|
+
throw new UnlimitedMessagingApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
361
|
+
case 503:
|
|
362
|
+
throw new UnlimitedMessagingApi.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
363
|
+
default:
|
|
364
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
365
|
+
statusCode: _response.error.statusCode,
|
|
366
|
+
body: _response.error.body,
|
|
367
|
+
rawResponse: _response.rawResponse,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
switch (_response.error.reason) {
|
|
372
|
+
case "non-json":
|
|
373
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
374
|
+
statusCode: _response.error.statusCode,
|
|
375
|
+
body: _response.error.rawBody,
|
|
376
|
+
rawResponse: _response.rawResponse,
|
|
377
|
+
});
|
|
378
|
+
case "timeout":
|
|
379
|
+
throw new errors.UnlimitedMessagingApiTimeoutError("Timeout exceeded when calling GET /account/email/autoconfig.");
|
|
380
|
+
case "unknown":
|
|
381
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
382
|
+
message: _response.error.errorMessage,
|
|
383
|
+
rawResponse: _response.rawResponse,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
390
|
+
*
|
|
391
|
+
* Logs in to the IMAP and SMTP servers and saves nothing. Optional: POST /account/email runs the same test before connecting. Errors (422) carry `context.code`: AUTH_FAILED (wrong password, or an app password is required), OAUTH_REQUIRED (Microsoft 365 / Outlook.com), HOST_UNREACHABLE, TLS_ERROR.
|
|
392
|
+
*
|
|
393
|
+
* @param {UnlimitedMessagingApi.AccountTestEmailRequest} request
|
|
394
|
+
* @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
|
|
395
|
+
*
|
|
396
|
+
* @throws {@link UnlimitedMessagingApi.UnauthorizedError}
|
|
397
|
+
* @throws {@link UnlimitedMessagingApi.ForbiddenError}
|
|
398
|
+
* @throws {@link UnlimitedMessagingApi.UnprocessableEntityError}
|
|
399
|
+
* @throws {@link UnlimitedMessagingApi.ServiceUnavailableError}
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* await client.accounts.accountTestEmail({
|
|
403
|
+
* address: "address",
|
|
404
|
+
* password: "password",
|
|
405
|
+
* imap: {
|
|
406
|
+
* host: "host",
|
|
407
|
+
* port: 1,
|
|
408
|
+
* security: "tls"
|
|
409
|
+
* },
|
|
410
|
+
* smtp: {
|
|
411
|
+
* host: "host",
|
|
412
|
+
* port: 1,
|
|
413
|
+
* security: "tls"
|
|
414
|
+
* }
|
|
415
|
+
* })
|
|
416
|
+
*/
|
|
417
|
+
accountTestEmail(request, requestOptions) {
|
|
418
|
+
return core.HttpResponsePromise.fromPromise(this.__accountTestEmail(request, requestOptions));
|
|
419
|
+
}
|
|
420
|
+
__accountTestEmail(request, requestOptions) {
|
|
421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
var _a, _b;
|
|
423
|
+
const _response = yield core.fetcher({
|
|
424
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.UnlimitedMessagingApiEnvironment.Production, "account/email/test"),
|
|
425
|
+
method: "POST",
|
|
426
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
427
|
+
contentType: "application/json",
|
|
428
|
+
requestType: "json",
|
|
429
|
+
body: serializers.AccountTestEmailRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
430
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
431
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
432
|
+
withCredentials: true,
|
|
433
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
434
|
+
});
|
|
435
|
+
if (_response.ok) {
|
|
436
|
+
return {
|
|
437
|
+
data: serializers.AccountTestEmailResponse.parseOrThrow(_response.body, {
|
|
438
|
+
unrecognizedObjectKeys: "passthrough",
|
|
439
|
+
allowUnrecognizedUnionMembers: true,
|
|
440
|
+
allowUnrecognizedEnumValues: true,
|
|
441
|
+
breadcrumbsPrefix: ["response"],
|
|
442
|
+
}),
|
|
443
|
+
rawResponse: _response.rawResponse,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
if (_response.error.reason === "status-code") {
|
|
447
|
+
switch (_response.error.statusCode) {
|
|
448
|
+
case 401:
|
|
449
|
+
throw new UnlimitedMessagingApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
450
|
+
case 403:
|
|
451
|
+
throw new UnlimitedMessagingApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
452
|
+
case 422:
|
|
453
|
+
throw new UnlimitedMessagingApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
454
|
+
case 503:
|
|
455
|
+
throw new UnlimitedMessagingApi.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
456
|
+
default:
|
|
457
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
458
|
+
statusCode: _response.error.statusCode,
|
|
459
|
+
body: _response.error.body,
|
|
460
|
+
rawResponse: _response.rawResponse,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
switch (_response.error.reason) {
|
|
465
|
+
case "non-json":
|
|
466
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
467
|
+
statusCode: _response.error.statusCode,
|
|
468
|
+
body: _response.error.rawBody,
|
|
469
|
+
rawResponse: _response.rawResponse,
|
|
470
|
+
});
|
|
471
|
+
case "timeout":
|
|
472
|
+
throw new errors.UnlimitedMessagingApiTimeoutError("Timeout exceeded when calling POST /account/email/test.");
|
|
473
|
+
case "unknown":
|
|
474
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
475
|
+
message: _response.error.errorMessage,
|
|
476
|
+
rawResponse: _response.rawResponse,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
483
|
+
*
|
|
484
|
+
* Tests the credentials and connects the mailbox as an EMAIL account. There is no QR code or challenge: the account is ACTIVE as soon as this returns. Its id is then the `accountId` to send email from with POST /message, and incoming email arrives as `message.received` webhooks. Gmail, iCloud and Yahoo require an app password. Same error codes as POST /account/email/test. A mailbox already connected elsewhere (on another of your accounts or on another user) connects anyway as its own account; connecting an address you already have reuses that account with the new credentials.
|
|
485
|
+
*
|
|
486
|
+
* @param {UnlimitedMessagingApi.AccountConnectEmailRequest} request
|
|
487
|
+
* @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
|
|
488
|
+
*
|
|
489
|
+
* @throws {@link UnlimitedMessagingApi.UnauthorizedError}
|
|
490
|
+
* @throws {@link UnlimitedMessagingApi.ForbiddenError}
|
|
491
|
+
* @throws {@link UnlimitedMessagingApi.ConflictError}
|
|
492
|
+
* @throws {@link UnlimitedMessagingApi.UnprocessableEntityError}
|
|
493
|
+
* @throws {@link UnlimitedMessagingApi.ServiceUnavailableError}
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* await client.accounts.accountConnectEmail({
|
|
497
|
+
* address: "address",
|
|
498
|
+
* password: "password",
|
|
499
|
+
* imap: {
|
|
500
|
+
* host: "host",
|
|
501
|
+
* port: 1,
|
|
502
|
+
* security: "tls"
|
|
503
|
+
* },
|
|
504
|
+
* smtp: {
|
|
505
|
+
* host: "host",
|
|
506
|
+
* port: 1,
|
|
507
|
+
* security: "tls"
|
|
508
|
+
* }
|
|
509
|
+
* })
|
|
510
|
+
*/
|
|
511
|
+
accountConnectEmail(request, requestOptions) {
|
|
512
|
+
return core.HttpResponsePromise.fromPromise(this.__accountConnectEmail(request, requestOptions));
|
|
513
|
+
}
|
|
514
|
+
__accountConnectEmail(request, requestOptions) {
|
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
516
|
+
var _a, _b;
|
|
517
|
+
const _response = yield core.fetcher({
|
|
518
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.UnlimitedMessagingApiEnvironment.Production, "account/email"),
|
|
519
|
+
method: "POST",
|
|
520
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
521
|
+
contentType: "application/json",
|
|
522
|
+
requestType: "json",
|
|
523
|
+
body: serializers.AccountConnectEmailRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
524
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
525
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
526
|
+
withCredentials: true,
|
|
527
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
528
|
+
});
|
|
529
|
+
if (_response.ok) {
|
|
530
|
+
return {
|
|
531
|
+
data: serializers.AccountConnectEmailResponse.parseOrThrow(_response.body, {
|
|
532
|
+
unrecognizedObjectKeys: "passthrough",
|
|
533
|
+
allowUnrecognizedUnionMembers: true,
|
|
534
|
+
allowUnrecognizedEnumValues: true,
|
|
535
|
+
breadcrumbsPrefix: ["response"],
|
|
536
|
+
}),
|
|
537
|
+
rawResponse: _response.rawResponse,
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
if (_response.error.reason === "status-code") {
|
|
541
|
+
switch (_response.error.statusCode) {
|
|
542
|
+
case 401:
|
|
543
|
+
throw new UnlimitedMessagingApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
544
|
+
case 403:
|
|
545
|
+
throw new UnlimitedMessagingApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
546
|
+
case 409:
|
|
547
|
+
throw new UnlimitedMessagingApi.ConflictError(_response.error.body, _response.rawResponse);
|
|
548
|
+
case 422:
|
|
549
|
+
throw new UnlimitedMessagingApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
550
|
+
case 503:
|
|
551
|
+
throw new UnlimitedMessagingApi.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
552
|
+
default:
|
|
553
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
554
|
+
statusCode: _response.error.statusCode,
|
|
555
|
+
body: _response.error.body,
|
|
556
|
+
rawResponse: _response.rawResponse,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
switch (_response.error.reason) {
|
|
561
|
+
case "non-json":
|
|
562
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
563
|
+
statusCode: _response.error.statusCode,
|
|
564
|
+
body: _response.error.rawBody,
|
|
565
|
+
rawResponse: _response.rawResponse,
|
|
566
|
+
});
|
|
567
|
+
case "timeout":
|
|
568
|
+
throw new errors.UnlimitedMessagingApiTimeoutError("Timeout exceeded when calling POST /account/email.");
|
|
569
|
+
case "unknown":
|
|
570
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
571
|
+
message: _response.error.errorMessage,
|
|
572
|
+
rawResponse: _response.rawResponse,
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
579
|
+
*
|
|
580
|
+
* For a changed password, or an account whose credentials the mail server refused (status INACTIVE, see the `account.status_changed` webhook). Servers default to the stored ones. The address cannot change: connect a new mailbox instead.
|
|
581
|
+
*
|
|
582
|
+
* @param {string} accountId
|
|
583
|
+
* @param {UnlimitedMessagingApi.AccountReconnectEmailRequest} request
|
|
584
|
+
* @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
|
|
585
|
+
*
|
|
586
|
+
* @throws {@link UnlimitedMessagingApi.UnauthorizedError}
|
|
587
|
+
* @throws {@link UnlimitedMessagingApi.ForbiddenError}
|
|
588
|
+
* @throws {@link UnlimitedMessagingApi.NotFoundError}
|
|
589
|
+
* @throws {@link UnlimitedMessagingApi.UnprocessableEntityError}
|
|
590
|
+
* @throws {@link UnlimitedMessagingApi.ServiceUnavailableError}
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* await client.accounts.accountReconnectEmail("accountId", {
|
|
594
|
+
* password: "password"
|
|
595
|
+
* })
|
|
596
|
+
*/
|
|
597
|
+
accountReconnectEmail(accountId, request, requestOptions) {
|
|
598
|
+
return core.HttpResponsePromise.fromPromise(this.__accountReconnectEmail(accountId, request, requestOptions));
|
|
599
|
+
}
|
|
600
|
+
__accountReconnectEmail(accountId, request, requestOptions) {
|
|
601
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
602
|
+
var _a, _b;
|
|
603
|
+
const _response = yield core.fetcher({
|
|
604
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.UnlimitedMessagingApiEnvironment.Production, `account/${encodeURIComponent(accountId)}/email`),
|
|
605
|
+
method: "PUT",
|
|
606
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
607
|
+
contentType: "application/json",
|
|
608
|
+
requestType: "json",
|
|
609
|
+
body: serializers.AccountReconnectEmailRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
610
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
611
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
612
|
+
withCredentials: true,
|
|
613
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
614
|
+
});
|
|
615
|
+
if (_response.ok) {
|
|
616
|
+
return {
|
|
617
|
+
data: serializers.AccountReconnectEmailResponse.parseOrThrow(_response.body, {
|
|
618
|
+
unrecognizedObjectKeys: "passthrough",
|
|
619
|
+
allowUnrecognizedUnionMembers: true,
|
|
620
|
+
allowUnrecognizedEnumValues: true,
|
|
621
|
+
breadcrumbsPrefix: ["response"],
|
|
622
|
+
}),
|
|
623
|
+
rawResponse: _response.rawResponse,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
if (_response.error.reason === "status-code") {
|
|
627
|
+
switch (_response.error.statusCode) {
|
|
628
|
+
case 401:
|
|
629
|
+
throw new UnlimitedMessagingApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
630
|
+
case 403:
|
|
631
|
+
throw new UnlimitedMessagingApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
632
|
+
case 404:
|
|
633
|
+
throw new UnlimitedMessagingApi.NotFoundError(_response.error.body, _response.rawResponse);
|
|
634
|
+
case 422:
|
|
635
|
+
throw new UnlimitedMessagingApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
636
|
+
case 503:
|
|
637
|
+
throw new UnlimitedMessagingApi.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
638
|
+
default:
|
|
639
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
640
|
+
statusCode: _response.error.statusCode,
|
|
641
|
+
body: _response.error.body,
|
|
642
|
+
rawResponse: _response.rawResponse,
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
switch (_response.error.reason) {
|
|
647
|
+
case "non-json":
|
|
648
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
649
|
+
statusCode: _response.error.statusCode,
|
|
650
|
+
body: _response.error.rawBody,
|
|
651
|
+
rawResponse: _response.rawResponse,
|
|
652
|
+
});
|
|
653
|
+
case "timeout":
|
|
654
|
+
throw new errors.UnlimitedMessagingApiTimeoutError("Timeout exceeded when calling PUT /account/{accountId}/email.");
|
|
655
|
+
case "unknown":
|
|
656
|
+
throw new errors.UnlimitedMessagingApiError({
|
|
657
|
+
message: _response.error.errorMessage,
|
|
658
|
+
rawResponse: _response.rawResponse,
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}
|
|
227
663
|
/**
|
|
228
664
|
* **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ, OTHER:WRITE
|
|
229
665
|
*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as UnlimitedMessagingApi from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* address: "address",
|
|
9
|
+
* password: "password",
|
|
10
|
+
* imap: {
|
|
11
|
+
* host: "host",
|
|
12
|
+
* port: 1,
|
|
13
|
+
* security: "tls"
|
|
14
|
+
* },
|
|
15
|
+
* smtp: {
|
|
16
|
+
* host: "host",
|
|
17
|
+
* port: 1,
|
|
18
|
+
* security: "tls"
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export interface AccountConnectEmailRequest {
|
|
23
|
+
/** The mailbox address. It identifies the account and cannot change later. */
|
|
24
|
+
address: string;
|
|
25
|
+
/** Login for the IMAP and SMTP servers. Defaults to the address. */
|
|
26
|
+
username?: string;
|
|
27
|
+
/** Mailbox password. For Gmail, iCloud and Yahoo this must be an app password, not the account password. It is stored encrypted by the mail service and never returned. */
|
|
28
|
+
password: string;
|
|
29
|
+
/** Incoming mail server (IMAP). */
|
|
30
|
+
imap: UnlimitedMessagingApi.AccountConnectEmailRequestImap;
|
|
31
|
+
/** Outgoing mail server (SMTP). */
|
|
32
|
+
smtp: UnlimitedMessagingApi.AccountConnectEmailRequestSmtp;
|
|
33
|
+
/** Copy each sent email into the Sent folder over IMAP. Defaults to true, except for providers that file sent mail themselves (Gmail). */
|
|
34
|
+
appendSent?: boolean;
|
|
35
|
+
/** Display name of the account. Defaults to the address. */
|
|
36
|
+
name?: string;
|
|
37
|
+
/** Your own reference for this account (e.g. your customer id), stored on it and returned with it. Can be changed later with PATCH /account/{accountId}. */
|
|
38
|
+
externalRef?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as UnlimitedMessagingApi from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* password: "password"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface AccountReconnectEmailRequest {
|
|
12
|
+
/** New login. Defaults to the stored one. */
|
|
13
|
+
username?: string;
|
|
14
|
+
/** The new password (or app password). */
|
|
15
|
+
password: string;
|
|
16
|
+
/** New IMAP server. Defaults to the stored one. */
|
|
17
|
+
imap?: UnlimitedMessagingApi.AccountReconnectEmailRequestImap;
|
|
18
|
+
/** New SMTP server. Defaults to the stored one. */
|
|
19
|
+
smtp?: UnlimitedMessagingApi.AccountReconnectEmailRequestSmtp;
|
|
20
|
+
/** Defaults to the stored setting. */
|
|
21
|
+
appendSent?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as UnlimitedMessagingApi from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* address: "address",
|
|
9
|
+
* password: "password",
|
|
10
|
+
* imap: {
|
|
11
|
+
* host: "host",
|
|
12
|
+
* port: 1,
|
|
13
|
+
* security: "tls"
|
|
14
|
+
* },
|
|
15
|
+
* smtp: {
|
|
16
|
+
* host: "host",
|
|
17
|
+
* port: 1,
|
|
18
|
+
* security: "tls"
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export interface AccountTestEmailRequest {
|
|
23
|
+
/** The mailbox address. It identifies the account and cannot change later. */
|
|
24
|
+
address: string;
|
|
25
|
+
/** Login for the IMAP and SMTP servers. Defaults to the address. */
|
|
26
|
+
username?: string;
|
|
27
|
+
/** Mailbox password. For Gmail, iCloud and Yahoo this must be an app password, not the account password. It is stored encrypted by the mail service and never returned. */
|
|
28
|
+
password: string;
|
|
29
|
+
/** Incoming mail server (IMAP). */
|
|
30
|
+
imap: UnlimitedMessagingApi.AccountTestEmailRequestImap;
|
|
31
|
+
/** Outgoing mail server (SMTP). */
|
|
32
|
+
smtp: UnlimitedMessagingApi.AccountTestEmailRequestSmtp;
|
|
33
|
+
/** Copy each sent email into the Sent folder over IMAP. Defaults to true, except for providers that file sent mail themselves (Gmail). */
|
|
34
|
+
appendSent?: boolean;
|
|
35
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { type AccountLinkAccountRequest } from "./AccountLinkAccountRequest";
|
|
2
|
+
export { type AccountEmailAutoconfigRequest } from "./AccountEmailAutoconfigRequest";
|
|
3
|
+
export { type AccountTestEmailRequest } from "./AccountTestEmailRequest";
|
|
4
|
+
export { type AccountConnectEmailRequest } from "./AccountConnectEmailRequest";
|
|
5
|
+
export { type AccountReconnectEmailRequest } from "./AccountReconnectEmailRequest";
|
|
2
6
|
export { type AccountGetChallengeRequest } from "./AccountGetChallengeRequest";
|
|
3
7
|
export { type AccountGetQrCodeRequest } from "./AccountGetQrCodeRequest";
|
|
4
8
|
export { type AccountRequestHistoryRequest } from "./AccountRequestHistoryRequest";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as UnlimitedMessagingApi from "../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* Incoming mail server (IMAP).
|
|
7
|
+
*/
|
|
8
|
+
export interface AccountConnectEmailRequestImap {
|
|
9
|
+
/** Server hostname, e.g. imap.gmail.com. */
|
|
10
|
+
host: string;
|
|
11
|
+
/** Server port, e.g. 993 (IMAP) or 465 / 587 (SMTP). */
|
|
12
|
+
port: number;
|
|
13
|
+
/** `tls` for implicit TLS (993, 465), `starttls` for an upgraded connection (143, 587). Plain text is refused. */
|
|
14
|
+
security: UnlimitedMessagingApi.AccountConnectEmailRequestImapSecurity;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* `tls` for implicit TLS (993, 465), `starttls` for an upgraded connection (143, 587). Plain text is refused.
|
|
6
|
+
*/
|
|
7
|
+
export type AccountConnectEmailRequestImapSecurity = "tls" | "starttls";
|
|
8
|
+
export declare const AccountConnectEmailRequestImapSecurity: {
|
|
9
|
+
readonly Tls: "tls";
|
|
10
|
+
readonly Starttls: "starttls";
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccountConnectEmailRequestImapSecurity = void 0;
|
|
7
|
+
exports.AccountConnectEmailRequestImapSecurity = {
|
|
8
|
+
Tls: "tls",
|
|
9
|
+
Starttls: "starttls",
|
|
10
|
+
};
|