export type GetApiYemeksepetiGetTokenArgs = {username?: string | undefined, password?: string | undefined}; export type GetApiYemeksepetiGetTokenOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /yemeksepeti/get-token */ export const getApiYemeksepetiGetToken = async (args: GetApiYemeksepetiGetTokenArgs, options?: GetApiYemeksepetiGetTokenOptions) => { const {baseUrl = "https://demo.poskobi.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.username != null) query.append("username", String(args.username)) if (args.password != null) query.append("password", String(args.password)) const url = `${baseUrl.replace(/\/+$/, '')}/yemeksepeti/get-token${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };