diff --git a/.changeset/clean-badgers-heal.md b/.changeset/clean-badgers-heal.md new file mode 100644 index 000000000..d738f86b2 --- /dev/null +++ b/.changeset/clean-badgers-heal.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: make TanStack Query plugin work with class-based services diff --git a/eslint.config.js b/eslint.config.js index 2e8115f33..21f7b0d79 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -61,6 +61,7 @@ export default tseslint.config( 'packages/openapi-ts/src/legacy/handlebars/templates/**/*.hbs', '**/test/e2e/generated/', '**/test/generated/', + '**/__snapshots__/', '**/.svelte-kit/', '**/.vitepress/cache', '**/.vitepress/dist', diff --git a/packages/openapi-ts/src/generate/transformers.ts b/packages/openapi-ts/src/generate/transformers.ts index b5ad144da..805a207ec 100644 --- a/packages/openapi-ts/src/generate/transformers.ts +++ b/packages/openapi-ts/src/generate/transformers.ts @@ -1,6 +1,7 @@ import ts from 'typescript'; import { compiler } from '../compiler'; +import { getOperationKey } from '../openApi/common/parser/operation'; import type { ModelMeta, OperationResponse } from '../types/client'; import { getConfig } from '../utils/config'; import { isModelDate, unsetUniqueTypeName } from '../utils/type'; @@ -270,7 +271,7 @@ export const generateResponseTransformers = async ({ if (nonVoidResponses.length > 1) { if (config.debug) { console.warn( - `❗️ Transformers warning: route ${operation.method} ${operation.path} has ${nonVoidResponses.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`, + `❗️ Transformers warning: route ${getOperationKey(operation)} has ${nonVoidResponses.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`, ); } continue; diff --git a/packages/openapi-ts/src/openApi/common/parser/operation.ts b/packages/openapi-ts/src/openApi/common/parser/operation.ts index d634c2e8c..f6cf6f2ea 100644 --- a/packages/openapi-ts/src/openApi/common/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/common/parser/operation.ts @@ -3,6 +3,14 @@ import type { OperationResponse, } from '../interfaces/client'; +export const getOperationKey = (operation: { + method: string; + path: string; +}) => { + const operationKey = `${operation.method} ${operation.path}`; + return operationKey; +}; + export const getOperationResponseHeader = ( operationResponses: OperationResponse[], ): string | null => { diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts index 69f2cfb67..696eae6ff 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts @@ -1,4 +1,5 @@ import type { Client, Operation } from '../../common/interfaces/client'; +import { getOperationKey } from '../../common/parser/operation'; import { allowedServiceMethods } from '../../common/parser/service'; import { getConfig } from '../../config'; import type { OpenApi } from '../interfaces/OpenApi'; @@ -17,21 +18,24 @@ export const getOperations = ({ const operationIds = new Map(); const operations: Operation[] = []; - for (const url in openApi.paths) { - const path = openApi.paths[url]; + for (const path in openApi.paths) { + const pathItem = openApi.paths[path]; const pathParameters = getOperationParameters({ openApi, - parameters: path.parameters ?? [], + parameters: pathItem.parameters ?? [], types, }); - for (const key in path) { + for (const key in pathItem) { const method = key as Lowercase; - const operationKey = `${method.toUpperCase()} ${url}`; + const operationKey = getOperationKey({ + method: method.toUpperCase(), + path, + }); if (allowedServiceMethods.includes(method)) { - const op = path[method]!; + const op = pathItem[method]!; if (op.operationId) { if (operationIds.has(op.operationId)) { @@ -53,7 +57,7 @@ export const getOperations = ({ openApi, pathParams: pathParameters, types, - url, + url: path, }); operations.push(operation); } diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts index 69f2cfb67..696eae6ff 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts @@ -1,4 +1,5 @@ import type { Client, Operation } from '../../common/interfaces/client'; +import { getOperationKey } from '../../common/parser/operation'; import { allowedServiceMethods } from '../../common/parser/service'; import { getConfig } from '../../config'; import type { OpenApi } from '../interfaces/OpenApi'; @@ -17,21 +18,24 @@ export const getOperations = ({ const operationIds = new Map(); const operations: Operation[] = []; - for (const url in openApi.paths) { - const path = openApi.paths[url]; + for (const path in openApi.paths) { + const pathItem = openApi.paths[path]; const pathParameters = getOperationParameters({ openApi, - parameters: path.parameters ?? [], + parameters: pathItem.parameters ?? [], types, }); - for (const key in path) { + for (const key in pathItem) { const method = key as Lowercase; - const operationKey = `${method.toUpperCase()} ${url}`; + const operationKey = getOperationKey({ + method: method.toUpperCase(), + path, + }); if (allowedServiceMethods.includes(method)) { - const op = path[method]!; + const op = pathItem[method]!; if (op.operationId) { if (operationIds.has(op.operationId)) { @@ -53,7 +57,7 @@ export const getOperations = ({ openApi, pathParams: pathParameters, types, - url, + url: path, }); operations.push(operation); } diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 9026ddb67..d677d0d62 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -16,6 +16,7 @@ import { toOperationName, } from '../../../generate/services'; import { isOperationParameterRequired } from '../../../openApi'; +import { getOperationKey } from '../../../openApi/common/parser/operation'; import type { Client } from '../../../types/client'; import type { Method, @@ -25,6 +26,7 @@ import type { } from '../../../types/client'; import type { Files } from '../../../types/utils'; import { getConfig } from '../../../utils/config'; +import { transformServiceName } from '../../../utils/transform'; import type { PluginDefinition } from '../../types'; const toInfiniteQueryOptionsName = (operation: Operation) => @@ -471,6 +473,7 @@ export const handler: PluginDefinition['handler'] = ({ checkPrerequisites({ files }); + const config = getConfig(); const file = files[plugin.name]; file.import({ @@ -495,9 +498,23 @@ export const handler: PluginDefinition['handler'] = ({ let hasMutations = false; let hasQueries = false; + const processedOperations = new Map(); + for (const service of client.services) { for (const operation of service.operations) { - const queryFn = toOperationName(operation, true); + // track processed operations to avoid creating duplicates + const operationKey = getOperationKey(operation); + if (processedOperations.has(operationKey)) { + continue; + } + processedOperations.set(operationKey, true); + + const queryFn = [ + config.services.asClass && transformServiceName(service.name), + toOperationName(operation, !config.services.asClass), + ] + .filter(Boolean) + .join('.'); let hasUsedQueryFn = false; // queries @@ -1149,7 +1166,7 @@ export const handler: PluginDefinition['handler'] = ({ if (hasUsedQueryFn) { file.import({ module: servicesModulePath, - name: queryFn, + name: queryFn.split('.')[0], }); } } diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts index 343d3c8f7..56bade120 100644 --- a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts @@ -1,2 +1,2 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './types.gen'; +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts new file mode 100644 index 000000000..9cac1815e --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/react-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts index c0c16d891..a48ba3ea4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ @@ -1097,10 +974,6 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - export type GetApiVbyApiVersionSimpleOperationData = { path: { /** @@ -1114,6 +987,10 @@ export type GetApiVbyApiVersionSimpleOperationResponse = (number); export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + export type DeleteFooData3 = { headers: { /** @@ -1133,48 +1010,6 @@ export type DeleteFooData3 = { }; }; -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - export type CallWithParametersData = { /** * This is the parameter that goes into the body @@ -1281,6 +1116,48 @@ export type PostCallWithOptionalParamResponse = (number | void); export type PostCallWithOptionalParamError = unknown; +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body @@ -1402,14 +1279,6 @@ export type CallWithResponseAndNoContentResponseResponse = (number | void); export type CallWithResponseAndNoContentResponseError = unknown; -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - export type CallWithResponseResponse = (_import); export type CallWithResponseError = unknown; @@ -1426,6 +1295,14 @@ export type CallWithResponsesResponse = ({ export type CallWithResponsesError = (ModelWithStringError); +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + export type CollectionFormatData = { query: { /** @@ -1551,23 +1428,6 @@ export type ComplexTypesResponse = (Array); export type ComplexTypesError = (unknown); -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - export type ComplexParamsData = { body?: { readonly key: (string) | null; @@ -1595,6 +1455,23 @@ export type ComplexParamsResponse = (ModelWithString); export type ComplexParamsError = unknown; +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + export type CallWithResultFromHeaderResponse = (string); export type CallWithResultFromHeaderError = (unknown); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts index c0c16d891..1989b3f22 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts index c0c16d891..1989b3f22 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts new file mode 100644 index 000000000..c746f7155 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/solid-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts index c0c16d891..a48ba3ea4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ @@ -1097,10 +974,6 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - export type GetApiVbyApiVersionSimpleOperationData = { path: { /** @@ -1114,6 +987,10 @@ export type GetApiVbyApiVersionSimpleOperationResponse = (number); export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + export type DeleteFooData3 = { headers: { /** @@ -1133,48 +1010,6 @@ export type DeleteFooData3 = { }; }; -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - export type CallWithParametersData = { /** * This is the parameter that goes into the body @@ -1281,6 +1116,48 @@ export type PostCallWithOptionalParamResponse = (number | void); export type PostCallWithOptionalParamError = unknown; +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body @@ -1402,14 +1279,6 @@ export type CallWithResponseAndNoContentResponseResponse = (number | void); export type CallWithResponseAndNoContentResponseError = unknown; -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - export type CallWithResponseResponse = (_import); export type CallWithResponseError = unknown; @@ -1426,6 +1295,14 @@ export type CallWithResponsesResponse = ({ export type CallWithResponsesError = (ModelWithStringError); +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + export type CollectionFormatData = { query: { /** @@ -1551,23 +1428,6 @@ export type ComplexTypesResponse = (Array); export type ComplexTypesError = (unknown); -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - export type ComplexParamsData = { body?: { readonly key: (string) | null; @@ -1595,6 +1455,23 @@ export type ComplexParamsResponse = (ModelWithString); export type ComplexParamsError = unknown; +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + export type CallWithResultFromHeaderResponse = (string); export type CallWithResultFromHeaderError = (unknown); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts new file mode 100644 index 000000000..5891d67f9 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/svelte-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts new file mode 100644 index 000000000..a48ba3ea4 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts new file mode 100644 index 000000000..fbc84a28d --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/vue-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts new file mode 100644 index 000000000..a48ba3ea4 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap deleted file mode 100644 index 7bf74f876..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type UseMutationOptions } from '@tanstack/react-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap deleted file mode 100644 index 4218ca2c0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type MutationOptions } from '@tanstack/solid-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap deleted file mode 100644 index f92598833..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type MutationOptions } from '@tanstack/svelte-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap deleted file mode 100644 index c3cdb4906..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type UseMutationOptions } from '@tanstack/vue-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap deleted file mode 100644 index 505ab21c0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type UseMutationOptions } from '@tanstack/react-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap deleted file mode 100644 index 19500be46..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type MutationOptions } from '@tanstack/solid-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap deleted file mode 100644 index 4e6ff2100..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type MutationOptions } from '@tanstack/svelte-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap deleted file mode 100644 index ed6e6c501..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type UseMutationOptions } from '@tanstack/vue-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/index.spec.ts b/packages/openapi-ts/test/index.spec.ts index 996338245..24873f796 100644 --- a/packages/openapi-ts/test/index.spec.ts +++ b/packages/openapi-ts/test/index.spec.ts @@ -146,38 +146,6 @@ describe('OpenAPI v3', () => { description: 'generate class-based Axios client', name: 'v3-hey-api-client-axios-class', }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/react-query'], - }), - description: 'generate Axios client with TanStack React Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-react-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/solid-query'], - }), - description: 'generate Axios client with TanStack Solid Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-solid-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/svelte-query'], - }), - description: 'generate Axios client with TanStack Svelte Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-svelte-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/vue-query'], - }), - description: 'generate Axios client with TanStack Vue Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-vue-query', - }, { config: createConfig({ client: '@hey-api/client-fetch', @@ -205,39 +173,6 @@ describe('OpenAPI v3', () => { description: 'generate class-based Fetch API client', name: 'v3-hey-api-client-fetch-class', }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/react-query'], - }), - description: 'generate Fetch API client with TanStack React Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-react-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/solid-query'], - }), - description: 'generate Fetch API client with TanStack Solid Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-solid-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/svelte-query'], - }), - description: - 'generate Fetch API client with TanStack Svelte Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-svelte-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/vue-query'], - }), - description: 'generate Fetch API client with TanStack Vue Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-vue-query', - }, { config: createConfig({ client: 'legacy/xhr', diff --git a/packages/openapi-ts/test/plugins.spec.ts b/packages/openapi-ts/test/plugins.spec.ts new file mode 100644 index 000000000..20a95580a --- /dev/null +++ b/packages/openapi-ts/test/plugins.spec.ts @@ -0,0 +1,161 @@ +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { describe, expect, it } from 'vitest'; + +import { createClient } from '../'; +import type { UserConfig } from '../src/types/config'; +import { getFilePaths } from './utils'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const outputDir = path.join(__dirname, 'generated', 'plugins'); + +describe('plugins', () => { + const createConfig = ( + userConfig: Omit & + Pick, 'plugins'>, + ): UserConfig => ({ + client: '@hey-api/client-fetch', + schemas: false, + ...userConfig, + input: path.join(__dirname, 'spec', 'v3.json'), + output: path.join( + outputDir, + typeof userConfig.plugins[0] === 'string' + ? userConfig.plugins[0] + : userConfig.plugins[0].name, + typeof userConfig.output === 'string' ? userConfig.output : '', + ), + }); + + const scenarios = [ + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/react-query'], + }), + description: 'generate Fetch API client with TanStack React Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/solid-query'], + }), + description: 'generate Fetch API client with TanStack Solid Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/svelte-query'], + }), + description: + 'generate Fetch API client with TanStack Svelte Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/vue-query'], + }), + description: 'generate Fetch API client with TanStack Vue Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/react-query'], + }), + description: 'generate Axios client with TanStack React Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/solid-query'], + }), + description: 'generate Axios client with TanStack Solid Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/svelte-query'], + }), + description: 'generate Axios client with TanStack Svelte Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/vue-query'], + }), + description: 'generate Axios client with TanStack Vue Query plugin', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/react-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack React Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/solid-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Solid Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/svelte-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Svelte Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/vue-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Vue Query plugin using class-based services', + }, + ]; + + it.each(scenarios)('$description', async ({ config }) => { + // @ts-ignore + await createClient(config); + + const outputPath = typeof config.output === 'string' ? config.output : ''; + const filePaths = getFilePaths(outputPath); + + filePaths.forEach((filePath) => { + const fileContent = readFileSync(filePath, 'utf-8'); + expect(fileContent).toMatchFileSnapshot( + path.join( + __dirname, + '__snapshots__', + 'plugins', + filePath.slice(outputDir.length + 1), + ), + ); + }); + }); +}); diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index c45a07fed..193206995 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -11,29 +11,29 @@ const main = async () => { // debug: true, // experimental_parser: true, // input: './test/spec/v3-transforms.json', - // input: './test/spec/v3.json', - input: './test/spec/3.1.0/duplicate-null.json', + input: './test/spec/v3.json', + // input: './test/spec/3.1.0/duplicate-null.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', output: { path: './test/generated/sample/', }, - // plugins: [ - // { - // // infiniteQueryOptions: false, - // // mutationOptions: false, - // name: '@tanstack/react-query', - // // queryOptions: false, - // }, - // // '@hey-api/services', - // ], + plugins: [ + { + // infiniteQueryOptions: false, + // mutationOptions: false, + name: '@tanstack/react-query', + // queryOptions: false, + }, + // '@hey-api/services', + ], schemas: { export: false, }, services: { - export: false, - // asClass: true, + // export: false, + asClass: true, // filter: '^GET /api/v{api-version}/simple:operation$', // export: false, // name: '^Parameters',