fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(pinia-colada): update snapshots

+330 -126
+41 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/asClass/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, FooBazService, BarBazService } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { GetFooData, FooPostData, FooPostResponse, FooPutData, FooPutResponse, GetFooBarData, FooBarPostData, FooBarPostResponse, FooBarPutData, FooBarPutResponse } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const getFooQueryKey = (options?: Options<GetFooData>) => createQueryKey('getFoo', options); 43 + 8 44 export const getFooQuery = defineQueryOptions({ 9 - key: [ 10 - 'getFoo' 11 - ], 45 + key: getFooQueryKey(), 12 46 query: async () => { 13 47 const { data } = await FooBazService.getFoo({ throwOnError: true }); 14 48 return data; ··· 41 75 }; 42 76 }; 43 77 78 + export const getFooBarQueryKey = (options?: Options<GetFooBarData>) => createQueryKey('getFooBar', options); 79 + 44 80 export const getFooBarQuery = defineQueryOptions({ 45 - key: [ 46 - 'getFooBar' 47 - ], 81 + key: getFooBarQueryKey(), 48 82 query: async () => { 49 83 const { data } = await BarBazService.getFooBar({ throwOnError: true }); 50 84 return data;
+63 -29
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, serviceWithEmptyTag, patchApiVbyApiVersionNoTag, fooWow, deleteCallWithoutParametersAndResponse, getCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, callWithDescriptions, callWithParameters, callWithWeirdParameterNames, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName2, duplicateName3, duplicateName4, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, complexTypes, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, postApiVbyApiVersionBody } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { ServiceWithEmptyTagData, PatchApiVbyApiVersionNoTagData, FooWowData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, CallWithDescriptionsData, CallWithParametersData, CallWithWeirdParameterNamesData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseData, DummyAData, DummyBData, CallWithResponseData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesData, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, ComplexTypesData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PostApiVbyApiVersionBodyData, PostApiVbyApiVersionBodyError, PostApiVbyApiVersionBodyResponse } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const serviceWithEmptyTagQueryKey = (options?: Options<ServiceWithEmptyTagData>) => createQueryKey('serviceWithEmptyTag', options); 43 + 8 44 export const serviceWithEmptyTagQuery = defineQueryOptions({ 9 - key: [ 10 - 'serviceWithEmptyTag' 11 - ], 45 + key: serviceWithEmptyTagQueryKey(), 12 46 query: async () => { 13 47 const { data } = await serviceWithEmptyTag({ throwOnError: true }); 14 48 return data; ··· 54 88 }; 55 89 }; 56 90 91 + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options<GetCallWithoutParametersAndResponseData>) => createQueryKey('getCallWithoutParametersAndResponse', options); 92 + 57 93 export const getCallWithoutParametersAndResponseQuery = defineQueryOptions({ 58 - key: [ 59 - 'getCallWithoutParametersAndResponse' 60 - ], 94 + key: getCallWithoutParametersAndResponseQueryKey(), 61 95 query: async () => { 62 96 const { data } = await getCallWithoutParametersAndResponse({ throwOnError: true }); 63 97 return data; ··· 142 176 }; 143 177 }; 144 178 145 - export const callWithDefaultParametersQueryKey = (options: Options<CallWithDefaultParametersData>) => _heyapi_187_('callWithDefaultParameters', options); 179 + export const callWithDefaultParametersQueryKey = (options: Options<CallWithDefaultParametersData>) => createQueryKey('callWithDefaultParameters', options); 146 180 147 181 export const callWithDefaultParametersQuery = defineQueryOptions((options: Options<CallWithDefaultParametersData>) => ({ 148 182 key: callWithDefaultParametersQueryKey(options), ··· 193 227 } 194 228 }; 195 229 }; 230 + 231 + export const duplicateName2QueryKey = (options?: Options<DuplicateName2Data>) => createQueryKey('duplicateName2', options); 196 232 197 233 export const duplicateName2Query = defineQueryOptions({ 198 - key: [ 199 - 'duplicateName2' 200 - ], 234 + key: duplicateName2QueryKey(), 201 235 query: async () => { 202 236 const { data } = await duplicateName2({ throwOnError: true }); 203 237 return data; ··· 229 263 } 230 264 }; 231 265 }; 266 + 267 + export const callWithNoContentResponseQueryKey = (options?: Options<CallWithNoContentResponseData>) => createQueryKey('callWithNoContentResponse', options); 232 268 233 269 export const callWithNoContentResponseQuery = defineQueryOptions({ 234 - key: [ 235 - 'callWithNoContentResponse' 236 - ], 270 + key: callWithNoContentResponseQueryKey(), 237 271 query: async () => { 238 272 const { data } = await callWithNoContentResponse({ throwOnError: true }); 239 273 return data; 240 274 } 241 275 }); 276 + 277 + export const callWithResponseAndNoContentResponseQueryKey = (options?: Options<CallWithResponseAndNoContentResponseData>) => createQueryKey('callWithResponseAndNoContentResponse', options); 242 278 243 279 export const callWithResponseAndNoContentResponseQuery = defineQueryOptions({ 244 - key: [ 245 - 'callWithResponseAndNoContentResponse' 246 - ], 280 + key: callWithResponseAndNoContentResponseQueryKey(), 247 281 query: async () => { 248 282 const { data } = await callWithResponseAndNoContentResponse({ throwOnError: true }); 249 283 return data; 250 284 } 251 285 }); 252 286 287 + export const dummyAQueryKey = (options?: Options<DummyAData>) => createQueryKey('dummyA', options); 288 + 253 289 export const dummyAQuery = defineQueryOptions({ 254 - key: [ 255 - 'dummyA' 256 - ], 290 + key: dummyAQueryKey(), 257 291 query: async () => { 258 292 const { data } = await dummyA({ throwOnError: true }); 259 293 return data; 260 294 } 261 295 }); 262 296 297 + export const dummyBQueryKey = (options?: Options<DummyBData>) => createQueryKey('dummyB', options); 298 + 263 299 export const dummyBQuery = defineQueryOptions({ 264 - key: [ 265 - 'dummyB' 266 - ], 300 + key: dummyBQueryKey(), 267 301 query: async () => { 268 302 const { data } = await dummyB({ throwOnError: true }); 269 303 return data; 270 304 } 271 305 }); 272 306 307 + export const callWithResponseQueryKey = (options?: Options<CallWithResponseData>) => createQueryKey('callWithResponse', options); 308 + 273 309 export const callWithResponseQuery = defineQueryOptions({ 274 - key: [ 275 - 'callWithResponse' 276 - ], 310 + key: callWithResponseQueryKey(), 277 311 query: async () => { 278 312 const { data } = await callWithResponse({ throwOnError: true }); 279 313 return data; ··· 306 340 }; 307 341 }; 308 342 309 - export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => 2('collectionFormat', options); 343 + export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => createQueryKey('collectionFormat', options); 310 344 311 345 export const collectionFormatQuery = defineQueryOptions((options: Options<CollectionFormatData>) => ({ 312 346 key: collectionFormatQueryKey(options), ··· 319 353 } 320 354 })); 321 355 322 - export const typesQueryKey = (options: Options<TypesData>) => 2('types', options); 356 + export const typesQueryKey = (options: Options<TypesData>) => createQueryKey('types', options); 323 357 324 358 export const typesQuery = defineQueryOptions((options: Options<TypesData>) => ({ 325 359 key: typesQueryKey(options), ··· 332 366 } 333 367 })); 334 368 335 - export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => 2('complexTypes', options); 369 + export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => createQueryKey('complexTypes', options); 336 370 337 371 export const complexTypesQuery = defineQueryOptions((options: Options<ComplexTypesData>) => ({ 338 372 key: complexTypesQueryKey(options),
+41 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/asClass/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, FooBazService, BarBazService } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { GetFooData, FooPostData, FooPostResponse, FooPutData, FooPutResponse, GetFooBarData, FooBarPostData, FooBarPostResponse, FooBarPutData, FooBarPutResponse } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const getFooQueryKey = (options?: Options<GetFooData>) => createQueryKey('getFoo', options); 43 + 8 44 export const getFooQuery = defineQueryOptions({ 9 - key: [ 10 - 'getFoo' 11 - ], 45 + key: getFooQueryKey(), 12 46 query: async () => { 13 47 const { data } = await FooBazService.getFoo({ throwOnError: true }); 14 48 return data; ··· 41 75 }; 42 76 }; 43 77 78 + export const getFooBarQueryKey = (options?: Options<GetFooBarData>) => createQueryKey('getFooBar', options); 79 + 44 80 export const getFooBarQuery = defineQueryOptions({ 45 - key: [ 46 - 'getFooBar' 47 - ], 81 + key: getFooBarQueryKey(), 48 82 query: async () => { 49 83 const { data } = await BarBazService.getFooBar({ throwOnError: true }); 50 84 return data;
+72 -38
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, export_, patchApiVbyApiVersionNoTag, import_, fooWow, apiVVersionODataControllerCount, getApiVbyApiVersionSimpleOperation, deleteCallWithoutParametersAndResponse, getCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName2, duplicateName3, duplicateName4, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartResponse, multipartRequest, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportData, ImportResponse, FooWowData, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3 as DeleteFooData, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseData, DummyAData, DummyBData, CallWithResponseData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesData, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartResponseData, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const exportQueryKey = (options?: Options<ExportData>) => createQueryKey('export', options); 43 + 8 44 export const exportQuery = defineQueryOptions({ 9 - key: [ 10 - 'export' 11 - ], 45 + key: exportQueryKey(), 12 46 query: async () => { 13 47 const { data } = await export_({ throwOnError: true }); 14 48 return data; ··· 54 88 }; 55 89 }; 56 90 91 + export const apiVVersionODataControllerCountQueryKey = (options?: Options<ApiVVersionODataControllerCountData>) => createQueryKey('apiVVersionODataControllerCount', options); 92 + 57 93 export const apiVVersionODataControllerCountQuery = defineQueryOptions({ 58 - key: [ 59 - 'apiVVersionODataControllerCount' 60 - ], 94 + key: apiVVersionODataControllerCountQueryKey(), 61 95 query: async () => { 62 96 const { data } = await apiVVersionODataControllerCount({ throwOnError: true }); 63 97 return data; 64 98 } 65 99 }); 66 100 67 - export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options<GetApiVbyApiVersionSimpleOperationData>) => _heyapi_308_('getApiVbyApiVersionSimpleOperation', options); 101 + export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options<GetApiVbyApiVersionSimpleOperationData>) => createQueryKey('getApiVbyApiVersionSimpleOperation', options); 68 102 69 103 export const getApiVbyApiVersionSimpleOperationQuery = defineQueryOptions((options: Options<GetApiVbyApiVersionSimpleOperationData>) => ({ 70 104 key: getApiVbyApiVersionSimpleOperationQueryKey(options), ··· 90 124 }; 91 125 }; 92 126 127 + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options<GetCallWithoutParametersAndResponseData>) => createQueryKey('getCallWithoutParametersAndResponse', options); 128 + 93 129 export const getCallWithoutParametersAndResponseQuery = defineQueryOptions({ 94 - key: [ 95 - 'getCallWithoutParametersAndResponse' 96 - ], 130 + key: getCallWithoutParametersAndResponseQueryKey(), 97 131 query: async () => { 98 132 const { data } = await getCallWithoutParametersAndResponse({ throwOnError: true }); 99 133 return data; ··· 207 241 }; 208 242 }; 209 243 210 - export const getCallWithOptionalParamQueryKey = (options: Options<GetCallWithOptionalParamData>) => 2('getCallWithOptionalParam', options); 244 + export const getCallWithOptionalParamQueryKey = (options: Options<GetCallWithOptionalParamData>) => createQueryKey('getCallWithOptionalParam', options); 211 245 212 246 export const getCallWithOptionalParamQuery = defineQueryOptions((options: Options<GetCallWithOptionalParamData>) => ({ 213 247 key: getCallWithOptionalParamQueryKey(options), ··· 259 293 }; 260 294 }; 261 295 262 - export const callWithDefaultParametersQueryKey = (options?: Options<CallWithDefaultParametersData>) => 2('callWithDefaultParameters', options); 296 + export const callWithDefaultParametersQueryKey = (options?: Options<CallWithDefaultParametersData>) => createQueryKey('callWithDefaultParameters', options); 263 297 264 298 export const callWithDefaultParametersQuery = defineQueryOptions((options?: Options<CallWithDefaultParametersData>) => ({ 265 299 key: callWithDefaultParametersQueryKey(options), ··· 309 343 } 310 344 }; 311 345 }; 346 + 347 + export const duplicateName2QueryKey = (options?: Options<DuplicateName2Data>) => createQueryKey('duplicateName2', options); 312 348 313 349 export const duplicateName2Query = defineQueryOptions({ 314 - key: [ 315 - 'duplicateName2' 316 - ], 350 + key: duplicateName2QueryKey(), 317 351 query: async () => { 318 352 const { data } = await duplicateName2({ throwOnError: true }); 319 353 return data; ··· 346 380 }; 347 381 }; 348 382 383 + export const callWithNoContentResponseQueryKey = (options?: Options<CallWithNoContentResponseData>) => createQueryKey('callWithNoContentResponse', options); 384 + 349 385 export const callWithNoContentResponseQuery = defineQueryOptions({ 350 - key: [ 351 - 'callWithNoContentResponse' 352 - ], 386 + key: callWithNoContentResponseQueryKey(), 353 387 query: async () => { 354 388 const { data } = await callWithNoContentResponse({ throwOnError: true }); 355 389 return data; 356 390 } 357 391 }); 358 392 393 + export const callWithResponseAndNoContentResponseQueryKey = (options?: Options<CallWithResponseAndNoContentResponseData>) => createQueryKey('callWithResponseAndNoContentResponse', options); 394 + 359 395 export const callWithResponseAndNoContentResponseQuery = defineQueryOptions({ 360 - key: [ 361 - 'callWithResponseAndNoContentResponse' 362 - ], 396 + key: callWithResponseAndNoContentResponseQueryKey(), 363 397 query: async () => { 364 398 const { data } = await callWithResponseAndNoContentResponse({ throwOnError: true }); 365 399 return data; 366 400 } 367 401 }); 368 402 403 + export const dummyAQueryKey = (options?: Options<DummyAData>) => createQueryKey('dummyA', options); 404 + 369 405 export const dummyAQuery = defineQueryOptions({ 370 - key: [ 371 - 'dummyA' 372 - ], 406 + key: dummyAQueryKey(), 373 407 query: async () => { 374 408 const { data } = await dummyA({ throwOnError: true }); 375 409 return data; 376 410 } 377 411 }); 378 412 413 + export const dummyBQueryKey = (options?: Options<DummyBData>) => createQueryKey('dummyB', options); 414 + 379 415 export const dummyBQuery = defineQueryOptions({ 380 - key: [ 381 - 'dummyB' 382 - ], 416 + key: dummyBQueryKey(), 383 417 query: async () => { 384 418 const { data } = await dummyB({ throwOnError: true }); 385 419 return data; 386 420 } 387 421 }); 388 422 423 + export const callWithResponseQueryKey = (options?: Options<CallWithResponseData>) => createQueryKey('callWithResponse', options); 424 + 389 425 export const callWithResponseQuery = defineQueryOptions({ 390 - key: [ 391 - 'callWithResponse' 392 - ], 426 + key: callWithResponseQueryKey(), 393 427 query: async () => { 394 428 const { data } = await callWithResponse({ throwOnError: true }); 395 429 return data; ··· 422 456 }; 423 457 }; 424 458 425 - export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => 2('collectionFormat', options); 459 + export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => createQueryKey('collectionFormat', options); 426 460 427 461 export const collectionFormatQuery = defineQueryOptions((options: Options<CollectionFormatData>) => ({ 428 462 key: collectionFormatQueryKey(options), ··· 435 469 } 436 470 })); 437 471 438 - export const typesQueryKey = (options: Options<TypesData>) => 2('types', options); 472 + export const typesQueryKey = (options: Options<TypesData>) => createQueryKey('types', options); 439 473 440 474 export const typesQuery = defineQueryOptions((options: Options<TypesData>) => ({ 441 475 key: typesQueryKey(options), ··· 461 495 }; 462 496 }; 463 497 464 - export const fileResponseQueryKey = (options: Options<FileResponseData>) => 2('fileResponse', options); 498 + export const fileResponseQueryKey = (options: Options<FileResponseData>) => createQueryKey('fileResponse', options); 465 499 466 500 export const fileResponseQuery = defineQueryOptions((options: Options<FileResponseData>) => ({ 467 501 key: fileResponseQueryKey(options), ··· 474 508 } 475 509 })); 476 510 477 - export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => 2('complexTypes', options); 511 + export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => createQueryKey('complexTypes', options); 478 512 479 513 export const complexTypesQuery = defineQueryOptions((options: Options<ComplexTypesData>) => ({ 480 514 key: complexTypesQueryKey(options), ··· 487 521 } 488 522 })); 489 523 524 + export const multipartResponseQueryKey = (options?: Options<MultipartResponseData>) => createQueryKey('multipartResponse', options); 525 + 490 526 export const multipartResponseQuery = defineQueryOptions({ 491 - key: [ 492 - 'multipartResponse' 493 - ], 527 + key: multipartResponseQueryKey(), 494 528 query: async () => { 495 529 const { data } = await multipartResponse({ throwOnError: true }); 496 530 return data;
+41 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/asClass/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, FooBazService, BarBazService } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { GetFooData, FooPostData, FooPostResponse, FooPutData, FooPutResponse, GetFooBarData, FooBarPostData, FooBarPostResponse, FooBarPutData, FooBarPutResponse } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const getFooQueryKey = (options?: Options<GetFooData>) => createQueryKey('getFoo', options); 43 + 8 44 export const getFooQuery = defineQueryOptions({ 9 - key: [ 10 - 'getFoo' 11 - ], 45 + key: getFooQueryKey(), 12 46 query: async () => { 13 47 const { data } = await FooBazService.getFoo({ throwOnError: true }); 14 48 return data; ··· 41 75 }; 42 76 }; 43 77 78 + export const getFooBarQueryKey = (options?: Options<GetFooBarData>) => createQueryKey('getFooBar', options); 79 + 44 80 export const getFooBarQuery = defineQueryOptions({ 45 - key: [ 46 - 'getFooBar' 47 - ], 81 + key: getFooBarQueryKey(), 48 82 query: async () => { 49 83 const { data } = await BarBazService.getFooBar({ throwOnError: true }); 50 84 return data;
+72 -38
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 3 import { type Options, export_, patchApiVbyApiVersionNoTag, import_, fooWow, apiVVersionODataControllerCount, getApiVbyApiVersionSimpleOperation, deleteCallWithoutParametersAndResponse, getCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName2, duplicateName3, duplicateName4, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartResponse, multipartRequest, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../sdk.gen'; 4 - import { type UseQueryOptions, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 4 + import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@pinia/colada'; 5 5 import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportData, ImportResponse, FooWowData, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationData, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3 as DeleteFooData, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseData, DummyAData, DummyBData, CallWithResponseData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesData, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartResponseData, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; 6 6 import { client } from '../client.gen'; 7 7 8 + export type QueryKey<TOptions extends Options> = [ 9 + Pick<TOptions, 'body' | 'path'> & { 10 + _id: string; 11 + baseUrl?: _JSONValue; 12 + headers?: _JSONValue; 13 + query?: _JSONValue; 14 + tags?: _JSONValue; 15 + } 16 + ]; 17 + 18 + const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, tags?: ReadonlyArray<string>): [ 19 + QueryKey<TOptions>[0] 20 + ] => { 21 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0]; 22 + if (tags) { 23 + params.tags = tags as unknown as _JSONValue; 24 + } 25 + if (options?.body) { 26 + params.body = options.body; 27 + } 28 + if (options?.headers) { 29 + params.headers = options.headers as unknown as _JSONValue; 30 + } 31 + if (options?.path) { 32 + params.path = options.path; 33 + } 34 + if (options?.query) { 35 + params.query = options.query as unknown as _JSONValue; 36 + } 37 + return [ 38 + params 39 + ]; 40 + }; 41 + 42 + export const exportQueryKey = (options?: Options<ExportData>) => createQueryKey('export', options); 43 + 8 44 export const exportQuery = defineQueryOptions({ 9 - key: [ 10 - 'export' 11 - ], 45 + key: exportQueryKey(), 12 46 query: async () => { 13 47 const { data } = await export_({ throwOnError: true }); 14 48 return data; ··· 54 88 }; 55 89 }; 56 90 91 + export const apiVVersionODataControllerCountQueryKey = (options?: Options<ApiVVersionODataControllerCountData>) => createQueryKey('apiVVersionODataControllerCount', options); 92 + 57 93 export const apiVVersionODataControllerCountQuery = defineQueryOptions({ 58 - key: [ 59 - 'apiVVersionODataControllerCount' 60 - ], 94 + key: apiVVersionODataControllerCountQueryKey(), 61 95 query: async () => { 62 96 const { data } = await apiVVersionODataControllerCount({ throwOnError: true }); 63 97 return data; 64 98 } 65 99 }); 66 100 67 - export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options<GetApiVbyApiVersionSimpleOperationData>) => _heyapi_308_('getApiVbyApiVersionSimpleOperation', options); 101 + export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options<GetApiVbyApiVersionSimpleOperationData>) => createQueryKey('getApiVbyApiVersionSimpleOperation', options); 68 102 69 103 export const getApiVbyApiVersionSimpleOperationQuery = defineQueryOptions((options: Options<GetApiVbyApiVersionSimpleOperationData>) => ({ 70 104 key: getApiVbyApiVersionSimpleOperationQueryKey(options), ··· 90 124 }; 91 125 }; 92 126 127 + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options<GetCallWithoutParametersAndResponseData>) => createQueryKey('getCallWithoutParametersAndResponse', options); 128 + 93 129 export const getCallWithoutParametersAndResponseQuery = defineQueryOptions({ 94 - key: [ 95 - 'getCallWithoutParametersAndResponse' 96 - ], 130 + key: getCallWithoutParametersAndResponseQueryKey(), 97 131 query: async () => { 98 132 const { data } = await getCallWithoutParametersAndResponse({ throwOnError: true }); 99 133 return data; ··· 207 241 }; 208 242 }; 209 243 210 - export const getCallWithOptionalParamQueryKey = (options: Options<GetCallWithOptionalParamData>) => 2('getCallWithOptionalParam', options); 244 + export const getCallWithOptionalParamQueryKey = (options: Options<GetCallWithOptionalParamData>) => createQueryKey('getCallWithOptionalParam', options); 211 245 212 246 export const getCallWithOptionalParamQuery = defineQueryOptions((options: Options<GetCallWithOptionalParamData>) => ({ 213 247 key: getCallWithOptionalParamQueryKey(options), ··· 259 293 }; 260 294 }; 261 295 262 - export const callWithDefaultParametersQueryKey = (options?: Options<CallWithDefaultParametersData>) => 2('callWithDefaultParameters', options); 296 + export const callWithDefaultParametersQueryKey = (options?: Options<CallWithDefaultParametersData>) => createQueryKey('callWithDefaultParameters', options); 263 297 264 298 export const callWithDefaultParametersQuery = defineQueryOptions((options?: Options<CallWithDefaultParametersData>) => ({ 265 299 key: callWithDefaultParametersQueryKey(options), ··· 309 343 } 310 344 }; 311 345 }; 346 + 347 + export const duplicateName2QueryKey = (options?: Options<DuplicateName2Data>) => createQueryKey('duplicateName2', options); 312 348 313 349 export const duplicateName2Query = defineQueryOptions({ 314 - key: [ 315 - 'duplicateName2' 316 - ], 350 + key: duplicateName2QueryKey(), 317 351 query: async () => { 318 352 const { data } = await duplicateName2({ throwOnError: true }); 319 353 return data; ··· 346 380 }; 347 381 }; 348 382 383 + export const callWithNoContentResponseQueryKey = (options?: Options<CallWithNoContentResponseData>) => createQueryKey('callWithNoContentResponse', options); 384 + 349 385 export const callWithNoContentResponseQuery = defineQueryOptions({ 350 - key: [ 351 - 'callWithNoContentResponse' 352 - ], 386 + key: callWithNoContentResponseQueryKey(), 353 387 query: async () => { 354 388 const { data } = await callWithNoContentResponse({ throwOnError: true }); 355 389 return data; 356 390 } 357 391 }); 358 392 393 + export const callWithResponseAndNoContentResponseQueryKey = (options?: Options<CallWithResponseAndNoContentResponseData>) => createQueryKey('callWithResponseAndNoContentResponse', options); 394 + 359 395 export const callWithResponseAndNoContentResponseQuery = defineQueryOptions({ 360 - key: [ 361 - 'callWithResponseAndNoContentResponse' 362 - ], 396 + key: callWithResponseAndNoContentResponseQueryKey(), 363 397 query: async () => { 364 398 const { data } = await callWithResponseAndNoContentResponse({ throwOnError: true }); 365 399 return data; 366 400 } 367 401 }); 368 402 403 + export const dummyAQueryKey = (options?: Options<DummyAData>) => createQueryKey('dummyA', options); 404 + 369 405 export const dummyAQuery = defineQueryOptions({ 370 - key: [ 371 - 'dummyA' 372 - ], 406 + key: dummyAQueryKey(), 373 407 query: async () => { 374 408 const { data } = await dummyA({ throwOnError: true }); 375 409 return data; 376 410 } 377 411 }); 378 412 413 + export const dummyBQueryKey = (options?: Options<DummyBData>) => createQueryKey('dummyB', options); 414 + 379 415 export const dummyBQuery = defineQueryOptions({ 380 - key: [ 381 - 'dummyB' 382 - ], 416 + key: dummyBQueryKey(), 383 417 query: async () => { 384 418 const { data } = await dummyB({ throwOnError: true }); 385 419 return data; 386 420 } 387 421 }); 388 422 423 + export const callWithResponseQueryKey = (options?: Options<CallWithResponseData>) => createQueryKey('callWithResponse', options); 424 + 389 425 export const callWithResponseQuery = defineQueryOptions({ 390 - key: [ 391 - 'callWithResponse' 392 - ], 426 + key: callWithResponseQueryKey(), 393 427 query: async () => { 394 428 const { data } = await callWithResponse({ throwOnError: true }); 395 429 return data; ··· 422 456 }; 423 457 }; 424 458 425 - export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => 2('collectionFormat', options); 459 + export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => createQueryKey('collectionFormat', options); 426 460 427 461 export const collectionFormatQuery = defineQueryOptions((options: Options<CollectionFormatData>) => ({ 428 462 key: collectionFormatQueryKey(options), ··· 435 469 } 436 470 })); 437 471 438 - export const typesQueryKey = (options: Options<TypesData>) => 2('types', options); 472 + export const typesQueryKey = (options: Options<TypesData>) => createQueryKey('types', options); 439 473 440 474 export const typesQuery = defineQueryOptions((options: Options<TypesData>) => ({ 441 475 key: typesQueryKey(options), ··· 461 495 }; 462 496 }; 463 497 464 - export const fileResponseQueryKey = (options: Options<FileResponseData>) => 2('fileResponse', options); 498 + export const fileResponseQueryKey = (options: Options<FileResponseData>) => createQueryKey('fileResponse', options); 465 499 466 500 export const fileResponseQuery = defineQueryOptions((options: Options<FileResponseData>) => ({ 467 501 key: fileResponseQueryKey(options), ··· 474 508 } 475 509 })); 476 510 477 - export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => 2('complexTypes', options); 511 + export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => createQueryKey('complexTypes', options); 478 512 479 513 export const complexTypesQuery = defineQueryOptions((options: Options<ComplexTypesData>) => ({ 480 514 key: complexTypesQueryKey(options), ··· 487 521 } 488 522 })); 489 523 524 + export const multipartResponseQueryKey = (options?: Options<MultipartResponseData>) => createQueryKey('multipartResponse', options); 525 + 490 526 export const multipartResponseQuery = defineQueryOptions({ 491 - key: [ 492 - 'multipartResponse' 493 - ], 527 + key: multipartResponseQueryKey(), 494 528 query: async () => { 495 529 const { data } = await multipartResponse({ throwOnError: true }); 496 530 return data;