diff --git a/.changeset/smooth-ties-brush.md b/.changeset/smooth-ties-brush.md new file mode 100644 index 000000000..a99392f3e --- /dev/null +++ b/.changeset/smooth-ties-brush.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': minor +--- + +Add @pinia/colada Plugin diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts new file mode 100644 index 000000000..8a95af75a --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CollectionFormatData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCollectionFormatQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts new file mode 100644 index 000000000..c730a0ef0 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ComplexTypesResponse, ComplexTypesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useComplexTypesQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/complex', + queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts new file mode 100644 index 000000000..6bed9e296 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts @@ -0,0 +1,75 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDefaultParametersQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts new file mode 100644 index 000000000..32380cf33 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDescriptionsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDescriptionsQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/descriptions/', + queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts new file mode 100644 index 000000000..0b2c4cb1f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDuplicateNameQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName2Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName3Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName4Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts new file mode 100644 index 000000000..700e50b0e --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TestErrorCodeData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTestErrorCodeQuery = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/error', + queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts new file mode 100644 index 000000000..d8634c263 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResultFromHeaderData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResultFromHeaderQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts new file mode 100644 index 000000000..a4245c4a5 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts @@ -0,0 +1,40 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DummyAData, DummyBData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDummyAQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDummyBQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts new file mode 100644 index 000000000..0546dc359 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithNoContentResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'NoContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git "a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" new file mode 100644 index 000000000..3c8448d94 --- /dev/null +++ "b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -0,0 +1,29 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: { + query: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts new file mode 100644 index 000000000..861b5e80b --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts @@ -0,0 +1,72 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithParametersData, CallWithWeirdParameterNamesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithParametersQuery = async (params: { + query: unknown; + path: unknown; + headers: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + queryRef, + pathRef, + headersRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef + ], + ...options + }); + return { + ...query, + query: queryRef, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithWeirdParameterNamesQuery = async (params: { + query: unknown; + path: unknown; + headers: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + queryRef, + pathRef, + headersRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef + ], + ...options + }); + return { + ...query, + query: queryRef, + path: pathRef, + headers: headersRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts new file mode 100644 index 000000000..26fbb4bcb --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResponseAndNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts new file mode 100644 index 000000000..adda9ff77 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts @@ -0,0 +1,125 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts new file mode 100644 index 000000000..e8f42fb22 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts @@ -0,0 +1,34 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TypesResponse, TypesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTypesQuery = async (params: { + query: unknown; + path: unknown; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/types', + queryRef, + pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...query, + query: queryRef, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts new file mode 100644 index 000000000..599b53374 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ServiceWithEmptyTagData, PatchApiVbyApiVersionNoTagData, FooWowData, PostApiVbyApiVersionBodyResponse, PostApiVbyApiVersionBodyData, PostApiVbyApiVersionBodyError } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useServiceWithEmptyTagQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'serviceWithEmptyTag' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...query + }; +}; + +export const useFooWowQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...query + }; +}; + +/** + * Body should not be unknown + * Body should not be unknown + */ +export const usePostApiVbyApiVersionBodyMutation = async (params: { + body: unknown; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/body', + bodyRef + }), + key: [ + 'default', + 'postApiVbyApiVersionBody', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/index.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/index.ts new file mode 100644 index 000000000..8430fe1ed --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/index.ts @@ -0,0 +1,17 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './default.gen'; +export * from './Simple.gen'; +export * from './Descriptions.gen'; +export * from './Parameters.gen'; +export * from './Defaults.gen'; +export * from './Duplicate.gen'; +export * from './NoContent.gen'; +export * from './Response.gen'; +export * from './MultipleTags1.gen'; +export * from './CollectionFormat.gen'; +export * from './Types.gen'; +export * from './Complex.gen'; +export * from './Header.gen'; +export * from './Error.gen'; +export * from './Non-Ascii-æøåÆØÅöôêÊ.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts new file mode 100644 index 000000000..56640474e --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts @@ -0,0 +1,1164 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * 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; + +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string; + +/** + * 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 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; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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<{ + foo?: string; + bar?: string; +}>; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: string; +}; + +/** + * 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 type-only model that defines Date as a string + */ +export type _Date = 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; +}; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp: string | null; +}; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + test?: '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?: true; +}; + +/** + * 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; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; + }; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + required: string; + readonly requiredAndReadOnly: string; + 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 ModelWithPropertiesWritable = { + required: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; + +/** + * 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; +}; + +export type Default = { + name?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type ParameterActivityParams = { + description?: string; + graduate_id?: number; + organization_id?: number; + parent_activity?: number; + post_id?: number; +}; + +export type ResponsePostActivityResponse = { + description?: string; + graduate_id?: number; + organization_id?: number; + parent_activity_id?: number; + post_id?: number; +}; + +export type FailureFailure = { + error?: string; + message?: string; + reference_code?: string; +}; + +export type ServiceWithEmptyTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions/'; +}; + +export type CallWithParametersData = { + body?: never; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: string; + }; + path: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +export type CallWithWeirdParameterNamesData = { + body?: never; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': string; + }; + path: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query: { + /** + * This is a simple string with default value + */ + parameterString: string; + /** + * This is a simple number with default value + */ + parameterNumber: number; + /** + * This is a simple boolean with default value + */ + parameterBoolean: boolean; + /** + * This is a simple enum with default value + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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'; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + }; + /** + * This is an array parameter + */ + parameterArray: Array; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + }; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: string; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: NonAsciiStringæøåÆøÅöôêÊ字符串; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PostApiVbyApiVersionBodyData = { + /** + * Body should not be unknown + */ + body: ParameterActivityParams; + path?: never; + query?: never; + url: '/api/v{api-version}/body'; +}; + +export type PostApiVbyApiVersionBodyErrors = { + /** + * Bad Request + */ + 400: FailureFailure; + /** + * Internal Server Error + */ + 500: FailureFailure; +}; + +export type PostApiVbyApiVersionBodyError = PostApiVbyApiVersionBodyErrors[keyof PostApiVbyApiVersionBodyErrors]; + +export type PostApiVbyApiVersionBodyResponses = { + /** + * OK + */ + 200: ResponsePostActivityResponse; +}; + +export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts new file mode 100644 index 000000000..9d0ebe7c8 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts @@ -0,0 +1,685 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ServiceWithEmptyTagData, PatchApiVbyApiVersionNoTagData, FooWowData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, CallWithDescriptionsData, CallWithParametersData, CallWithWeirdParameterNamesData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAData, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData, CollectionFormatData, TypesData, TypesResponse, ComplexTypesData, ComplexTypesResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PostApiVbyApiVersionBodyData, PostApiVbyApiVersionBodyResponse, PostApiVbyApiVersionBodyError } from '../types.gen'; +import { client as _heyApiClient } from '../client.gen'; + +export const useServiceWithEmptyTagQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'serviceWithEmptyTag' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useFooWowQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithDescriptionsQuery = async (params: { + query: CallWithDescriptionsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/descriptions/', + query: queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallWithParametersQuery = async (params: { + query: CallWithParametersData['query']; + path: CallWithParametersData['path']; + headers: CallWithParametersData['headers']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + query: queryRef, + path: pathRef, + headers: headersRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithWeirdParameterNamesQuery = async (params: { + query: CallWithWeirdParameterNamesData['query']; + path: CallWithWeirdParameterNamesData['path']; + headers: CallWithWeirdParameterNamesData['headers']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + query: queryRef, + path: pathRef, + headers: headersRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithDefaultParametersQuery = async (params: { + query: CallWithDefaultParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: { + query: CallWithDefaultOptionalParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: { + query: CallToTestOrderOfParamsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useDuplicateNameQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName2Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName3Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName4Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'NoContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseAndNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyAQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyBQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCollectionFormatQuery = async (params: { + query: CollectionFormatData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + query: queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useTypesQuery = async (params: { + query: TypesData['query']; + path: TypesData['path']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/types', + query: queryRef, + path: pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + path: pathRef + }; +}; + +export const useComplexTypesQuery = async (params: { + query: ComplexTypesData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/complex', + query: queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallWithResultFromHeaderQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useTestErrorCodeQuery = async (params: { + query: TestErrorCodeData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/error', + query: queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: { + query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +/** + * Body should not be unknown + * Body should not be unknown + */ +export const usePostApiVbyApiVersionBodyMutation = async (params: { + body: PostApiVbyApiVersionBodyData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/body', + data: bodyRef + }), + key: [ + 'default', + 'postApiVbyApiVersionBody', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/client.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/client.gen.ts new file mode 100644 index 000000000..fdbaafa48 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/client.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ClientOptions } from './types.gen'; +import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig({ + baseUrl: 'http://localhost:3000/base' +})); \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/index.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/index.ts new file mode 100644 index 000000000..14312beac --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/index.ts @@ -0,0 +1,3 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './colada.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/types.gen.ts new file mode 100644 index 000000000..56640474e --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@pinia/colada/default/types.gen.ts @@ -0,0 +1,1164 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * 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; + +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string; + +/** + * 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 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; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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<{ + foo?: string; + bar?: string; +}>; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: string; +}; + +/** + * 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 type-only model that defines Date as a string + */ +export type _Date = 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; +}; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp: string | null; +}; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + test?: '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?: true; +}; + +/** + * 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; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; + }; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + required: string; + readonly requiredAndReadOnly: string; + 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 ModelWithPropertiesWritable = { + required: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; + +/** + * 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; +}; + +export type Default = { + name?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type ParameterActivityParams = { + description?: string; + graduate_id?: number; + organization_id?: number; + parent_activity?: number; + post_id?: number; +}; + +export type ResponsePostActivityResponse = { + description?: string; + graduate_id?: number; + organization_id?: number; + parent_activity_id?: number; + post_id?: number; +}; + +export type FailureFailure = { + error?: string; + message?: string; + reference_code?: string; +}; + +export type ServiceWithEmptyTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions/'; +}; + +export type CallWithParametersData = { + body?: never; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: string; + }; + path: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +export type CallWithWeirdParameterNamesData = { + body?: never; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': string; + }; + path: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query: { + /** + * This is a simple string with default value + */ + parameterString: string; + /** + * This is a simple number with default value + */ + parameterNumber: number; + /** + * This is a simple boolean with default value + */ + parameterBoolean: boolean; + /** + * This is a simple enum with default value + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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'; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: unknown; +}; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithString; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + }; + /** + * This is an array parameter + */ + parameterArray: Array; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + }; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: string; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: NonAsciiStringæøåÆøÅöôêÊ字符串; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PostApiVbyApiVersionBodyData = { + /** + * Body should not be unknown + */ + body: ParameterActivityParams; + path?: never; + query?: never; + url: '/api/v{api-version}/body'; +}; + +export type PostApiVbyApiVersionBodyErrors = { + /** + * Bad Request + */ + 400: FailureFailure; + /** + * Internal Server Error + */ + 500: FailureFailure; +}; + +export type PostApiVbyApiVersionBodyError = PostApiVbyApiVersionBodyErrors[keyof PostApiVbyApiVersionBodyErrors]; + +export type PostApiVbyApiVersionBodyResponses = { + /** + * OK + */ + 200: ResponsePostActivityResponse; +}; + +export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts index 9cc4305a3..d30055549 100644 --- a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts @@ -1,9 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts -export const _400Schema = { - description: 'Model with number-only name', - type: 'string' -} as const; +export const useCallWithParametersMutation = async (params: { + query: unknown; + path: unknown; + headers: unknown; + body: unknown; + cookies: export const _400Schema = { + description: 'Model with number-only name', + type: 'string' + } as const; export const camelCaseCommentWithBreaksSchema = { description: `Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts new file mode 100644 index 000000000..6af8bf51f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CollectionFormatData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCollectionFormatQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts new file mode 100644 index 000000000..ec912f5ca --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts @@ -0,0 +1,52 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ComplexTypesResponse, ComplexTypesData, ComplexParamsResponse, ComplexParamsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useComplexTypesQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/complex', + queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useComplexParamsMutation = async (params: {}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'put', + url: '/api/v{api-version}/complex/{id}', + pathRef, + bodyRef + }), + key: [ + 'Complex', + 'complexParams', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + path: pathRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts new file mode 100644 index 000000000..093596103 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts @@ -0,0 +1,69 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDefaultParametersQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts new file mode 100644 index 000000000..288141612 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts @@ -0,0 +1,30 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DeprecatedCallData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +/** + * @deprecated + */ +export const useDeprecatedCallQuery = async (params: {}, options?: UseQueryOptions) => { + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/parameters/deprecated', + headersRef + }), + key: [ + 'Deprecated', + 'deprecatedCall', + headersRef + ], + ...options + }); + return { + ...query, + headers: headersRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts new file mode 100644 index 000000000..bbefc74aa --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDescriptionsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDescriptionsQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/descriptions', + queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts new file mode 100644 index 000000000..0b2c4cb1f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDuplicateNameQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName2Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName3Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName4Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts new file mode 100644 index 000000000..31be2cfe8 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TestErrorCodeData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTestErrorCodeQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/error', + queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts new file mode 100644 index 000000000..7c62da990 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { FileResponseResponse, FileResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useFileResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/file/{id}', + pathRef + }), + key: [ + 'FileResponse', + 'fileResponse', + pathRef + ], + ...options + }); + return { + ...query, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts new file mode 100644 index 000000000..07c76c6ca --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { PostApiVbyApiVersionFormDataData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const usePostApiVbyApiVersionFormDataMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/formData', + queryRef, + bodyRef + }), + key: [ + 'FormData', + 'postApiVbyApiVersionFormData', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts new file mode 100644 index 000000000..d8634c263 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResultFromHeaderData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResultFromHeaderQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts new file mode 100644 index 000000000..96b9023f0 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts @@ -0,0 +1,40 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DummyAResponse, DummyAData, DummyBResponse, DummyBData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDummyAQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDummyBQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts new file mode 100644 index 000000000..a346b08dd --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/NoContent.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithNoContentResponseResponse, CallWithNoContentResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'NoContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git "a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" new file mode 100644 index 000000000..c687d6d21 --- /dev/null +++ "b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -0,0 +1,51 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +/** + * Login User + */ +export const usePutWithFormUrlEncodedMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'put', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + bodyRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'putWithFormUrlEncoded', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts new file mode 100644 index 000000000..04b477a7a --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts @@ -0,0 +1,155 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDeleteFooQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + pathRef, + headersRef + }), + key: [ + 'Parameters', + 'deleteFoo', + pathRef, + headersRef + ], + ...options + }); + return { + ...query, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithParametersMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useCallWithWeirdParameterNamesMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useGetCallWithOptionalParamQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/parameters', + queryRef, + bodyRef + }), + key: [ + 'Parameters', + 'getCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...query, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostCallWithOptionalParamMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters', + queryRef, + bodyRef + }), + key: [ + 'Parameters', + 'postCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts new file mode 100644 index 000000000..1c7e51229 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { PostApiVbyApiVersionRequestBodyData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const usePostApiVbyApiVersionRequestBodyMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/requestBody', + queryRef, + bodyRef + }), + key: [ + 'RequestBody', + 'postApiVbyApiVersionRequestBody', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts new file mode 100644 index 000000000..26fbb4bcb --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResponseAndNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts new file mode 100644 index 000000000..8030f32f5 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts @@ -0,0 +1,142 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useApiVVersionODataControllerCountQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple/$count' + }), + key: [ + 'Simple', + 'apiVVersionODataControllerCount' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts new file mode 100644 index 000000000..9403f9975 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TypesResponse, TypesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTypesQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/types', + queryRef, + pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...query, + query: queryRef, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts new file mode 100644 index 000000000..172b9dbd1 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { UploadFileResponse, UploadFileData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useUploadFileMutation = async (params: {}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/upload', + pathRef, + bodyRef + }), + key: [ + 'Upload', + 'uploadFile', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + path: pathRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts new file mode 100644 index 000000000..57efce095 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts @@ -0,0 +1,99 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useExportQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'export' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...query + }; +}; + +export const useImportMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/no+tag', + bodyRef + }), + key: [ + 'default', + 'import', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; + +export const useFooWowQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...query + }; +}; + +export const useGetApiVbyApiVersionSimpleOperationQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple:operation', + pathRef + }), + key: [ + 'default', + 'getApiVbyApiVersionSimpleOperation', + pathRef + ], + ...options + }); + return { + ...query, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts new file mode 100644 index 000000000..2fb2d800a --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts @@ -0,0 +1,44 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { MultipartResponseResponse, MultipartResponseData, MultipartRequestData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useMultipartResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multipart' + }), + key: [ + 'multipart', + 'multipartResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useMultipartRequestMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/multipart', + bodyRef + }), + key: [ + 'multipart', + 'multipartRequest', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/index.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/index.ts new file mode 100644 index 000000000..f6b1c43c4 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/index.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './default.gen'; +export * from './Simple.gen'; +export * from './Parameters.gen'; +export * from './Descriptions.gen'; +export * from './Deprecated.gen'; +export * from './RequestBody.gen'; +export * from './FormData.gen'; +export * from './Defaults.gen'; +export * from './Duplicate.gen'; +export * from './NoContent.gen'; +export * from './Response.gen'; +export * from './MultipleTags1.gen'; +export * from './CollectionFormat.gen'; +export * from './Types.gen'; +export * from './Upload.gen'; +export * from './FileResponse.gen'; +export * from './Complex.gen'; +export * from './multipart.gen'; +export * from './Header.gen'; +export * from './Error.gen'; +export * from './Non-Ascii-æøåÆØÅöôêÊ.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts new file mode 100644 index 000000000..8d98b563e --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/asFileSdk/types.gen.ts @@ -0,0 +1,2023 @@ +// 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; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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; +}; + +/** + * 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 ModelFromZendesk = 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 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?: true; +}; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + '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; + /** + * 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 ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyReadable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * 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: string; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: string; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & 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 | Array; +}; + +export type _3eNum1Период = '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<_3eNum1Период | 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; + }; +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; +}; + +/** + * 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 & { + age: number; + firstName: string; + lastname: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + 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 ModelWithPropertiesWritable = { + required: string; + requiredAndNullable: string | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + 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 ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type FileReadable = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type FileWritable = { + mime: string; +}; + +export type Default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; + +/** + * 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 = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: unknown; + 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 | undefined; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + 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 ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; + +export type ModelWithReadOnlyAndWriteOnlyReadable = { + foo: string; + readonly bar: string; +}; + +export type ModelWithReadOnlyAndWriteOnlyWritable = { + foo: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = Array; + +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; +}; + +/** + * 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 = (SimpleParameter | 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 IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * 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; +}; + +export type OneOfAllOfIssueReadable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanReadable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringReadable; + +export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanWritable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringWritable; + +export type GenericSchemaDuplicateIssue1SystemBooleanReadable = { + item?: boolean; + error?: string | null; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { + item?: boolean; + error?: string | null; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemStringReadable = { + item?: string | null; + error?: string | null; + readonly hasError?: boolean; +}; + +export type GenericSchemaDuplicateIssue1SystemStringWritable = { + item?: string | null; + error?: string | null; +}; + +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type XFooBar = ModelWithString; + +export type SimpleRequestBody = ModelWithString; + +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnlyReadable; +}; + +export type ImportResponse = ImportResponses[keyof ImportResponses]; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; + +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; + +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; + +export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; + path: { + /** + * foo in method + */ + foo_param: string; + }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * foo in method + */ + foo_param: string; + /** + * bar in method + */ + BarParam: string; + }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions'; +}; + +export type DeprecatedCallData = { + body?: never; + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: DeprecatedModel | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the query params + */ + cursor: string | null; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + path?: never; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: number | null; + }; + path?: never; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: SimpleRequestBody; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/requestBody'; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string | null; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean | null; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: Blob | File; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: Blob | File; +}; + +export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + name: string | null; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + }; + path: { + id: number; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; +}; + +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts new file mode 100644 index 000000000..ade485b2f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts @@ -0,0 +1,1062 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportData, ImportResponse, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client as _heyApiClient } from '../client.gen'; + +export const useExportQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'export' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useImportMutation = async (params: { + body: ImportData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/no+tag', + data: bodyRef + }), + key: [ + 'default', + 'import', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; + +export const useFooWowQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useApiVVersionODataControllerCountQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple/$count' + }), + key: [ + 'Simple', + 'apiVVersionODataControllerCount' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useGetApiVbyApiVersionSimpleOperationQuery = async (params: { + path: GetApiVbyApiVersionSimpleOperationData['path']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple:operation', + path: pathRef + }), + key: [ + 'default', + 'getApiVbyApiVersionSimpleOperation', + pathRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef + }; +}; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDeleteFooQuery = async (params: { + path: DeleteFooData3['path']; + headers: DeleteFooData3['headers']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + path: pathRef, + headers: headersRef + }), + key: [ + 'Parameters', + 'deleteFoo', + pathRef, + headersRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithDescriptionsQuery = async (params: { + query: CallWithDescriptionsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/descriptions', + query: queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +/** + * @deprecated + */ +export const useDeprecatedCallQuery = async (params: { + headers: DeprecatedCallData['headers']; +}, options?: UseQueryOptions) => { + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/deprecated', + headers: headersRef + }), + key: [ + 'Deprecated', + 'deprecatedCall', + headersRef + ], + ...options + }); + return { + ...queryResult, + headers: headersRef + }; +}; + +export const useCallWithParametersMutation = async (params: { + query: CallWithParametersData['query']; + path: CallWithParametersData['path']; + headers: CallWithParametersData['headers']; + body: CallWithParametersData['body']; + cookies: { + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + }; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + query: queryRef, + path: pathRef, + headers: headersRef, + data: bodyRef, + cookies: cookiesRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useCallWithWeirdParameterNamesMutation = async (params: { + query: CallWithWeirdParameterNamesData['query']; + path: CallWithWeirdParameterNamesData['path']; + headers: CallWithWeirdParameterNamesData['headers']; + body: CallWithWeirdParameterNamesData['body']; + cookies: { + /** + * This is the parameter that goes into the cookie + */ + 'PARAMETER-COOKIE': string | null; + }; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + query: queryRef, + path: pathRef, + headers: headersRef, + data: bodyRef, + cookies: cookiesRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useGetCallWithOptionalParamQuery = async (params: { + query: GetCallWithOptionalParamData['query']; + body: GetCallWithOptionalParamData['body']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/parameters', + query: queryRef, + data: bodyRef + }), + key: [ + 'Parameters', + 'getCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostCallWithOptionalParamMutation = async (params: { + query: PostCallWithOptionalParamData['query']; + body: PostCallWithOptionalParamData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters', + query: queryRef, + data: bodyRef + }), + key: [ + 'Parameters', + 'postCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostApiVbyApiVersionRequestBodyMutation = async (params: { + query: PostApiVbyApiVersionRequestBodyData['query']; + body: PostApiVbyApiVersionRequestBodyData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/requestBody', + query: queryRef, + data: bodyRef + }), + key: [ + 'RequestBody', + 'postApiVbyApiVersionRequestBody', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostApiVbyApiVersionFormDataMutation = async (params: { + query: PostApiVbyApiVersionFormDataData['query']; + body: PostApiVbyApiVersionFormDataData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/formData', + query: queryRef, + data: bodyRef + }), + key: [ + 'FormData', + 'postApiVbyApiVersionFormData', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const useCallWithDefaultParametersQuery = async (params: { + query: CallWithDefaultParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: { + query: CallWithDefaultOptionalParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: { + query: CallToTestOrderOfParamsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useDuplicateNameQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName2Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName3Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName4Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'NoContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseAndNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyAQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyBQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCollectionFormatQuery = async (params: { + query: CollectionFormatData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + query: queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useTypesQuery = async (params: { + query: TypesData['query']; + path: TypesData['path']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/types', + query: queryRef, + path: pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + path: pathRef + }; +}; + +export const useUploadFileMutation = async (params: { + path: UploadFileData['path']; + body: UploadFileData['body']; +}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/upload', + path: pathRef, + data: bodyRef + }), + key: [ + 'Upload', + 'uploadFile', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + path: pathRef, + body: bodyRef + }; +}; + +export const useFileResponseQuery = async (params: { + path: FileResponseData['path']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/file/{id}', + path: pathRef + }), + key: [ + 'FileResponse', + 'fileResponse', + pathRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef + }; +}; + +export const useComplexTypesQuery = async (params: { + query: ComplexTypesData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/complex', + query: queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useMultipartResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multipart' + }), + key: [ + 'multipart', + 'multipartResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useMultipartRequestMutation = async (params: { + body: MultipartRequestData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/multipart', + data: bodyRef + }), + key: [ + 'multipart', + 'multipartRequest', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; + +export const useComplexParamsMutation = async (params: { + path: ComplexParamsData['path']; + body: ComplexParamsData['body']; +}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/complex/{id}', + path: pathRef, + data: bodyRef + }), + key: [ + 'Complex', + 'complexParams', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + path: pathRef, + body: bodyRef + }; +}; + +export const useCallWithResultFromHeaderQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useTestErrorCodeQuery = async (params: { + query: TestErrorCodeData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/error', + query: queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: { + query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +/** + * Login User + */ +export const usePutWithFormUrlEncodedMutation = async (params: { + body: PutWithFormUrlEncodedData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + data: bodyRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'putWithFormUrlEncoded', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/client.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/client.gen.ts new file mode 100644 index 000000000..fdbaafa48 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/client.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ClientOptions } from './types.gen'; +import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig({ + baseUrl: 'http://localhost:3000/base' +})); \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/index.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/index.ts new file mode 100644 index 000000000..14312beac --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/index.ts @@ -0,0 +1,3 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './colada.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/types.gen.ts new file mode 100644 index 000000000..8d98b563e --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@pinia/colada/default/types.gen.ts @@ -0,0 +1,2023 @@ +// 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; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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; +}; + +/** + * 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 ModelFromZendesk = 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 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?: true; +}; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + '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; + /** + * 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 ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyReadable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * 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: string; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: string; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & 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 | Array; +}; + +export type _3eNum1Период = '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<_3eNum1Период | 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; + }; +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; +}; + +/** + * 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 & { + age: number; + firstName: string; + lastname: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + 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 ModelWithPropertiesWritable = { + required: string; + requiredAndNullable: string | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + 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 ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type FileReadable = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type FileWritable = { + mime: string; +}; + +export type Default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; + +/** + * 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 = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: unknown; + 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 | undefined; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + 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 ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; + +export type ModelWithReadOnlyAndWriteOnlyReadable = { + foo: string; + readonly bar: string; +}; + +export type ModelWithReadOnlyAndWriteOnlyWritable = { + foo: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = Array; + +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; +}; + +/** + * 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 = (SimpleParameter | 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 IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * 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; +}; + +export type OneOfAllOfIssueReadable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanReadable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringReadable; + +export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanWritable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringWritable; + +export type GenericSchemaDuplicateIssue1SystemBooleanReadable = { + item?: boolean; + error?: string | null; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { + item?: boolean; + error?: string | null; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemStringReadable = { + item?: string | null; + error?: string | null; + readonly hasError?: boolean; +}; + +export type GenericSchemaDuplicateIssue1SystemStringWritable = { + item?: string | null; + error?: string | null; +}; + +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type XFooBar = ModelWithString; + +export type SimpleRequestBody = ModelWithString; + +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnlyReadable; +}; + +export type ImportResponse = ImportResponses[keyof ImportResponses]; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; + +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; + +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; + +export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; + path: { + /** + * foo in method + */ + foo_param: string; + }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * foo in method + */ + foo_param: string; + /** + * bar in method + */ + BarParam: string; + }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions'; +}; + +export type DeprecatedCallData = { + body?: never; + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: DeprecatedModel | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the query params + */ + cursor: string | null; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + path?: never; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: number | null; + }; + path?: never; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: SimpleRequestBody; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/requestBody'; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string | null; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean | null; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: Blob | File; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: Blob | File; +}; + +export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + name: string | null; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + }; + path: { + id: number; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; +}; + +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts index 5e7432861..9de8acc1c 100644 --- a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts @@ -1,9 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts -export const _400Schema = { - description: 'Model with number-only name', - type: 'string' -} as const; +export const useCallWithParametersMutation = async (params: { + query: unknown; + path: unknown; + headers: unknown; + body: unknown; + cookies: export const _400Schema = { + description: 'Model with number-only name', + type: 'string' + } as const; export const camelCaseCommentWithBreaksSchema = { description: `Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts new file mode 100644 index 000000000..6af8bf51f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/CollectionFormat.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CollectionFormatData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCollectionFormatQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts new file mode 100644 index 000000000..ec912f5ca --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Complex.gen.ts @@ -0,0 +1,52 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ComplexTypesResponse, ComplexTypesData, ComplexParamsResponse, ComplexParamsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useComplexTypesQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/complex', + queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useComplexParamsMutation = async (params: {}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'put', + url: '/api/v{api-version}/complex/{id}', + pathRef, + bodyRef + }), + key: [ + 'Complex', + 'complexParams', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + path: pathRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts new file mode 100644 index 000000000..093596103 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Defaults.gen.ts @@ -0,0 +1,69 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDefaultParametersQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/defaults', + queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts new file mode 100644 index 000000000..288141612 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Deprecated.gen.ts @@ -0,0 +1,30 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DeprecatedCallData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +/** + * @deprecated + */ +export const useDeprecatedCallQuery = async (params: {}, options?: UseQueryOptions) => { + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/parameters/deprecated', + headersRef + }), + key: [ + 'Deprecated', + 'deprecatedCall', + headersRef + ], + ...options + }); + return { + ...query, + headers: headersRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts new file mode 100644 index 000000000..bbefc74aa --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Descriptions.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithDescriptionsData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithDescriptionsQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/descriptions', + queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts new file mode 100644 index 000000000..0b2c4cb1f --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Duplicate.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDuplicateNameQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName2Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName3Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDuplicateName4Query = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts new file mode 100644 index 000000000..31be2cfe8 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Error.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TestErrorCodeData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTestErrorCodeQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/error', + queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts new file mode 100644 index 000000000..7c62da990 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FileResponse.gen.ts @@ -0,0 +1,27 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { FileResponseResponse, FileResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useFileResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/file/{id}', + pathRef + }), + key: [ + 'FileResponse', + 'fileResponse', + pathRef + ], + ...options + }); + return { + ...query, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts new file mode 100644 index 000000000..07c76c6ca --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/FormData.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { PostApiVbyApiVersionFormDataData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const usePostApiVbyApiVersionFormDataMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/formData', + queryRef, + bodyRef + }), + key: [ + 'FormData', + 'postApiVbyApiVersionFormData', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts new file mode 100644 index 000000000..d8634c263 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Header.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResultFromHeaderData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResultFromHeaderQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts new file mode 100644 index 000000000..96b9023f0 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/MultipleTags1.gen.ts @@ -0,0 +1,40 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DummyAResponse, DummyAData, DummyBResponse, DummyBData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDummyAQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDummyBQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git "a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" new file mode 100644 index 000000000..c687d6d21 --- /dev/null +++ "b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -0,0 +1,51 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...query, + query: queryRef + }; +}; + +/** + * Login User + */ +export const usePutWithFormUrlEncodedMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'put', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + bodyRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'putWithFormUrlEncoded', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts new file mode 100644 index 000000000..04b477a7a --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Parameters.gen.ts @@ -0,0 +1,155 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useDeleteFooQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + pathRef, + headersRef + }), + key: [ + 'Parameters', + 'deleteFoo', + pathRef, + headersRef + ], + ...options + }); + return { + ...query, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithParametersMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useCallWithWeirdParameterNamesMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useGetCallWithOptionalParamQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/parameters', + queryRef, + bodyRef + }), + key: [ + 'Parameters', + 'getCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...query, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostCallWithOptionalParamMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/parameters', + queryRef, + bodyRef + }), + key: [ + 'Parameters', + 'postCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts new file mode 100644 index 000000000..1c7e51229 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/RequestBody.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { PostApiVbyApiVersionRequestBodyData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const usePostApiVbyApiVersionRequestBodyMutation = async (params: {}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/requestBody', + queryRef, + bodyRef + }), + key: [ + 'RequestBody', + 'postApiVbyApiVersionRequestBody', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + query: queryRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts new file mode 100644 index 000000000..26fbb4bcb --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Response.gen.ts @@ -0,0 +1,74 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithResponseAndNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...query + }; +}; + +export const useCallWithResponsesQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts new file mode 100644 index 000000000..8030f32f5 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Simple.gen.ts @@ -0,0 +1,142 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useApiVVersionODataControllerCountQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple/$count' + }), + key: [ + 'Simple', + 'apiVVersionODataControllerCount' + ], + ...options + }); + return { + ...query + }; +}; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts new file mode 100644 index 000000000..9403f9975 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Types.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { TypesResponse, TypesData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useTypesQuery = async (params: {}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/types', + queryRef, + pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...query, + query: queryRef, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts new file mode 100644 index 000000000..172b9dbd1 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/Upload.gen.ts @@ -0,0 +1,31 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { UploadFileResponse, UploadFileData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useUploadFileMutation = async (params: {}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/upload', + pathRef, + bodyRef + }), + key: [ + 'Upload', + 'uploadFile', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutation, + path: pathRef, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts new file mode 100644 index 000000000..57efce095 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/default.gen.ts @@ -0,0 +1,99 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useExportQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'export' + ], + ...options + }); + return { + ...query + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...query + }; +}; + +export const useImportMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/no+tag', + bodyRef + }), + key: [ + 'default', + 'import', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; + +export const useFooWowQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...query + }; +}; + +export const useGetApiVbyApiVersionSimpleOperationQuery = async (params: {}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/simple:operation', + pathRef + }), + key: [ + 'default', + 'getApiVbyApiVersionSimpleOperation', + pathRef + ], + ...options + }); + return { + ...query, + path: pathRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts new file mode 100644 index 000000000..2fb2d800a --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/multipart.gen.ts @@ -0,0 +1,44 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { MultipartResponseResponse, MultipartResponseData, MultipartRequestData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useMultipartResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/multipart' + }), + key: [ + 'multipart', + 'multipartResponse' + ], + ...options + }); + return { + ...query + }; +}; + +export const useMultipartRequestMutation = async (params: {}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutation = useMutation({ + mutation: client({ + method: 'post', + url: '/api/v{api-version}/multipart', + bodyRef + }), + key: [ + 'multipart', + 'multipartRequest', + bodyRef + ], + ...options + }); + return { + ...mutation, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/noContent.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/noContent.gen.ts new file mode 100644 index 000000000..5b0cbdb06 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/@pinia/colada/noContent.gen.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { CallWithNoContentResponseResponse, CallWithNoContentResponseData } from '../../types.gen'; +import { client } from '@pinia/colada/client'; + +export const useCallWithNoContentResponseQuery = async (params: {}, options?: UseQueryOptions) => { + const query = useQuery({ + query: client({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'noContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...query + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/index.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/index.ts new file mode 100644 index 000000000..7607234bb --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/index.ts @@ -0,0 +1,23 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './default.gen'; +export * from './Simple.gen'; +export * from './Parameters.gen'; +export * from './Descriptions.gen'; +export * from './Deprecated.gen'; +export * from './RequestBody.gen'; +export * from './FormData.gen'; +export * from './Defaults.gen'; +export * from './Duplicate.gen'; +export * from './noContent.gen'; +export * from './Response.gen'; +export * from './MultipleTags1.gen'; +export * from './CollectionFormat.gen'; +export * from './Types.gen'; +export * from './Upload.gen'; +export * from './FileResponse.gen'; +export * from './Complex.gen'; +export * from './multipart.gen'; +export * from './Header.gen'; +export * from './Error.gen'; +export * from './Non-Ascii-æøåÆØÅöôêÊ.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/types.gen.ts new file mode 100644 index 000000000..70cd1fa23 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/asFileSdk/types.gen.ts @@ -0,0 +1,2033 @@ +// 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; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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 ModelFromZendesk = 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 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?: true; +}; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + '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; + /** + * 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 ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyReadable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * 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: string; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: string; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & 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 | Array; +}; + +export type _3eNum1Период = '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<_3eNum1Период | 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; + }; +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; +}; + +/** + * 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 & { + age: number; + firstName: string; + lastname: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + 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 ModelWithPropertiesWritable = { + required: string; + requiredAndNullable: string | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + 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 ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type FileReadable = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type FileWritable = { + mime: string; +}; + +export type Default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; + +/** + * 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 = {}; + +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 | undefined; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + 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 ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; + +export type ModelWithReadOnlyAndWriteOnlyReadable = { + foo: string; + readonly bar: string; +}; + +export type ModelWithReadOnlyAndWriteOnlyWritable = { + foo: 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; +}; + +/** + * 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 = (SimpleParameter | 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 IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * 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; +}; + +export type OneOfAllOfIssueReadable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanReadable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringReadable; + +export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanWritable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringWritable; + +export type GenericSchemaDuplicateIssue1SystemBooleanReadable = { + item?: boolean; + error?: string | null; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { + item?: boolean; + error?: string | null; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemStringReadable = { + item?: string | null; + error?: string | null; + readonly hasError?: boolean; +}; + +export type GenericSchemaDuplicateIssue1SystemStringWritable = { + item?: string | null; + error?: string | null; +}; + +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type XFooBar = ModelWithString; + +/** + * A reusable request body + */ +export type SimpleRequestBody = ModelWithString; + +/** + * A reusable request body + */ +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnlyReadable; +}; + +export type ImportResponse = ImportResponses[keyof ImportResponses]; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; + +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; + +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; + +export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; + path: { + /** + * foo in method + */ + foo_param: string; + }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * foo in method + */ + foo_param: string; + /** + * bar in method + */ + BarParam: string; + }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions'; +}; + +export type DeprecatedCallData = { + body?: never; + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: DeprecatedModel | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the query params + */ + cursor: string | null; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + path?: never; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: number | null; + }; + path?: never; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: SimpleRequestBody; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/requestBody'; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string | null; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean | null; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: Blob | File; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: Blob | File; +}; + +export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + name: string | null; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + }; + path: { + id: number; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; +}; + +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts new file mode 100644 index 000000000..e55866556 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/@pinia/colada.gen.ts @@ -0,0 +1,1062 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { useQuery, type UseQueryOptions, useMutation, type UseMutationOptions } from '@pinia/colada'; +import { toRef } from 'vue'; +import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportData, ImportResponse, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesData, CallWithResponsesResponse, CallWithResponsesError, CallWithResponsesData, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client as _heyApiClient } from '../client.gen'; + +export const useExportQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'export' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchApiVbyApiVersionNoTagQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'patchApiVbyApiVersionNoTag' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useImportMutation = async (params: { + body: ImportData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/no+tag', + data: bodyRef + }), + key: [ + 'default', + 'import', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; + +export const useFooWowQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/no+tag' + }), + key: [ + 'default', + 'fooWow' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useApiVVersionODataControllerCountQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple/$count' + }), + key: [ + 'Simple', + 'apiVVersionODataControllerCount' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useGetApiVbyApiVersionSimpleOperationQuery = async (params: { + path: GetApiVbyApiVersionSimpleOperationData['path']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple:operation', + path: pathRef + }), + key: [ + 'default', + 'getApiVbyApiVersionSimpleOperation', + pathRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef + }; +}; + +export const useDeleteCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'deleteCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useGetCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'getCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useHeadCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'head', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'headCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useOptionsCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'options', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'optionsCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePatchCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'patch', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'patchCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePostCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'postCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const usePutCallWithoutParametersAndResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/simple' + }), + key: [ + 'Simple', + 'putCallWithoutParametersAndResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDeleteFooQuery = async (params: { + path: DeleteFooData3['path']; + headers: DeleteFooData3['headers']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + path: pathRef, + headers: headersRef + }), + key: [ + 'Parameters', + 'deleteFoo', + pathRef, + headersRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef, + headers: headersRef + }; +}; + +export const useCallWithDescriptionsQuery = async (params: { + query: CallWithDescriptionsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/descriptions', + query: queryRef + }), + key: [ + 'Descriptions', + 'callWithDescriptions', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +/** + * @deprecated + */ +export const useDeprecatedCallQuery = async (params: { + headers: DeprecatedCallData['headers']; +}, options?: UseQueryOptions) => { + const headersRef = toRef(params?.headers); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/deprecated', + headers: headersRef + }), + key: [ + 'Deprecated', + 'deprecatedCall', + headersRef + ], + ...options + }); + return { + ...queryResult, + headers: headersRef + }; +}; + +export const useCallWithParametersMutation = async (params: { + query: CallWithParametersData['query']; + path: CallWithParametersData['path']; + headers: CallWithParametersData['headers']; + body: CallWithParametersData['body']; + cookies: { + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + }; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameterPath}', + query: queryRef, + path: pathRef, + headers: headersRef, + data: bodyRef, + cookies: cookiesRef + }), + key: [ + 'Parameters', + 'callWithParameters', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useCallWithWeirdParameterNamesMutation = async (params: { + query: CallWithWeirdParameterNamesData['query']; + path: CallWithWeirdParameterNamesData['path']; + headers: CallWithWeirdParameterNamesData['headers']; + body: CallWithWeirdParameterNamesData['body']; + cookies: { + /** + * This is the parameter that goes into the cookie + */ + 'PARAMETER-COOKIE': string | null; + }; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const headersRef = toRef(params?.headers); + const bodyRef = toRef(params?.body); + const cookiesRef = toRef(params?.cookies); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + query: queryRef, + path: pathRef, + headers: headersRef, + data: bodyRef, + cookies: cookiesRef + }), + key: [ + 'Parameters', + 'callWithWeirdParameterNames', + queryRef, + pathRef, + headersRef, + bodyRef, + cookiesRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + path: pathRef, + headers: headersRef, + body: bodyRef, + cookies: cookiesRef + }; +}; + +export const useGetCallWithOptionalParamQuery = async (params: { + query: GetCallWithOptionalParamData['query']; + body: GetCallWithOptionalParamData['body']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/parameters', + query: queryRef, + data: bodyRef + }), + key: [ + 'Parameters', + 'getCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostCallWithOptionalParamMutation = async (params: { + query: PostCallWithOptionalParamData['query']; + body: PostCallWithOptionalParamData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/parameters', + query: queryRef, + data: bodyRef + }), + key: [ + 'Parameters', + 'postCallWithOptionalParam', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostApiVbyApiVersionRequestBodyMutation = async (params: { + query: PostApiVbyApiVersionRequestBodyData['query']; + body: PostApiVbyApiVersionRequestBodyData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/requestBody', + query: queryRef, + data: bodyRef + }), + key: [ + 'RequestBody', + 'postApiVbyApiVersionRequestBody', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const usePostApiVbyApiVersionFormDataMutation = async (params: { + query: PostApiVbyApiVersionFormDataData['query']; + body: PostApiVbyApiVersionFormDataData['body']; +}, options?: UseMutationOptions) => { + const queryRef = toRef(params?.query); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/formData', + query: queryRef, + data: bodyRef + }), + key: [ + 'FormData', + 'postApiVbyApiVersionFormData', + queryRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + query: queryRef, + body: bodyRef + }; +}; + +export const useCallWithDefaultParametersQuery = async (params: { + query: CallWithDefaultParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallWithDefaultOptionalParametersQuery = async (params: { + query: CallWithDefaultOptionalParametersData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callWithDefaultOptionalParameters', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useCallToTestOrderOfParamsQuery = async (params: { + query: CallToTestOrderOfParamsData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/defaults', + query: queryRef + }), + key: [ + 'Defaults', + 'callToTestOrderOfParams', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useDuplicateNameQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'delete', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName2Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName2' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName3Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName3' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDuplicateName4Query = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/duplicate' + }), + key: [ + 'Duplicate', + 'duplicateName4' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/no-content' + }), + key: [ + 'noContent', + 'callWithNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseAndNoContentResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }), + key: [ + 'Response', + 'callWithResponseAndNoContentResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyAQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/a' + }), + key: [ + 'MultipleTags1', + 'dummyA' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useDummyBQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multiple-tags/b' + }), + key: [ + 'MultipleTags1', + 'dummyB' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithDuplicateResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithDuplicateResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCallWithResponsesQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/response' + }), + key: [ + 'Response', + 'callWithResponses' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useCollectionFormatQuery = async (params: { + query: CollectionFormatData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/collectionFormat', + query: queryRef + }), + key: [ + 'CollectionFormat', + 'collectionFormat', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useTypesQuery = async (params: { + query: TypesData['query']; + path: TypesData['path']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/types', + query: queryRef, + path: pathRef + }), + key: [ + 'Types', + 'types', + queryRef, + pathRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef, + path: pathRef + }; +}; + +export const useUploadFileMutation = async (params: { + path: UploadFileData['path']; + body: UploadFileData['body']; +}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/upload', + path: pathRef, + data: bodyRef + }), + key: [ + 'Upload', + 'uploadFile', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + path: pathRef, + body: bodyRef + }; +}; + +export const useFileResponseQuery = async (params: { + path: FileResponseData['path']; +}, options?: UseQueryOptions) => { + const pathRef = toRef(params?.path); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/file/{id}', + path: pathRef + }), + key: [ + 'FileResponse', + 'fileResponse', + pathRef + ], + ...options + }); + return { + ...queryResult, + path: pathRef + }; +}; + +export const useComplexTypesQuery = async (params: { + query: ComplexTypesData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/complex', + query: queryRef + }), + key: [ + 'Complex', + 'complexTypes', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useMultipartResponseQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'get', + url: '/api/v{api-version}/multipart' + }), + key: [ + 'multipart', + 'multipartResponse' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useMultipartRequestMutation = async (params: { + body: MultipartRequestData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/multipart', + data: bodyRef + }), + key: [ + 'multipart', + 'multipartRequest', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; + +export const useComplexParamsMutation = async (params: { + path: ComplexParamsData['path']; + body: ComplexParamsData['body']; +}, options?: UseMutationOptions) => { + const pathRef = toRef(params?.path); + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/complex/{id}', + path: pathRef, + data: bodyRef + }), + key: [ + 'Complex', + 'complexParams', + pathRef, + bodyRef + ], + ...options + }); + return { + ...mutationResult, + path: pathRef, + body: bodyRef + }; +}; + +export const useCallWithResultFromHeaderQuery = async (params?: {}, options?: UseQueryOptions) => { + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/header' + }), + key: [ + 'Header', + 'callWithResultFromHeader' + ], + ...options + }); + return { + ...queryResult + }; +}; + +export const useTestErrorCodeQuery = async (params: { + query: TestErrorCodeData['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/error', + query: queryRef + }), + key: [ + 'Error', + 'testErrorCode', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +export const useNonAsciiæøåÆøÅöôêÊ字符串Query = async (params: { + query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']; +}, options?: UseQueryOptions) => { + const queryRef = toRef(params?.query); + const queryResult = useQuery({ + query: _heyApiClient({ + method: 'post', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: queryRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'nonAsciiæøåÆøÅöôêÊ字符串', + queryRef + ], + ...options + }); + return { + ...queryResult, + query: queryRef + }; +}; + +/** + * Login User + */ +export const usePutWithFormUrlEncodedMutation = async (params: { + body: PutWithFormUrlEncodedData['body']; +}, options?: UseMutationOptions) => { + const bodyRef = toRef(params?.body); + const mutationResult = useMutation({ + mutation: _heyApiClient({ + method: 'put', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + data: bodyRef + }), + key: [ + 'Non-Ascii-æøåÆØÅöôêÊ', + 'putWithFormUrlEncoded', + bodyRef + ], + ...options + }); + return { + ...mutationResult, + body: bodyRef + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/client.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/client.gen.ts new file mode 100644 index 000000000..fdbaafa48 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/client.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ClientOptions } from './types.gen'; +import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig({ + baseUrl: 'http://localhost:3000/base' +})); \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/index.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/index.ts new file mode 100644 index 000000000..14312beac --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/index.ts @@ -0,0 +1,3 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; +export * from './colada.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/types.gen.ts b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/types.gen.ts new file mode 100644 index 000000000..70cd1fa23 --- /dev/null +++ b/packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@pinia/colada/default/types.gen.ts @@ -0,0 +1,2033 @@ +// 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; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; + +/** + * 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 ModelFromZendesk = 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 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?: true; +}; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + '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; + /** + * 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 ModelWithReferenceReadable = { + prop?: ModelWithPropertiesReadable; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReferenceWritable = { + prop?: ModelWithPropertiesWritable; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyReadable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; + +/** + * 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: string; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: string; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & 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 | Array; +}; + +export type _3eNum1Период = '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<_3eNum1Период | 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; + }; +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; +}; + +/** + * 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 & { + age: number; + firstName: string; + lastname: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithPropertiesReadable = { + 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 ModelWithPropertiesWritable = { + required: string; + requiredAndNullable: string | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedPropertiesReadable = { + 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 ModelWithPatternReadable = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPatternWritable = { + key: string; + name: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type FileReadable = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type FileWritable = { + mime: string; +}; + +export type Default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; + +/** + * 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 = {}; + +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 | undefined; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + 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 ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; + +export type ModelWithReadOnlyAndWriteOnlyReadable = { + foo: string; + readonly bar: string; +}; + +export type ModelWithReadOnlyAndWriteOnlyWritable = { + foo: 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; +}; + +/** + * 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 = (SimpleParameter | 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 IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * 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; +}; + +export type OneOfAllOfIssueReadable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanReadable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringReadable; + +export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBooleanWritable) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemStringWritable; + +export type GenericSchemaDuplicateIssue1SystemBooleanReadable = { + item?: boolean; + error?: string | null; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { + item?: boolean; + error?: string | null; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemStringReadable = { + item?: string | null; + error?: string | null; + readonly hasError?: boolean; +}; + +export type GenericSchemaDuplicateIssue1SystemStringWritable = { + item?: string | null; + error?: string | null; +}; + +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type XFooBar = ModelWithString; + +/** + * A reusable request body + */ +export type SimpleRequestBody = ModelWithString; + +/** + * A reusable request body + */ +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type PatchApiVbyApiVersionNoTagResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnlyReadable; +}; + +export type ImportResponse = ImportResponses[keyof ImportResponses]; + +export type FooWowData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no+tag'; +}; + +export type FooWowResponses = { + /** + * OK + */ + default: unknown; +}; + +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; + +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; + +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; + +export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; + path: { + /** + * foo in method + */ + foo_param: string; + }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * foo in method + */ + foo_param: string; + /** + * bar in method + */ + BarParam: string; + }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; +}; + +export type CallWithDescriptionsData = { + body?: never; + path?: never; + query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + }; + url: '/api/v{api-version}/descriptions'; +}; + +export type DeprecatedCallData = { + body?: never; + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: DeprecatedModel | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the query params + */ + cursor: string | null; + }; + url: '/api/v{api-version}/parameters/{parameterPath}'; +}; + +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: { + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + /** + * 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; + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + 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; + }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + path?: never; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: number | null; + }; + path?: never; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; + url: '/api/v{api-version}/parameters'; +}; + +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: SimpleRequestBody; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/requestBody'; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * 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; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + 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 with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName2Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName3Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateName4Data = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + }; + url: '/api/v{api-version}/collectionFormat'; +}; + +export type TypesData = { + body?: never; + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string | null; + /** + * This is a boolean parameter + */ + parameterBoolean: boolean | null; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: Blob | File; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string | null; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: Blob | File; +}; + +export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; + +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString | null; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + name: string | null; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + }; + path: { + id: number; + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; +}; + +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; + +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type ClientOptions = { + baseUrl: 'http://localhost:3000/base' | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/test/plugins.test.ts b/packages/openapi-ts-tests/test/plugins.test.ts index 5ab6b58b6..8e4a6d11d 100644 --- a/packages/openapi-ts-tests/test/plugins.test.ts +++ b/packages/openapi-ts-tests/test/plugins.test.ts @@ -204,6 +204,25 @@ for (const version of versions) { description: 'generate Fetch API client with TanStack Vue Query plugin using class-based SDKs', }, + { + config: createConfig({ + output: 'default', + plugins: ['@pinia/colada', '@hey-api/client-fetch'], + }), + description: 'generate with plugin Pinia Colada', + }, + /* { + config: createConfig({ + output: 'asFileSdk', + plugins: [ + { + groupByTag: true, + name: '@pinia/colada', + }, + ], + }), + description: 'generate with plugin Pinia Colada using file-based SDK', + }, */ { config: createConfig({ output: 'default', @@ -294,7 +313,7 @@ for (const version of versions) { }, ]; - it.each(scenarios)('$description', async ({ config }) => { + it.only.each(scenarios)('$description', async ({ config }) => { await createClient(config); const outputPath = typeof config.output === 'string' ? config.output : ''; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts index 2fad8c081..e62466b62 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts @@ -788,7 +788,7 @@ const schemaTypeToIdentifier = ({ } }; -const irParametersToIrSchema = ({ +export const irParametersToIrSchema = ({ parameters, }: { parameters: Record; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/config.ts b/packages/openapi-ts/src/plugins/@pinia/colada/config.ts new file mode 100644 index 000000000..a92c40d2e --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/config.ts @@ -0,0 +1,37 @@ +import type { Plugin } from '../../types'; +import { handler } from './plugin'; +import type { Config } from './types'; + +export const PluginName = '@pinia/colada'; + +/** + * Default options for the Pinia Colada plugin + */ +export const defaultConfig: Plugin.Config = { + _dependencies: ['@hey-api/typescript'], + _handler: handler, + enableCaching: false, + enablePaginationOnKey: undefined, + errorHandling: 'specific', + exportFromIndex: true, + groupByTag: false, + importPath: PluginName, + includeTypes: true, + name: PluginName, + output: PluginName, + prefixUse: true, + resolveQuery: undefined, + resolveQueryKey: undefined, + suffixQueryMutation: true, + useInfiniteQueries: false, +}; + +/** + * Type helper for `@pinia-colada` plugin, returns {@link Plugin.Config} object + */ +export const defineConfig: Plugin.DefineConfig = ( + config?: Partial, +) => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/index.ts b/packages/openapi-ts/src/plugins/@pinia/colada/index.ts new file mode 100644 index 000000000..98f39ae1f --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/index.ts @@ -0,0 +1,13 @@ +import { PluginName } from './config'; +import { handler } from './plugin.js'; +export { defaultConfig, defineConfig } from './config'; +export type { Config } from './types'; + +/** + * Pinia Colada plugin for generating query and mutation functions + * that work with @pinia/colada + */ +export default { + handler, + name: PluginName, +}; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/mutation.ts b/packages/openapi-ts/src/plugins/@pinia/colada/mutation.ts new file mode 100644 index 000000000..42c351994 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/mutation.ts @@ -0,0 +1,27 @@ +import type { TypeScriptFile } from '../../../generate/files'; +import type { IR } from '../../../ir/types'; +import type { Plugin } from '../../types'; +import type { Config } from './types'; +import { createComposable } from './utils'; + +/** + * Creates a mutation function for an operation + */ +export const createMutationFunction = ({ + context, + file, + operation, + plugin, +}: { + context: IR.Context; + file: TypeScriptFile; + operation: IR.OperationObject; + plugin: Plugin.Instance; +}) => { + // Allow hooks to customize or skip mutation generation + if (plugin?.onMutation && plugin.onMutation(operation) === false) { + return; + } + + createComposable({ context, file, isQuery: false, operation, plugin }); +}; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts new file mode 100644 index 000000000..50725d5e1 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts @@ -0,0 +1,91 @@ +import type { IR } from '../../../ir/types'; +import { clientId } from '../../@hey-api/client-core/utils.js'; +import type { Plugin } from '../../types'; +import { createMutationFunction } from './mutation'; +import { createQueryFunction } from './query'; +import type { Config } from './types'; +import { isQuery } from './utils'; + +/** + * Main handler for the Pinia Colada plugin + */ +export const handler: Plugin.Handler = ({ + context, + plugin, +}: { + context: IR.Context; + plugin: Plugin.Instance; +}) => { + const { enableCaching, exportFromIndex, groupByTag, name, output } = plugin; + + // Create default configuration if not provided + if (enableCaching && plugin.defaultCacheTime === undefined) { + plugin.defaultCacheTime = 300000; // 5 minutes + } + + if (enableCaching && plugin.defaultStaleTime === undefined) { + plugin.defaultStaleTime = 0; // No stale time by default + } + + if (!groupByTag) { + context.createFile({ + exportFromIndex, + id: name, + path: output, + }); + } + + // Create files based on grouping strategy + const getFile = (tag: string) => { + if (!groupByTag) { + return ( + context.file({ id: name }) ?? + context.createFile({ + exportFromIndex, + id: name, + path: output, + }) + ); + } + + const fileId = `${name}/${tag}`; + return ( + context.file({ id: fileId }) ?? + context.createFile({ + exportFromIndex, + id: fileId, + path: `${output}/${tag}`, + }) + ); + }; + + // Process each operation as it's discovered + context.subscribe( + 'operation', + ({ operation }: { operation: IR.OperationObject }) => { + const file = getFile(operation.tags?.[0] || 'default'); + + // Determine if the operation should be a query or mutation + if (isQuery(operation, plugin)) { + createQueryFunction({ context, file, operation, plugin }); + } else { + createMutationFunction({ context, file, operation, plugin }); + } + }, + ); + + // Clean up and finalize after processing + context.subscribe('after', () => { + // Add client import to all generated files + Object.entries(context.files).forEach(([fileId, file]) => { + if (fileId.startsWith(name)) { + // Make sure we have a client import + file.import({ + alias: '_heyApiClient', + module: file.relativePathToFile({ context, id: clientId }), + name: 'client', + }); + } + }); + }); +}; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/query.ts b/packages/openapi-ts/src/plugins/@pinia/colada/query.ts new file mode 100644 index 000000000..02fec983b --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/query.ts @@ -0,0 +1,27 @@ +import type { TypeScriptFile } from '../../../generate/files'; +import type { IR } from '../../../ir/types'; +import type { Plugin } from '../../types'; +import type { Config } from './types'; +import { createComposable } from './utils'; + +/** + * Creates a query function for an operation + */ +export const createQueryFunction = ({ + context, + file, + operation, + plugin, +}: { + context: IR.Context; + file: TypeScriptFile; + operation: IR.OperationObject; + plugin: Plugin.Instance; +}) => { + // Allow hooks to customize or skip query generation + if (plugin?.onQuery && plugin.onQuery(operation) === false) { + return; + } + + createComposable({ context, file, isQuery: true, operation, plugin }); +}; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts new file mode 100644 index 000000000..b341d1d42 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts @@ -0,0 +1,113 @@ +import type { IR } from '../../../ir/types'; +import type { Plugin } from '../../types'; + +export interface Config extends Plugin.Name<'@pinia/colada'> { + /** + * Default cache time for queries in milliseconds. + * @default 300000 (5 minutes) + */ + defaultCacheTime?: number; + + /** + * Default stale time for queries in milliseconds. + * @default 0 (no stale time) + */ + defaultStaleTime?: number; + + /** + * Enable caching for queries. + * @default false + */ + enableCaching?: boolean; + + /** + * Enable pagination support on this key when found in the query parameters or body. + * @default undefined + */ + enablePaginationOnKey?: string; + + /** + * How to handle error responses. + * 'unified' - Unified error type for all errors + * 'specific' - Specific error types per operation + * @default 'specific' + */ + errorHandling?: 'unified' | 'specific'; + + /** + * Export types from index barrel file. + * @default false + */ + exportFromIndex?: boolean; + + /** + * Group operations by tag into separate files. + * @default false + */ + groupByTag?: boolean; + + /** + * Import path for the plugin. + * @default '@pinia/colada' + */ + importPath?: string; + + /** + * Include types in the generated files. + * @default true + */ + includeTypes?: boolean; + + /** + * Custom hook to customize or skip mutation generation. + * Return false to skip generating a mutation for this operation. + * @default undefined + */ + onMutation?: (operation: IR.OperationObject) => boolean | undefined; + + /** + * Custom hook to customize or skip query generation. + * Return false to skip generating a query for this operation. + * @default undefined + */ + onQuery?: (operation: IR.OperationObject) => boolean | undefined; + + /** + * Plugin output path. + * @default '@pinia/colada' + */ + output: string; + + /** + * Whether to prefix generated function names with 'use'. + * @default true + */ + prefixUse?: boolean; + + /** + * Custom hook that determines if an operation should be a query or not. + * Return true to force query, false to force mutation, undefined to use default logic. + * @default undefined + */ + resolveQuery?: (operation: IR.OperationObject) => boolean | undefined; + + /** + * Custom hook to resolve query key. + * Default is [operation.tags?.[0] || 'default', operation.id] + * @default undefined + */ + resolveQueryKey?: (operation: IR.OperationObject) => Array; + + /** + * Whether to suffix generated function names with 'Query' or 'Mutation' to indicate the type + * of Pinia Colada operation that is used under the hood. + * @default true + */ + suffixQueryMutation?: boolean; + + /** + * Use infinite queries. + * @default false + */ + useInfiniteQueries?: boolean; +} diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts new file mode 100644 index 000000000..e4265e20d --- /dev/null +++ b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts @@ -0,0 +1,434 @@ +import type { TypeNode } from '../../../compiler'; +import { compiler, type Property } from '../../../compiler'; +import type { TypeScriptFile } from '../../../generate/files'; +import type { IR } from '../../../ir/types'; +import { escapeComment } from '../../../utils/escape'; +import { stringCase } from '../../../utils/stringCase'; +import { + irParametersToIrSchema, + schemaToType, +} from '../../@hey-api/typescript/plugin.js'; +import { + importIdentifierData, + importIdentifierError, + importIdentifierResponse, +} from '../../@hey-api/typescript/ref'; +import type { Plugin } from '../../types'; +import type { Config } from './types'; + +/** + * Determines if an operation should be a query or mutation + */ +export const isQuery = ( + operation: IR.OperationObject, + plugin: Plugin.Instance, +): boolean => { + // 1. Check for hook override + const hookResult = plugin?.resolveQuery?.(operation); + if (hookResult !== undefined) { + return hookResult; + } + + // 2. Use method as primary signal + if (['get', 'head', 'options'].includes(operation.method)) { + return true; + } + + // 3. Consider body presence as secondary signal + // If method is not GET/HEAD/OPTIONS but also has no body schema, likely a query + return !operation.body?.schema; +}; + +/** + * Generates the cache configuration object for a query + */ +export const generateCacheConfig = ( + operation: IR.OperationObject, + plugin: Plugin.Instance, +) => { + const obj: Array<{ + key: string; + value: any; + }> = []; + + // Use default stale time if specified in config + if (plugin.defaultStaleTime !== undefined) { + obj.push({ + key: 'staleTime', + value: plugin.defaultStaleTime, + }); + } + + // Use default cache time if specified in config + if (plugin.defaultCacheTime !== undefined) { + obj.push({ + key: 'gcTime', + value: plugin.defaultCacheTime, + }); + } + + // Add pagination config if enabled and operation has pagination parameters + if ( + plugin.enablePaginationOnKey && + hasPagination(operation, plugin.enablePaginationOnKey) + ) { + obj.push({ + key: 'infinite', + value: true, + }); + } + + return obj; +}; + +/** + * Checks if operation has pagination parameters + */ +export const hasPagination = ( + operation: IR.OperationObject, + paginationParam: string, +): boolean => + // Check if operation has pagination parameter + !!operation.parameters?.query?.[paginationParam] || + !!operation.body?.pagination; + +/** + * Generates the function name for an operation + */ +export const generateFunctionName = ( + operation: IR.OperationObject, + isQueryType: boolean, + prefixUse: boolean = true, + suffixQueryMutation: boolean = true, +): string => { + const operationPascalCase = stringCase({ + case: 'PascalCase', + value: operation.id, + }); + const prefix = prefixUse ? 'use' : ''; + const suffix = suffixQueryMutation + ? isQueryType + ? 'Query' + : 'Mutation' + : ''; + return `${prefix}${operationPascalCase}${suffix}`; +}; + +const parametersPluralizedNames = [ + 'query', + 'path', + 'headers', + 'body', + 'cookies', +] as const; +type ParamNames = (typeof parametersPluralizedNames)[number]; +// Define a conditional type to transform the names +type NonPluralizedName = T extends 'headers' + ? 'header' + : T extends 'cookies' + ? 'cookie' + : T; +function getNonPluralizedName( + name: T, +): NonPluralizedName { + return ( + ['headers', 'cookies'].includes(name) ? name.slice(0, -1) : name + ) as NonPluralizedName; +} +type DataKeyNames = Exclude; +function getDataSubType(identifier: string, dataKey: DataKeyNames) { + return compiler.indexedAccessTypeNode({ + indexType: compiler.literalTypeNode({ + literal: compiler.stringLiteral({ + text: dataKey, + }), + }), + objectType: compiler.typeReferenceNode({ + typeName: identifier, + }), + }); +} + +function createParameterConst( + name: ParamNames, + operation?: IR.OperationObject, +) { + const nonPluralizedName = getNonPluralizedName(name); + if (nonPluralizedName === 'body' && !operation?.body?.schema) return []; + if ( + nonPluralizedName !== 'body' && + !operation?.parameters?.[nonPluralizedName] + ) + return []; + return [ + compiler.constVariable({ + expression: compiler.callExpression({ + functionName: 'toRef', + parameters: [getParameterQualifiedName(name)], + }), + name: `${name}Ref`, + }), + ]; +} +function getParameterQualifiedName(name: ParamNames) { + return compiler.propertyAccessExpression({ + expression: 'params', + isOptional: true, + name, + }); +} +/** + * Creates a composable function for an operation + */ +export const createComposable = ({ + context, + file, + isQuery, + operation, + plugin, +}: { + context: IR.Context; + file: TypeScriptFile; + isQuery: boolean; + operation: IR.OperationObject; + plugin: Plugin.Instance; +}) => { + // Import necessary functions and types + file.import({ + module: '@pinia/colada', + name: isQuery ? 'useQuery' : 'useMutation', + }); + file.import({ + asType: true, + module: '@pinia/colada', + name: `Use${isQuery ? 'Query' : 'Mutation'}Options`, + }); + file.import({ + module: 'vue', + name: 'toRef', + }); + + // Get query key from hooks or generate default + const queryKey = plugin?.resolveQueryKey?.(operation) ?? [ + operation.tags?.[0] || 'default', + operation.id, + ]; + + // Get identifiers for data, response and error types + const identifierData = importIdentifierData({ context, file, operation }); + const identifierResponse = importIdentifierResponse({ + context, + file, + operation, + }); + const identifierError = importIdentifierError({ context, file, operation }); + + /** + * Creates a parameter for a composable function + */ + function createParameter( + name: ParamNames, + operation?: IR.OperationObject, + ): Property[] { + const nonPluralizedName = getNonPluralizedName(name); + if (nonPluralizedName === 'body' && !operation?.body?.schema) return []; + if ( + nonPluralizedName !== 'body' && + !operation?.parameters?.[nonPluralizedName] + ) + return []; + let type: TypeNode = compiler.keywordTypeNode({ + keyword: 'unknown', + }); + if (nonPluralizedName === 'cookie') { + type = + schemaToType({ + context, + namespace: [], + plugin: plugin as any, + schema: irParametersToIrSchema({ + parameters: operation?.parameters?.cookie || {}, + }), + state: undefined, + }) ?? type; + } else if (name !== 'cookies') { + type = identifierData.name + ? getDataSubType(identifierData.name, name) + : type; + } + return [ + { + name, + type, + }, + ]; + } + const parameters = parametersPluralizedNames.flatMap((name) => + createParameter(name, operation), + ); + + // Create the composable function + const node = compiler.constVariable({ + comment: [ + operation.deprecated && '@deprecated', + operation.summary && escapeComment(operation.summary), + operation.description && escapeComment(operation.description), + ].filter(Boolean), + exportConst: true, + expression: compiler.arrowFunction({ + async: true, + parameters: [ + { + isRequired: parameters.length > 0, + name: 'params', + type: compiler.typeInterfaceNode({ + properties: parameters, + useLegacyResolution: true, + }), + }, + // Additional Pinia Colada options + { + isRequired: false, + name: 'options', + type: compiler.typeReferenceNode({ + typeName: isQuery + ? `UseQueryOptions<${identifierResponse.name || 'unknown'}, ${identifierError.name || 'unknown'}, ${identifierData.name || 'unknown'}>` + : `UseMutationOptions<${identifierResponse.name || 'unknown'}, ${identifierData.name || 'unknown'}, ${identifierError.name || 'unknown'}>`, + }), + }, + ], + statements: [ + // Create reactive refs for parameters + ...parametersPluralizedNames.flatMap((name) => + createParameterConst(name, operation), + ), + + // Create query/mutation result + compiler.constVariable({ + expression: compiler.callExpression({ + functionName: isQuery ? 'useQuery' : 'useMutation', + parameters: [ + compiler.objectExpression({ + obj: [ + // Query/mutation function + { + key: isQuery ? 'query' : 'mutation', + value: compiler.callExpression({ + functionName: '_heyApiClient', + parameters: [ + compiler.objectExpression({ + obj: [ + { + key: 'method', + value: operation.method, + }, + { + key: 'url', + value: operation.path, + }, + // Add data if it's a valid body parameter (mutations only) + ...parametersPluralizedNames.flatMap((name) => { + const nonPluralizedName = + getNonPluralizedName(name); + if ( + nonPluralizedName === 'body' && + !operation?.body?.schema + ) + return []; + if ( + nonPluralizedName !== 'body' && + !operation?.parameters?.[nonPluralizedName] + ) + return []; + return [ + { + key: + nonPluralizedName === 'body' + ? 'data' + : name, + value: compiler.identifier({ + text: `${name}Ref`, + }), + }, + ]; + }), + ].filter(Boolean), + }), + ], + }), + }, + // Query key (optional for mutations) + { + key: 'key', + value: compiler.arrayLiteralExpression({ + elements: [ + ...queryKey.map((k: string) => compiler.ots.string(k)), + // Add path params to query key if they exist + ...parametersPluralizedNames.flatMap((name) => { + const nonPluralizedName = getNonPluralizedName(name); + if ( + nonPluralizedName === 'body' && + !operation?.body?.schema + ) + return []; + if ( + nonPluralizedName !== 'body' && + !operation?.parameters?.[nonPluralizedName] + ) + return []; + return [compiler.identifier({ text: `${name}Ref` })]; + }), + ], + }), + }, + // Spread additional options + { + spread: 'options', + }, + ], + }), + ], + }), + name: isQuery ? 'queryResult' : 'mutationResult', + }), + + // Return useQuery/useMutation call with reactive parameters + compiler.returnStatement({ + expression: compiler.objectExpression({ + obj: [ + // Spread the query/mutation result + { + spread: isQuery ? 'queryResult' : 'mutationResult', + }, + // Return reactive parameters + ...parametersPluralizedNames.flatMap((name) => { + const nonPluralizedName = getNonPluralizedName(name); + if (nonPluralizedName === 'body' && !operation?.body?.schema) + return []; + if ( + nonPluralizedName !== 'body' && + !operation?.parameters?.[nonPluralizedName] + ) + return []; + return [ + { + key: name, + value: compiler.identifier({ text: `${name}Ref` }), + }, + ]; + }), + ], + }), + }), + ], + }), + name: generateFunctionName( + operation, + isQuery, + plugin.prefixUse, + plugin.suffixQueryMutation, + ), + }); + + file.add(node); +}; diff --git a/packages/openapi-ts/src/plugins/index.ts b/packages/openapi-ts/src/plugins/index.ts index d194d87c9..587bd05e2 100644 --- a/packages/openapi-ts/src/plugins/index.ts +++ b/packages/openapi-ts/src/plugins/index.ts @@ -50,6 +50,10 @@ import { type Config as HeyApiTypeScript, defaultConfig as heyApiTypeScript, } from './@hey-api/typescript'; +import { + type Config as PiniaColadaSdk, + defaultConfig as piniaColadaSdk, +} from './@pinia/colada'; import { type Config as TanStackAngularQueryExperimental, defaultConfig as tanStackAngularQueryExperimental, @@ -91,6 +95,7 @@ export type UserPlugins = | Plugin.UserConfig | Plugin.UserConfig | Plugin.UserConfig + | Plugin.UserConfig | Plugin.UserConfig | Plugin.UserConfig | Plugin.UserConfig @@ -116,6 +121,7 @@ export type ClientPlugins = | Plugin.Config | Plugin.Config | Plugin.Config + | Plugin.Config | Plugin.Config | Plugin.Config | Plugin.Config @@ -133,6 +139,7 @@ export const defaultPluginConfigs: DefaultPluginConfigs = { '@hey-api/sdk': heyApiSdk, '@hey-api/transformers': heyApiTransformers, '@hey-api/typescript': heyApiTypeScript, + '@pinia/colada': piniaColadaSdk, '@tanstack/angular-query-experimental': tanStackAngularQueryExperimental, '@tanstack/react-query': tanStackReactQuery, '@tanstack/solid-query': tanStackSolidQuery, diff --git a/packages/openapi-ts/src/plugins/types.d.ts b/packages/openapi-ts/src/plugins/types.d.ts index a4effa533..ed6cff791 100644 --- a/packages/openapi-ts/src/plugins/types.d.ts +++ b/packages/openapi-ts/src/plugins/types.d.ts @@ -27,6 +27,7 @@ export type PluginNames = | '@hey-api/sdk' | '@hey-api/transformers' | '@hey-api/typescript' + | '@pinia/colada' | '@tanstack/angular-query-experimental' | '@tanstack/react-query' | '@tanstack/solid-query' @@ -83,7 +84,7 @@ export type DefaultPluginConfigs = { [K in PluginNames]: BaseConfig & Meta & { _handler: Plugin.Handler>>; - _handlerLegacy: Plugin.LegacyHandler>>; + _handlerLegacy?: Plugin.LegacyHandler>>; }; }; @@ -94,7 +95,7 @@ export namespace Plugin { export type Config = Config & Meta & { _handler: Plugin.Handler; - _handlerLegacy: Plugin.LegacyHandler; + _handlerLegacy?: Plugin.LegacyHandler; exportFromIndex?: boolean; };