export type PatchApiControllerRelayConnectionsIdArgs = {id: number, body: {controller_relay_connection: {duration?: number | undefined, name?: (string | null) | undefined}} | {controller_relay_connection: {duration?: number | undefined, name?: (string | null) | undefined}} | {controller_relay_connection: {duration_for_away_mode?: (number | null) | undefined, duration_for_stay_mode?: (number | null) | undefined, name?: (string | null) | undefined}}}; export type PatchApiControllerRelayConnectionsIdOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a controller relay connection * * PATCH /controller_relay_connections/{id} * * Also accepts auth: OAuth2 */ export const patchApiControllerRelayConnectionsId = async (args: PatchApiControllerRelayConnectionsIdArgs, options?: PatchApiControllerRelayConnectionsIdOptions) => { 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_relay_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 };