Skip to content

Commit 28d6a87

Browse files
committed
add status parameter
1 parent 83f3b7f commit 28d6a87

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

index.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ export declare namespace BulkDataClient {
257257
config?: string
258258

259259
reporter?: "cli" | "text"
260+
261+
/**
262+
* Use if you have a status endpoint of an export that has already been
263+
* started.
264+
*/
265+
status?: string
260266
}
261267

262268
interface NormalizedOptions {
@@ -703,6 +709,7 @@ export declare namespace BulkDataClient {
703709
retryAfterHeader?: string
704710
body ?: any
705711
virtual ?: boolean
712+
statusEndpoint : string
706713
}
707714
}
708715

src/app.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ APP.option('-d, --destination [destination]' , 'Download destination. See conf
3838
APP.option("--config <path>" , 'Relative path to config file.');
3939
APP.option("--reporter [cli|text]" , 'Reporter to use to render the output. "cli" renders fancy progress bars and tables. "text" is better for log files. Defaults to "cli".');
4040
APP.option("-c, --custom [opt=val...]" , "Custom parameters to be passed to the kick-off endpoint.");
41+
APP.option("--status [url]" , "Status endpoint of already started export.");
4142

4243
APP.action(async (args: BulkDataClient.CLIOptions) => {
4344
const { config, ...params } = args;
@@ -210,7 +211,7 @@ APP.action(async (args: BulkDataClient.CLIOptions) => {
210211
process.exit(1);
211212
})
212213

213-
const statusEndpoint = await client.kickOff()
214+
const statusEndpoint = options.status || await client.kickOff()
214215
const manifest = await client.waitForExport(statusEndpoint)
215216
const downloads = await client.downloadAllFiles(manifest)
216217
// console.log(downloads)

src/reporters/cli.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function CLIReporter(client: BulkDataClient)
2727

2828
function onExportStart(status: Types.ExportStatus) {
2929
console.log(status.message)
30+
console.log(`Status endpoint: ${status.statusEndpoint}`)
3031
}
3132

3233
function onExportProgress(status: Types.ExportStatus) {

src/reporters/text.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default function TextReporter(client: BulkDataClient)
2323
function onExportStart(status: Types.ExportStatus) {
2424
downloadedPct = 0;
2525
console.log(status.message)
26+
console.log(`Status endpoint: ${status.statusEndpoint}`)
2627
}
2728

2829
function onExportProgress(status: Types.ExportStatus) {

0 commit comments

Comments
 (0)