export type GetApiPublicV1PriceTiersArgs = {'ids[]'?: Array | undefined, company_id?: string | undefined, 'product_ids[]'?: Array | undefined, search?: string | undefined, inserted_datetime?: string | undefined, updated_datetime?: string | undefined, 'owner_ids[]'?: Array | undefined, page?: string | undefined}; export type GetApiPublicV1PriceTiersOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get price tiers * * GET /public/v1/price-tiers */ export const getApiPublicV1PriceTiers = async (args: GetApiPublicV1PriceTiersArgs, options?: GetApiPublicV1PriceTiersOptions) => { const {baseUrl = "https://app.distru.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") for (const item of args['ids[]'] ?? []) query.append("ids[]", String(item)) if (args.company_id != null) query.append("company_id", String(args.company_id)) for (const item of args['product_ids[]'] ?? []) query.append("product_ids[]", String(item)) if (args.search != null) query.append("search", String(args.search)) if (args.inserted_datetime != null) query.append("inserted_datetime", String(args.inserted_datetime)) if (args.updated_datetime != null) query.append("updated_datetime", String(args.updated_datetime)) for (const item of args['owner_ids[]'] ?? []) query.append("owner_ids[]", String(item)) if (args.page != null) query.append("page", String(args.page)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/price-tiers${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() };