diff --git a/LICENSE b/LICENSE index 681db0dc..d1856748 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 m-mitsuhide +Copyright (c) 2020 Solufa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index fa0c72b7..f2e77c6b 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Create config file in project root ```js module.exports = { input: "apis", // "input" of aspida is "output" for openapi2aspida + outputEachDir: true, // Generate $api.ts in each endpoint directory openapi: { inputFile: "https://petstore.swagger.io/v2/swagger.json" } // Compatible with yaml/json of OpenAPI3.0/Swagger2.0 } ``` diff --git a/aspida.config.js b/aspida.config.js index 8aa51d47..a523fae1 100644 --- a/aspida.config.js +++ b/aspida.config.js @@ -1,26 +1,32 @@ module.exports = [ { input: 'samples/swagger', + outputEachDir: true, openapi: { inputFile: 'samples/swagger.yaml', mock: true } }, { input: 'samples/simple', + outputEachDir: true, openapi: { inputFile: 'samples/simple.yaml', mock: true, noMockType: true } }, { input: 'samples/strapi', + outputEachDir: true, openapi: { inputFile: 'samples/strapi.json' } }, { input: 'samples/freee', + outputEachDir: true, openapi: { inputFile: 'samples/freee.json', mock: true } }, { input: 'samples/openapi', + outputEachDir: true, openapi: { inputFile: 'samples/openapi.json', mock: true, yaml: false } }, { input: 'samples/externals', + outputEachDir: true, openapi: { inputFile: 'samples/externals.json', yaml: false } } ] diff --git a/package.json b/package.json index 3649f986..649fa0fe 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "openapi2aspida", "version": "0.8.0", "description": "Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida", - "author": "m-mitsuhide ", + "author": "Solufa ", "license": "MIT", "main": "dist/index.js", "bin": "bin/index.js", @@ -37,7 +37,7 @@ "swagger" ], "dependencies": { - "aspida": "^0.18.0", + "aspida": "^0.19.2", "swagger-parser": "^9.0.1", "swagger2openapi": "^6.0.3" }, diff --git a/samples/externals/$api.ts b/samples/externals/$api.ts index 3e6ae8ba..ebcbbc09 100644 --- a/samples/externals/$api.ts +++ b/samples/externals/$api.ts @@ -1,86 +1,107 @@ /* eslint-disable */ import { AspidaClient } from 'aspida' -import { Methods as Methods0 } from './users/_user_id@string/orders/index' -import { Methods as Methods1 } from './users/_user_id@string/orders/_order_id@string/index' -import { Methods as Methods2 } from './users/_user_id@string/orders/purchase/invoice/index' -import { Methods as Methods3 } from './users/_user_id@string/orders/purchase/wallet/index' -import { Methods as Methods4 } from './users/_user_id@string/orders/unsubscribe/index' -import { Methods as Methods5 } from './users/_user_id@string/orders/update/renew/index' -import { Methods as Methods6 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/index' -import { Methods as Methods7 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/invoice/index' -import { Methods as Methods8 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/wallet/index' +import { Methods as Methods0 } from './users/_user_id@string/orders' +import { Methods as Methods1 } from './users/_user_id@string/orders/_order_id@string' +import { Methods as Methods2 } from './users/_user_id@string/orders/purchase/invoice' +import { Methods as Methods3 } from './users/_user_id@string/orders/purchase/wallet' +import { Methods as Methods4 } from './users/_user_id@string/orders/unsubscribe' +import { Methods as Methods5 } from './users/_user_id@string/orders/update/renew' +import { Methods as Methods6 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders' +import { Methods as Methods7 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/invoice' +import { Methods as Methods8 } from './users/_user_id@string/phone-numbers/_phone_number@string/orders/purchase/wallet' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PATH0 = '/users' +const PATH1 = '/orders' +const PATH2 = '/orders/purchase/invoice' +const PATH3 = '/orders/purchase/wallet' +const PATH4 = '/orders/unsubscribe' +const PATH5 = '/orders/update/renew' +const PATH6 = '/phone-numbers' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : baseURL).replace(/\/$/, '') return { users: { - _user_id: (val0: string) => ({ - orders: { - _order_id: (val1: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/users/${val0}/orders/${val1}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders/${val1}`, 'GET', option).json()).body - }), - purchase: { - invoice: { - post: (option: { body: Methods2['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/orders/purchase/invoice`, 'POST', option).json(), - $post: async (option: { body: Methods2['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders/purchase/invoice`, 'POST', option).json()).body + _user_id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + orders: { + _order_id: (val1: string) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } }, - wallet: { - post: (option: { body: Methods3['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/orders/purchase/wallet`, 'POST', option).json(), - $post: async (option: { body: Methods3['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders/purchase/wallet`, 'POST', option).json()).body - } - }, - unsubscribe: { - post: (option: { body: Methods4['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/orders/unsubscribe`, 'POST', option).json(), - $post: async (option: { body: Methods4['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders/unsubscribe`, 'POST', option).json()).body - }, - update: { - renew: { - post: (option: { body: Methods5['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/orders/update/renew`, 'POST', option).json(), - $post: async (option: { body: Methods5['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders/update/renew`, 'POST', option).json()).body - } + purchase: { + invoice: { + post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option).json().then(r => r.body) + }, + wallet: { + post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option).json().then(r => r.body) + } + }, + unsubscribe: { + post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option).json(), + $post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option).json().then(r => r.body) + }, + update: { + renew: { + post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body) }, - get: (option?: { query?: Methods0['get']['query'], config?: T }) => - client.fetch(prefix, `/users/${val0}/orders`, 'GET', option).json(), - $get: async (option?: { query?: Methods0['get']['query'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/orders`, 'GET', option).json()).body - }, - phone_numbers: { - _phone_number: (val2: string) => ({ - orders: { - purchase: { - invoice: { - post: (option: { body: Methods7['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/invoice`, 'POST', option).json(), - $post: async (option: { body: Methods7['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/invoice`, 'POST', option).json()).body - }, - wallet: { - post: (option: { body: Methods8['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/wallet`, 'POST', option).json(), - $post: async (option: { body: Methods8['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders/purchase/wallet`, 'POST', option).json()).body + phone_numbers: { + _phone_number: (val2: string) => { + const prefix2 = `${prefix0}${PATH6}/${val2}` + + return { + orders: { + purchase: { + invoice: { + post: (option: { body: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option).json().then(r => r.body) + }, + wallet: { + post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body) } - }, - get: (option?: { config?: T }) => - client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users/${val0}/phone-numbers/${val2}/orders`, 'GET', option).json()).body + } } - }) + } } - }) + } } } } diff --git a/samples/externals/users/$api.ts b/samples/externals/users/$api.ts new file mode 100644 index 00000000..18389f78 --- /dev/null +++ b/samples/externals/users/$api.ts @@ -0,0 +1,108 @@ +/* eslint-disable */ +import { AspidaClient } from 'aspida' +import { Methods as Methods0 } from './_user_id@string/orders' +import { Methods as Methods1 } from './_user_id@string/orders/_order_id@string' +import { Methods as Methods2 } from './_user_id@string/orders/purchase/invoice' +import { Methods as Methods3 } from './_user_id@string/orders/purchase/wallet' +import { Methods as Methods4 } from './_user_id@string/orders/unsubscribe' +import { Methods as Methods5 } from './_user_id@string/orders/update/renew' +import { Methods as Methods6 } from './_user_id@string/phone-numbers/_phone_number@string/orders' +import { Methods as Methods7 } from './_user_id@string/phone-numbers/_phone_number@string/orders/purchase/invoice' +import { Methods as Methods8 } from './_user_id@string/phone-numbers/_phone_number@string/orders/purchase/wallet' + +const GET = 'GET' +const POST = 'POST' +const PATH0 = '/users' +const PATH1 = '/orders' +const PATH2 = '/orders/purchase/invoice' +const PATH3 = '/orders/purchase/wallet' +const PATH4 = '/orders/unsubscribe' +const PATH5 = '/orders/update/renew' +const PATH6 = '/phone-numbers' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.baikalplatform.com/product-management/v1' : baseURL).replace(/\/$/, '') + + return { + _user_id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + orders: { + _order_id: (val1: string) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + }, + purchase: { + invoice: { + post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option).json().then(r => r.body) + }, + wallet: { + post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option).json().then(r => r.body) + } + }, + unsubscribe: { + post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option).json(), + $post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option).json().then(r => r.body) + }, + update: { + renew: { + post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body) + }, + phone_numbers: { + _phone_number: (val2: string) => { + const prefix2 = `${prefix0}${PATH6}/${val2}` + + return { + orders: { + purchase: { + invoice: { + post: (option: { body: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option).json().then(r => r.body) + }, + wallet: { + post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body) + } + } + } + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/$api.ts b/samples/freee/$api.ts index c971353a..be8f4157 100644 --- a/samples/freee/$api.ts +++ b/samples/freee/$api.ts @@ -1,637 +1,784 @@ /* eslint-disable */ import { AspidaClient, BasicHeaders } from 'aspida' -import { Methods as Methods0 } from './api/1/account_items/index' -import { Methods as Methods1 } from './api/1/account_items/_id@number/index' -import { Methods as Methods2 } from './api/1/banks/index' -import { Methods as Methods3 } from './api/1/banks/_id@number/index' -import { Methods as Methods4 } from './api/1/companies/index' -import { Methods as Methods5 } from './api/1/companies/_id@number/index' -import { Methods as Methods6 } from './api/1/deals/index' -import { Methods as Methods7 } from './api/1/deals/_id@number/index' -import { Methods as Methods8 } from './api/1/deals/_id@number/payments/index' -import { Methods as Methods9 } from './api/1/deals/_id@number/payments/_payment_id@number/index' -import { Methods as Methods10 } from './api/1/deals/_id@number/renews/index' -import { Methods as Methods11 } from './api/1/deals/_id@number/renews/_renew_id@number/index' -import { Methods as Methods12 } from './api/1/expense_application_line_templates/index' -import { Methods as Methods13 } from './api/1/expense_application_line_templates/_id@number/index' -import { Methods as Methods14 } from './api/1/expense_applications/index' -import { Methods as Methods15 } from './api/1/expense_applications/_id@number/index' -import { Methods as Methods16 } from './api/1/forms/selectables/index' -import { Methods as Methods17 } from './api/1/invoices/index' -import { Methods as Methods18 } from './api/1/invoices/_id@number/index' -import { Methods as Methods19 } from './api/1/items/index' -import { Methods as Methods20 } from './api/1/items/_id@number/index' -import { Methods as Methods21 } from './api/1/journals/index' -import { Methods as Methods22 } from './api/1/journals/reports/_id@number/download/index' -import { Methods as Methods23 } from './api/1/journals/reports/_id@number/status/index' -import { Methods as Methods24 } from './api/1/manual_journals/index' -import { Methods as Methods25 } from './api/1/manual_journals/_id@number/index' -import { Methods as Methods26 } from './api/1/partners/index' -import { Methods as Methods27 } from './api/1/partners/_id@number/index' -import { Methods as Methods28 } from './api/1/partners/code/_code@string/index' -import { Methods as Methods29 } from './api/1/quotations/index' -import { Methods as Methods30 } from './api/1/quotations/_id@number/index' -import { Methods as Methods31 } from './api/1/receipts/index' -import { Methods as Methods32 } from './api/1/receipts/_id@number/index' -import { Methods as Methods33 } from './api/1/reports/trial_bs/index' -import { Methods as Methods34 } from './api/1/reports/trial_bs_three_years/index' -import { Methods as Methods35 } from './api/1/reports/trial_bs_two_years/index' -import { Methods as Methods36 } from './api/1/reports/trial_pl/index' -import { Methods as Methods37 } from './api/1/reports/trial_pl_sections/index' -import { Methods as Methods38 } from './api/1/reports/trial_pl_three_years/index' -import { Methods as Methods39 } from './api/1/reports/trial_pl_two_years/index' -import { Methods as Methods40 } from './api/1/sections/index' -import { Methods as Methods41 } from './api/1/sections/_id@number/index' -import { Methods as Methods42 } from './api/1/segments/_segment_id@number/tags/index' -import { Methods as Methods43 } from './api/1/segments/_segment_id@number/tags/_id@number/index' -import { Methods as Methods44 } from './api/1/tags/index' -import { Methods as Methods45 } from './api/1/tags/_id@number/index' -import { Methods as Methods46 } from './api/1/taxes/codes/index' -import { Methods as Methods47 } from './api/1/taxes/codes/_code@number/index' -import { Methods as Methods48 } from './api/1/taxes/companies/_company_id@number/index' -import { Methods as Methods49 } from './api/1/transfers/index' -import { Methods as Methods50 } from './api/1/transfers/_id@number/index' -import { Methods as Methods51 } from './api/1/users/index' -import { Methods as Methods52 } from './api/1/users/capabilities/index' -import { Methods as Methods53 } from './api/1/users/me/index' -import { Methods as Methods54 } from './api/1/wallet_txns/index' -import { Methods as Methods55 } from './api/1/wallet_txns/_id@number/index' -import { Methods as Methods56 } from './api/1/walletables/index' -import { Methods as Methods57 } from './api/1/walletables/_type/_id@number/index' +import { Methods as Methods0 } from './api/1/account_items' +import { Methods as Methods1 } from './api/1/account_items/_id@number' +import { Methods as Methods2 } from './api/1/banks' +import { Methods as Methods3 } from './api/1/banks/_id@number' +import { Methods as Methods4 } from './api/1/companies' +import { Methods as Methods5 } from './api/1/companies/_id@number' +import { Methods as Methods6 } from './api/1/deals' +import { Methods as Methods7 } from './api/1/deals/_id@number' +import { Methods as Methods8 } from './api/1/deals/_id@number/payments' +import { Methods as Methods9 } from './api/1/deals/_id@number/payments/_payment_id@number' +import { Methods as Methods10 } from './api/1/deals/_id@number/renews' +import { Methods as Methods11 } from './api/1/deals/_id@number/renews/_renew_id@number' +import { Methods as Methods12 } from './api/1/expense_application_line_templates' +import { Methods as Methods13 } from './api/1/expense_application_line_templates/_id@number' +import { Methods as Methods14 } from './api/1/expense_applications' +import { Methods as Methods15 } from './api/1/expense_applications/_id@number' +import { Methods as Methods16 } from './api/1/forms/selectables' +import { Methods as Methods17 } from './api/1/invoices' +import { Methods as Methods18 } from './api/1/invoices/_id@number' +import { Methods as Methods19 } from './api/1/items' +import { Methods as Methods20 } from './api/1/items/_id@number' +import { Methods as Methods21 } from './api/1/journals' +import { Methods as Methods22 } from './api/1/journals/reports/_id@number/download' +import { Methods as Methods23 } from './api/1/journals/reports/_id@number/status' +import { Methods as Methods24 } from './api/1/manual_journals' +import { Methods as Methods25 } from './api/1/manual_journals/_id@number' +import { Methods as Methods26 } from './api/1/partners' +import { Methods as Methods27 } from './api/1/partners/_id@number' +import { Methods as Methods28 } from './api/1/partners/code/_code@string' +import { Methods as Methods29 } from './api/1/quotations' +import { Methods as Methods30 } from './api/1/quotations/_id@number' +import { Methods as Methods31 } from './api/1/receipts' +import { Methods as Methods32 } from './api/1/receipts/_id@number' +import { Methods as Methods33 } from './api/1/reports/trial_bs' +import { Methods as Methods34 } from './api/1/reports/trial_bs_three_years' +import { Methods as Methods35 } from './api/1/reports/trial_bs_two_years' +import { Methods as Methods36 } from './api/1/reports/trial_pl' +import { Methods as Methods37 } from './api/1/reports/trial_pl_sections' +import { Methods as Methods38 } from './api/1/reports/trial_pl_three_years' +import { Methods as Methods39 } from './api/1/reports/trial_pl_two_years' +import { Methods as Methods40 } from './api/1/sections' +import { Methods as Methods41 } from './api/1/sections/_id@number' +import { Methods as Methods42 } from './api/1/segments/_segment_id@number/tags' +import { Methods as Methods43 } from './api/1/segments/_segment_id@number/tags/_id@number' +import { Methods as Methods44 } from './api/1/tags' +import { Methods as Methods45 } from './api/1/tags/_id@number' +import { Methods as Methods46 } from './api/1/taxes/codes' +import { Methods as Methods47 } from './api/1/taxes/codes/_code@number' +import { Methods as Methods48 } from './api/1/taxes/companies/_company_id@number' +import { Methods as Methods49 } from './api/1/transfers' +import { Methods as Methods50 } from './api/1/transfers/_id@number' +import { Methods as Methods51 } from './api/1/users' +import { Methods as Methods52 } from './api/1/users/capabilities' +import { Methods as Methods53 } from './api/1/users/me' +import { Methods as Methods54 } from './api/1/wallet_txns' +import { Methods as Methods55 } from './api/1/wallet_txns/_id@number' +import { Methods as Methods56 } from './api/1/walletables' +import { Methods as Methods57 } from './api/1/walletables/_type/_id@number' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? 'https://api.freee.co.jp' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/account_items' +const PATH1 = '/api/1/banks' +const PATH2 = '/api/1/companies' +const PATH3 = '/api/1/deals' +const PATH4 = '/payments' +const PATH5 = '/renews' +const PATH6 = '/api/1/expense_application_line_templates' +const PATH7 = '/api/1/expense_applications' +const PATH8 = '/api/1/forms/selectables' +const PATH9 = '/api/1/invoices' +const PATH10 = '/api/1/items' +const PATH11 = '/api/1/journals' +const PATH12 = '/api/1/journals/reports' +const PATH13 = '/download' +const PATH14 = '/status' +const PATH15 = '/api/1/manual_journals' +const PATH16 = '/api/1/partners' +const PATH17 = '/api/1/partners/code' +const PATH18 = '/api/1/quotations' +const PATH19 = '/api/1/receipts' +const PATH20 = '/api/1/reports/trial_bs' +const PATH21 = '/api/1/reports/trial_bs_three_years' +const PATH22 = '/api/1/reports/trial_bs_two_years' +const PATH23 = '/api/1/reports/trial_pl' +const PATH24 = '/api/1/reports/trial_pl_sections' +const PATH25 = '/api/1/reports/trial_pl_three_years' +const PATH26 = '/api/1/reports/trial_pl_two_years' +const PATH27 = '/api/1/sections' +const PATH28 = '/api/1/segments' +const PATH29 = '/tags' +const PATH30 = '/api/1/tags' +const PATH31 = '/api/1/taxes/codes' +const PATH32 = '/api/1/taxes/companies' +const PATH33 = '/api/1/transfers' +const PATH34 = '/api/1/users' +const PATH35 = '/api/1/users/capabilities' +const PATH36 = '/api/1/users/me' +const PATH37 = '/api/1/wallet_txns' +const PATH38 = '/api/1/walletables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') return { api: { $1: { account_items: { - _id: (val0: number) => ({ - get: (option: { query: Methods1['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/account_items/${val0}`, 'GET', option).json(), - $get: async (option: { query: Methods1['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/account_items/${val0}`, 'GET', option).json()).body, - put: (option: { body: Methods1['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/account_items/${val0}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods1['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/account_items/${val0}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods1['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/account_items/${val0}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods1['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/account_items/${val0}`, 'DELETE', option).send()).body - }), + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods0['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/account_items', 'GET', option).json(), - $get: async (option: { query: Methods0['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/account_items', 'GET', option).json()).body, + fetch(prefix, PATH0, GET, option).json(), + $get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body), post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/account_items', 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods0['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/account_items', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) }, banks: { - _id: (val1: number) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/api/1/banks/${val1}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/api/1/banks/${val1}`, 'GET', option).json()).body - }), + _id: (val1: number) => { + const prefix1 = `${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + }, get: (option?: { query?: Methods2['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/banks', 'GET', option).json(), - $get: async (option?: { query?: Methods2['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/banks', 'GET', option).json()).body + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) }, companies: { - _id: (val2: number) => ({ - get: (option?: { query?: Methods5['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/companies/${val2}`, 'GET', option).json(), - $get: async (option?: { query?: Methods5['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/companies/${val2}`, 'GET', option).json()).body, - put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/companies/${val2}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods5['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/companies/${val2}`, 'PUT', option, 'URLSearchParams').json()).body - }), + _id: (val2: number) => { + const prefix2 = `${PATH2}/${val2}` + + return { + get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + }, get: (option?: { config?: T }) => - client.fetch(prefix, '/api/1/companies', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/api/1/companies', 'GET', option).json()).body + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) }, deals: { - _id: (val3: number) => ({ - payments: { - _payment_id: (val4: number) => ({ - put: (option: { body: Methods9['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/payments/${val4}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods9['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/payments/${val4}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods9['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/payments/${val4}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods9['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/payments/${val4}`, 'DELETE', option).send()).body - }), - post: (option: { body: Methods8['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/payments`, 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods8['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/payments`, 'POST', option, 'URLSearchParams').json()).body - }, - renews: { - _renew_id: (val5: number) => ({ - put: (option: { body: Methods11['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/renews/${val5}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods11['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/renews/${val5}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods11['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/renews/${val5}`, 'DELETE', option).json(), - $delete: async (option: { query: Methods11['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/renews/${val5}`, 'DELETE', option).json()).body - }), - post: (option: { body: Methods10['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}/renews`, 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods10['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}/renews`, 'POST', option, 'URLSearchParams').json()).body - }, - get: (option: { query: Methods7['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}`, 'GET', option).json(), - $get: async (option: { query: Methods7['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}`, 'GET', option).json()).body, - put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods7['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods7['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/deals/${val3}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods7['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/deals/${val3}`, 'DELETE', option).send()).body - }), + _id: (val3: number) => { + const prefix3 = `${PATH3}/${val3}` + + return { + payments: { + _payment_id: (val4: number) => { + const prefix4 = `${prefix3}${PATH4}/${val4}` + + return { + put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send(), + $delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + renews: { + _renew_id: (val5: number) => { + const prefix5 = `${prefix3}${PATH5}/${val5}` + + return { + put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json(), + $delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json().then(r => r.body) + } + }, + post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json(), + $get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send(), + $delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods6['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/deals', 'GET', option).json(), - $get: async (option: { query: Methods6['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/deals', 'GET', option).json()).body, + fetch(prefix, PATH3, GET, option).json(), + $get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json().then(r => r.body), post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/deals', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods6['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/deals', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body) }, expense_application_line_templates: { - _id: (val6: number) => ({ - get: (option: { query: Methods13['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'GET', option).json(), - $get: async (option: { query: Methods13['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'GET', option).json()).body, - put: (option: { body: Methods13['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods13['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods13['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods13['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_application_line_templates/${val6}`, 'DELETE', option).send()).body - }), + _id: (val6: number) => { + const prefix6 = `${PATH6}/${val6}` + + return { + get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json(), + $get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json().then(r => r.body), + put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send(), + $delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods12['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/expense_application_line_templates', 'GET', option).json(), - $get: async (option: { query: Methods12['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/expense_application_line_templates', 'GET', option).json()).body, + fetch(prefix, PATH6, GET, option).json(), + $get: (option: { query: Methods12['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json().then(r => r.body), post: (option: { body: Methods12['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/expense_application_line_templates', 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods12['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/expense_application_line_templates', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body) }, expense_applications: { - _id: (val7: number) => ({ - get: (option: { query: Methods15['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'GET', option).json(), - $get: async (option: { query: Methods15['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'GET', option).json()).body, - put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods15['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods15['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods15['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/expense_applications/${val7}`, 'DELETE', option).send()).body - }), + _id: (val7: number) => { + const prefix7 = `${PATH7}/${val7}` + + return { + get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send(), + $delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods14['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/expense_applications', 'GET', option).json(), - $get: async (option: { query: Methods14['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/expense_applications', 'GET', option).json()).body, + fetch(prefix, PATH7, GET, option).json(), + $get: (option: { query: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH7, GET, option).json().then(r => r.body), post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/expense_applications', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods14['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/expense_applications', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body) }, forms: { selectables: { get: (option: { query: Methods16['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/forms/selectables', 'GET', option).json(), - $get: async (option: { query: Methods16['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/forms/selectables', 'GET', option).json()).body + fetch(prefix, PATH8, GET, option).json(), + $get: (option: { query: Methods16['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).json().then(r => r.body) } }, invoices: { - _id: (val8: number) => ({ - get: (option: { query: Methods18['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/invoices/${val8}`, 'GET', option).json(), - $get: async (option: { query: Methods18['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/invoices/${val8}`, 'GET', option).json()).body, - put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/invoices/${val8}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods18['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/invoices/${val8}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods18['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/invoices/${val8}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods18['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/invoices/${val8}`, 'DELETE', option).send()).body - }), + _id: (val8: number) => { + const prefix8 = `${PATH9}/${val8}` + + return { + get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json(), + $get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send(), + $delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods17['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/invoices', 'GET', option).json(), - $get: async (option: { query: Methods17['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/invoices', 'GET', option).json()).body, + fetch(prefix, PATH9, GET, option).json(), + $get: (option: { query: Methods17['get']['query'], config?: T }) => + fetch(prefix, PATH9, GET, option).json().then(r => r.body), post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/invoices', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods17['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/invoices', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body) }, items: { - _id: (val9: number) => ({ - get: (option: { query: Methods20['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/items/${val9}`, 'GET', option).json(), - $get: async (option: { query: Methods20['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/items/${val9}`, 'GET', option).json()).body, - put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/items/${val9}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods20['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/items/${val9}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods20['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/items/${val9}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods20['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/items/${val9}`, 'DELETE', option).send()).body - }), + _id: (val9: number) => { + const prefix9 = `${PATH10}/${val9}` + + return { + get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json(), + $get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send(), + $delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods19['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/items', 'GET', option).json(), - $get: async (option: { query: Methods19['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/items', 'GET', option).json()).body, + fetch(prefix, PATH10, GET, option).json(), + $get: (option: { query: Methods19['get']['query'], config?: T }) => + fetch(prefix, PATH10, GET, option).json().then(r => r.body), post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/items', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods19['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/items', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body) }, journals: { reports: { - _id: (val10: number) => ({ - download: { - get: (option: { query: Methods22['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/journals/reports/${val10}/download`, 'GET', option).send(), - $get: async (option: { query: Methods22['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/journals/reports/${val10}/download`, 'GET', option).send()).body - }, - status: { - get: (option: { query: Methods23['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/journals/reports/${val10}/status`, 'GET', option).json(), - $get: async (option: { query: Methods23['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/journals/reports/${val10}/status`, 'GET', option).json()).body + _id: (val10: number) => { + const prefix10 = `${PATH12}/${val10}` + + return { + download: { + get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send(), + $get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body) + }, + status: { + get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json(), + $get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body) + } } - }) + } }, get: (option: { query: Methods21['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/journals', 'GET', option).json(), - $get: async (option: { query: Methods21['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/journals', 'GET', option).json()).body + fetch(prefix, PATH11, GET, option).json(), + $get: (option: { query: Methods21['get']['query'], config?: T }) => + fetch(prefix, PATH11, GET, option).json().then(r => r.body) }, manual_journals: { - _id: (val11: number) => ({ - get: (option: { query: Methods25['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'GET', option).json(), - $get: async (option: { query: Methods25['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'GET', option).json()).body, - put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods25['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods25['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods25['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/manual_journals/${val11}`, 'DELETE', option).send()).body - }), + _id: (val11: number) => { + const prefix11 = `${PATH15}/${val11}` + + return { + get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json(), + $get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send(), + $delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods24['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/manual_journals', 'GET', option).json(), - $get: async (option: { query: Methods24['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/manual_journals', 'GET', option).json()).body, + fetch(prefix, PATH15, GET, option).json(), + $get: (option: { query: Methods24['get']['query'], config?: T }) => + fetch(prefix, PATH15, GET, option).json().then(r => r.body), post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/manual_journals', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods24['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/manual_journals', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body) }, partners: { - _id: (val12: number) => ({ - get: (option: { query: Methods27['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/partners/${val12}`, 'GET', option).json(), - $get: async (option: { query: Methods27['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/partners/${val12}`, 'GET', option).json()).body, - put: (option: { body: Methods27['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/partners/${val12}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods27['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/partners/${val12}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods27['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/partners/${val12}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods27['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/partners/${val12}`, 'DELETE', option).send()).body - }), + _id: (val12: number) => { + const prefix12 = `${PATH16}/${val12}` + + return { + get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json(), + $get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json().then(r => r.body), + put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send(), + $delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send().then(r => r.body) + } + }, code: { - _code: (val13: string) => ({ - put: (option: { body: Methods28['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/partners/code/${val13}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods28['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/partners/code/${val13}`, 'PUT', option, 'URLSearchParams').json()).body - }) + _code: (val13: string) => { + const prefix13 = `${PATH17}/${val13}` + + return { + put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + } }, get: (option: { query: Methods26['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/partners', 'GET', option).json(), - $get: async (option: { query: Methods26['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/partners', 'GET', option).json()).body, + fetch(prefix, PATH16, GET, option).json(), + $get: (option: { query: Methods26['get']['query'], config?: T }) => + fetch(prefix, PATH16, GET, option).json().then(r => r.body), post: (option: { body: Methods26['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/partners', 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods26['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/partners', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body) }, quotations: { - _id: (val14: number) => ({ - get: (option: { query: Methods30['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/quotations/${val14}`, 'GET', option).json(), - $get: async (option: { query: Methods30['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/quotations/${val14}`, 'GET', option).json()).body, - put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/quotations/${val14}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods30['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/quotations/${val14}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods30['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/quotations/${val14}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods30['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/quotations/${val14}`, 'DELETE', option).send()).body - }), + _id: (val14: number) => { + const prefix14 = `${PATH18}/${val14}` + + return { + get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json(), + $get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send(), + $delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods29['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/quotations', 'GET', option).json(), - $get: async (option: { query: Methods29['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/quotations', 'GET', option).json()).body, + fetch(prefix, PATH18, GET, option).json(), + $get: (option: { query: Methods29['get']['query'], config?: T }) => + fetch(prefix, PATH18, GET, option).json().then(r => r.body), post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/quotations', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods29['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/quotations', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body) }, receipts: { - _id: (val15: number) => ({ - get: (option: { query: Methods32['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/receipts/${val15}`, 'GET', option).json(), - $get: async (option: { query: Methods32['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/receipts/${val15}`, 'GET', option).json()).body, - put: (option: { body: Methods32['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/receipts/${val15}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods32['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/receipts/${val15}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods32['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/receipts/${val15}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods32['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/receipts/${val15}`, 'DELETE', option).send()).body - }), + _id: (val15: number) => { + const prefix15 = `${PATH19}/${val15}` + + return { + get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json(), + $get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json().then(r => r.body), + put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send(), + $delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods31['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/receipts', 'GET', option).json(), - $get: async (option: { query: Methods31['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/receipts', 'GET', option).json()).body, + fetch(prefix, PATH19, GET, option).json(), + $get: (option: { query: Methods31['get']['query'], config?: T }) => + fetch(prefix, PATH19, GET, option).json().then(r => r.body), post: (option: { body: Methods31['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/receipts', 'POST', option, 'FormData').json(), - $post: async (option: { body: Methods31['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/receipts', 'POST', option, 'FormData').json()).body + fetch(prefix, PATH19, POST, option, 'FormData').json(), + $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => + fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body) }, reports: { trial_bs: { get: (option: { query: Methods33['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_bs', 'GET', option).json(), - $get: async (option: { query: Methods33['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_bs', 'GET', option).json()).body + fetch(prefix, PATH20, GET, option).json(), + $get: (option: { query: Methods33['get']['query'], config?: T }) => + fetch(prefix, PATH20, GET, option).json().then(r => r.body) }, trial_bs_three_years: { get: (option: { query: Methods34['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_bs_three_years', 'GET', option).json(), - $get: async (option: { query: Methods34['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_bs_three_years', 'GET', option).json()).body + fetch(prefix, PATH21, GET, option).json(), + $get: (option: { query: Methods34['get']['query'], config?: T }) => + fetch(prefix, PATH21, GET, option).json().then(r => r.body) }, trial_bs_two_years: { get: (option: { query: Methods35['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_bs_two_years', 'GET', option).json(), - $get: async (option: { query: Methods35['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_bs_two_years', 'GET', option).json()).body + fetch(prefix, PATH22, GET, option).json(), + $get: (option: { query: Methods35['get']['query'], config?: T }) => + fetch(prefix, PATH22, GET, option).json().then(r => r.body) }, trial_pl: { get: (option: { query: Methods36['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_pl', 'GET', option).json(), - $get: async (option: { query: Methods36['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_pl', 'GET', option).json()).body + fetch(prefix, PATH23, GET, option).json(), + $get: (option: { query: Methods36['get']['query'], config?: T }) => + fetch(prefix, PATH23, GET, option).json().then(r => r.body) }, trial_pl_sections: { get: (option: { query: Methods37['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_pl_sections', 'GET', option).json(), - $get: async (option: { query: Methods37['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_pl_sections', 'GET', option).json()).body + fetch(prefix, PATH24, GET, option).json(), + $get: (option: { query: Methods37['get']['query'], config?: T }) => + fetch(prefix, PATH24, GET, option).json().then(r => r.body) }, trial_pl_three_years: { get: (option: { query: Methods38['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_pl_three_years', 'GET', option).json(), - $get: async (option: { query: Methods38['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_pl_three_years', 'GET', option).json()).body + fetch(prefix, PATH25, GET, option).json(), + $get: (option: { query: Methods38['get']['query'], config?: T }) => + fetch(prefix, PATH25, GET, option).json().then(r => r.body) }, trial_pl_two_years: { get: (option: { query: Methods39['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/reports/trial_pl_two_years', 'GET', option).json(), - $get: async (option: { query: Methods39['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/reports/trial_pl_two_years', 'GET', option).json()).body + fetch(prefix, PATH26, GET, option).json(), + $get: (option: { query: Methods39['get']['query'], config?: T }) => + fetch(prefix, PATH26, GET, option).json().then(r => r.body) } }, sections: { - _id: (val16: number) => ({ - get: (option: { query: Methods41['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/sections/${val16}`, 'GET', option).json(), - $get: async (option: { query: Methods41['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/sections/${val16}`, 'GET', option).json()).body, - put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/sections/${val16}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods41['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/sections/${val16}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods41['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/sections/${val16}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods41['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/sections/${val16}`, 'DELETE', option).send()).body - }), + _id: (val16: number) => { + const prefix16 = `${PATH27}/${val16}` + + return { + get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json(), + $get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send(), + $delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods40['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/sections', 'GET', option).json(), - $get: async (option: { query: Methods40['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/sections', 'GET', option).json()).body, + fetch(prefix, PATH27, GET, option).json(), + $get: (option: { query: Methods40['get']['query'], config?: T }) => + fetch(prefix, PATH27, GET, option).json().then(r => r.body), post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/sections', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods40['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/sections', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body) }, segments: { - _segment_id: (val17: number) => ({ - tags: { - _id: (val18: number) => ({ - put: (option: { body: Methods43['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/segments/${val17}/tags/${val18}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods43['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/segments/${val17}/tags/${val18}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods43['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/segments/${val17}/tags/${val18}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods43['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/segments/${val17}/tags/${val18}`, 'DELETE', option).send()).body - }), - get: (option: { query: Methods42['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/segments/${val17}/tags`, 'GET', option).json(), - $get: async (option: { query: Methods42['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/segments/${val17}/tags`, 'GET', option).json()).body, - post: (option: { body: Methods42['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/segments/${val17}/tags`, 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods42['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/segments/${val17}/tags`, 'POST', option, 'URLSearchParams').json()).body + _segment_id: (val17: number) => { + const prefix17 = `${PATH28}/${val17}` + + return { + tags: { + _id: (val18: number) => { + const prefix18 = `${prefix17}${PATH29}/${val18}` + + return { + put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send(), + $delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json(), + $get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body) + } } - }) + } }, tags: { - _id: (val19: number) => ({ - get: (option: { query: Methods45['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/tags/${val19}`, 'GET', option).json(), - $get: async (option: { query: Methods45['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/tags/${val19}`, 'GET', option).json()).body, - put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/tags/${val19}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods45['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/tags/${val19}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods45['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/tags/${val19}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods45['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/tags/${val19}`, 'DELETE', option).send()).body - }), + _id: (val19: number) => { + const prefix19 = `${PATH30}/${val19}` + + return { + get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json(), + $get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send(), + $delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods44['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/tags', 'GET', option).json(), - $get: async (option: { query: Methods44['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/tags', 'GET', option).json()).body, + fetch(prefix, PATH30, GET, option).json(), + $get: (option: { query: Methods44['get']['query'], config?: T }) => + fetch(prefix, PATH30, GET, option).json().then(r => r.body), post: (option: { body: Methods44['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/tags', 'POST', option, 'URLSearchParams').json(), - $post: async (option: { body: Methods44['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/tags', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body) }, taxes: { codes: { - _code: (val20: number) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/api/1/taxes/codes/${val20}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/api/1/taxes/codes/${val20}`, 'GET', option).json()).body - }), + _code: (val20: number) => { + const prefix20 = `${PATH31}/${val20}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json().then(r => r.body) + } + }, get: (option?: { config?: T }) => - client.fetch(prefix, '/api/1/taxes/codes', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/api/1/taxes/codes', 'GET', option).json()).body + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) }, companies: { - _company_id: (val21: number) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/api/1/taxes/companies/${val21}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/api/1/taxes/companies/${val21}`, 'GET', option).json()).body - }) + _company_id: (val21: number) => { + const prefix21 = `${PATH32}/${val21}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json().then(r => r.body) + } + } } }, transfers: { - _id: (val22: number) => ({ - get: (option: { query: Methods50['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/transfers/${val22}`, 'GET', option).json(), - $get: async (option: { query: Methods50['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/transfers/${val22}`, 'GET', option).json()).body, - put: (option: { body: Methods50['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/1/transfers/${val22}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body: Methods50['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/1/transfers/${val22}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods50['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/transfers/${val22}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods50['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/transfers/${val22}`, 'DELETE', option).send()).body - }), + _id: (val22: number) => { + const prefix22 = `${PATH33}/${val22}` + + return { + get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json(), + $get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json().then(r => r.body), + put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send(), + $delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods49['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/transfers', 'GET', option).json(), - $get: async (option: { query: Methods49['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/transfers', 'GET', option).json()).body, + fetch(prefix, PATH33, GET, option).json(), + $get: (option: { query: Methods49['get']['query'], config?: T }) => + fetch(prefix, PATH33, GET, option).json().then(r => r.body), post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/transfers', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods49['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/transfers', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body) }, users: { capabilities: { get: (option: { query: Methods52['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/users/capabilities', 'GET', option).json(), - $get: async (option: { query: Methods52['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/users/capabilities', 'GET', option).json()).body + fetch(prefix, PATH35, GET, option).json(), + $get: (option: { query: Methods52['get']['query'], config?: T }) => + fetch(prefix, PATH35, GET, option).json().then(r => r.body) }, me: { get: (option?: { query?: Methods53['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/users/me', 'GET', option).json(), - $get: async (option?: { query?: Methods53['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/users/me', 'GET', option).json()).body, + fetch(prefix, PATH36, GET, option).json(), + $get: (option?: { query?: Methods53['get']['query'], config?: T }) => + fetch(prefix, PATH36, GET, option).json().then(r => r.body), put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/users/me', 'PUT', option, 'URLSearchParams').json(), - $put: async (option?: { body?: Methods53['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/users/me', 'PUT', option, 'URLSearchParams').json()).body + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body) }, get: (option: { query: Methods51['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/users', 'GET', option).json(), - $get: async (option: { query: Methods51['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/users', 'GET', option).json()).body + fetch(prefix, PATH34, GET, option).json(), + $get: (option: { query: Methods51['get']['query'], config?: T }) => + fetch(prefix, PATH34, GET, option).json().then(r => r.body) }, wallet_txns: { - _id: (val23: number) => ({ - get: (option: { query: Methods55['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/wallet_txns/${val23}`, 'GET', option).json(), - $get: async (option: { query: Methods55['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/wallet_txns/${val23}`, 'GET', option).json()).body, - delete: (option: { query: Methods55['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/wallet_txns/${val23}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods55['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/wallet_txns/${val23}`, 'DELETE', option).send()).body - }), + _id: (val23: number) => { + const prefix23 = `${PATH37}/${val23}` + + return { + get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json(), + $get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json().then(r => r.body), + delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send(), + $delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send().then(r => r.body) + } + }, get: (option: { query: Methods54['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/wallet_txns', 'GET', option).json(), - $get: async (option: { query: Methods54['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/wallet_txns', 'GET', option).json()).body, + fetch(prefix, PATH37, GET, option).json(), + $get: (option: { query: Methods54['get']['query'], config?: T }) => + fetch(prefix, PATH37, GET, option).json().then(r => r.body), post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/wallet_txns', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods54['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/wallet_txns', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body) }, walletables: { - _type: (val24: number | string) => ({ - _id: (val25: number) => ({ - get: (option: { query: Methods57['get']['query'], config?: T }) => - client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'GET', option).json(), - $get: async (option: { query: Methods57['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'GET', option).json()).body, - put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => - client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'PUT', option, 'URLSearchParams').json(), - $put: async (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'PUT', option, 'URLSearchParams').json()).body, - delete: (option: { query: Methods57['delete']['query'], config?: T }) => - client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'DELETE', option).send(), - $delete: async (option: { query: Methods57['delete']['query'], config?: T }) => - (await client.fetch(prefix, `/api/1/walletables/${val24}/${val25}`, 'DELETE', option).send()).body - }) - }), + _type: (val24: number | string) => { + const prefix24 = `${PATH38}/${val24}` + + return { + _id: (val25: number) => { + const prefix25 = `${prefix24}/${val25}` + + return { + get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json(), + $get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json().then(r => r.body), + put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json(), + $put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send(), + $delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send().then(r => r.body) + } + } + } + }, get: (option: { query: Methods56['get']['query'], config?: T }) => - client.fetch(prefix, '/api/1/walletables', 'GET', option).json(), - $get: async (option: { query: Methods56['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/1/walletables', 'GET', option).json()).body, + fetch(prefix, PATH38, GET, option).json(), + $get: (option: { query: Methods56['get']['query'], config?: T }) => + fetch(prefix, PATH38, GET, option).json().then(r => r.body), post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/1/walletables', 'POST', option, 'URLSearchParams').json(), - $post: async (option?: { body?: Methods56['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/1/walletables', 'POST', option, 'URLSearchParams').json()).body + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body) } } } diff --git a/samples/freee/api/$api.ts b/samples/freee/api/$api.ts new file mode 100644 index 00000000..7743413f --- /dev/null +++ b/samples/freee/api/$api.ts @@ -0,0 +1,787 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './1/account_items' +import { Methods as Methods1 } from './1/account_items/_id@number' +import { Methods as Methods2 } from './1/banks' +import { Methods as Methods3 } from './1/banks/_id@number' +import { Methods as Methods4 } from './1/companies' +import { Methods as Methods5 } from './1/companies/_id@number' +import { Methods as Methods6 } from './1/deals' +import { Methods as Methods7 } from './1/deals/_id@number' +import { Methods as Methods8 } from './1/deals/_id@number/payments' +import { Methods as Methods9 } from './1/deals/_id@number/payments/_payment_id@number' +import { Methods as Methods10 } from './1/deals/_id@number/renews' +import { Methods as Methods11 } from './1/deals/_id@number/renews/_renew_id@number' +import { Methods as Methods12 } from './1/expense_application_line_templates' +import { Methods as Methods13 } from './1/expense_application_line_templates/_id@number' +import { Methods as Methods14 } from './1/expense_applications' +import { Methods as Methods15 } from './1/expense_applications/_id@number' +import { Methods as Methods16 } from './1/forms/selectables' +import { Methods as Methods17 } from './1/invoices' +import { Methods as Methods18 } from './1/invoices/_id@number' +import { Methods as Methods19 } from './1/items' +import { Methods as Methods20 } from './1/items/_id@number' +import { Methods as Methods21 } from './1/journals' +import { Methods as Methods22 } from './1/journals/reports/_id@number/download' +import { Methods as Methods23 } from './1/journals/reports/_id@number/status' +import { Methods as Methods24 } from './1/manual_journals' +import { Methods as Methods25 } from './1/manual_journals/_id@number' +import { Methods as Methods26 } from './1/partners' +import { Methods as Methods27 } from './1/partners/_id@number' +import { Methods as Methods28 } from './1/partners/code/_code@string' +import { Methods as Methods29 } from './1/quotations' +import { Methods as Methods30 } from './1/quotations/_id@number' +import { Methods as Methods31 } from './1/receipts' +import { Methods as Methods32 } from './1/receipts/_id@number' +import { Methods as Methods33 } from './1/reports/trial_bs' +import { Methods as Methods34 } from './1/reports/trial_bs_three_years' +import { Methods as Methods35 } from './1/reports/trial_bs_two_years' +import { Methods as Methods36 } from './1/reports/trial_pl' +import { Methods as Methods37 } from './1/reports/trial_pl_sections' +import { Methods as Methods38 } from './1/reports/trial_pl_three_years' +import { Methods as Methods39 } from './1/reports/trial_pl_two_years' +import { Methods as Methods40 } from './1/sections' +import { Methods as Methods41 } from './1/sections/_id@number' +import { Methods as Methods42 } from './1/segments/_segment_id@number/tags' +import { Methods as Methods43 } from './1/segments/_segment_id@number/tags/_id@number' +import { Methods as Methods44 } from './1/tags' +import { Methods as Methods45 } from './1/tags/_id@number' +import { Methods as Methods46 } from './1/taxes/codes' +import { Methods as Methods47 } from './1/taxes/codes/_code@number' +import { Methods as Methods48 } from './1/taxes/companies/_company_id@number' +import { Methods as Methods49 } from './1/transfers' +import { Methods as Methods50 } from './1/transfers/_id@number' +import { Methods as Methods51 } from './1/users' +import { Methods as Methods52 } from './1/users/capabilities' +import { Methods as Methods53 } from './1/users/me' +import { Methods as Methods54 } from './1/wallet_txns' +import { Methods as Methods55 } from './1/wallet_txns/_id@number' +import { Methods as Methods56 } from './1/walletables' +import { Methods as Methods57 } from './1/walletables/_type/_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/account_items' +const PATH1 = '/api/1/banks' +const PATH2 = '/api/1/companies' +const PATH3 = '/api/1/deals' +const PATH4 = '/payments' +const PATH5 = '/renews' +const PATH6 = '/api/1/expense_application_line_templates' +const PATH7 = '/api/1/expense_applications' +const PATH8 = '/api/1/forms/selectables' +const PATH9 = '/api/1/invoices' +const PATH10 = '/api/1/items' +const PATH11 = '/api/1/journals' +const PATH12 = '/api/1/journals/reports' +const PATH13 = '/download' +const PATH14 = '/status' +const PATH15 = '/api/1/manual_journals' +const PATH16 = '/api/1/partners' +const PATH17 = '/api/1/partners/code' +const PATH18 = '/api/1/quotations' +const PATH19 = '/api/1/receipts' +const PATH20 = '/api/1/reports/trial_bs' +const PATH21 = '/api/1/reports/trial_bs_three_years' +const PATH22 = '/api/1/reports/trial_bs_two_years' +const PATH23 = '/api/1/reports/trial_pl' +const PATH24 = '/api/1/reports/trial_pl_sections' +const PATH25 = '/api/1/reports/trial_pl_three_years' +const PATH26 = '/api/1/reports/trial_pl_two_years' +const PATH27 = '/api/1/sections' +const PATH28 = '/api/1/segments' +const PATH29 = '/tags' +const PATH30 = '/api/1/tags' +const PATH31 = '/api/1/taxes/codes' +const PATH32 = '/api/1/taxes/companies' +const PATH33 = '/api/1/transfers' +const PATH34 = '/api/1/users' +const PATH35 = '/api/1/users/capabilities' +const PATH36 = '/api/1/users/me' +const PATH37 = '/api/1/wallet_txns' +const PATH38 = '/api/1/walletables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + $1: { + account_items: { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + banks: { + _id: (val1: number) => { + const prefix1 = `${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + companies: { + _id: (val2: number) => { + const prefix2 = `${PATH2}/${val2}` + + return { + get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + deals: { + _id: (val3: number) => { + const prefix3 = `${PATH3}/${val3}` + + return { + payments: { + _payment_id: (val4: number) => { + const prefix4 = `${prefix3}${PATH4}/${val4}` + + return { + put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send(), + $delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + renews: { + _renew_id: (val5: number) => { + const prefix5 = `${prefix3}${PATH5}/${val5}` + + return { + put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json(), + $delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json().then(r => r.body) + } + }, + post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json(), + $get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send(), + $delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json(), + $get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + expense_application_line_templates: { + _id: (val6: number) => { + const prefix6 = `${PATH6}/${val6}` + + return { + get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json(), + $get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json().then(r => r.body), + put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send(), + $delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods12['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json(), + $get: (option: { query: Methods12['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json().then(r => r.body), + post: (option: { body: Methods12['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + expense_applications: { + _id: (val7: number) => { + const prefix7 = `${PATH7}/${val7}` + + return { + get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send(), + $delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH7, GET, option).json(), + $get: (option: { query: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH7, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + forms: { + selectables: { + get: (option: { query: Methods16['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).json(), + $get: (option: { query: Methods16['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).json().then(r => r.body) + } + }, + invoices: { + _id: (val8: number) => { + const prefix8 = `${PATH9}/${val8}` + + return { + get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json(), + $get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send(), + $delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods17['get']['query'], config?: T }) => + fetch(prefix, PATH9, GET, option).json(), + $get: (option: { query: Methods17['get']['query'], config?: T }) => + fetch(prefix, PATH9, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + items: { + _id: (val9: number) => { + const prefix9 = `${PATH10}/${val9}` + + return { + get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json(), + $get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send(), + $delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods19['get']['query'], config?: T }) => + fetch(prefix, PATH10, GET, option).json(), + $get: (option: { query: Methods19['get']['query'], config?: T }) => + fetch(prefix, PATH10, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + journals: { + reports: { + _id: (val10: number) => { + const prefix10 = `${PATH12}/${val10}` + + return { + download: { + get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send(), + $get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body) + }, + status: { + get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json(), + $get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body) + } + } + } + }, + get: (option: { query: Methods21['get']['query'], config?: T }) => + fetch(prefix, PATH11, GET, option).json(), + $get: (option: { query: Methods21['get']['query'], config?: T }) => + fetch(prefix, PATH11, GET, option).json().then(r => r.body) + }, + manual_journals: { + _id: (val11: number) => { + const prefix11 = `${PATH15}/${val11}` + + return { + get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json(), + $get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send(), + $delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods24['get']['query'], config?: T }) => + fetch(prefix, PATH15, GET, option).json(), + $get: (option: { query: Methods24['get']['query'], config?: T }) => + fetch(prefix, PATH15, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + partners: { + _id: (val12: number) => { + const prefix12 = `${PATH16}/${val12}` + + return { + get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json(), + $get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json().then(r => r.body), + put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send(), + $delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send().then(r => r.body) + } + }, + code: { + _code: (val13: string) => { + const prefix13 = `${PATH17}/${val13}` + + return { + put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + } + }, + get: (option: { query: Methods26['get']['query'], config?: T }) => + fetch(prefix, PATH16, GET, option).json(), + $get: (option: { query: Methods26['get']['query'], config?: T }) => + fetch(prefix, PATH16, GET, option).json().then(r => r.body), + post: (option: { body: Methods26['post']['reqBody'], config?: T }) => + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + quotations: { + _id: (val14: number) => { + const prefix14 = `${PATH18}/${val14}` + + return { + get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json(), + $get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send(), + $delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods29['get']['query'], config?: T }) => + fetch(prefix, PATH18, GET, option).json(), + $get: (option: { query: Methods29['get']['query'], config?: T }) => + fetch(prefix, PATH18, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + receipts: { + _id: (val15: number) => { + const prefix15 = `${PATH19}/${val15}` + + return { + get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json(), + $get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json().then(r => r.body), + put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send(), + $delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods31['get']['query'], config?: T }) => + fetch(prefix, PATH19, GET, option).json(), + $get: (option: { query: Methods31['get']['query'], config?: T }) => + fetch(prefix, PATH19, GET, option).json().then(r => r.body), + post: (option: { body: Methods31['post']['reqBody'], config?: T }) => + fetch(prefix, PATH19, POST, option, 'FormData').json(), + $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => + fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body) + }, + reports: { + trial_bs: { + get: (option: { query: Methods33['get']['query'], config?: T }) => + fetch(prefix, PATH20, GET, option).json(), + $get: (option: { query: Methods33['get']['query'], config?: T }) => + fetch(prefix, PATH20, GET, option).json().then(r => r.body) + }, + trial_bs_three_years: { + get: (option: { query: Methods34['get']['query'], config?: T }) => + fetch(prefix, PATH21, GET, option).json(), + $get: (option: { query: Methods34['get']['query'], config?: T }) => + fetch(prefix, PATH21, GET, option).json().then(r => r.body) + }, + trial_bs_two_years: { + get: (option: { query: Methods35['get']['query'], config?: T }) => + fetch(prefix, PATH22, GET, option).json(), + $get: (option: { query: Methods35['get']['query'], config?: T }) => + fetch(prefix, PATH22, GET, option).json().then(r => r.body) + }, + trial_pl: { + get: (option: { query: Methods36['get']['query'], config?: T }) => + fetch(prefix, PATH23, GET, option).json(), + $get: (option: { query: Methods36['get']['query'], config?: T }) => + fetch(prefix, PATH23, GET, option).json().then(r => r.body) + }, + trial_pl_sections: { + get: (option: { query: Methods37['get']['query'], config?: T }) => + fetch(prefix, PATH24, GET, option).json(), + $get: (option: { query: Methods37['get']['query'], config?: T }) => + fetch(prefix, PATH24, GET, option).json().then(r => r.body) + }, + trial_pl_three_years: { + get: (option: { query: Methods38['get']['query'], config?: T }) => + fetch(prefix, PATH25, GET, option).json(), + $get: (option: { query: Methods38['get']['query'], config?: T }) => + fetch(prefix, PATH25, GET, option).json().then(r => r.body) + }, + trial_pl_two_years: { + get: (option: { query: Methods39['get']['query'], config?: T }) => + fetch(prefix, PATH26, GET, option).json(), + $get: (option: { query: Methods39['get']['query'], config?: T }) => + fetch(prefix, PATH26, GET, option).json().then(r => r.body) + } + }, + sections: { + _id: (val16: number) => { + const prefix16 = `${PATH27}/${val16}` + + return { + get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json(), + $get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send(), + $delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods40['get']['query'], config?: T }) => + fetch(prefix, PATH27, GET, option).json(), + $get: (option: { query: Methods40['get']['query'], config?: T }) => + fetch(prefix, PATH27, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + segments: { + _segment_id: (val17: number) => { + const prefix17 = `${PATH28}/${val17}` + + return { + tags: { + _id: (val18: number) => { + const prefix18 = `${prefix17}${PATH29}/${val18}` + + return { + put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send(), + $delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json(), + $get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body) + } + } + } + }, + tags: { + _id: (val19: number) => { + const prefix19 = `${PATH30}/${val19}` + + return { + get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json(), + $get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send(), + $delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods44['get']['query'], config?: T }) => + fetch(prefix, PATH30, GET, option).json(), + $get: (option: { query: Methods44['get']['query'], config?: T }) => + fetch(prefix, PATH30, GET, option).json().then(r => r.body), + post: (option: { body: Methods44['post']['reqBody'], config?: T }) => + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + taxes: { + codes: { + _code: (val20: number) => { + const prefix20 = `${PATH31}/${val20}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) + }, + companies: { + _company_id: (val21: number) => { + const prefix21 = `${PATH32}/${val21}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json().then(r => r.body) + } + } + } + }, + transfers: { + _id: (val22: number) => { + const prefix22 = `${PATH33}/${val22}` + + return { + get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json(), + $get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json().then(r => r.body), + put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send(), + $delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods49['get']['query'], config?: T }) => + fetch(prefix, PATH33, GET, option).json(), + $get: (option: { query: Methods49['get']['query'], config?: T }) => + fetch(prefix, PATH33, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + users: { + capabilities: { + get: (option: { query: Methods52['get']['query'], config?: T }) => + fetch(prefix, PATH35, GET, option).json(), + $get: (option: { query: Methods52['get']['query'], config?: T }) => + fetch(prefix, PATH35, GET, option).json().then(r => r.body) + }, + me: { + get: (option?: { query?: Methods53['get']['query'], config?: T }) => + fetch(prefix, PATH36, GET, option).json(), + $get: (option?: { query?: Methods53['get']['query'], config?: T }) => + fetch(prefix, PATH36, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body) + }, + 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) + }, + wallet_txns: { + _id: (val23: number) => { + const prefix23 = `${PATH37}/${val23}` + + return { + get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json(), + $get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json().then(r => r.body), + delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send(), + $delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods54['get']['query'], config?: T }) => + fetch(prefix, PATH37, GET, option).json(), + $get: (option: { query: Methods54['get']['query'], config?: T }) => + fetch(prefix, PATH37, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + walletables: { + _type: (val24: number | string) => { + const prefix24 = `${PATH38}/${val24}` + + return { + _id: (val25: number) => { + const prefix25 = `${prefix24}/${val25}` + + return { + get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json(), + $get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json().then(r => r.body), + put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json(), + $put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send(), + $delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send().then(r => r.body) + } + } + } + }, + get: (option: { query: Methods56['get']['query'], config?: T }) => + fetch(prefix, PATH38, GET, option).json(), + $get: (option: { query: Methods56['get']['query'], config?: T }) => + fetch(prefix, PATH38, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/$api.ts b/samples/freee/api/1/$api.ts new file mode 100644 index 00000000..a2700710 --- /dev/null +++ b/samples/freee/api/1/$api.ts @@ -0,0 +1,785 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './account_items' +import { Methods as Methods1 } from './account_items/_id@number' +import { Methods as Methods2 } from './banks' +import { Methods as Methods3 } from './banks/_id@number' +import { Methods as Methods4 } from './companies' +import { Methods as Methods5 } from './companies/_id@number' +import { Methods as Methods6 } from './deals' +import { Methods as Methods7 } from './deals/_id@number' +import { Methods as Methods8 } from './deals/_id@number/payments' +import { Methods as Methods9 } from './deals/_id@number/payments/_payment_id@number' +import { Methods as Methods10 } from './deals/_id@number/renews' +import { Methods as Methods11 } from './deals/_id@number/renews/_renew_id@number' +import { Methods as Methods12 } from './expense_application_line_templates' +import { Methods as Methods13 } from './expense_application_line_templates/_id@number' +import { Methods as Methods14 } from './expense_applications' +import { Methods as Methods15 } from './expense_applications/_id@number' +import { Methods as Methods16 } from './forms/selectables' +import { Methods as Methods17 } from './invoices' +import { Methods as Methods18 } from './invoices/_id@number' +import { Methods as Methods19 } from './items' +import { Methods as Methods20 } from './items/_id@number' +import { Methods as Methods21 } from './journals' +import { Methods as Methods22 } from './journals/reports/_id@number/download' +import { Methods as Methods23 } from './journals/reports/_id@number/status' +import { Methods as Methods24 } from './manual_journals' +import { Methods as Methods25 } from './manual_journals/_id@number' +import { Methods as Methods26 } from './partners' +import { Methods as Methods27 } from './partners/_id@number' +import { Methods as Methods28 } from './partners/code/_code@string' +import { Methods as Methods29 } from './quotations' +import { Methods as Methods30 } from './quotations/_id@number' +import { Methods as Methods31 } from './receipts' +import { Methods as Methods32 } from './receipts/_id@number' +import { Methods as Methods33 } from './reports/trial_bs' +import { Methods as Methods34 } from './reports/trial_bs_three_years' +import { Methods as Methods35 } from './reports/trial_bs_two_years' +import { Methods as Methods36 } from './reports/trial_pl' +import { Methods as Methods37 } from './reports/trial_pl_sections' +import { Methods as Methods38 } from './reports/trial_pl_three_years' +import { Methods as Methods39 } from './reports/trial_pl_two_years' +import { Methods as Methods40 } from './sections' +import { Methods as Methods41 } from './sections/_id@number' +import { Methods as Methods42 } from './segments/_segment_id@number/tags' +import { Methods as Methods43 } from './segments/_segment_id@number/tags/_id@number' +import { Methods as Methods44 } from './tags' +import { Methods as Methods45 } from './tags/_id@number' +import { Methods as Methods46 } from './taxes/codes' +import { Methods as Methods47 } from './taxes/codes/_code@number' +import { Methods as Methods48 } from './taxes/companies/_company_id@number' +import { Methods as Methods49 } from './transfers' +import { Methods as Methods50 } from './transfers/_id@number' +import { Methods as Methods51 } from './users' +import { Methods as Methods52 } from './users/capabilities' +import { Methods as Methods53 } from './users/me' +import { Methods as Methods54 } from './wallet_txns' +import { Methods as Methods55 } from './wallet_txns/_id@number' +import { Methods as Methods56 } from './walletables' +import { Methods as Methods57 } from './walletables/_type/_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/account_items' +const PATH1 = '/api/1/banks' +const PATH2 = '/api/1/companies' +const PATH3 = '/api/1/deals' +const PATH4 = '/payments' +const PATH5 = '/renews' +const PATH6 = '/api/1/expense_application_line_templates' +const PATH7 = '/api/1/expense_applications' +const PATH8 = '/api/1/forms/selectables' +const PATH9 = '/api/1/invoices' +const PATH10 = '/api/1/items' +const PATH11 = '/api/1/journals' +const PATH12 = '/api/1/journals/reports' +const PATH13 = '/download' +const PATH14 = '/status' +const PATH15 = '/api/1/manual_journals' +const PATH16 = '/api/1/partners' +const PATH17 = '/api/1/partners/code' +const PATH18 = '/api/1/quotations' +const PATH19 = '/api/1/receipts' +const PATH20 = '/api/1/reports/trial_bs' +const PATH21 = '/api/1/reports/trial_bs_three_years' +const PATH22 = '/api/1/reports/trial_bs_two_years' +const PATH23 = '/api/1/reports/trial_pl' +const PATH24 = '/api/1/reports/trial_pl_sections' +const PATH25 = '/api/1/reports/trial_pl_three_years' +const PATH26 = '/api/1/reports/trial_pl_two_years' +const PATH27 = '/api/1/sections' +const PATH28 = '/api/1/segments' +const PATH29 = '/tags' +const PATH30 = '/api/1/tags' +const PATH31 = '/api/1/taxes/codes' +const PATH32 = '/api/1/taxes/companies' +const PATH33 = '/api/1/transfers' +const PATH34 = '/api/1/users' +const PATH35 = '/api/1/users/capabilities' +const PATH36 = '/api/1/users/me' +const PATH37 = '/api/1/wallet_txns' +const PATH38 = '/api/1/walletables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + account_items: { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + banks: { + _id: (val1: number) => { + const prefix1 = `${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + companies: { + _id: (val2: number) => { + const prefix2 = `${PATH2}/${val2}` + + return { + get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + deals: { + _id: (val3: number) => { + const prefix3 = `${PATH3}/${val3}` + + return { + payments: { + _payment_id: (val4: number) => { + const prefix4 = `${prefix3}${PATH4}/${val4}` + + return { + put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods9['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send(), + $delete: (option: { query: Methods9['delete']['query'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH4}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + renews: { + _renew_id: (val5: number) => { + const prefix5 = `${prefix3}${PATH5}/${val5}` + + return { + put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods11['put']['reqBody'], config?: T }) => + fetch(prefix, prefix5, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json(), + $delete: (option: { query: Methods11['delete']['query'], config?: T }) => + fetch(prefix, prefix5, DELETE, option).json().then(r => r.body) + } + }, + post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix3}${PATH5}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json(), + $get: (option: { query: Methods7['get']['query'], config?: T }) => + fetch(prefix, prefix3, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods7['put']['reqBody'], config?: T }) => + fetch(prefix, prefix3, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send(), + $delete: (option: { query: Methods7['delete']['query'], config?: T }) => + fetch(prefix, prefix3, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json(), + $get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + expense_application_line_templates: { + _id: (val6: number) => { + const prefix6 = `${PATH6}/${val6}` + + return { + get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json(), + $get: (option: { query: Methods13['get']['query'], config?: T }) => + fetch(prefix, prefix6, GET, option).json().then(r => r.body), + put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods13['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send(), + $delete: (option: { query: Methods13['delete']['query'], config?: T }) => + fetch(prefix, prefix6, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods12['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json(), + $get: (option: { query: Methods12['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json().then(r => r.body), + post: (option: { body: Methods12['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods12['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + expense_applications: { + _id: (val7: number) => { + const prefix7 = `${PATH7}/${val7}` + + return { + get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option: { query: Methods15['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix7, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send(), + $delete: (option: { query: Methods15['delete']['query'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH7, GET, option).json(), + $get: (option: { query: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH7, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods14['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + forms: { + selectables: { + get: (option: { query: Methods16['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).json(), + $get: (option: { query: Methods16['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).json().then(r => r.body) + } + }, + invoices: { + _id: (val8: number) => { + const prefix8 = `${PATH9}/${val8}` + + return { + get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json(), + $get: (option: { query: Methods18['get']['query'], config?: T }) => + fetch(prefix, prefix8, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods18['put']['reqBody'], config?: T }) => + fetch(prefix, prefix8, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send(), + $delete: (option: { query: Methods18['delete']['query'], config?: T }) => + fetch(prefix, prefix8, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods17['get']['query'], config?: T }) => + fetch(prefix, PATH9, GET, option).json(), + $get: (option: { query: Methods17['get']['query'], config?: T }) => + fetch(prefix, PATH9, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods17['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + items: { + _id: (val9: number) => { + const prefix9 = `${PATH10}/${val9}` + + return { + get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json(), + $get: (option: { query: Methods20['get']['query'], config?: T }) => + fetch(prefix, prefix9, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix9, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send(), + $delete: (option: { query: Methods20['delete']['query'], config?: T }) => + fetch(prefix, prefix9, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods19['get']['query'], config?: T }) => + fetch(prefix, PATH10, GET, option).json(), + $get: (option: { query: Methods19['get']['query'], config?: T }) => + fetch(prefix, PATH10, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + journals: { + reports: { + _id: (val10: number) => { + const prefix10 = `${PATH12}/${val10}` + + return { + download: { + get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send(), + $get: (option: { query: Methods22['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, GET, option).send().then(r => r.body) + }, + status: { + get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json(), + $get: (option: { query: Methods23['get']['query'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, GET, option).json().then(r => r.body) + } + } + } + }, + get: (option: { query: Methods21['get']['query'], config?: T }) => + fetch(prefix, PATH11, GET, option).json(), + $get: (option: { query: Methods21['get']['query'], config?: T }) => + fetch(prefix, PATH11, GET, option).json().then(r => r.body) + }, + manual_journals: { + _id: (val11: number) => { + const prefix11 = `${PATH15}/${val11}` + + return { + get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json(), + $get: (option: { query: Methods25['get']['query'], config?: T }) => + fetch(prefix, prefix11, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods25['put']['reqBody'], config?: T }) => + fetch(prefix, prefix11, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send(), + $delete: (option: { query: Methods25['delete']['query'], config?: T }) => + fetch(prefix, prefix11, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods24['get']['query'], config?: T }) => + fetch(prefix, PATH15, GET, option).json(), + $get: (option: { query: Methods24['get']['query'], config?: T }) => + fetch(prefix, PATH15, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods24['post']['reqBody'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + partners: { + _id: (val12: number) => { + const prefix12 = `${PATH16}/${val12}` + + return { + get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json(), + $get: (option: { query: Methods27['get']['query'], config?: T }) => + fetch(prefix, prefix12, GET, option).json().then(r => r.body), + put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods27['put']['reqBody'], config?: T }) => + fetch(prefix, prefix12, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send(), + $delete: (option: { query: Methods27['delete']['query'], config?: T }) => + fetch(prefix, prefix12, DELETE, option).send().then(r => r.body) + } + }, + code: { + _code: (val13: string) => { + const prefix13 = `${PATH17}/${val13}` + + return { + put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods28['put']['reqBody'], config?: T }) => + fetch(prefix, prefix13, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + } + }, + get: (option: { query: Methods26['get']['query'], config?: T }) => + fetch(prefix, PATH16, GET, option).json(), + $get: (option: { query: Methods26['get']['query'], config?: T }) => + fetch(prefix, PATH16, GET, option).json().then(r => r.body), + post: (option: { body: Methods26['post']['reqBody'], config?: T }) => + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods26['post']['reqBody'], config?: T }) => + fetch(prefix, PATH16, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + quotations: { + _id: (val14: number) => { + const prefix14 = `${PATH18}/${val14}` + + return { + get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json(), + $get: (option: { query: Methods30['get']['query'], config?: T }) => + fetch(prefix, prefix14, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods30['put']['reqBody'], config?: T }) => + fetch(prefix, prefix14, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send(), + $delete: (option: { query: Methods30['delete']['query'], config?: T }) => + fetch(prefix, prefix14, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods29['get']['query'], config?: T }) => + fetch(prefix, PATH18, GET, option).json(), + $get: (option: { query: Methods29['get']['query'], config?: T }) => + fetch(prefix, PATH18, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods29['post']['reqBody'], config?: T }) => + fetch(prefix, PATH18, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + receipts: { + _id: (val15: number) => { + const prefix15 = `${PATH19}/${val15}` + + return { + get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json(), + $get: (option: { query: Methods32['get']['query'], config?: T }) => + fetch(prefix, prefix15, GET, option).json().then(r => r.body), + put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods32['put']['reqBody'], config?: T }) => + fetch(prefix, prefix15, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send(), + $delete: (option: { query: Methods32['delete']['query'], config?: T }) => + fetch(prefix, prefix15, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods31['get']['query'], config?: T }) => + fetch(prefix, PATH19, GET, option).json(), + $get: (option: { query: Methods31['get']['query'], config?: T }) => + fetch(prefix, PATH19, GET, option).json().then(r => r.body), + post: (option: { body: Methods31['post']['reqBody'], config?: T }) => + fetch(prefix, PATH19, POST, option, 'FormData').json(), + $post: (option: { body: Methods31['post']['reqBody'], config?: T }) => + fetch(prefix, PATH19, POST, option, 'FormData').json().then(r => r.body) + }, + reports: { + trial_bs: { + get: (option: { query: Methods33['get']['query'], config?: T }) => + fetch(prefix, PATH20, GET, option).json(), + $get: (option: { query: Methods33['get']['query'], config?: T }) => + fetch(prefix, PATH20, GET, option).json().then(r => r.body) + }, + trial_bs_three_years: { + get: (option: { query: Methods34['get']['query'], config?: T }) => + fetch(prefix, PATH21, GET, option).json(), + $get: (option: { query: Methods34['get']['query'], config?: T }) => + fetch(prefix, PATH21, GET, option).json().then(r => r.body) + }, + trial_bs_two_years: { + get: (option: { query: Methods35['get']['query'], config?: T }) => + fetch(prefix, PATH22, GET, option).json(), + $get: (option: { query: Methods35['get']['query'], config?: T }) => + fetch(prefix, PATH22, GET, option).json().then(r => r.body) + }, + trial_pl: { + get: (option: { query: Methods36['get']['query'], config?: T }) => + fetch(prefix, PATH23, GET, option).json(), + $get: (option: { query: Methods36['get']['query'], config?: T }) => + fetch(prefix, PATH23, GET, option).json().then(r => r.body) + }, + trial_pl_sections: { + get: (option: { query: Methods37['get']['query'], config?: T }) => + fetch(prefix, PATH24, GET, option).json(), + $get: (option: { query: Methods37['get']['query'], config?: T }) => + fetch(prefix, PATH24, GET, option).json().then(r => r.body) + }, + trial_pl_three_years: { + get: (option: { query: Methods38['get']['query'], config?: T }) => + fetch(prefix, PATH25, GET, option).json(), + $get: (option: { query: Methods38['get']['query'], config?: T }) => + fetch(prefix, PATH25, GET, option).json().then(r => r.body) + }, + trial_pl_two_years: { + get: (option: { query: Methods39['get']['query'], config?: T }) => + fetch(prefix, PATH26, GET, option).json(), + $get: (option: { query: Methods39['get']['query'], config?: T }) => + fetch(prefix, PATH26, GET, option).json().then(r => r.body) + } + }, + sections: { + _id: (val16: number) => { + const prefix16 = `${PATH27}/${val16}` + + return { + get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json(), + $get: (option: { query: Methods41['get']['query'], config?: T }) => + fetch(prefix, prefix16, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods41['put']['reqBody'], config?: T }) => + fetch(prefix, prefix16, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send(), + $delete: (option: { query: Methods41['delete']['query'], config?: T }) => + fetch(prefix, prefix16, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods40['get']['query'], config?: T }) => + fetch(prefix, PATH27, GET, option).json(), + $get: (option: { query: Methods40['get']['query'], config?: T }) => + fetch(prefix, PATH27, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods40['post']['reqBody'], config?: T }) => + fetch(prefix, PATH27, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + segments: { + _segment_id: (val17: number) => { + const prefix17 = `${PATH28}/${val17}` + + return { + tags: { + _id: (val18: number) => { + const prefix18 = `${prefix17}${PATH29}/${val18}` + + return { + put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods43['put']['reqBody'], config?: T }) => + fetch(prefix, prefix18, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send(), + $delete: (option: { query: Methods43['delete']['query'], config?: T }) => + fetch(prefix, prefix18, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json(), + $get: (option: { query: Methods42['get']['query'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods42['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix17}${PATH29}`, POST, option, 'URLSearchParams').json().then(r => r.body) + } + } + } + }, + tags: { + _id: (val19: number) => { + const prefix19 = `${PATH30}/${val19}` + + return { + get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json(), + $get: (option: { query: Methods45['get']['query'], config?: T }) => + fetch(prefix, prefix19, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods45['put']['reqBody'], config?: T }) => + fetch(prefix, prefix19, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send(), + $delete: (option: { query: Methods45['delete']['query'], config?: T }) => + fetch(prefix, prefix19, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods44['get']['query'], config?: T }) => + fetch(prefix, PATH30, GET, option).json(), + $get: (option: { query: Methods44['get']['query'], config?: T }) => + fetch(prefix, PATH30, GET, option).json().then(r => r.body), + post: (option: { body: Methods44['post']['reqBody'], config?: T }) => + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods44['post']['reqBody'], config?: T }) => + fetch(prefix, PATH30, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + taxes: { + codes: { + _code: (val20: number) => { + const prefix20 = `${PATH31}/${val20}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix20, GET, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) + }, + companies: { + _company_id: (val21: number) => { + const prefix21 = `${PATH32}/${val21}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix21, GET, option).json().then(r => r.body) + } + } + } + }, + transfers: { + _id: (val22: number) => { + const prefix22 = `${PATH33}/${val22}` + + return { + get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json(), + $get: (option: { query: Methods50['get']['query'], config?: T }) => + fetch(prefix, prefix22, GET, option).json().then(r => r.body), + put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods50['put']['reqBody'], config?: T }) => + fetch(prefix, prefix22, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send(), + $delete: (option: { query: Methods50['delete']['query'], config?: T }) => + fetch(prefix, prefix22, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods49['get']['query'], config?: T }) => + fetch(prefix, PATH33, GET, option).json(), + $get: (option: { query: Methods49['get']['query'], config?: T }) => + fetch(prefix, PATH33, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods49['post']['reqBody'], config?: T }) => + fetch(prefix, PATH33, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + users: { + capabilities: { + get: (option: { query: Methods52['get']['query'], config?: T }) => + fetch(prefix, PATH35, GET, option).json(), + $get: (option: { query: Methods52['get']['query'], config?: T }) => + fetch(prefix, PATH35, GET, option).json().then(r => r.body) + }, + me: { + get: (option?: { query?: Methods53['get']['query'], config?: T }) => + fetch(prefix, PATH36, GET, option).json(), + $get: (option?: { query?: Methods53['get']['query'], config?: T }) => + fetch(prefix, PATH36, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods53['put']['reqBody'], config?: T }) => + fetch(prefix, PATH36, PUT, option, 'URLSearchParams').json().then(r => r.body) + }, + 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) + }, + wallet_txns: { + _id: (val23: number) => { + const prefix23 = `${PATH37}/${val23}` + + return { + get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json(), + $get: (option: { query: Methods55['get']['query'], config?: T }) => + fetch(prefix, prefix23, GET, option).json().then(r => r.body), + delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send(), + $delete: (option: { query: Methods55['delete']['query'], config?: T }) => + fetch(prefix, prefix23, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods54['get']['query'], config?: T }) => + fetch(prefix, PATH37, GET, option).json(), + $get: (option: { query: Methods54['get']['query'], config?: T }) => + fetch(prefix, PATH37, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods54['post']['reqBody'], config?: T }) => + fetch(prefix, PATH37, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + walletables: { + _type: (val24: number | string) => { + const prefix24 = `${PATH38}/${val24}` + + return { + _id: (val25: number) => { + const prefix25 = `${prefix24}/${val25}` + + return { + get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json(), + $get: (option: { query: Methods57['get']['query'], config?: T }) => + fetch(prefix, prefix25, GET, option).json().then(r => r.body), + put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json(), + $put: (option: { body?: Methods57['put']['reqBody'], query: Methods57['put']['query'], config?: T }) => + fetch(prefix, prefix25, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send(), + $delete: (option: { query: Methods57['delete']['query'], config?: T }) => + fetch(prefix, prefix25, DELETE, option).send().then(r => r.body) + } + } + } + }, + get: (option: { query: Methods56['get']['query'], config?: T }) => + fetch(prefix, PATH38, GET, option).json(), + $get: (option: { query: Methods56['get']['query'], config?: T }) => + fetch(prefix, PATH38, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods56['post']['reqBody'], config?: T }) => + fetch(prefix, PATH38, POST, option, 'URLSearchParams').json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/account_items/$api.ts b/samples/freee/api/1/account_items/$api.ts new file mode 100644 index 00000000..a961daf0 --- /dev/null +++ b/samples/freee/api/1/account_items/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/account_items' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/banks/$api.ts b/samples/freee/api/1/banks/$api.ts new file mode 100644 index 00000000..c66c1993 --- /dev/null +++ b/samples/freee/api/1/banks/$api.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const PATH0 = '/api/1/banks' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/companies/$api.ts b/samples/freee/api/1/companies/$api.ts new file mode 100644 index 00000000..69dda8bb --- /dev/null +++ b/samples/freee/api/1/companies/$api.ts @@ -0,0 +1,35 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const PUT = 'PUT' +const PATH0 = '/api/1/companies' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { query?: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { query?: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/deals/$api.ts b/samples/freee/api/1/deals/$api.ts new file mode 100644 index 00000000..1c81cd7f --- /dev/null +++ b/samples/freee/api/1/deals/$api.ts @@ -0,0 +1,91 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' +import { Methods as Methods2 } from './_id@number/payments' +import { Methods as Methods3 } from './_id@number/payments/_payment_id@number' +import { Methods as Methods4 } from './_id@number/renews' +import { Methods as Methods5 } from './_id@number/renews/_renew_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/deals' +const PATH1 = '/payments' +const PATH2 = '/renews' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + payments: { + _payment_id: (val1: number) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + put: (option: { body: Methods3['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods3['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods3['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send(), + $delete: (option: { query: Methods3['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + renews: { + _renew_id: (val2: number) => { + const prefix2 = `${prefix0}${PATH2}/${val2}` + + return { + put: (option: { body: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods5['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods5['delete']['query'], config?: T }) => + fetch(prefix, prefix2, DELETE, option).json(), + $delete: (option: { query: Methods5['delete']['query'], config?: T }) => + fetch(prefix, prefix2, DELETE, option).json().then(r => r.body) + } + }, + post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option, 'URLSearchParams').json().then(r => r.body) + }, + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/expense_application_line_templates/$api.ts b/samples/freee/api/1/expense_application_line_templates/$api.ts new file mode 100644 index 00000000..bc5482e3 --- /dev/null +++ b/samples/freee/api/1/expense_application_line_templates/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/expense_application_line_templates' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/expense_applications/$api.ts b/samples/freee/api/1/expense_applications/$api.ts new file mode 100644 index 00000000..940564f5 --- /dev/null +++ b/samples/freee/api/1/expense_applications/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/expense_applications' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/forms/$api.ts b/samples/freee/api/1/forms/$api.ts new file mode 100644 index 00000000..1bb26bb6 --- /dev/null +++ b/samples/freee/api/1/forms/$api.ts @@ -0,0 +1,21 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './selectables' + +const GET = 'GET' +const PATH0 = '/api/1/forms/selectables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + selectables: { + 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) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/forms/selectables/$api.ts b/samples/freee/api/1/forms/selectables/$api.ts new file mode 100644 index 00000000..0a53d8b6 --- /dev/null +++ b/samples/freee/api/1/forms/selectables/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/forms/selectables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/invoices/$api.ts b/samples/freee/api/1/invoices/$api.ts new file mode 100644 index 00000000..add667ee --- /dev/null +++ b/samples/freee/api/1/invoices/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/invoices' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/items/$api.ts b/samples/freee/api/1/items/$api.ts new file mode 100644 index 00000000..e7930782 --- /dev/null +++ b/samples/freee/api/1/items/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/items' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/journals/$api.ts b/samples/freee/api/1/journals/$api.ts new file mode 100644 index 00000000..6e7b9c99 --- /dev/null +++ b/samples/freee/api/1/journals/$api.ts @@ -0,0 +1,44 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './reports/_id@number/download' +import { Methods as Methods2 } from './reports/_id@number/status' + +const GET = 'GET' +const PATH0 = '/api/1/journals' +const PATH1 = '/api/1/journals/reports' +const PATH2 = '/download' +const PATH3 = '/status' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + reports: { + _id: (val0: number) => { + const prefix0 = `${PATH1}/${val0}` + + return { + download: { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).send(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).send().then(r => r.body) + }, + status: { + get: (option: { query: Methods2['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, GET, option).json(), + $get: (option: { query: Methods2['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, GET, option).json().then(r => r.body) + } + } + } + }, + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/journals/reports/$api.ts b/samples/freee/api/1/journals/reports/$api.ts new file mode 100644 index 00000000..3a282c82 --- /dev/null +++ b/samples/freee/api/1/journals/reports/$api.ts @@ -0,0 +1,36 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@number/download' +import { Methods as Methods1 } from './_id@number/status' + +const GET = 'GET' +const PATH0 = '/api/1/journals/reports' +const PATH1 = '/download' +const PATH2 = '/status' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + download: { + get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).send(), + $get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).send().then(r => r.body) + }, + status: { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).json().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/manual_journals/$api.ts b/samples/freee/api/1/manual_journals/$api.ts new file mode 100644 index 00000000..8f300e9b --- /dev/null +++ b/samples/freee/api/1/manual_journals/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/manual_journals' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/partners/$api.ts b/samples/freee/api/1/partners/$api.ts new file mode 100644 index 00000000..50c5b3bb --- /dev/null +++ b/samples/freee/api/1/partners/$api.ts @@ -0,0 +1,59 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' +import { Methods as Methods2 } from './code/_code@string' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/partners' +const PATH1 = '/api/1/partners/code' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + code: { + _code: (val1: string) => { + const prefix1 = `${PATH1}/${val1}` + + return { + put: (option: { body: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/partners/code/$api.ts b/samples/freee/api/1/partners/code/$api.ts new file mode 100644 index 00000000..b334361a --- /dev/null +++ b/samples/freee/api/1/partners/code/$api.ts @@ -0,0 +1,25 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_code@string' + +const PUT = 'PUT' +const PATH0 = '/api/1/partners/code' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _code: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + put: (option: { body: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/quotations/$api.ts b/samples/freee/api/1/quotations/$api.ts new file mode 100644 index 00000000..91fdf40d --- /dev/null +++ b/samples/freee/api/1/quotations/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/quotations' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/receipts/$api.ts b/samples/freee/api/1/receipts/$api.ts new file mode 100644 index 00000000..a697d7a9 --- /dev/null +++ b/samples/freee/api/1/receipts/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/receipts' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/reports/$api.ts b/samples/freee/api/1/reports/$api.ts new file mode 100644 index 00000000..37266b89 --- /dev/null +++ b/samples/freee/api/1/reports/$api.ts @@ -0,0 +1,69 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './trial_bs' +import { Methods as Methods1 } from './trial_bs_three_years' +import { Methods as Methods2 } from './trial_bs_two_years' +import { Methods as Methods3 } from './trial_pl' +import { Methods as Methods4 } from './trial_pl_sections' +import { Methods as Methods5 } from './trial_pl_three_years' +import { Methods as Methods6 } from './trial_pl_two_years' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_bs' +const PATH1 = '/api/1/reports/trial_bs_three_years' +const PATH2 = '/api/1/reports/trial_bs_two_years' +const PATH3 = '/api/1/reports/trial_pl' +const PATH4 = '/api/1/reports/trial_pl_sections' +const PATH5 = '/api/1/reports/trial_pl_three_years' +const PATH6 = '/api/1/reports/trial_pl_two_years' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + trial_bs: { + 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) + }, + trial_bs_three_years: { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + trial_bs_two_years: { + get: (option: { query: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option: { query: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + trial_pl: { + get: (option: { query: Methods3['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json(), + $get: (option: { query: Methods3['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).json().then(r => r.body) + }, + trial_pl_sections: { + get: (option: { query: Methods4['get']['query'], config?: T }) => + fetch(prefix, PATH4, GET, option).json(), + $get: (option: { query: Methods4['get']['query'], config?: T }) => + fetch(prefix, PATH4, GET, option).json().then(r => r.body) + }, + trial_pl_three_years: { + get: (option: { query: Methods5['get']['query'], config?: T }) => + fetch(prefix, PATH5, GET, option).json(), + $get: (option: { query: Methods5['get']['query'], config?: T }) => + fetch(prefix, PATH5, GET, option).json().then(r => r.body) + }, + trial_pl_two_years: { + get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json(), + $get: (option: { query: Methods6['get']['query'], config?: T }) => + fetch(prefix, PATH6, GET, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/reports/trial_bs/$api.ts b/samples/freee/api/1/reports/trial_bs/$api.ts new file mode 100644 index 00000000..d76e4438 --- /dev/null +++ b/samples/freee/api/1/reports/trial_bs/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_bs' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api 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 new file mode 100644 index 00000000..583d20ab --- /dev/null +++ b/samples/freee/api/1/reports/trial_bs_three_years/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_bs_three_years' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api 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 new file mode 100644 index 00000000..fa9e884c --- /dev/null +++ b/samples/freee/api/1/reports/trial_bs_two_years/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_bs_two_years' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/reports/trial_pl/$api.ts b/samples/freee/api/1/reports/trial_pl/$api.ts new file mode 100644 index 00000000..677d51a7 --- /dev/null +++ b/samples/freee/api/1/reports/trial_pl/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_pl' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/reports/trial_pl_sections/$api.ts b/samples/freee/api/1/reports/trial_pl_sections/$api.ts new file mode 100644 index 00000000..96bb3b36 --- /dev/null +++ b/samples/freee/api/1/reports/trial_pl_sections/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_pl_sections' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api 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 new file mode 100644 index 00000000..67dc8ce8 --- /dev/null +++ b/samples/freee/api/1/reports/trial_pl_three_years/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_pl_three_years' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api 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 new file mode 100644 index 00000000..905f3d82 --- /dev/null +++ b/samples/freee/api/1/reports/trial_pl_two_years/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/reports/trial_pl_two_years' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/sections/$api.ts b/samples/freee/api/1/sections/$api.ts new file mode 100644 index 00000000..1552a544 --- /dev/null +++ b/samples/freee/api/1/sections/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/sections' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/segments/$api.ts b/samples/freee/api/1/segments/$api.ts new file mode 100644 index 00000000..18af6529 --- /dev/null +++ b/samples/freee/api/1/segments/$api.ts @@ -0,0 +1,50 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_segment_id@number/tags' +import { Methods as Methods1 } from './_segment_id@number/tags/_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/segments' +const PATH1 = '/tags' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _segment_id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + tags: { + _id: (val1: number) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send().then(r => r.body) + } + }, + get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'URLSearchParams').json().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/tags/$api.ts b/samples/freee/api/1/tags/$api.ts new file mode 100644 index 00000000..b9ec1e35 --- /dev/null +++ b/samples/freee/api/1/tags/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/tags' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/taxes/$api.ts b/samples/freee/api/1/taxes/$api.ts new file mode 100644 index 00000000..7e69e84d --- /dev/null +++ b/samples/freee/api/1/taxes/$api.ts @@ -0,0 +1,46 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './codes' +import { Methods as Methods1 } from './codes/_code@number' +import { Methods as Methods2 } from './companies/_company_id@number' + +const GET = 'GET' +const PATH0 = '/api/1/taxes/codes' +const PATH1 = '/api/1/taxes/companies' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + codes: { + _code: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + }, + companies: { + _company_id: (val1: number) => { + const prefix1 = `${PATH1}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/taxes/codes/$api.ts b/samples/freee/api/1/taxes/codes/$api.ts new file mode 100644 index 00000000..bf577476 --- /dev/null +++ b/samples/freee/api/1/taxes/codes/$api.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_code@number' + +const GET = 'GET' +const PATH0 = '/api/1/taxes/codes' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _code: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/taxes/companies/$api.ts b/samples/freee/api/1/taxes/companies/$api.ts new file mode 100644 index 00000000..1e0e161d --- /dev/null +++ b/samples/freee/api/1/taxes/companies/$api.ts @@ -0,0 +1,25 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_company_id@number' + +const GET = 'GET' +const PATH0 = '/api/1/taxes/companies' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _company_id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/transfers/$api.ts b/samples/freee/api/1/transfers/$api.ts new file mode 100644 index 00000000..24416c7b --- /dev/null +++ b/samples/freee/api/1/transfers/$api.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/transfers' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], 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, 'URLSearchParams').json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/users/$api.ts b/samples/freee/api/1/users/$api.ts new file mode 100644 index 00000000..7f8190d3 --- /dev/null +++ b/samples/freee/api/1/users/$api.ts @@ -0,0 +1,40 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './capabilities' +import { Methods as Methods2 } from './me' + +const GET = 'GET' +const PUT = 'PUT' +const PATH0 = '/api/1/users' +const PATH1 = '/api/1/users/capabilities' +const PATH2 = '/api/1/users/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + capabilities: { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + me: { + get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { query?: Methods2['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body), + put: (option?: { body?: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, PATH2, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, PATH2, PUT, option, 'URLSearchParams').json().then(r => r.body) + }, + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/users/capabilities/$api.ts b/samples/freee/api/1/users/capabilities/$api.ts new file mode 100644 index 00000000..2323f061 --- /dev/null +++ b/samples/freee/api/1/users/capabilities/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/1/users/capabilities' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/users/me/$api.ts b/samples/freee/api/1/users/me/$api.ts new file mode 100644 index 00000000..83975deb --- /dev/null +++ b/samples/freee/api/1/users/me/$api.ts @@ -0,0 +1,24 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PUT = 'PUT' +const PATH0 = '/api/1/users/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + 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), + put: (option?: { body?: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, PATH0, PUT, option, 'URLSearchParams').json(), + $put: (option?: { body?: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, PATH0, PUT, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/wallet_txns/$api.ts b/samples/freee/api/1/wallet_txns/$api.ts new file mode 100644 index 00000000..8c88e602 --- /dev/null +++ b/samples/freee/api/1/wallet_txns/$api.ts @@ -0,0 +1,40 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@number' + +const GET = 'GET' +const POST = 'POST' +const DELETE = 'DELETE' +const PATH0 = '/api/1/wallet_txns' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/freee/api/1/walletables/$api.ts b/samples/freee/api/1/walletables/$api.ts new file mode 100644 index 00000000..5394b6cc --- /dev/null +++ b/samples/freee/api/1/walletables/$api.ts @@ -0,0 +1,51 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_type/_id@number' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/1/walletables' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://api.freee.co.jp' : baseURL).replace(/\/$/, '') + + return { + _type: (val0: number | string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + _id: (val1: number) => { + const prefix1 = `${prefix0}/${val1}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body), + put: (option: { body?: Methods1['put']['reqBody'], query: Methods1['put']['query'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json(), + $put: (option: { body?: Methods1['put']['reqBody'], query: Methods1['put']['query'], config?: T }) => + fetch(prefix, prefix1, PUT, option, 'URLSearchParams').json().then(r => r.body), + delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send(), + $delete: (option: { query: Methods1['delete']['query'], config?: T }) => + fetch(prefix, prefix1, DELETE, option).send().then(r => r.body) + } + } + } + }, + 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), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'URLSearchParams').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/$api.ts b/samples/openapi/$api.ts index d2d4f9a6..86a30b34 100644 --- a/samples/openapi/$api.ts +++ b/samples/openapi/$api.ts @@ -1,443 +1,548 @@ /* eslint-disable */ import { AspidaClient, BasicHeaders } from 'aspida' -import { Methods as Methods0 } from './api/stream/v1/stories/index' -import { Methods as Methods1 } from './api/stream/v1/stories/_storyId@number/index' -import { Methods as Methods2 } from './api/v1/me/index' -import { Methods as Methods3 } from './api/v1/mixes/index' -import { Methods as Methods4 } from './api/v1/mixes/_id@string/index' -import { Methods as Methods5 } from './api/v1/mixes/_mixId@string/cards/index' -import { Methods as Methods6 } from './api/v1/mixes/_mixId@string/url/index' -import { Methods as Methods7 } from './api/v1/parse/index' -import { Methods as Methods8 } from './api/v1/parse/image/index' -import { Methods as Methods9 } from './api/v1/token/index' -import { Methods as Methods10 } from './api/v3/2fa/index' -import { Methods as Methods11 } from './api/v3/channels/index' -import { Methods as Methods12 } from './api/v3/channels/_channelId@number/chats/_chatId@number/items/_itemId@number/index' -import { Methods as Methods13 } from './api/v3/channels/_channelId@number/news-feed/index' -import { Methods as Methods14 } from './api/v3/channels/_channelId@string/index' -import { Methods as Methods15 } from './api/v3/channels/_channelId@string/chats/index' -import { Methods as Methods16 } from './api/v3/channels/_channelId@string/chats/_chatId@string/index' -import { Methods as Methods17 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/index' -import { Methods as Methods18 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/audio/index' -import { Methods as Methods19 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/image/index' -import { Methods as Methods20 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/video/index' -import { Methods as Methods21 } from './api/v3/channels/_channelId@string/chats/_chatId@string/itemslist/index' -import { Methods as Methods22 } from './api/v3/channels/_channelId@string/chats/_chatId@string/users/index' -import { Methods as Methods23 } from './api/v3/channels/_channelId@string/chats/_chatId@string/users/remove/index' -import { Methods as Methods24 } from './api/v3/channels/_channelId@string/notifications/index' -import { Methods as Methods25 } from './api/v3/chats/_chatId@number/items/_itemId@number/index' -import { Methods as Methods26 } from './api/v3/chats/_chatId@string/items/index' -import { Methods as Methods27 } from './api/v3/chats/_chatId@string/items/audio/index' -import { Methods as Methods28 } from './api/v3/chats/_chatId@string/items/image/index' -import { Methods as Methods29 } from './api/v3/chats/_chatId@string/items/video/index' -import { Methods as Methods30 } from './api/v3/chats/keys/index' -import { Methods as Methods31 } from './api/v3/extension/audio/index' -import { Methods as Methods32 } from './api/v3/extension/image/index' -import { Methods as Methods33 } from './api/v3/extension/parse/index' -import { Methods as Methods34 } from './api/v3/extension/story/_storyId@string/index' -import { Methods as Methods35 } from './api/v3/extension/story/_storyId@string/audio/index' -import { Methods as Methods36 } from './api/v3/extension/story/_storyId@string/image/index' -import { Methods as Methods37 } from './api/v3/extension/story/_storyId@string/video/index' -import { Methods as Methods38 } from './api/v3/extension/video/index' -import { Methods as Methods39 } from './api/v3/fcm_token/index' -import { Methods as Methods40 } from './api/v3/info/index' -import { Methods as Methods41 } from './api/v3/login/index' -import { Methods as Methods42 } from './api/v3/logout/index' -import { Methods as Methods43 } from './api/v3/me/index' -import { Methods as Methods44 } from './api/v3/organisation/index' -import { Methods as Methods45 } from './api/v3/organisation/users/index' -import { Methods as Methods46 } from './api/v3/stories/_storyId@number/items/index' -import { Methods as Methods47 } from './api/v3/stories/_storyId@number/items/_itemId@number/index' -import { Methods as Methods48 } from './api/v3/stories/_storyId@number/items/_itemId@number/reaction/index' -import { Methods as Methods49 } from './api/v3/user/index' -import { Methods as Methods50 } from './api/v3/user/_userId@string/index' -import { Methods as Methods51 } from './api/v3/user/profile/index' +import { Methods as Methods0 } from './api/stream/v1/stories' +import { Methods as Methods1 } from './api/stream/v1/stories/_storyId@number' +import { Methods as Methods2 } from './api/v1/me' +import { Methods as Methods3 } from './api/v1/mixes' +import { Methods as Methods4 } from './api/v1/mixes/_id@string' +import { Methods as Methods5 } from './api/v1/mixes/_mixId@string/cards' +import { Methods as Methods6 } from './api/v1/mixes/_mixId@string/url' +import { Methods as Methods7 } from './api/v1/parse' +import { Methods as Methods8 } from './api/v1/parse/image' +import { Methods as Methods9 } from './api/v1/token' +import { Methods as Methods10 } from './api/v3/2fa' +import { Methods as Methods11 } from './api/v3/channels' +import { Methods as Methods12 } from './api/v3/channels/_channelId@number/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods13 } from './api/v3/channels/_channelId@number/news-feed' +import { Methods as Methods14 } from './api/v3/channels/_channelId@string' +import { Methods as Methods15 } from './api/v3/channels/_channelId@string/chats' +import { Methods as Methods16 } from './api/v3/channels/_channelId@string/chats/_chatId@string' +import { Methods as Methods17 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items' +import { Methods as Methods18 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/audio' +import { Methods as Methods19 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/image' +import { Methods as Methods20 } from './api/v3/channels/_channelId@string/chats/_chatId@string/items/video' +import { Methods as Methods21 } from './api/v3/channels/_channelId@string/chats/_chatId@string/itemslist' +import { Methods as Methods22 } from './api/v3/channels/_channelId@string/chats/_chatId@string/users' +import { Methods as Methods23 } from './api/v3/channels/_channelId@string/chats/_chatId@string/users/remove' +import { Methods as Methods24 } from './api/v3/channels/_channelId@string/notifications' +import { Methods as Methods25 } from './api/v3/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods26 } from './api/v3/chats/_chatId@string/items' +import { Methods as Methods27 } from './api/v3/chats/_chatId@string/items/audio' +import { Methods as Methods28 } from './api/v3/chats/_chatId@string/items/image' +import { Methods as Methods29 } from './api/v3/chats/_chatId@string/items/video' +import { Methods as Methods30 } from './api/v3/chats/keys' +import { Methods as Methods31 } from './api/v3/extension/audio' +import { Methods as Methods32 } from './api/v3/extension/image' +import { Methods as Methods33 } from './api/v3/extension/parse' +import { Methods as Methods34 } from './api/v3/extension/story/_storyId@string' +import { Methods as Methods35 } from './api/v3/extension/story/_storyId@string/audio' +import { Methods as Methods36 } from './api/v3/extension/story/_storyId@string/image' +import { Methods as Methods37 } from './api/v3/extension/story/_storyId@string/video' +import { Methods as Methods38 } from './api/v3/extension/video' +import { Methods as Methods39 } from './api/v3/fcm_token' +import { Methods as Methods40 } from './api/v3/info' +import { Methods as Methods41 } from './api/v3/login' +import { Methods as Methods42 } from './api/v3/logout' +import { Methods as Methods43 } from './api/v3/me' +import { Methods as Methods44 } from './api/v3/organisation' +import { Methods as Methods45 } from './api/v3/organisation/users' +import { Methods as Methods46 } from './api/v3/stories/_storyId@number/items' +import { Methods as Methods47 } from './api/v3/stories/_storyId@number/items/_itemId@number' +import { Methods as Methods48 } from './api/v3/stories/_storyId@number/items/_itemId@number/reaction' +import { Methods as Methods49 } from './api/v3/user' +import { Methods as Methods50 } from './api/v3/user/_userId@string' +import { Methods as Methods51 } from './api/v3/user/profile' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? '' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/stream/v1/stories' +const PATH1 = '/api/v1/me' +const PATH2 = '/api/v1/mixes' +const PATH3 = '/cards' +const PATH4 = '/url' +const PATH5 = '/api/v1/parse' +const PATH6 = '/api/v1/parse/image' +const PATH7 = '/api/v1/token' +const PATH8 = '/api/v3/2fa' +const PATH9 = '/api/v3/channels' +const PATH10 = '/chats' +const PATH11 = '/items' +const PATH12 = '/news-feed' +const PATH13 = '/items/audio' +const PATH14 = '/items/image' +const PATH15 = '/items/video' +const PATH16 = '/itemslist' +const PATH17 = '/users' +const PATH18 = '/users/remove' +const PATH19 = '/notifications' +const PATH20 = '/api/v3/chats' +const PATH21 = '/api/v3/chats/keys' +const PATH22 = '/api/v3/extension/audio' +const PATH23 = '/api/v3/extension/image' +const PATH24 = '/api/v3/extension/parse' +const PATH25 = '/api/v3/extension/story' +const PATH26 = '/audio' +const PATH27 = '/image' +const PATH28 = '/video' +const PATH29 = '/api/v3/extension/video' +const PATH30 = '/api/v3/fcm_token' +const PATH31 = '/api/v3/info' +const PATH32 = '/api/v3/login' +const PATH33 = '/api/v3/logout' +const PATH34 = '/api/v3/me' +const PATH35 = '/api/v3/organisation' +const PATH36 = '/api/v3/organisation/users' +const PATH37 = '/api/v3/stories' +const PATH38 = '/reaction' +const PATH39 = '/api/v3/user' +const PATH40 = '/api/v3/user/profile' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') return { api: { stream: { v1: { stories: { - _storyId: (val0: number) => ({ - get: (option: { query: Methods1['get']['query'], config?: T }) => - client.fetch(prefix, `/api/stream/v1/stories/${val0}`, 'GET', option).json(), - $get: async (option: { query: Methods1['get']['query'], config?: T }) => - (await client.fetch(prefix, `/api/stream/v1/stories/${val0}`, 'GET', option).json()).body - }), + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, get: (option: { query: Methods0['get']['query'], config?: T }) => - client.fetch(prefix, '/api/stream/v1/stories', 'GET', option).json(), - $get: async (option: { query: Methods0['get']['query'], config?: T }) => - (await client.fetch(prefix, '/api/stream/v1/stories', 'GET', option).json()).body + fetch(prefix, PATH0, GET, option).json(), + $get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) } } }, v1: { me: { get: (option?: { config?: T }) => - client.fetch(prefix, '/api/v1/me', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/api/v1/me', 'GET', option).json()).body + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) }, mixes: { - _id: (val1: string) => ({ - put: (option?: { body?: Methods4['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/v1/mixes/${val1}`, 'PUT', option).send(), - $put: async (option?: { body?: Methods4['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/v1/mixes/${val1}`, 'PUT', option).send()).body - }), - _mixId: (val2: string) => ({ - cards: { - post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/v1/mixes/${val2}/cards`, 'POST', option).send(), - $post: async (option?: { body?: Methods5['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/v1/mixes/${val2}/cards`, 'POST', option).send()).body - }, - url: { - post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/api/v1/mixes/${val2}/url`, 'POST', option).send(), - $post: async (option?: { body?: Methods6['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/api/v1/mixes/${val2}/url`, 'POST', option).send()).body + _id: (val1: string) => { + const prefix1 = `${PATH2}/${val1}` + + return { + put: (option?: { body?: Methods4['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).send(), + $put: (option?: { body?: Methods4['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).send().then(r => r.body) } - }), + }, + _mixId: (val2: string) => { + const prefix2 = `${PATH2}/${val2}` + + return { + cards: { + post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).send(), + $post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).send().then(r => r.body) + }, + url: { + post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option).send(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option).send().then(r => r.body) + } + } + }, get: (option?: { config?: T }) => - client.fetch(prefix, '/api/v1/mixes', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/api/v1/mixes', 'GET', option).json()).body, + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body), post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/v1/mixes', 'POST', option).json(), - $post: async (option?: { body?: Methods3['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/v1/mixes', 'POST', option).json()).body + fetch(prefix, PATH2, POST, option).json(), + $post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH2, POST, option).json().then(r => r.body) }, parse: { image: { post: (option?: { body?: Methods8['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/v1/parse/image', 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods8['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/v1/parse/image', 'POST', option, 'FormData').json()).body + fetch(prefix, PATH6, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'FormData').json().then(r => r.body) }, post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/v1/parse', 'POST', option).json(), - $post: async (option?: { body?: Methods7['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/v1/parse', 'POST', option).json()).body + fetch(prefix, PATH5, POST, option).json(), + $post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json().then(r => r.body) }, token: { post: (option?: { body?: Methods9['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/api/v1/token', 'POST', option).json(), - $post: async (option?: { body?: Methods9['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/api/v1/token', 'POST', option).json()).body + fetch(prefix, PATH7, POST, option).json(), + $post: (option?: { body?: Methods9['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json().then(r => r.body) } }, v3: { $2fa: { post: (option: { body: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/2fa', 'POST', option).json(), - $post: async (option: { body: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/2fa', 'POST', option).json()).body + fetch(prefix, PATH8, POST, option).json(), + $post: (option: { body: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH8, POST, option).json().then(r => r.body) }, channels: { - _channelId_0: (val3: number) => ({ - chats: { - _chatId: (val4: number) => ({ - items: { - _itemId: (val5: number) => ({ - post: (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val3}/chats/${val4}/items/${val5}`, 'POST', option).json(), - $post: async (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val3}/chats/${val4}/items/${val5}`, 'POST', option).json()).body - }) + _channelId_0: (val3: number) => { + const prefix3 = `${PATH9}/${val3}` + + return { + chats: { + _chatId: (val4: number) => { + const prefix4 = `${prefix3}${PATH10}/${val4}` + + return { + items: { + _itemId: (val5: number) => { + const prefix5 = `${prefix4}${PATH11}/${val5}` + + return { + post: (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix5, POST, option).json(), + $post: (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix5, POST, option).json().then(r => r.body) + } + } + } + } } - }) - }, - news_feed: { - get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val3}/news-feed`, 'GET', option).json(), - $get: async (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val3}/news-feed`, 'GET', option).json()).body + }, + news_feed: { + get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH12}`, GET, option).json(), + $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH12}`, GET, option).json().then(r => r.body) + } } - }), - _channelId_1: (val6: string) => ({ - chats: { - _chatId: (val7: string) => ({ - items: { - audio: { - post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/audio`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/audio`, 'POST', option, 'FormData').json()).body - }, - image: { - post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/image`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/image`, 'POST', option, 'FormData').json()).body - }, - video: { - post: (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/video`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items/video`, 'POST', option, 'FormData').json()).body - }, - get: (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items`, 'GET', option).json(), - $get: async (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items`, 'GET', option).json()).body, - post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items`, 'POST', option).json(), - $post: async (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/items`, 'POST', option).json()).body - }, - itemslist: { - get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/itemslist`, 'GET', option).json(), - $get: async (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/itemslist`, 'GET', option).json()).body - }, - users: { - remove: { - post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users/remove`, 'POST', option).send(), - $post: async (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users/remove`, 'POST', option).send()).body - }, - get: (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'GET', option).json(), - $get: async (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'GET', option).json()).body, - post: (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'POST', option).send(), - $post: async (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'POST', option).send()).body, - put: (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'PUT', option).send(), - $put: async (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}/users`, 'PUT', option).send()).body + }, + _channelId_1: (val6: string) => { + const prefix6 = `${PATH9}/${val6}` + + return { + chats: { + _chatId: (val7: string) => { + const prefix7 = `${prefix6}${PATH10}/${val7}` + + return { + items: { + audio: { + post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH13}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH13}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH14}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH14}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH15}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH15}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, POST, option).json(), + $post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, POST, option).json().then(r => r.body) + }, + itemslist: { + get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH16}`, GET, option).json(), + $get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH16}`, GET, option).json().then(r => r.body) + }, + users: { + remove: { + post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH18}`, POST, option).send(), + $post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH18}`, POST, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, GET, option).json(), + $get: (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, POST, option).send(), + $post: (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, POST, option).send().then(r => r.body), + put: (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, PUT, option).send(), + $put: (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, PUT, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body), + put: (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, PUT, option).send(), + $put: (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, PUT, option).send().then(r => r.body), + delete: (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send(), + $delete: (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send().then(r => r.body) + } }, - get: (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'GET', option).json(), - $get: async (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'GET', option).json()).body, - put: (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'PUT', option).send(), - $put: async (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'PUT', option).send()).body, - delete: (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'DELETE', option).send(), - $delete: async (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats/${val7}`, 'DELETE', option).send()).body - }), - get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats`, 'GET', option).json(), - $get: async (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats`, 'GET', option).json()).body, - post: (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/chats`, 'POST', option).json(), - $post: async (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/chats`, 'POST', option).json()).body - }, - notifications: { - get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}/notifications`, 'GET', option).json(), - $get: async (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}/notifications`, 'GET', option).json()).body - }, - get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/channels/${val6}`, 'GET', option).send(), - $get: async (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/channels/${val6}`, 'GET', option).send()).body - }), + get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, GET, option).json(), + $get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, POST, option).json(), + $post: (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, POST, option).json().then(r => r.body) + }, + notifications: { + get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH19}`, GET, option).json(), + $get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH19}`, GET, option).json().then(r => r.body) + }, + 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) + } + }, get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/channels', 'GET', option).json(), - $get: async (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/channels', 'GET', option).json()).body + fetch(prefix, PATH9, GET, option).json(), + $get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH9, GET, option).json().then(r => r.body) }, chats: { - _chatId_0: (val8: number) => ({ - items: { - _itemId: (val9: number) => ({ - post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val8}/items/${val9}`, 'POST', option).json(), - $post: async (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val8}/items/${val9}`, 'POST', option).json()).body, - get: (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val8}/items/${val9}`, 'GET', option).json(), - $get: async (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val8}/items/${val9}`, 'GET', option).json()).body - }) + _chatId_0: (val8: number) => { + const prefix8 = `${PATH20}/${val8}` + + return { + items: { + _itemId: (val9: number) => { + const prefix9 = `${prefix8}${PATH11}/${val9}` + + return { + post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, POST, option).json(), + $post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, POST, option).json().then(r => r.body), + get: (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, GET, option).json(), + $get: (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, GET, option).json().then(r => r.body) + } + } + } } - }), - _chatId_1: (val10: string) => ({ - items: { - audio: { - post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val10}/items/audio`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val10}/items/audio`, 'POST', option, 'FormData').json()).body - }, - image: { - post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val10}/items/image`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val10}/items/image`, 'POST', option, 'FormData').json()).body - }, - video: { - post: (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val10}/items/video`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val10}/items/video`, 'POST', option, 'FormData').json()).body - }, - get: (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val10}/items`, 'GET', option).json(), - $get: async (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val10}/items`, 'GET', option).json()).body, - post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/chats/${val10}/items`, 'POST', option).json(), - $post: async (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/chats/${val10}/items`, 'POST', option).json()).body + }, + _chatId_1: (val10: string) => { + const prefix10 = `${PATH20}/${val10}` + + return { + items: { + audio: { + post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH15}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH15}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, POST, option).json(), + $post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, POST, option).json().then(r => r.body) + } } - }), + }, keys: { get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/chats/keys', 'GET', option).json(), - $get: async (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/chats/keys', 'GET', option).json()).body + fetch(prefix, PATH21, GET, option).json(), + $get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH21, GET, option).json().then(r => r.body) } }, extension: { audio: { post: (option?: { body?: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/extension/audio', 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/extension/audio', 'POST', option, 'FormData').json()).body + fetch(prefix, PATH22, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH22, POST, option, 'FormData').json().then(r => r.body) }, image: { post: (option?: { body?: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/extension/image', 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/extension/image', 'POST', option, 'FormData').json()).body + fetch(prefix, PATH23, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH23, POST, option, 'FormData').json().then(r => r.body) }, parse: { post: (option: { body: Methods33['post']['reqBody'], headers?: Methods33['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/extension/parse', 'POST', option).json(), - $post: async (option: { body: Methods33['post']['reqBody'], headers?: Methods33['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/extension/parse', 'POST', option).json()).body + fetch(prefix, PATH24, POST, option).json(), + $post: (option: { body: Methods33['post']['reqBody'], headers?: Methods33['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH24, POST, option).json().then(r => r.body) }, story: { - _storyId: (val11: string) => ({ - audio: { - post: (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/extension/story/${val11}/audio`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/extension/story/${val11}/audio`, 'POST', option, 'FormData').json()).body - }, - image: { - post: (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/extension/story/${val11}/image`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/extension/story/${val11}/image`, 'POST', option, 'FormData').json()).body - }, - video: { - post: (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/extension/story/${val11}/video`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/extension/story/${val11}/video`, 'POST', option, 'FormData').json()).body - }, - post: (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/extension/story/${val11}`, 'POST', option, 'FormData').json(), - $post: async (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/extension/story/${val11}`, 'POST', option, 'FormData').json()).body - }) + _storyId: (val11: string) => { + const prefix11 = `${PATH25}/${val11}` + + return { + audio: { + post: (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH26}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH26}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH27}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH27}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH28}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH28}`, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, POST, option, 'FormData').json(), + $post: (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, POST, option, 'FormData').json().then(r => r.body) + } + } }, video: { post: (option?: { body?: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/extension/video', 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/extension/video', 'POST', option, 'FormData').json()).body + fetch(prefix, PATH29, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH29, POST, option, 'FormData').json().then(r => r.body) } }, fcm_token: { post: (option: { body: Methods39['post']['reqBody'], headers?: Methods39['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/fcm_token', 'POST', option).send(), - $post: async (option: { body: Methods39['post']['reqBody'], headers?: Methods39['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/fcm_token', 'POST', option).send()).body + fetch(prefix, PATH30, POST, option).send(), + $post: (option: { body: Methods39['post']['reqBody'], headers?: Methods39['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH30, POST, option).send().then(r => r.body) }, info: { get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/info', 'GET', option).json(), - $get: async (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/info', 'GET', option).json()).body + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) }, login: { post: (option: { body: Methods41['post']['reqBody'], headers?: Methods41['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/login', 'POST', option).json(), - $post: async (option: { body: Methods41['post']['reqBody'], headers?: Methods41['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/login', 'POST', option).json()).body + fetch(prefix, PATH32, POST, option).json(), + $post: (option: { body: Methods41['post']['reqBody'], headers?: Methods41['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH32, POST, option).json().then(r => r.body) }, logout: { post: (option: { body: Methods42['post']['reqBody'], headers?: Methods42['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/logout', 'POST', option).send(), - $post: async (option: { body: Methods42['post']['reqBody'], headers?: Methods42['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/logout', 'POST', option).send()).body + fetch(prefix, PATH33, POST, option).send(), + $post: (option: { body: Methods42['post']['reqBody'], headers?: Methods42['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH33, POST, option).send().then(r => r.body) }, me: { get: (option?: { headers?: Methods43['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/me', 'GET', option).json(), - $get: async (option?: { headers?: Methods43['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/me', 'GET', option).json()).body + fetch(prefix, PATH34, GET, option).json(), + $get: (option?: { headers?: Methods43['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH34, GET, option).json().then(r => r.body) }, organisation: { users: { get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/organisation/users', 'GET', option).json(), - $get: async (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/organisation/users', 'GET', option).json()).body + fetch(prefix, PATH36, GET, option).json(), + $get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH36, GET, option).json().then(r => r.body) }, get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/organisation', 'GET', option).json(), - $get: async (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/organisation', 'GET', option).json()).body + fetch(prefix, PATH35, GET, option).json(), + $get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH35, GET, option).json().then(r => r.body) }, stories: { - _storyId: (val12: number) => ({ - items: { - _itemId: (val13: number) => ({ - reaction: { - post: (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/stories/${val12}/items/${val13}/reaction`, 'POST', option).json(), - $post: async (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/stories/${val12}/items/${val13}/reaction`, 'POST', option).json()).body + _storyId: (val12: number) => { + const prefix12 = `${PATH37}/${val12}` + + return { + items: { + _itemId: (val13: number) => { + const prefix13 = `${prefix12}${PATH11}/${val13}` + + return { + reaction: { + post: (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix13}${PATH38}`, POST, option).json(), + $post: (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix13}${PATH38}`, POST, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix13, GET, option).json(), + $get: (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix13, GET, option).json().then(r => r.body) + } }, - get: (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/stories/${val12}/items/${val13}`, 'GET', option).json(), - $get: async (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/stories/${val12}/items/${val13}`, 'GET', option).json()).body - }), - get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/stories/${val12}/items`, 'GET', option).json(), - $get: async (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/stories/${val12}/items`, 'GET', option).json()).body + get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix12}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix12}${PATH11}`, GET, option).json().then(r => r.body) + } } - }) + } }, user: { - _userId: (val14: string) => ({ - get: (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/api/v3/user/${val14}`, 'GET', option).json(), - $get: async (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/api/v3/user/${val14}`, 'GET', option).json()).body - }), + _userId: (val14: string) => { + const prefix14 = `${PATH39}/${val14}` + + return { + get: (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix14, GET, option).json(), + $get: (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix14, GET, option).json().then(r => r.body) + } + }, profile: { put: (option?: { body?: Methods51['put']['reqBody'], headers?: Methods51['put']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/user/profile', 'PUT', option, 'FormData').send(), - $put: async (option?: { body?: Methods51['put']['reqBody'], headers?: Methods51['put']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/user/profile', 'PUT', option, 'FormData').send()).body + fetch(prefix, PATH40, PUT, option, 'FormData').send(), + $put: (option?: { body?: Methods51['put']['reqBody'], headers?: Methods51['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH40, PUT, option, 'FormData').send().then(r => r.body) }, get: (option?: { headers?: Methods49['get']['reqHeaders'], config?: T }) => - client.fetch(prefix, '/api/v3/user', 'GET', option).json(), - $get: async (option?: { headers?: Methods49['get']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, '/api/v3/user', 'GET', option).json()).body + fetch(prefix, PATH39, GET, option).json(), + $get: (option?: { headers?: Methods49['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH39, GET, option).json().then(r => r.body) } } } diff --git a/samples/openapi/api/$api.ts b/samples/openapi/api/$api.ts new file mode 100644 index 00000000..2bf68bfd --- /dev/null +++ b/samples/openapi/api/$api.ts @@ -0,0 +1,551 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './stream/v1/stories' +import { Methods as Methods1 } from './stream/v1/stories/_storyId@number' +import { Methods as Methods2 } from './v1/me' +import { Methods as Methods3 } from './v1/mixes' +import { Methods as Methods4 } from './v1/mixes/_id@string' +import { Methods as Methods5 } from './v1/mixes/_mixId@string/cards' +import { Methods as Methods6 } from './v1/mixes/_mixId@string/url' +import { Methods as Methods7 } from './v1/parse' +import { Methods as Methods8 } from './v1/parse/image' +import { Methods as Methods9 } from './v1/token' +import { Methods as Methods10 } from './v3/2fa' +import { Methods as Methods11 } from './v3/channels' +import { Methods as Methods12 } from './v3/channels/_channelId@number/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods13 } from './v3/channels/_channelId@number/news-feed' +import { Methods as Methods14 } from './v3/channels/_channelId@string' +import { Methods as Methods15 } from './v3/channels/_channelId@string/chats' +import { Methods as Methods16 } from './v3/channels/_channelId@string/chats/_chatId@string' +import { Methods as Methods17 } from './v3/channels/_channelId@string/chats/_chatId@string/items' +import { Methods as Methods18 } from './v3/channels/_channelId@string/chats/_chatId@string/items/audio' +import { Methods as Methods19 } from './v3/channels/_channelId@string/chats/_chatId@string/items/image' +import { Methods as Methods20 } from './v3/channels/_channelId@string/chats/_chatId@string/items/video' +import { Methods as Methods21 } from './v3/channels/_channelId@string/chats/_chatId@string/itemslist' +import { Methods as Methods22 } from './v3/channels/_channelId@string/chats/_chatId@string/users' +import { Methods as Methods23 } from './v3/channels/_channelId@string/chats/_chatId@string/users/remove' +import { Methods as Methods24 } from './v3/channels/_channelId@string/notifications' +import { Methods as Methods25 } from './v3/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods26 } from './v3/chats/_chatId@string/items' +import { Methods as Methods27 } from './v3/chats/_chatId@string/items/audio' +import { Methods as Methods28 } from './v3/chats/_chatId@string/items/image' +import { Methods as Methods29 } from './v3/chats/_chatId@string/items/video' +import { Methods as Methods30 } from './v3/chats/keys' +import { Methods as Methods31 } from './v3/extension/audio' +import { Methods as Methods32 } from './v3/extension/image' +import { Methods as Methods33 } from './v3/extension/parse' +import { Methods as Methods34 } from './v3/extension/story/_storyId@string' +import { Methods as Methods35 } from './v3/extension/story/_storyId@string/audio' +import { Methods as Methods36 } from './v3/extension/story/_storyId@string/image' +import { Methods as Methods37 } from './v3/extension/story/_storyId@string/video' +import { Methods as Methods38 } from './v3/extension/video' +import { Methods as Methods39 } from './v3/fcm_token' +import { Methods as Methods40 } from './v3/info' +import { Methods as Methods41 } from './v3/login' +import { Methods as Methods42 } from './v3/logout' +import { Methods as Methods43 } from './v3/me' +import { Methods as Methods44 } from './v3/organisation' +import { Methods as Methods45 } from './v3/organisation/users' +import { Methods as Methods46 } from './v3/stories/_storyId@number/items' +import { Methods as Methods47 } from './v3/stories/_storyId@number/items/_itemId@number' +import { Methods as Methods48 } from './v3/stories/_storyId@number/items/_itemId@number/reaction' +import { Methods as Methods49 } from './v3/user' +import { Methods as Methods50 } from './v3/user/_userId@string' +import { Methods as Methods51 } from './v3/user/profile' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/stream/v1/stories' +const PATH1 = '/api/v1/me' +const PATH2 = '/api/v1/mixes' +const PATH3 = '/cards' +const PATH4 = '/url' +const PATH5 = '/api/v1/parse' +const PATH6 = '/api/v1/parse/image' +const PATH7 = '/api/v1/token' +const PATH8 = '/api/v3/2fa' +const PATH9 = '/api/v3/channels' +const PATH10 = '/chats' +const PATH11 = '/items' +const PATH12 = '/news-feed' +const PATH13 = '/items/audio' +const PATH14 = '/items/image' +const PATH15 = '/items/video' +const PATH16 = '/itemslist' +const PATH17 = '/users' +const PATH18 = '/users/remove' +const PATH19 = '/notifications' +const PATH20 = '/api/v3/chats' +const PATH21 = '/api/v3/chats/keys' +const PATH22 = '/api/v3/extension/audio' +const PATH23 = '/api/v3/extension/image' +const PATH24 = '/api/v3/extension/parse' +const PATH25 = '/api/v3/extension/story' +const PATH26 = '/audio' +const PATH27 = '/image' +const PATH28 = '/video' +const PATH29 = '/api/v3/extension/video' +const PATH30 = '/api/v3/fcm_token' +const PATH31 = '/api/v3/info' +const PATH32 = '/api/v3/login' +const PATH33 = '/api/v3/logout' +const PATH34 = '/api/v3/me' +const PATH35 = '/api/v3/organisation' +const PATH36 = '/api/v3/organisation/users' +const PATH37 = '/api/v3/stories' +const PATH38 = '/reaction' +const PATH39 = '/api/v3/user' +const PATH40 = '/api/v3/user/profile' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + stream: { + v1: { + stories: { + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + 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) + } + } + }, + v1: { + me: { + get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + mixes: { + _id: (val1: string) => { + const prefix1 = `${PATH2}/${val1}` + + return { + put: (option?: { body?: Methods4['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).send(), + $put: (option?: { body?: Methods4['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).send().then(r => r.body) + } + }, + _mixId: (val2: string) => { + const prefix2 = `${PATH2}/${val2}` + + return { + cards: { + post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).send(), + $post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option).send().then(r => r.body) + }, + url: { + post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option).send(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option).send().then(r => r.body) + } + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH2, POST, option).json(), + $post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH2, POST, option).json().then(r => r.body) + }, + parse: { + image: { + post: (option?: { body?: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json(), + $post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json().then(r => r.body) + }, + token: { + post: (option?: { body?: Methods9['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json(), + $post: (option?: { body?: Methods9['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json().then(r => r.body) + } + }, + v3: { + $2fa: { + post: (option: { body: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH8, POST, option).json(), + $post: (option: { body: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH8, POST, option).json().then(r => r.body) + }, + channels: { + _channelId_0: (val3: number) => { + const prefix3 = `${PATH9}/${val3}` + + return { + chats: { + _chatId: (val4: number) => { + const prefix4 = `${prefix3}${PATH10}/${val4}` + + return { + items: { + _itemId: (val5: number) => { + const prefix5 = `${prefix4}${PATH11}/${val5}` + + return { + post: (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix5, POST, option).json(), + $post: (option?: { body?: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix5, POST, option).json().then(r => r.body) + } + } + } + } + } + }, + news_feed: { + get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH12}`, GET, option).json(), + $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH12}`, GET, option).json().then(r => r.body) + } + } + }, + _channelId_1: (val6: string) => { + const prefix6 = `${PATH9}/${val6}` + + return { + chats: { + _chatId: (val7: string) => { + const prefix7 = `${prefix6}${PATH10}/${val7}` + + return { + items: { + audio: { + post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH13}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH13}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH14}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH14}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH15}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods20['post']['reqBody'], headers?: Methods20['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH15}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods17['get']['query'], headers?: Methods17['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, POST, option).json(), + $post: (option: { body: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH11}`, POST, option).json().then(r => r.body) + }, + itemslist: { + get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH16}`, GET, option).json(), + $get: (option: { query: Methods21['get']['query'], headers?: Methods21['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH16}`, GET, option).json().then(r => r.body) + }, + users: { + remove: { + post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH18}`, POST, option).send(), + $post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH18}`, POST, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, GET, option).json(), + $get: (option?: { headers?: Methods22['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, POST, option).send(), + $post: (option: { body: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, POST, option).send().then(r => r.body), + put: (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, PUT, option).send(), + $put: (option: { body: Methods22['put']['reqBody'], headers?: Methods22['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH17}`, PUT, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option?: { headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body), + put: (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, PUT, option).send(), + $put: (option: { body: Methods16['put']['reqBody'], headers?: Methods16['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, PUT, option).send().then(r => r.body), + delete: (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send(), + $delete: (option?: { headers?: Methods16['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix7, DELETE, option).send().then(r => r.body) + } + }, + get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, GET, option).json(), + $get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, POST, option).json(), + $post: (option: { body: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH10}`, POST, option).json().then(r => r.body) + }, + notifications: { + get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH19}`, GET, option).json(), + $get: (option?: { query?: Methods24['get']['query'], headers?: Methods24['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix6}${PATH19}`, GET, option).json().then(r => r.body) + }, + 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) + } + }, + get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH9, GET, option).json(), + $get: (option?: { query?: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH9, GET, option).json().then(r => r.body) + }, + chats: { + _chatId_0: (val8: number) => { + const prefix8 = `${PATH20}/${val8}` + + return { + items: { + _itemId: (val9: number) => { + const prefix9 = `${prefix8}${PATH11}/${val9}` + + return { + post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, POST, option).json(), + $post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, POST, option).json().then(r => r.body), + get: (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, GET, option).json(), + $get: (option?: { headers?: Methods25['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix9, GET, option).json().then(r => r.body) + } + } + } + } + }, + _chatId_1: (val10: string) => { + const prefix10 = `${PATH20}/${val10}` + + return { + items: { + audio: { + post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH13}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH14}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH15}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH15}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods26['get']['query'], headers?: Methods26['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, POST, option).json(), + $post: (option: { body: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH11}`, POST, option).json().then(r => r.body) + } + } + }, + keys: { + get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH21, GET, option).json(), + $get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH21, GET, option).json().then(r => r.body) + } + }, + extension: { + audio: { + post: (option?: { body?: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH22, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH22, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH23, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH23, POST, option, 'FormData').json().then(r => r.body) + }, + parse: { + post: (option: { body: Methods33['post']['reqBody'], headers?: Methods33['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH24, POST, option).json(), + $post: (option: { body: Methods33['post']['reqBody'], headers?: Methods33['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH24, POST, option).json().then(r => r.body) + }, + story: { + _storyId: (val11: string) => { + const prefix11 = `${PATH25}/${val11}` + + return { + audio: { + post: (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH26}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods35['post']['reqBody'], headers?: Methods35['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH26}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH27}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods36['post']['reqBody'], headers?: Methods36['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH27}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH28}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods37['post']['reqBody'], headers?: Methods37['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix11}${PATH28}`, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, POST, option, 'FormData').json(), + $post: (option: { body: Methods34['post']['reqBody'], headers?: Methods34['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, POST, option, 'FormData').json().then(r => r.body) + } + } + }, + video: { + post: (option?: { body?: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH29, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH29, POST, option, 'FormData').json().then(r => r.body) + } + }, + fcm_token: { + post: (option: { body: Methods39['post']['reqBody'], headers?: Methods39['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH30, POST, option).send(), + $post: (option: { body: Methods39['post']['reqBody'], headers?: Methods39['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH30, POST, option).send().then(r => r.body) + }, + info: { + get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) + }, + login: { + post: (option: { body: Methods41['post']['reqBody'], headers?: Methods41['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH32, POST, option).json(), + $post: (option: { body: Methods41['post']['reqBody'], headers?: Methods41['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH32, POST, option).json().then(r => r.body) + }, + logout: { + post: (option: { body: Methods42['post']['reqBody'], headers?: Methods42['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH33, POST, option).send(), + $post: (option: { body: Methods42['post']['reqBody'], headers?: Methods42['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH33, POST, option).send().then(r => r.body) + }, + me: { + get: (option?: { headers?: Methods43['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH34, GET, option).json(), + $get: (option?: { headers?: Methods43['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH34, GET, option).json().then(r => r.body) + }, + organisation: { + users: { + get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH36, GET, option).json(), + $get: (option: { query: Methods45['get']['query'], headers?: Methods45['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH36, GET, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH35, GET, option).json(), + $get: (option?: { headers?: Methods44['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH35, GET, option).json().then(r => r.body) + }, + stories: { + _storyId: (val12: number) => { + const prefix12 = `${PATH37}/${val12}` + + return { + items: { + _itemId: (val13: number) => { + const prefix13 = `${prefix12}${PATH11}/${val13}` + + return { + reaction: { + post: (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix13}${PATH38}`, POST, option).json(), + $post: (option: { body: Methods48['post']['reqBody'], headers?: Methods48['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix13}${PATH38}`, POST, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix13, GET, option).json(), + $get: (option?: { headers?: Methods47['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix13, GET, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix12}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods46['get']['query'], headers?: Methods46['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix12}${PATH11}`, GET, option).json().then(r => r.body) + } + } + } + }, + user: { + _userId: (val14: string) => { + const prefix14 = `${PATH39}/${val14}` + + return { + get: (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix14, GET, option).json(), + $get: (option?: { headers?: Methods50['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix14, GET, option).json().then(r => r.body) + } + }, + profile: { + put: (option?: { body?: Methods51['put']['reqBody'], headers?: Methods51['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH40, PUT, option, 'FormData').send(), + $put: (option?: { body?: Methods51['put']['reqBody'], headers?: Methods51['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH40, PUT, option, 'FormData').send().then(r => r.body) + }, + get: (option?: { headers?: Methods49['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH39, GET, option).json(), + $get: (option?: { headers?: Methods49['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH39, GET, option).json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/stream/$api.ts b/samples/openapi/api/stream/$api.ts new file mode 100644 index 00000000..1b28a67a --- /dev/null +++ b/samples/openapi/api/stream/$api.ts @@ -0,0 +1,34 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './v1/stories' +import { Methods as Methods1 } from './v1/stories/_storyId@number' + +const GET = 'GET' +const PATH0 = '/api/stream/v1/stories' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + v1: { + stories: { + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + 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) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/stream/v1/$api.ts b/samples/openapi/api/stream/v1/$api.ts new file mode 100644 index 00000000..3351f64a --- /dev/null +++ b/samples/openapi/api/stream/v1/$api.ts @@ -0,0 +1,32 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './stories' +import { Methods as Methods1 } from './stories/_storyId@number' + +const GET = 'GET' +const PATH0 = '/api/stream/v1/stories' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + stories: { + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + 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) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/stream/v1/stories/$api.ts b/samples/openapi/api/stream/v1/stories/$api.ts new file mode 100644 index 00000000..310e43a9 --- /dev/null +++ b/samples/openapi/api/stream/v1/stories/$api.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_storyId@number' + +const GET = 'GET' +const PATH0 = '/api/stream/v1/stories' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/$api.ts b/samples/openapi/api/v1/$api.ts new file mode 100644 index 00000000..432a037d --- /dev/null +++ b/samples/openapi/api/v1/$api.ts @@ -0,0 +1,92 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './me' +import { Methods as Methods1 } from './mixes' +import { Methods as Methods2 } from './mixes/_id@string' +import { Methods as Methods3 } from './mixes/_mixId@string/cards' +import { Methods as Methods4 } from './mixes/_mixId@string/url' +import { Methods as Methods5 } from './parse' +import { Methods as Methods6 } from './parse/image' +import { Methods as Methods7 } from './token' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const PATH0 = '/api/v1/me' +const PATH1 = '/api/v1/mixes' +const PATH2 = '/cards' +const PATH3 = '/url' +const PATH4 = '/api/v1/parse' +const PATH5 = '/api/v1/parse/image' +const PATH6 = '/api/v1/token' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + me: { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + }, + mixes: { + _id: (val0: string) => { + const prefix0 = `${PATH1}/${val0}` + + return { + put: (option?: { body?: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).send(), + $put: (option?: { body?: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).send().then(r => r.body) + } + }, + _mixId: (val1: string) => { + const prefix1 = `${PATH1}/${val1}` + + return { + cards: { + post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).send(), + $post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).send().then(r => r.body) + }, + url: { + post: (option?: { body?: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH3}`, POST, option).send(), + $post: (option?: { body?: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH3}`, POST, option).send().then(r => r.body) + } + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json(), + $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json().then(r => r.body) + }, + parse: { + image: { + post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json(), + $post: (option?: { body?: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json().then(r => r.body) + }, + token: { + post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).json(), + $post: (option?: { body?: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/me/$api.ts b/samples/openapi/api/v1/me/$api.ts new file mode 100644 index 00000000..a528f012 --- /dev/null +++ b/samples/openapi/api/v1/me/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/v1/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/mixes/$api.ts b/samples/openapi/api/v1/mixes/$api.ts new file mode 100644 index 00000000..baf74691 --- /dev/null +++ b/samples/openapi/api/v1/mixes/$api.ts @@ -0,0 +1,58 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@string' +import { Methods as Methods2 } from './_mixId@string/cards' +import { Methods as Methods3 } from './_mixId@string/url' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const PATH0 = '/api/v1/mixes' +const PATH1 = '/cards' +const PATH2 = '/url' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).send(), + $put: (option?: { body?: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).send().then(r => r.body) + } + }, + _mixId: (val1: string) => { + const prefix1 = `${PATH0}/${val1}` + + return { + cards: { + post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH1}`, POST, option).send(), + $post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH1}`, POST, option).send().then(r => r.body) + }, + url: { + post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).send(), + $post: (option?: { body?: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).send().then(r => r.body) + } + } + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body), + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/parse/$api.ts b/samples/openapi/api/v1/parse/$api.ts new file mode 100644 index 00000000..b21e9a20 --- /dev/null +++ b/samples/openapi/api/v1/parse/$api.ts @@ -0,0 +1,27 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './image' + +const POST = 'POST' +const PATH0 = '/api/v1/parse' +const PATH1 = '/api/v1/parse/image' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + image: { + post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/parse/image/$api.ts b/samples/openapi/api/v1/parse/image/$api.ts new file mode 100644 index 00000000..b27db4a0 --- /dev/null +++ b/samples/openapi/api/v1/parse/image/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v1/parse/image' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v1/token/$api.ts b/samples/openapi/api/v1/token/$api.ts new file mode 100644 index 00000000..e45814b9 --- /dev/null +++ b/samples/openapi/api/v1/token/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v1/token' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option?: { body?: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/$api.ts b/samples/openapi/api/v3/$api.ts new file mode 100644 index 00000000..b3d61755 --- /dev/null +++ b/samples/openapi/api/v3/$api.ts @@ -0,0 +1,447 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './2fa' +import { Methods as Methods1 } from './channels' +import { Methods as Methods2 } from './channels/_channelId@number/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods3 } from './channels/_channelId@number/news-feed' +import { Methods as Methods4 } from './channels/_channelId@string' +import { Methods as Methods5 } from './channels/_channelId@string/chats' +import { Methods as Methods6 } from './channels/_channelId@string/chats/_chatId@string' +import { Methods as Methods7 } from './channels/_channelId@string/chats/_chatId@string/items' +import { Methods as Methods8 } from './channels/_channelId@string/chats/_chatId@string/items/audio' +import { Methods as Methods9 } from './channels/_channelId@string/chats/_chatId@string/items/image' +import { Methods as Methods10 } from './channels/_channelId@string/chats/_chatId@string/items/video' +import { Methods as Methods11 } from './channels/_channelId@string/chats/_chatId@string/itemslist' +import { Methods as Methods12 } from './channels/_channelId@string/chats/_chatId@string/users' +import { Methods as Methods13 } from './channels/_channelId@string/chats/_chatId@string/users/remove' +import { Methods as Methods14 } from './channels/_channelId@string/notifications' +import { Methods as Methods15 } from './chats/_chatId@number/items/_itemId@number' +import { Methods as Methods16 } from './chats/_chatId@string/items' +import { Methods as Methods17 } from './chats/_chatId@string/items/audio' +import { Methods as Methods18 } from './chats/_chatId@string/items/image' +import { Methods as Methods19 } from './chats/_chatId@string/items/video' +import { Methods as Methods20 } from './chats/keys' +import { Methods as Methods21 } from './extension/audio' +import { Methods as Methods22 } from './extension/image' +import { Methods as Methods23 } from './extension/parse' +import { Methods as Methods24 } from './extension/story/_storyId@string' +import { Methods as Methods25 } from './extension/story/_storyId@string/audio' +import { Methods as Methods26 } from './extension/story/_storyId@string/image' +import { Methods as Methods27 } from './extension/story/_storyId@string/video' +import { Methods as Methods28 } from './extension/video' +import { Methods as Methods29 } from './fcm_token' +import { Methods as Methods30 } from './info' +import { Methods as Methods31 } from './login' +import { Methods as Methods32 } from './logout' +import { Methods as Methods33 } from './me' +import { Methods as Methods34 } from './organisation' +import { Methods as Methods35 } from './organisation/users' +import { Methods as Methods36 } from './stories/_storyId@number/items' +import { Methods as Methods37 } from './stories/_storyId@number/items/_itemId@number' +import { Methods as Methods38 } from './stories/_storyId@number/items/_itemId@number/reaction' +import { Methods as Methods39 } from './user' +import { Methods as Methods40 } from './user/_userId@string' +import { Methods as Methods41 } from './user/profile' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/v3/2fa' +const PATH1 = '/api/v3/channels' +const PATH2 = '/chats' +const PATH3 = '/items' +const PATH4 = '/news-feed' +const PATH5 = '/items/audio' +const PATH6 = '/items/image' +const PATH7 = '/items/video' +const PATH8 = '/itemslist' +const PATH9 = '/users' +const PATH10 = '/users/remove' +const PATH11 = '/notifications' +const PATH12 = '/api/v3/chats' +const PATH13 = '/api/v3/chats/keys' +const PATH14 = '/api/v3/extension/audio' +const PATH15 = '/api/v3/extension/image' +const PATH16 = '/api/v3/extension/parse' +const PATH17 = '/api/v3/extension/story' +const PATH18 = '/audio' +const PATH19 = '/image' +const PATH20 = '/video' +const PATH21 = '/api/v3/extension/video' +const PATH22 = '/api/v3/fcm_token' +const PATH23 = '/api/v3/info' +const PATH24 = '/api/v3/login' +const PATH25 = '/api/v3/logout' +const PATH26 = '/api/v3/me' +const PATH27 = '/api/v3/organisation' +const PATH28 = '/api/v3/organisation/users' +const PATH29 = '/api/v3/stories' +const PATH30 = '/reaction' +const PATH31 = '/api/v3/user' +const PATH32 = '/api/v3/user/profile' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + $2fa: { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + }, + channels: { + _channelId_0: (val0: number) => { + const prefix0 = `${PATH1}/${val0}` + + return { + chats: { + _chatId: (val1: number) => { + const prefix1 = `${prefix0}${PATH2}/${val1}` + + return { + items: { + _itemId: (val2: number) => { + const prefix2 = `${prefix1}${PATH3}/${val2}` + + return { + post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix2, POST, option).json(), + $post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix2, POST, option).json().then(r => r.body) + } + } + } + } + } + }, + news_feed: { + get: (option?: { query?: Methods3['get']['query'], headers?: Methods3['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, GET, option).json(), + $get: (option?: { query?: Methods3['get']['query'], headers?: Methods3['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, GET, option).json().then(r => r.body) + } + } + }, + _channelId_1: (val3: string) => { + const prefix3 = `${PATH1}/${val3}` + + return { + chats: { + _chatId: (val4: string) => { + const prefix4 = `${prefix3}${PATH2}/${val4}` + + return { + items: { + audio: { + post: (option?: { body?: Methods8['post']['reqBody'], headers?: Methods8['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH5}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods8['post']['reqBody'], headers?: Methods8['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH5}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods9['post']['reqBody'], headers?: Methods9['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH6}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods9['post']['reqBody'], headers?: Methods9['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH6}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH7}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods10['post']['reqBody'], headers?: Methods10['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH7}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods7['get']['query'], headers?: Methods7['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH3}`, GET, option).json(), + $get: (option?: { query?: Methods7['get']['query'], headers?: Methods7['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH3}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH3}`, POST, option).json().then(r => r.body) + }, + itemslist: { + get: (option: { query: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, GET, option).json(), + $get: (option: { query: Methods11['get']['query'], headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, GET, option).json().then(r => r.body) + }, + users: { + remove: { + post: (option: { body: Methods13['post']['reqBody'], headers?: Methods13['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH10}`, POST, option).send(), + $post: (option: { body: Methods13['post']['reqBody'], headers?: Methods13['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH10}`, POST, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods12['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, GET, option).json(), + $get: (option?: { headers?: Methods12['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, POST, option).send(), + $post: (option: { body: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, POST, option).send().then(r => r.body), + put: (option: { body: Methods12['put']['reqBody'], headers?: Methods12['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, PUT, option).send(), + $put: (option: { body: Methods12['put']['reqBody'], headers?: Methods12['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, PUT, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods6['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, GET, option).json(), + $get: (option?: { headers?: Methods6['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, GET, option).json().then(r => r.body), + put: (option: { body: Methods6['put']['reqBody'], headers?: Methods6['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, PUT, option).send(), + $put: (option: { body: Methods6['put']['reqBody'], headers?: Methods6['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, PUT, option).send().then(r => r.body), + delete: (option?: { headers?: Methods6['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send(), + $delete: (option?: { headers?: Methods6['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send().then(r => r.body) + } + }, + get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH2}`, GET, option).json(), + $get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH2}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods5['post']['reqBody'], headers?: Methods5['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], headers?: Methods5['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH2}`, POST, option).json().then(r => r.body) + }, + notifications: { + get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH11}`, GET, option).json(), + $get: (option?: { query?: Methods14['get']['query'], headers?: Methods14['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH11}`, GET, option).json().then(r => r.body) + }, + 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) + } + }, + get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + chats: { + _chatId_0: (val5: number) => { + const prefix5 = `${PATH12}/${val5}` + + return { + items: { + _itemId: (val6: number) => { + const prefix6 = `${prefix5}${PATH3}/${val6}` + + return { + post: (option?: { body?: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix6, POST, option).json(), + $post: (option?: { body?: Methods15['post']['reqBody'], headers?: Methods15['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix6, POST, option).json().then(r => r.body), + get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix6, GET, option).json(), + $get: (option?: { headers?: Methods15['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix6, GET, option).json().then(r => r.body) + } + } + } + } + }, + _chatId_1: (val7: string) => { + const prefix7 = `${PATH12}/${val7}` + + return { + items: { + audio: { + post: (option?: { body?: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH5}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods17['post']['reqBody'], headers?: Methods17['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH5}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH6}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods18['post']['reqBody'], headers?: Methods18['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH6}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH7}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods19['post']['reqBody'], headers?: Methods19['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH7}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods16['get']['query'], headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH3}`, GET, option).json(), + $get: (option?: { query?: Methods16['get']['query'], headers?: Methods16['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH3}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods16['post']['reqBody'], headers?: Methods16['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH3}`, POST, option).json(), + $post: (option: { body: Methods16['post']['reqBody'], headers?: Methods16['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix7}${PATH3}`, POST, option).json().then(r => r.body) + } + } + }, + keys: { + get: (option?: { headers?: Methods20['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH13, GET, option).json(), + $get: (option?: { headers?: Methods20['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH13, GET, option).json().then(r => r.body) + } + }, + extension: { + audio: { + post: (option?: { body?: Methods21['post']['reqBody'], headers?: Methods21['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH14, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods21['post']['reqBody'], headers?: Methods21['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH14, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods22['post']['reqBody'], headers?: Methods22['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH15, POST, option, 'FormData').json().then(r => r.body) + }, + parse: { + post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH16, POST, option).json(), + $post: (option: { body: Methods23['post']['reqBody'], headers?: Methods23['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH16, POST, option).json().then(r => r.body) + }, + story: { + _storyId: (val8: string) => { + const prefix8 = `${PATH17}/${val8}` + + return { + audio: { + post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH18}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods25['post']['reqBody'], headers?: Methods25['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH18}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH19}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods26['post']['reqBody'], headers?: Methods26['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH19}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH20}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods27['post']['reqBody'], headers?: Methods27['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix8}${PATH20}`, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option: { body: Methods24['post']['reqBody'], headers?: Methods24['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix8, POST, option, 'FormData').json(), + $post: (option: { body: Methods24['post']['reqBody'], headers?: Methods24['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix8, POST, option, 'FormData').json().then(r => r.body) + } + } + }, + video: { + post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH21, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods28['post']['reqBody'], headers?: Methods28['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH21, POST, option, 'FormData').json().then(r => r.body) + } + }, + fcm_token: { + post: (option: { body: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH22, POST, option).send(), + $post: (option: { body: Methods29['post']['reqBody'], headers?: Methods29['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH22, POST, option).send().then(r => r.body) + }, + info: { + get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH23, GET, option).json(), + $get: (option?: { headers?: Methods30['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH23, GET, option).json().then(r => r.body) + }, + login: { + post: (option: { body: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH24, POST, option).json(), + $post: (option: { body: Methods31['post']['reqBody'], headers?: Methods31['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH24, POST, option).json().then(r => r.body) + }, + logout: { + post: (option: { body: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH25, POST, option).send(), + $post: (option: { body: Methods32['post']['reqBody'], headers?: Methods32['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH25, POST, option).send().then(r => r.body) + }, + me: { + get: (option?: { headers?: Methods33['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH26, GET, option).json(), + $get: (option?: { headers?: Methods33['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH26, GET, option).json().then(r => r.body) + }, + organisation: { + users: { + get: (option: { query: Methods35['get']['query'], headers?: Methods35['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH28, GET, option).json(), + $get: (option: { query: Methods35['get']['query'], headers?: Methods35['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH28, GET, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods34['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH27, GET, option).json(), + $get: (option?: { headers?: Methods34['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH27, GET, option).json().then(r => r.body) + }, + stories: { + _storyId: (val9: number) => { + const prefix9 = `${PATH29}/${val9}` + + return { + items: { + _itemId: (val10: number) => { + const prefix10 = `${prefix9}${PATH3}/${val10}` + + return { + reaction: { + post: (option: { body: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH30}`, POST, option).json(), + $post: (option: { body: Methods38['post']['reqBody'], headers?: Methods38['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix10}${PATH30}`, POST, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods37['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix10, GET, option).json(), + $get: (option?: { headers?: Methods37['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix10, GET, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods36['get']['query'], headers?: Methods36['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix9}${PATH3}`, GET, option).json(), + $get: (option?: { query?: Methods36['get']['query'], headers?: Methods36['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix9}${PATH3}`, GET, option).json().then(r => r.body) + } + } + } + }, + user: { + _userId: (val11: string) => { + const prefix11 = `${PATH31}/${val11}` + + return { + get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, GET, option).json(), + $get: (option?: { headers?: Methods40['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix11, GET, option).json().then(r => r.body) + } + }, + profile: { + put: (option?: { body?: Methods41['put']['reqBody'], headers?: Methods41['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH32, PUT, option, 'FormData').send(), + $put: (option?: { body?: Methods41['put']['reqBody'], headers?: Methods41['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH32, PUT, option, 'FormData').send().then(r => r.body) + }, + get: (option?: { headers?: Methods39['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH31, GET, option).json(), + $get: (option?: { headers?: Methods39['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH31, GET, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/2fa/$api.ts b/samples/openapi/api/v3/2fa/$api.ts new file mode 100644 index 00000000..a4952740 --- /dev/null +++ b/samples/openapi/api/v3/2fa/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/2fa' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/channels/$api.ts b/samples/openapi/api/v3/channels/$api.ts new file mode 100644 index 00000000..326ccad8 --- /dev/null +++ b/samples/openapi/api/v3/channels/$api.ts @@ -0,0 +1,175 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_channelId@number/chats/_chatId@number/items/_itemId@number' +import { Methods as Methods2 } from './_channelId@number/news-feed' +import { Methods as Methods3 } from './_channelId@string' +import { Methods as Methods4 } from './_channelId@string/chats' +import { Methods as Methods5 } from './_channelId@string/chats/_chatId@string' +import { Methods as Methods6 } from './_channelId@string/chats/_chatId@string/items' +import { Methods as Methods7 } from './_channelId@string/chats/_chatId@string/items/audio' +import { Methods as Methods8 } from './_channelId@string/chats/_chatId@string/items/image' +import { Methods as Methods9 } from './_channelId@string/chats/_chatId@string/items/video' +import { Methods as Methods10 } from './_channelId@string/chats/_chatId@string/itemslist' +import { Methods as Methods11 } from './_channelId@string/chats/_chatId@string/users' +import { Methods as Methods12 } from './_channelId@string/chats/_chatId@string/users/remove' +import { Methods as Methods13 } from './_channelId@string/notifications' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/api/v3/channels' +const PATH1 = '/chats' +const PATH2 = '/items' +const PATH3 = '/news-feed' +const PATH4 = '/items/audio' +const PATH5 = '/items/image' +const PATH6 = '/items/video' +const PATH7 = '/itemslist' +const PATH8 = '/users' +const PATH9 = '/users/remove' +const PATH10 = '/notifications' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _channelId_0: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + chats: { + _chatId: (val1: number) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + items: { + _itemId: (val2: number) => { + const prefix2 = `${prefix1}${PATH2}/${val2}` + + return { + post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix2, POST, option).json(), + $post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix2, POST, option).json().then(r => r.body) + } + } + } + } + } + }, + news_feed: { + get: (option?: { query?: Methods2['get']['query'], headers?: Methods2['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, GET, option).json(), + $get: (option?: { query?: Methods2['get']['query'], headers?: Methods2['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, GET, option).json().then(r => r.body) + } + } + }, + _channelId_1: (val3: string) => { + const prefix3 = `${PATH0}/${val3}` + + return { + chats: { + _chatId: (val4: string) => { + const prefix4 = `${prefix3}${PATH1}/${val4}` + + return { + items: { + audio: { + post: (option?: { body?: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH4}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH4}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods8['post']['reqBody'], headers?: Methods8['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH5}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods8['post']['reqBody'], headers?: Methods8['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH5}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods9['post']['reqBody'], headers?: Methods9['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH6}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods9['post']['reqBody'], headers?: Methods9['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH6}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods6['get']['query'], headers?: Methods6['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH2}`, GET, option).json(), + $get: (option?: { query?: Methods6['get']['query'], headers?: Methods6['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH2}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods6['post']['reqBody'], headers?: Methods6['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods6['post']['reqBody'], headers?: Methods6['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH2}`, POST, option).json().then(r => r.body) + }, + itemslist: { + get: (option: { query: Methods10['get']['query'], headers?: Methods10['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH7}`, GET, option).json(), + $get: (option: { query: Methods10['get']['query'], headers?: Methods10['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH7}`, GET, option).json().then(r => r.body) + }, + users: { + remove: { + post: (option: { body: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, POST, option).send(), + $post: (option: { body: Methods12['post']['reqBody'], headers?: Methods12['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH9}`, POST, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, GET, option).json(), + $get: (option?: { headers?: Methods11['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods11['post']['reqBody'], headers?: Methods11['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, POST, option).send(), + $post: (option: { body: Methods11['post']['reqBody'], headers?: Methods11['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, POST, option).send().then(r => r.body), + put: (option: { body: Methods11['put']['reqBody'], headers?: Methods11['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, PUT, option).send(), + $put: (option: { body: Methods11['put']['reqBody'], headers?: Methods11['put']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix4}${PATH8}`, PUT, option).send().then(r => r.body) + }, + get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, GET, option).json(), + $get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, GET, option).json().then(r => r.body), + put: (option: { body: Methods5['put']['reqBody'], headers?: Methods5['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, PUT, option).send(), + $put: (option: { body: Methods5['put']['reqBody'], headers?: Methods5['put']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, PUT, option).send().then(r => r.body), + delete: (option?: { headers?: Methods5['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send(), + $delete: (option?: { headers?: Methods5['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix4, DELETE, option).send().then(r => r.body) + } + }, + get: (option?: { headers?: Methods4['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH1}`, GET, option).json(), + $get: (option?: { headers?: Methods4['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH1}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH1}`, POST, option).json(), + $post: (option: { body: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH1}`, POST, option).json().then(r => r.body) + }, + notifications: { + get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH10}`, GET, option).json(), + $get: (option?: { query?: Methods13['get']['query'], headers?: Methods13['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix3}${PATH10}`, GET, option).json().then(r => r.body) + }, + 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) + } + }, + get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/chats/$api.ts b/samples/openapi/api/v3/chats/$api.ts new file mode 100644 index 00000000..58553e8a --- /dev/null +++ b/samples/openapi/api/v3/chats/$api.ts @@ -0,0 +1,88 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_chatId@number/items/_itemId@number' +import { Methods as Methods1 } from './_chatId@string/items' +import { Methods as Methods2 } from './_chatId@string/items/audio' +import { Methods as Methods3 } from './_chatId@string/items/image' +import { Methods as Methods4 } from './_chatId@string/items/video' +import { Methods as Methods5 } from './keys' + +const GET = 'GET' +const POST = 'POST' +const PATH0 = '/api/v3/chats' +const PATH1 = '/items' +const PATH2 = '/items/audio' +const PATH3 = '/items/image' +const PATH4 = '/items/video' +const PATH5 = '/api/v3/chats/keys' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _chatId_0: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + items: { + _itemId: (val1: number) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, POST, option).json(), + $post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, POST, option).json().then(r => r.body), + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + } + } + } + }, + _chatId_1: (val2: string) => { + const prefix2 = `${PATH0}/${val2}` + + return { + items: { + audio: { + post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH2}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH3}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH4}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json(), + $get: (option?: { query?: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, GET, option).json().then(r => r.body), + post: (option: { body: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, POST, option).json(), + $post: (option: { body: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix2}${PATH1}`, POST, option).json().then(r => r.body) + } + } + }, + keys: { + get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH5, GET, option).json(), + $get: (option?: { headers?: Methods5['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH5, GET, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/chats/keys/$api.ts b/samples/openapi/api/v3/chats/keys/$api.ts new file mode 100644 index 00000000..f4027b73 --- /dev/null +++ b/samples/openapi/api/v3/chats/keys/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/v3/chats/keys' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/$api.ts b/samples/openapi/api/v3/extension/$api.ts new file mode 100644 index 00000000..d79170f8 --- /dev/null +++ b/samples/openapi/api/v3/extension/$api.ts @@ -0,0 +1,83 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './audio' +import { Methods as Methods1 } from './image' +import { Methods as Methods2 } from './parse' +import { Methods as Methods3 } from './story/_storyId@string' +import { Methods as Methods4 } from './story/_storyId@string/audio' +import { Methods as Methods5 } from './story/_storyId@string/image' +import { Methods as Methods6 } from './story/_storyId@string/video' +import { Methods as Methods7 } from './video' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/audio' +const PATH1 = '/api/v3/extension/image' +const PATH2 = '/api/v3/extension/parse' +const PATH3 = '/api/v3/extension/story' +const PATH4 = '/audio' +const PATH5 = '/image' +const PATH6 = '/video' +const PATH7 = '/api/v3/extension/video' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + audio: { + post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, POST, option, 'FormData').json().then(r => r.body) + }, + parse: { + post: (option: { body: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH2, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH2, POST, option).json().then(r => r.body) + }, + story: { + _storyId: (val0: string) => { + const prefix0 = `${PATH3}/${val0}` + + return { + audio: { + post: (option?: { body?: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods4['post']['reqBody'], headers?: Methods4['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH4}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods5['post']['reqBody'], headers?: Methods5['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods5['post']['reqBody'], headers?: Methods5['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH5}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods6['post']['reqBody'], headers?: Methods6['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH6}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods6['post']['reqBody'], headers?: Methods6['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH6}`, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option: { body: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, POST, option, 'FormData').json(), + $post: (option: { body: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, POST, option, 'FormData').json().then(r => r.body) + } + } + }, + video: { + post: (option?: { body?: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods7['post']['reqBody'], headers?: Methods7['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH7, POST, option, 'FormData').json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/audio/$api.ts b/samples/openapi/api/v3/extension/audio/$api.ts new file mode 100644 index 00000000..960c119c --- /dev/null +++ b/samples/openapi/api/v3/extension/audio/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/audio' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/image/$api.ts b/samples/openapi/api/v3/extension/image/$api.ts new file mode 100644 index 00000000..1c4abc60 --- /dev/null +++ b/samples/openapi/api/v3/extension/image/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/image' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/parse/$api.ts b/samples/openapi/api/v3/extension/parse/$api.ts new file mode 100644 index 00000000..f38fea3e --- /dev/null +++ b/samples/openapi/api/v3/extension/parse/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/parse' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/story/$api.ts b/samples/openapi/api/v3/extension/story/$api.ts new file mode 100644 index 00000000..7a8e3879 --- /dev/null +++ b/samples/openapi/api/v3/extension/story/$api.ts @@ -0,0 +1,49 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_storyId@string' +import { Methods as Methods1 } from './_storyId@string/audio' +import { Methods as Methods2 } from './_storyId@string/image' +import { Methods as Methods3 } from './_storyId@string/video' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/story' +const PATH1 = '/audio' +const PATH2 = '/image' +const PATH3 = '/video' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _storyId: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + audio: { + post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods1['post']['reqBody'], headers?: Methods1['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json().then(r => r.body) + }, + image: { + post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, POST, option, 'FormData').json().then(r => r.body) + }, + video: { + post: (option?: { body?: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods3['post']['reqBody'], headers?: Methods3['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, POST, option, 'FormData').json().then(r => r.body) + }, + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, POST, option, 'FormData').json(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, POST, option, 'FormData').json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/extension/video/$api.ts b/samples/openapi/api/v3/extension/video/$api.ts new file mode 100644 index 00000000..1157e2b6 --- /dev/null +++ b/samples/openapi/api/v3/extension/video/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/extension/video' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option, 'FormData').json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/fcm_token/$api.ts b/samples/openapi/api/v3/fcm_token/$api.ts new file mode 100644 index 00000000..36092732 --- /dev/null +++ b/samples/openapi/api/v3/fcm_token/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/fcm_token' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/info/$api.ts b/samples/openapi/api/v3/info/$api.ts new file mode 100644 index 00000000..56a8cd70 --- /dev/null +++ b/samples/openapi/api/v3/info/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/v3/info' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/login/$api.ts b/samples/openapi/api/v3/login/$api.ts new file mode 100644 index 00000000..1e1c9c00 --- /dev/null +++ b/samples/openapi/api/v3/login/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/login' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/logout/$api.ts b/samples/openapi/api/v3/logout/$api.ts new file mode 100644 index 00000000..a7da7d8d --- /dev/null +++ b/samples/openapi/api/v3/logout/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/api/v3/logout' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], headers?: Methods0['post']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/me/$api.ts b/samples/openapi/api/v3/me/$api.ts new file mode 100644 index 00000000..3a3ef147 --- /dev/null +++ b/samples/openapi/api/v3/me/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/v3/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/organisation/$api.ts b/samples/openapi/api/v3/organisation/$api.ts new file mode 100644 index 00000000..ca212edd --- /dev/null +++ b/samples/openapi/api/v3/organisation/$api.ts @@ -0,0 +1,27 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './users' + +const GET = 'GET' +const PATH0 = '/api/v3/organisation' +const PATH1 = '/api/v3/organisation/users' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + users: { + get: (option: { query: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option: { query: Methods1['get']['query'], headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/organisation/users/$api.ts b/samples/openapi/api/v3/organisation/users/$api.ts new file mode 100644 index 00000000..0a5019d3 --- /dev/null +++ b/samples/openapi/api/v3/organisation/users/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/api/v3/organisation/users' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + get: (option: { query: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option: { query: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/stories/$api.ts b/samples/openapi/api/v3/stories/$api.ts new file mode 100644 index 00000000..528683e9 --- /dev/null +++ b/samples/openapi/api/v3/stories/$api.ts @@ -0,0 +1,48 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_storyId@number/items' +import { Methods as Methods1 } from './_storyId@number/items/_itemId@number' +import { Methods as Methods2 } from './_storyId@number/items/_itemId@number/reaction' + +const GET = 'GET' +const POST = 'POST' +const PATH0 = '/api/v3/stories' +const PATH1 = '/items' +const PATH2 = '/reaction' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _storyId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + items: { + _itemId: (val1: number) => { + const prefix1 = `${prefix0}${PATH1}/${val1}` + + return { + reaction: { + post: (option: { body: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], headers?: Methods2['post']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix1}${PATH2}`, POST, option).json().then(r => r.body) + }, + get: (option?: { headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option?: { query?: Methods0['get']['query'], headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/user/$api.ts b/samples/openapi/api/v3/user/$api.ts new file mode 100644 index 00000000..2f35451d --- /dev/null +++ b/samples/openapi/api/v3/user/$api.ts @@ -0,0 +1,39 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_userId@string' +import { Methods as Methods2 } from './profile' + +const GET = 'GET' +const PUT = 'PUT' +const PATH0 = '/api/v3/user' +const PATH1 = '/api/v3/user/profile' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _userId: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { headers?: Methods1['get']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + profile: { + put: (option?: { body?: Methods2['put']['reqBody'], headers?: Methods2['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, PUT, option, 'FormData').send(), + $put: (option?: { body?: Methods2['put']['reqBody'], headers?: Methods2['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH1, PUT, option, 'FormData').send().then(r => r.body) + }, + get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { headers?: Methods0['get']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/openapi/api/v3/user/profile/$api.ts b/samples/openapi/api/v3/user/profile/$api.ts new file mode 100644 index 00000000..ce08736f --- /dev/null +++ b/samples/openapi/api/v3/user/profile/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const PUT = 'PUT' +const PATH0 = '/api/v3/user/profile' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + put: (option?: { body?: Methods0['put']['reqBody'], headers?: Methods0['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, PUT, option, 'FormData').send(), + $put: (option?: { body?: Methods0['put']['reqBody'], headers?: Methods0['put']['reqHeaders'], config?: T }) => + fetch(prefix, PATH0, PUT, option, 'FormData').send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/simple/$api.ts b/samples/simple/$api.ts index 22e9ac5a..a8f3efe6 100644 --- a/samples/simple/$api.ts +++ b/samples/simple/$api.ts @@ -1,80 +1,106 @@ /* eslint-disable */ import { AspidaClient, BasicHeaders } from 'aspida' -import { Methods as Methods0 } from './dummy/_id@number/content/index' -import { Methods as Methods1 } from './dummy/_id@number/query/index' -import { Methods as Methods2 } from './dummy/_id@number/simple/index' -import { Methods as Methods3 } from './file/_id@number/upload/index' -import { Methods as Methods4 } from './user/_id@number/index' -import { Methods as Methods5 } from './user/_id@number/abc/index' -import { Methods as Methods6 } from './user/_id@number/xyz/index' +import { Methods as Methods0 } from './dummy/_id@number/content' +import { Methods as Methods1 } from './dummy/_id@number/query' +import { Methods as Methods2 } from './dummy/_id@number/simple' +import { Methods as Methods3 } from './file/_id@number/upload' +import { Methods as Methods4 } from './user/_id@number' +import { Methods as Methods5 } from './user/_id@number/abc' +import { Methods as Methods6 } from './user/_id@number/xyz' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? '' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATCH = 'PATCH' +const PATH0 = '/dummy' +const PATH1 = '/content' +const PATH2 = '/query' +const PATH3 = '/simple' +const PATH4 = '/file' +const PATH5 = '/upload' +const PATH6 = '/user' +const PATH7 = '/abc' +const PATH8 = '/xyz' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') return { dummy: { - _id: (val0: number) => ({ - content: { - put: (option?: { config?: T }) => - client.fetch(prefix, `/dummy/${val0}/content`, 'PUT', option).text(), - $put: async (option?: { config?: T }) => - (await client.fetch(prefix, `/dummy/${val0}/content`, 'PUT', option).text()).body - }, - query: { - put: (option?: { query?: Methods1['put']['query'], config?: T }) => - client.fetch(prefix, `/dummy/${val0}/query`, 'PUT', option).send(), - $put: async (option?: { query?: Methods1['put']['query'], config?: T }) => - (await client.fetch(prefix, `/dummy/${val0}/query`, 'PUT', option).send()).body - }, - simple: { - put: (option?: { config?: T }) => - client.fetch(prefix, `/dummy/${val0}/simple`, 'PUT', option).send(), - $put: async (option?: { config?: T }) => - (await client.fetch(prefix, `/dummy/${val0}/simple`, 'PUT', option).send()).body + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + content: { + put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, PUT, option).text(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, PUT, option).text().then(r => r.body) + }, + query: { + put: (option?: { query?: Methods1['put']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send(), + $put: (option?: { query?: Methods1['put']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send().then(r => r.body) + }, + simple: { + put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, PUT, option).send(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, PUT, option).send().then(r => r.body) + } } - }) + } }, file: { - _id: (val1: number) => ({ - upload: { - post: (option?: { body?: Methods3['post']['reqBody'], query?: Methods3['post']['query'], config?: T }) => - client.fetch(prefix, `/file/${val1}/upload`, 'POST', option, 'Blob').send(), - $post: async (option?: { body?: Methods3['post']['reqBody'], query?: Methods3['post']['query'], config?: T }) => - (await client.fetch(prefix, `/file/${val1}/upload`, 'POST', option, 'Blob').send()).body + _id: (val1: number) => { + const prefix1 = `${PATH4}/${val1}` + + return { + upload: { + post: (option?: { body?: Methods3['post']['reqBody'], query?: Methods3['post']['query'], config?: T }) => + fetch(prefix, `${prefix1}${PATH5}`, POST, option, 'Blob').send(), + $post: (option?: { body?: Methods3['post']['reqBody'], query?: Methods3['post']['query'], config?: T }) => + fetch(prefix, `${prefix1}${PATH5}`, POST, option, 'Blob').send().then(r => r.body) + } } - }) + } }, user: { - _id: (val2: number) => ({ - abc: { - get: (option?: { query?: Methods5['get']['query'], config?: T }) => - client.fetch(prefix, `/user/${val2}/abc`, 'GET', option).send(), - $get: async (option?: { query?: Methods5['get']['query'], config?: T }) => - (await client.fetch(prefix, `/user/${val2}/abc`, 'GET', option).send()).body - }, - xyz: { + _id: (val2: number) => { + const prefix2 = `${PATH6}/${val2}` + + return { + abc: { + get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, `${prefix2}${PATH7}`, GET, option).send(), + $get: (option?: { query?: Methods5['get']['query'], config?: T }) => + fetch(prefix, `${prefix2}${PATH7}`, GET, option).send().then(r => r.body) + }, + xyz: { + get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH8}`, GET, option).send(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH8}`, GET, option).send().then(r => r.body), + put: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH8}`, PUT, option).send(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix2}${PATH8}`, PUT, option).send().then(r => r.body) + }, get: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}/xyz`, 'GET', option).send(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}/xyz`, 'GET', option).send()).body, - put: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}/xyz`, 'PUT', option).send(), - $put: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}/xyz`, 'PUT', option).send()).body - }, - get: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'GET', option).send(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'GET', option).send()).body, - patch: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'PATCH', option).send(), - $patch: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'PATCH', option).send()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'DELETE', option).send(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'DELETE', option).send()).body - }) + fetch(prefix, prefix2, GET, option).send(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix2, GET, option).send().then(r => r.body), + patch: (option?: { config?: T }) => + fetch(prefix, prefix2, PATCH, option).send(), + $patch: (option?: { config?: T }) => + fetch(prefix, prefix2, PATCH, option).send().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).send().then(r => r.body) + } + } } } } diff --git a/samples/simple/dummy/$api.ts b/samples/simple/dummy/$api.ts new file mode 100644 index 00000000..75b4a1d8 --- /dev/null +++ b/samples/simple/dummy/$api.ts @@ -0,0 +1,44 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@number/content' +import { Methods as Methods1 } from './_id@number/query' +import { Methods as Methods2 } from './_id@number/simple' + +const PUT = 'PUT' +const PATH0 = '/dummy' +const PATH1 = '/content' +const PATH2 = '/query' +const PATH3 = '/simple' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + content: { + put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, PUT, option).text(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, PUT, option).text().then(r => r.body) + }, + query: { + put: (option?: { query?: Methods1['put']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send(), + $put: (option?: { query?: Methods1['put']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send().then(r => r.body) + }, + simple: { + put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, PUT, option).send(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH3}`, PUT, option).send().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/simple/file/$api.ts b/samples/simple/file/$api.ts new file mode 100644 index 00000000..09e15ece --- /dev/null +++ b/samples/simple/file/$api.ts @@ -0,0 +1,28 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@number/upload' + +const POST = 'POST' +const PATH0 = '/file' +const PATH1 = '/upload' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + upload: { + post: (option?: { body?: Methods0['post']['reqBody'], query?: Methods0['post']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'Blob').send(), + $post: (option?: { body?: Methods0['post']['reqBody'], query?: Methods0['post']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'Blob').send().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/simple/user/$api.ts b/samples/simple/user/$api.ts new file mode 100644 index 00000000..5801af5d --- /dev/null +++ b/samples/simple/user/$api.ts @@ -0,0 +1,56 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@number' +import { Methods as Methods1 } from './_id@number/abc' +import { Methods as Methods2 } from './_id@number/xyz' + +const GET = 'GET' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATCH = 'PATCH' +const PATH0 = '/user' +const PATH1 = '/abc' +const PATH2 = '/xyz' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? '' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + abc: { + get: (option?: { query?: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).send(), + $get: (option?: { query?: Methods1['get']['query'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).send().then(r => r.body) + }, + xyz: { + get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).send(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, GET, option).send().then(r => r.body), + put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send(), + $put: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH2}`, PUT, option).send().then(r => r.body) + }, + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).send(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).send().then(r => r.body), + patch: (option?: { config?: T }) => + fetch(prefix, prefix0, PATCH, option).send(), + $patch: (option?: { config?: T }) => + fetch(prefix, prefix0, PATCH, option).send().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/$api.ts b/samples/strapi/$api.ts index 678ff281..c4e0f53e 100644 --- a/samples/strapi/$api.ts +++ b/samples/strapi/$api.ts @@ -1,194 +1,249 @@ /* eslint-disable */ import { AspidaClient, BasicHeaders } from 'aspida' -import { Methods as Methods0 } from './auth/_provider@string/callback/index' -import { Methods as Methods1 } from './auth/email-confirmation/index' -import { Methods as Methods2 } from './auth/forgot-password/index' -import { Methods as Methods3 } from './auth/local/index' -import { Methods as Methods4 } from './auth/local/register/index' -import { Methods as Methods5 } from './auth/reset-password/index' -import { Methods as Methods6 } from './auth/send-email-confirmation/index' -import { Methods as Methods7 } from './connect/_any/index' -import { Methods as Methods8 } from './email/index' -import { Methods as Methods9 } from './upload/index' -import { Methods as Methods10 } from './upload/files/index' -import { Methods as Methods11 } from './upload/files/_id@string/index' -import { Methods as Methods12 } from './upload/files/count/index' -import { Methods as Methods13 } from './upload/search/_id@string/index' -import { Methods as Methods14 } from './users/index' -import { Methods as Methods15 } from './users/_id@string/index' -import { Methods as Methods16 } from './users/me/index' -import { Methods as Methods17 } from './users-permissions/init/index' -import { Methods as Methods18 } from './users-permissions/roles/index' -import { Methods as Methods19 } from './users-permissions/roles/_id@string/index' -import { Methods as Methods20 } from './users-permissions/roles/_role@string/index' -import { Methods as Methods21 } from './users-permissions/search/_id@string/index' +import { Methods as Methods0 } from './auth/_provider@string/callback' +import { Methods as Methods1 } from './auth/email-confirmation' +import { Methods as Methods2 } from './auth/forgot-password' +import { Methods as Methods3 } from './auth/local' +import { Methods as Methods4 } from './auth/local/register' +import { Methods as Methods5 } from './auth/reset-password' +import { Methods as Methods6 } from './auth/send-email-confirmation' +import { Methods as Methods7 } from './connect/_any' +import { Methods as Methods8 } from './email' +import { Methods as Methods9 } from './upload' +import { Methods as Methods10 } from './upload/files' +import { Methods as Methods11 } from './upload/files/_id@string' +import { Methods as Methods12 } from './upload/files/count' +import { Methods as Methods13 } from './upload/search/_id@string' +import { Methods as Methods14 } from './users' +import { Methods as Methods15 } from './users/_id@string' +import { Methods as Methods16 } from './users/me' +import { Methods as Methods17 } from './users-permissions/init' +import { Methods as Methods18 } from './users-permissions/roles' +import { Methods as Methods19 } from './users-permissions/roles/_id@string' +import { Methods as Methods20 } from './users-permissions/roles/_role@string' +import { Methods as Methods21 } from './users-permissions/search/_id@string' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? 'http://localhost:1337' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/auth' +const PATH1 = '/callback' +const PATH2 = '/auth/email-confirmation' +const PATH3 = '/auth/forgot-password' +const PATH4 = '/auth/local' +const PATH5 = '/auth/local/register' +const PATH6 = '/auth/reset-password' +const PATH7 = '/auth/send-email-confirmation' +const PATH8 = '/connect' +const PATH9 = '/email' +const PATH10 = '/upload' +const PATH11 = '/upload/files' +const PATH12 = '/upload/files/count' +const PATH13 = '/upload/search' +const PATH14 = '/users' +const PATH15 = '/users/me' +const PATH16 = '/users-permissions/init' +const PATH17 = '/users-permissions/roles' +const PATH18 = '/users-permissions/search' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') return { auth: { - _provider: (val0: string) => ({ - callback: { - get: (option?: { config?: T }) => - client.fetch(prefix, `/auth/${val0}/callback`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/auth/${val0}/callback`, 'GET', option).json()).body + _provider: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + callback: { + get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body) + } } - }), + }, email_confirmation: { get: (option?: { config?: T }) => - client.fetch(prefix, '/auth/email-confirmation', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/auth/email-confirmation', 'GET', option).json()).body + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) }, forgot_password: { post: (option: { body: Methods2['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/auth/forgot-password', 'POST', option).json(), - $post: async (option: { body: Methods2['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/auth/forgot-password', 'POST', option).json()).body + fetch(prefix, PATH3, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option).json().then(r => r.body) }, local: { register: { post: (option: { body: Methods4['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/auth/local/register', 'POST', option).json(), - $post: async (option: { body: Methods4['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/auth/local/register', 'POST', option).json()).body + fetch(prefix, PATH5, POST, option).json(), + $post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json().then(r => r.body) }, post: (option: { body: Methods3['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/auth/local', 'POST', option).json(), - $post: async (option: { body: Methods3['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/auth/local', 'POST', option).json()).body + fetch(prefix, PATH4, POST, option).json(), + $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json().then(r => r.body) }, reset_password: { post: (option: { body: Methods5['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/auth/reset-password', 'POST', option).json(), - $post: async (option: { body: Methods5['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/auth/reset-password', 'POST', option).json()).body + fetch(prefix, PATH6, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).json().then(r => r.body) }, send_email_confirmation: { post: (option: { body: Methods6['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/auth/send-email-confirmation', 'POST', option).json(), - $post: async (option: { body: Methods6['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/auth/send-email-confirmation', 'POST', option).json()).body + fetch(prefix, PATH7, POST, option).json(), + $post: (option: { body: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json().then(r => r.body) } }, connect: { - _any: (val1: number | string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/connect/${val1}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/connect/${val1}`, 'GET', option).json()).body - }) + _any: (val1: number | string) => { + const prefix1 = `${PATH8}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + } }, email: { post: (option: { body: Methods8['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/email', 'POST', option).json(), - $post: async (option: { body: Methods8['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/email', 'POST', option).json()).body + fetch(prefix, PATH9, POST, option).json(), + $post: (option: { body: Methods8['post']['reqBody'], config?: T }) => + fetch(prefix, PATH9, POST, option).json().then(r => r.body) }, upload: { files: { - _id: (val2: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/upload/files/${val2}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/upload/files/${val2}`, 'GET', option).json()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/upload/files/${val2}`, 'DELETE', option).json(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/upload/files/${val2}`, 'DELETE', option).json()).body - }), + _id: (val2: string) => { + const prefix2 = `${PATH11}/${val2}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix2, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).json().then(r => r.body) + } + }, count: { get: (option?: { config?: T }) => - client.fetch(prefix, '/upload/files/count', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/upload/files/count', 'GET', option).json()).body + fetch(prefix, PATH12, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH12, GET, option).json().then(r => r.body) }, get: (option?: { config?: T }) => - client.fetch(prefix, '/upload/files', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/upload/files', 'GET', option).json()).body + fetch(prefix, PATH11, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH11, GET, option).json().then(r => r.body) }, search: { - _id: (val3: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/upload/search/${val3}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/upload/search/${val3}`, 'GET', option).json()).body - }) + _id: (val3: string) => { + const prefix3 = `${PATH13}/${val3}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix3, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix3, GET, option).json().then(r => r.body) + } + } }, post: (option: { body: Methods9['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/upload', 'POST', option).json(), - $post: async (option: { body: Methods9['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/upload', 'POST', option).json()).body + fetch(prefix, PATH10, POST, option).json(), + $post: (option: { body: Methods9['post']['reqBody'], config?: T }) => + fetch(prefix, PATH10, POST, option).json().then(r => r.body) }, users: { - _id: (val4: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/users/${val4}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users/${val4}`, 'GET', option).json()).body, - put: (option: { body: Methods15['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/users/${val4}`, 'PUT', option).json(), - $put: async (option: { body: Methods15['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users/${val4}`, 'PUT', option).json()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/users/${val4}`, 'DELETE', option).json(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users/${val4}`, 'DELETE', option).json()).body - }), + _id: (val4: string) => { + const prefix4 = `${PATH14}/${val4}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix4, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix4, GET, option).json().then(r => r.body), + put: (option: { body: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option).json(), + $put: (option: { body: Methods15['put']['reqBody'], config?: T }) => + fetch(prefix, prefix4, PUT, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix4, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix4, DELETE, option).json().then(r => r.body) + } + }, me: { get: (option?: { config?: T }) => - client.fetch(prefix, '/users/me', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/users/me', 'GET', option).json()).body + fetch(prefix, PATH15, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH15, GET, option).json().then(r => r.body) }, get: (option?: { query?: Methods14['get']['query'], config?: T }) => - client.fetch(prefix, '/users', 'GET', option).json(), - $get: async (option?: { query?: Methods14['get']['query'], config?: T }) => - (await client.fetch(prefix, '/users', 'GET', option).json()).body + fetch(prefix, PATH14, GET, option).json(), + $get: (option?: { query?: Methods14['get']['query'], config?: T }) => + fetch(prefix, PATH14, GET, option).json().then(r => r.body) }, users_permissions: { init: { get: (option?: { config?: T }) => - client.fetch(prefix, '/users-permissions/init', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/users-permissions/init', 'GET', option).json()).body + fetch(prefix, PATH16, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH16, GET, option).json().then(r => r.body) }, roles: { - _id: (val5: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/users-permissions/roles/${val5}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users-permissions/roles/${val5}`, 'GET', option).json()).body - }), - _role: (val6: string) => ({ - put: (option: { body: Methods20['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/users-permissions/roles/${val6}`, 'PUT', option).json(), - $put: async (option: { body: Methods20['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/users-permissions/roles/${val6}`, 'PUT', option).json()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/users-permissions/roles/${val6}`, 'DELETE', option).json(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/users-permissions/roles/${val6}`, 'DELETE', option).json()).body - }), + _id: (val5: string) => { + const prefix5 = `${PATH17}/${val5}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix5, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix5, GET, option).json().then(r => r.body) + } + }, + _role: (val6: string) => { + const prefix6 = `${PATH17}/${val6}` + + return { + put: (option: { body: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option).json(), + $put: (option: { body: Methods20['put']['reqBody'], config?: T }) => + fetch(prefix, prefix6, PUT, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix6, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix6, DELETE, option).json().then(r => r.body) + } + }, get: (option?: { query?: Methods18['get']['query'], config?: T }) => - client.fetch(prefix, '/users-permissions/roles', 'GET', option).json(), - $get: async (option?: { query?: Methods18['get']['query'], config?: T }) => - (await client.fetch(prefix, '/users-permissions/roles', 'GET', option).json()).body, + fetch(prefix, PATH17, GET, option).json(), + $get: (option?: { query?: Methods18['get']['query'], config?: T }) => + fetch(prefix, PATH17, GET, option).json().then(r => r.body), post: (option: { body: Methods18['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/users-permissions/roles', 'POST', option).json(), - $post: async (option: { body: Methods18['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/users-permissions/roles', 'POST', option).json()).body + fetch(prefix, PATH17, POST, option).json(), + $post: (option: { body: Methods18['post']['reqBody'], config?: T }) => + fetch(prefix, PATH17, POST, option).json().then(r => r.body) }, search: { - _id: (val7: string) => ({ - get: (option?: { query?: Methods21['get']['query'], config?: T }) => - client.fetch(prefix, `/users-permissions/search/${val7}`, 'GET', option).json(), - $get: async (option?: { query?: Methods21['get']['query'], config?: T }) => - (await client.fetch(prefix, `/users-permissions/search/${val7}`, 'GET', option).json()).body - }) + _id: (val7: string) => { + const prefix7 = `${PATH18}/${val7}` + + return { + get: (option?: { query?: Methods21['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json(), + $get: (option?: { query?: Methods21['get']['query'], config?: T }) => + fetch(prefix, prefix7, GET, option).json().then(r => r.body) + } + } } } } diff --git a/samples/strapi/auth/$api.ts b/samples/strapi/auth/$api.ts new file mode 100644 index 00000000..c03d5770 --- /dev/null +++ b/samples/strapi/auth/$api.ts @@ -0,0 +1,77 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_provider@string/callback' +import { Methods as Methods1 } from './email-confirmation' +import { Methods as Methods2 } from './forgot-password' +import { Methods as Methods3 } from './local' +import { Methods as Methods4 } from './local/register' +import { Methods as Methods5 } from './reset-password' +import { Methods as Methods6 } from './send-email-confirmation' + +const GET = 'GET' +const POST = 'POST' +const PATH0 = '/auth' +const PATH1 = '/callback' +const PATH2 = '/auth/email-confirmation' +const PATH3 = '/auth/forgot-password' +const PATH4 = '/auth/local' +const PATH5 = '/auth/local/register' +const PATH6 = '/auth/reset-password' +const PATH7 = '/auth/send-email-confirmation' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _provider: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + callback: { + get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, GET, option).json().then(r => r.body) + } + } + }, + email_confirmation: { + get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + forgot_password: { + post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option).json(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, PATH3, POST, option).json().then(r => r.body) + }, + local: { + register: { + post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json(), + $post: (option: { body: Methods4['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).json().then(r => r.body) + }, + post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json(), + $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json().then(r => r.body) + }, + reset_password: { + post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).json().then(r => r.body) + }, + send_email_confirmation: { + post: (option: { body: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json(), + $post: (option: { body: Methods6['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/email-confirmation/$api.ts b/samples/strapi/auth/email-confirmation/$api.ts new file mode 100644 index 00000000..133a4a20 --- /dev/null +++ b/samples/strapi/auth/email-confirmation/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/auth/email-confirmation' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/forgot-password/$api.ts b/samples/strapi/auth/forgot-password/$api.ts new file mode 100644 index 00000000..fdefd578 --- /dev/null +++ b/samples/strapi/auth/forgot-password/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/auth/forgot-password' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/local/$api.ts b/samples/strapi/auth/local/$api.ts new file mode 100644 index 00000000..d0cf0919 --- /dev/null +++ b/samples/strapi/auth/local/$api.ts @@ -0,0 +1,27 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './register' + +const POST = 'POST' +const PATH0 = '/auth/local' +const PATH1 = '/auth/local/register' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + register: { + post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json(), + $post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json().then(r => r.body) + }, + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/local/register/$api.ts b/samples/strapi/auth/local/register/$api.ts new file mode 100644 index 00000000..0a47ee76 --- /dev/null +++ b/samples/strapi/auth/local/register/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/auth/local/register' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/reset-password/$api.ts b/samples/strapi/auth/reset-password/$api.ts new file mode 100644 index 00000000..8525a428 --- /dev/null +++ b/samples/strapi/auth/reset-password/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/auth/reset-password' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/auth/send-email-confirmation/$api.ts b/samples/strapi/auth/send-email-confirmation/$api.ts new file mode 100644 index 00000000..804ae976 --- /dev/null +++ b/samples/strapi/auth/send-email-confirmation/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/auth/send-email-confirmation' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/connect/$api.ts b/samples/strapi/connect/$api.ts new file mode 100644 index 00000000..f39ab691 --- /dev/null +++ b/samples/strapi/connect/$api.ts @@ -0,0 +1,25 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_any' + +const GET = 'GET' +const PATH0 = '/connect' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _any: (val0: number | string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/email/$api.ts b/samples/strapi/email/$api.ts new file mode 100644 index 00000000..27739475 --- /dev/null +++ b/samples/strapi/email/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/email' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/upload/$api.ts b/samples/strapi/upload/$api.ts new file mode 100644 index 00000000..67f96411 --- /dev/null +++ b/samples/strapi/upload/$api.ts @@ -0,0 +1,66 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './files' +import { Methods as Methods2 } from './files/_id@string' +import { Methods as Methods3 } from './files/count' +import { Methods as Methods4 } from './search/_id@string' + +const GET = 'GET' +const POST = 'POST' +const DELETE = 'DELETE' +const PATH0 = '/upload' +const PATH1 = '/upload/files' +const PATH2 = '/upload/files/count' +const PATH3 = '/upload/search' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + files: { + _id: (val0: string) => { + const prefix0 = `${PATH1}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json().then(r => r.body) + } + }, + count: { + get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + search: { + _id: (val1: string) => { + const prefix1 = `${PATH3}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body) + } + } + }, + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/upload/files/$api.ts b/samples/strapi/upload/files/$api.ts new file mode 100644 index 00000000..0987d79d --- /dev/null +++ b/samples/strapi/upload/files/$api.ts @@ -0,0 +1,43 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@string' +import { Methods as Methods2 } from './count' + +const GET = 'GET' +const DELETE = 'DELETE' +const PATH0 = '/upload/files' +const PATH1 = '/upload/files/count' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json().then(r => r.body) + } + }, + count: { + get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/upload/files/count/$api.ts b/samples/strapi/upload/files/count/$api.ts new file mode 100644 index 00000000..d04d8d80 --- /dev/null +++ b/samples/strapi/upload/files/count/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/upload/files/count' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/upload/search/$api.ts b/samples/strapi/upload/search/$api.ts new file mode 100644 index 00000000..85433cdf --- /dev/null +++ b/samples/strapi/upload/search/$api.ts @@ -0,0 +1,25 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@string' + +const GET = 'GET' +const PATH0 = '/upload/search' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users-permissions/$api.ts b/samples/strapi/users-permissions/$api.ts new file mode 100644 index 00000000..4d30d534 --- /dev/null +++ b/samples/strapi/users-permissions/$api.ts @@ -0,0 +1,76 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './init' +import { Methods as Methods1 } from './roles' +import { Methods as Methods2 } from './roles/_id@string' +import { Methods as Methods3 } from './roles/_role@string' +import { Methods as Methods4 } from './search/_id@string' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/users-permissions/init' +const PATH1 = '/users-permissions/roles' +const PATH2 = '/users-permissions/search' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + init: { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + }, + roles: { + _id: (val0: string) => { + const prefix0 = `${PATH1}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + _role: (val1: string) => { + const prefix1 = `${PATH1}/${val1}` + + return { + put: (option: { body: Methods3['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).json(), + $put: (option: { body: Methods3['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).json().then(r => r.body) + } + }, + get: (option?: { query?: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { query?: Methods1['get']['query'], config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body), + post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json(), + $post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json().then(r => r.body) + }, + search: { + _id: (val2: string) => { + const prefix2 = `${PATH2}/${val2}` + + return { + get: (option?: { query?: Methods4['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $get: (option?: { query?: Methods4['get']['query'], config?: T }) => + fetch(prefix, prefix2, GET, option).json().then(r => r.body) + } + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users-permissions/init/$api.ts b/samples/strapi/users-permissions/init/$api.ts new file mode 100644 index 00000000..9bae43ab --- /dev/null +++ b/samples/strapi/users-permissions/init/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/users-permissions/init' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users-permissions/roles/$api.ts b/samples/strapi/users-permissions/roles/$api.ts new file mode 100644 index 00000000..d060d823 --- /dev/null +++ b/samples/strapi/users-permissions/roles/$api.ts @@ -0,0 +1,52 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@string' +import { Methods as Methods2 } from './_role@string' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/users-permissions/roles' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + }, + _role: (val1: string) => { + const prefix1 = `${PATH0}/${val1}` + + return { + put: (option: { body: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).json(), + $put: (option: { body: Methods2['put']['reqBody'], config?: T }) => + fetch(prefix, prefix1, PUT, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).json().then(r => r.body) + } + }, + 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), + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users-permissions/search/$api.ts b/samples/strapi/users-permissions/search/$api.ts new file mode 100644 index 00000000..6244138e --- /dev/null +++ b/samples/strapi/users-permissions/search/$api.ts @@ -0,0 +1,25 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './_id@string' + +const GET = 'GET' +const PATH0 = '/users-permissions/search' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { query?: Methods0['get']['query'], config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body) + } + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users/$api.ts b/samples/strapi/users/$api.ts new file mode 100644 index 00000000..876053ab --- /dev/null +++ b/samples/strapi/users/$api.ts @@ -0,0 +1,48 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_id@string' +import { Methods as Methods2 } from './me' + +const GET = 'GET' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/users' +const PATH1 = '/users/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + _id: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $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).json(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).json().then(r => r.body) + } + }, + me: { + get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH1, GET, option).json().then(r => r.body) + }, + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/strapi/users/me/$api.ts b/samples/strapi/users/me/$api.ts new file mode 100644 index 00000000..a29aadad --- /dev/null +++ b/samples/strapi/users/me/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/users/me' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'http://localhost:1337' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/$api.ts b/samples/swagger/$api.ts index 9322f9d5..b0f244d5 100644 --- a/samples/swagger/$api.ts +++ b/samples/swagger/$api.ts @@ -1,125 +1,144 @@ /* eslint-disable */ import { AspidaClient, BasicHeaders } from 'aspida' -import { Methods as Methods0 } from './pet/index' -import { Methods as Methods1 } from './pet/_petId@number/index' -import { Methods as Methods2 } from './pet/_petId@number/uploadImage/index' -import { Methods as Methods3 } from './pet/findByStatus/index' -import { Methods as Methods4 } from './store/inventory/index' -import { Methods as Methods5 } from './store/order/index' -import { Methods as Methods6 } from './store/order/_orderId@number/index' -import { Methods as Methods7 } from './user/index' -import { Methods as Methods8 } from './user/_username@string/index' -import { Methods as Methods9 } from './user/createWithArray/index' -import { Methods as Methods10 } from './user/createWithList/index' -import { Methods as Methods11 } from './user/login/index' +import { Methods as Methods0 } from './pet' +import { Methods as Methods1 } from './pet/_petId@number' +import { Methods as Methods2 } from './pet/_petId@number/uploadImage' +import { Methods as Methods3 } from './pet/findByStatus' +import { Methods as Methods4 } from './store/inventory' +import { Methods as Methods5 } from './store/order' +import { Methods as Methods6 } from './store/order/_orderId@number' +import { Methods as Methods7 } from './user' +import { Methods as Methods8 } from './user/_username@string' +import { Methods as Methods9 } from './user/createWithArray' +import { Methods as Methods10 } from './user/createWithList' +import { Methods as Methods11 } from './user/login' -const api = (client: AspidaClient) => { - const prefix = (client.baseURL === undefined ? 'https://petstore.swagger.io/v2' : client.baseURL).replace(/\/$/, '') +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/pet' +const PATH1 = '/uploadImage' +const PATH2 = '/pet/findByStatus' +const PATH3 = '/store/inventory' +const PATH4 = '/store/order' +const PATH5 = '/user' +const PATH6 = '/user/createWithArray' +const PATH7 = '/user/createWithList' +const PATH8 = '/user/login' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') return { pet: { - _petId: (val0: number) => ({ - uploadImage: { - post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/pet/${val0}/uploadImage`, 'POST', option, 'FormData').json(), - $post: async (option?: { body?: Methods2['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/pet/${val0}/uploadImage`, 'POST', option, 'FormData').json()).body - }, - get: (option?: { config?: T }) => - client.fetch(prefix, `/pet/${val0}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/pet/${val0}`, 'GET', option).json()).body, - post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - client.fetch(prefix, `/pet/${val0}`, 'POST', option, 'URLSearchParams').send(), - $post: async (option?: { body?: Methods1['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/pet/${val0}`, 'POST', option, 'URLSearchParams').send()).body, - delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - client.fetch(prefix, `/pet/${val0}`, 'DELETE', option).send(), - $delete: async (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => - (await client.fetch(prefix, `/pet/${val0}`, 'DELETE', option).send()).body - }), + _petId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + uploadImage: { + post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $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(), + $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + 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(), + $delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, findByStatus: { get: (option: { query: Methods3['get']['query'], config?: T }) => - client.fetch(prefix, '/pet/findByStatus', 'GET', option).json(), - $get: async (option: { query: Methods3['get']['query'], config?: T }) => - (await client.fetch(prefix, '/pet/findByStatus', 'GET', option).json()).body + fetch(prefix, PATH2, GET, option).json(), + $get: (option: { query: Methods3['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) }, post: (option: { body: Methods0['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/pet', 'POST', option).send(), - $post: async (option: { body: Methods0['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/pet', 'POST', option).send()).body, + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body), put: (option: { body: Methods0['put']['reqBody'], config?: T }) => - client.fetch(prefix, '/pet', 'PUT', option).send(), - $put: async (option: { body: Methods0['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/pet', 'PUT', option).send()).body + fetch(prefix, PATH0, PUT, option).send(), + $put: (option: { body: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, PATH0, PUT, option).send().then(r => r.body) }, store: { inventory: { get: (option?: { config?: T }) => - client.fetch(prefix, '/store/inventory', 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/store/inventory', 'GET', option).json()).body + fetch(prefix, PATH3, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH3, GET, option).json().then(r => r.body) }, order: { - _orderId: (val1: number) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/store/order/${val1}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/store/order/${val1}`, 'GET', option).json()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/store/order/${val1}`, 'DELETE', option).send(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/store/order/${val1}`, 'DELETE', option).send()).body - }), + _orderId: (val1: number) => { + const prefix1 = `${PATH4}/${val1}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix1, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix1, DELETE, option).send().then(r => r.body) + } + }, post: (option: { body: Methods5['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/store/order', 'POST', option).json(), - $post: async (option: { body: Methods5['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/store/order', 'POST', option).json()).body + fetch(prefix, PATH4, POST, option).json(), + $post: (option: { body: Methods5['post']['reqBody'], config?: T }) => + fetch(prefix, PATH4, POST, option).json().then(r => r.body) } }, user: { - _username: (val2: string) => ({ - get: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'GET', option).json(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'GET', option).json()).body, - put: (option: { body: Methods8['put']['reqBody'], config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'PUT', option).send(), - $put: async (option: { body: Methods8['put']['reqBody'], config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'PUT', option).send()).body, - delete: (option?: { config?: T }) => - client.fetch(prefix, `/user/${val2}`, 'DELETE', option).send(), - $delete: async (option?: { config?: T }) => - (await client.fetch(prefix, `/user/${val2}`, 'DELETE', option).send()).body - }), + _username: (val2: string) => { + const prefix2 = `${PATH5}/${val2}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix2, GET, option).json(), + $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(), + $put: (option: { body: Methods8['put']['reqBody'], config?: T }) => + fetch(prefix, prefix2, PUT, option).send().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix2, DELETE, option).send().then(r => r.body) + } + }, createWithArray: { post: (option: { body: Methods9['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/user/createWithArray', 'POST', option).send(), - $post: async (option: { body: Methods9['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/user/createWithArray', 'POST', option).send()).body + fetch(prefix, PATH6, POST, option).send(), + $post: (option: { body: Methods9['post']['reqBody'], config?: T }) => + fetch(prefix, PATH6, POST, option).send().then(r => r.body) }, createWithList: { post: (option: { body: Methods10['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/user/createWithList', 'POST', option).send(), - $post: async (option: { body: Methods10['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/user/createWithList', 'POST', option).send()).body + fetch(prefix, PATH7, POST, option).send(), + $post: (option: { body: Methods10['post']['reqBody'], config?: T }) => + fetch(prefix, PATH7, POST, option).send().then(r => r.body) }, login: { get: (option: { query: Methods11['get']['query'], config?: T }) => - client.fetch(prefix, '/user/login', 'GET', option).text(), - $get: async (option: { query: Methods11['get']['query'], config?: T }) => - (await client.fetch(prefix, '/user/login', 'GET', option).text()).body - }, - logout: { - get: (option?: { config?: T }) => - client.fetch(prefix, '/user/logout', 'GET', option).send(), - $get: async (option?: { config?: T }) => - (await client.fetch(prefix, '/user/logout', 'GET', option).send()).body + fetch(prefix, PATH8, GET, option).text(), + $get: (option: { query: Methods11['get']['query'], config?: T }) => + fetch(prefix, PATH8, GET, option).text().then(r => r.body) }, post: (option: { body: Methods7['post']['reqBody'], config?: T }) => - client.fetch(prefix, '/user', 'POST', option).send(), - $post: async (option: { body: Methods7['post']['reqBody'], config?: T }) => - (await client.fetch(prefix, '/user', 'POST', option).send()).body + fetch(prefix, PATH5, POST, option).send(), + $post: (option: { body: Methods7['post']['reqBody'], config?: T }) => + fetch(prefix, PATH5, POST, option).send().then(r => r.body) } } } diff --git a/samples/swagger/pet/$api.ts b/samples/swagger/pet/$api.ts new file mode 100644 index 00000000..d546860d --- /dev/null +++ b/samples/swagger/pet/$api.ts @@ -0,0 +1,61 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_petId@number' +import { Methods as Methods2 } from './_petId@number/uploadImage' +import { Methods as Methods3 } from './findByStatus' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/pet' +const PATH1 = '/uploadImage' +const PATH2 = '/pet/findByStatus' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + _petId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + uploadImage: { + post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json(), + $post: (option?: { body?: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, `${prefix0}${PATH1}`, POST, option, 'FormData').json().then(r => r.body) + }, + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $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(), + $post: (option?: { body?: Methods1['post']['reqBody'], config?: T }) => + 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(), + $delete: (option?: { headers?: Methods1['delete']['reqHeaders'], config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + findByStatus: { + get: (option: { query: Methods3['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json(), + $get: (option: { query: Methods3['get']['query'], config?: T }) => + fetch(prefix, PATH2, GET, option).json().then(r => r.body) + }, + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body), + put: (option: { body: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, PATH0, PUT, option).send(), + $put: (option: { body: Methods0['put']['reqBody'], config?: T }) => + fetch(prefix, PATH0, PUT, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/pet/findByStatus/$api.ts b/samples/swagger/pet/findByStatus/$api.ts new file mode 100644 index 00000000..b16897b1 --- /dev/null +++ b/samples/swagger/pet/findByStatus/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/pet/findByStatus' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + 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) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/store/$api.ts b/samples/swagger/store/$api.ts new file mode 100644 index 00000000..e6cf286d --- /dev/null +++ b/samples/swagger/store/$api.ts @@ -0,0 +1,46 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './inventory' +import { Methods as Methods1 } from './order' +import { Methods as Methods2 } from './order/_orderId@number' + +const GET = 'GET' +const POST = 'POST' +const DELETE = 'DELETE' +const PATH0 = '/store/inventory' +const PATH1 = '/store/order' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + inventory: { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + }, + order: { + _orderId: (val0: number) => { + const prefix0 = `${PATH1}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json(), + $post: (option: { body: Methods1['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).json().then(r => r.body) + } + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/store/inventory/$api.ts b/samples/swagger/store/inventory/$api.ts new file mode 100644 index 00000000..5271179d --- /dev/null +++ b/samples/swagger/store/inventory/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/store/inventory' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, PATH0, GET, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/store/order/$api.ts b/samples/swagger/store/order/$api.ts new file mode 100644 index 00000000..655b372d --- /dev/null +++ b/samples/swagger/store/order/$api.ts @@ -0,0 +1,36 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_orderId@number' + +const GET = 'GET' +const POST = 'POST' +const DELETE = 'DELETE' +const PATH0 = '/store/order' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + _orderId: (val0: number) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).json().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/user/$api.ts b/samples/swagger/user/$api.ts new file mode 100644 index 00000000..9b69a3f0 --- /dev/null +++ b/samples/swagger/user/$api.ts @@ -0,0 +1,65 @@ +/* eslint-disable */ +import { AspidaClient, BasicHeaders } from 'aspida' +import { Methods as Methods0 } from './index' +import { Methods as Methods1 } from './_username@string' +import { Methods as Methods2 } from './createWithArray' +import { Methods as Methods3 } from './createWithList' +import { Methods as Methods4 } from './login' + +const GET = 'GET' +const POST = 'POST' +const PUT = 'PUT' +const DELETE = 'DELETE' +const PATH0 = '/user' +const PATH1 = '/user/createWithArray' +const PATH2 = '/user/createWithList' +const PATH3 = '/user/login' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + _username: (val0: string) => { + const prefix0 = `${PATH0}/${val0}` + + return { + get: (option?: { config?: T }) => + fetch(prefix, prefix0, GET, option).json(), + $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(), + $put: (option: { body: Methods1['put']['reqBody'], config?: T }) => + fetch(prefix, prefix0, PUT, option).send().then(r => r.body), + delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send(), + $delete: (option?: { config?: T }) => + fetch(prefix, prefix0, DELETE, option).send().then(r => r.body) + } + }, + createWithArray: { + post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).send(), + $post: (option: { body: Methods2['post']['reqBody'], config?: T }) => + fetch(prefix, PATH1, POST, option).send().then(r => r.body) + }, + createWithList: { + post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH2, POST, option).send(), + $post: (option: { body: Methods3['post']['reqBody'], config?: T }) => + fetch(prefix, PATH2, POST, option).send().then(r => r.body) + }, + login: { + get: (option: { query: Methods4['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).text(), + $get: (option: { query: Methods4['get']['query'], config?: T }) => + fetch(prefix, PATH3, GET, option).text().then(r => r.body) + }, + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/user/createWithArray/$api.ts b/samples/swagger/user/createWithArray/$api.ts new file mode 100644 index 00000000..9751c5a9 --- /dev/null +++ b/samples/swagger/user/createWithArray/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/user/createWithArray' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/user/createWithList/$api.ts b/samples/swagger/user/createWithList/$api.ts new file mode 100644 index 00000000..139a3b57 --- /dev/null +++ b/samples/swagger/user/createWithList/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient } from 'aspida' +import { Methods as Methods0 } from './index' + +const POST = 'POST' +const PATH0 = '/user/createWithList' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send(), + $post: (option: { body: Methods0['post']['reqBody'], config?: T }) => + fetch(prefix, PATH0, POST, option).send().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/user/login/$api.ts b/samples/swagger/user/login/$api.ts new file mode 100644 index 00000000..34a40445 --- /dev/null +++ b/samples/swagger/user/login/$api.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { AspidaClient } from 'aspida' +import { Methods as Methods0 } from './index' + +const GET = 'GET' +const PATH0 = '/user/login' +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, PATH0, GET, option).text(), + $get: (option: { query: Methods0['get']['query'], config?: T }) => + fetch(prefix, PATH0, GET, option).text().then(r => r.body) + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/samples/swagger/user/logout/$api.ts b/samples/swagger/user/logout/$api.ts new file mode 100644 index 00000000..f9e0e2cf --- /dev/null +++ b/samples/swagger/user/logout/$api.ts @@ -0,0 +1,14 @@ +/* eslint-disable */ +import { AspidaClient } from 'aspida' + + +const api = ({ baseURL, fetch }: AspidaClient) => { + const prefix = (baseURL === undefined ? 'https://petstore.swagger.io/v2' : baseURL).replace(/\/$/, '') + + return { + + } +} + +export type ApiInstance = ReturnType +export default api diff --git a/src/cli/build.ts b/src/cli/build.ts index 9196b1e1..2b3c0d1b 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -29,7 +29,7 @@ type BuildCommand = { } export type BuildIO = { - write(outputDir: string, trailingSlash: boolean, template: Template): void + write(outputDir: string, trailingSlash: boolean, outputEachDir: boolean, template: Template): void } export class Build implements BuildCommand { @@ -46,6 +46,7 @@ export class Build implements BuildCommand { io.write( config.output, config.trailingSlash, + config.outputEachDir, await build(config.input, config.isYaml, config.needsMock, config.needsMockType) ) } diff --git a/src/getConfig.ts b/src/getConfig.ts index 18114406..a54fb6eb 100644 --- a/src/getConfig.ts +++ b/src/getConfig.ts @@ -6,6 +6,7 @@ export type Config = { input: string | OpenAPI.Document output: string trailingSlash: boolean + outputEachDir: boolean isYaml: boolean needsMock: boolean needsMockType: boolean @@ -27,6 +28,7 @@ const createConfig = (config: ConfigFile) => { input: openapi.inputFile, output: config.input, trailingSlash: config.trailingSlash, + outputEachDir: config.outputEachDir, isYaml: openapi.yaml ?? path.extname(openapi.inputFile).slice(1) === 'yaml', needsMock: !!openapi.mock, needsMockType: !openapi.noMockType diff --git a/src/writeRouteFile.ts b/src/writeRouteFile.ts index aadb37f3..9937d3a8 100644 --- a/src/writeRouteFile.ts +++ b/src/writeRouteFile.ts @@ -3,7 +3,12 @@ import aspidaBuild from 'aspida/dist/buildTemplate' import aspidaWrite from 'aspida/dist/writeRouteFile' import { Template } from './buildTemplate' -export default (input: string, trailingSlash: boolean, { baseURL, types, files }: Template) => { +export default ( + input: string, + trailingSlash: boolean, + outputEachDir: boolean, + { baseURL, types, files }: Template +) => { if (types) { fs.writeFileSync(`${input}/@types.ts`, types, 'utf8') } @@ -20,6 +25,5 @@ export default (input: string, trailingSlash: boolean, { baseURL, types, files } fs.writeFileSync(`${input}/${p.file.join('/')}/${fileName}.ts`, p.methods, 'utf8') }) - const config = { input, baseURL, trailingSlash } - aspidaWrite(aspidaBuild(config)) + aspidaBuild({ input, baseURL, trailingSlash, outputEachDir }).forEach(aspidaWrite) } diff --git a/yarn.lock b/yarn.lock index a53621b3..b1a2f491 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1027,10 +1027,10 @@ asn1@~0.2.3: dependencies: safer-buffer "~2.1.0" -aspida@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/aspida/-/aspida-0.18.0.tgz#7b8dcad290b6e24d9efe57e0a4a07f1ebd689d7d" - integrity sha512-xHdMjYHncV4oRi4BuM4ytx8FgehaPsCgeI9T5/PqHWX0TzuSl7y3QqEkN3Q7PTmtWD6uVLXUHdocg0ipwBNSag== +aspida@^0.19.2: + version "0.19.2" + resolved "https://registry.yarnpkg.com/aspida/-/aspida-0.19.2.tgz#03ea0f39a142c4c060b05f2e2d8068f6d719661c" + integrity sha512-GJ9aqZpP5lSYPDrUyjcVHY6zU2Q8ZkJKmy1Tefmfjr0EAUP0HVao1nzuVkp6whw6yrpeoJq5xADZmVoLS0sa8Q== dependencies: chokidar "^3.4.0" minimist "^1.2.5"