export type CreateApiV3CustomerLoginRequestsArgs = {email?: string | undefined, reservation_id?: string | undefined, redirect_page?: string | undefined, send_login_url?: boolean | undefined}; export type CreateApiV3CustomerLoginRequestsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST customer_login_request * * POST /v3/customer_login_requests * * Also accepts auth: OAuth2 */ export const createApiV3CustomerLoginRequests = async (args: CreateApiV3CustomerLoginRequestsArgs, options?: CreateApiV3CustomerLoginRequestsOptions) => { const {baseUrl = "https://api.bookingexperts.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) if (args.reservation_id != null) query.append("reservation_id", String(args.reservation_id)) if (args.redirect_page != null) query.append("redirect_page", String(args.redirect_page)) if (args.send_login_url != null) query.append("send_login_url", String(args.send_login_url)) if (ApiKeyAuth !== undefined) headers.set("X-API-KEY", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v3/customer_login_requests${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };