import {z} from 'zod' export type UpdateApiV1DialerCampaignIdArgs = {id: string, Authorization: string, body: {name?: string | undefined, description?: string | undefined, dial_method?: string | undefined, auto_dial_duration?: string | undefined, outbound_caller_id?: string | undefined, agent_wise_caller_id?: boolean | undefined, lead_list_map?: Array | undefined, agent_wise_lead_list?: boolean | undefined, list_traversal_order?: string | undefined, agent_script?: string | undefined, disposition_list?: string | undefined, number_of_retry?: string | undefined, retry_after_minutes?: string | undefined, auto_disposition_cancel_duration?: string | undefined, dial_status?: Array | undefined, time_group?: string | undefined, time_group_recording?: string | undefined, ring_timeout?: string | undefined, quick_transfer_list?: string | undefined, account_dnd_list?: string | undefined, hide_lead_details?: boolean | undefined, update_lead_details?: boolean | undefined, automatic_schedule_call_enabled?: boolean | undefined, enable_hangup?: boolean | undefined, enable_external_transfer?: boolean | undefined, after_call_work_duration?: string | undefined, enable_web_form?: boolean | undefined, webform_url?: string | undefined, music_on_hold?: string | undefined, ring_strategy?: string | undefined, dial_ratio?: string | undefined, enable_transfer?: boolean | undefined, manual_lead_list?: Array | undefined, break_list?: string | undefined, map_agent_caller_id?: string | undefined, map_agent_lead_list?: string | undefined, connect_agent_through?: string | undefined, dial_in_type?: string | undefined, agent_only_callback?: boolean | undefined, agent_dial_in_number?: string | undefined, agent?: Array | undefined, enforce_agent_pause_code?: number | undefined, manual_dial_enabled?: boolean | undefined, enable_inbound?: boolean | undefined, inbound_queue?: string | undefined, enable_agent_opt_out?: boolean | undefined, inbound_lead_list?: string | undefined, enable_auto_answer?: boolean | undefined, call_qualification_duration?: string | undefined, announcement_recording?: string | undefined}}; export type UpdateApiV1DialerCampaignIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const updateApiV1DialerCampaignIdResponse = z.object({}); 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 a particular dialer campaign * * PUT /v1/dialer/campaign/{id} */ export const updateApiV1DialerCampaignId = async (args: UpdateApiV1DialerCampaignIdArgs, options?: UpdateApiV1DialerCampaignIdOptions) => { const {baseUrl = "https://api-smartflo.tatateleservices.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/dialer/campaign/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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(updateApiV1DialerCampaignIdResponse, await res.json()) };