@@ -300,10 +300,17 @@ const BASE_CONTENT_TYPE_JSON = {
300
300
"Content-Type" :"application/json" ,
301
301
} as const satisfies HeadersInit ;
302
302
303
- export type GetTemplateOptions = Readonly < {
303
+ export type GetTemplatesOptions = Readonly < {
304
304
readonly deprecated ?:boolean ;
305
305
} > ;
306
306
307
+ function normalizeGetTemplatesOptions (
308
+ options :GetTemplatesOptions = { } ,
309
+ ) :Record < string , string > {
310
+ const { deprecated= false } = options ;
311
+ return { deprecated :String ( deprecated ) } ;
312
+ }
313
+
307
314
type SearchParamOptions = TypesGen . Pagination & {
308
315
q ?:string ;
309
316
} ;
@@ -626,16 +633,9 @@ class ApiMethods {
626
633
} ;
627
634
628
635
getTemplates = async (
629
- options ?:GetTemplateOptions ,
636
+ options ?:GetTemplatesOptions ,
630
637
) :Promise < TypesGen . Template [ ] > => {
631
- const params :Record < string , string > = { } ;
632
- if ( options ?. deprecated !== undefined ) {
633
- // Just want to check if it isn't undefined. If it has
634
- // a boolean value, convert it to a string and include
635
- // it as a param.
636
- params [ "deprecated" ] = String ( options . deprecated ) ;
637
- }
638
-
638
+ const params = normalizeGetTemplatesOptions ( options ) ;
639
639
const response = await this . axios . get < TypesGen . Template [ ] > (
640
640
`/api/v2/templates` ,
641
641
{ params} ,
@@ -649,16 +649,9 @@ class ApiMethods {
649
649
*/
650
650
getTemplatesByOrganization = async (
651
651
organization :string ,
652
- options ?:GetTemplateOptions ,
652
+ options ?:GetTemplatesOptions ,
653
653
) :Promise < TypesGen . Template [ ] > => {
654
- const params :Record < string , string > = { } ;
655
- if ( options ?. deprecated !== undefined ) {
656
- // Just want to check if it isn't undefined. If it has
657
- // a boolean value, convert it to a string and include
658
- // it as a param.
659
- params [ "deprecated" ] = String ( options . deprecated ) ;
660
- }
661
-
654
+ const params = normalizeGetTemplatesOptions ( options ) ;
662
655
const response = await this . axios . get < TypesGen . Template [ ] > (
663
656
`/api/v2/organizations/${ organization } /templates` ,
664
657
{ params} ,