/** * Opportunities resource client. * * Wraps all /v1/opportunities endpoints: * - search (list) GET /v1/opportunities * - stats GET /v1/opportunities/stats * - get GET /v1/opportunities/:noticeId * - createExport POST /v1/opportunities/export * - getExport GET /v1/opportunities/export/:exportId * - downloadExport GET /v1/opportunities/export/:exportId/download * - paginate (generator) auto-paginates over the search endpoint */ import type { HttpClient, ParsedResponse } from '../http.js'; import type { Opportunity, OpportunitiesStats, ListOpportunitiesParams, GetOpportunitiesStatsParams, CreateExportParams, ExportJob } from '../types/opportunities.js'; export declare class OpportunitiesResource { private readonly http; constructor(http: HttpClient); /** * Search and filter federal contract opportunities. * * @param params Filter and pagination parameters. * @returns Paginated list of opportunities. * * @example * ```ts * const result = await client.opportunities.list({ * q: 'cybersecurity', * naics: '541512', * postedAfter: '2025-01-01', * limit: 50, * }); * console.log(result.data[0].title); * ``` */ list(params?: ListOpportunitiesParams): Promise>; /** * Get a single opportunity by its SAM.gov notice ID. * * @param noticeId The unique SAM.gov notice identifier. * @throws {NotFoundError} If the opportunity does not exist. */ get(noticeId: string): Promise>; /** * Get aggregated statistics for opportunities. * * Returns a flat array of `{key, count}` buckets. * The `key` is the grouped value (e.g. NAICS code, department name). * * @param params Grouping and filter parameters. * * @example * ```ts * const stats = await client.opportunities.stats({ groupBy: 'naics', limit: 10 }); * for (const bucket of stats.data) { * console.log(`${bucket.key}: ${bucket.count}`); * } * ``` */ stats(params?: GetOpportunitiesStatsParams): Promise>; /** * Create a background export job for opportunities. * * Requires: Developer plan (CSV only) or Professional/Enterprise plan (all formats). * Requires: `export` API key scope. * * @param params Export parameters (format + same filters as `list`). * @returns Export job metadata. * * @example * ```ts * const job = await client.opportunities.createExport({ format: 'csv', agency: 'NASA' }); * // Poll getExport() until job.data.status === 'done', then call downloadExport(). * ``` */ createExport(params: CreateExportParams): Promise>; /** * Get the status of an export job. * * @param exportId UUID of the export job. * @throws {NotFoundError} If the export job does not exist or belongs to another user. */ getExport(exportId: string): Promise>; /** * Download the output file of a completed export job. * * Returns the raw `Response` object so callers can stream or save the body. * The response body will be CSV or NDJSON depending on the export format. * * @param exportId UUID of a **completed** export job. * @returns Raw fetch `Response` with the file body. * @throws {PermissionError} If the export is not complete. * @throws {NotFoundError} If the export does not exist. * * @example * ```ts * const response = await client.opportunities.downloadExport(exportId); * const csv = await response.text(); * ``` */ downloadExport(exportId: string): Promise; /** * Async generator that automatically paginates over all matching opportunities. * * Uses cursor-based pagination when available, falling back to offset. * Yields one page of results at a time. * * @param params Same filter parameters as `list()`. Do not pass `page` or `cursor`. * * @example * ```ts * for await (const page of client.opportunities.paginate({ naics: '541512' })) { * for (const opp of page.data) { * console.log(opp.title); * } * } * ``` */ paginate(params: Omit & { limit?: number; }): AsyncGenerator>; } //# sourceMappingURL=opportunities.d.ts.map