// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import * as V2API from './v2'; import { AdminConnector, AdminUser, V2 } from './v2'; import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Whatsapp extends APIResource { v2: V2API.V2 = new V2API.V2(this._client); /** * Register or re-register a user with WhatsApp. Idempotent — repeated calls reuse * the existing user. */ register(params: WhatsappRegisterParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/auth/whatsapp/register', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Phone and email verification response model. * * Attributes: challenge_id: Unique identifier for the verification challenge * expires_at: Timestamp when the verification code expires user_detail: User * details including username and display name cooldown: Cooldown period in seconds * before next resend is allowed */ export interface VerificationResponse { /** * Unique challenge ID for verification */ challenge_id: string; /** * Cooldown period in seconds */ cooldown: number; /** * When the verification code expires */ expires_at: string; /** * User details with username, display_name and email */ user_detail: { [key: string]: string }; /** * Echo of verification_profile when applicable (e.g. deferred_link_email_otp). */ flow?: string | null; } export interface WhatsappRegisterParams { /** * Body param */ provider_code: string; /** * Body param */ whatsapp_id: string; /** * Body param */ email?: string | null; /** * Body param */ profile_name?: string | null; /** * Body param */ username?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } Whatsapp.V2 = V2; export declare namespace Whatsapp { export { type VerificationResponse as VerificationResponse, type WhatsappRegisterParams as WhatsappRegisterParams, }; export { V2 as V2, type AdminConnector as AdminConnector, type AdminUser as AdminUser }; }