export type DeleteApiApiV0BoardProfessionalsArgs = {emails?: Array | undefined, secret_key?: string | undefined}; export type DeleteApiApiV0BoardProfessionalsOptions = {baseUrl?: string | undefined, BoardSecretKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove board professionals * * DELETE /api/v0/board/professionals */ export const deleteApiApiV0BoardProfessionals = async (args: DeleteApiApiV0BoardProfessionalsArgs, options?: DeleteApiApiV0BoardProfessionalsOptions) => { const {baseUrl = "https://www.getonbrd.com", fetch: fetchFn = fetch, BoardSecretKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") for (const item of args.emails ?? []) query.append("emails", String(item)) if (args.secret_key != null) query.append("secret_key", String(args.secret_key)) if (BoardSecretKey !== undefined) headers.set('authorization', `Bearer ${BoardSecretKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v0/board/professionals${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };