Gmail API Zod Schemas (endpoints/types.ts)

corsair · packages/gmail/endpoints/types.ts · typescript · Apache-2.0
integration, email, lang:typescript, fw:zod, tag:validation

Zod validation schemas and type definitions for Gmail API endpoints, including raw message encoding rules. Reuse when integrating Gmail API functionality into TypeScript applications.

// Source: https://github.com/corsairdev/corsair | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';
import type {
	Draft,
	DraftListResponse,
	Label,
	LabelListResponse,
	Message,
	MessageListResponse,
	Profile,
	Thread,
	ThreadListResponse,
} from '../types';

/** Gmail API `raw` fields expect base64url RFC 2822 — not plain email text. */
const GMAIL_RAW_MESSAGE_ENCODE_DESCRIPTION =
	'Base64url-encoded RFC 2822 email — do NOT pass plain email text. Build the MIME message (From, To, Subject, Content-Type headers, blank line, body; lines separated by \\r\\n), then base64url-encode: standard base64, replace + with -, / with _, remove trailing =.';

const GmailR

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key