Skip to content

Commit 53a275e

Browse files
committed
feat: add jobs.getExportUrls utility
This adds a utility method which allows library consumers to turn a job into a list of file results. Contrary to what was suggested in #91, this does not add a class `Job` which would have to be instantiated. Therefore, it does not require a hydration of all API call results. Currently, all interactions with jobs and tasks happen through `cloudconvert.jobs` and `cloudconvert.tasks`, so doing this would work, but not be very consistent. Closes #91.
1 parent c0755e2 commit 53a275e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/JobsResource.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import CloudConvert from './CloudConvert';
22
import {
3+
type FileResult,
34
type Operation,
45
type Task,
56
type TaskEventData,
@@ -99,6 +100,10 @@ export default class JobsResource {
99100
callback
100101
);
101102
}
103+
104+
getExportUrls(job: Job): FileResult[] {
105+
return job.tasks.flatMap(task => task.result?.files ?? []);
106+
}
102107
}
103108

104109
// We need to map the types from the large Operation union type

0 commit comments

Comments
 (0)