export type PatchApiControllerInputConnectionsIdArgs = {id: number, body: {controller_input_connection: {enabled?: boolean | undefined, duration?: number | undefined, end_of_line_type?: ('cut_detect' | 'short_detect' | 'cut_and_short_detect' | 'null' | null) | undefined, end_of_line_main_resistor?: (number | null) | undefined, end_of_line_second_resistor?: (number | null) | undefined, name?: (string | null) | undefined}} | {controller_input_connection: {enabled?: boolean | undefined, duration?: number | undefined, end_of_line_type?: ('cut_detect' | 'short_detect' | 'cut_and_short_detect' | 'null' | null) | undefined, end_of_line_main_resistor?: (number | null) | undefined, end_of_line_second_resistor?: (number | null) | undefined, name?: (string | null) | undefined, action?: ('last_to_leave' | 'last_to_unlock' | 'unlock' | 'none') | undefined}} | {controller_input_connection: {action?: ('away' | 'stay' | 'disarmed' | 'violated') | undefined}} | {controller_input_connection: {enabled?: boolean | undefined, end_of_line_type?: ('cut_detect' | 'short_detect' | 'cut_and_short_detect' | 'null' | null) | undefined, end_of_line_main_resistor?: (number | null) | undefined, end_of_line_second_resistor?: (number | null) | undefined, name?: (string | null) | undefined}}}; export type PatchApiControllerInputConnectionsIdOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a controller input connection * * PATCH /controller_input_connections/{id} * * Also accepts auth: OAuth2 */ export const patchApiControllerInputConnectionsId = async (args: PatchApiControllerInputConnectionsIdArgs, options?: PatchApiControllerInputConnectionsIdOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch, KisiLogin} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (KisiLogin !== undefined) headers.set("Authorization", KisiLogin) const url = `${baseUrl.replace(/\/+$/, '')}/controller_input_connections/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };