@fedpulse/sdk 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,8 +82,18 @@ await client.opportunities.get('abc123-notice-id');
|
|
|
82
82
|
// Aggregate statistics
|
|
83
83
|
await client.opportunities.stats({ postedAfter: '2025-01-01' });
|
|
84
84
|
|
|
85
|
-
//
|
|
86
|
-
|
|
85
|
+
// Exports are background jobs — createExport() returns immediately with a job ID.
|
|
86
|
+
// Poll getExport() until status === 'done', then call downloadExport().
|
|
87
|
+
const job = await client.opportunities.createExport({ format: 'csv', q: 'AI' });
|
|
88
|
+
let status = job.data;
|
|
89
|
+
while (status.status !== 'done' && status.status !== 'failed') {
|
|
90
|
+
await new Promise(r => setTimeout(r, 3000)); // wait 3s between polls
|
|
91
|
+
status = (await client.opportunities.getExport(status.exportId)).data;
|
|
92
|
+
}
|
|
93
|
+
if (status.status === 'done') {
|
|
94
|
+
const response = await client.opportunities.downloadExport(status.exportId);
|
|
95
|
+
const csv = await response.text(); // or response.body for streaming
|
|
96
|
+
}
|
|
87
97
|
|
|
88
98
|
// Async generator — walks all pages automatically
|
|
89
99
|
for await (const page of client.opportunities.paginate({ q: 'defense' })) {
|
package/package.json
CHANGED