export type SelfSatisResult = {deger: number, str?: string | undefined}; export type CreateApiUrunSelfekraniurunlerArgs = {body: SelfSatisResult}; export type CreateApiUrunSelfekraniurunlerOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /urun/selfekraniurunler */ export const createApiUrunSelfekraniurunler = async (args: CreateApiUrunSelfekraniurunlerArgs, options?: CreateApiUrunSelfekraniurunlerOptions) => { const {baseUrl = "https://demo.poskobi.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/urun/selfekraniurunler${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 res.blob() };