export type CreateUpdateTaskStatusDto = {status: string, backgroundColor?: string | undefined, textColor?: string | undefined, borderColor?: string | undefined}; export type CreateApiTaskStatusArgs = {body: CreateUpdateTaskStatusDto}; export type CreateApiTaskStatusOptions = {baseUrl?: string | undefined, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create task status * * POST /task-status */ export const createApiTaskStatus = async (args: CreateApiTaskStatusArgs, options?: CreateApiTaskStatusOptions) => { const {baseUrl = "https://api.findmydocument.net", fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/task-status${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 };