export type Archivo = {height?: number | undefined, timestamp?: string | undefined, uri?: (string | null) | undefined, fileName?: (string | null) | undefined, data?: (string | null) | undefined}; export type NewsImageRequest = {isMain?: boolean | undefined, photo?: Archivo | undefined}; export type VideoArchivo = {height?: (number | null) | undefined, timestamp?: (string | null) | undefined, uri?: (string | null) | undefined, fileName?: (string | null) | undefined, data?: (string | null) | undefined}; export type NewsCreateRqs = {newsID?: number | undefined, newsCategoryID?: number | undefined, communicationTypeID?: number | undefined, topicID?: (number | null) | undefined, title?: (string | null) | undefined, txtContent?: (string | null) | undefined, url?: (string | null) | undefined, contentID?: (number | null) | undefined, startDate?: (string | null) | undefined, finishDate?: (string | null) | undefined, isActive?: boolean | undefined, highlighted?: boolean | undefined, paisID?: number | undefined, listaAccounts?: (Array | null) | undefined, listaStores?: (Array | null) | undefined, newsImages?: (Array | null) | undefined, video?: VideoArchivo | undefined}; export type CreateApiV1ApiNewsArgs = {body: NewsCreateRqs}; export type CreateApiV1ApiNewsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/api/News */ export const createApiV1ApiNews = async (args: CreateApiV1ApiNewsArgs, options: CreateApiV1ApiNewsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v1/api/News${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 };