export type CreateApiV1BoardsBoardIdCopyJsonArgs = {token: string, boardId: number, body: {board_visibility?: number | undefined, keepCards?: boolean | undefined, organization_id?: number | undefined}}; export type CreateApiV1BoardsBoardIdCopyJsonOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Copy board * * POST /v1/boards/{boardId}/copy.json */ export const createApiV1BoardsBoardIdCopyJson = async (args: CreateApiV1BoardsBoardIdCopyJsonArgs, options: CreateApiV1BoardsBoardIdCopyJsonOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.token != null) query.append("token", String(args.token)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/boards/${encodeURIComponent(String(args.boardId))}/copy.json${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 };