export type GetApiCooperationSearchArgs = {merchantBranches: Array, categories?: (Array<'MOBILE_COMPUTER_TABLET' | 'AUTO_PARTS' | 'HOUSEHOLD' | 'FURNITURE' | 'CONSTRUCTION_MATERIALS_ACCESSORIES_TOOLS' | 'SOLAR' | 'SERVICES' | 'OTHER'>) | undefined, startFrom?: number | undefined, totalCount?: number | undefined}; export type GetApiCooperationSearchOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /cooperation/search */ export const getApiCooperationSearch = async (args: GetApiCooperationSearchArgs, options?: GetApiCooperationSearchOptions) => { const {baseUrl = "https://api.velox.am", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") for (const item of args.merchantBranches ?? []) query.append("merchantBranches", String(item)) for (const item of args.categories ?? []) query.append("categories", String(item)) if (args.startFrom != null) query.append("startFrom", String(args.startFrom)) if (args.totalCount != null) query.append("totalCount", String(args.totalCount)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/cooperation/search${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() };