export type SDAPRequest = {ticket_id?: (string | null) | undefined, event_type?: (string | null) | undefined, id_type_sa_guid?: (string | null) | undefined, id_type_email?: (string | null) | undefined, id_type_phone_number?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined, phone_number?: (string | null) | undefined, birth_date?: (string | null) | undefined, country_code?: (string | null) | undefined, lang_code?: (string | null) | undefined, channel_type?: (string | null) | undefined, channel_service?: (string | null) | undefined, user_request_date?: (string | null) | undefined, source_system_date?: (string | null) | undefined, expect_due_date?: (string | null) | undefined}; export type CreateApiV1ApiSDAPRequestArgs = {body: SDAPRequest}; export type CreateApiV1ApiSDAPRequestOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/api/SDAP/request */ export const createApiV1ApiSDAPRequest = async (args: CreateApiV1ApiSDAPRequestArgs, options: CreateApiV1ApiSDAPRequestOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v1/api/SDAP/request${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 };