export type UpdateApiV1ChatRoomsRoomIdCloseArgs = {roomId: number, markAsSolved?: boolean | undefined, apiKey?: string | undefined, visitorId?: string | undefined, email?: string | undefined, phone?: string | undefined, userHash?: string | undefined}; export type UpdateApiV1ChatRoomsRoomIdCloseOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /v1/chat/rooms/{roomId}/close * * Also accepts auth: API Key */ export const updateApiV1ChatRoomsRoomIdClose = async (args: UpdateApiV1ChatRoomsRoomIdCloseArgs, options: UpdateApiV1ChatRoomsRoomIdCloseOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.markAsSolved != null) query.append("markAsSolved", String(args.markAsSolved)) if (args.apiKey != null) query.append("apiKey", String(args.apiKey)) if (args.visitorId != null) query.append("visitorId", String(args.visitorId)) if (args.email != null) query.append("email", String(args.email)) if (args.phone != null) query.append("phone", String(args.phone)) if (args.userHash != null) query.append("userHash", String(args.userHash)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/chat/rooms/${encodeURIComponent(String(args.roomId))}/close${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };