export type Archivo = {height?: number | undefined, timestamp?: string | undefined, uri?: (string | null) | undefined, fileName?: (string | null) | undefined, data?: (string | null) | undefined}; export type VentaItemRqs = {productoID?: number | undefined, imei?: (string | null) | undefined, serial?: (string | null) | undefined, precio?: number | undefined}; export type VentaRqs = {empleadoID?: string | undefined, codFactura?: (string | null) | undefined, fechaVenta?: string | undefined, storeID?: number | undefined, fotoFactura?: Archivo | undefined, listArticulosVenta?: (Array | null) | undefined}; export type CreateApiV1ApiVentasRegistrarVentaArgs = {body: VentaRqs}; export type CreateApiV1ApiVentasRegistrarVentaOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/api/Ventas/RegistrarVenta */ export const createApiV1ApiVentasRegistrarVenta = async (args: CreateApiV1ApiVentasRegistrarVentaArgs, options: CreateApiV1ApiVentasRegistrarVentaOptions) => { 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/Ventas/RegistrarVenta${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 };