import {z} from 'zod' export type InterviewUpdate = {name?: (string | null) | undefined, description?: (string | null) | undefined, goal?: (string | null) | undefined, agent_behavior?: (string | null) | undefined, channel?: (string | null) | undefined, completion_threshold?: (number | null) | undefined, status?: (string | null) | undefined, timeframe_start?: (string | null) | undefined, timeframe_end?: (string | null) | undefined, interview_order?: (string | null) | undefined, interview_duration_minutes?: (number | null) | undefined, timezone?: (string | null) | undefined, start_immediately?: (boolean | null) | undefined, scheduling_mode?: (string | null) | undefined, quick_mode_hours?: (number | null) | undefined, weekly_availability?: ({[key: string]: unknown} | null) | undefined, project_context?: (string | null) | undefined, interview_context_for_employee?: (string | null) | undefined, invitation_email_message?: (string | null) | undefined, teams_invitation_message?: (string | null) | undefined, agent_profile_id?: (string | null) | undefined, agent_profile_snapshot?: ({[key: string]: unknown} | null) | undefined, interview_type?: (string | null) | undefined, default_language?: (string | null) | undefined, voice_id?: (string | null) | undefined, voice_provider?: (string | null) | undefined, voice_language?: (string | null) | undefined, voice_speed?: (number | null) | undefined, welcome_screen?: (string | null) | undefined, closing_message?: (string | null) | undefined, completion_redirect_url?: (string | null) | undefined, participant_voice_selection_enabled?: (boolean | null) | undefined, participant_mode_selection_enabled?: (boolean | null) | undefined, participant_language_selection_enabled?: (boolean | null) | undefined, participant_selectable_languages?: (Array | null) | undefined, participant_anonymity_selection_enabled?: (boolean | null) | undefined, participant_review_enabled?: (boolean | null) | undefined, result_summary_enabled?: (boolean | null) | undefined, folder?: (string | null) | undefined, recurring_interval?: (string | null) | undefined, followup_enabled?: (boolean | null) | undefined, followup_strategy?: (string | null) | undefined, followup_intervals_hours?: (Array | null) | undefined, followup_deadline_days?: (Array | null) | undefined, followup_message?: (string | null) | undefined, report_floor_count?: (number | null) | undefined, incremental_update_every_n?: (number | null) | undefined, is_anonymous?: (boolean | null) | undefined, anonymity_level?: (string | null) | undefined, conversation_mode?: ('classic' | 'v2_beta' | null) | undefined, live_voice?: ('alloy' | 'ash' | 'ballad' | 'cedar' | 'coral' | 'echo' | 'marin' | 'sage' | 'shimmer' | 'verse' | null) | undefined}; export type PatchApiV1InterviewsInterviewIdArgs = {interview_id: string, 'X-API-Key'?: (string | null) | undefined, body: InterviewUpdate}; export type PatchApiV1InterviewsInterviewIdOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; export const interviewOut = z.object({id: z.string(), workspace_id: z.string(), is_shared: z.boolean().optional(), shared_from_workspace_name: z.string().nullable().optional(), share_scope: z.string().optional(), share_link_enabled: z.boolean().optional(), join_link_delivery: z.boolean().optional(), name: z.string(), description: z.string().nullable(), goal: z.string().nullable(), agent_behavior: z.string().nullable(), status: z.string(), channel: z.string(), completion_threshold: z.number().int(), timeframe_start: z.string().nullable(), timeframe_end: z.string().nullable(), interview_order: z.string(), interview_duration_minutes: z.number().int(), timezone: z.string().nullable().optional(), start_immediately: z.boolean().optional(), scheduling_mode: z.string().optional(), quick_mode_hours: z.number().int().nullable().optional(), weekly_availability: z.record(z.string(), z.unknown()).nullable().optional(), project_context: z.string().nullable().optional(), success_criteria: z.string().nullable().optional(), interview_context_for_employee: z.string().nullable().optional(), invitation_email_message: z.string().nullable().optional(), teams_invitation_message: z.string().nullable().optional(), agent_profile_id: z.string().nullable().optional(), agent_profile_snapshot: z.record(z.string(), z.unknown()).nullable().optional(), agent_template_id: z.string().nullable().optional(), draft_guide: z.array(z.unknown()).nullable().optional(), draft_guide_revision: z.string().nullable().optional(), interview_type: z.string().nullable().optional(), default_language: z.string().nullable().optional(), voice_id: z.string().nullable().optional(), voice_provider: z.string().nullable().optional(), voice_language: z.string().nullable().optional(), voice_speed: z.number().optional(), participant_voice_selection_enabled: z.boolean().optional(), participant_mode_selection_enabled: z.boolean().optional(), participant_language_selection_enabled: z.boolean().optional(), participant_selectable_languages: z.array(z.string()).optional(), participant_anonymity_selection_enabled: z.boolean().optional(), participant_review_enabled: z.boolean().optional(), result_summary_enabled: z.boolean().optional(), result_summary_recipient_count: z.number().int().optional(), welcome_screen: z.string().nullable().optional(), closing_message: z.string().nullable().optional(), completion_redirect_url: z.string().nullable().optional(), folder: z.string().nullable().optional(), recurring_interval: z.string().nullable().optional(), followup_enabled: z.boolean().optional(), followup_strategy: z.string().nullable().optional(), followup_intervals_hours: z.array(z.number().int()).nullable().optional(), followup_deadline_days: z.array(z.number().int()).nullable().optional(), followup_message: z.string().nullable().optional(), report_floor_count: z.number().int().nullable().optional(), incremental_update_every_n: z.number().int().nullable().optional(), is_anonymous: z.boolean().optional(), anonymity_level: z.string().optional(), conversation_mode: z.string().optional(), live_voice: z.string().optional(), contact_count: z.number().int().optional(), completed_count: z.number().int().optional(), scheduled_count: z.number().int().optional(), created_by: z.string().nullable(), created_by_email: z.string().nullable().optional(), created_by_name: z.string().nullable().optional(), created_at: z.string(), updated_at: z.string()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Update Interview * * PATCH /v1/interviews/{interview_id} */ export const patchApiV1InterviewsInterviewId = async (args: PatchApiV1InterviewsInterviewIdArgs, options: PatchApiV1InterviewsInterviewIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/interviews/${encodeURIComponent(String(args.interview_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(interviewOut, await res.json()) };