export type GetApiV1AccountsExportArgs = {search?: string | undefined, facetFilters?: string | undefined, tags?: string | undefined, index?: string | undefined, page?: number | undefined, 'x-api-key': string}; export type GetApiV1AccountsExportOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export all project accounts for a given search * * GET /v1/accounts/export */ export const getApiV1AccountsExport = async (args: GetApiV1AccountsExportArgs, options?: GetApiV1AccountsExportOptions) => { const {baseUrl = "https://api.mailreach.co/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.search != null) query.append("search", String(args.search)) if (args.facetFilters != null) query.append("facetFilters", String(args.facetFilters)) if (args.tags != null) query.append("tags", String(args.tags)) if (args.index != null) query.append("index", String(args.index)) if (args.page != null) query.append("page", String(args.page)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/accounts/export${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 };