Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* email_service
* OpenAPI spec version: 0.1.0
*/
import type {
AddDraftAttachmentParams,
AddDraftAttachmentRequest,
AddDraftAttachmentResponse,
AddForwardedAttachmentParams,
AddForwardedAttachmentRequest,
AddForwardedAttachmentResponse,
ApiPaginatedThreadCursor,
ArchiveThreadRequest,
ArchiveThreadsRequest,
ArchiveThreadsResponse,
BlockSenderRequest,
CalendarEvent,
CalendarMutationApiError,
CancelBackfillParams,
CompleteDraftAttachmentParams,
CopyCalendarEventRequest,
CreateDraftRequest,
CreateDraftResponse,
CreateLabelRequest,
CreateLabelResponse,
DeleteDraftParams,
DeleteScheduledDraftParams,
EmlFile,
EmptyResponse,
ErrorResponse,
ForwardCalendarEventError,
ForwardCalendarEventRequest,
ForwardCalendarEventResponse,
GetActiveBackfillJobResponse,
GetAttachmentDocumentIDResponse,
GetAttachmentResponse,
GetBackfillJobResponse,
GetScheduledMessagesParams,
GetScheduledResponse,
GetThreadCalendarInvitations200,
GetThreadMessagesHandlerParams,
GetThreadParams,
GetThreadResponse,
InitErrorCodeResponse,
InitResponse,
InitUserParams,
ListBackfillJobsResponse,
ListBlockedResponse,
ListContactsResponse,
ListEmailFiltersResponse,
ListLabelsResponse,
ListLinksResponse,
MailboxOperation,
MailboxSettingsOperation,
MessageOperationResponse,
ParsedMessage,
PatchSettingsRequest,
PatchSettingsResponse,
PreviewsInboxCursorParams,
RemoveDraftAttachmentParams,
RemoveForwardedAttachmentParams,
ResolveMessageOperationRequest,
ResyncResponse,
SendMessageRequest,
SendMessageResponse,
SharedInboxConflictResponse,
ThreadReadReceipts,
TransferDraftRequest,
TransferDraftResponse,
TransferRecoveryResponse,
UnblockSenderRequest,
UnresolvedSignatureImagesError,
UpdateLabelBatchRequest,
UpdateLabelBatchResponse,
UpdateThreadLabelRequest,
UpdateThreadLabelsResponse,
UpdateThreadProjectRequest,
UpdateThreadProjectResponse,
UpdateThreadStateRequest,
UpsertEmailFilterRequest,
UpsertEmailFilterResponse,
UpsertScheduledMessageParams,
UpsertScheduledRequest,
UpsertScheduledResponse,
} from './schemas';
/**
* @summary Get an attachment by ID.
*/
export type getAttachmentResponse200 = {
data: GetAttachmentResponse;
status: 200;
};
export type getAttachmentResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getAttachmentResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getAttachmentResponse403 = {
data: ErrorResponse;
status: 403;
};
export type getAttachmentResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getAttachmentResponse409 = {
data: ErrorResponse;
status: 409;
};
export type getAttachmentResponse429 = {
data: ErrorResponse;
status: 429;
};
export type getAttachmentResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getAttachmentResponseSuccess = getAttachmentResponse200 & {
headers: Headers;
};
export type getAttachmentResponseError = (
| getAttachmentResponse400
| getAttachmentResponse401
| getAttachmentResponse403
| getAttachmentResponse404
| getAttachmentResponse409
| getAttachmentResponse429
| getAttachmentResponse500
) & {
headers: Headers;
};
export type getAttachmentResponse =
| getAttachmentResponseSuccess
| getAttachmentResponseError;
export const getGetAttachmentUrl = (id: string) => {
return `/email/attachments/${id}`;
};
export const getAttachment = async (
id: string,
options?: RequestInit
): Promise<getAttachmentResponse> => {
const res = await fetch(getGetAttachmentUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getAttachmentResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getAttachmentResponse;
};
/**
* @summary Get the Macro document id for an email attachment, uploading it if it doesn't already exist.
*/
export type getAttachmentDocumentIdResponse200 = {
data: GetAttachmentDocumentIDResponse;
status: 200;
};
export type getAttachmentDocumentIdResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getAttachmentDocumentIdResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getAttachmentDocumentIdResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getAttachmentDocumentIdResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getAttachmentDocumentIdResponseSuccess =
getAttachmentDocumentIdResponse200 & {
headers: Headers;
};
export type getAttachmentDocumentIdResponseError = (
| getAttachmentDocumentIdResponse400
| getAttachmentDocumentIdResponse401
| getAttachmentDocumentIdResponse404
| getAttachmentDocumentIdResponse500
) & {
headers: Headers;
};
export type getAttachmentDocumentIdResponse =
| getAttachmentDocumentIdResponseSuccess
| getAttachmentDocumentIdResponseError;
export const getGetAttachmentDocumentIdUrl = (id: string) => {
return `/email/attachments/${id}/document_id`;
};
export const getAttachmentDocumentId = async (
id: string,
options?: RequestInit
): Promise<getAttachmentDocumentIdResponse> => {
const res = await fetch(getGetAttachmentDocumentIdUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getAttachmentDocumentIdResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getAttachmentDocumentIdResponse;
};
/**
* @summary List all backfill jobs for the authenticated user, across every link they
own. Scoped by the user's fusionauth id from the request context rather than
a single resolved link.
*/
export type listBackfillGmailResponse200 = {
data: ListBackfillJobsResponse;
status: 200;
};
export type listBackfillGmailResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listBackfillGmailResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listBackfillGmailResponseSuccess = listBackfillGmailResponse200 & {
headers: Headers;
};
export type listBackfillGmailResponseError = (
| listBackfillGmailResponse401
| listBackfillGmailResponse500
) & {
headers: Headers;
};
export type listBackfillGmailResponse =
| listBackfillGmailResponseSuccess
| listBackfillGmailResponseError;
export const getListBackfillGmailUrl = () => {
return `/email/backfill/gmail`;
};
export const listBackfillGmail = async (
options?: RequestInit
): Promise<listBackfillGmailResponse> => {
const res = await fetch(getListBackfillGmailUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listBackfillGmailResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listBackfillGmailResponse;
};
/**
* @summary Cancel a backfill job.
*/
export type cancelBackfillGmailResponse201 = {
data: EmptyResponse;
status: 201;
};
export type cancelBackfillGmailResponse404 = {
data: ErrorResponse;
status: 404;
};
export type cancelBackfillGmailResponse429 = {
data: ErrorResponse;
status: 429;
};
export type cancelBackfillGmailResponse500 = {
data: ErrorResponse;
status: 500;
};
export type cancelBackfillGmailResponseSuccess =
cancelBackfillGmailResponse201 & {
headers: Headers;
};
export type cancelBackfillGmailResponseError = (
| cancelBackfillGmailResponse404
| cancelBackfillGmailResponse429
| cancelBackfillGmailResponse500
) & {
headers: Headers;
};
export type cancelBackfillGmailResponse =
| cancelBackfillGmailResponseSuccess
| cancelBackfillGmailResponseError;
export const getCancelBackfillGmailUrl = () => {
return `/email/backfill/gmail`;
};
export const cancelBackfillGmail = async (
cancelBackfillParams: CancelBackfillParams,
options?: RequestInit
): Promise<cancelBackfillGmailResponse> => {
const res = await fetch(getCancelBackfillGmailUrl(), {
...options,
method: 'DELETE',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(cancelBackfillParams),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: cancelBackfillGmailResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as cancelBackfillGmailResponse;
};
/**
* @summary Get any active backfill job for the user.
*/
export type getBackfillGmailActiveResponse200 = {
data: GetActiveBackfillJobResponse;
status: 200;
};
export type getBackfillGmailActiveResponse204 = {
data: EmptyResponse;
status: 204;
};
export type getBackfillGmailActiveResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getBackfillGmailActiveResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getBackfillGmailActiveResponseSuccess = (
| getBackfillGmailActiveResponse200
| getBackfillGmailActiveResponse204
) & {
headers: Headers;
};
export type getBackfillGmailActiveResponseError = (
| getBackfillGmailActiveResponse401
| getBackfillGmailActiveResponse500
) & {
headers: Headers;
};
export type getBackfillGmailActiveResponse =
| getBackfillGmailActiveResponseSuccess
| getBackfillGmailActiveResponseError;
export const getGetBackfillGmailActiveUrl = () => {
return `/email/backfill/gmail/active`;
};
export const getBackfillGmailActive = async (
options?: RequestInit
): Promise<getBackfillGmailActiveResponse> => {
const res = await fetch(getGetBackfillGmailActiveUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getBackfillGmailActiveResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getBackfillGmailActiveResponse;
};
/**
* @summary Get a backfill job.
*/
export type getBackfillGmailResponse200 = {
data: GetBackfillJobResponse;
status: 200;
};
export type getBackfillGmailResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getBackfillGmailResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getBackfillGmailResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getBackfillGmailResponseSuccess = getBackfillGmailResponse200 & {
headers: Headers;
};
export type getBackfillGmailResponseError = (
| getBackfillGmailResponse401
| getBackfillGmailResponse404
| getBackfillGmailResponse500
) & {
headers: Headers;
};
export type getBackfillGmailResponse =
| getBackfillGmailResponseSuccess
| getBackfillGmailResponseError;
export const getGetBackfillGmailUrl = (id: string) => {
return `/email/backfill/gmail/${id}`;
};
export const getBackfillGmail = async (
id: string,
options?: RequestInit
): Promise<getBackfillGmailResponse> => {
const res = await fetch(getGetBackfillGmailUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getBackfillGmailResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getBackfillGmailResponse;
};
/**
* @summary Email one of the viewer's events to people the organizer's guest list
does not name, from the inbox that holds the viewer's copy, with the
usual undo delay, carrying the copy's join link. When the copy is Google's
private copy of an invitation from an organizer outside Google, it is a
real invitation (`METHOD:REQUEST`) naming the recipients, who answer it to
the organizer, who gets the email too. Otherwise it is the event's file
(`METHOD:PUBLISH`, no attendees): recipients can add the event to their
own calendar, are not added to the guest list, and the organizer is not
told.
*/
export type forwardCalendarEventResponse202 = {
data: ForwardCalendarEventResponse;
status: 202;
};
export type forwardCalendarEventResponse400 = {
data: ForwardCalendarEventError;
status: 400;
};
export type forwardCalendarEventResponse401 = {
data: void;
status: 401;
};
export type forwardCalendarEventResponse403 = {
data: ForwardCalendarEventError;
status: 403;
};
export type forwardCalendarEventResponse404 = {
data: ForwardCalendarEventError;
status: 404;
};
export type forwardCalendarEventResponse502 = {
data: ForwardCalendarEventError;
status: 502;
};
export type forwardCalendarEventResponseSuccess =
forwardCalendarEventResponse202 & {
headers: Headers;
};
export type forwardCalendarEventResponseError = (
| forwardCalendarEventResponse400
| forwardCalendarEventResponse401
| forwardCalendarEventResponse403
| forwardCalendarEventResponse404
| forwardCalendarEventResponse502
) & {
headers: Headers;
};
export type forwardCalendarEventResponse =
| forwardCalendarEventResponseSuccess
| forwardCalendarEventResponseError;
export const getForwardCalendarEventUrl = (eventId: string) => {
return `/email/calendar-events/${eventId}/forward`;
};
export const forwardCalendarEvent = async (
eventId: string,
forwardCalendarEventRequest: ForwardCalendarEventRequest,
options?: RequestInit
): Promise<forwardCalendarEventResponse> => {
const res = await fetch(getForwardCalendarEventUrl(eventId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(forwardCalendarEventRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: forwardCalendarEventResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as forwardCalendarEventResponse;
};
/**
* @summary List all contacts belonging to the user, grouped by link.
*/
export type listContactsResponse200 = {
data: ListContactsResponse;
status: 200;
};
export type listContactsResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listContactsResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listContactsResponseSuccess = listContactsResponse200 & {
headers: Headers;
};
export type listContactsResponseError = (
| listContactsResponse401
| listContactsResponse500
) & {
headers: Headers;
};
export type listContactsResponse =
| listContactsResponseSuccess
| listContactsResponseError;
export const getListContactsUrl = () => {
return `/email/contacts`;
};
export const listContacts = async (
options?: RequestInit
): Promise<listContactsResponse> => {
const res = await fetch(getListContactsUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listContactsResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listContactsResponse;
};
/**
* @summary Durably block a sender in the selected inbox.
*/
export type blockSenderResponse200 = {
data: void;
status: 200;
};
export type blockSenderResponse400 = {
data: ErrorResponse;
status: 400;
};
export type blockSenderResponse401 = {
data: ErrorResponse;
status: 401;
};
export type blockSenderResponse500 = {
data: ErrorResponse;
status: 500;
};
export type blockSenderResponseSuccess = blockSenderResponse200 & {
headers: Headers;
};
export type blockSenderResponseError = (
| blockSenderResponse400
| blockSenderResponse401
| blockSenderResponse500
) & {
headers: Headers;
};
export type blockSenderResponse =
| blockSenderResponseSuccess
| blockSenderResponseError;
export const getBlockSenderUrl = () => {
return `/email/contacts/block`;
};
export const blockSender = async (
blockSenderRequest: BlockSenderRequest,
options?: RequestInit
): Promise<blockSenderResponse> => {
const res = await fetch(getBlockSenderUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(blockSenderRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: blockSenderResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as blockSenderResponse;
};
/**
* @summary List all blocked senders for the authenticated user.
*/
export type listBlockedSendersResponse200 = {
data: ListBlockedResponse;
status: 200;
};
export type listBlockedSendersResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listBlockedSendersResponse403 = {
data: ErrorResponse;
status: 403;
};
export type listBlockedSendersResponse404 = {
data: ErrorResponse;
status: 404;
};
export type listBlockedSendersResponse409 = {
data: ErrorResponse;
status: 409;
};
export type listBlockedSendersResponse429 = {
data: ErrorResponse;
status: 429;
};
export type listBlockedSendersResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listBlockedSendersResponseSuccess =
listBlockedSendersResponse200 & {
headers: Headers;
};
export type listBlockedSendersResponseError = (
| listBlockedSendersResponse401
| listBlockedSendersResponse403
| listBlockedSendersResponse404
| listBlockedSendersResponse409
| listBlockedSendersResponse429
| listBlockedSendersResponse500
) & {
headers: Headers;
};
export type listBlockedSendersResponse =
| listBlockedSendersResponseSuccess
| listBlockedSendersResponseError;
export const getListBlockedSendersUrl = () => {
return `/email/contacts/blocked`;
};
export const listBlockedSenders = async (
options?: RequestInit
): Promise<listBlockedSendersResponse> => {
const res = await fetch(getListBlockedSendersUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listBlockedSendersResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listBlockedSendersResponse;
};
/**
* @summary Durably remove Macro-managed sender blocking in the selected inbox.
*/
export type unblockSenderResponse204 = {
data: void;
status: 204;
};
export type unblockSenderResponse400 = {
data: ErrorResponse;
status: 400;
};
export type unblockSenderResponse401 = {
data: ErrorResponse;
status: 401;
};
export type unblockSenderResponse500 = {
data: ErrorResponse;
status: 500;
};
export type unblockSenderResponseSuccess = unblockSenderResponse204 & {
headers: Headers;
};
export type unblockSenderResponseError = (
| unblockSenderResponse400
| unblockSenderResponse401
| unblockSenderResponse500
) & {
headers: Headers;
};
export type unblockSenderResponse =
| unblockSenderResponseSuccess
| unblockSenderResponseError;
export const getUnblockSenderUrl = () => {
return `/email/contacts/unblock`;
};
export const unblockSender = async (
unblockSenderRequest: UnblockSenderRequest,
options?: RequestInit
): Promise<unblockSenderResponse> => {
const res = await fetch(getUnblockSenderUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(unblockSenderRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: unblockSenderResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as unblockSenderResponse;
};
export type recoverDraftTransferResponse200 = {
data: TransferRecoveryResponse;
status: 200;
};
export type recoverDraftTransferResponse403 = {
data: void;
status: 403;
};
export type recoverDraftTransferResponse500 = {
data: void;
status: 500;
};
export type recoverDraftTransferResponseSuccess =
recoverDraftTransferResponse200 & {
headers: Headers;
};
export type recoverDraftTransferResponseError = (
| recoverDraftTransferResponse403
| recoverDraftTransferResponse500
) & {
headers: Headers;
};
export type recoverDraftTransferResponse =
| recoverDraftTransferResponseSuccess
| recoverDraftTransferResponseError;
export const getRecoverDraftTransferUrl = (id: string) => {
return `/email/draft-transfers/${id}/recover`;
};
export const recoverDraftTransfer = async (
id: string,
options?: RequestInit
): Promise<recoverDraftTransferResponse> => {
const res = await fetch(getRecoverDraftTransferUrl(id), {
...options,
method: 'POST',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: recoverDraftTransferResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as recoverDraftTransferResponse;
};
/**
* @summary Create a draft.
*/
export type createDraftResponse201 = {
data: CreateDraftResponse;
status: 201;
};
export type createDraftResponse400 = {
data: ErrorResponse;
status: 400;
};
export type createDraftResponse404 = {
data: ErrorResponse;
status: 404;
};
export type createDraftResponse500 = {
data: ErrorResponse;
status: 500;
};
export type createDraftResponseSuccess = createDraftResponse201 & {
headers: Headers;
};
export type createDraftResponseError = (
| createDraftResponse400
| createDraftResponse404
| createDraftResponse500
) & {
headers: Headers;
};
export type createDraftResponse =
| createDraftResponseSuccess
| createDraftResponseError;
export const getCreateDraftUrl = () => {
return `/email/drafts`;
};
export const createDraft = async (
createDraftRequest: CreateDraftRequest,
options?: RequestInit
): Promise<createDraftResponse> => {
const res = await fetch(getCreateDraftUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(createDraftRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: createDraftResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as createDraftResponse;
};
/**
* @summary List scheduled drafts.
*/
export type getScheduledMessagesResponse200 = {
data: GetScheduledResponse;
status: 200;
};
export type getScheduledMessagesResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getScheduledMessagesResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getScheduledMessagesResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getScheduledMessagesResponseSuccess =
getScheduledMessagesResponse200 & {
headers: Headers;
};
export type getScheduledMessagesResponseError = (
| getScheduledMessagesResponse400
| getScheduledMessagesResponse401
| getScheduledMessagesResponse500
) & {
headers: Headers;
};
export type getScheduledMessagesResponse =
| getScheduledMessagesResponseSuccess
| getScheduledMessagesResponseError;
export const getGetScheduledMessagesUrl = (
params?: GetScheduledMessagesParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/scheduled?${stringifiedParams}`
: `/email/drafts/scheduled`;
};
export const getScheduledMessages = async (
params?: GetScheduledMessagesParams,
options?: RequestInit
): Promise<getScheduledMessagesResponse> => {
const res = await fetch(getGetScheduledMessagesUrl(params), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getScheduledMessagesResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getScheduledMessagesResponse;
};
/**
* @summary Schedule or update a scheduled draft.
*/
export type upsertScheduledMessageResponse200 = {
data: UpsertScheduledResponse;
status: 200;
};
export type upsertScheduledMessageResponse400 = {
data: ErrorResponse;
status: 400;
};
export type upsertScheduledMessageResponse401 = {
data: ErrorResponse;
status: 401;
};
export type upsertScheduledMessageResponse403 = {
data: ErrorResponse;
status: 403;
};
export type upsertScheduledMessageResponse404 = {
data: ErrorResponse;
status: 404;
};
export type upsertScheduledMessageResponse500 = {
data: ErrorResponse;
status: 500;
};
export type upsertScheduledMessageResponseSuccess =
upsertScheduledMessageResponse200 & {
headers: Headers;
};
export type upsertScheduledMessageResponseError = (
| upsertScheduledMessageResponse400
| upsertScheduledMessageResponse401
| upsertScheduledMessageResponse403
| upsertScheduledMessageResponse404
| upsertScheduledMessageResponse500
) & {
headers: Headers;
};
export type upsertScheduledMessageResponse =
| upsertScheduledMessageResponseSuccess
| upsertScheduledMessageResponseError;
export const getUpsertScheduledMessageUrl = (
id: string,
params?: UpsertScheduledMessageParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/scheduled/${id}?${stringifiedParams}`
: `/email/drafts/scheduled/${id}`;
};
export const upsertScheduledMessage = async (
id: string,
upsertScheduledRequest: UpsertScheduledRequest,
params?: UpsertScheduledMessageParams,
options?: RequestInit
): Promise<upsertScheduledMessageResponse> => {
const res = await fetch(getUpsertScheduledMessageUrl(id, params), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(upsertScheduledRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: upsertScheduledMessageResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as upsertScheduledMessageResponse;
};
/**
* @summary Remove the scheduled send from a draft, including immediate-send undo.
*/
export type deleteScheduledDraftResponse204 = {
data: void;
status: 204;
};
export type deleteScheduledDraftResponse400 = {
data: ErrorResponse;
status: 400;
};
export type deleteScheduledDraftResponse401 = {
data: ErrorResponse;
status: 401;
};
export type deleteScheduledDraftResponse403 = {
data: ErrorResponse;
status: 403;
};
export type deleteScheduledDraftResponse404 = {
data: ErrorResponse;
status: 404;
};
export type deleteScheduledDraftResponse500 = {
data: ErrorResponse;
status: 500;
};
export type deleteScheduledDraftResponseSuccess =
deleteScheduledDraftResponse204 & {
headers: Headers;
};
export type deleteScheduledDraftResponseError = (
| deleteScheduledDraftResponse400
| deleteScheduledDraftResponse401
| deleteScheduledDraftResponse403
| deleteScheduledDraftResponse404
| deleteScheduledDraftResponse500
) & {
headers: Headers;
};
export type deleteScheduledDraftResponse =
| deleteScheduledDraftResponseSuccess
| deleteScheduledDraftResponseError;
export const getDeleteScheduledDraftUrl = (
messageId: string,
params?: DeleteScheduledDraftParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/scheduled/${messageId}?${stringifiedParams}`
: `/email/drafts/scheduled/${messageId}`;
};
export const deleteScheduledDraft = async (
messageId: string,
params?: DeleteScheduledDraftParams,
options?: RequestInit
): Promise<deleteScheduledDraftResponse> => {
const res = await fetch(getDeleteScheduledDraftUrl(messageId, params), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteScheduledDraftResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as deleteScheduledDraftResponse;
};
/**
* @summary Delete a draft.
*/
export type deleteDraftResponse204 = {
data: EmptyResponse;
status: 204;
};
export type deleteDraftResponse400 = {
data: ErrorResponse;
status: 400;
};
export type deleteDraftResponse401 = {
data: ErrorResponse;
status: 401;
};
export type deleteDraftResponse404 = {
data: ErrorResponse;
status: 404;
};
export type deleteDraftResponse500 = {
data: ErrorResponse;
status: 500;
};
export type deleteDraftResponseSuccess = deleteDraftResponse204 & {
headers: Headers;
};
export type deleteDraftResponseError = (
| deleteDraftResponse400
| deleteDraftResponse401
| deleteDraftResponse404
| deleteDraftResponse500
) & {
headers: Headers;
};
export type deleteDraftResponse =
| deleteDraftResponseSuccess
| deleteDraftResponseError;
export const getDeleteDraftUrl = (id: string, params?: DeleteDraftParams) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}?${stringifiedParams}`
: `/email/drafts/${id}`;
};
export const deleteDraft = async (
id: string,
params?: DeleteDraftParams,
options?: RequestInit
): Promise<deleteDraftResponse> => {
const res = await fetch(getDeleteDraftUrl(id, params), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteDraftResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as deleteDraftResponse;
};
/**
* @summary Add an attachment to a draft.
*/
export type addDraftAttachmentResponse201 = {
data: AddDraftAttachmentResponse;
status: 201;
};
export type addDraftAttachmentResponse400 = {
data: ErrorResponse;
status: 400;
};
export type addDraftAttachmentResponse401 = {
data: ErrorResponse;
status: 401;
};
export type addDraftAttachmentResponse404 = {
data: ErrorResponse;
status: 404;
};
export type addDraftAttachmentResponse500 = {
data: ErrorResponse;
status: 500;
};
export type addDraftAttachmentResponseSuccess =
addDraftAttachmentResponse201 & {
headers: Headers;
};
export type addDraftAttachmentResponseError = (
| addDraftAttachmentResponse400
| addDraftAttachmentResponse401
| addDraftAttachmentResponse404
| addDraftAttachmentResponse500
) & {
headers: Headers;
};
export type addDraftAttachmentResponse =
| addDraftAttachmentResponseSuccess
| addDraftAttachmentResponseError;
export const getAddDraftAttachmentUrl = (
id: string,
params?: AddDraftAttachmentParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}/attachments?${stringifiedParams}`
: `/email/drafts/${id}/attachments`;
};
export const addDraftAttachment = async (
id: string,
addDraftAttachmentRequest: AddDraftAttachmentRequest,
params?: AddDraftAttachmentParams,
options?: RequestInit
): Promise<addDraftAttachmentResponse> => {
const res = await fetch(getAddDraftAttachmentUrl(id, params), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(addDraftAttachmentRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: addDraftAttachmentResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as addDraftAttachmentResponse;
};
/**
* @summary Remove an attachment from a draft.
*/
export type removeDraftAttachmentResponse201 = {
data: EmptyResponse;
status: 201;
};
export type removeDraftAttachmentResponse400 = {
data: ErrorResponse;
status: 400;
};
export type removeDraftAttachmentResponse401 = {
data: ErrorResponse;
status: 401;
};
export type removeDraftAttachmentResponse404 = {
data: ErrorResponse;
status: 404;
};
export type removeDraftAttachmentResponse500 = {
data: ErrorResponse;
status: 500;
};
export type removeDraftAttachmentResponseSuccess =
removeDraftAttachmentResponse201 & {
headers: Headers;
};
export type removeDraftAttachmentResponseError = (
| removeDraftAttachmentResponse400
| removeDraftAttachmentResponse401
| removeDraftAttachmentResponse404
| removeDraftAttachmentResponse500
) & {
headers: Headers;
};
export type removeDraftAttachmentResponse =
| removeDraftAttachmentResponseSuccess
| removeDraftAttachmentResponseError;
export const getRemoveDraftAttachmentUrl = (
id: string,
attachmentId: string,
params?: RemoveDraftAttachmentParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}/attachments/${attachmentId}?${stringifiedParams}`
: `/email/drafts/${id}/attachments/${attachmentId}`;
};
export const removeDraftAttachment = async (
id: string,
attachmentId: string,
params?: RemoveDraftAttachmentParams,
options?: RequestInit
): Promise<removeDraftAttachmentResponse> => {
const res = await fetch(
getRemoveDraftAttachmentUrl(id, attachmentId, params),
{
...options,
method: 'DELETE',
}
);
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: removeDraftAttachmentResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as removeDraftAttachmentResponse;
};
/**
* @summary Confirm an uploaded attachment before it becomes part of a sendable draft.
*/
export type completeDraftAttachmentResponse204 = {
data: void;
status: 204;
};
export type completeDraftAttachmentResponse400 = {
data: void;
status: 400;
};
export type completeDraftAttachmentResponse403 = {
data: void;
status: 403;
};
export type completeDraftAttachmentResponse404 = {
data: void;
status: 404;
};
export type completeDraftAttachmentResponse409 = {
data: void;
status: 409;
};
export type completeDraftAttachmentResponse500 = {
data: void;
status: 500;
};
export type completeDraftAttachmentResponseSuccess =
completeDraftAttachmentResponse204 & {
headers: Headers;
};
export type completeDraftAttachmentResponseError = (
| completeDraftAttachmentResponse400
| completeDraftAttachmentResponse403
| completeDraftAttachmentResponse404
| completeDraftAttachmentResponse409
| completeDraftAttachmentResponse500
) & {
headers: Headers;
};
export type completeDraftAttachmentResponse =
| completeDraftAttachmentResponseSuccess
| completeDraftAttachmentResponseError;
export const getCompleteDraftAttachmentUrl = (
id: string,
attachmentId: string,
params?: CompleteDraftAttachmentParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}/attachments/${attachmentId}/complete?${stringifiedParams}`
: `/email/drafts/${id}/attachments/${attachmentId}/complete`;
};
export const completeDraftAttachment = async (
id: string,
attachmentId: string,
params?: CompleteDraftAttachmentParams,
options?: RequestInit
): Promise<completeDraftAttachmentResponse> => {
const res = await fetch(
getCompleteDraftAttachmentUrl(id, attachmentId, params),
{
...options,
method: 'POST',
}
);
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: completeDraftAttachmentResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as completeDraftAttachmentResponse;
};
/**
* @summary Add a forwarded attachment to a draft.
*/
export type addForwardedAttachmentResponse201 = {
data: AddForwardedAttachmentResponse;
status: 201;
};
export type addForwardedAttachmentResponse404 = {
data: ErrorResponse;
status: 404;
};
export type addForwardedAttachmentResponse500 = {
data: ErrorResponse;
status: 500;
};
export type addForwardedAttachmentResponseSuccess =
addForwardedAttachmentResponse201 & {
headers: Headers;
};
export type addForwardedAttachmentResponseError = (
| addForwardedAttachmentResponse404
| addForwardedAttachmentResponse500
) & {
headers: Headers;
};
export type addForwardedAttachmentResponse =
| addForwardedAttachmentResponseSuccess
| addForwardedAttachmentResponseError;
export const getAddForwardedAttachmentUrl = (
id: string,
params?: AddForwardedAttachmentParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}/forwarded-attachments?${stringifiedParams}`
: `/email/drafts/${id}/forwarded-attachments`;
};
export const addForwardedAttachment = async (
id: string,
addForwardedAttachmentRequest: AddForwardedAttachmentRequest,
params?: AddForwardedAttachmentParams,
options?: RequestInit
): Promise<addForwardedAttachmentResponse> => {
const res = await fetch(getAddForwardedAttachmentUrl(id, params), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(addForwardedAttachmentRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: addForwardedAttachmentResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as addForwardedAttachmentResponse;
};
/**
* @summary Remove a forwarded attachment from a draft.
*/
export type removeForwardedAttachmentResponse204 = {
data: void;
status: 204;
};
export type removeForwardedAttachmentResponse404 = {
data: ErrorResponse;
status: 404;
};
export type removeForwardedAttachmentResponse500 = {
data: ErrorResponse;
status: 500;
};
export type removeForwardedAttachmentResponseSuccess =
removeForwardedAttachmentResponse204 & {
headers: Headers;
};
export type removeForwardedAttachmentResponseError = (
| removeForwardedAttachmentResponse404
| removeForwardedAttachmentResponse500
) & {
headers: Headers;
};
export type removeForwardedAttachmentResponse =
| removeForwardedAttachmentResponseSuccess
| removeForwardedAttachmentResponseError;
export const getRemoveForwardedAttachmentUrl = (
id: string,
attachmentId: string,
params?: RemoveForwardedAttachmentParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/drafts/${id}/forwarded-attachments/${attachmentId}?${stringifiedParams}`
: `/email/drafts/${id}/forwarded-attachments/${attachmentId}`;
};
export const removeForwardedAttachment = async (
id: string,
attachmentId: string,
params?: RemoveForwardedAttachmentParams,
options?: RequestInit
): Promise<removeForwardedAttachmentResponse> => {
const res = await fetch(
getRemoveForwardedAttachmentUrl(id, attachmentId, params),
{
...options,
method: 'DELETE',
}
);
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: removeForwardedAttachmentResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as removeForwardedAttachmentResponse;
};
/**
* @summary The same provider-neutral state returned on fully hydrated email messages.
*/
export type messageOperationStatusResponse200 = {
data: MessageOperationResponse;
status: 200;
};
export type messageOperationStatusResponse403 = {
data: ErrorResponse;
status: 403;
};
export type messageOperationStatusResponse404 = {
data: ErrorResponse;
status: 404;
};
export type messageOperationStatusResponseSuccess =
messageOperationStatusResponse200 & {
headers: Headers;
};
export type messageOperationStatusResponseError = (
| messageOperationStatusResponse403
| messageOperationStatusResponse404
) & {
headers: Headers;
};
export type messageOperationStatusResponse =
| messageOperationStatusResponseSuccess
| messageOperationStatusResponseError;
export const getMessageOperationStatusUrl = (id: string) => {
return `/email/drafts/${id}/operation`;
};
export const messageOperationStatus = async (
id: string,
options?: RequestInit
): Promise<messageOperationStatusResponse> => {
const res = await fetch(getMessageOperationStatusUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: messageOperationStatusResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as messageOperationStatusResponse;
};
/**
* @summary Resolve an observed draft conflict or uncertain provider operation.
*/
export type resolveMessageOperationResponse204 = {
data: void;
status: 204;
};
export type resolveMessageOperationResponse400 = {
data: ErrorResponse;
status: 400;
};
export type resolveMessageOperationResponse403 = {
data: ErrorResponse;
status: 403;
};
export type resolveMessageOperationResponse404 = {
data: ErrorResponse;
status: 404;
};
export type resolveMessageOperationResponse409 = {
data: ErrorResponse;
status: 409;
};
export type resolveMessageOperationResponseSuccess =
resolveMessageOperationResponse204 & {
headers: Headers;
};
export type resolveMessageOperationResponseError = (
| resolveMessageOperationResponse400
| resolveMessageOperationResponse403
| resolveMessageOperationResponse404
| resolveMessageOperationResponse409
) & {
headers: Headers;
};
export type resolveMessageOperationResponse =
| resolveMessageOperationResponseSuccess
| resolveMessageOperationResponseError;
export const getResolveMessageOperationUrl = (id: string) => {
return `/email/drafts/${id}/resolve`;
};
export const resolveMessageOperation = async (
id: string,
resolveMessageOperationRequest: ResolveMessageOperationRequest,
options?: RequestInit
): Promise<resolveMessageOperationResponse> => {
const res = await fetch(getResolveMessageOperationUrl(id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(resolveMessageOperationRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: resolveMessageOperationResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as resolveMessageOperationResponse;
};
export type transferDraftResponse200 = {
data: TransferDraftResponse;
status: 200;
};
export type transferDraftResponse403 = {
data: void;
status: 403;
};
export type transferDraftResponse404 = {
data: void;
status: 404;
};
export type transferDraftResponse409 = {
data: void;
status: 409;
};
export type transferDraftResponse500 = {
data: void;
status: 500;
};
export type transferDraftResponseSuccess = transferDraftResponse200 & {
headers: Headers;
};
export type transferDraftResponseError = (
| transferDraftResponse403
| transferDraftResponse404
| transferDraftResponse409
| transferDraftResponse500
) & {
headers: Headers;
};
export type transferDraftResponse =
| transferDraftResponseSuccess
| transferDraftResponseError;
export const getTransferDraftUrl = (id: string) => {
return `/email/drafts/${id}/transfer`;
};
export const transferDraft = async (
id: string,
transferDraftRequest: TransferDraftRequest,
options?: RequestInit
): Promise<transferDraftResponse> => {
const res = await fetch(getTransferDraftUrl(id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(transferDraftRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: transferDraftResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as transferDraftResponse;
};
/**
* @summary List all email filters for the current user.
*/
export type listEmailFiltersResponse200 = {
data: ListEmailFiltersResponse;
status: 200;
};
export type listEmailFiltersResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listEmailFiltersResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listEmailFiltersResponseSuccess = listEmailFiltersResponse200 & {
headers: Headers;
};
export type listEmailFiltersResponseError = (
| listEmailFiltersResponse401
| listEmailFiltersResponse500
) & {
headers: Headers;
};
export type listEmailFiltersResponse =
| listEmailFiltersResponseSuccess
| listEmailFiltersResponseError;
export const getListEmailFiltersUrl = () => {
return `/email/filters`;
};
export const listEmailFilters = async (
options?: RequestInit
): Promise<listEmailFiltersResponse> => {
const res = await fetch(getListEmailFiltersUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listEmailFiltersResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listEmailFiltersResponse;
};
/**
* @summary Create or update an email filter.
*/
export type upsertEmailFilterResponse200 = {
data: UpsertEmailFilterResponse;
status: 200;
};
export type upsertEmailFilterResponse400 = {
data: ErrorResponse;
status: 400;
};
export type upsertEmailFilterResponse401 = {
data: ErrorResponse;
status: 401;
};
export type upsertEmailFilterResponse500 = {
data: ErrorResponse;
status: 500;
};
export type upsertEmailFilterResponseSuccess = upsertEmailFilterResponse200 & {
headers: Headers;
};
export type upsertEmailFilterResponseError = (
| upsertEmailFilterResponse400
| upsertEmailFilterResponse401
| upsertEmailFilterResponse500
) & {
headers: Headers;
};
export type upsertEmailFilterResponse =
| upsertEmailFilterResponseSuccess
| upsertEmailFilterResponseError;
export const getUpsertEmailFilterUrl = () => {
return `/email/filters`;
};
export const upsertEmailFilter = async (
upsertEmailFilterRequest: UpsertEmailFilterRequest,
options?: RequestInit
): Promise<upsertEmailFilterResponse> => {
const res = await fetch(getUpsertEmailFilterUrl(), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(upsertEmailFilterRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: upsertEmailFilterResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as upsertEmailFilterResponse;
};
/**
* @summary Delete an email filter by ID.
*/
export type deleteEmailFilterResponse204 = {
data: void;
status: 204;
};
export type deleteEmailFilterResponse401 = {
data: ErrorResponse;
status: 401;
};
export type deleteEmailFilterResponse404 = {
data: ErrorResponse;
status: 404;
};
export type deleteEmailFilterResponse500 = {
data: ErrorResponse;
status: 500;
};
export type deleteEmailFilterResponseSuccess = deleteEmailFilterResponse204 & {
headers: Headers;
};
export type deleteEmailFilterResponseError = (
| deleteEmailFilterResponse401
| deleteEmailFilterResponse404
| deleteEmailFilterResponse500
) & {
headers: Headers;
};
export type deleteEmailFilterResponse =
| deleteEmailFilterResponseSuccess
| deleteEmailFilterResponseError;
export const getDeleteEmailFilterUrl = (id: string) => {
return `/email/filters/${id}`;
};
export const deleteEmailFilter = async (
id: string,
options?: RequestInit
): Promise<deleteEmailFilterResponse> => {
const res = await fetch(getDeleteEmailFilterUrl(id), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteEmailFilterResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as deleteEmailFilterResponse;
};
/**
* @summary Initialize email functionality for the user. Populates initial threads and enables inbox syncing.
*/
export type initUserResponse200 = {
data: InitResponse;
status: 200;
};
export type initUserResponse400 = {
data: InitErrorCodeResponse;
status: 400;
};
export type initUserResponse401 = {
data: ErrorResponse;
status: 401;
};
export type initUserResponse402 = {
data: ErrorResponse;
status: 402;
};
export type initUserResponse409 = {
data: SharedInboxConflictResponse;
status: 409;
};
export type initUserResponse429 = {
data: ErrorResponse;
status: 429;
};
export type initUserResponse500 = {
data: ErrorResponse;
status: 500;
};
export type initUserResponseSuccess = initUserResponse200 & {
headers: Headers;
};
export type initUserResponseError = (
| initUserResponse400
| initUserResponse401
| initUserResponse402
| initUserResponse409
| initUserResponse429
| initUserResponse500
) & {
headers: Headers;
};
export type initUserResponse = initUserResponseSuccess | initUserResponseError;
export const getInitUserUrl = (params?: InitUserParams) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/init?${stringifiedParams}`
: `/email/init`;
};
export const initUser = async (
params?: InitUserParams,
options?: RequestInit
): Promise<initUserResponse> => {
const res = await fetch(getInitUserUrl(params), {
...options,
method: 'POST',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: initUserResponse['data'] = body ? JSON.parse(body) : {};
return { data, status: res.status, headers: res.headers } as initUserResponse;
};
/**
* @summary List all labels for the user's email link.
*/
export type listLabelsResponse200 = {
data: ListLabelsResponse;
status: 200;
};
export type listLabelsResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listLabelsResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listLabelsResponseSuccess = listLabelsResponse200 & {
headers: Headers;
};
export type listLabelsResponseError = (
| listLabelsResponse401
| listLabelsResponse500
) & {
headers: Headers;
};
export type listLabelsResponse =
| listLabelsResponseSuccess
| listLabelsResponseError;
export const getListLabelsUrl = () => {
return `/email/labels`;
};
export const listLabels = async (
options?: RequestInit
): Promise<listLabelsResponse> => {
const res = await fetch(getListLabelsUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listLabelsResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listLabelsResponse;
};
/**
* @summary Create a label.
*/
export type createLabelResponse201 = {
data: CreateLabelResponse;
status: 201;
};
export type createLabelResponse400 = {
data: ErrorResponse;
status: 400;
};
export type createLabelResponse401 = {
data: ErrorResponse;
status: 401;
};
export type createLabelResponse403 = {
data: ErrorResponse;
status: 403;
};
export type createLabelResponse404 = {
data: ErrorResponse;
status: 404;
};
export type createLabelResponse409 = {
data: ErrorResponse;
status: 409;
};
export type createLabelResponse429 = {
data: ErrorResponse;
status: 429;
};
export type createLabelResponse500 = {
data: ErrorResponse;
status: 500;
};
export type createLabelResponseSuccess = createLabelResponse201 & {
headers: Headers;
};
export type createLabelResponseError = (
| createLabelResponse400
| createLabelResponse401
| createLabelResponse403
| createLabelResponse404
| createLabelResponse409
| createLabelResponse429
| createLabelResponse500
) & {
headers: Headers;
};
export type createLabelResponse =
| createLabelResponseSuccess
| createLabelResponseError;
export const getCreateLabelUrl = () => {
return `/email/labels`;
};
export const createLabel = async (
createLabelRequest: CreateLabelRequest,
options?: RequestInit
): Promise<createLabelResponse> => {
const res = await fetch(getCreateLabelUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(createLabelRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: createLabelResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as createLabelResponse;
};
/**
* @summary Delete a label.
*/
export type deleteLabelResponse204 = {
data: EmptyResponse;
status: 204;
};
export type deleteLabelResponse400 = {
data: ErrorResponse;
status: 400;
};
export type deleteLabelResponse401 = {
data: ErrorResponse;
status: 401;
};
export type deleteLabelResponse404 = {
data: ErrorResponse;
status: 404;
};
export type deleteLabelResponse500 = {
data: ErrorResponse;
status: 500;
};
export type deleteLabelResponseSuccess = deleteLabelResponse204 & {
headers: Headers;
};
export type deleteLabelResponseError = (
| deleteLabelResponse400
| deleteLabelResponse401
| deleteLabelResponse404
| deleteLabelResponse500
) & {
headers: Headers;
};
export type deleteLabelResponse =
| deleteLabelResponseSuccess
| deleteLabelResponseError;
export const getDeleteLabelUrl = (id: string) => {
return `/email/labels/${id}`;
};
export const deleteLabel = async (
id: string,
options?: RequestInit
): Promise<deleteLabelResponse> => {
const res = await fetch(getDeleteLabelUrl(id), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteLabelResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as deleteLabelResponse;
};
/**
* @summary List all links belonging to the user.
*/
export type listLinksResponse200 = {
data: ListLinksResponse;
status: 200;
};
export type listLinksResponse401 = {
data: ErrorResponse;
status: 401;
};
export type listLinksResponse404 = {
data: ErrorResponse;
status: 404;
};
export type listLinksResponse500 = {
data: ErrorResponse;
status: 500;
};
export type listLinksResponseSuccess = listLinksResponse200 & {
headers: Headers;
};
export type listLinksResponseError = (
| listLinksResponse401
| listLinksResponse404
| listLinksResponse500
) & {
headers: Headers;
};
export type listLinksResponse =
| listLinksResponseSuccess
| listLinksResponseError;
export const getListLinksUrl = () => {
return `/email/links`;
};
export const listLinks = async (
options?: RequestInit
): Promise<listLinksResponse> => {
const res = await fetch(getListLinksUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: listLinksResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as listLinksResponse;
};
/**
* Probes are durably queued and the response returns immediately to stay off the
load path; each persisted flag is picked up by the next links read. Probes are
throttled per link in Redis so frequent calls — and many sharers of a shared inbox —
collapse to one refresh per window.
* @summary Probes the live auth state of each of the caller's inboxes (owned and delegated)
against the auth service and records the result on each link. A grant that died
while the caller was inactive is detected here within minutes instead of waiting on
the daily refresh sweep; the side effects (clearing or setting the reauth flag, and
the one-time reauth fan-out) are handled by the email service token source.
*/
export type healthCheckLinksResponse202 = {
data: EmptyResponse;
status: 202;
};
export type healthCheckLinksResponse401 = {
data: ErrorResponse;
status: 401;
};
export type healthCheckLinksResponse500 = {
data: ErrorResponse;
status: 500;
};
export type healthCheckLinksResponseSuccess = healthCheckLinksResponse202 & {
headers: Headers;
};
export type healthCheckLinksResponseError = (
| healthCheckLinksResponse401
| healthCheckLinksResponse500
) & {
headers: Headers;
};
export type healthCheckLinksResponse =
| healthCheckLinksResponseSuccess
| healthCheckLinksResponseError;
export const getHealthCheckLinksUrl = () => {
return `/email/links/health-check`;
};
export const healthCheckLinks = async (
options?: RequestInit
): Promise<healthCheckLinksResponse> => {
const res = await fetch(getHealthCheckLinksUrl(), {
...options,
method: 'POST',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: healthCheckLinksResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as healthCheckLinksResponse;
};
/**
* For an inbox the caller owns this enqueues a full cascade teardown
(`LinkManagerMessage::DeleteLink`). For an inbox reached via delegation it
only drops the `macro_user_links` edge, leaving the owner's data intact.
* @summary Removes a linked inbox.
*/
export type deleteLinkResponse204 = {
data: EmptyResponse;
status: 204;
};
export type deleteLinkResponse401 = {
data: ErrorResponse;
status: 401;
};
export type deleteLinkResponse403 = {
data: ErrorResponse;
status: 403;
};
export type deleteLinkResponse404 = {
data: ErrorResponse;
status: 404;
};
export type deleteLinkResponse500 = {
data: ErrorResponse;
status: 500;
};
export type deleteLinkResponseSuccess = deleteLinkResponse204 & {
headers: Headers;
};
export type deleteLinkResponseError = (
| deleteLinkResponse401
| deleteLinkResponse403
| deleteLinkResponse404
| deleteLinkResponse500
) & {
headers: Headers;
};
export type deleteLinkResponse =
| deleteLinkResponseSuccess
| deleteLinkResponseError;
export const getDeleteLinkUrl = (linkId: string) => {
return `/email/links/${linkId}`;
};
export const deleteLink = async (
linkId: string,
options?: RequestInit
): Promise<deleteLinkResponse> => {
const res = await fetch(getDeleteLinkUrl(linkId), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteLinkResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as deleteLinkResponse;
};
/**
* Removes the inbox's calendar data, drops the calendar scopes from its
recorded Google grant, and closes its push channels, so the inbox reads as
calendar-less until the user runs the calendar consent flow again. Gmail
sync is untouched.
Only the inbox's owner may do this: a delegate can see the owner's calendar
but must not be able to delete the owner's data.
* @summary Turns calendar off for a connected inbox.
*/
export type disableLinkCalendarResponse204 = {
data: EmptyResponse;
status: 204;
};
export type disableLinkCalendarResponse401 = {
data: ErrorResponse;
status: 401;
};
export type disableLinkCalendarResponse403 = {
data: ErrorResponse;
status: 403;
};
export type disableLinkCalendarResponse404 = {
data: ErrorResponse;
status: 404;
};
export type disableLinkCalendarResponse500 = {
data: ErrorResponse;
status: 500;
};
export type disableLinkCalendarResponseSuccess =
disableLinkCalendarResponse204 & {
headers: Headers;
};
export type disableLinkCalendarResponseError = (
| disableLinkCalendarResponse401
| disableLinkCalendarResponse403
| disableLinkCalendarResponse404
| disableLinkCalendarResponse500
) & {
headers: Headers;
};
export type disableLinkCalendarResponse =
| disableLinkCalendarResponseSuccess
| disableLinkCalendarResponseError;
export const getDisableLinkCalendarUrl = (linkId: string) => {
return `/email/links/${linkId}/calendar`;
};
export const disableLinkCalendar = async (
linkId: string,
options?: RequestInit
): Promise<disableLinkCalendarResponse> => {
const res = await fetch(getDisableLinkCalendarUrl(linkId), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: disableLinkCalendarResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as disableLinkCalendarResponse;
};
/**
* Idempotent: if a backfill is already `Init`/`InProgress` for the inbox this is
a no-op and returns that job.
* @summary Re-syncs a linked inbox by enqueuing a fresh backfill.
*/
export type resyncLinkResponse200 = {
data: ResyncResponse;
status: 200;
};
export type resyncLinkResponse401 = {
data: ErrorResponse;
status: 401;
};
export type resyncLinkResponse403 = {
data: ErrorResponse;
status: 403;
};
export type resyncLinkResponse404 = {
data: ErrorResponse;
status: 404;
};
export type resyncLinkResponse500 = {
data: ErrorResponse;
status: 500;
};
export type resyncLinkResponseSuccess = resyncLinkResponse200 & {
headers: Headers;
};
export type resyncLinkResponseError = (
| resyncLinkResponse401
| resyncLinkResponse403
| resyncLinkResponse404
| resyncLinkResponse500
) & {
headers: Headers;
};
export type resyncLinkResponse =
| resyncLinkResponseSuccess
| resyncLinkResponseError;
export const getResyncLinkUrl = (linkId: string) => {
return `/email/links/${linkId}/resync`;
};
export const resyncLink = async (
linkId: string,
options?: RequestInit
): Promise<resyncLinkResponse> => {
const res = await fetch(getResyncLinkUrl(linkId), {
...options,
method: 'POST',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: resyncLinkResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as resyncLinkResponse;
};
/**
* @summary Send a message.
*/
export type sendMessageResponse201 = {
data: SendMessageResponse;
status: 201;
};
export type sendMessageResponse400 = {
data: ErrorResponse;
status: 400;
};
export type sendMessageResponse403 = {
data: ErrorResponse;
status: 403;
};
export type sendMessageResponse404 = {
data: ErrorResponse;
status: 404;
};
export type sendMessageResponse500 = {
data: ErrorResponse;
status: 500;
};
export type sendMessageResponseSuccess = sendMessageResponse201 & {
headers: Headers;
};
export type sendMessageResponseError = (
| sendMessageResponse400
| sendMessageResponse403
| sendMessageResponse404
| sendMessageResponse500
) & {
headers: Headers;
};
export type sendMessageResponse =
| sendMessageResponseSuccess
| sendMessageResponseError;
export const getSendMessageUrl = () => {
return `/email/messages`;
};
export const sendMessage = async (
sendMessageRequest: SendMessageRequest,
options?: RequestInit
): Promise<sendMessageResponse> => {
const res = await fetch(getSendMessageUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sendMessageRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: sendMessageResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as sendMessageResponse;
};
export type getMessagesBatchResponse200 = {
data: ParsedMessage[];
status: 200;
};
export type getMessagesBatchResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getMessagesBatchResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getMessagesBatchResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getMessagesBatchResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getMessagesBatchResponseSuccess = getMessagesBatchResponse200 & {
headers: Headers;
};
export type getMessagesBatchResponseError = (
| getMessagesBatchResponse400
| getMessagesBatchResponse401
| getMessagesBatchResponse404
| getMessagesBatchResponse500
) & {
headers: Headers;
};
export type getMessagesBatchResponse =
| getMessagesBatchResponseSuccess
| getMessagesBatchResponseError;
export const getGetMessagesBatchUrl = () => {
return `/email/messages/batch`;
};
export const getMessagesBatch = async (
getMessagesBatchBody: string[],
options?: RequestInit
): Promise<getMessagesBatchResponse> => {
const res = await fetch(getGetMessagesBatchUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(getMessagesBatchBody),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getMessagesBatchResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getMessagesBatchResponse;
};
/**
* @summary Add or remove a label from a batch of messages
*/
export type addRemoveLabelResponse200 = {
data: UpdateLabelBatchResponse;
status: 200;
};
export type addRemoveLabelResponse400 = {
data: ErrorResponse;
status: 400;
};
export type addRemoveLabelResponse401 = {
data: ErrorResponse;
status: 401;
};
export type addRemoveLabelResponse404 = {
data: ErrorResponse;
status: 404;
};
export type addRemoveLabelResponse500 = {
data: ErrorResponse;
status: 500;
};
export type addRemoveLabelResponseSuccess = addRemoveLabelResponse200 & {
headers: Headers;
};
export type addRemoveLabelResponseError = (
| addRemoveLabelResponse400
| addRemoveLabelResponse401
| addRemoveLabelResponse404
| addRemoveLabelResponse500
) & {
headers: Headers;
};
export type addRemoveLabelResponse =
| addRemoveLabelResponseSuccess
| addRemoveLabelResponseError;
export const getAddRemoveLabelUrl = () => {
return `/email/messages/labels`;
};
export const addRemoveLabel = async (
updateLabelBatchRequest: UpdateLabelBatchRequest,
options?: RequestInit
): Promise<addRemoveLabelResponse> => {
const res = await fetch(getAddRemoveLabelUrl(), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(updateLabelBatchRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: addRemoveLabelResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as addRemoveLabelResponse;
};
export type getMessageResponse200 = {
data: ParsedMessage;
status: 200;
};
export type getMessageResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getMessageResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getMessageResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getMessageResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getMessageResponseSuccess = getMessageResponse200 & {
headers: Headers;
};
export type getMessageResponseError = (
| getMessageResponse400
| getMessageResponse401
| getMessageResponse404
| getMessageResponse500
) & {
headers: Headers;
};
export type getMessageResponse =
| getMessageResponseSuccess
| getMessageResponseError;
export const getGetMessageUrl = (id: string) => {
return `/email/messages/${id}`;
};
export const getMessage = async (
id: string,
options?: RequestInit
): Promise<getMessageResponse> => {
const res = await fetch(getGetMessageUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getMessageResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getMessageResponse;
};
/**
* @summary Download a message's original source as an `.eml` file.
*/
export type getMessageEmlResponse200 = {
data: EmlFile;
status: 200;
};
export type getMessageEmlResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getMessageEmlResponse403 = {
data: ErrorResponse;
status: 403;
};
export type getMessageEmlResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getMessageEmlResponse409 = {
data: ErrorResponse;
status: 409;
};
export type getMessageEmlResponse429 = {
data: ErrorResponse;
status: 429;
};
export type getMessageEmlResponse503 = {
data: ErrorResponse;
status: 503;
};
export type getMessageEmlResponseSuccess = getMessageEmlResponse200 & {
headers: Headers;
};
export type getMessageEmlResponseError = (
| getMessageEmlResponse401
| getMessageEmlResponse403
| getMessageEmlResponse404
| getMessageEmlResponse409
| getMessageEmlResponse429
| getMessageEmlResponse503
) & {
headers: Headers;
};
export type getMessageEmlResponse =
| getMessageEmlResponseSuccess
| getMessageEmlResponseError;
export const getGetMessageEmlUrl = (id: string) => {
return `/email/messages/${id}/eml`;
};
export const getMessageEml = async (
id: string,
options?: RequestInit
): Promise<getMessageEmlResponse> => {
const res = await fetch(getGetMessageEmlUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getMessageEmlResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getMessageEmlResponse;
};
/**
* @summary Patch user settings.
*/
export type patchSettingsResponse200 = {
data: PatchSettingsResponse;
status: 200;
};
export type patchSettingsResponse400 = {
data: ErrorResponse;
status: 400;
};
export type patchSettingsResponse401 = {
data: ErrorResponse;
status: 401;
};
export type patchSettingsResponse422 = {
data: UnresolvedSignatureImagesError;
status: 422;
};
export type patchSettingsResponse500 = {
data: ErrorResponse;
status: 500;
};
export type patchSettingsResponseSuccess = patchSettingsResponse200 & {
headers: Headers;
};
export type patchSettingsResponseError = (
| patchSettingsResponse400
| patchSettingsResponse401
| patchSettingsResponse422
| patchSettingsResponse500
) & {
headers: Headers;
};
export type patchSettingsResponse =
| patchSettingsResponseSuccess
| patchSettingsResponseError;
export const getPatchSettingsUrl = () => {
return `/email/settings`;
};
export const patchSettings = async (
patchSettingsRequest: PatchSettingsRequest,
options?: RequestInit
): Promise<patchSettingsResponse> => {
const res = await fetch(getPatchSettingsUrl(), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchSettingsRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: patchSettingsResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as patchSettingsResponse;
};
/**
* @summary Accepted label and sender-policy changes awaiting provider confirmation.
*/
export type mailboxSettingsOperationsResponse200 = {
data: MailboxSettingsOperation[];
status: 200;
};
export type mailboxSettingsOperationsResponseSuccess =
mailboxSettingsOperationsResponse200 & {
headers: Headers;
};
export type mailboxSettingsOperationsResponse =
mailboxSettingsOperationsResponseSuccess;
export const getMailboxSettingsOperationsUrl = () => {
return `/email/settings/operations`;
};
export const mailboxSettingsOperations = async (
options?: RequestInit
): Promise<mailboxSettingsOperationsResponse> => {
const res = await fetch(getMailboxSettingsOperationsUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: mailboxSettingsOperationsResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as mailboxSettingsOperationsResponse;
};
/**
* The inbox is the caller's primary, or the one named by `X-Email-Link-Id`,
which may be an inbox the caller only reaches through delegation. Removal
therefore follows the same policy as `DELETE /email/links/{link_id}`: an
owner's inbox is torn down, while a delegate only loses their
`macro_user_links` edge and the owner's data stays intact.
* @summary Disables inbox syncing for the selected inbox.
*/
export type disableSyncResponse204 = {
data: EmptyResponse;
status: 204;
};
export type disableSyncResponse400 = {
data: ErrorResponse;
status: 400;
};
export type disableSyncResponse401 = {
data: ErrorResponse;
status: 401;
};
export type disableSyncResponse403 = {
data: ErrorResponse;
status: 403;
};
export type disableSyncResponse404 = {
data: ErrorResponse;
status: 404;
};
export type disableSyncResponse409 = {
data: ErrorResponse;
status: 409;
};
export type disableSyncResponse500 = {
data: ErrorResponse;
status: 500;
};
export type disableSyncResponseSuccess = disableSyncResponse204 & {
headers: Headers;
};
export type disableSyncResponseError = (
| disableSyncResponse400
| disableSyncResponse401
| disableSyncResponse403
| disableSyncResponse404
| disableSyncResponse409
| disableSyncResponse500
) & {
headers: Headers;
};
export type disableSyncResponse =
| disableSyncResponseSuccess
| disableSyncResponseError;
export const getDisableSyncUrl = () => {
return `/email/sync`;
};
export const disableSync = async (
options?: RequestInit
): Promise<disableSyncResponse> => {
const res = await fetch(getDisableSyncUrl(), {
...options,
method: 'DELETE',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: disableSyncResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as disableSyncResponse;
};
/**
* @summary Change the archived status of up to 100 threads, sending one provider
write per inbox. A thread that can't change is reported, not fatal.
*/
export type archiveThreadsResponse200 = {
data: ArchiveThreadsResponse;
status: 200;
};
export type archiveThreadsResponse400 = {
data: ErrorResponse;
status: 400;
};
export type archiveThreadsResponse401 = {
data: ErrorResponse;
status: 401;
};
export type archiveThreadsResponse500 = {
data: ErrorResponse;
status: 500;
};
export type archiveThreadsResponseSuccess = archiveThreadsResponse200 & {
headers: Headers;
};
export type archiveThreadsResponseError = (
| archiveThreadsResponse400
| archiveThreadsResponse401
| archiveThreadsResponse500
) & {
headers: Headers;
};
export type archiveThreadsResponse =
| archiveThreadsResponseSuccess
| archiveThreadsResponseError;
export const getArchiveThreadsUrl = () => {
return `/email/threads/archived`;
};
export const archiveThreads = async (
archiveThreadsRequest: ArchiveThreadsRequest,
options?: RequestInit
): Promise<archiveThreadsResponse> => {
const res = await fetch(getArchiveThreadsUrl(), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(archiveThreadsRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: archiveThreadsResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as archiveThreadsResponse;
};
/**
* @summary Get paginated thread previews with cursor-based pagination.
*/
export type previewsInboxCursorResponse200 = {
data: ApiPaginatedThreadCursor;
status: 200;
};
export type previewsInboxCursorResponse400 = {
data: ErrorResponse;
status: 400;
};
export type previewsInboxCursorResponse401 = {
data: ErrorResponse;
status: 401;
};
export type previewsInboxCursorResponse500 = {
data: ErrorResponse;
status: 500;
};
export type previewsInboxCursorResponseSuccess =
previewsInboxCursorResponse200 & {
headers: Headers;
};
export type previewsInboxCursorResponseError = (
| previewsInboxCursorResponse400
| previewsInboxCursorResponse401
| previewsInboxCursorResponse500
) & {
headers: Headers;
};
export type previewsInboxCursorResponse =
| previewsInboxCursorResponseSuccess
| previewsInboxCursorResponseError;
export const getPreviewsInboxCursorUrl = (
view: string,
params?: PreviewsInboxCursorParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/threads/previews/cursor/${view}?${stringifiedParams}`
: `/email/threads/previews/cursor/${view}`;
};
export const previewsInboxCursor = async (
view: string,
params?: PreviewsInboxCursorParams,
options?: RequestInit
): Promise<previewsInboxCursorResponse> => {
const res = await fetch(getPreviewsInboxCursorUrl(view, params), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: previewsInboxCursorResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as previewsInboxCursorResponse;
};
/**
* @summary Change the archived status of a thread.
*/
export type archiveThreadResponse200 = {
data: EmptyResponse;
status: 200;
};
export type archiveThreadResponse401 = {
data: ErrorResponse;
status: 401;
};
export type archiveThreadResponse404 = {
data: ErrorResponse;
status: 404;
};
export type archiveThreadResponse500 = {
data: ErrorResponse;
status: 500;
};
export type archiveThreadResponseSuccess = archiveThreadResponse200 & {
headers: Headers;
};
export type archiveThreadResponseError = (
| archiveThreadResponse401
| archiveThreadResponse404
| archiveThreadResponse500
) & {
headers: Headers;
};
export type archiveThreadResponse =
| archiveThreadResponseSuccess
| archiveThreadResponseError;
export const getArchiveThreadUrl = (id: string) => {
return `/email/threads/${id}/archived`;
};
export const archiveThread = async (
id: string,
archiveThreadRequest: ArchiveThreadRequest,
options?: RequestInit
): Promise<archiveThreadResponse> => {
const res = await fetch(getArchiveThreadUrl(id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(archiveThreadRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: archiveThreadResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as archiveThreadResponse;
};
/**
* @summary Add or remove a label from all messages in a thread.
*/
export type addRemoveThreadLabelResponse200 = {
data: UpdateThreadLabelsResponse;
status: 200;
};
export type addRemoveThreadLabelResponse400 = {
data: ErrorResponse;
status: 400;
};
export type addRemoveThreadLabelResponse401 = {
data: ErrorResponse;
status: 401;
};
export type addRemoveThreadLabelResponse404 = {
data: ErrorResponse;
status: 404;
};
export type addRemoveThreadLabelResponse500 = {
data: ErrorResponse;
status: 500;
};
export type addRemoveThreadLabelResponseSuccess =
addRemoveThreadLabelResponse200 & {
headers: Headers;
};
export type addRemoveThreadLabelResponseError = (
| addRemoveThreadLabelResponse400
| addRemoveThreadLabelResponse401
| addRemoveThreadLabelResponse404
| addRemoveThreadLabelResponse500
) & {
headers: Headers;
};
export type addRemoveThreadLabelResponse =
| addRemoveThreadLabelResponseSuccess
| addRemoveThreadLabelResponseError;
export const getAddRemoveThreadLabelUrl = (id: string) => {
return `/email/threads/${id}/labels`;
};
export const addRemoveThreadLabel = async (
id: string,
updateThreadLabelRequest: UpdateThreadLabelRequest,
options?: RequestInit
): Promise<addRemoveThreadLabelResponse> => {
const res = await fetch(getAddRemoveThreadLabelUrl(id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(updateThreadLabelRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: addRemoveThreadLabelResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as addRemoveThreadLabelResponse;
};
export type getThreadMessagesHandlerResponse200 = {
data: ParsedMessage[];
status: 200;
};
export type getThreadMessagesHandlerResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getThreadMessagesHandlerResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getThreadMessagesHandlerResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getThreadMessagesHandlerResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getThreadMessagesHandlerResponseSuccess =
getThreadMessagesHandlerResponse200 & {
headers: Headers;
};
export type getThreadMessagesHandlerResponseError = (
| getThreadMessagesHandlerResponse400
| getThreadMessagesHandlerResponse401
| getThreadMessagesHandlerResponse404
| getThreadMessagesHandlerResponse500
) & {
headers: Headers;
};
export type getThreadMessagesHandlerResponse =
| getThreadMessagesHandlerResponseSuccess
| getThreadMessagesHandlerResponseError;
export const getGetThreadMessagesHandlerUrl = (
id: string,
params?: GetThreadMessagesHandlerParams
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/threads/${id}/messages?${stringifiedParams}`
: `/email/threads/${id}/messages`;
};
export const getThreadMessagesHandler = async (
id: string,
params?: GetThreadMessagesHandlerParams,
options?: RequestInit
): Promise<getThreadMessagesHandlerResponse> => {
const res = await fetch(getGetThreadMessagesHandlerUrl(id, params), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getThreadMessagesHandlerResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getThreadMessagesHandlerResponse;
};
/**
* @summary Fetch the latest organization action outcomes without provider-specific status strings.
*/
export type threadOperationsResponse200 = {
data: MailboxOperation[];
status: 200;
};
export type threadOperationsResponse404 = {
data: ErrorResponse;
status: 404;
};
export type threadOperationsResponseSuccess = threadOperationsResponse200 & {
headers: Headers;
};
export type threadOperationsResponseError = threadOperationsResponse404 & {
headers: Headers;
};
export type threadOperationsResponse =
| threadOperationsResponseSuccess
| threadOperationsResponseError;
export const getThreadOperationsUrl = (id: string) => {
return `/email/threads/${id}/operations`;
};
export const threadOperations = async (
id: string,
options?: RequestInit
): Promise<threadOperationsResponse> => {
const res = await fetch(getThreadOperationsUrl(id), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: threadOperationsResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as threadOperationsResponse;
};
/**
* @summary Called by FE when the user has seen a thread.
*/
export type threadSeenResponse200 = {
data: EmptyResponse;
status: 200;
};
export type threadSeenResponse401 = {
data: ErrorResponse;
status: 401;
};
export type threadSeenResponse404 = {
data: ErrorResponse;
status: 404;
};
export type threadSeenResponse500 = {
data: ErrorResponse;
status: 500;
};
export type threadSeenResponseSuccess = threadSeenResponse200 & {
headers: Headers;
};
export type threadSeenResponseError = (
| threadSeenResponse401
| threadSeenResponse404
| threadSeenResponse500
) & {
headers: Headers;
};
export type threadSeenResponse =
| threadSeenResponseSuccess
| threadSeenResponseError;
export const getThreadSeenUrl = (id: string) => {
return `/email/threads/${id}/seen`;
};
export const threadSeen = async (
id: string,
options?: RequestInit
): Promise<threadSeenResponse> => {
const res = await fetch(getThreadSeenUrl(id), {
...options,
method: 'POST',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: threadSeenResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as threadSeenResponse;
};
/**
* @summary Set mailbox state without client-side provider label lookup.
*/
export type updateThreadStateResponse204 = {
data: void;
status: 204;
};
export type updateThreadStateResponse400 = {
data: ErrorResponse;
status: 400;
};
export type updateThreadStateResponse401 = {
data: ErrorResponse;
status: 401;
};
export type updateThreadStateResponse404 = {
data: ErrorResponse;
status: 404;
};
export type updateThreadStateResponse409 = {
data: ErrorResponse;
status: 409;
};
export type updateThreadStateResponseSuccess = updateThreadStateResponse204 & {
headers: Headers;
};
export type updateThreadStateResponseError = (
| updateThreadStateResponse400
| updateThreadStateResponse401
| updateThreadStateResponse404
| updateThreadStateResponse409
) & {
headers: Headers;
};
export type updateThreadStateResponse =
| updateThreadStateResponseSuccess
| updateThreadStateResponseError;
export const getUpdateThreadStateUrl = (id: string) => {
return `/email/threads/${id}/state`;
};
export const updateThreadState = async (
id: string,
updateThreadStateRequest: UpdateThreadStateRequest,
options?: RequestInit
): Promise<updateThreadStateResponse> => {
const res = await fetch(getUpdateThreadStateUrl(id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(updateThreadStateRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: updateThreadStateResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as updateThreadStateResponse;
};
/**
* @summary Get a thread with paginated messages.
*/
export type getThreadResponse200 = {
data: GetThreadResponse;
status: 200;
};
export type getThreadResponse400 = {
data: ErrorResponse;
status: 400;
};
export type getThreadResponse401 = {
data: ErrorResponse;
status: 401;
};
export type getThreadResponse404 = {
data: ErrorResponse;
status: 404;
};
export type getThreadResponse500 = {
data: ErrorResponse;
status: 500;
};
export type getThreadResponseSuccess = getThreadResponse200 & {
headers: Headers;
};
export type getThreadResponseError = (
| getThreadResponse400
| getThreadResponse401
| getThreadResponse404
| getThreadResponse500
) & {
headers: Headers;
};
export type getThreadResponse =
| getThreadResponseSuccess
| getThreadResponseError;
export const getGetThreadUrl = (threadId: string, params?: GetThreadParams) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/email/threads/${threadId}?${stringifiedParams}`
: `/email/threads/${threadId}`;
};
export const getThread = async (
threadId: string,
params?: GetThreadParams,
options?: RequestInit
): Promise<getThreadResponse> => {
const res = await fetch(getGetThreadUrl(threadId, params), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getThreadResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as getThreadResponse;
};
export type getThreadCalendarInvitationsResponse200 = {
data: GetThreadCalendarInvitations200;
status: 200;
};
export type getThreadCalendarInvitationsResponse401 = {
data: void;
status: 401;
};
export type getThreadCalendarInvitationsResponse403 = {
data: void;
status: 403;
};
export type getThreadCalendarInvitationsResponseSuccess =
getThreadCalendarInvitationsResponse200 & {
headers: Headers;
};
export type getThreadCalendarInvitationsResponseError = (
| getThreadCalendarInvitationsResponse401
| getThreadCalendarInvitationsResponse403
) & {
headers: Headers;
};
export type getThreadCalendarInvitationsResponse =
| getThreadCalendarInvitationsResponseSuccess
| getThreadCalendarInvitationsResponseError;
export const getGetThreadCalendarInvitationsUrl = (threadId: string) => {
return `/email/threads/${threadId}/calendar-invitations`;
};
export const getThreadCalendarInvitations = async (
threadId: string,
options?: RequestInit
): Promise<getThreadCalendarInvitationsResponse> => {
const res = await fetch(getGetThreadCalendarInvitationsUrl(threadId), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getThreadCalendarInvitationsResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getThreadCalendarInvitationsResponse;
};
/**
* @summary Add a shared event saved from one of the thread's messages to one of the
viewer's Google calendars, the way Add to calendar adds a channel-shared
event: a snapshot under the meeting's iCalendar UID and organizer, with the
viewer as its only guest and no join link. Nobody is notified. Only a
published event file (`METHOD:PUBLISH`) can be added; an invitation is
answered from the calendar it reached.
*/
export type copyThreadCalendarInvitationResponse201 = {
data: CalendarEvent;
status: 201;
};
export type copyThreadCalendarInvitationResponse400 = {
data: CalendarMutationApiError;
status: 400;
};
export type copyThreadCalendarInvitationResponse401 = {
data: void;
status: 401;
};
export type copyThreadCalendarInvitationResponse403 = {
data: CalendarMutationApiError;
status: 403;
};
export type copyThreadCalendarInvitationResponse404 = {
data: CalendarMutationApiError;
status: 404;
};
export type copyThreadCalendarInvitationResponse409 = {
data: CalendarMutationApiError;
status: 409;
};
export type copyThreadCalendarInvitationResponse503 = {
data: CalendarMutationApiError;
status: 503;
};
export type copyThreadCalendarInvitationResponseSuccess =
copyThreadCalendarInvitationResponse201 & {
headers: Headers;
};
export type copyThreadCalendarInvitationResponseError = (
| copyThreadCalendarInvitationResponse400
| copyThreadCalendarInvitationResponse401
| copyThreadCalendarInvitationResponse403
| copyThreadCalendarInvitationResponse404
| copyThreadCalendarInvitationResponse409
| copyThreadCalendarInvitationResponse503
) & {
headers: Headers;
};
export type copyThreadCalendarInvitationResponse =
| copyThreadCalendarInvitationResponseSuccess
| copyThreadCalendarInvitationResponseError;
export const getCopyThreadCalendarInvitationUrl = (
threadId: string,
messageId: string,
invitationId: string
) => {
return `/email/threads/${threadId}/messages/${messageId}/calendar-invitations/${invitationId}/copy`;
};
export const copyThreadCalendarInvitation = async (
threadId: string,
messageId: string,
invitationId: string,
copyCalendarEventRequest: CopyCalendarEventRequest,
options?: RequestInit
): Promise<copyThreadCalendarInvitationResponse> => {
const res = await fetch(
getCopyThreadCalendarInvitationUrl(threadId, messageId, invitationId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(copyCalendarEventRequest),
}
);
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: copyThreadCalendarInvitationResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as copyThreadCalendarInvitationResponse;
};
/**
* @summary Update the project assignment for a thread.
*/
export type updateThreadProjectResponse200 = {
data: UpdateThreadProjectResponse;
status: 200;
};
export type updateThreadProjectResponse401 = {
data: ErrorResponse;
status: 401;
};
export type updateThreadProjectResponse404 = {
data: ErrorResponse;
status: 404;
};
export type updateThreadProjectResponse500 = {
data: ErrorResponse;
status: 500;
};
export type updateThreadProjectResponseSuccess =
updateThreadProjectResponse200 & {
headers: Headers;
};
export type updateThreadProjectResponseError = (
| updateThreadProjectResponse401
| updateThreadProjectResponse404
| updateThreadProjectResponse500
) & {
headers: Headers;
};
export type updateThreadProjectResponse =
| updateThreadProjectResponseSuccess
| updateThreadProjectResponseError;
export const getUpdateThreadProjectUrl = (threadId: string) => {
return `/email/threads/${threadId}/project`;
};
export const updateThreadProject = async (
threadId: string,
updateThreadProjectRequest: UpdateThreadProjectRequest,
options?: RequestInit
): Promise<updateThreadProjectResponse> => {
const res = await fetch(getUpdateThreadProjectUrl(threadId), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(updateThreadProjectRequest),
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: updateThreadProjectResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as updateThreadProjectResponse;
};
export type getThreadReadReceiptsResponse200 = {
data: ThreadReadReceipts;
status: 200;
};
export type getThreadReadReceiptsResponse401 = {
data: void;
status: 401;
};
export type getThreadReadReceiptsResponse403 = {
data: void;
status: 403;
};
export type getThreadReadReceiptsResponseSuccess =
getThreadReadReceiptsResponse200 & {
headers: Headers;
};
export type getThreadReadReceiptsResponseError = (
| getThreadReadReceiptsResponse401
| getThreadReadReceiptsResponse403
) & {
headers: Headers;
};
export type getThreadReadReceiptsResponse =
| getThreadReadReceiptsResponseSuccess
| getThreadReadReceiptsResponseError;
export const getGetThreadReadReceiptsUrl = (threadId: string) => {
return `/email/threads/${threadId}/read-receipts`;
};
export const getThreadReadReceipts = async (
threadId: string,
options?: RequestInit
): Promise<getThreadReadReceiptsResponse> => {
const res = await fetch(getGetThreadReadReceiptsUrl(threadId), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getThreadReadReceiptsResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getThreadReadReceiptsResponse;
};
/**
* @summary Health check
*/
export type healthHandlerResponse200 = {
data: EmptyResponse;
status: 200;
};
export type healthHandlerResponseSuccess = healthHandlerResponse200 & {
headers: Headers;
};
export type healthHandlerResponse = healthHandlerResponseSuccess;
export const getHealthHandlerUrl = () => {
return `/health`;
};
export const healthHandler = async (
options?: RequestInit
): Promise<healthHandlerResponse> => {
const res = await fetch(getHealthHandlerUrl(), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: healthHandlerResponse['data'] = body ? JSON.parse(body) : {};
return {
data,
status: res.status,
headers: res.headers,
} as healthHandlerResponse;
};
/**
* @summary Every request gets the same uncacheable pixel so the response reveals nothing
about the token, and each open reaches the server.
*/
export type getReadReceiptPixelResponseDefault = {
data: unknown;
status: number;
};
export type getReadReceiptPixelResponseError =
getReadReceiptPixelResponseDefault & {
headers: Headers;
};
export type getReadReceiptPixelResponse = getReadReceiptPixelResponseError;
export const getGetReadReceiptPixelUrl = (token: string) => {
return `/opens/${token}`;
};
export const getReadReceiptPixel = async (
token: string,
options?: RequestInit
): Promise<getReadReceiptPixelResponse> => {
const res = await fetch(getGetReadReceiptPixelUrl(token), {
...options,
method: 'GET',
});
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getReadReceiptPixelResponse['data'] = body
? JSON.parse(body)
: {};
return {
data,
status: res.status,
headers: res.headers,
} as getReadReceiptPixelResponse;
};