vacation.set
Update out-of-office auto-reply settings.
Configures or replaces the out-of-office auto-responder settings. Supports optimistic locking via the If-Match header with the state token.
openemail.vacation.set(
mailboxId: string,
body: VacationSetBody,
options?: VacationSetOptions,
): ApiPromise<Vacation>It calls PUT /mailboxes/{mailboxId}/vacation: Update out-of-office auto-reply settings in the API reference.
Example
const vacation = await openemail.vacation.set(mailboxId, { isEnabled: true })Arguments
| Argument | Type | Description |
|---|---|---|
mailboxId | string | Mailbox ULID identifier. The path's {mailboxId}. |
body | VacationSetBody | The request's body. |
Options
The last argument, options, a VacationSetOptions, takes:
| Option | Type | Sent as | Description |
|---|---|---|---|
ifMatch | string | header if-match | Expected state token for optimistic locking (omit for unconditional update) |
Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
Awaited, it is the API's JSON, Vacation. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.
Errors
| Status | What it means |
|---|---|
400 | validation_failed — invalid request body |
401 | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge |
404 | Mailbox not found or not accessible to this principal |
412 | state_conflict — state token does not match current version |
413 | too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing |
422 | invalid_window (fromDate must be before toDate) or empty_body |
503 | temporary_failure: the mailbox or account is in transition while its store is being adopted; retry after Retry-After |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.
Types
VacationSetBody
/** The body of `vacation.set`. */
type VacationSetBody = {
/** @default null */
fromDate?: string | null
/** @default null */
htmlBody?: string | null
isEnabled: boolean
/** @default null */
subject?: string | null
/** @default null */
textBody?: string | null
/** @default null */
toDate?: string | null
}It names these types of the API, each on a page of its own: Vacation.