export type CreateApiAccountsAidCustomersUsersCustomerIdCommunicationOperationFieldArgs = {aid: unknown, customer_id: string, field: 'email' | 'phone_number', operation: 'send-verification-code' | 'confirm-verification-code', body: {code?: string | undefined}}; export type CreateApiAccountsAidCustomersUsersCustomerIdCommunicationOperationFieldOptions = {baseUrl?: string | undefined, JWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * aid_customers_cid_verify_post * * POST /accounts/{aid}/customers/users/{customer_id}/communication/{operation}/{field} */ export const createApiAccountsAidCustomersUsersCustomerIdCommunicationOperationField = async (args: CreateApiAccountsAidCustomersUsersCustomerIdCommunicationOperationFieldArgs, options?: CreateApiAccountsAidCustomersUsersCustomerIdCommunicationOperationFieldOptions) => { const {baseUrl = "https://api.dintero.com/v1", fetch: fetchFn = fetch, JWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (JWT !== undefined) headers.set('authorization', `Bearer ${JWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.aid))}/customers/users/${encodeURIComponent(String(args.customer_id))}/communication/${encodeURIComponent(String(args.operation))}/${encodeURIComponent(String(args.field))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 undefined };