export type CreateApiPublicCommunitiesSubdomainUsersUserIdBanArgs = {subdomain: string, userId: string, 'x-api-key': string, body: {reason?: string | undefined}}; export type CreateApiPublicCommunitiesSubdomainUsersUserIdBanOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /public/communities/{subdomain}/users/{userId}/ban */ export const createApiPublicCommunitiesSubdomainUsersUserIdBan = async (args: CreateApiPublicCommunitiesSubdomainUsersUserIdBanArgs, options?: CreateApiPublicCommunitiesSubdomainUsersUserIdBanOptions) => { const {baseUrl = "https://api-v2.zealy.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/public/communities/${encodeURIComponent(String(args.subdomain))}/users/${encodeURIComponent(String(args.userId))}/ban${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };