1- import { camel } from 'case' ;
2- import { VERBS_WITH_BODY } from '../../constants' ;
3- import { Verbs } from '../../types' ;
1+ import { camel } from 'case' ;
2+ import { VERBS_WITH_BODY } from '../../constants' ;
3+ import { Verbs } from '../../types' ;
44import {
55 GeneratorOptions ,
66 GeneratorSchema ,
7- GeneratorVerbOptions
7+ GeneratorVerbOptions ,
88} from '../../types/generator' ;
9- import { GetterBody , GetterResponse } from '../../types/getters' ;
9+ import { GetterBody , GetterResponse } from '../../types/getters' ;
1010
1111const generateBodyProps = ( body : GetterBody , verb : Verbs ) => {
1212 if ( ! VERBS_WITH_BODY . includes ( verb ) ) {
@@ -22,7 +22,7 @@ const generateBodyProps = (body: GetterBody, verb: Verbs) => {
2222
2323const generateQueryParamsProps = (
2424 response : GetterResponse ,
25- queryParams ?: GeneratorSchema
25+ queryParams ?: GeneratorSchema ,
2626) => {
2727 if ( ! queryParams && ! response . isBlob ) {
2828 return '' ;
@@ -52,7 +52,7 @@ const generateAxiosProps = ({
5252 body,
5353 queryParams,
5454 response,
55- verb
55+ verb,
5656} : {
5757 route : string ;
5858 body : GetterBody ;
@@ -62,15 +62,15 @@ const generateAxiosProps = ({
6262} ) => {
6363 return `\`${ route } \` ${ generateBodyProps (
6464 body ,
65- verb
65+ verb ,
6666 ) } ${ generateQueryParamsProps ( response , queryParams ) } `;
6767} ;
6868
6969const generateAxiosDefinition = ( {
7070 props,
7171 definitionName,
7272 response,
73- summary
73+ summary,
7474} : GeneratorVerbOptions ) => {
7575 let value = '' ;
7676
@@ -89,7 +89,7 @@ const generateFormData = (body: GetterBody) => {
8989 }
9090
9191 return `const formData = new FormData(); formData.append('file', ${ camel (
92- body . implementation
92+ body . implementation ,
9393 ) } );`;
9494} ;
9595
@@ -101,16 +101,16 @@ const generateAxiosImplementation = (
101101 transformer,
102102 body,
103103 props,
104- verb
104+ verb,
105105 } : GeneratorVerbOptions ,
106- { route} : GeneratorOptions
106+ { route } : GeneratorOptions ,
107107) => {
108108 const axiosProps = generateAxiosProps ( {
109109 route,
110110 body,
111111 queryParams,
112112 response,
113- verb
113+ verb,
114114 } ) ;
115115
116116 return ` ${ definitionName } (${ props . implementation } ): AxiosPromise<${
@@ -126,25 +126,25 @@ const generateAxiosImplementation = (
126126const generateImports = ( {
127127 response,
128128 body,
129- queryParams
129+ queryParams,
130130} : GeneratorVerbOptions ) => [
131131 ...response . imports ,
132132 ...body . imports ,
133- ...( queryParams ? [ queryParams . name ] : [ ] )
133+ ...( queryParams ? [ queryParams . name ] : [ ] ) ,
134134] ;
135135
136136export const generateAxiosHeader = ( title : string ) => ( {
137137 definition : `export interface ${ title } {` ,
138- implementation : `export const get${ title } = (axios: AxiosInstance): ${ title } => ({\n`
138+ implementation : `export const get${ title } = (axios: AxiosInstance): ${ title } => ({\n` ,
139139} ) ;
140140
141141export const generateAxios = (
142142 verbOptions : GeneratorVerbOptions ,
143- options : GeneratorOptions
143+ options : GeneratorOptions ,
144144) => {
145145 const imports = generateImports ( verbOptions ) ;
146146 const definition = generateAxiosDefinition ( verbOptions ) ;
147147 const implementation = generateAxiosImplementation ( verbOptions , options ) ;
148148
149- return { definition, implementation, imports} ;
149+ return { definition, implementation, imports } ;
150150} ;
0 commit comments