1- import { AxiosInstance } from "axios" ;
1+ import type { AxiosInstance } from "axios" ;
22import { getAspectRatio } from "../../utils/aspectRatio" ;
3- import {
4- Design ,
5- Project ,
6- RenderableItem ,
7- RenderableItemsListOptions ,
8- } from "../types" ;
3+ import type { Design , Project , RenderableItem , RenderableItemsListOptions } from "../types" ;
94
105export const listRenderableItems = async (
116 client : AxiosInstance ,
127 options : RenderableItemsListOptions = {
138 excludeDesigns : false ,
149 excludeProjects : false ,
15- }
10+ } ,
1611) : Promise < RenderableItem [ ] > => {
17- const designs = options . excludeDesigns
18- ? [ ]
19- : await listRenderableDesigns ( client ) ;
20- const projects = options . excludeProjects
21- ? [ ]
22- : await listRenderableProjects ( client ) ;
12+ const designs = options . excludeDesigns ? [ ] : await listRenderableDesigns ( client ) ;
13+ const projects = options . excludeProjects ? [ ] : await listRenderableProjects ( client ) ;
2314
2415 return [ ...projects , ...designs ] ;
2516} ;
2617
27- const listRenderableDesigns = async (
28- client : AxiosInstance
29- ) : Promise < RenderableItem [ ] > => {
18+ const listRenderableDesigns = async ( client : AxiosInstance ) : Promise < RenderableItem [ ] > => {
3019 const response = await client . get < Design [ ] > ( "/api/v2/designs" ) ;
3120
3221 return response . data
@@ -46,9 +35,7 @@ const listRenderableDesigns = async (
4635 } ) ) ;
4736} ;
4837
49- const listRenderableProjects = async (
50- client : AxiosInstance
51- ) : Promise < RenderableItem [ ] > => {
38+ const listRenderableProjects = async ( client : AxiosInstance ) : Promise < RenderableItem [ ] > => {
5239 const response = await client . get < Project [ ] > ( "/api/v2/projects" ) ;
5340
5441 return response . data
@@ -62,10 +49,7 @@ const listRenderableProjects = async (
6249 templates : project . templates . map ( ( template ) => ( {
6350 id : template . id ,
6451 name : template . name ,
65- aspectRatio : getAspectRatio (
66- template . resolution . width ,
67- template . resolution . height
68- ) ,
52+ aspectRatio : getAspectRatio ( template . resolution . width , template . resolution . height ) ,
6953 durationSeconds : template . duration ,
7054 } ) ) ,
7155 } ) ) ;
0 commit comments