11import type { DeferredJobsApiClient } from '../../api' ;
22import { routing } from '../../routing' ;
3- import type { Template } from '../../types' ;
3+ import type { ExtendedTemplate , Template } from '../../types' ;
44
55import type { CreateRequest , UpdateRequest } from './types' ;
66
@@ -15,25 +15,31 @@ export function createClient(api: DeferredJobsApiClient) {
1515 return templates ;
1616 }
1717
18- async function get ( templateId : TemplateId ) : Promise < Template > {
18+ async function get ( templateId : TemplateId ) : Promise < ExtendedTemplate > {
1919 const url = routing . templatesUrl ;
20- const { template } = await api . get < { template : Template } > ( `${ url } /${ templateId } ` ) ;
20+ const { template } = await api . get < { template : ExtendedTemplate } > ( `${ url } /${ templateId } ` ) ;
2121 return template ;
2222 }
2323
24- async function create ( payload : CreateRequest ) : Promise < Template > {
24+ async function create ( payload : CreateRequest ) : Promise < ExtendedTemplate > {
2525 const url = routing . templatesUrl ;
26- const { template } = await api . post < { template : Template } > ( url , {
26+ const { template } = await api . post < { template : ExtendedTemplate } > ( url , {
2727 payload,
2828 } ) ;
2929 return template ;
3030 }
3131
32- async function update ( templateId : TemplateId , payload : UpdateRequest ) : Promise < Template > {
32+ async function update (
33+ templateId : TemplateId ,
34+ payload : UpdateRequest ,
35+ ) : Promise < ExtendedTemplate > {
3336 const url = routing . templatesUrl ;
34- const { template } = await api . patch < { template : Template } > ( `${ url } /${ templateId } ` , {
35- payload,
36- } ) ;
37+ const { template } = await api . patch < { template : ExtendedTemplate } > (
38+ `${ url } /${ templateId } ` ,
39+ {
40+ payload,
41+ } ,
42+ ) ;
3743 return template ;
3844 }
3945
0 commit comments