export type DeleteApiPublicCommunitiesSubdomainUsersUserIdZealyConnectArgs = {subdomain: string, userId: string, 'x-api-key': string, redirectUrl: string}; export type DeleteApiPublicCommunitiesSubdomainUsersUserIdZealyConnectOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes Zealy Connect for a member * * DELETE /public/communities/{subdomain}/users/{userId}/zealy_connect */ export const deleteApiPublicCommunitiesSubdomainUsersUserIdZealyConnect = async (args: DeleteApiPublicCommunitiesSubdomainUsersUserIdZealyConnectArgs, options?: DeleteApiPublicCommunitiesSubdomainUsersUserIdZealyConnectOptions) => { const {baseUrl = "https://api-v2.zealy.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) if (args.redirectUrl != null) query.append("redirectUrl", String(args.redirectUrl)) const url = `${baseUrl.replace(/\/+$/, '')}/public/communities/${encodeURIComponent(String(args.subdomain))}/users/${encodeURIComponent(String(args.userId))}/zealy_connect${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 undefined };