11import CloudConvert from './CloudConvert' ;
2- import { Operation , Task , TaskEventData , TaskStatus } from './TasksResource' ;
2+ import {
3+ type Operation ,
4+ type Task ,
5+ type TaskEventData ,
6+ type TaskStatus
7+ } from './TasksResource' ;
38
49export type JobEvent = 'created' | 'updated' | 'finished' | 'failed' ;
510export type JobStatus = 'processing' | 'finished' | 'error' ;
@@ -31,14 +36,14 @@ export default class JobsResource {
3136 }
3237
3338 async get ( id : string , query = null ) : Promise < Job > {
34- const response = await this . cloudConvert . axios . get ( ' jobs/' + id , {
39+ const response = await this . cloudConvert . axios . get ( ` jobs/${ id } ` , {
3540 params : query || { }
3641 } ) ;
3742 return response . data . data ;
3843 }
3944
4045 async wait ( id : string ) : Promise < Job > {
41- const response = await this . cloudConvert . axios . get ( ' jobs/' + id , {
46+ const response = await this . cloudConvert . axios . get ( ` jobs/${ id } ` , {
4247 baseURL : this . cloudConvert . useSandbox
4348 ? 'https://sync.api.sandbox.cloudconvert.com/v2/'
4449 : 'https://sync.api.cloudconvert.com/v2/'
@@ -68,7 +73,7 @@ export default class JobsResource {
6873 }
6974
7075 async delete ( id : string ) : Promise < void > {
71- await this . cloudConvert . axios . delete ( ' jobs/' + id ) ;
76+ await this . cloudConvert . axios . delete ( ` jobs/${ id } ` ) ;
7277 }
7378
7479 async subscribeEvent (
@@ -77,8 +82,8 @@ export default class JobsResource {
7782 callback : ( event : JobEventData ) => void
7883 ) : Promise < void > {
7984 this . cloudConvert . subscribe (
80- ' private-job.' + id ,
81- ' job.' + event ,
85+ ` private-job.${ id } ` ,
86+ ` job.${ event } ` ,
8287 callback
8388 ) ;
8489 }
@@ -89,8 +94,8 @@ export default class JobsResource {
8994 callback : ( event : TaskEventData ) => void
9095 ) : Promise < void > {
9196 this . cloudConvert . subscribe (
92- ' private-job.' + id + ' .tasks' ,
93- ' task.' + event ,
97+ ` private-job.${ id } .tasks` ,
98+ ` task.${ event } ` ,
9499 callback
95100 ) ;
96101 }
@@ -130,4 +135,5 @@ interface TaskContainer {
130135export interface JobTemplate {
131136 tasks : TaskContainer ;
132137 tag ?: string ;
138+ webhook_url ?: string ;
133139}
0 commit comments