export type DeleteApiOrganizationsOrganizationIdUsersLeaveArgs = {organization_id: number}; export type DeleteApiOrganizationsOrganizationIdUsersLeaveOptions = {baseUrl: string, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Leaves organization * * DELETE /organizations/{organization_id}/users/leave */ export const deleteApiOrganizationsOrganizationIdUsersLeave = async (args: DeleteApiOrganizationsOrganizationIdUsersLeaveArgs, options: DeleteApiOrganizationsOrganizationIdUsersLeaveOptions) => { const {baseUrl, fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/organizations/${encodeURIComponent(String(args.organization_id))}/users/leave${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() };