From 7cccbfb6fd75c29ddc4e16067c359120f2fb8763 Mon Sep 17 00:00:00 2001 From: solufa Date: Sat, 7 Nov 2020 09:02:25 +0900 Subject: [PATCH] fix: convert allOf/oneOf/anyOf --- samples/externals/$api.ts | 2 +- samples/externals/users/$api.ts | 2 +- samples/freee/$api.ts | 100 +++++++++--------- samples/freee/@types.ts | 6 ++ samples/freee/api/$api.ts | 100 +++++++++--------- samples/freee/api/1/$api.ts | 100 +++++++++--------- samples/freee/api/1/account_items/$api.ts | 4 +- samples/freee/api/1/banks/$api.ts | 2 +- samples/freee/api/1/companies/$api.ts | 2 +- samples/freee/api/1/deals/$api.ts | 8 +- .../$api.ts | 4 +- .../freee/api/1/expense_applications/$api.ts | 4 +- samples/freee/api/1/forms/$api.ts | 2 +- samples/freee/api/1/forms/selectables/$api.ts | 2 +- samples/freee/api/1/invoices/$api.ts | 4 +- samples/freee/api/1/items/$api.ts | 4 +- samples/freee/api/1/journals/$api.ts | 6 +- samples/freee/api/1/journals/reports/$api.ts | 4 +- samples/freee/api/1/manual_journals/$api.ts | 4 +- samples/freee/api/1/partners/$api.ts | 4 +- samples/freee/api/1/quotations/$api.ts | 4 +- samples/freee/api/1/receipts/$api.ts | 4 +- samples/freee/api/1/reports/$api.ts | 14 +-- samples/freee/api/1/reports/trial_bs/$api.ts | 2 +- .../1/reports/trial_bs_three_years/$api.ts | 2 +- .../api/1/reports/trial_bs_two_years/$api.ts | 2 +- samples/freee/api/1/reports/trial_pl/$api.ts | 2 +- .../api/1/reports/trial_pl_sections/$api.ts | 2 +- .../1/reports/trial_pl_three_years/$api.ts | 2 +- .../api/1/reports/trial_pl_two_years/$api.ts | 2 +- samples/freee/api/1/sections/$api.ts | 4 +- samples/freee/api/1/segments/$api.ts | 4 +- samples/freee/api/1/tags/$api.ts | 4 +- samples/freee/api/1/transfers/$api.ts | 4 +- samples/freee/api/1/users/$api.ts | 6 +- .../freee/api/1/users/capabilities/$api.ts | 2 +- samples/freee/api/1/users/me/$api.ts | 2 +- samples/freee/api/1/wallet_txns/$api.ts | 4 +- samples/freee/api/1/walletables/$api.ts | 4 +- samples/openapi/$api.ts | 22 ++-- samples/openapi/api/$api.ts | 22 ++-- samples/openapi/api/stream/$api.ts | 4 +- samples/openapi/api/stream/v1/$api.ts | 4 +- samples/openapi/api/stream/v1/stories/$api.ts | 4 +- samples/openapi/api/v3/$api.ts | 18 ++-- samples/openapi/api/v3/channels/$api.ts | 12 +-- samples/openapi/api/v3/chats/$api.ts | 2 +- samples/openapi/api/v3/organisation/$api.ts | 2 +- .../openapi/api/v3/organisation/users/$api.ts | 2 +- samples/openapi/api/v3/stories/$api.ts | 2 +- samples/simple/$api.ts | 6 +- samples/simple/dummy/$api.ts | 2 +- samples/simple/file/$api.ts | 2 +- samples/simple/user/$api.ts | 2 +- samples/strapi/$api.ts | 6 +- samples/strapi/users-permissions/$api.ts | 4 +- .../strapi/users-permissions/roles/$api.ts | 2 +- .../strapi/users-permissions/search/$api.ts | 2 +- samples/strapi/users/$api.ts | 2 +- samples/swagger/$api.ts | 44 ++++---- samples/swagger/pet/$api.ts | 18 ++-- samples/swagger/pet/findByStatus/$api.ts | 2 +- samples/swagger/store/$api.ts | 4 +- samples/swagger/store/order/$api.ts | 4 +- samples/swagger/user/$api.ts | 22 ++-- samples/swagger/user/createWithArray/$api.ts | 4 +- samples/swagger/user/createWithList/$api.ts | 4 +- samples/swagger/user/login/$api.ts | 2 +- src/buildV3.ts | 10 -- src/builderUtils/converters.ts | 13 +-- src/builderUtils/parameters2Props.ts | 1 - src/builderUtils/props2String.ts | 18 ++-- 72 files changed, 347 insertions(+), 355 deletions(-) diff --git a/samples/externals/$api.ts b/samples/externals/$api.ts index 4254284a..5f21f1a9 100644 --- a/samples/externals/$api.ts +++ b/samples/externals/$api.ts @@ -77,7 +77,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, phone_numbers: { _phone_number: (val2: string) => { diff --git a/samples/externals/users/$api.ts b/samples/externals/users/$api.ts index bf788247..fce66c3a 100644 --- a/samples/externals/users/$api.ts +++ b/samples/externals/users/$api.ts @@ -76,7 +76,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, phone_numbers: { _phone_number: (val2: string) => { diff --git a/samples/freee/$api.ts b/samples/freee/$api.ts index c97634c1..956ab9e9 100644 --- a/samples/freee/$api.ts +++ b/samples/freee/$api.ts @@ -126,7 +126,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -138,7 +138,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, banks: { _id: (val1: number) => { @@ -157,7 +157,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods2['get']['query'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, companies: { _id: (val2: number) => { @@ -173,7 +173,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods5['get']['query'] }) => - `${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { config?: T }) => @@ -201,7 +201,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods9['delete']['query'], config?: T }) => fetch(prefix, prefix4, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods9['delete']['query'] }) => - `${prefix}${prefix4}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods8['post']['reqBody'], config?: T }) => @@ -224,7 +224,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods11['delete']['query'], config?: T }) => fetch(prefix, prefix5, DELETE, option).json().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods11['delete']['query'] }) => - `${prefix}${prefix5}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix5}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods10['post']['reqBody'], config?: T }) => @@ -246,7 +246,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods7['delete']['query'], config?: T }) => fetch(prefix, prefix3, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods7['get']['query'] } | { method: 'delete'; query: Methods7['delete']['query'] }) => - `${prefix}${prefix3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods6['get']['query'], config?: T }) => @@ -258,7 +258,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods6['get']['query'] }) => - `${prefix}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_application_line_templates: { _id: (val6: number) => { @@ -278,7 +278,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods13['delete']['query'], config?: T }) => fetch(prefix, prefix6, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] } | { method: 'delete'; query: Methods13['delete']['query'] }) => - `${prefix}${prefix6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods12['get']['query'], config?: T }) => @@ -290,7 +290,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods12['get']['query'] }) => - `${prefix}${PATH6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_applications: { _id: (val7: number) => { @@ -310,7 +310,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods15['delete']['query'], config?: T }) => fetch(prefix, prefix7, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods15['get']['query'] } | { method: 'delete'; query: Methods15['delete']['query'] }) => - `${prefix}${prefix7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods14['get']['query'], config?: T }) => @@ -322,7 +322,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${PATH7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, forms: { selectables: { @@ -331,7 +331,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods16['get']['query'], config?: T }) => fetch(prefix, PATH8, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods16['get']['query'] }) => - `${prefix}${PATH8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, invoices: { @@ -352,7 +352,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods18['delete']['query'], config?: T }) => fetch(prefix, prefix8, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods18['get']['query'] } | { method: 'delete'; query: Methods18['delete']['query'] }) => - `${prefix}${prefix8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods17['get']['query'], config?: T }) => @@ -364,7 +364,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods17['get']['query'] }) => - `${prefix}${PATH9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, items: { _id: (val9: number) => { @@ -384,7 +384,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods20['delete']['query'], config?: T }) => fetch(prefix, prefix9, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods20['get']['query'] } | { method: 'delete'; query: Methods20['delete']['query'] }) => - `${prefix}${prefix9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods19['get']['query'], config?: T }) => @@ -396,7 +396,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods19['get']['query'] }) => - `${prefix}${PATH10}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH10}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, journals: { reports: { @@ -410,7 +410,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods22['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods22['get']['query'] }) => - `${prefix}${prefix10}${PATH13}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH13}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, status: { get: (option: { query: Methods23['get']['query'], config?: T }) => @@ -418,7 +418,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods23['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods23['get']['query'] }) => - `${prefix}${prefix10}${PATH14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -428,7 +428,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods21['get']['query'], config?: T }) => fetch(prefix, PATH11, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, manual_journals: { _id: (val11: number) => { @@ -448,7 +448,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods25['delete']['query'], config?: T }) => fetch(prefix, prefix11, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods25['get']['query'] } | { method: 'delete'; query: Methods25['delete']['query'] }) => - `${prefix}${prefix11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods24['get']['query'], config?: T }) => @@ -460,7 +460,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods24['get']['query'] }) => - `${prefix}${PATH15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, partners: { _id: (val12: number) => { @@ -480,7 +480,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods27['delete']['query'], config?: T }) => fetch(prefix, prefix12, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods27['get']['query'] } | { method: 'delete'; query: Methods27['delete']['query'] }) => - `${prefix}${prefix12}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix12}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, code: { @@ -505,7 +505,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods26['get']['query'] }) => - `${prefix}${PATH16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, quotations: { _id: (val14: number) => { @@ -525,7 +525,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods30['delete']['query'], config?: T }) => fetch(prefix, prefix14, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods30['get']['query'] } | { method: 'delete'; query: Methods30['delete']['query'] }) => - `${prefix}${prefix14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods29['get']['query'], config?: T }) => @@ -537,7 +537,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods29['get']['query'] }) => - `${prefix}${PATH18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, receipts: { _id: (val15: number) => { @@ -557,7 +557,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods32['delete']['query'], config?: T }) => fetch(prefix, prefix15, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods32['get']['query'] } | { method: 'delete'; query: Methods32['delete']['query'] }) => - `${prefix}${prefix15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods31['get']['query'], config?: T }) => @@ -569,7 +569,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods31['get']['query'] }) => - `${prefix}${PATH19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, reports: { trial_bs: { @@ -578,7 +578,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods33['get']['query'], config?: T }) => fetch(prefix, PATH20, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods33['get']['query'] }) => - `${prefix}${PATH20}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH20}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_three_years: { get: (option: { query: Methods34['get']['query'], config?: T }) => @@ -586,7 +586,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods34['get']['query'], config?: T }) => fetch(prefix, PATH21, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods34['get']['query'] }) => - `${prefix}${PATH21}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH21}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_two_years: { get: (option: { query: Methods35['get']['query'], config?: T }) => @@ -594,7 +594,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods35['get']['query'], config?: T }) => fetch(prefix, PATH22, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods35['get']['query'] }) => - `${prefix}${PATH22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl: { get: (option: { query: Methods36['get']['query'], config?: T }) => @@ -602,7 +602,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods36['get']['query'], config?: T }) => fetch(prefix, PATH23, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods36['get']['query'] }) => - `${prefix}${PATH23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_sections: { get: (option: { query: Methods37['get']['query'], config?: T }) => @@ -610,7 +610,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods37['get']['query'], config?: T }) => fetch(prefix, PATH24, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods37['get']['query'] }) => - `${prefix}${PATH24}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH24}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_three_years: { get: (option: { query: Methods38['get']['query'], config?: T }) => @@ -618,7 +618,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods38['get']['query'], config?: T }) => fetch(prefix, PATH25, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods38['get']['query'] }) => - `${prefix}${PATH25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_two_years: { get: (option: { query: Methods39['get']['query'], config?: T }) => @@ -626,7 +626,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods39['get']['query'], config?: T }) => fetch(prefix, PATH26, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods39['get']['query'] }) => - `${prefix}${PATH26}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH26}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, sections: { @@ -647,7 +647,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods41['delete']['query'], config?: T }) => fetch(prefix, prefix16, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods41['get']['query'] } | { method: 'delete'; query: Methods41['delete']['query'] }) => - `${prefix}${prefix16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods40['get']['query'], config?: T }) => @@ -659,7 +659,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods40['get']['query'] }) => - `${prefix}${PATH27}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH27}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, segments: { _segment_id: (val17: number) => { @@ -680,7 +680,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods43['delete']['query'], config?: T }) => fetch(prefix, prefix18, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods43['delete']['query'] }) => - `${prefix}${prefix18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods42['get']['query'], config?: T }) => @@ -692,7 +692,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods42['get']['query'] }) => - `${prefix}${prefix17}${PATH29}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix17}${PATH29}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -715,7 +715,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods45['delete']['query'], config?: T }) => fetch(prefix, prefix19, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods45['get']['query'] } | { method: 'delete'; query: Methods45['delete']['query'] }) => - `${prefix}${prefix19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods44['get']['query'], config?: T }) => @@ -727,7 +727,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods44['get']['query'] }) => - `${prefix}${PATH30}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH30}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, taxes: { codes: { @@ -780,7 +780,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods50['delete']['query'], config?: T }) => fetch(prefix, prefix22, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods50['get']['query'] } | { method: 'delete'; query: Methods50['delete']['query'] }) => - `${prefix}${prefix22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods49['get']['query'], config?: T }) => @@ -792,7 +792,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods49['get']['query'] }) => - `${prefix}${PATH33}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH33}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { capabilities: { @@ -801,7 +801,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods52['get']['query'], config?: T }) => fetch(prefix, PATH35, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods52['get']['query'] }) => - `${prefix}${PATH35}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH35}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, me: { get: (option?: { query?: Methods53['get']['query'], config?: T }) => @@ -813,14 +813,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods53['get']['query'] }) => - `${prefix}${PATH36}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH36}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json(), $get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods51['get']['query'] }) => - `${prefix}${PATH34}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH34}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, wallet_txns: { _id: (val23: number) => { @@ -836,7 +836,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods55['delete']['query'], config?: T }) => fetch(prefix, prefix23, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods55['get']['query'] } | { method: 'delete'; query: Methods55['delete']['query'] }) => - `${prefix}${prefix23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods54['get']['query'], config?: T }) => @@ -848,7 +848,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods54['get']['query'] }) => - `${prefix}${PATH37}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH37}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, walletables: { _type: (val24: number | string) => { @@ -872,7 +872,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods57['delete']['query'], config?: T }) => fetch(prefix, prefix25, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods57['get']['query'] } | { method: 'put'; query: Methods57['put']['query'] } | { method: 'delete'; query: Methods57['delete']['query'] }) => - `${prefix}${prefix25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -886,7 +886,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods56['get']['query'] }) => - `${prefix}${PATH38}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH38}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/@types.ts b/samples/freee/@types.ts index 680af338..d0b6bae4 100644 --- a/samples/freee/@types.ts +++ b/samples/freee/@types.ts @@ -1165,6 +1165,8 @@ export type forbiddenError = { export type badRequestError = { status_code?: number errors?: { + messages: Partial + type: 'status' | 'validation' | 'error' }[] } @@ -1172,6 +1174,8 @@ export type badRequestError = { export type badRequestNotFoundError = { status_code?: number errors?: { + messages: Partial + type: 'status' | 'validation' | 'error' }[] } @@ -1190,6 +1194,8 @@ export type tooManyRequestsError = { export type internalServerError = { status_code?: number errors?: { + messages: Partial + type: 'status' | 'validation' | 'error' }[] } diff --git a/samples/freee/api/$api.ts b/samples/freee/api/$api.ts index 70da0417..48240fd4 100644 --- a/samples/freee/api/$api.ts +++ b/samples/freee/api/$api.ts @@ -125,7 +125,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -137,7 +137,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, banks: { _id: (val1: number) => { @@ -156,7 +156,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods2['get']['query'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, companies: { _id: (val2: number) => { @@ -172,7 +172,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods5['get']['query'] }) => - `${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { config?: T }) => @@ -200,7 +200,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods9['delete']['query'], config?: T }) => fetch(prefix, prefix4, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods9['delete']['query'] }) => - `${prefix}${prefix4}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods8['post']['reqBody'], config?: T }) => @@ -223,7 +223,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods11['delete']['query'], config?: T }) => fetch(prefix, prefix5, DELETE, option).json().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods11['delete']['query'] }) => - `${prefix}${prefix5}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix5}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods10['post']['reqBody'], config?: T }) => @@ -245,7 +245,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods7['delete']['query'], config?: T }) => fetch(prefix, prefix3, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods7['get']['query'] } | { method: 'delete'; query: Methods7['delete']['query'] }) => - `${prefix}${prefix3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods6['get']['query'], config?: T }) => @@ -257,7 +257,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods6['get']['query'] }) => - `${prefix}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_application_line_templates: { _id: (val6: number) => { @@ -277,7 +277,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods13['delete']['query'], config?: T }) => fetch(prefix, prefix6, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] } | { method: 'delete'; query: Methods13['delete']['query'] }) => - `${prefix}${prefix6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods12['get']['query'], config?: T }) => @@ -289,7 +289,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods12['get']['query'] }) => - `${prefix}${PATH6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_applications: { _id: (val7: number) => { @@ -309,7 +309,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods15['delete']['query'], config?: T }) => fetch(prefix, prefix7, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods15['get']['query'] } | { method: 'delete'; query: Methods15['delete']['query'] }) => - `${prefix}${prefix7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods14['get']['query'], config?: T }) => @@ -321,7 +321,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${PATH7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, forms: { selectables: { @@ -330,7 +330,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods16['get']['query'], config?: T }) => fetch(prefix, PATH8, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods16['get']['query'] }) => - `${prefix}${PATH8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, invoices: { @@ -351,7 +351,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods18['delete']['query'], config?: T }) => fetch(prefix, prefix8, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods18['get']['query'] } | { method: 'delete'; query: Methods18['delete']['query'] }) => - `${prefix}${prefix8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods17['get']['query'], config?: T }) => @@ -363,7 +363,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods17['get']['query'] }) => - `${prefix}${PATH9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, items: { _id: (val9: number) => { @@ -383,7 +383,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods20['delete']['query'], config?: T }) => fetch(prefix, prefix9, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods20['get']['query'] } | { method: 'delete'; query: Methods20['delete']['query'] }) => - `${prefix}${prefix9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods19['get']['query'], config?: T }) => @@ -395,7 +395,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods19['get']['query'] }) => - `${prefix}${PATH10}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH10}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, journals: { reports: { @@ -409,7 +409,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods22['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods22['get']['query'] }) => - `${prefix}${prefix10}${PATH13}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH13}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, status: { get: (option: { query: Methods23['get']['query'], config?: T }) => @@ -417,7 +417,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods23['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods23['get']['query'] }) => - `${prefix}${prefix10}${PATH14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -427,7 +427,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods21['get']['query'], config?: T }) => fetch(prefix, PATH11, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, manual_journals: { _id: (val11: number) => { @@ -447,7 +447,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods25['delete']['query'], config?: T }) => fetch(prefix, prefix11, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods25['get']['query'] } | { method: 'delete'; query: Methods25['delete']['query'] }) => - `${prefix}${prefix11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods24['get']['query'], config?: T }) => @@ -459,7 +459,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods24['get']['query'] }) => - `${prefix}${PATH15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, partners: { _id: (val12: number) => { @@ -479,7 +479,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods27['delete']['query'], config?: T }) => fetch(prefix, prefix12, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods27['get']['query'] } | { method: 'delete'; query: Methods27['delete']['query'] }) => - `${prefix}${prefix12}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix12}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, code: { @@ -504,7 +504,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods26['get']['query'] }) => - `${prefix}${PATH16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, quotations: { _id: (val14: number) => { @@ -524,7 +524,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods30['delete']['query'], config?: T }) => fetch(prefix, prefix14, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods30['get']['query'] } | { method: 'delete'; query: Methods30['delete']['query'] }) => - `${prefix}${prefix14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods29['get']['query'], config?: T }) => @@ -536,7 +536,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods29['get']['query'] }) => - `${prefix}${PATH18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, receipts: { _id: (val15: number) => { @@ -556,7 +556,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods32['delete']['query'], config?: T }) => fetch(prefix, prefix15, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods32['get']['query'] } | { method: 'delete'; query: Methods32['delete']['query'] }) => - `${prefix}${prefix15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods31['get']['query'], config?: T }) => @@ -568,7 +568,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods31['get']['query'] }) => - `${prefix}${PATH19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, reports: { trial_bs: { @@ -577,7 +577,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods33['get']['query'], config?: T }) => fetch(prefix, PATH20, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods33['get']['query'] }) => - `${prefix}${PATH20}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH20}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_three_years: { get: (option: { query: Methods34['get']['query'], config?: T }) => @@ -585,7 +585,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods34['get']['query'], config?: T }) => fetch(prefix, PATH21, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods34['get']['query'] }) => - `${prefix}${PATH21}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH21}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_two_years: { get: (option: { query: Methods35['get']['query'], config?: T }) => @@ -593,7 +593,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods35['get']['query'], config?: T }) => fetch(prefix, PATH22, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods35['get']['query'] }) => - `${prefix}${PATH22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl: { get: (option: { query: Methods36['get']['query'], config?: T }) => @@ -601,7 +601,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods36['get']['query'], config?: T }) => fetch(prefix, PATH23, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods36['get']['query'] }) => - `${prefix}${PATH23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_sections: { get: (option: { query: Methods37['get']['query'], config?: T }) => @@ -609,7 +609,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods37['get']['query'], config?: T }) => fetch(prefix, PATH24, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods37['get']['query'] }) => - `${prefix}${PATH24}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH24}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_three_years: { get: (option: { query: Methods38['get']['query'], config?: T }) => @@ -617,7 +617,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods38['get']['query'], config?: T }) => fetch(prefix, PATH25, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods38['get']['query'] }) => - `${prefix}${PATH25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_two_years: { get: (option: { query: Methods39['get']['query'], config?: T }) => @@ -625,7 +625,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods39['get']['query'], config?: T }) => fetch(prefix, PATH26, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods39['get']['query'] }) => - `${prefix}${PATH26}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH26}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, sections: { @@ -646,7 +646,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods41['delete']['query'], config?: T }) => fetch(prefix, prefix16, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods41['get']['query'] } | { method: 'delete'; query: Methods41['delete']['query'] }) => - `${prefix}${prefix16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods40['get']['query'], config?: T }) => @@ -658,7 +658,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods40['get']['query'] }) => - `${prefix}${PATH27}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH27}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, segments: { _segment_id: (val17: number) => { @@ -679,7 +679,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods43['delete']['query'], config?: T }) => fetch(prefix, prefix18, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods43['delete']['query'] }) => - `${prefix}${prefix18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods42['get']['query'], config?: T }) => @@ -691,7 +691,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods42['get']['query'] }) => - `${prefix}${prefix17}${PATH29}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix17}${PATH29}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -714,7 +714,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods45['delete']['query'], config?: T }) => fetch(prefix, prefix19, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods45['get']['query'] } | { method: 'delete'; query: Methods45['delete']['query'] }) => - `${prefix}${prefix19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods44['get']['query'], config?: T }) => @@ -726,7 +726,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods44['get']['query'] }) => - `${prefix}${PATH30}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH30}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, taxes: { codes: { @@ -779,7 +779,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods50['delete']['query'], config?: T }) => fetch(prefix, prefix22, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods50['get']['query'] } | { method: 'delete'; query: Methods50['delete']['query'] }) => - `${prefix}${prefix22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods49['get']['query'], config?: T }) => @@ -791,7 +791,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods49['get']['query'] }) => - `${prefix}${PATH33}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH33}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { capabilities: { @@ -800,7 +800,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods52['get']['query'], config?: T }) => fetch(prefix, PATH35, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods52['get']['query'] }) => - `${prefix}${PATH35}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH35}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, me: { get: (option?: { query?: Methods53['get']['query'], config?: T }) => @@ -812,14 +812,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods53['get']['query'] }) => - `${prefix}${PATH36}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH36}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json(), $get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods51['get']['query'] }) => - `${prefix}${PATH34}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH34}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, wallet_txns: { _id: (val23: number) => { @@ -835,7 +835,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods55['delete']['query'], config?: T }) => fetch(prefix, prefix23, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods55['get']['query'] } | { method: 'delete'; query: Methods55['delete']['query'] }) => - `${prefix}${prefix23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods54['get']['query'], config?: T }) => @@ -847,7 +847,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods54['get']['query'] }) => - `${prefix}${PATH37}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH37}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, walletables: { _type: (val24: number | string) => { @@ -871,7 +871,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods57['delete']['query'], config?: T }) => fetch(prefix, prefix25, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods57['get']['query'] } | { method: 'put'; query: Methods57['put']['query'] } | { method: 'delete'; query: Methods57['delete']['query'] }) => - `${prefix}${prefix25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -885,7 +885,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods56['get']['query'] }) => - `${prefix}${PATH38}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH38}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/$api.ts b/samples/freee/api/1/$api.ts index 8e9009ee..d556f077 100644 --- a/samples/freee/api/1/$api.ts +++ b/samples/freee/api/1/$api.ts @@ -124,7 +124,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -136,7 +136,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, banks: { _id: (val1: number) => { @@ -155,7 +155,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods2['get']['query'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, companies: { _id: (val2: number) => { @@ -171,7 +171,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods5['get']['query'] }) => - `${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { config?: T }) => @@ -199,7 +199,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods9['delete']['query'], config?: T }) => fetch(prefix, prefix4, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods9['delete']['query'] }) => - `${prefix}${prefix4}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods8['post']['reqBody'], config?: T }) => @@ -222,7 +222,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods11['delete']['query'], config?: T }) => fetch(prefix, prefix5, DELETE, option).json().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods11['delete']['query'] }) => - `${prefix}${prefix5}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix5}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods10['post']['reqBody'], config?: T }) => @@ -244,7 +244,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods7['delete']['query'], config?: T }) => fetch(prefix, prefix3, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods7['get']['query'] } | { method: 'delete'; query: Methods7['delete']['query'] }) => - `${prefix}${prefix3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods6['get']['query'], config?: T }) => @@ -256,7 +256,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods6['get']['query'] }) => - `${prefix}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_application_line_templates: { _id: (val6: number) => { @@ -276,7 +276,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods13['delete']['query'], config?: T }) => fetch(prefix, prefix6, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] } | { method: 'delete'; query: Methods13['delete']['query'] }) => - `${prefix}${prefix6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods12['get']['query'], config?: T }) => @@ -288,7 +288,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods12['get']['query'] }) => - `${prefix}${PATH6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, expense_applications: { _id: (val7: number) => { @@ -308,7 +308,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods15['delete']['query'], config?: T }) => fetch(prefix, prefix7, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods15['get']['query'] } | { method: 'delete'; query: Methods15['delete']['query'] }) => - `${prefix}${prefix7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods14['get']['query'], config?: T }) => @@ -320,7 +320,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${PATH7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, forms: { selectables: { @@ -329,7 +329,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods16['get']['query'], config?: T }) => fetch(prefix, PATH8, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods16['get']['query'] }) => - `${prefix}${PATH8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, invoices: { @@ -350,7 +350,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods18['delete']['query'], config?: T }) => fetch(prefix, prefix8, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods18['get']['query'] } | { method: 'delete'; query: Methods18['delete']['query'] }) => - `${prefix}${prefix8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods17['get']['query'], config?: T }) => @@ -362,7 +362,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods17['get']['query'] }) => - `${prefix}${PATH9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, items: { _id: (val9: number) => { @@ -382,7 +382,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods20['delete']['query'], config?: T }) => fetch(prefix, prefix9, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods20['get']['query'] } | { method: 'delete'; query: Methods20['delete']['query'] }) => - `${prefix}${prefix9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods19['get']['query'], config?: T }) => @@ -394,7 +394,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods19['get']['query'] }) => - `${prefix}${PATH10}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH10}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, journals: { reports: { @@ -408,7 +408,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods22['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods22['get']['query'] }) => - `${prefix}${prefix10}${PATH13}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH13}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, status: { get: (option: { query: Methods23['get']['query'], config?: T }) => @@ -416,7 +416,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods23['get']['query'], config?: T }) => fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods23['get']['query'] }) => - `${prefix}${prefix10}${PATH14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -426,7 +426,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods21['get']['query'], config?: T }) => fetch(prefix, PATH11, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, manual_journals: { _id: (val11: number) => { @@ -446,7 +446,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods25['delete']['query'], config?: T }) => fetch(prefix, prefix11, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods25['get']['query'] } | { method: 'delete'; query: Methods25['delete']['query'] }) => - `${prefix}${prefix11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods24['get']['query'], config?: T }) => @@ -458,7 +458,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods24['get']['query'] }) => - `${prefix}${PATH15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, partners: { _id: (val12: number) => { @@ -478,7 +478,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods27['delete']['query'], config?: T }) => fetch(prefix, prefix12, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods27['get']['query'] } | { method: 'delete'; query: Methods27['delete']['query'] }) => - `${prefix}${prefix12}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix12}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, code: { @@ -503,7 +503,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods26['get']['query'] }) => - `${prefix}${PATH16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, quotations: { _id: (val14: number) => { @@ -523,7 +523,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods30['delete']['query'], config?: T }) => fetch(prefix, prefix14, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods30['get']['query'] } | { method: 'delete'; query: Methods30['delete']['query'] }) => - `${prefix}${prefix14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods29['get']['query'], config?: T }) => @@ -535,7 +535,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods29['get']['query'] }) => - `${prefix}${PATH18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, receipts: { _id: (val15: number) => { @@ -555,7 +555,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods32['delete']['query'], config?: T }) => fetch(prefix, prefix15, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods32['get']['query'] } | { method: 'delete'; query: Methods32['delete']['query'] }) => - `${prefix}${prefix15}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix15}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods31['get']['query'], config?: T }) => @@ -567,7 +567,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods31['get']['query'] }) => - `${prefix}${PATH19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, reports: { trial_bs: { @@ -576,7 +576,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods33['get']['query'], config?: T }) => fetch(prefix, PATH20, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods33['get']['query'] }) => - `${prefix}${PATH20}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH20}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_three_years: { get: (option: { query: Methods34['get']['query'], config?: T }) => @@ -584,7 +584,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods34['get']['query'], config?: T }) => fetch(prefix, PATH21, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods34['get']['query'] }) => - `${prefix}${PATH21}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH21}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_two_years: { get: (option: { query: Methods35['get']['query'], config?: T }) => @@ -592,7 +592,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods35['get']['query'], config?: T }) => fetch(prefix, PATH22, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods35['get']['query'] }) => - `${prefix}${PATH22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl: { get: (option: { query: Methods36['get']['query'], config?: T }) => @@ -600,7 +600,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods36['get']['query'], config?: T }) => fetch(prefix, PATH23, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods36['get']['query'] }) => - `${prefix}${PATH23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_sections: { get: (option: { query: Methods37['get']['query'], config?: T }) => @@ -608,7 +608,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods37['get']['query'], config?: T }) => fetch(prefix, PATH24, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods37['get']['query'] }) => - `${prefix}${PATH24}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH24}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_three_years: { get: (option: { query: Methods38['get']['query'], config?: T }) => @@ -616,7 +616,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods38['get']['query'], config?: T }) => fetch(prefix, PATH25, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods38['get']['query'] }) => - `${prefix}${PATH25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_two_years: { get: (option: { query: Methods39['get']['query'], config?: T }) => @@ -624,7 +624,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods39['get']['query'], config?: T }) => fetch(prefix, PATH26, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods39['get']['query'] }) => - `${prefix}${PATH26}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH26}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, sections: { @@ -645,7 +645,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods41['delete']['query'], config?: T }) => fetch(prefix, prefix16, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods41['get']['query'] } | { method: 'delete'; query: Methods41['delete']['query'] }) => - `${prefix}${prefix16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods40['get']['query'], config?: T }) => @@ -657,7 +657,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods40['get']['query'] }) => - `${prefix}${PATH27}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH27}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, segments: { _segment_id: (val17: number) => { @@ -678,7 +678,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods43['delete']['query'], config?: T }) => fetch(prefix, prefix18, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods43['delete']['query'] }) => - `${prefix}${prefix18}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix18}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods42['get']['query'], config?: T }) => @@ -690,7 +690,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods42['get']['query'] }) => - `${prefix}${prefix17}${PATH29}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix17}${PATH29}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -713,7 +713,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods45['delete']['query'], config?: T }) => fetch(prefix, prefix19, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods45['get']['query'] } | { method: 'delete'; query: Methods45['delete']['query'] }) => - `${prefix}${prefix19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods44['get']['query'], config?: T }) => @@ -725,7 +725,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods44['get']['query'] }) => - `${prefix}${PATH30}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH30}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, taxes: { codes: { @@ -778,7 +778,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods50['delete']['query'], config?: T }) => fetch(prefix, prefix22, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods50['get']['query'] } | { method: 'delete'; query: Methods50['delete']['query'] }) => - `${prefix}${prefix22}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix22}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods49['get']['query'], config?: T }) => @@ -790,7 +790,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods49['get']['query'] }) => - `${prefix}${PATH33}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH33}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { capabilities: { @@ -799,7 +799,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods52['get']['query'], config?: T }) => fetch(prefix, PATH35, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods52['get']['query'] }) => - `${prefix}${PATH35}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH35}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, me: { get: (option?: { query?: Methods53['get']['query'], config?: T }) => @@ -811,14 +811,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods53['get']['query'] }) => - `${prefix}${PATH36}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH36}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json(), $get: (option: { query: Methods51['get']['query'], config?: T }) => fetch(prefix, PATH34, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods51['get']['query'] }) => - `${prefix}${PATH34}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH34}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, wallet_txns: { _id: (val23: number) => { @@ -834,7 +834,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods55['delete']['query'], config?: T }) => fetch(prefix, prefix23, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods55['get']['query'] } | { method: 'delete'; query: Methods55['delete']['query'] }) => - `${prefix}${prefix23}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix23}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods54['get']['query'], config?: T }) => @@ -846,7 +846,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods54['get']['query'] }) => - `${prefix}${PATH37}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH37}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, walletables: { _type: (val24: number | string) => { @@ -870,7 +870,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods57['delete']['query'], config?: T }) => fetch(prefix, prefix25, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods57['get']['query'] } | { method: 'put'; query: Methods57['put']['query'] } | { method: 'delete'; query: Methods57['delete']['query'] }) => - `${prefix}${prefix25}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix25}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -884,7 +884,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods56['get']['query'] }) => - `${prefix}${PATH38}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH38}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/account_items/$api.ts b/samples/freee/api/1/account_items/$api.ts index 1d859d8e..089e7b21 100644 --- a/samples/freee/api/1/account_items/$api.ts +++ b/samples/freee/api/1/account_items/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/banks/$api.ts b/samples/freee/api/1/banks/$api.ts index 9426b1cd..76814ca4 100644 --- a/samples/freee/api/1/banks/$api.ts +++ b/samples/freee/api/1/banks/$api.ts @@ -25,7 +25,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/companies/$api.ts b/samples/freee/api/1/companies/$api.ts index 8e970348..dc4479cd 100644 --- a/samples/freee/api/1/companies/$api.ts +++ b/samples/freee/api/1/companies/$api.ts @@ -23,7 +23,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { config?: T }) => diff --git a/samples/freee/api/1/deals/$api.ts b/samples/freee/api/1/deals/$api.ts index 7804f90c..fe831ba1 100644 --- a/samples/freee/api/1/deals/$api.ts +++ b/samples/freee/api/1/deals/$api.ts @@ -36,7 +36,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods3['delete']['query'], config?: T }) => fetch(prefix, prefix1, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods3['delete']['query'] }) => - `${prefix}${prefix1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods2['post']['reqBody'], config?: T }) => @@ -59,7 +59,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods5['delete']['query'], config?: T }) => fetch(prefix, prefix2, DELETE, option).json().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods5['delete']['query'] }) => - `${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, post: (option: { body: Methods4['post']['reqBody'], config?: T }) => @@ -81,7 +81,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -93,7 +93,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/expense_application_line_templates/$api.ts b/samples/freee/api/1/expense_application_line_templates/$api.ts index 56a87236..4f1441d0 100644 --- a/samples/freee/api/1/expense_application_line_templates/$api.ts +++ b/samples/freee/api/1/expense_application_line_templates/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/expense_applications/$api.ts b/samples/freee/api/1/expense_applications/$api.ts index 9a281185..bed31c11 100644 --- a/samples/freee/api/1/expense_applications/$api.ts +++ b/samples/freee/api/1/expense_applications/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/forms/$api.ts b/samples/freee/api/1/forms/$api.ts index a5219e0f..f22639ee 100644 --- a/samples/freee/api/1/forms/$api.ts +++ b/samples/freee/api/1/forms/$api.ts @@ -14,7 +14,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/forms/selectables/$api.ts b/samples/freee/api/1/forms/selectables/$api.ts index 88b19901..8a1c4429 100644 --- a/samples/freee/api/1/forms/selectables/$api.ts +++ b/samples/freee/api/1/forms/selectables/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/invoices/$api.ts b/samples/freee/api/1/invoices/$api.ts index aaca0dde..9ea23f26 100644 --- a/samples/freee/api/1/invoices/$api.ts +++ b/samples/freee/api/1/invoices/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/items/$api.ts b/samples/freee/api/1/items/$api.ts index 3639db3f..53fbd0bf 100644 --- a/samples/freee/api/1/items/$api.ts +++ b/samples/freee/api/1/items/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/journals/$api.ts b/samples/freee/api/1/journals/$api.ts index 2c1a747c..a16f4885 100644 --- a/samples/freee/api/1/journals/$api.ts +++ b/samples/freee/api/1/journals/$api.ts @@ -24,7 +24,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH2}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, status: { get: (option: { query: Methods2['get']['query'], config?: T }) => @@ -32,7 +32,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods2['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH3}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${prefix0}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -42,7 +42,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/journals/reports/$api.ts b/samples/freee/api/1/journals/reports/$api.ts index 44b53930..d30dbea5 100644 --- a/samples/freee/api/1/journals/reports/$api.ts +++ b/samples/freee/api/1/journals/reports/$api.ts @@ -21,7 +21,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, status: { get: (option: { query: Methods1['get']['query'], config?: T }) => @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH2}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/manual_journals/$api.ts b/samples/freee/api/1/manual_journals/$api.ts index 80d94117..72029346 100644 --- a/samples/freee/api/1/manual_journals/$api.ts +++ b/samples/freee/api/1/manual_journals/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/partners/$api.ts b/samples/freee/api/1/partners/$api.ts index 57482f7f..51f1384e 100644 --- a/samples/freee/api/1/partners/$api.ts +++ b/samples/freee/api/1/partners/$api.ts @@ -31,7 +31,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, code: { @@ -56,7 +56,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/quotations/$api.ts b/samples/freee/api/1/quotations/$api.ts index 5b17a6d0..3bb6002f 100644 --- a/samples/freee/api/1/quotations/$api.ts +++ b/samples/freee/api/1/quotations/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/receipts/$api.ts b/samples/freee/api/1/receipts/$api.ts index 4e1fa3e2..ab16e58a 100644 --- a/samples/freee/api/1/receipts/$api.ts +++ b/samples/freee/api/1/receipts/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/$api.ts b/samples/freee/api/1/reports/$api.ts index 19d32d34..9cf90053 100644 --- a/samples/freee/api/1/reports/$api.ts +++ b/samples/freee/api/1/reports/$api.ts @@ -26,7 +26,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_three_years: { get: (option: { query: Methods1['get']['query'], config?: T }) => @@ -34,7 +34,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_bs_two_years: { get: (option: { query: Methods2['get']['query'], config?: T }) => @@ -42,7 +42,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods2['get']['query'], config?: T }) => fetch(prefix, PATH2, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl: { get: (option: { query: Methods3['get']['query'], config?: T }) => @@ -50,7 +50,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods3['get']['query'], config?: T }) => fetch(prefix, PATH3, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods3['get']['query'] }) => - `${prefix}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_sections: { get: (option: { query: Methods4['get']['query'], config?: T }) => @@ -58,7 +58,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods4['get']['query'], config?: T }) => fetch(prefix, PATH4, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods4['get']['query'] }) => - `${prefix}${PATH4}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH4}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_three_years: { get: (option: { query: Methods5['get']['query'], config?: T }) => @@ -66,7 +66,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods5['get']['query'], config?: T }) => fetch(prefix, PATH5, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods5['get']['query'] }) => - `${prefix}${PATH5}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH5}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, trial_pl_two_years: { get: (option: { query: Methods6['get']['query'], config?: T }) => @@ -74,7 +74,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods6['get']['query'], config?: T }) => fetch(prefix, PATH6, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods6['get']['query'] }) => - `${prefix}${PATH6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/reports/trial_bs/$api.ts b/samples/freee/api/1/reports/trial_bs/$api.ts index e5451d71..d776e36f 100644 --- a/samples/freee/api/1/reports/trial_bs/$api.ts +++ b/samples/freee/api/1/reports/trial_bs/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_bs_three_years/$api.ts b/samples/freee/api/1/reports/trial_bs_three_years/$api.ts index 23a9e892..685cba3e 100644 --- a/samples/freee/api/1/reports/trial_bs_three_years/$api.ts +++ b/samples/freee/api/1/reports/trial_bs_three_years/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_bs_two_years/$api.ts b/samples/freee/api/1/reports/trial_bs_two_years/$api.ts index 10f77986..158077d8 100644 --- a/samples/freee/api/1/reports/trial_bs_two_years/$api.ts +++ b/samples/freee/api/1/reports/trial_bs_two_years/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_pl/$api.ts b/samples/freee/api/1/reports/trial_pl/$api.ts index 2805f4ef..eba0e17e 100644 --- a/samples/freee/api/1/reports/trial_pl/$api.ts +++ b/samples/freee/api/1/reports/trial_pl/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_pl_sections/$api.ts b/samples/freee/api/1/reports/trial_pl_sections/$api.ts index 5205492c..18d16393 100644 --- a/samples/freee/api/1/reports/trial_pl_sections/$api.ts +++ b/samples/freee/api/1/reports/trial_pl_sections/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_pl_three_years/$api.ts b/samples/freee/api/1/reports/trial_pl_three_years/$api.ts index 208d50c4..31176742 100644 --- a/samples/freee/api/1/reports/trial_pl_three_years/$api.ts +++ b/samples/freee/api/1/reports/trial_pl_three_years/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/reports/trial_pl_two_years/$api.ts b/samples/freee/api/1/reports/trial_pl_two_years/$api.ts index e7923012..57f18fd4 100644 --- a/samples/freee/api/1/reports/trial_pl_two_years/$api.ts +++ b/samples/freee/api/1/reports/trial_pl_two_years/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/sections/$api.ts b/samples/freee/api/1/sections/$api.ts index 3a711259..ebf0e01f 100644 --- a/samples/freee/api/1/sections/$api.ts +++ b/samples/freee/api/1/sections/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/segments/$api.ts b/samples/freee/api/1/segments/$api.ts index f03b194b..27439a2c 100644 --- a/samples/freee/api/1/segments/$api.ts +++ b/samples/freee/api/1/segments/$api.ts @@ -31,7 +31,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix1, DELETE, option).send().then(r => r.body), $path: (option?: { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -43,7 +43,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/freee/api/1/tags/$api.ts b/samples/freee/api/1/tags/$api.ts index b58bf403..44ead501 100644 --- a/samples/freee/api/1/tags/$api.ts +++ b/samples/freee/api/1/tags/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/transfers/$api.ts b/samples/freee/api/1/transfers/$api.ts index cd9cdac6..4c94dcac 100644 --- a/samples/freee/api/1/transfers/$api.ts +++ b/samples/freee/api/1/transfers/$api.ts @@ -29,7 +29,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/users/$api.ts b/samples/freee/api/1/users/$api.ts index 31c21181..c80534fb 100644 --- a/samples/freee/api/1/users/$api.ts +++ b/samples/freee/api/1/users/$api.ts @@ -19,7 +19,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, me: { get: (option?: { query?: Methods2['get']['query'], config?: T }) => @@ -31,14 +31,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods2['put']['reqBody'], config?: T }) => fetch(prefix, PATH2, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json(), $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/users/capabilities/$api.ts b/samples/freee/api/1/users/capabilities/$api.ts index 8fc073cd..67de1678 100644 --- a/samples/freee/api/1/users/capabilities/$api.ts +++ b/samples/freee/api/1/users/capabilities/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/users/me/$api.ts b/samples/freee/api/1/users/me/$api.ts index dbd14da7..14990971 100644 --- a/samples/freee/api/1/users/me/$api.ts +++ b/samples/freee/api/1/users/me/$api.ts @@ -18,7 +18,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { body?: Methods0['put']['reqBody'], config?: T }) => fetch(prefix, PATH0, PUT, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/wallet_txns/$api.ts b/samples/freee/api/1/wallet_txns/$api.ts index 8f46fa4b..7a2237cc 100644 --- a/samples/freee/api/1/wallet_txns/$api.ts +++ b/samples/freee/api/1/wallet_txns/$api.ts @@ -24,7 +24,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -36,7 +36,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/freee/api/1/walletables/$api.ts b/samples/freee/api/1/walletables/$api.ts index 79b996f7..bd4f20ea 100644 --- a/samples/freee/api/1/walletables/$api.ts +++ b/samples/freee/api/1/walletables/$api.ts @@ -33,7 +33,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $delete: (option: { query: Methods1['delete']['query'], config?: T }) => fetch(prefix, prefix1, DELETE, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] } | { method: 'put'; query: Methods1['put']['query'] } | { method: 'delete'; query: Methods1['delete']['query'] }) => - `${prefix}${prefix1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -47,7 +47,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/openapi/$api.ts b/samples/openapi/$api.ts index 69e06304..0cbf7289 100644 --- a/samples/openapi/$api.ts +++ b/samples/openapi/$api.ts @@ -115,7 +115,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -123,7 +123,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -239,7 +239,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix3}${PATH12}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] }) => - `${prefix}${prefix3}${PATH12}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${PATH12}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -283,7 +283,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix7}${PATH11}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods17['get']['query'] }) => - `${prefix}${prefix7}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, itemslist: { get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => @@ -291,7 +291,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix7}${PATH16}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${prefix7}${PATH16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${PATH16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { remove: { @@ -346,14 +346,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix6}${PATH19}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods24['get']['query'] }) => - `${prefix}${prefix6}${PATH19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${PATH19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix6, GET, option).send(), $get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix6, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${prefix6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => @@ -361,7 +361,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH9, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods11['get']['query'] }) => - `${prefix}${PATH9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, chats: { _chatId_0: (val8: number) => { @@ -422,7 +422,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix10}${PATH11}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods26['get']['query'] }) => - `${prefix}${prefix10}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -540,7 +540,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH36, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods45['get']['query'] }) => - `${prefix}${PATH36}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH36}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH35, GET, option).json(), @@ -577,7 +577,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix12}${PATH11}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods46['get']['query'] }) => - `${prefix}${prefix12}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix12}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/openapi/api/$api.ts b/samples/openapi/api/$api.ts index 52fca011..2b5312fa 100644 --- a/samples/openapi/api/$api.ts +++ b/samples/openapi/api/$api.ts @@ -114,7 +114,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -122,7 +122,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -238,7 +238,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix3}${PATH12}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] }) => - `${prefix}${prefix3}${PATH12}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${PATH12}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -282,7 +282,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix7}${PATH11}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods17['get']['query'] }) => - `${prefix}${prefix7}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, itemslist: { get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => @@ -290,7 +290,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix7}${PATH16}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${prefix7}${PATH16}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${PATH16}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { remove: { @@ -345,14 +345,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix6}${PATH19}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods24['get']['query'] }) => - `${prefix}${prefix6}${PATH19}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${PATH19}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix6, GET, option).send(), $get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix6, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${prefix6}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix6}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => @@ -360,7 +360,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH9, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods11['get']['query'] }) => - `${prefix}${PATH9}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH9}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, chats: { _chatId_0: (val8: number) => { @@ -421,7 +421,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix10}${PATH11}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods26['get']['query'] }) => - `${prefix}${prefix10}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix10}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -539,7 +539,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH36, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods45['get']['query'] }) => - `${prefix}${PATH36}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH36}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH35, GET, option).json(), @@ -576,7 +576,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix12}${PATH11}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods46['get']['query'] }) => - `${prefix}${prefix12}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix12}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/openapi/api/stream/$api.ts b/samples/openapi/api/stream/$api.ts index 7bfbe8ff..93fe4e6b 100644 --- a/samples/openapi/api/stream/$api.ts +++ b/samples/openapi/api/stream/$api.ts @@ -20,7 +20,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -28,7 +28,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/openapi/api/stream/v1/$api.ts b/samples/openapi/api/stream/v1/$api.ts index 13766fdb..5186e430 100644 --- a/samples/openapi/api/stream/v1/$api.ts +++ b/samples/openapi/api/stream/v1/$api.ts @@ -19,7 +19,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -27,7 +27,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/openapi/api/stream/v1/stories/$api.ts b/samples/openapi/api/stream/v1/stories/$api.ts index 5980b4d2..d4cda026 100644 --- a/samples/openapi/api/stream/v1/stories/$api.ts +++ b/samples/openapi/api/stream/v1/stories/$api.ts @@ -18,7 +18,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option: { query: Methods0['get']['query'], config?: T }) => @@ -26,7 +26,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/openapi/api/v3/$api.ts b/samples/openapi/api/v3/$api.ts index e7c721c5..e45d4882 100644 --- a/samples/openapi/api/v3/$api.ts +++ b/samples/openapi/api/v3/$api.ts @@ -123,7 +123,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods3['get']['query'], headers?: Methods3['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix0}${PATH4}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods3['get']['query'] }) => - `${prefix}${prefix0}${PATH4}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH4}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -167,7 +167,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix4}${PATH3}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods7['get']['query'] }) => - `${prefix}${prefix4}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, itemslist: { get: (option: { query: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => @@ -175,7 +175,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix4}${PATH8}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods11['get']['query'] }) => - `${prefix}${prefix4}${PATH8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${PATH8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { remove: { @@ -230,14 +230,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix3}${PATH11}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${prefix3}${PATH11}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${PATH11}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { query?: Methods4['get']['query'], headers?: Methods4['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix3, GET, option).send(), $get: (option?: { query?: Methods4['get']['query'], headers?: Methods4['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix3, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods4['get']['query'] }) => - `${prefix}${prefix3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => @@ -245,7 +245,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, chats: { _chatId_0: (val5: number) => { @@ -306,7 +306,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods16['post']['reqBody'], headers?: Methods16['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix7}${PATH3}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods16['get']['query'] }) => - `${prefix}${prefix7}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -424,7 +424,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods35['get']['query'], headers?: Methods35['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH28, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods35['get']['query'] }) => - `${prefix}${PATH28}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH28}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { headers?: Methods34['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH27, GET, option).json(), @@ -461,7 +461,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods36['get']['query'], headers?: Methods36['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix9}${PATH3}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods36['get']['query'] }) => - `${prefix}${prefix9}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix9}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/openapi/api/v3/channels/$api.ts b/samples/openapi/api/v3/channels/$api.ts index c2dfe4ee..466b3394 100644 --- a/samples/openapi/api/v3/channels/$api.ts +++ b/samples/openapi/api/v3/channels/$api.ts @@ -65,7 +65,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods2['get']['query'], headers?: Methods2['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix0}${PATH3}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods2['get']['query'] }) => - `${prefix}${prefix0}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, @@ -109,7 +109,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods6['post']['reqBody'], headers?: Methods6['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix4}${PATH2}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods6['get']['query'] }) => - `${prefix}${prefix4}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, itemslist: { get: (option: { query: Methods10['get']['query'], headers?: Methods10['get']['reqHeaders'], config?: T }) => @@ -117,7 +117,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods10['get']['query'], headers?: Methods10['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix4}${PATH7}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods10['get']['query'] }) => - `${prefix}${prefix4}${PATH7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix4}${PATH7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users: { remove: { @@ -172,14 +172,14 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix3}${PATH10}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods13['get']['query'] }) => - `${prefix}${prefix3}${PATH10}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${PATH10}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { query?: Methods3['get']['query'], headers?: Methods3['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix3, GET, option).send(), $get: (option?: { query?: Methods3['get']['query'], headers?: Methods3['get']['reqHeaders'], config?: T }) => fetch(prefix, prefix3, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods3['get']['query'] }) => - `${prefix}${prefix3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } }, get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => @@ -187,7 +187,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/openapi/api/v3/chats/$api.ts b/samples/openapi/api/v3/chats/$api.ts index 8a4d1295..d85234b7 100644 --- a/samples/openapi/api/v3/chats/$api.ts +++ b/samples/openapi/api/v3/chats/$api.ts @@ -77,7 +77,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix2}${PATH1}`, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix2}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } }, diff --git a/samples/openapi/api/v3/organisation/$api.ts b/samples/openapi/api/v3/organisation/$api.ts index 3c3e0251..8979ca04 100644 --- a/samples/openapi/api/v3/organisation/$api.ts +++ b/samples/openapi/api/v3/organisation/$api.ts @@ -16,7 +16,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH1, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH0, GET, option).json(), diff --git a/samples/openapi/api/v3/organisation/users/$api.ts b/samples/openapi/api/v3/organisation/users/$api.ts index bdf90328..c4c485ea 100644 --- a/samples/openapi/api/v3/organisation/users/$api.ts +++ b/samples/openapi/api/v3/organisation/users/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/openapi/api/v3/stories/$api.ts b/samples/openapi/api/v3/stories/$api.ts index ad6e2cbc..2e59cce8 100644 --- a/samples/openapi/api/v3/stories/$api.ts +++ b/samples/openapi/api/v3/stories/$api.ts @@ -41,7 +41,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/simple/$api.ts b/samples/simple/$api.ts index 74396743..09abdd6a 100644 --- a/samples/simple/$api.ts +++ b/samples/simple/$api.ts @@ -44,7 +44,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { query?: Methods1['put']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send().then(r => r.body), $path: (option?: { method: 'put'; query: Methods1['put']['query'] }) => - `${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, simple: { put: (option?: { config?: T }) => @@ -67,7 +67,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods3['post']['reqBody'], query?: Methods3['post']['query'], config?: T }) => fetch(prefix, `${prefix1}${PATH5}`, POST, option, 'Blob').send().then(r => r.body), $path: (option?: { method: 'post'; query: Methods3['post']['query'] }) => - `${prefix}${prefix1}${PATH5}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix1}${PATH5}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } @@ -83,7 +83,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods5['get']['query'], config?: T }) => fetch(prefix, `${prefix2}${PATH7}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods5['get']['query'] }) => - `${prefix}${prefix2}${PATH7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${PATH7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, xyz: { get: (option?: { config?: T }) => diff --git a/samples/simple/dummy/$api.ts b/samples/simple/dummy/$api.ts index 3bf25f12..185e5139 100644 --- a/samples/simple/dummy/$api.ts +++ b/samples/simple/dummy/$api.ts @@ -30,7 +30,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $put: (option?: { query?: Methods1['put']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send().then(r => r.body), $path: (option?: { method: 'put'; query: Methods1['put']['query'] }) => - `${prefix}${prefix0}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, simple: { put: (option?: { config?: T }) => diff --git a/samples/simple/file/$api.ts b/samples/simple/file/$api.ts index 3ec4c3de..7f67d81f 100644 --- a/samples/simple/file/$api.ts +++ b/samples/simple/file/$api.ts @@ -19,7 +19,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option?: { body?: Methods0['post']['reqBody'], query?: Methods0['post']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'Blob').send().then(r => r.body), $path: (option?: { method: 'post'; query: Methods0['post']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/simple/user/$api.ts b/samples/simple/user/$api.ts index 4e94056f..5e5a5c88 100644 --- a/samples/simple/user/$api.ts +++ b/samples/simple/user/$api.ts @@ -25,7 +25,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods1['get']['query'], config?: T }) => fetch(prefix, `${prefix0}${PATH1}`, GET, option).send().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${prefix0}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, xyz: { get: (option?: { config?: T }) => diff --git a/samples/strapi/$api.ts b/samples/strapi/$api.ts index db11c29f..6c62b457 100644 --- a/samples/strapi/$api.ts +++ b/samples/strapi/$api.ts @@ -208,7 +208,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods14['get']['query'], config?: T }) => fetch(prefix, PATH14, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods14['get']['query'] }) => - `${prefix}${PATH14}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH14}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, users_permissions: { init: { @@ -254,7 +254,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods18['post']['reqBody'], config?: T }) => fetch(prefix, PATH17, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods18['get']['query'] }) => - `${prefix}${PATH17}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH17}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, search: { _id: (val7: string) => { @@ -266,7 +266,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods21['get']['query'], config?: T }) => fetch(prefix, prefix7, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods21['get']['query'] }) => - `${prefix}${prefix7}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix7}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/strapi/users-permissions/$api.ts b/samples/strapi/users-permissions/$api.ts index 4895e7e9..604cc781 100644 --- a/samples/strapi/users-permissions/$api.ts +++ b/samples/strapi/users-permissions/$api.ts @@ -60,7 +60,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods1['post']['reqBody'], config?: T }) => fetch(prefix, PATH1, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods1['get']['query'] }) => - `${prefix}${PATH1}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH1}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, search: { _id: (val2: string) => { @@ -72,7 +72,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods4['get']['query'], config?: T }) => fetch(prefix, prefix2, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods4['get']['query'] }) => - `${prefix}${prefix2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/strapi/users-permissions/roles/$api.ts b/samples/strapi/users-permissions/roles/$api.ts index 57a8d5f3..131c49b9 100644 --- a/samples/strapi/users-permissions/roles/$api.ts +++ b/samples/strapi/users-permissions/roles/$api.ts @@ -48,7 +48,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => fetch(prefix, PATH0, POST, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/strapi/users-permissions/search/$api.ts b/samples/strapi/users-permissions/search/$api.ts index 3a96a416..36e2564e 100644 --- a/samples/strapi/users-permissions/search/$api.ts +++ b/samples/strapi/users-permissions/search/$api.ts @@ -17,7 +17,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${prefix0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${prefix0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } } diff --git a/samples/strapi/users/$api.ts b/samples/strapi/users/$api.ts index cdd58837..968407c7 100644 --- a/samples/strapi/users/$api.ts +++ b/samples/strapi/users/$api.ts @@ -44,7 +44,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { query?: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/swagger/$api.ts b/samples/swagger/$api.ts index 5d22ae9d..b71bab10 100644 --- a/samples/swagger/$api.ts +++ b/samples/swagger/$api.ts @@ -47,13 +47,13 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - fetch(prefix, prefix0, POST, option, 'URLSearchParams').send(), + fetch(prefix, prefix0, POST, option, 'URLSearchParams').send(), $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - fetch(prefix, prefix0, POST, option, 'URLSearchParams').send().then(r => r.body), + fetch(prefix, prefix0, POST, option, 'URLSearchParams').send().then(r => r.body), delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - fetch(prefix, prefix0, DELETE, option).send(), + fetch(prefix, prefix0, DELETE, option).send(), $delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix0}` } }, @@ -63,16 +63,16 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods3['get']['query'], config?: T }) => fetch(prefix, PATH2, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods3['get']['query'] }) => - `${prefix}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send(), + fetch(prefix, PATH0, POST, option).send(), $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send().then(r => r.body), + fetch(prefix, PATH0, POST, option).send().then(r => r.body), put: (option: { body: Methods0['put']['reqBody'], config?: T }) => - fetch(prefix, PATH0, PUT, option).send(), + fetch(prefix, PATH0, PUT, option).send(), $put: (option: { body: Methods0['put']['reqBody'], config?: T }) => - fetch(prefix, PATH0, PUT, option).send().then(r => r.body), + fetch(prefix, PATH0, PUT, option).send().then(r => r.body), $path: () => `${prefix}${PATH0}` }, store: { @@ -93,9 +93,9 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix1, GET, option).json().then(r => r.body), delete: (option?: { config?: T }) => - fetch(prefix, prefix1, DELETE, option).send(), + fetch(prefix, prefix1, DELETE, option).send(), $delete: (option?: { config?: T }) => - fetch(prefix, prefix1, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix1, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix1}` } }, @@ -116,28 +116,28 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix2, GET, option).json().then(r => r.body), put: (option: { body: Methods8['put']['reqBody'], config?: T }) => - fetch(prefix, prefix2, PUT, option).send(), + fetch(prefix, prefix2, PUT, option).send(), $put: (option: { body: Methods8['put']['reqBody'], config?: T }) => - fetch(prefix, prefix2, PUT, option).send().then(r => r.body), + fetch(prefix, prefix2, PUT, option).send().then(r => r.body), delete: (option?: { config?: T }) => - fetch(prefix, prefix2, DELETE, option).send(), + fetch(prefix, prefix2, DELETE, option).send(), $delete: (option?: { config?: T }) => - fetch(prefix, prefix2, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix2, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix2}` } }, createWithArray: { post: (option: { body: Methods9['post']['reqBody'], config?: T }) => - fetch(prefix, PATH6, POST, option).send(), + fetch(prefix, PATH6, POST, option).send(), $post: (option: { body: Methods9['post']['reqBody'], config?: T }) => - fetch(prefix, PATH6, POST, option).send().then(r => r.body), + fetch(prefix, PATH6, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH6}` }, createWithList: { post: (option: { body: Methods10['post']['reqBody'], config?: T }) => - fetch(prefix, PATH7, POST, option).send(), + fetch(prefix, PATH7, POST, option).send(), $post: (option: { body: Methods10['post']['reqBody'], config?: T }) => - fetch(prefix, PATH7, POST, option).send().then(r => r.body), + fetch(prefix, PATH7, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH7}` }, login: { @@ -146,12 +146,12 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods11['get']['query'], config?: T }) => fetch(prefix, PATH8, GET, option).text().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods11['get']['query'] }) => - `${prefix}${PATH8}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH8}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, post: (option: { body: Methods7['post']['reqBody'], config?: T }) => - fetch(prefix, PATH5, POST, option).send(), + fetch(prefix, PATH5, POST, option).send(), $post: (option: { body: Methods7['post']['reqBody'], config?: T }) => - fetch(prefix, PATH5, POST, option).send().then(r => r.body), + fetch(prefix, PATH5, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH5}` } } diff --git a/samples/swagger/pet/$api.ts b/samples/swagger/pet/$api.ts index 226398b3..0f2e21e8 100644 --- a/samples/swagger/pet/$api.ts +++ b/samples/swagger/pet/$api.ts @@ -32,13 +32,13 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - fetch(prefix, prefix0, POST, option, 'URLSearchParams').send(), + fetch(prefix, prefix0, POST, option, 'URLSearchParams').send(), $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - fetch(prefix, prefix0, POST, option, 'URLSearchParams').send().then(r => r.body), + fetch(prefix, prefix0, POST, option, 'URLSearchParams').send().then(r => r.body), delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - fetch(prefix, prefix0, DELETE, option).send(), + fetch(prefix, prefix0, DELETE, option).send(), $delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix0}` } }, @@ -48,16 +48,16 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods3['get']['query'], config?: T }) => fetch(prefix, PATH2, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods3['get']['query'] }) => - `${prefix}${PATH2}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH2}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send(), + fetch(prefix, PATH0, POST, option).send(), $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send().then(r => r.body), + fetch(prefix, PATH0, POST, option).send().then(r => r.body), put: (option: { body: Methods0['put']['reqBody'], config?: T }) => - fetch(prefix, PATH0, PUT, option).send(), + fetch(prefix, PATH0, PUT, option).send(), $put: (option: { body: Methods0['put']['reqBody'], config?: T }) => - fetch(prefix, PATH0, PUT, option).send().then(r => r.body), + fetch(prefix, PATH0, PUT, option).send().then(r => r.body), $path: () => `${prefix}${PATH0}` } } diff --git a/samples/swagger/pet/findByStatus/$api.ts b/samples/swagger/pet/findByStatus/$api.ts index e645bbfe..a555d59b 100644 --- a/samples/swagger/pet/findByStatus/$api.ts +++ b/samples/swagger/pet/findByStatus/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).json().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/samples/swagger/store/$api.ts b/samples/swagger/store/$api.ts index a888f82b..2dad0ae3 100644 --- a/samples/swagger/store/$api.ts +++ b/samples/swagger/store/$api.ts @@ -30,9 +30,9 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send(), + fetch(prefix, prefix0, DELETE, option).send(), $delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix0}` } }, diff --git a/samples/swagger/store/order/$api.ts b/samples/swagger/store/order/$api.ts index e95d9c5e..d9d38e90 100644 --- a/samples/swagger/store/order/$api.ts +++ b/samples/swagger/store/order/$api.ts @@ -20,9 +20,9 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send(), + fetch(prefix, prefix0, DELETE, option).send(), $delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix0}` } }, diff --git a/samples/swagger/user/$api.ts b/samples/swagger/user/$api.ts index 2fd20ab8..50307767 100644 --- a/samples/swagger/user/$api.ts +++ b/samples/swagger/user/$api.ts @@ -27,28 +27,28 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option?: { config?: T }) => fetch(prefix, prefix0, GET, option).json().then(r => r.body), put: (option: { body: Methods1['put']['reqBody'], config?: T }) => - fetch(prefix, prefix0, PUT, option).send(), + fetch(prefix, prefix0, PUT, option).send(), $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => - fetch(prefix, prefix0, PUT, option).send().then(r => r.body), + fetch(prefix, prefix0, PUT, option).send().then(r => r.body), delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send(), + fetch(prefix, prefix0, DELETE, option).send(), $delete: (option?: { config?: T }) => - fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body), $path: () => `${prefix}${prefix0}` } }, createWithArray: { post: (option: { body: Methods2['post']['reqBody'], config?: T }) => - fetch(prefix, PATH1, POST, option).send(), + fetch(prefix, PATH1, POST, option).send(), $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => - fetch(prefix, PATH1, POST, option).send().then(r => r.body), + fetch(prefix, PATH1, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH1}` }, createWithList: { post: (option: { body: Methods3['post']['reqBody'], config?: T }) => - fetch(prefix, PATH2, POST, option).send(), + fetch(prefix, PATH2, POST, option).send(), $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => - fetch(prefix, PATH2, POST, option).send().then(r => r.body), + fetch(prefix, PATH2, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH2}` }, login: { @@ -57,12 +57,12 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods4['get']['query'], config?: T }) => fetch(prefix, PATH3, GET, option).text().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods4['get']['query'] }) => - `${prefix}${PATH3}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH3}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` }, post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send(), + fetch(prefix, PATH0, POST, option).send(), $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send().then(r => r.body), + fetch(prefix, PATH0, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH0}` } } diff --git a/samples/swagger/user/createWithArray/$api.ts b/samples/swagger/user/createWithArray/$api.ts index 28604e0d..dc1bcfca 100644 --- a/samples/swagger/user/createWithArray/$api.ts +++ b/samples/swagger/user/createWithArray/$api.ts @@ -9,9 +9,9 @@ const api = ({ baseURL, fetch }: AspidaClient) => { return { post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send(), + fetch(prefix, PATH0, POST, option).send(), $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send().then(r => r.body), + fetch(prefix, PATH0, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH0}` } } diff --git a/samples/swagger/user/createWithList/$api.ts b/samples/swagger/user/createWithList/$api.ts index 008188e1..42001a63 100644 --- a/samples/swagger/user/createWithList/$api.ts +++ b/samples/swagger/user/createWithList/$api.ts @@ -9,9 +9,9 @@ const api = ({ baseURL, fetch }: AspidaClient) => { return { post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send(), + fetch(prefix, PATH0, POST, option).send(), $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - fetch(prefix, PATH0, POST, option).send().then(r => r.body), + fetch(prefix, PATH0, POST, option).send().then(r => r.body), $path: () => `${prefix}${PATH0}` } } diff --git a/samples/swagger/user/login/$api.ts b/samples/swagger/user/login/$api.ts index 07b79a9b..fbea3b5f 100644 --- a/samples/swagger/user/login/$api.ts +++ b/samples/swagger/user/login/$api.ts @@ -13,7 +13,7 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $get: (option: { query: Methods0['get']['query'], config?: T }) => fetch(prefix, PATH0, GET, option).text().then(r => r.body), $path: (option?: { method?: 'get'; query: Methods0['get']['query'] }) => - `${prefix}${PATH0}${option?.query ? `?${dataToURLString(option.query)}` : ''}` + `${prefix}${PATH0}${option && option.query ? `?${dataToURLString(option.query)}` : ''}` } } diff --git a/src/buildV3.ts b/src/buildV3.ts index b7d7218b..c5b8affd 100644 --- a/src/buildV3.ts +++ b/src/buildV3.ts @@ -87,7 +87,6 @@ export default (openapi: OpenAPIV3.Document) => { const prop = { name: getPropertyName(p.name), required: !!p.required, - isOneOf: false, values: [value] } @@ -110,7 +109,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'reqHeaders', required: false, - isOneOf: false, values: [ ...reqRefHeaders, ...(reqHeaders.length @@ -124,7 +122,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'query', required: queryRequired, - isOneOf: false, values: [ ...refQuery, ...(query.length ? [{ isArray: false, isEnum: false, value: query }] : []) @@ -139,7 +136,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'status', required: true, - isOneOf: false, values: [{ isArray: false, isEnum: false, value: code }] }) @@ -152,7 +148,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'resBody', required: true, - isOneOf: false, values: [val] }) } @@ -161,7 +156,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'resHeaders', required: true, - isOneOf: false, values: [ { isArray: false, @@ -181,7 +175,6 @@ export default (openapi: OpenAPIV3.Document) => { val && { name: getPropertyName(header), required: true, - isOneOf: false, values: [val] } ) @@ -236,7 +229,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'reqFormat', required: true, - isOneOf: false, values: [{ isArray: false, isEnum: false, value: reqFormat }] }) } @@ -245,7 +237,6 @@ export default (openapi: OpenAPIV3.Document) => { params.push({ name: 'reqBody', required, - isOneOf: false, values: [reqBody] }) } @@ -254,7 +245,6 @@ export default (openapi: OpenAPIV3.Document) => { return { name: method, required: true, - isOneOf: false, values: [{ isArray: false, isEnum: false, value: params }] } }) diff --git a/src/builderUtils/converters.ts b/src/builderUtils/converters.ts index 16732686..00440d4d 100644 --- a/src/builderUtils/converters.ts +++ b/src/builderUtils/converters.ts @@ -38,7 +38,7 @@ export const getPropertyName = (name: string) => /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name) ? name : `'${name}'` const of2Values = (obj: OpenAPIV3.SchemaObject): PropValue[] | null => { - const values = (obj.oneOf || obj.allOf || []) + const values = (obj.oneOf || obj.allOf || obj.anyOf || []) .map(p => schema2value(p)) .filter(v => v) as PropValue[] return values.length ? values : null @@ -59,7 +59,6 @@ const object2value = (obj: OpenAPIV3.NonArraySchemaObject): Prop[] => { return { name: getPropertyName(name), required: !!obj.required?.includes(name), - isOneOf: false, values: [val] } }) @@ -72,7 +71,6 @@ const object2value = (obj: OpenAPIV3.NonArraySchemaObject): Prop[] => { ? { isArray: false, isEnum: false, - isOneOf: false, value: 'any' } : schema2value(additionalProps) @@ -81,7 +79,6 @@ const object2value = (obj: OpenAPIV3.NonArraySchemaObject): Prop[] => { value.push({ name: '[key: string]', required: true, - isOneOf: false, values: [val] }) } @@ -96,13 +93,13 @@ export const schema2value = ( let isArray = false let isEnum = false - let isOneOf + let hasOf: PropValue['hasOf'] let value: PropValue['value'] | null = null if (isRefObject(schema)) { value = $ref2Type(schema.$ref) - } else if (schema.oneOf || schema.allOf) { - isOneOf = !!schema.oneOf + } else if (schema.oneOf || schema.allOf || schema.anyOf) { + hasOf = schema.oneOf ? 'oneOf' : schema.allOf ? 'allOf' : 'anyOf' value = of2Values(schema) } else if (schema.enum) { isEnum = true @@ -124,5 +121,5 @@ export const schema2value = ( }[schema.type ?? 'string'] } - return value ? { isArray, isEnum, isOneOf, value } : null + return value ? { isArray, isEnum, hasOf, value } : null } diff --git a/src/builderUtils/parameters2Props.ts b/src/builderUtils/parameters2Props.ts index a974188d..f8c2f221 100644 --- a/src/builderUtils/parameters2Props.ts +++ b/src/builderUtils/parameters2Props.ts @@ -26,7 +26,6 @@ export default (params: OpenAPIV3.ComponentsObject['parameters'], openapi: OpenA { name: getPropertyName(target.name), required: !!target.required, - isOneOf: false, values: [value] } ] diff --git a/src/builderUtils/props2String.ts b/src/builderUtils/props2String.ts index cc789982..3379b1ba 100644 --- a/src/builderUtils/props2String.ts +++ b/src/builderUtils/props2String.ts @@ -1,7 +1,7 @@ export type PropValue = { isArray: boolean isEnum: boolean - isOneOf?: boolean + hasOf?: 'oneOf' | 'allOf' | 'anyOf' // eslint-disable-next-line no-use-before-define value: Prop[] | string | string[] | PropValue | PropValue[] } @@ -9,20 +9,18 @@ export type PropValue = { export type Prop = { name: string required: boolean - isOneOf: boolean values: PropValue[] } const array2String = (val: PropValue, indent: string) => { - const hasMulti = - (val.isEnum || typeof val.isOneOf === 'boolean') && Array.isArray(val.value) && val.value.length + const hasMulti = (val.isEnum || val.hasOf) && Array.isArray(val.value) && val.value.length return `${hasMulti ? '(' : ''}${value2String(val, indent)}${hasMulti ? ')' : ''}[]` } export const value2String = (v: PropValue, indent: string): string => `${ - typeof v.isOneOf === 'boolean' - ? values2String(v.value as PropValue[], v.isOneOf, indent) + v.hasOf + ? values2String(v.value as PropValue[], v.hasOf, indent) : v.isArray ? array2String(v.value as PropValue, indent) : v.isEnum @@ -32,8 +30,10 @@ export const value2String = (v: PropValue, indent: string): string => : v.value }` -const values2String = (values: PropValue[], isOneOf: boolean, indent: string) => - values.map(a => value2String(a, indent)).join(isOneOf ? ' | ' : ' & ') +const values2String = (values: PropValue[], hasOf: PropValue['hasOf'], indent: string) => + `${hasOf === 'anyOf' ? 'Partial<' : ''}${values + .map(a => value2String(a, indent)) + .join(hasOf === 'oneOf' ? ' | ' : ' & ')}${hasOf === 'anyOf' ? '>' : ''}` const isMultiLine = (values: PropValue[]) => values.find(v => !v.isEnum && Array.isArray(v.value)) @@ -43,7 +43,7 @@ export const props2String = (props: Prop[], indent: string) => (p, i) => ` ${indent}${p.name}${p.required ? '' : '?'}: ${values2String( p.values, - p.isOneOf, + undefined, indent )}${ props.length - 1 === i || isMultiLine(p.values) || isMultiLine(props[i + 1].values)