export type BillNavigatorStatusUpdateRequest = {action: 'deactivate' | 'terminate' | 'deactivated' | 'terminated', reason?: string | undefined}; export type UpdateApiEndUsersEndUserIdBillNavigatorStatusArgs = {end_user_id: string, 'Pinwheel-Version': '2025-07-08' | '2023-11-22' | '2023-07-18' | '2023-04-18' | '2022-09-09' | '2022-06-22' | '2022-03-02', body: BillNavigatorStatusUpdateRequest}; export type UpdateApiEndUsersEndUserIdBillNavigatorStatusOptions = {baseUrl?: string | undefined, apiSecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update end user Bill Navigator status * * PUT /end_users/{end_user_id}/bill_navigator/status */ export const updateApiEndUsersEndUserIdBillNavigatorStatus = async (args: UpdateApiEndUsersEndUserIdBillNavigatorStatusArgs, options?: UpdateApiEndUsersEndUserIdBillNavigatorStatusOptions) => { const {baseUrl = "https://api.getpinwheel.com/v1", fetch: fetchFn = fetch, apiSecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Pinwheel-Version'] != null) headers.set("Pinwheel-Version", String(args['Pinwheel-Version'])) if (apiSecret !== undefined) headers.set("X-API-SECRET", apiSecret) const url = `${baseUrl.replace(/\/+$/, '')}/end_users/${encodeURIComponent(String(args.end_user_id))}/bill_navigator/status${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 undefined };