export type PatchApiCtsUsersIdArgs = {id: number, body: {bto_user_id: number, cts_namespace?: string | undefined, cts_operator_code: string, cts_password: string, cts_xmlns?: string | undefined, cts_endpoint: string, cts_proxy?: string | undefined, cts_soap_action_header?: string | undefined, cts_version?: string | undefined, trips_in_advance_days?: number | undefined, cts_data_format?: ('soap' | 'json' | 'soap_ttklia') | undefined, qr_endpoint?: string | undefined, qr_ota_code?: string | undefined, qr_password?: string | undefined}}; export type PatchApiCtsUsersIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a CTS user * * PATCH /cts/users/{id} */ export const patchApiCtsUsersId = async (args: PatchApiCtsUsersIdArgs, options?: PatchApiCtsUsersIdOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") const url = `${baseUrl.replace(/\/+$/, '')}/cts/users/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };