Something went wrong. Try again.
CLI for FastMail via JMAP
Something went wrong. Try again.
1.6 kB · 63 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364/** * JMAP protocol types. * Based on RFC 8620 (JMAP Core) and RFC 8621 (JMAP Mail). */
// Account information from sessionexport interface JmapAccount { name: string; isPersonal: boolean; isReadOnly: boolean; accountCapabilities: Record<string, unknown>;}
// Session response from /jmap/session endpointexport interface JmapSession { username: string; apiUrl: string; downloadUrl: string; uploadUrl: string; eventSourceUrl: string; state: string; accounts: Record<string, JmapAccount>; primaryAccounts: Record<string, string>; capabilities: Record<string, unknown>;}
// Method invocation: [methodName, arguments, callId]export type MethodInvocation = [string, Record<string, unknown>, string];
// Method response: [methodName, result, callId]export type MethodResponse = [string, Record<string, unknown>, string];
// JMAP request bodyexport interface JmapRequest { using: string[]; methodCalls: MethodInvocation[];}
// JMAP response bodyexport interface JmapResponse { methodResponses: MethodResponse[]; sessionState: string;}
// JMAP error responseexport interface JmapErrorResponse { type: string; status?: number; detail?: string;}
// JMAP method-level errorexport interface JmapMethodError { type: string; description?: string;}
// Common JMAP capabilitiesexport const JMAP_CORE_CAPABILITY = "urn:ietf:params:jmap:core";export const JMAP_MAIL_CAPABILITY = "urn:ietf:params:jmap:mail";export const JMAP_SUBMISSION_CAPABILITY = "urn:ietf:params:jmap:submission";export const MASKED_EMAIL_CAPABILITY = "https://www.fastmail.com/dev/maskedemail";