export type CreateApiV1UsersUserIdBlocksArgs = {user_id: number}; export type CreateApiV1UsersUserIdBlocksOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Block user * * POST /v1/users/{user_id}/blocks */ export const createApiV1UsersUserIdBlocks = async (args: CreateApiV1UsersUserIdBlocksArgs, options?: CreateApiV1UsersUserIdBlocksOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/${encodeURIComponent(String(args.user_id))}/blocks${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };