export type GetApiV1VendorsGlobalSearchArgs = {name?: string | undefined}; export type GetApiV1VendorsGlobalSearchOptions = {baseUrl?: string | undefined, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search global vendors * * GET /v1/vendors/global/search */ export const getApiV1VendorsGlobalSearch = async (args: GetApiV1VendorsGlobalSearchArgs, options?: GetApiV1VendorsGlobalSearchOptions) => { const {baseUrl = "https://api.betayum.com", fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.name != null) query.append("name", String(args.name)) if (apikey !== undefined) headers.set("X-API-Key", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/vendors/global/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 undefined };