diff --git a/examples/generated-rq/1password-connect/client.ts b/examples/generated-rq/1password-connect/client.ts index 3fa80e4..5d0cdc3 100644 --- a/examples/generated-rq/1password-connect/client.ts +++ b/examples/generated-rq/1password-connect/client.ts @@ -1,6 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit -import type { APIRequest, File, FullItem, Item, Patch, Vault } from './models.js' +import type { APIRequest, File, FullItem, Item, Patch, ServiceDependency, Vault } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' export class ApiError extends Error { @@ -326,7 +326,7 @@ export async function getHeartbeat(config?: Partial): Promise -): Promise> { +): Promise<{ name: string; version: string; dependencies?: ServiceDependency[] }> { const res = await _request('GET', '/health', {}, config) return res.json() } diff --git a/examples/generated-rq/1password-connect/hooks.ts b/examples/generated-rq/1password-connect/hooks.ts index 8a7d5d2..19323fe 100644 --- a/examples/generated-rq/1password-connect/hooks.ts +++ b/examples/generated-rq/1password-connect/hooks.ts @@ -40,24 +40,32 @@ export const activityKeys = { export const vaultKeys = { all: () => ['vaults'] as const, list: (params?: Parameters[0]) => ['vaults', 'list', params] as const, - getVaultById: (vaultUuid: string) => ['vaults', 'getVaultById', vaultUuid] as const, - getVaultItems: (vaultUuid: string, params?: Parameters[1]) => - ['vaults', 'getVaultItems', vaultUuid, params] as const, - getVaultItemById: (vaultUuid: string, itemUuid: string) => - ['vaults', 'getVaultItemById', vaultUuid, itemUuid] as const, + getVaultById: (vaultUuid: Parameters[0]) => + ['vaults', 'getVaultById', vaultUuid] as const, + getVaultItems: ( + vaultUuid: Parameters[0], + params?: Parameters[1] + ) => ['vaults', 'getVaultItems', vaultUuid, params] as const, + getVaultItemById: ( + vaultUuid: Parameters[0], + itemUuid: Parameters[1] + ) => ['vaults', 'getVaultItemById', vaultUuid, itemUuid] as const, getItemFiles: ( - vaultUuid: string, - itemUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], params?: Parameters[2] ) => ['vaults', 'getItemFiles', vaultUuid, itemUuid, params] as const, getDetailsOfFileById: ( - vaultUuid: string, - itemUuid: string, - fileUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], + fileUuid: Parameters[2], params?: Parameters[3] ) => ['vaults', 'getDetailsOfFileById', vaultUuid, itemUuid, fileUuid, params] as const, - downloadFileByID: (vaultUuid: string, itemUuid: string, fileUuid: string) => - ['vaults', 'downloadFileByID', vaultUuid, itemUuid, fileUuid] as const, + downloadFileByID: ( + vaultUuid: Parameters[0], + itemUuid: Parameters[1], + fileUuid: Parameters[2] + ) => ['vaults', 'downloadFileByID', vaultUuid, itemUuid, fileUuid] as const, } export const heartbeatKeys = { @@ -110,7 +118,7 @@ export function getVaultsQueryOptions( } export function getVaultByIdQueryOptions( - vaultUuid: string, + vaultUuid: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -126,7 +134,7 @@ export function getVaultByIdQueryOptions( } export function getVaultItemsQueryOptions( - vaultUuid: string, + vaultUuid: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -143,8 +151,8 @@ export function getVaultItemsQueryOptions( } export function getVaultItemByIdQueryOptions( - vaultUuid: string, - itemUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -160,8 +168,8 @@ export function getVaultItemByIdQueryOptions( } export function getItemFilesQueryOptions( - vaultUuid: string, - itemUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -178,9 +186,9 @@ export function getItemFilesQueryOptions( } export function getDetailsOfFileByIdQueryOptions( - vaultUuid: string, - itemUuid: string, - fileUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], + fileUuid: Parameters[2], params?: Parameters[3], options?: Omit< UseQueryOptions>, ApiError>, @@ -197,9 +205,9 @@ export function getDetailsOfFileByIdQueryOptions( } export function downloadFileByIDQueryOptions( - vaultUuid: string, - itemUuid: string, - fileUuid: string, + vaultUuid: Parameters[0], + itemUuid: Parameters[1], + fileUuid: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -325,7 +333,7 @@ export function useGetVaults( } export function useGetVaultById( - vaultUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -342,7 +350,7 @@ export function useGetVaultById( } export function useGetVaultItems( - vaultUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -360,8 +368,8 @@ export function useGetVaultItems( } export function useGetVaultItemById( - vaultUuid: string | undefined | null, - itemUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, + itemUuid: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -378,8 +386,8 @@ export function useGetVaultItemById( } export function useGetItemFiles( - vaultUuid: string | undefined | null, - itemUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, + itemUuid: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -397,9 +405,9 @@ export function useGetItemFiles( } export function useGetDetailsOfFileById( - vaultUuid: string | undefined | null, - itemUuid: string | undefined | null, - fileUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, + itemUuid: Parameters[1] | undefined | null, + fileUuid: Parameters[2] | undefined | null, params?: Parameters[3], options?: Omit< UseQueryOptions>, ApiError>, @@ -418,9 +426,9 @@ export function useGetDetailsOfFileById( } export function useDownloadFileByID( - vaultUuid: string | undefined | null, - itemUuid: string | undefined | null, - fileUuid: string | undefined | null, + vaultUuid: Parameters[0] | undefined | null, + itemUuid: Parameters[1] | undefined | null, + fileUuid: Parameters[2] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -489,7 +497,10 @@ export function useCreateVaultItem( UseMutationOptions< Awaited>, ApiError, - { vaultUuid: string; body: Parameters[1] } + { + vaultUuid: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -497,7 +508,10 @@ export function useCreateVaultItem( return useMutation< Awaited>, ApiError, - { vaultUuid: string; body: Parameters[1] } + { + vaultUuid: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ vaultUuid, body }) => createVaultItem(vaultUuid, body), ...options, @@ -509,7 +523,11 @@ export function useUpdateVaultItem( UseMutationOptions< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string; body: Parameters[2] } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -517,7 +535,11 @@ export function useUpdateVaultItem( return useMutation< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string; body: Parameters[2] } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ vaultUuid, itemUuid, body }) => updateVaultItem(vaultUuid, itemUuid, body), ...options, @@ -529,7 +551,11 @@ export function usePatchVaultItem( UseMutationOptions< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string; body: Parameters[2] } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -537,7 +563,11 @@ export function usePatchVaultItem( return useMutation< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string; body: Parameters[2] } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ vaultUuid, itemUuid, body }) => patchVaultItem(vaultUuid, itemUuid, body), ...options, @@ -549,7 +579,10 @@ export function useDeleteVaultItem( UseMutationOptions< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + } >, 'mutationFn' > @@ -557,7 +590,10 @@ export function useDeleteVaultItem( return useMutation< Awaited>, ApiError, - { vaultUuid: string; itemUuid: string } + { + vaultUuid: Parameters[0] + itemUuid: Parameters[1] + } >({ mutationFn: ({ vaultUuid, itemUuid }) => deleteVaultItem(vaultUuid, itemUuid), ...options, diff --git a/examples/generated-rq/adyen-checkout/hooks.ts b/examples/generated-rq/adyen-checkout/hooks.ts index ce00b18..af31a5f 100644 --- a/examples/generated-rq/adyen-checkout/hooks.ts +++ b/examples/generated-rq/adyen-checkout/hooks.ts @@ -43,13 +43,16 @@ import { export const paymentLinkKeys = { all: () => ['paymentLinks'] as const, - detail: (linkId: string) => ['paymentLinks', linkId] as const, + detail: (linkId: Parameters[0]) => + ['paymentLinks', linkId] as const, } export const sessionKeys = { all: () => ['sessions'] as const, - detail: (sessionId: string, params: Parameters[1]) => - ['sessions', sessionId, params] as const, + detail: ( + sessionId: Parameters[0], + params: Parameters[1] + ) => ['sessions', sessionId, params] as const, } export const storedPaymentMethodKeys = { @@ -61,7 +64,7 @@ export const storedPaymentMethodKeys = { // ── Query options factories ────────────────────────────────── export function getPaymentLinksLinkIdQueryOptions( - linkId: string, + linkId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -77,7 +80,7 @@ export function getPaymentLinksLinkIdQueryOptions( } export function getSessionsSessionIdQueryOptions( - sessionId: string, + sessionId: Parameters[0], params: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -112,7 +115,7 @@ export function getStoredPaymentMethodsQueryOptions( // ── Queries ────────────────────────────────────────────────── export function useGetPaymentLinksLinkId( - linkId: string | undefined | null, + linkId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -129,7 +132,7 @@ export function useGetPaymentLinksLinkId( } export function useGetSessionsSessionId( - sessionId: string | undefined | null, + sessionId: Parameters[0] | undefined | null, params: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -388,7 +391,10 @@ export function usePatchPaymentLinksLinkId( UseMutationOptions< Awaited>, ApiError, - { linkId: string; body: Parameters[1] } + { + linkId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -396,7 +402,10 @@ export function usePatchPaymentLinksLinkId( return useMutation< Awaited>, ApiError, - { linkId: string; body: Parameters[1] } + { + linkId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ linkId, body }) => patchPaymentLinksLinkId(linkId, body), ...options, @@ -507,7 +516,7 @@ export function usePostPaymentsPaymentPspReferenceAmountUpdates( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -519,7 +528,7 @@ export function usePostPaymentsPaymentPspReferenceAmountUpdates( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -536,7 +545,7 @@ export function usePostPaymentsPaymentPspReferenceCancels( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -548,7 +557,7 @@ export function usePostPaymentsPaymentPspReferenceCancels( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -565,7 +574,7 @@ export function usePostPaymentsPaymentPspReferenceCaptures( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -577,7 +586,7 @@ export function usePostPaymentsPaymentPspReferenceCaptures( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -594,7 +603,7 @@ export function usePostPaymentsPaymentPspReferenceRefunds( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -606,7 +615,7 @@ export function usePostPaymentsPaymentPspReferenceRefunds( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -623,7 +632,7 @@ export function usePostPaymentsPaymentPspReferenceReversals( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -635,7 +644,7 @@ export function usePostPaymentsPaymentPspReferenceReversals( Awaited>, ApiError, { - paymentPspReference: string + paymentPspReference: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -724,7 +733,7 @@ export function useDeleteStoredPaymentMethodsStoredPaymentMethodId( Awaited>, ApiError, { - storedPaymentMethodId: string + storedPaymentMethodId: Parameters[0] params: Parameters[1] } >, @@ -735,7 +744,7 @@ export function useDeleteStoredPaymentMethodsStoredPaymentMethodId( Awaited>, ApiError, { - storedPaymentMethodId: string + storedPaymentMethodId: Parameters[0] params: Parameters[1] } >({ diff --git a/examples/generated-rq/adyen-legal-entity/hooks.ts b/examples/generated-rq/adyen-legal-entity/hooks.ts index 10de927..b8226a0 100644 --- a/examples/generated-rq/adyen-legal-entity/hooks.ts +++ b/examples/generated-rq/adyen-legal-entity/hooks.ts @@ -49,21 +49,28 @@ import { export const businessLineKeys = { all: () => ['businessLines'] as const, - detail: (id: string) => ['businessLines', id] as const, + detail: (id: Parameters[0]) => ['businessLines', id] as const, } export const documentKeys = { all: () => ['documents'] as const, - detail: (id: string, params?: Parameters[1]) => - ['documents', id, params] as const, + detail: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['documents', id, params] as const, } export const legalEntityKeys = { all: () => ['legalEntities'] as const, - getLegalEntitiesId: (id: string) => ['legalEntities', 'getLegalEntitiesId', id] as const, + getLegalEntitiesId: (id: Parameters[0]) => + ['legalEntities', 'getLegalEntitiesId', id] as const, getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference: ( - id: string, - termsofserviceacceptancereference: string, + id: Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[0], + termsofserviceacceptancereference: Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[1], params?: Parameters< typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference >[2] @@ -75,33 +82,39 @@ export const legalEntityKeys = { termsofserviceacceptancereference, params, ] as const, - getLegalEntitiesIdBusinessLines: (id: string) => + getLegalEntitiesIdBusinessLines: (id: Parameters[0]) => ['legalEntities', 'getLegalEntitiesIdBusinessLines', id] as const, - getLegalEntitiesIdPciQuestionnaires: (id: string) => - ['legalEntities', 'getLegalEntitiesIdPciQuestionnaires', id] as const, - getLegalEntitiesIdPciQuestionnairesPciid: (id: string, pciid: string) => - ['legalEntities', 'getLegalEntitiesIdPciQuestionnairesPciid', id, pciid] as const, - getLegalEntitiesIdTermsOfServiceAcceptanceInfos: (id: string) => - ['legalEntities', 'getLegalEntitiesIdTermsOfServiceAcceptanceInfos', id] as const, - getLegalEntitiesIdTermsOfServiceStatus: (id: string) => - ['legalEntities', 'getLegalEntitiesIdTermsOfServiceStatus', id] as const, + getLegalEntitiesIdPciQuestionnaires: ( + id: Parameters[0] + ) => ['legalEntities', 'getLegalEntitiesIdPciQuestionnaires', id] as const, + getLegalEntitiesIdPciQuestionnairesPciid: ( + id: Parameters[0], + pciid: Parameters[1] + ) => ['legalEntities', 'getLegalEntitiesIdPciQuestionnairesPciid', id, pciid] as const, + getLegalEntitiesIdTermsOfServiceAcceptanceInfos: ( + id: Parameters[0] + ) => ['legalEntities', 'getLegalEntitiesIdTermsOfServiceAcceptanceInfos', id] as const, + getLegalEntitiesIdTermsOfServiceStatus: ( + id: Parameters[0] + ) => ['legalEntities', 'getLegalEntitiesIdTermsOfServiceStatus', id] as const, } export const themeKeys = { all: () => ['themes'] as const, list: () => ['themes', 'list'] as const, - detail: (id: string) => ['themes', id] as const, + detail: (id: Parameters[0]) => ['themes', id] as const, } export const transferInstrumentKeys = { all: () => ['transferInstruments'] as const, - detail: (id: string) => ['transferInstruments', id] as const, + detail: (id: Parameters[0]) => + ['transferInstruments', id] as const, } // ── Query options factories ────────────────────────────────── export function getBusinessLinesIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -117,7 +130,7 @@ export function getBusinessLinesIdQueryOptions( } export function getDocumentsIdQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -134,7 +147,7 @@ export function getDocumentsIdQueryOptions( } export function getLegalEntitiesIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -150,8 +163,12 @@ export function getLegalEntitiesIdQueryOptions( } export function getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereferenceQueryOptions( - id: string, - termsofserviceacceptancereference: string, + id: Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[0], + termsofserviceacceptancereference: Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[1], params?: Parameters< typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference >[2], @@ -194,7 +211,7 @@ export function getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceac } export function getLegalEntitiesIdBusinessLinesQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -210,7 +227,7 @@ export function getLegalEntitiesIdBusinessLinesQueryOptions( } export function getLegalEntitiesIdPciQuestionnairesQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -226,8 +243,8 @@ export function getLegalEntitiesIdPciQuestionnairesQueryOptions( } export function getLegalEntitiesIdPciQuestionnairesPciidQueryOptions( - id: string, - pciid: string, + id: Parameters[0], + pciid: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -246,7 +263,7 @@ export function getLegalEntitiesIdPciQuestionnairesPciidQueryOptions( } export function getLegalEntitiesIdTermsOfServiceAcceptanceInfosQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions< Awaited>, @@ -268,7 +285,7 @@ export function getLegalEntitiesIdTermsOfServiceAcceptanceInfosQueryOptions( } export function getLegalEntitiesIdTermsOfServiceStatusQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -301,7 +318,7 @@ export function getThemesQueryOptions( } export function getThemesIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -317,7 +334,7 @@ export function getThemesIdQueryOptions( } export function getTransferInstrumentsIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -335,7 +352,7 @@ export function getTransferInstrumentsIdQueryOptions( // ── Queries ────────────────────────────────────────────────── export function useGetBusinessLinesId( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -352,7 +369,7 @@ export function useGetBusinessLinesId( } export function useGetDocumentsId( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -370,7 +387,7 @@ export function useGetDocumentsId( } export function useGetLegalEntitiesId( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -387,8 +404,18 @@ export function useGetLegalEntitiesId( } export function useGetLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference( - id: string | undefined | null, - termsofserviceacceptancereference: string | undefined | null, + id: + | Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[0] + | undefined + | null, + termsofserviceacceptancereference: + | Parameters< + typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference + >[1] + | undefined + | null, params?: Parameters< typeof getLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofserviceacceptancereference >[2], @@ -432,7 +459,7 @@ export function useGetLegalEntitiesIdAcceptedTermsOfServiceDocumentTermsofservic } export function useGetLegalEntitiesIdBusinessLines( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -449,7 +476,7 @@ export function useGetLegalEntitiesIdBusinessLines( } export function useGetLegalEntitiesIdPciQuestionnaires( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -466,8 +493,8 @@ export function useGetLegalEntitiesIdPciQuestionnaires( } export function useGetLegalEntitiesIdPciQuestionnairesPciid( - id: string | undefined | null, - pciid: string | undefined | null, + id: Parameters[0] | undefined | null, + pciid: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -484,7 +511,7 @@ export function useGetLegalEntitiesIdPciQuestionnairesPciid( } export function useGetLegalEntitiesIdTermsOfServiceAcceptanceInfos( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions< Awaited>, @@ -507,7 +534,7 @@ export function useGetLegalEntitiesIdTermsOfServiceAcceptanceInfos( } export function useGetLegalEntitiesIdTermsOfServiceStatus( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -539,7 +566,7 @@ export function useGetThemes( } export function useGetThemesId( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -556,7 +583,7 @@ export function useGetThemesId( } export function useGetTransferInstrumentsId( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -599,7 +626,10 @@ export function usePatchBusinessLinesId( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -607,7 +637,10 @@ export function usePatchBusinessLinesId( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => patchBusinessLinesId(id, body), ...options, @@ -616,11 +649,19 @@ export function usePatchBusinessLinesId( export function useDeleteBusinessLinesId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteBusinessLinesId(id), ...options, }) @@ -652,7 +693,7 @@ export function usePatchDocumentsId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -664,7 +705,7 @@ export function usePatchDocumentsId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -676,11 +717,19 @@ export function usePatchDocumentsId( export function useDeleteDocumentsId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteDocumentsId(id), ...options, }) @@ -718,7 +767,7 @@ export function usePatchLegalEntitiesId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -730,7 +779,7 @@ export function usePatchLegalEntitiesId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -745,7 +794,7 @@ export function usePostLegalEntitiesIdCheckTaxElectronicDeliveryConsent( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -753,7 +802,7 @@ export function usePostLegalEntitiesIdCheckTaxElectronicDeliveryConsent( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (id) => postLegalEntitiesIdCheckTaxElectronicDeliveryConsent(id), ...options, @@ -765,7 +814,7 @@ export function usePostLegalEntitiesIdCheckVerificationErrors( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -773,7 +822,7 @@ export function usePostLegalEntitiesIdCheckVerificationErrors( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (id) => postLegalEntitiesIdCheckVerificationErrors(id), ...options, @@ -785,7 +834,7 @@ export function usePostLegalEntitiesIdConfirmDataReview( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -793,7 +842,7 @@ export function usePostLegalEntitiesIdConfirmDataReview( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (id) => postLegalEntitiesIdConfirmDataReview(id), ...options, @@ -805,7 +854,10 @@ export function usePostLegalEntitiesIdOnboardingLinks( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -813,7 +865,10 @@ export function usePostLegalEntitiesIdOnboardingLinks( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postLegalEntitiesIdOnboardingLinks(id, body), ...options, @@ -826,7 +881,7 @@ export function usePostLegalEntitiesIdPciQuestionnairesGeneratePciTemplates( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] } >, @@ -837,7 +892,7 @@ export function usePostLegalEntitiesIdPciQuestionnairesGeneratePciTemplates( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] } >({ @@ -853,7 +908,7 @@ export function usePostLegalEntitiesIdPciQuestionnairesSignPciTemplates( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] } >, @@ -863,7 +918,10 @@ export function usePostLegalEntitiesIdPciQuestionnairesSignPciTemplates( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postLegalEntitiesIdPciQuestionnairesSignPciTemplates(id, body), ...options, @@ -876,7 +934,7 @@ export function usePostLegalEntitiesIdPciQuestionnairesSigningRequired( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] } >, @@ -886,7 +944,10 @@ export function usePostLegalEntitiesIdPciQuestionnairesSigningRequired( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postLegalEntitiesIdPciQuestionnairesSigningRequired(id, body), ...options, @@ -898,7 +959,10 @@ export function usePostLegalEntitiesIdSetTaxElectronicDeliveryConsent( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -906,7 +970,10 @@ export function usePostLegalEntitiesIdSetTaxElectronicDeliveryConsent( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postLegalEntitiesIdSetTaxElectronicDeliveryConsent(id, body), ...options, @@ -918,7 +985,10 @@ export function usePostLegalEntitiesIdTermsOfService( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -926,7 +996,10 @@ export function usePostLegalEntitiesIdTermsOfService( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postLegalEntitiesIdTermsOfService(id, body), ...options, @@ -939,8 +1012,10 @@ export function usePatchLegalEntitiesIdTermsOfServiceTermsofservicedocumentid( Awaited>, ApiError, { - id: string - termsofservicedocumentid: string + id: Parameters[0] + termsofservicedocumentid: Parameters< + typeof patchLegalEntitiesIdTermsOfServiceTermsofservicedocumentid + >[1] body: Parameters[2] } >, @@ -951,8 +1026,10 @@ export function usePatchLegalEntitiesIdTermsOfServiceTermsofservicedocumentid( Awaited>, ApiError, { - id: string - termsofservicedocumentid: string + id: Parameters[0] + termsofservicedocumentid: Parameters< + typeof patchLegalEntitiesIdTermsOfServiceTermsofservicedocumentid + >[1] body: Parameters[2] } >({ @@ -998,7 +1075,7 @@ export function usePatchTransferInstrumentsId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -1010,7 +1087,7 @@ export function usePatchTransferInstrumentsId( Awaited>, ApiError, { - id: string + id: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -1022,11 +1099,19 @@ export function usePatchTransferInstrumentsId( export function useDeleteTransferInstrumentsId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteTransferInstrumentsId(id), ...options, }) @@ -1037,7 +1122,7 @@ export function usePostLegalEntitiesIdRequestPeriodicReview( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -1045,7 +1130,7 @@ export function usePostLegalEntitiesIdRequestPeriodicReview( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (id) => postLegalEntitiesIdRequestPeriodicReview(id), ...options, diff --git a/examples/generated-rq/canada_holidays/client.ts b/examples/generated-rq/canada_holidays/client.ts index 1aa71f3..0717ead 100644 --- a/examples/generated-rq/canada_holidays/client.ts +++ b/examples/generated-rq/canada_holidays/client.ts @@ -1,5 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit +import type { Holiday, Province } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' export class ApiError extends Error { @@ -83,7 +84,17 @@ async function _request( return res } -export async function root(config?: Partial): Promise> { +export async function root( + config?: Partial +): Promise<{ + _links?: { + holidays?: { href?: string } + provinces?: { href?: string } + self?: { href?: string } + spec?: { href?: string } + } + message?: string +}> { const res = await _request('GET', '/api/v1', {}, config) return res.json() } @@ -95,7 +106,7 @@ export async function holidays( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ holidays?: Holiday[] }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.federal != null) searchParams.set('federal', String(params.federal)) @@ -105,13 +116,13 @@ export async function holidays( } export async function holiday( - holidayId: string, + holidayId: number, params?: { year?: number optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ holiday?: Holiday }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) @@ -130,7 +141,7 @@ export async function provinces( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ provinces?: Province[] }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) @@ -145,7 +156,7 @@ export async function province( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ province?: Province }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) diff --git a/examples/generated-rq/canada_holidays/hooks.ts b/examples/generated-rq/canada_holidays/hooks.ts index f0e678c..247eab3 100644 --- a/examples/generated-rq/canada_holidays/hooks.ts +++ b/examples/generated-rq/canada_holidays/hooks.ts @@ -13,14 +13,14 @@ export const apiKeys = { export const holidayKeys = { all: () => ['holidays'] as const, list: (params?: Parameters[0]) => ['holidays', 'list', params] as const, - detail: (holidayId: string, params?: Parameters[1]) => + detail: (holidayId: Parameters[0], params?: Parameters[1]) => ['holidays', holidayId, params] as const, } export const provinceKeys = { all: () => ['provinces'] as const, list: (params?: Parameters[0]) => ['provinces', 'list', params] as const, - detail: (provinceId: string, params?: Parameters[1]) => + detail: (provinceId: Parameters[0], params?: Parameters[1]) => ['provinces', provinceId, params] as const, } @@ -63,7 +63,7 @@ export function holidaysQueryOptions( } export function holidayQueryOptions( - holidayId: string, + holidayId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -96,7 +96,7 @@ export function provincesQueryOptions( } export function provinceQueryOptions( - provinceId: string, + provinceId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -161,7 +161,7 @@ export function useHolidays( } export function useHoliday( - holidayId: string | undefined | null, + holidayId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -195,7 +195,7 @@ export function useProvinces( } export function useProvince( - provinceId: string | undefined | null, + provinceId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, diff --git a/examples/generated-rq/devto/client.ts b/examples/generated-rq/devto/client.ts index f8a5a93..b934d5f 100644 --- a/examples/generated-rq/devto/client.ts +++ b/examples/generated-rq/devto/client.ts @@ -116,7 +116,7 @@ export async function getAgentSessions( } export async function createAgentSession( - body: Record, + body: { title?: string; curated_data: string; s3_key?: string; tool_name?: string }, config?: Partial ): Promise { const res = await _request('POST', '/api/agent_sessions', { body }, config) @@ -178,7 +178,7 @@ export async function getLatestArticles( } export async function getArticleById( - id: string, + id: number, config?: Partial ): Promise> { const res = await _request('GET', `/api/articles/${encodeURIComponent(id)}`, {}, config) @@ -186,7 +186,7 @@ export async function getArticleById( } export async function updateArticle( - id: string, + id: number, body: Article, config?: Partial ): Promise { @@ -264,7 +264,7 @@ export async function getUserAllArticles( } export async function unpublishArticle( - id: string, + id: number, params?: { note?: string }, @@ -297,19 +297,19 @@ export async function createSegment(config?: Partial): Promise ): Promise> { const res = await _request('GET', `/api/segments/${encodeURIComponent(id)}`, {}, config) return res.json() } -export async function deleteSegment(id: string, config?: Partial): Promise { +export async function deleteSegment(id: number, config?: Partial): Promise { await _request('DELETE', `/api/segments/${encodeURIComponent(id)}`, {}, config) } export async function getUsersInSegment( - id: string, + id: number, params?: { perPage?: number }, @@ -327,7 +327,7 @@ export async function getUsersInSegment( } export async function addUsersToSegment( - id: string, + id: number, body: SegmentUserIds, config?: Partial ): Promise { @@ -335,7 +335,7 @@ export async function addUsersToSegment( } export async function removeUsersFromSegment( - id: string, + id: number, body: SegmentUserIds, config?: Partial ): Promise { @@ -356,14 +356,14 @@ export async function createApiBillboards( } export async function getApiBillboardsById( - id: string, + id: number, config?: Partial ): Promise { await _request('GET', `/api/billboards/${encodeURIComponent(id)}`, {}, config) } export async function updateApiBillboardsById( - id: string, + id: number, body: Record, config?: Partial ): Promise> { @@ -372,7 +372,7 @@ export async function updateApiBillboardsById( } export async function updateApiBillboardsByIdUnpublish( - id: string, + id: number, config?: Partial ): Promise { await _request('PUT', `/api/billboards/${encodeURIComponent(id)}/unpublish`, {}, config) @@ -396,7 +396,7 @@ export async function getCommentsByArticleId( return res.json() } -export async function getCommentById(id: string, config?: Partial): Promise { +export async function getCommentById(id: number, config?: Partial): Promise { await _request('GET', `/api/comments/${encodeURIComponent(id)}`, {}, config) } @@ -496,7 +496,7 @@ export async function createOrganization( } export async function getOrganizationById( - id: string, + id: number, config?: Partial ): Promise> { const res = await _request('GET', `/api/organizations/${encodeURIComponent(id)}`, {}, config) @@ -504,7 +504,7 @@ export async function getOrganizationById( } export async function updateApiOrganizationsById( - id: string, + id: number, body: Organization, config?: Partial ): Promise { @@ -512,7 +512,7 @@ export async function updateApiOrganizationsById( } export async function deleteApiOrganizationsById( - id: string, + id: number, config?: Partial ): Promise { await _request('DELETE', `/api/organizations/${encodeURIComponent(id)}`, {}, config) @@ -524,19 +524,27 @@ export async function getApiPages(config?: Partial): Promise, + body: { + title?: string + slug?: string + description?: string + body_markdown?: string + body_json?: string + is_top_level_path?: boolean + template?: string + }, config?: Partial ): Promise { await _request('POST', '/api/pages', { body }, config) } -export async function getApiPagesById(id: string, config?: Partial): Promise { +export async function getApiPagesById(id: number, config?: Partial): Promise { const res = await _request('GET', `/api/pages/${encodeURIComponent(id)}`, {}, config) return res.json() } export async function updateApiPagesById( - id: string, + id: number, body: Page, config?: Partial ): Promise { @@ -545,7 +553,7 @@ export async function updateApiPagesById( } export async function deleteApiPagesById( - id: string, + id: number, config?: Partial ): Promise { const res = await _request('DELETE', `/api/pages/${encodeURIComponent(id)}`, {}, config) @@ -705,31 +713,31 @@ export async function getTags( return res.json() } -export async function suspendUser(id: string, config?: Partial): Promise { +export async function suspendUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/suspend`, {}, config) } -export async function limitUser(id: string, config?: Partial): Promise { +export async function limitUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/limited`, {}, config) } -export async function unLimitUser(id: string, config?: Partial): Promise { +export async function unLimitUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/limited`, {}, config) } -export async function spamUser(id: string, config?: Partial): Promise { +export async function spamUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/spam`, {}, config) } -export async function unSpamUser(id: string, config?: Partial): Promise { +export async function unSpamUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/spam`, {}, config) } -export async function trustUser(id: string, config?: Partial): Promise { +export async function trustUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/trusted`, {}, config) } -export async function unTrustUser(id: string, config?: Partial): Promise { +export async function unTrustUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/trusted`, {}, config) } @@ -746,7 +754,7 @@ export async function getUser( return res.json() } -export async function unpublishUser(id: string, config?: Partial): Promise { +export async function unpublishUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/unpublish`, {}, config) } diff --git a/examples/generated-rq/devto/hooks.ts b/examples/generated-rq/devto/hooks.ts index db6bd07..d14a19c 100644 --- a/examples/generated-rq/devto/hooks.ts +++ b/examples/generated-rq/devto/hooks.ts @@ -116,33 +116,50 @@ export const apiKeys = { getTags: (params?: Parameters[0]) => ['api', 'getTags', params] as const, getUserMe: () => ['api', 'getUserMe'] as const, videos: (params?: Parameters[0]) => ['api', 'videos', params] as const, - getAgentSessionById: (id: string) => ['api', 'getAgentSessionById', id] as const, - getArticleById: (id: string) => ['api', 'getArticleById', id] as const, - getArticleByPath: (username: string, slug: string) => - ['api', 'getArticleByPath', username, slug] as const, - getSegment: (id: string) => ['api', 'getSegment', id] as const, - getUsersInSegment: (id: string, params?: Parameters[1]) => - ['api', 'getUsersInSegment', id, params] as const, - getApiBillboardsById: (id: string) => ['api', 'getApiBillboardsById', id] as const, - getCommentById: (id: string) => ['api', 'getCommentById', id] as const, - getOrganization: (username: string) => ['api', 'getOrganization', username] as const, - getOrgUsers: (organizationIdOrUsername: string, params?: Parameters[1]) => - ['api', 'getOrgUsers', organizationIdOrUsername, params] as const, + getAgentSessionById: (id: Parameters[0]) => + ['api', 'getAgentSessionById', id] as const, + getArticleById: (id: Parameters[0]) => + ['api', 'getArticleById', id] as const, + getArticleByPath: ( + username: Parameters[0], + slug: Parameters[1] + ) => ['api', 'getArticleByPath', username, slug] as const, + getSegment: (id: Parameters[0]) => ['api', 'getSegment', id] as const, + getUsersInSegment: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['api', 'getUsersInSegment', id, params] as const, + getApiBillboardsById: (id: Parameters[0]) => + ['api', 'getApiBillboardsById', id] as const, + getCommentById: (id: Parameters[0]) => + ['api', 'getCommentById', id] as const, + getOrganization: (username: Parameters[0]) => + ['api', 'getOrganization', username] as const, + getOrgUsers: ( + organizationIdOrUsername: Parameters[0], + params?: Parameters[1] + ) => ['api', 'getOrgUsers', organizationIdOrUsername, params] as const, getOrgArticles: ( - organizationIdOrUsername: string, + organizationIdOrUsername: Parameters[0], params?: Parameters[1] ) => ['api', 'getOrgArticles', organizationIdOrUsername, params] as const, - getOrganizationById: (id: string) => ['api', 'getOrganizationById', id] as const, - getApiPagesById: (id: string) => ['api', 'getApiPagesById', id] as const, - getProfileImage: (username: string) => ['api', 'getProfileImage', username] as const, - getSurveyByIdOrSlug: (idOrSlug: string) => ['api', 'getSurveyByIdOrSlug', idOrSlug] as const, - getSurveyPollVotes: (idOrSlug: string, params?: Parameters[1]) => - ['api', 'getSurveyPollVotes', idOrSlug, params] as const, + getOrganizationById: (id: Parameters[0]) => + ['api', 'getOrganizationById', id] as const, + getApiPagesById: (id: Parameters[0]) => + ['api', 'getApiPagesById', id] as const, + getProfileImage: (username: Parameters[0]) => + ['api', 'getProfileImage', username] as const, + getSurveyByIdOrSlug: (idOrSlug: Parameters[0]) => + ['api', 'getSurveyByIdOrSlug', idOrSlug] as const, + getSurveyPollVotes: ( + idOrSlug: Parameters[0], + params?: Parameters[1] + ) => ['api', 'getSurveyPollVotes', idOrSlug, params] as const, getSurveyPollTextResponses: ( - idOrSlug: string, + idOrSlug: Parameters[0], params?: Parameters[1] ) => ['api', 'getSurveyPollTextResponses', idOrSlug, params] as const, - getUser: (id: string) => ['api', 'getUser', id] as const, + getUser: (id: Parameters[0]) => ['api', 'getUser', id] as const, } // ── Query options factories ────────────────────────────────── @@ -163,7 +180,7 @@ export function getAgentSessionsQueryOptions( } export function getAgentSessionByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -211,7 +228,7 @@ export function getLatestArticlesQueryOptions( } export function getArticleByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -227,8 +244,8 @@ export function getArticleByIdQueryOptions( } export function getArticleByPathQueryOptions( - username: string, - slug: string, + username: Parameters[0], + slug: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -324,7 +341,7 @@ export function getSegmentsQueryOptions( } export function getSegmentQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -340,7 +357,7 @@ export function getSegmentQueryOptions( } export function getUsersInSegmentQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -372,7 +389,7 @@ export function getApiBillboardsQueryOptions( } export function getApiBillboardsByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -404,7 +421,7 @@ export function getCommentsByArticleIdQueryOptions( } export function getCommentByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -451,7 +468,7 @@ export function getFollowersQueryOptions( } export function getOrganizationQueryOptions( - username: string, + username: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -467,7 +484,7 @@ export function getOrganizationQueryOptions( } export function getOrgUsersQueryOptions( - organizationIdOrUsername: string, + organizationIdOrUsername: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -484,7 +501,7 @@ export function getOrgUsersQueryOptions( } export function getOrgArticlesQueryOptions( - organizationIdOrUsername: string, + organizationIdOrUsername: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -517,7 +534,7 @@ export function getOrganizationsQueryOptions( } export function getOrganizationByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -548,7 +565,7 @@ export function getApiPagesQueryOptions( } export function getApiPagesByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -580,7 +597,7 @@ export function getPodcastEpisodesQueryOptions( } export function getProfileImageQueryOptions( - username: string, + username: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -628,7 +645,7 @@ export function getSurveysQueryOptions( } export function getSurveyByIdOrSlugQueryOptions( - idOrSlug: string, + idOrSlug: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -644,7 +661,7 @@ export function getSurveyByIdOrSlugQueryOptions( } export function getSurveyPollVotesQueryOptions( - idOrSlug: string, + idOrSlug: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -661,7 +678,7 @@ export function getSurveyPollVotesQueryOptions( } export function getSurveyPollTextResponsesQueryOptions( - idOrSlug: string, + idOrSlug: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -709,7 +726,7 @@ export function getUserMeQueryOptions( } export function getUserQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -758,7 +775,7 @@ export function useGetAgentSessions( } export function useGetAgentSessionById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -869,7 +886,7 @@ export function useGetLatestArticlesInfinite( } export function useGetArticleById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -886,8 +903,8 @@ export function useGetArticleById( } export function useGetArticleByPath( - username: string | undefined | null, - slug: string | undefined | null, + username: Parameters[0] | undefined | null, + slug: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1108,7 +1125,7 @@ export function useGetSegments( } export function useGetSegment( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1125,7 +1142,7 @@ export function useGetSegment( } export function useGetUsersInSegment( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1158,7 +1175,7 @@ export function useGetApiBillboards( } export function useGetApiBillboardsById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1222,7 +1239,7 @@ export function useGetCommentsByArticleIdInfinite( } export function useGetCommentById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1301,7 +1318,7 @@ export function useGetFollowersInfinite( } export function useGetOrganization( - username: string | undefined | null, + username: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1318,7 +1335,7 @@ export function useGetOrganization( } export function useGetOrgUsers( - organizationIdOrUsername: string | undefined | null, + organizationIdOrUsername: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1336,7 +1353,7 @@ export function useGetOrgUsers( } export function useGetOrgArticles( - organizationIdOrUsername: string | undefined | null, + organizationIdOrUsername: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1401,7 +1418,7 @@ export function useGetOrganizationsInfinite( } export function useGetOrganizationById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1433,7 +1450,7 @@ export function useGetApiPages( } export function useGetApiPagesById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1497,7 +1514,7 @@ export function useGetPodcastEpisodesInfinite( } export function useGetProfileImage( - username: string | undefined | null, + username: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1608,7 +1625,7 @@ export function useGetSurveysInfinite( } export function useGetSurveyByIdOrSlug( - idOrSlug: string | undefined | null, + idOrSlug: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1625,7 +1642,7 @@ export function useGetSurveyByIdOrSlug( } export function useGetSurveyPollVotes( - idOrSlug: string | undefined | null, + idOrSlug: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1643,7 +1660,7 @@ export function useGetSurveyPollVotes( } export function useGetSurveyPollTextResponses( - idOrSlug: string | undefined | null, + idOrSlug: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1723,7 +1740,7 @@ export function useGetUserMe( } export function useGetUser( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1833,7 +1850,7 @@ export function useUpdateArticle( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -1841,7 +1858,7 @@ export function useUpdateArticle( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => updateArticle(id, body), ...options, @@ -1853,7 +1870,7 @@ export function useUnpublishArticle( UseMutationOptions< Awaited>, ApiError, - { id: string; params: Parameters[1] } + { id: Parameters[0]; params: Parameters[1] } >, 'mutationFn' > @@ -1861,7 +1878,7 @@ export function useUnpublishArticle( return useMutation< Awaited>, ApiError, - { id: string; params: Parameters[1] } + { id: Parameters[0]; params: Parameters[1] } >({ mutationFn: ({ id, params }) => unpublishArticle(id, params), ...options, @@ -1882,11 +1899,19 @@ export function useCreateSegment( export function useDeleteSegment( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteSegment(id), ...options, }) @@ -1897,7 +1922,7 @@ export function useAddUsersToSegment( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -1905,7 +1930,7 @@ export function useAddUsersToSegment( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => addUsersToSegment(id, body), ...options, @@ -1917,7 +1942,10 @@ export function useRemoveUsersFromSegment( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -1925,7 +1953,10 @@ export function useRemoveUsersFromSegment( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => removeUsersFromSegment(id, body), ...options, @@ -1957,7 +1988,10 @@ export function useUpdateApiBillboardsById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -1965,7 +1999,10 @@ export function useUpdateApiBillboardsById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => updateApiBillboardsById(id, body), ...options, @@ -1977,7 +2014,7 @@ export function useUpdateApiBillboardsByIdUnpublish( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -1985,7 +2022,7 @@ export function useUpdateApiBillboardsByIdUnpublish( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (id) => updateApiBillboardsByIdUnpublish(id), ...options, @@ -2017,7 +2054,10 @@ export function useUpdateApiOrganizationsById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2025,7 +2065,10 @@ export function useUpdateApiOrganizationsById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => updateApiOrganizationsById(id, body), ...options, @@ -2034,11 +2077,19 @@ export function useUpdateApiOrganizationsById( export function useDeleteApiOrganizationsById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteApiOrganizationsById(id), ...options, }) @@ -2069,7 +2120,10 @@ export function useUpdateApiPagesById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2077,7 +2131,7 @@ export function useUpdateApiPagesById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => updateApiPagesById(id, body), ...options, @@ -2086,11 +2140,19 @@ export function useUpdateApiPagesById( export function useDeleteApiPagesById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteApiPagesById(id), ...options, }) @@ -2138,11 +2200,19 @@ export function useCreateApiReactions( export function useSuspendUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => suspendUser(id), ...options, }) @@ -2150,11 +2220,19 @@ export function useSuspendUser( export function useLimitUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => limitUser(id), ...options, }) @@ -2162,11 +2240,19 @@ export function useLimitUser( export function useUnLimitUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => unLimitUser(id), ...options, }) @@ -2174,11 +2260,19 @@ export function useUnLimitUser( export function useSpamUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => spamUser(id), ...options, }) @@ -2186,11 +2280,19 @@ export function useSpamUser( export function useUnSpamUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => unSpamUser(id), ...options, }) @@ -2198,11 +2300,19 @@ export function useUnSpamUser( export function useTrustUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => trustUser(id), ...options, }) @@ -2210,11 +2320,19 @@ export function useTrustUser( export function useUnTrustUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => unTrustUser(id), ...options, }) @@ -2222,11 +2340,19 @@ export function useUnTrustUser( export function useUnpublishUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => unpublishUser(id), ...options, }) diff --git a/examples/generated-rq/exchangerate/client.ts b/examples/generated-rq/exchangerate/client.ts index 19f7b45..6397f52 100644 --- a/examples/generated-rq/exchangerate/client.ts +++ b/examples/generated-rq/exchangerate/client.ts @@ -86,7 +86,12 @@ async function _request( export async function getLatestByBaseCurrency( baseCurrency: string, config?: Partial -): Promise> { +): Promise<{ + base?: string + date?: string + rates?: Record + time_last_updated?: number +}> { const res = await _request('GET', `/latest/${encodeURIComponent(baseCurrency)}`, {}, config) return res.json() } diff --git a/examples/generated-rq/exchangerate/hooks.ts b/examples/generated-rq/exchangerate/hooks.ts index 994ab56..ded256c 100644 --- a/examples/generated-rq/exchangerate/hooks.ts +++ b/examples/generated-rq/exchangerate/hooks.ts @@ -7,13 +7,14 @@ import { getLatestByBaseCurrency, type ApiError } from './client.js' export const latestKeys = { all: () => ['latest'] as const, - detail: (baseCurrency: string) => ['latest', baseCurrency] as const, + detail: (baseCurrency: Parameters[0]) => + ['latest', baseCurrency] as const, } // ── Query options factories ────────────────────────────────── export function getLatestByBaseCurrencyQueryOptions( - baseCurrency: string, + baseCurrency: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -31,7 +32,7 @@ export function getLatestByBaseCurrencyQueryOptions( // ── Queries ────────────────────────────────────────────────── export function useGetLatestByBaseCurrency( - baseCurrency: string | undefined | null, + baseCurrency: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' diff --git a/examples/generated-rq/open-meteo/client.ts b/examples/generated-rq/open-meteo/client.ts index fa673d9..99b9492 100644 --- a/examples/generated-rq/open-meteo/client.ts +++ b/examples/generated-rq/open-meteo/client.ts @@ -1,5 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit +import type { CurrentWeather, DailyResponse, HourlyResponse } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' export class ApiError extends Error { @@ -97,7 +98,18 @@ export async function getV1Forecast( pastDays?: number }, config?: Partial -): Promise> { +): Promise<{ + latitude?: number + longitude?: number + elevation?: number + generationtime_ms?: number + utc_offset_seconds?: number + hourly?: HourlyResponse + hourly_units?: Record + daily?: DailyResponse + daily_units?: Record + current_weather?: CurrentWeather +}> { const searchParams = new URLSearchParams() if (params?.hourly != null) { for (const v of params.hourly) searchParams.append('hourly', String(v)) diff --git a/examples/generated-rq/openai/client.ts b/examples/generated-rq/openai/client.ts index 21129bc..d15cb2d 100644 --- a/examples/generated-rq/openai/client.ts +++ b/examples/generated-rq/openai/client.ts @@ -6,6 +6,7 @@ import type { ApiKeyList, AssistantObject, Batch, + BatchFileExpirationAfter, Certificate, ChatCompletionDeleted, ChatCompletionList, @@ -88,6 +89,7 @@ import type { GroupUserAssignment, GroupUserDeletedResource, ImagesResponse, + InputItem, Invite, InviteDeleteResponse, InviteListResponse, @@ -110,6 +112,7 @@ import type { ListVectorStoreFilesResponse, ListVectorStoresResponse, MessageObject, + Metadata, Model, ModifyAssistantRequest, ModifyCertificateRequest, @@ -468,7 +471,13 @@ export async function listBatches( } export async function createBatch( - body: Record, + body: { + input_file_id: string + endpoint: string + completion_window: string + metadata?: Metadata + output_expires_after?: BatchFileExpirationAfter + }, config?: Partial ): Promise { const res = await _request('POST', '/batches', { body }, config) @@ -531,7 +540,7 @@ export async function getChatCompletion( export async function updateChatCompletion( completionId: string, - body: Record, + body: { metadata: Metadata }, config?: Partial ): Promise { const res = await _request( @@ -826,7 +835,7 @@ export async function getEval(evalId: string, config?: Partial): P export async function updateEval( evalId: string, - body: Record, + body: { name?: string; metadata?: Metadata }, config?: Partial ): Promise { const res = await _request('POST', `/evals/${encodeURIComponent(evalId)}`, { body }, config) @@ -839,7 +848,7 @@ export async function updateEval( export async function deleteEval( evalId: string, config?: Partial -): Promise> { +): Promise<{ object: string; deleted: boolean; eval_id: string }> { const res = await _request('DELETE', `/evals/${encodeURIComponent(evalId)}`, {}, config) return res.json() } @@ -915,7 +924,7 @@ export async function deleteEvalRun( evalId: string, runId: string, config?: Partial -): Promise> { +): Promise<{ object?: string; deleted?: boolean; run_id?: string }> { const res = await _request( 'DELETE', `/evals/${encodeURIComponent(evalId)}/runs/${encodeURIComponent(runId)}`, @@ -1262,7 +1271,7 @@ export async function adminApiKeysList( } export async function adminApiKeysCreate( - body: Record, + body: { name: string }, config?: Partial ): Promise { const res = await _request('POST', '/organization/admin_api_keys', { body }, config) @@ -1285,7 +1294,7 @@ export async function adminApiKeysGet( export async function adminApiKeysDelete( keyId: string, config?: Partial -): Promise> { +): Promise<{ id: string; object: string; deleted: boolean }> { const res = await _request( 'DELETE', `/organization/admin_api_keys/${encodeURIComponent(keyId)}`, @@ -1298,11 +1307,11 @@ export async function adminApiKeysDelete( export async function listAuditLogs( params?: { effectiveAt?: unknown - projectIds?: string[] - eventTypes?: string[] - actorIds?: string[] - actorEmails?: string[] - resourceIds?: string[] + 'project_ids[]'?: string[] + 'event_types[]'?: string[] + 'actor_ids[]'?: string[] + 'actor_emails[]'?: string[] + 'resource_ids[]'?: string[] limit?: number after?: string before?: string @@ -1311,20 +1320,20 @@ export async function listAuditLogs( ): Promise { const searchParams = new URLSearchParams() if (params?.effectiveAt != null) searchParams.set('effective_at', String(params.effectiveAt)) - if (params?.projectIds != null) { - for (const v of params.projectIds) searchParams.append('project_ids[]', String(v)) + if (params?.['project_ids[]'] != null) { + for (const v of params['project_ids[]']) searchParams.append('project_ids[]', String(v)) } - if (params?.eventTypes != null) { - for (const v of params.eventTypes) searchParams.append('event_types[]', String(v)) + if (params?.['event_types[]'] != null) { + for (const v of params['event_types[]']) searchParams.append('event_types[]', String(v)) } - if (params?.actorIds != null) { - for (const v of params.actorIds) searchParams.append('actor_ids[]', String(v)) + if (params?.['actor_ids[]'] != null) { + for (const v of params['actor_ids[]']) searchParams.append('actor_ids[]', String(v)) } - if (params?.actorEmails != null) { - for (const v of params.actorEmails) searchParams.append('actor_emails[]', String(v)) + if (params?.['actor_emails[]'] != null) { + for (const v of params['actor_emails[]']) searchParams.append('actor_emails[]', String(v)) } - if (params?.resourceIds != null) { - for (const v of params.resourceIds) searchParams.append('resource_ids[]', String(v)) + if (params?.['resource_ids[]'] != null) { + for (const v of params['resource_ids[]']) searchParams.append('resource_ids[]', String(v)) } if (params?.limit != null) searchParams.set('limit', String(params.limit)) if (params?.after != null) searchParams.set('after', String(params.after)) @@ -3013,13 +3022,13 @@ export async function createRun( threadId: string, body: CreateRunRequest, params?: { - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { const searchParams = new URLSearchParams() - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'POST', @@ -3081,7 +3090,7 @@ export async function listRunSteps( order?: 'asc' | 'desc' after?: string before?: string - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { @@ -3090,8 +3099,8 @@ export async function listRunSteps( if (params?.order != null) searchParams.set('order', String(params.order)) if (params?.after != null) searchParams.set('after', String(params.after)) if (params?.before != null) searchParams.set('before', String(params.before)) - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'GET', @@ -3107,13 +3116,13 @@ export async function getRunStep( runId: string, stepId: string, params?: { - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { const searchParams = new URLSearchParams() - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'GET', diff --git a/examples/generated-rq/openai/hooks.ts b/examples/generated-rq/openai/hooks.ts index db5236a..78b531c 100644 --- a/examples/generated-rq/openai/hooks.ts +++ b/examples/generated-rq/openai/hooks.ts @@ -262,27 +262,28 @@ import { export const assistantKeys = { all: () => ['assistants'] as const, list: (params?: Parameters[0]) => ['assistants', 'list', params] as const, - detail: (assistantId: string) => ['assistants', assistantId] as const, + detail: (assistantId: Parameters[0]) => ['assistants', assistantId] as const, } export const audioKeys = { all: () => ['audio'] as const, list: (params?: Parameters[0]) => ['audio', 'list', params] as const, - detail: (consentId: string) => ['audio', consentId] as const, + detail: (consentId: Parameters[0]) => ['audio', consentId] as const, } export const batchKeys = { all: () => ['batches'] as const, list: (params?: Parameters[0]) => ['batches', 'list', params] as const, - detail: (batchId: string) => ['batches', batchId] as const, + detail: (batchId: Parameters[0]) => ['batches', batchId] as const, } export const chatKeys = { all: () => ['chat'] as const, list: (params?: Parameters[0]) => ['chat', 'list', params] as const, - getChatCompletion: (completionId: string) => ['chat', 'getChatCompletion', completionId] as const, + getChatCompletion: (completionId: Parameters[0]) => + ['chat', 'getChatCompletion', completionId] as const, getChatCompletionMessages: ( - completionId: string, + completionId: Parameters[0], params?: Parameters[1] ) => ['chat', 'getChatCompletionMessages', completionId, params] as const, } @@ -290,52 +291,66 @@ export const chatKeys = { export const containerKeys = { all: () => ['containers'] as const, list: (params?: Parameters[0]) => ['containers', 'list', params] as const, - retrieveContainer: (containerId: string) => + retrieveContainer: (containerId: Parameters[0]) => ['containers', 'retrieveContainer', containerId] as const, - listContainerFiles: (containerId: string, params?: Parameters[1]) => - ['containers', 'listContainerFiles', containerId, params] as const, - retrieveContainerFile: (containerId: string, fileId: string) => - ['containers', 'retrieveContainerFile', containerId, fileId] as const, - retrieveContainerFileContent: (containerId: string, fileId: string) => - ['containers', 'retrieveContainerFileContent', containerId, fileId] as const, + listContainerFiles: ( + containerId: Parameters[0], + params?: Parameters[1] + ) => ['containers', 'listContainerFiles', containerId, params] as const, + retrieveContainerFile: ( + containerId: Parameters[0], + fileId: Parameters[1] + ) => ['containers', 'retrieveContainerFile', containerId, fileId] as const, + retrieveContainerFileContent: ( + containerId: Parameters[0], + fileId: Parameters[1] + ) => ['containers', 'retrieveContainerFileContent', containerId, fileId] as const, } export const conversationKeys = { all: () => ['conversations'] as const, listConversationItems: ( - conversationId: string, + conversationId: Parameters[0], params?: Parameters[1] ) => ['conversations', 'listConversationItems', conversationId, params] as const, getConversationItem: ( - conversationId: string, - itemId: string, + conversationId: Parameters[0], + itemId: Parameters[1], params?: Parameters[2] ) => ['conversations', 'getConversationItem', conversationId, itemId, params] as const, - getConversation: (conversationId: string) => + getConversation: (conversationId: Parameters[0]) => ['conversations', 'getConversation', conversationId] as const, } export const evalKeys = { all: () => ['evals'] as const, list: (params?: Parameters[0]) => ['evals', 'list', params] as const, - getEval: (evalId: string) => ['evals', 'getEval', evalId] as const, - getEvalRuns: (evalId: string, params?: Parameters[1]) => - ['evals', 'getEvalRuns', evalId, params] as const, - getEvalRun: (evalId: string, runId: string) => ['evals', 'getEvalRun', evalId, runId] as const, + getEval: (evalId: Parameters[0]) => ['evals', 'getEval', evalId] as const, + getEvalRuns: ( + evalId: Parameters[0], + params?: Parameters[1] + ) => ['evals', 'getEvalRuns', evalId, params] as const, + getEvalRun: (evalId: Parameters[0], runId: Parameters[1]) => + ['evals', 'getEvalRun', evalId, runId] as const, getEvalRunOutputItems: ( - evalId: string, - runId: string, + evalId: Parameters[0], + runId: Parameters[1], params?: Parameters[2] ) => ['evals', 'getEvalRunOutputItems', evalId, runId, params] as const, - getEvalRunOutputItem: (evalId: string, runId: string, outputItemId: string) => - ['evals', 'getEvalRunOutputItem', evalId, runId, outputItemId] as const, + getEvalRunOutputItem: ( + evalId: Parameters[0], + runId: Parameters[1], + outputItemId: Parameters[2] + ) => ['evals', 'getEvalRunOutputItem', evalId, runId, outputItemId] as const, } export const fileKeys = { all: () => ['files'] as const, list: (params?: Parameters[0]) => ['files', 'list', params] as const, - retrieveFile: (fileId: string) => ['files', 'retrieveFile', fileId] as const, - downloadFile: (fileId: string) => ['files', 'downloadFile', fileId] as const, + retrieveFile: (fileId: Parameters[0]) => + ['files', 'retrieveFile', fileId] as const, + downloadFile: (fileId: Parameters[0]) => + ['files', 'downloadFile', fileId] as const, } export const fineTuningKeys = { @@ -343,7 +358,7 @@ export const fineTuningKeys = { list: (params?: Parameters[0]) => ['fine_tuning', 'list', params] as const, listFineTuningCheckpointPermissions: ( - fineTunedModelCheckpoint: string, + fineTunedModelCheckpoint: Parameters[0], params?: Parameters[1] ) => [ @@ -352,14 +367,14 @@ export const fineTuningKeys = { fineTunedModelCheckpoint, params, ] as const, - retrieveFineTuningJob: (fineTuningJobId: string) => + retrieveFineTuningJob: (fineTuningJobId: Parameters[0]) => ['fine_tuning', 'retrieveFineTuningJob', fineTuningJobId] as const, listFineTuningJobCheckpoints: ( - fineTuningJobId: string, + fineTuningJobId: Parameters[0], params?: Parameters[1] ) => ['fine_tuning', 'listFineTuningJobCheckpoints', fineTuningJobId, params] as const, listFineTuningEvents: ( - fineTuningJobId: string, + fineTuningJobId: Parameters[0], params?: Parameters[1] ) => ['fine_tuning', 'listFineTuningEvents', fineTuningJobId, params] as const, } @@ -367,7 +382,7 @@ export const fineTuningKeys = { export const modelKeys = { all: () => ['models'] as const, list: () => ['models', 'list'] as const, - detail: (model: string) => ['models', model] as const, + detail: (model: Parameters[0]) => ['models', model] as const, } export const organizationKeys = { @@ -406,44 +421,64 @@ export const organizationKeys = { ['organization', 'usageVectorStores', params] as const, listUsers: (params?: Parameters[0]) => ['organization', 'listUsers', params] as const, - adminApiKeysGet: (keyId: string) => ['organization', 'adminApiKeysGet', keyId] as const, - getCertificate: (certificateId: string, params?: Parameters[1]) => - ['organization', 'getCertificate', certificateId, params] as const, + adminApiKeysGet: (keyId: Parameters[0]) => + ['organization', 'adminApiKeysGet', keyId] as const, + getCertificate: ( + certificateId: Parameters[0], + params?: Parameters[1] + ) => ['organization', 'getCertificate', certificateId, params] as const, listGroupRoleAssignments: ( - groupId: string, + groupId: Parameters[0], params?: Parameters[1] ) => ['organization', 'listGroupRoleAssignments', groupId, params] as const, - listGroupUsers: (groupId: string, params?: Parameters[1]) => - ['organization', 'listGroupUsers', groupId, params] as const, - retrieveInvite: (inviteId: string) => ['organization', 'retrieveInvite', inviteId] as const, - retrieveProject: (projectId: string) => ['organization', 'retrieveProject', projectId] as const, - listProjectApiKeys: (projectId: string, params?: Parameters[1]) => - ['organization', 'listProjectApiKeys', projectId, params] as const, - retrieveProjectApiKey: (projectId: string, apiKeyId: string) => - ['organization', 'retrieveProjectApiKey', projectId, apiKeyId] as const, + listGroupUsers: ( + groupId: Parameters[0], + params?: Parameters[1] + ) => ['organization', 'listGroupUsers', groupId, params] as const, + retrieveInvite: (inviteId: Parameters[0]) => + ['organization', 'retrieveInvite', inviteId] as const, + retrieveProject: (projectId: Parameters[0]) => + ['organization', 'retrieveProject', projectId] as const, + listProjectApiKeys: ( + projectId: Parameters[0], + params?: Parameters[1] + ) => ['organization', 'listProjectApiKeys', projectId, params] as const, + retrieveProjectApiKey: ( + projectId: Parameters[0], + apiKeyId: Parameters[1] + ) => ['organization', 'retrieveProjectApiKey', projectId, apiKeyId] as const, listProjectCertificates: ( - projectId: string, + projectId: Parameters[0], params?: Parameters[1] ) => ['organization', 'listProjectCertificates', projectId, params] as const, - listProjectGroups: (projectId: string, params?: Parameters[1]) => - ['organization', 'listProjectGroups', projectId, params] as const, + listProjectGroups: ( + projectId: Parameters[0], + params?: Parameters[1] + ) => ['organization', 'listProjectGroups', projectId, params] as const, listProjectRateLimits: ( - projectId: string, + projectId: Parameters[0], params?: Parameters[1] ) => ['organization', 'listProjectRateLimits', projectId, params] as const, listProjectServiceAccounts: ( - projectId: string, + projectId: Parameters[0], params?: Parameters[1] ) => ['organization', 'listProjectServiceAccounts', projectId, params] as const, - retrieveProjectServiceAccount: (projectId: string, serviceAccountId: string) => - ['organization', 'retrieveProjectServiceAccount', projectId, serviceAccountId] as const, - listProjectUsers: (projectId: string, params?: Parameters[1]) => - ['organization', 'listProjectUsers', projectId, params] as const, - retrieveProjectUser: (projectId: string, userId: string) => - ['organization', 'retrieveProjectUser', projectId, userId] as const, - retrieveUser: (userId: string) => ['organization', 'retrieveUser', userId] as const, + retrieveProjectServiceAccount: ( + projectId: Parameters[0], + serviceAccountId: Parameters[1] + ) => ['organization', 'retrieveProjectServiceAccount', projectId, serviceAccountId] as const, + listProjectUsers: ( + projectId: Parameters[0], + params?: Parameters[1] + ) => ['organization', 'listProjectUsers', projectId, params] as const, + retrieveProjectUser: ( + projectId: Parameters[0], + userId: Parameters[1] + ) => ['organization', 'retrieveProjectUser', projectId, userId] as const, + retrieveUser: (userId: Parameters[0]) => + ['organization', 'retrieveUser', userId] as const, listUserRoleAssignments: ( - userId: string, + userId: Parameters[0], params?: Parameters[1] ) => ['organization', 'listUserRoleAssignments', userId, params] as const, } @@ -451,43 +486,58 @@ export const organizationKeys = { export const projectKeys = { all: () => ['projects'] as const, listProjectGroupRoleAssignments: ( - projectId: string, - groupId: string, + projectId: Parameters[0], + groupId: Parameters[1], params?: Parameters[2] ) => ['projects', 'listProjectGroupRoleAssignments', projectId, groupId, params] as const, - listProjectRoles: (projectId: string, params?: Parameters[1]) => - ['projects', 'listProjectRoles', projectId, params] as const, + listProjectRoles: ( + projectId: Parameters[0], + params?: Parameters[1] + ) => ['projects', 'listProjectRoles', projectId, params] as const, listProjectUserRoleAssignments: ( - projectId: string, - userId: string, + projectId: Parameters[0], + userId: Parameters[1], params?: Parameters[2] ) => ['projects', 'listProjectUserRoleAssignments', projectId, userId, params] as const, } export const responseKeys = { all: () => ['responses'] as const, - getResponse: (responseId: string, params?: Parameters[1]) => - ['responses', 'getResponse', responseId, params] as const, - listInputItems: (responseId: string, params?: Parameters[1]) => - ['responses', 'listInputItems', responseId, params] as const, + getResponse: ( + responseId: Parameters[0], + params?: Parameters[1] + ) => ['responses', 'getResponse', responseId, params] as const, + listInputItems: ( + responseId: Parameters[0], + params?: Parameters[1] + ) => ['responses', 'listInputItems', responseId, params] as const, } export const threadKeys = { all: () => ['threads'] as const, - getThread: (threadId: string) => ['threads', 'getThread', threadId] as const, - listMessages: (threadId: string, params?: Parameters[1]) => - ['threads', 'listMessages', threadId, params] as const, - getMessage: (threadId: string, messageId: string) => - ['threads', 'getMessage', threadId, messageId] as const, - listRuns: (threadId: string, params?: Parameters[1]) => + getThread: (threadId: Parameters[0]) => + ['threads', 'getThread', threadId] as const, + listMessages: ( + threadId: Parameters[0], + params?: Parameters[1] + ) => ['threads', 'listMessages', threadId, params] as const, + getMessage: ( + threadId: Parameters[0], + messageId: Parameters[1] + ) => ['threads', 'getMessage', threadId, messageId] as const, + listRuns: (threadId: Parameters[0], params?: Parameters[1]) => ['threads', 'listRuns', threadId, params] as const, - getRun: (threadId: string, runId: string) => ['threads', 'getRun', threadId, runId] as const, - listRunSteps: (threadId: string, runId: string, params?: Parameters[2]) => - ['threads', 'listRunSteps', threadId, runId, params] as const, + getRun: (threadId: Parameters[0], runId: Parameters[1]) => + ['threads', 'getRun', threadId, runId] as const, + listRunSteps: ( + threadId: Parameters[0], + runId: Parameters[1], + params?: Parameters[2] + ) => ['threads', 'listRunSteps', threadId, runId, params] as const, getRunStep: ( - threadId: string, - runId: string, - stepId: string, + threadId: Parameters[0], + runId: Parameters[1], + stepId: Parameters[2], params?: Parameters[3] ) => ['threads', 'getRunStep', threadId, runId, stepId, params] as const, } @@ -496,53 +546,72 @@ export const vectorStoreKeys = { all: () => ['vector_stores'] as const, list: (params?: Parameters[0]) => ['vector_stores', 'list', params] as const, - getVectorStore: (vectorStoreId: string) => + getVectorStore: (vectorStoreId: Parameters[0]) => ['vector_stores', 'getVectorStore', vectorStoreId] as const, - getVectorStoreFileBatch: (vectorStoreId: string, batchId: string) => - ['vector_stores', 'getVectorStoreFileBatch', vectorStoreId, batchId] as const, + getVectorStoreFileBatch: ( + vectorStoreId: Parameters[0], + batchId: Parameters[1] + ) => ['vector_stores', 'getVectorStoreFileBatch', vectorStoreId, batchId] as const, listFilesInVectorStoreBatch: ( - vectorStoreId: string, - batchId: string, + vectorStoreId: Parameters[0], + batchId: Parameters[1], params?: Parameters[2] ) => ['vector_stores', 'listFilesInVectorStoreBatch', vectorStoreId, batchId, params] as const, listVectorStoreFiles: ( - vectorStoreId: string, + vectorStoreId: Parameters[0], params?: Parameters[1] ) => ['vector_stores', 'listVectorStoreFiles', vectorStoreId, params] as const, - getVectorStoreFile: (vectorStoreId: string, fileId: string) => - ['vector_stores', 'getVectorStoreFile', vectorStoreId, fileId] as const, - retrieveVectorStoreFileContent: (vectorStoreId: string, fileId: string) => - ['vector_stores', 'retrieveVectorStoreFileContent', vectorStoreId, fileId] as const, + getVectorStoreFile: ( + vectorStoreId: Parameters[0], + fileId: Parameters[1] + ) => ['vector_stores', 'getVectorStoreFile', vectorStoreId, fileId] as const, + retrieveVectorStoreFileContent: ( + vectorStoreId: Parameters[0], + fileId: Parameters[1] + ) => ['vector_stores', 'retrieveVectorStoreFileContent', vectorStoreId, fileId] as const, } export const videoKeys = { all: () => ['videos'] as const, list: (params?: Parameters[0]) => ['videos', 'list', params] as const, - getVideoCharacter: (characterId: string) => ['videos', 'getVideoCharacter', characterId] as const, - getVideo: (videoId: string) => ['videos', 'getVideo', videoId] as const, - retrieveVideoContent: (videoId: string, params?: Parameters[1]) => - ['videos', 'retrieveVideoContent', videoId, params] as const, + getVideoCharacter: (characterId: Parameters[0]) => + ['videos', 'getVideoCharacter', characterId] as const, + getVideo: (videoId: Parameters[0]) => ['videos', 'getVideo', videoId] as const, + retrieveVideoContent: ( + videoId: Parameters[0], + params?: Parameters[1] + ) => ['videos', 'retrieveVideoContent', videoId, params] as const, } export const skillKeys = { all: () => ['skills'] as const, list: (params?: Parameters[0]) => ['skills', 'list', params] as const, - getSkill: (skillId: string) => ['skills', 'getSkill', skillId] as const, - getSkillContent: (skillId: string) => ['skills', 'getSkillContent', skillId] as const, - listSkillVersions: (skillId: string, params?: Parameters[1]) => - ['skills', 'listSkillVersions', skillId, params] as const, - getSkillVersion: (skillId: string, version: string) => - ['skills', 'getSkillVersion', skillId, version] as const, - getSkillVersionContent: (skillId: string, version: string) => - ['skills', 'getSkillVersionContent', skillId, version] as const, + getSkill: (skillId: Parameters[0]) => ['skills', 'getSkill', skillId] as const, + getSkillContent: (skillId: Parameters[0]) => + ['skills', 'getSkillContent', skillId] as const, + listSkillVersions: ( + skillId: Parameters[0], + params?: Parameters[1] + ) => ['skills', 'listSkillVersions', skillId, params] as const, + getSkillVersion: ( + skillId: Parameters[0], + version: Parameters[1] + ) => ['skills', 'getSkillVersion', skillId, version] as const, + getSkillVersionContent: ( + skillId: Parameters[0], + version: Parameters[1] + ) => ['skills', 'getSkillVersionContent', skillId, version] as const, } export const chatkitKeys = { all: () => ['chatkit'] as const, list: (params?: Parameters[0]) => ['chatkit', 'list', params] as const, - listThreadItemsMethod: (threadId: string, params?: Parameters[1]) => - ['chatkit', 'listThreadItemsMethod', threadId, params] as const, - getThreadMethod: (threadId: string) => ['chatkit', 'getThreadMethod', threadId] as const, + listThreadItemsMethod: ( + threadId: Parameters[0], + params?: Parameters[1] + ) => ['chatkit', 'listThreadItemsMethod', threadId, params] as const, + getThreadMethod: (threadId: Parameters[0]) => + ['chatkit', 'getThreadMethod', threadId] as const, } // ── Query options factories ────────────────────────────────── @@ -566,7 +635,7 @@ export function listAssistantsQueryOptions( /** @deprecated */ export function getAssistantQueryOptions( - assistantId: string, + assistantId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -598,7 +667,7 @@ export function listVoiceConsentsQueryOptions( } export function getVoiceConsentQueryOptions( - consentId: string, + consentId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -630,7 +699,7 @@ export function listBatchesQueryOptions( } export function retrieveBatchQueryOptions( - batchId: string, + batchId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -662,7 +731,7 @@ export function listChatCompletionsQueryOptions( } export function getChatCompletionQueryOptions( - completionId: string, + completionId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -678,7 +747,7 @@ export function getChatCompletionQueryOptions( } export function getChatCompletionMessagesQueryOptions( - completionId: string, + completionId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -711,7 +780,7 @@ export function listContainersQueryOptions( } export function retrieveContainerQueryOptions( - containerId: string, + containerId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -727,7 +796,7 @@ export function retrieveContainerQueryOptions( } export function listContainerFilesQueryOptions( - containerId: string, + containerId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -744,8 +813,8 @@ export function listContainerFilesQueryOptions( } export function retrieveContainerFileQueryOptions( - containerId: string, - fileId: string, + containerId: Parameters[0], + fileId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -761,8 +830,8 @@ export function retrieveContainerFileQueryOptions( } export function retrieveContainerFileContentQueryOptions( - containerId: string, - fileId: string, + containerId: Parameters[0], + fileId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -778,7 +847,7 @@ export function retrieveContainerFileContentQueryOptions( } export function listConversationItemsQueryOptions( - conversationId: string, + conversationId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -795,8 +864,8 @@ export function listConversationItemsQueryOptions( } export function getConversationItemQueryOptions( - conversationId: string, - itemId: string, + conversationId: Parameters[0], + itemId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -829,7 +898,7 @@ export function listEvalsQueryOptions( } export function getEvalQueryOptions( - evalId: string, + evalId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -845,7 +914,7 @@ export function getEvalQueryOptions( } export function getEvalRunsQueryOptions( - evalId: string, + evalId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -862,8 +931,8 @@ export function getEvalRunsQueryOptions( } export function getEvalRunQueryOptions( - evalId: string, - runId: string, + evalId: Parameters[0], + runId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -879,8 +948,8 @@ export function getEvalRunQueryOptions( } export function getEvalRunOutputItemsQueryOptions( - evalId: string, - runId: string, + evalId: Parameters[0], + runId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -897,9 +966,9 @@ export function getEvalRunOutputItemsQueryOptions( } export function getEvalRunOutputItemQueryOptions( - evalId: string, - runId: string, - outputItemId: string, + evalId: Parameters[0], + runId: Parameters[1], + outputItemId: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -931,7 +1000,7 @@ export function listFilesQueryOptions( } export function retrieveFileQueryOptions( - fileId: string, + fileId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -947,7 +1016,7 @@ export function retrieveFileQueryOptions( } export function downloadFileQueryOptions( - fileId: string, + fileId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -963,7 +1032,7 @@ export function downloadFileQueryOptions( } export function listFineTuningCheckpointPermissionsQueryOptions( - fineTunedModelCheckpoint: string, + fineTunedModelCheckpoint: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -996,7 +1065,7 @@ export function listPaginatedFineTuningJobsQueryOptions( } export function retrieveFineTuningJobQueryOptions( - fineTuningJobId: string, + fineTuningJobId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1012,7 +1081,7 @@ export function retrieveFineTuningJobQueryOptions( } export function listFineTuningJobCheckpointsQueryOptions( - fineTuningJobId: string, + fineTuningJobId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1029,7 +1098,7 @@ export function listFineTuningJobCheckpointsQueryOptions( } export function listFineTuningEventsQueryOptions( - fineTuningJobId: string, + fineTuningJobId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1061,7 +1130,7 @@ export function listModelsQueryOptions( } export function retrieveModelQueryOptions( - model: string, + model: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1093,7 +1162,7 @@ export function adminApiKeysListQueryOptions( } export function adminApiKeysGetQueryOptions( - keyId: string, + keyId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1141,7 +1210,7 @@ export function listOrganizationCertificatesQueryOptions( } export function getCertificateQueryOptions( - certificateId: string, + certificateId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1190,7 +1259,7 @@ export function listGroupsQueryOptions( } export function listGroupRoleAssignmentsQueryOptions( - groupId: string, + groupId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1207,7 +1276,7 @@ export function listGroupRoleAssignmentsQueryOptions( } export function listGroupUsersQueryOptions( - groupId: string, + groupId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1240,7 +1309,7 @@ export function listInvitesQueryOptions( } export function retrieveInviteQueryOptions( - inviteId: string, + inviteId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1272,7 +1341,7 @@ export function listProjectsQueryOptions( } export function retrieveProjectQueryOptions( - projectId: string, + projectId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1288,7 +1357,7 @@ export function retrieveProjectQueryOptions( } export function listProjectApiKeysQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1305,8 +1374,8 @@ export function listProjectApiKeysQueryOptions( } export function retrieveProjectApiKeyQueryOptions( - projectId: string, - apiKeyId: string, + projectId: Parameters[0], + apiKeyId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1322,7 +1391,7 @@ export function retrieveProjectApiKeyQueryOptions( } export function listProjectCertificatesQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1339,7 +1408,7 @@ export function listProjectCertificatesQueryOptions( } export function listProjectGroupsQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1356,7 +1425,7 @@ export function listProjectGroupsQueryOptions( } export function listProjectRateLimitsQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1373,7 +1442,7 @@ export function listProjectRateLimitsQueryOptions( } export function listProjectServiceAccountsQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1390,8 +1459,8 @@ export function listProjectServiceAccountsQueryOptions( } export function retrieveProjectServiceAccountQueryOptions( - projectId: string, - serviceAccountId: string, + projectId: Parameters[0], + serviceAccountId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1407,7 +1476,7 @@ export function retrieveProjectServiceAccountQueryOptions( } export function listProjectUsersQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1424,8 +1493,8 @@ export function listProjectUsersQueryOptions( } export function retrieveProjectUserQueryOptions( - projectId: string, - userId: string, + projectId: Parameters[0], + userId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1601,7 +1670,7 @@ export function listUsersQueryOptions( } export function retrieveUserQueryOptions( - userId: string, + userId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1617,7 +1686,7 @@ export function retrieveUserQueryOptions( } export function listUserRoleAssignmentsQueryOptions( - userId: string, + userId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1634,8 +1703,8 @@ export function listUserRoleAssignmentsQueryOptions( } export function listProjectGroupRoleAssignmentsQueryOptions( - projectId: string, - groupId: string, + projectId: Parameters[0], + groupId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -1652,7 +1721,7 @@ export function listProjectGroupRoleAssignmentsQueryOptions( } export function listProjectRolesQueryOptions( - projectId: string, + projectId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1669,8 +1738,8 @@ export function listProjectRolesQueryOptions( } export function listProjectUserRoleAssignmentsQueryOptions( - projectId: string, - userId: string, + projectId: Parameters[0], + userId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -1687,7 +1756,7 @@ export function listProjectUserRoleAssignmentsQueryOptions( } export function getResponseQueryOptions( - responseId: string, + responseId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1704,7 +1773,7 @@ export function getResponseQueryOptions( } export function listInputItemsQueryOptions( - responseId: string, + responseId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1721,7 +1790,7 @@ export function listInputItemsQueryOptions( } export function getThreadQueryOptions( - threadId: string, + threadId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1737,7 +1806,7 @@ export function getThreadQueryOptions( } export function listMessagesQueryOptions( - threadId: string, + threadId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1754,8 +1823,8 @@ export function listMessagesQueryOptions( } export function getMessageQueryOptions( - threadId: string, - messageId: string, + threadId: Parameters[0], + messageId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1771,7 +1840,7 @@ export function getMessageQueryOptions( } export function listRunsQueryOptions( - threadId: string, + threadId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1788,8 +1857,8 @@ export function listRunsQueryOptions( } export function getRunQueryOptions( - threadId: string, - runId: string, + threadId: Parameters[0], + runId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1805,8 +1874,8 @@ export function getRunQueryOptions( } export function listRunStepsQueryOptions( - threadId: string, - runId: string, + threadId: Parameters[0], + runId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -1823,9 +1892,9 @@ export function listRunStepsQueryOptions( } export function getRunStepQueryOptions( - threadId: string, - runId: string, - stepId: string, + threadId: Parameters[0], + runId: Parameters[1], + stepId: Parameters[2], params?: Parameters[3], options?: Omit< UseQueryOptions>, ApiError>, @@ -1858,7 +1927,7 @@ export function listVectorStoresQueryOptions( } export function getVectorStoreQueryOptions( - vectorStoreId: string, + vectorStoreId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1874,8 +1943,8 @@ export function getVectorStoreQueryOptions( } export function getVectorStoreFileBatchQueryOptions( - vectorStoreId: string, - batchId: string, + vectorStoreId: Parameters[0], + batchId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1891,8 +1960,8 @@ export function getVectorStoreFileBatchQueryOptions( } export function listFilesInVectorStoreBatchQueryOptions( - vectorStoreId: string, - batchId: string, + vectorStoreId: Parameters[0], + batchId: Parameters[1], params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -1909,7 +1978,7 @@ export function listFilesInVectorStoreBatchQueryOptions( } export function listVectorStoreFilesQueryOptions( - vectorStoreId: string, + vectorStoreId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1926,8 +1995,8 @@ export function listVectorStoreFilesQueryOptions( } export function getVectorStoreFileQueryOptions( - vectorStoreId: string, - fileId: string, + vectorStoreId: Parameters[0], + fileId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1943,8 +2012,8 @@ export function getVectorStoreFileQueryOptions( } export function retrieveVectorStoreFileContentQueryOptions( - vectorStoreId: string, - fileId: string, + vectorStoreId: Parameters[0], + fileId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1960,7 +2029,7 @@ export function retrieveVectorStoreFileContentQueryOptions( } export function getConversationQueryOptions( - conversationId: string, + conversationId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1992,7 +2061,7 @@ export function listVideosQueryOptions( } export function getVideoCharacterQueryOptions( - characterId: string, + characterId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2008,7 +2077,7 @@ export function getVideoCharacterQueryOptions( } export function getVideoQueryOptions( - videoId: string, + videoId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2024,7 +2093,7 @@ export function getVideoQueryOptions( } export function retrieveVideoContentQueryOptions( - videoId: string, + videoId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2057,7 +2126,7 @@ export function listSkillsQueryOptions( } export function getSkillQueryOptions( - skillId: string, + skillId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2073,7 +2142,7 @@ export function getSkillQueryOptions( } export function getSkillContentQueryOptions( - skillId: string, + skillId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2089,7 +2158,7 @@ export function getSkillContentQueryOptions( } export function listSkillVersionsQueryOptions( - skillId: string, + skillId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2106,8 +2175,8 @@ export function listSkillVersionsQueryOptions( } export function getSkillVersionQueryOptions( - skillId: string, - version: string, + skillId: Parameters[0], + version: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2123,8 +2192,8 @@ export function getSkillVersionQueryOptions( } export function getSkillVersionContentQueryOptions( - skillId: string, - version: string, + skillId: Parameters[0], + version: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2140,7 +2209,7 @@ export function getSkillVersionContentQueryOptions( } export function listThreadItemsMethodQueryOptions( - threadId: string, + threadId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2157,7 +2226,7 @@ export function listThreadItemsMethodQueryOptions( } export function getThreadMethodQueryOptions( - threadId: string, + threadId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2241,7 +2310,7 @@ export function useListAssistantsInfinite( /** @deprecated */ export function useGetAssistant( - assistantId: string | undefined | null, + assistantId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2305,7 +2374,7 @@ export function useListVoiceConsentsInfinite( } export function useGetVoiceConsent( - consentId: string | undefined | null, + consentId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2369,7 +2438,7 @@ export function useListBatchesInfinite( } export function useRetrieveBatch( - batchId: string | undefined | null, + batchId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2433,7 +2502,7 @@ export function useListChatCompletionsInfinite( } export function useGetChatCompletion( - completionId: string | undefined | null, + completionId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2450,7 +2519,7 @@ export function useGetChatCompletion( } export function useGetChatCompletionMessages( - completionId: string | undefined | null, + completionId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2515,7 +2584,7 @@ export function useListContainersInfinite( } export function useRetrieveContainer( - containerId: string | undefined | null, + containerId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2532,7 +2601,7 @@ export function useRetrieveContainer( } export function useListContainerFiles( - containerId: string | undefined | null, + containerId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2550,8 +2619,8 @@ export function useListContainerFiles( } export function useRetrieveContainerFile( - containerId: string | undefined | null, - fileId: string | undefined | null, + containerId: Parameters[0] | undefined | null, + fileId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2568,8 +2637,8 @@ export function useRetrieveContainerFile( } export function useRetrieveContainerFileContent( - containerId: string | undefined | null, - fileId: string | undefined | null, + containerId: Parameters[0] | undefined | null, + fileId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2586,7 +2655,7 @@ export function useRetrieveContainerFileContent( } export function useListConversationItems( - conversationId: string | undefined | null, + conversationId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2604,8 +2673,8 @@ export function useListConversationItems( } export function useGetConversationItem( - conversationId: string | undefined | null, - itemId: string | undefined | null, + conversationId: Parameters[0] | undefined | null, + itemId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -2670,7 +2739,7 @@ export function useListEvalsInfinite( } export function useGetEval( - evalId: string | undefined | null, + evalId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2687,7 +2756,7 @@ export function useGetEval( } export function useGetEvalRuns( - evalId: string | undefined | null, + evalId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2705,8 +2774,8 @@ export function useGetEvalRuns( } export function useGetEvalRun( - evalId: string | undefined | null, - runId: string | undefined | null, + evalId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2723,8 +2792,8 @@ export function useGetEvalRun( } export function useGetEvalRunOutputItems( - evalId: string | undefined | null, - runId: string | undefined | null, + evalId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -2742,9 +2811,9 @@ export function useGetEvalRunOutputItems( } export function useGetEvalRunOutputItem( - evalId: string | undefined | null, - runId: string | undefined | null, - outputItemId: string | undefined | null, + evalId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, + outputItemId: Parameters[2] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2808,7 +2877,7 @@ export function useListFilesInfinite( } export function useRetrieveFile( - fileId: string | undefined | null, + fileId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2825,7 +2894,7 @@ export function useRetrieveFile( } export function useDownloadFile( - fileId: string | undefined | null, + fileId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2842,7 +2911,10 @@ export function useDownloadFile( } export function useListFineTuningCheckpointPermissions( - fineTunedModelCheckpoint: string | undefined | null, + fineTunedModelCheckpoint: + | Parameters[0] + | undefined + | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2908,7 +2980,7 @@ export function useListPaginatedFineTuningJobsInfinite( } export function useRetrieveFineTuningJob( - fineTuningJobId: string | undefined | null, + fineTuningJobId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2925,7 +2997,7 @@ export function useRetrieveFineTuningJob( } export function useListFineTuningJobCheckpoints( - fineTuningJobId: string | undefined | null, + fineTuningJobId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2943,7 +3015,7 @@ export function useListFineTuningJobCheckpoints( } export function useListFineTuningEvents( - fineTuningJobId: string | undefined | null, + fineTuningJobId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2976,7 +3048,7 @@ export function useListModels( } export function useRetrieveModel( - model: string | undefined | null, + model: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3040,7 +3112,7 @@ export function useAdminApiKeysListInfinite( } export function useAdminApiKeysGet( - keyId: string | undefined | null, + keyId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3152,7 +3224,7 @@ export function useListOrganizationCertificatesInfinite( } export function useGetCertificate( - certificateId: string | undefined | null, + certificateId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3264,7 +3336,7 @@ export function useListGroupsInfinite( } export function useListGroupRoleAssignments( - groupId: string | undefined | null, + groupId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3282,7 +3354,7 @@ export function useListGroupRoleAssignments( } export function useListGroupUsers( - groupId: string | undefined | null, + groupId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3347,7 +3419,7 @@ export function useListInvitesInfinite( } export function useRetrieveInvite( - inviteId: string | undefined | null, + inviteId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3411,7 +3483,7 @@ export function useListProjectsInfinite( } export function useRetrieveProject( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3428,7 +3500,7 @@ export function useRetrieveProject( } export function useListProjectApiKeys( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3446,8 +3518,8 @@ export function useListProjectApiKeys( } export function useRetrieveProjectApiKey( - projectId: string | undefined | null, - apiKeyId: string | undefined | null, + projectId: Parameters[0] | undefined | null, + apiKeyId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3464,7 +3536,7 @@ export function useRetrieveProjectApiKey( } export function useListProjectCertificates( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3482,7 +3554,7 @@ export function useListProjectCertificates( } export function useListProjectGroups( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3500,7 +3572,7 @@ export function useListProjectGroups( } export function useListProjectRateLimits( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3518,7 +3590,7 @@ export function useListProjectRateLimits( } export function useListProjectServiceAccounts( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3536,8 +3608,8 @@ export function useListProjectServiceAccounts( } export function useRetrieveProjectServiceAccount( - projectId: string | undefined | null, - serviceAccountId: string | undefined | null, + projectId: Parameters[0] | undefined | null, + serviceAccountId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -3554,7 +3626,7 @@ export function useRetrieveProjectServiceAccount( } export function useListProjectUsers( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -3572,8 +3644,8 @@ export function useListProjectUsers( } export function useRetrieveProjectUser( - projectId: string | undefined | null, - userId: string | undefined | null, + projectId: Parameters[0] | undefined | null, + userId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4061,7 +4133,7 @@ export function useListUsersInfinite( } export function useRetrieveUser( - userId: string | undefined | null, + userId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4078,7 +4150,7 @@ export function useRetrieveUser( } export function useListUserRoleAssignments( - userId: string | undefined | null, + userId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4096,8 +4168,8 @@ export function useListUserRoleAssignments( } export function useListProjectGroupRoleAssignments( - projectId: string | undefined | null, - groupId: string | undefined | null, + projectId: Parameters[0] | undefined | null, + groupId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -4115,7 +4187,7 @@ export function useListProjectGroupRoleAssignments( } export function useListProjectRoles( - projectId: string | undefined | null, + projectId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4133,8 +4205,8 @@ export function useListProjectRoles( } export function useListProjectUserRoleAssignments( - projectId: string | undefined | null, - userId: string | undefined | null, + projectId: Parameters[0] | undefined | null, + userId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -4152,7 +4224,7 @@ export function useListProjectUserRoleAssignments( } export function useGetResponse( - responseId: string | undefined | null, + responseId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4170,7 +4242,7 @@ export function useGetResponse( } export function useListInputItems( - responseId: string | undefined | null, + responseId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4188,7 +4260,7 @@ export function useListInputItems( } export function useGetThread( - threadId: string | undefined | null, + threadId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4205,7 +4277,7 @@ export function useGetThread( } export function useListMessages( - threadId: string | undefined | null, + threadId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4223,8 +4295,8 @@ export function useListMessages( } export function useGetMessage( - threadId: string | undefined | null, - messageId: string | undefined | null, + threadId: Parameters[0] | undefined | null, + messageId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4241,7 +4313,7 @@ export function useGetMessage( } export function useListRuns( - threadId: string | undefined | null, + threadId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4259,8 +4331,8 @@ export function useListRuns( } export function useGetRun( - threadId: string | undefined | null, - runId: string | undefined | null, + threadId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4277,8 +4349,8 @@ export function useGetRun( } export function useListRunSteps( - threadId: string | undefined | null, - runId: string | undefined | null, + threadId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -4296,9 +4368,9 @@ export function useListRunSteps( } export function useGetRunStep( - threadId: string | undefined | null, - runId: string | undefined | null, - stepId: string | undefined | null, + threadId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, + stepId: Parameters[2] | undefined | null, params?: Parameters[3], options?: Omit< UseQueryOptions>, ApiError>, @@ -4363,7 +4435,7 @@ export function useListVectorStoresInfinite( } export function useGetVectorStore( - vectorStoreId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4380,8 +4452,8 @@ export function useGetVectorStore( } export function useGetVectorStoreFileBatch( - vectorStoreId: string | undefined | null, - batchId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, + batchId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4398,8 +4470,8 @@ export function useGetVectorStoreFileBatch( } export function useListFilesInVectorStoreBatch( - vectorStoreId: string | undefined | null, - batchId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, + batchId: Parameters[1] | undefined | null, params?: Parameters[2], options?: Omit< UseQueryOptions>, ApiError>, @@ -4417,7 +4489,7 @@ export function useListFilesInVectorStoreBatch( } export function useListVectorStoreFiles( - vectorStoreId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4435,8 +4507,8 @@ export function useListVectorStoreFiles( } export function useGetVectorStoreFile( - vectorStoreId: string | undefined | null, - fileId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, + fileId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4453,8 +4525,8 @@ export function useGetVectorStoreFile( } export function useRetrieveVectorStoreFileContent( - vectorStoreId: string | undefined | null, - fileId: string | undefined | null, + vectorStoreId: Parameters[0] | undefined | null, + fileId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4471,7 +4543,7 @@ export function useRetrieveVectorStoreFileContent( } export function useGetConversation( - conversationId: string | undefined | null, + conversationId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4535,7 +4607,7 @@ export function useListVideosInfinite( } export function useGetVideoCharacter( - characterId: string | undefined | null, + characterId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4552,7 +4624,7 @@ export function useGetVideoCharacter( } export function useGetVideo( - videoId: string | undefined | null, + videoId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4569,7 +4641,7 @@ export function useGetVideo( } export function useRetrieveVideoContent( - videoId: string | undefined | null, + videoId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4634,7 +4706,7 @@ export function useListSkillsInfinite( } export function useGetSkill( - skillId: string | undefined | null, + skillId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4651,7 +4723,7 @@ export function useGetSkill( } export function useGetSkillContent( - skillId: string | undefined | null, + skillId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4668,7 +4740,7 @@ export function useGetSkillContent( } export function useListSkillVersions( - skillId: string | undefined | null, + skillId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4686,8 +4758,8 @@ export function useListSkillVersions( } export function useGetSkillVersion( - skillId: string | undefined | null, - version: string | undefined | null, + skillId: Parameters[0] | undefined | null, + version: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4704,8 +4776,8 @@ export function useGetSkillVersion( } export function useGetSkillVersionContent( - skillId: string | undefined | null, - version: string | undefined | null, + skillId: Parameters[0] | undefined | null, + version: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4722,7 +4794,7 @@ export function useGetSkillVersionContent( } export function useListThreadItemsMethod( - threadId: string | undefined | null, + threadId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -4740,7 +4812,7 @@ export function useListThreadItemsMethod( } export function useGetThreadMethod( - threadId: string | undefined | null, + threadId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -4832,7 +4904,10 @@ export function useModifyAssistant( UseMutationOptions< Awaited>, ApiError, - { assistantId: string; body: Parameters[1] } + { + assistantId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -4840,7 +4915,10 @@ export function useModifyAssistant( return useMutation< Awaited>, ApiError, - { assistantId: string; body: Parameters[1] } + { + assistantId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ assistantId, body }) => modifyAssistant(assistantId, body), ...options, @@ -4850,11 +4928,19 @@ export function useModifyAssistant( /** @deprecated */ export function useDeleteAssistant( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (assistantId) => deleteAssistant(assistantId), ...options, }) @@ -4945,7 +5031,10 @@ export function useUpdateVoiceConsent( UseMutationOptions< Awaited>, ApiError, - { consentId: string; body: Parameters[1] } + { + consentId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -4953,7 +5042,10 @@ export function useUpdateVoiceConsent( return useMutation< Awaited>, ApiError, - { consentId: string; body: Parameters[1] } + { + consentId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ consentId, body }) => updateVoiceConsent(consentId, body), ...options, @@ -4962,11 +5054,19 @@ export function useUpdateVoiceConsent( export function useDeleteVoiceConsent( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (consentId) => deleteVoiceConsent(consentId), ...options, }) @@ -5014,11 +5114,19 @@ export function useCreateBatch( export function useCancelBatch( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (batchId) => cancelBatch(batchId), ...options, }) @@ -5049,7 +5157,10 @@ export function useUpdateChatCompletion( UseMutationOptions< Awaited>, ApiError, - { completionId: string; body: Parameters[1] } + { + completionId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -5057,7 +5168,10 @@ export function useUpdateChatCompletion( return useMutation< Awaited>, ApiError, - { completionId: string; body: Parameters[1] } + { + completionId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ completionId, body }) => updateChatCompletion(completionId, body), ...options, @@ -5066,11 +5180,19 @@ export function useUpdateChatCompletion( export function useDeleteChatCompletion( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (completionId) => deleteChatCompletion(completionId), ...options, }) @@ -5118,11 +5240,19 @@ export function useCreateContainer( export function useDeleteContainer( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (containerId) => deleteContainer(containerId), ...options, }) @@ -5133,7 +5263,10 @@ export function useCreateContainerFile( UseMutationOptions< Awaited>, ApiError, - { containerId: string; body: Parameters[1] } + { + containerId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -5141,7 +5274,10 @@ export function useCreateContainerFile( return useMutation< Awaited>, ApiError, - { containerId: string; body: Parameters[1] } + { + containerId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ containerId, body }) => createContainerFile(containerId, body), ...options, @@ -5153,7 +5289,10 @@ export function useDeleteContainerFile( UseMutationOptions< Awaited>, ApiError, - { containerId: string; fileId: string } + { + containerId: Parameters[0] + fileId: Parameters[1] + } >, 'mutationFn' > @@ -5161,7 +5300,10 @@ export function useDeleteContainerFile( return useMutation< Awaited>, ApiError, - { containerId: string; fileId: string } + { + containerId: Parameters[0] + fileId: Parameters[1] + } >({ mutationFn: ({ containerId, fileId }) => deleteContainerFile(containerId, fileId), ...options, @@ -5174,7 +5316,7 @@ export function useCreateConversationItems( Awaited>, ApiError, { - conversationId: string + conversationId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -5186,7 +5328,7 @@ export function useCreateConversationItems( Awaited>, ApiError, { - conversationId: string + conversationId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -5202,7 +5344,10 @@ export function useDeleteConversationItem( UseMutationOptions< Awaited>, ApiError, - { conversationId: string; itemId: string } + { + conversationId: Parameters[0] + itemId: Parameters[1] + } >, 'mutationFn' > @@ -5210,7 +5355,10 @@ export function useDeleteConversationItem( return useMutation< Awaited>, ApiError, - { conversationId: string; itemId: string } + { + conversationId: Parameters[0] + itemId: Parameters[1] + } >({ mutationFn: ({ conversationId, itemId }) => deleteConversationItem(conversationId, itemId), ...options, @@ -5262,7 +5410,7 @@ export function useUpdateEval( UseMutationOptions< Awaited>, ApiError, - { evalId: string; body: Parameters[1] } + { evalId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -5270,7 +5418,7 @@ export function useUpdateEval( return useMutation< Awaited>, ApiError, - { evalId: string; body: Parameters[1] } + { evalId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ evalId, body }) => updateEval(evalId, body), ...options, @@ -5279,11 +5427,19 @@ export function useUpdateEval( export function useDeleteEval( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (evalId) => deleteEval(evalId), ...options, }) @@ -5294,7 +5450,7 @@ export function useCreateEvalRun( UseMutationOptions< Awaited>, ApiError, - { evalId: string; body: Parameters[1] } + { evalId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -5302,7 +5458,7 @@ export function useCreateEvalRun( return useMutation< Awaited>, ApiError, - { evalId: string; body: Parameters[1] } + { evalId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ evalId, body }) => createEvalRun(evalId, body), ...options, @@ -5314,7 +5470,7 @@ export function useCancelEvalRun( UseMutationOptions< Awaited>, ApiError, - { evalId: string; runId: string } + { evalId: Parameters[0]; runId: Parameters[1] } >, 'mutationFn' > @@ -5322,7 +5478,7 @@ export function useCancelEvalRun( return useMutation< Awaited>, ApiError, - { evalId: string; runId: string } + { evalId: Parameters[0]; runId: Parameters[1] } >({ mutationFn: ({ evalId, runId }) => cancelEvalRun(evalId, runId), ...options, @@ -5334,7 +5490,7 @@ export function useDeleteEvalRun( UseMutationOptions< Awaited>, ApiError, - { evalId: string; runId: string } + { evalId: Parameters[0]; runId: Parameters[1] } >, 'mutationFn' > @@ -5342,7 +5498,7 @@ export function useDeleteEvalRun( return useMutation< Awaited>, ApiError, - { evalId: string; runId: string } + { evalId: Parameters[0]; runId: Parameters[1] } >({ mutationFn: ({ evalId, runId }) => deleteEvalRun(evalId, runId), ...options, @@ -5371,11 +5527,19 @@ export function useCreateFile( export function useDeleteFile( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (fileId) => deleteFile(fileId), ...options, }) @@ -5427,7 +5591,7 @@ export function useCreateFineTuningCheckpointPermission( Awaited>, ApiError, { - fineTunedModelCheckpoint: string + fineTunedModelCheckpoint: Parameters[0] body: Parameters[1] } >, @@ -5438,7 +5602,7 @@ export function useCreateFineTuningCheckpointPermission( Awaited>, ApiError, { - fineTunedModelCheckpoint: string + fineTunedModelCheckpoint: Parameters[0] body: Parameters[1] } >({ @@ -5453,7 +5617,10 @@ export function useDeleteFineTuningCheckpointPermission( UseMutationOptions< Awaited>, ApiError, - { fineTunedModelCheckpoint: string; permissionId: string } + { + fineTunedModelCheckpoint: Parameters[0] + permissionId: Parameters[1] + } >, 'mutationFn' > @@ -5461,7 +5628,10 @@ export function useDeleteFineTuningCheckpointPermission( return useMutation< Awaited>, ApiError, - { fineTunedModelCheckpoint: string; permissionId: string } + { + fineTunedModelCheckpoint: Parameters[0] + permissionId: Parameters[1] + } >({ mutationFn: ({ fineTunedModelCheckpoint, permissionId }) => deleteFineTuningCheckpointPermission(fineTunedModelCheckpoint, permissionId), @@ -5491,11 +5661,19 @@ export function useCreateFineTuningJob( export function useCancelFineTuningJob( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (fineTuningJobId) => cancelFineTuningJob(fineTuningJobId), ...options, }) @@ -5503,11 +5681,19 @@ export function useCancelFineTuningJob( export function usePauseFineTuningJob( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (fineTuningJobId) => pauseFineTuningJob(fineTuningJobId), ...options, }) @@ -5515,11 +5701,19 @@ export function usePauseFineTuningJob( export function useResumeFineTuningJob( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (fineTuningJobId) => resumeFineTuningJob(fineTuningJobId), ...options, }) @@ -5587,11 +5781,19 @@ export function useCreateImageVariation( export function useDeleteModel( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (model) => deleteModel(model), ...options, }) @@ -5639,11 +5841,19 @@ export function useAdminApiKeysCreate( export function useAdminApiKeysDelete( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (keyId) => adminApiKeysDelete(keyId), ...options, }) @@ -5714,7 +5924,10 @@ export function useModifyCertificate( UseMutationOptions< Awaited>, ApiError, - { certificateId: string; body: Parameters[1] } + { + certificateId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -5722,7 +5935,10 @@ export function useModifyCertificate( return useMutation< Awaited>, ApiError, - { certificateId: string; body: Parameters[1] } + { + certificateId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ certificateId, body }) => modifyCertificate(certificateId, body), ...options, @@ -5731,11 +5947,19 @@ export function useModifyCertificate( export function useDeleteCertificate( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (certificateId) => deleteCertificate(certificateId), ...options, }) @@ -5766,7 +5990,7 @@ export function useUpdateGroup( UseMutationOptions< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { groupId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -5774,7 +5998,7 @@ export function useUpdateGroup( return useMutation< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { groupId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ groupId, body }) => updateGroup(groupId, body), ...options, @@ -5783,11 +6007,19 @@ export function useUpdateGroup( export function useDeleteGroup( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (groupId) => deleteGroup(groupId), ...options, }) @@ -5798,7 +6030,10 @@ export function useAssignGroupRole( UseMutationOptions< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { + groupId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -5806,7 +6041,7 @@ export function useAssignGroupRole( return useMutation< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { groupId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ groupId, body }) => assignGroupRole(groupId, body), ...options, @@ -5818,7 +6053,10 @@ export function useUnassignGroupRole( UseMutationOptions< Awaited>, ApiError, - { groupId: string; roleId: string } + { + groupId: Parameters[0] + roleId: Parameters[1] + } >, 'mutationFn' > @@ -5826,7 +6064,10 @@ export function useUnassignGroupRole( return useMutation< Awaited>, ApiError, - { groupId: string; roleId: string } + { + groupId: Parameters[0] + roleId: Parameters[1] + } >({ mutationFn: ({ groupId, roleId }) => unassignGroupRole(groupId, roleId), ...options, @@ -5838,7 +6079,7 @@ export function useAddGroupUser( UseMutationOptions< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { groupId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -5846,7 +6087,7 @@ export function useAddGroupUser( return useMutation< Awaited>, ApiError, - { groupId: string; body: Parameters[1] } + { groupId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ groupId, body }) => addGroupUser(groupId, body), ...options, @@ -5858,7 +6099,10 @@ export function useRemoveGroupUser( UseMutationOptions< Awaited>, ApiError, - { groupId: string; userId: string } + { + groupId: Parameters[0] + userId: Parameters[1] + } >, 'mutationFn' > @@ -5866,7 +6110,10 @@ export function useRemoveGroupUser( return useMutation< Awaited>, ApiError, - { groupId: string; userId: string } + { + groupId: Parameters[0] + userId: Parameters[1] + } >({ mutationFn: ({ groupId, userId }) => removeGroupUser(groupId, userId), ...options, @@ -5895,11 +6142,19 @@ export function useInviteUser( export function useDeleteInvite( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (inviteId) => deleteInvite(inviteId), ...options, }) @@ -5930,7 +6185,7 @@ export function useModifyProject( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { projectId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -5938,7 +6193,7 @@ export function useModifyProject( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { projectId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ projectId, body }) => modifyProject(projectId, body), ...options, @@ -5950,7 +6205,10 @@ export function useDeleteProjectApiKey( UseMutationOptions< Awaited>, ApiError, - { projectId: string; apiKeyId: string } + { + projectId: Parameters[0] + apiKeyId: Parameters[1] + } >, 'mutationFn' > @@ -5958,7 +6216,10 @@ export function useDeleteProjectApiKey( return useMutation< Awaited>, ApiError, - { projectId: string; apiKeyId: string } + { + projectId: Parameters[0] + apiKeyId: Parameters[1] + } >({ mutationFn: ({ projectId, apiKeyId }) => deleteProjectApiKey(projectId, apiKeyId), ...options, @@ -5967,11 +6228,19 @@ export function useDeleteProjectApiKey( export function useArchiveProject( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (projectId) => archiveProject(projectId), ...options, }) @@ -5982,7 +6251,10 @@ export function useActivateProjectCertificates( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -5990,7 +6262,10 @@ export function useActivateProjectCertificates( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => activateProjectCertificates(projectId, body), ...options, @@ -6002,7 +6277,10 @@ export function useDeactivateProjectCertificates( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6010,7 +6288,10 @@ export function useDeactivateProjectCertificates( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => deactivateProjectCertificates(projectId, body), ...options, @@ -6022,7 +6303,10 @@ export function useAddProjectGroup( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6030,7 +6314,10 @@ export function useAddProjectGroup( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => addProjectGroup(projectId, body), ...options, @@ -6042,7 +6329,10 @@ export function useRemoveProjectGroup( UseMutationOptions< Awaited>, ApiError, - { projectId: string; groupId: string } + { + projectId: Parameters[0] + groupId: Parameters[1] + } >, 'mutationFn' > @@ -6050,7 +6340,10 @@ export function useRemoveProjectGroup( return useMutation< Awaited>, ApiError, - { projectId: string; groupId: string } + { + projectId: Parameters[0] + groupId: Parameters[1] + } >({ mutationFn: ({ projectId, groupId }) => removeProjectGroup(projectId, groupId), ...options, @@ -6063,8 +6356,8 @@ export function useUpdateProjectRateLimits( Awaited>, ApiError, { - projectId: string - rateLimitId: string + projectId: Parameters[0] + rateLimitId: Parameters[1] body: Parameters[2] } >, @@ -6074,7 +6367,11 @@ export function useUpdateProjectRateLimits( return useMutation< Awaited>, ApiError, - { projectId: string; rateLimitId: string; body: Parameters[2] } + { + projectId: Parameters[0] + rateLimitId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ projectId, rateLimitId, body }) => updateProjectRateLimits(projectId, rateLimitId, body), @@ -6087,7 +6384,10 @@ export function useCreateProjectServiceAccount( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6095,7 +6395,10 @@ export function useCreateProjectServiceAccount( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => createProjectServiceAccount(projectId, body), ...options, @@ -6107,7 +6410,10 @@ export function useDeleteProjectServiceAccount( UseMutationOptions< Awaited>, ApiError, - { projectId: string; serviceAccountId: string } + { + projectId: Parameters[0] + serviceAccountId: Parameters[1] + } >, 'mutationFn' > @@ -6115,7 +6421,10 @@ export function useDeleteProjectServiceAccount( return useMutation< Awaited>, ApiError, - { projectId: string; serviceAccountId: string } + { + projectId: Parameters[0] + serviceAccountId: Parameters[1] + } >({ mutationFn: ({ projectId, serviceAccountId }) => deleteProjectServiceAccount(projectId, serviceAccountId), @@ -6128,7 +6437,10 @@ export function useCreateProjectUser( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6136,7 +6448,10 @@ export function useCreateProjectUser( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => createProjectUser(projectId, body), ...options, @@ -6148,7 +6463,11 @@ export function useModifyProjectUser( UseMutationOptions< Awaited>, ApiError, - { projectId: string; userId: string; body: Parameters[2] } + { + projectId: Parameters[0] + userId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6156,7 +6475,11 @@ export function useModifyProjectUser( return useMutation< Awaited>, ApiError, - { projectId: string; userId: string; body: Parameters[2] } + { + projectId: Parameters[0] + userId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ projectId, userId, body }) => modifyProjectUser(projectId, userId, body), ...options, @@ -6168,7 +6491,10 @@ export function useDeleteProjectUser( UseMutationOptions< Awaited>, ApiError, - { projectId: string; userId: string } + { + projectId: Parameters[0] + userId: Parameters[1] + } >, 'mutationFn' > @@ -6176,7 +6502,10 @@ export function useDeleteProjectUser( return useMutation< Awaited>, ApiError, - { projectId: string; userId: string } + { + projectId: Parameters[0] + userId: Parameters[1] + } >({ mutationFn: ({ projectId, userId }) => deleteProjectUser(projectId, userId), ...options, @@ -6208,7 +6537,7 @@ export function useUpdateRole( UseMutationOptions< Awaited>, ApiError, - { roleId: string; body: Parameters[1] } + { roleId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6216,7 +6545,7 @@ export function useUpdateRole( return useMutation< Awaited>, ApiError, - { roleId: string; body: Parameters[1] } + { roleId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ roleId, body }) => updateRole(roleId, body), ...options, @@ -6225,11 +6554,19 @@ export function useUpdateRole( export function useDeleteRole( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (roleId) => deleteRole(roleId), ...options, }) @@ -6240,7 +6577,7 @@ export function useModifyUser( UseMutationOptions< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { userId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6248,7 +6585,7 @@ export function useModifyUser( return useMutation< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { userId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ userId, body }) => modifyUser(userId, body), ...options, @@ -6257,11 +6594,19 @@ export function useModifyUser( export function useDeleteUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (userId) => deleteUser(userId), ...options, }) @@ -6272,7 +6617,7 @@ export function useAssignUserRole( UseMutationOptions< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { userId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6280,7 +6625,7 @@ export function useAssignUserRole( return useMutation< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { userId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ userId, body }) => assignUserRole(userId, body), ...options, @@ -6292,7 +6637,10 @@ export function useUnassignUserRole( UseMutationOptions< Awaited>, ApiError, - { userId: string; roleId: string } + { + userId: Parameters[0] + roleId: Parameters[1] + } >, 'mutationFn' > @@ -6300,7 +6648,10 @@ export function useUnassignUserRole( return useMutation< Awaited>, ApiError, - { userId: string; roleId: string } + { + userId: Parameters[0] + roleId: Parameters[1] + } >({ mutationFn: ({ userId, roleId }) => unassignUserRole(userId, roleId), ...options, @@ -6312,7 +6663,11 @@ export function useAssignProjectGroupRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; groupId: string; body: Parameters[2] } + { + projectId: Parameters[0] + groupId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6320,7 +6675,11 @@ export function useAssignProjectGroupRole( return useMutation< Awaited>, ApiError, - { projectId: string; groupId: string; body: Parameters[2] } + { + projectId: Parameters[0] + groupId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ projectId, groupId, body }) => assignProjectGroupRole(projectId, groupId, body), ...options, @@ -6332,7 +6691,11 @@ export function useUnassignProjectGroupRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; groupId: string; roleId: string } + { + projectId: Parameters[0] + groupId: Parameters[1] + roleId: Parameters[2] + } >, 'mutationFn' > @@ -6340,7 +6703,11 @@ export function useUnassignProjectGroupRole( return useMutation< Awaited>, ApiError, - { projectId: string; groupId: string; roleId: string } + { + projectId: Parameters[0] + groupId: Parameters[1] + roleId: Parameters[2] + } >({ mutationFn: ({ projectId, groupId, roleId }) => unassignProjectGroupRole(projectId, groupId, roleId), @@ -6353,7 +6720,10 @@ export function useCreateProjectRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6361,7 +6731,10 @@ export function useCreateProjectRole( return useMutation< Awaited>, ApiError, - { projectId: string; body: Parameters[1] } + { + projectId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ projectId, body }) => createProjectRole(projectId, body), ...options, @@ -6373,7 +6746,11 @@ export function useUpdateProjectRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; roleId: string; body: Parameters[2] } + { + projectId: Parameters[0] + roleId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6381,7 +6758,11 @@ export function useUpdateProjectRole( return useMutation< Awaited>, ApiError, - { projectId: string; roleId: string; body: Parameters[2] } + { + projectId: Parameters[0] + roleId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ projectId, roleId, body }) => updateProjectRole(projectId, roleId, body), ...options, @@ -6393,7 +6774,10 @@ export function useDeleteProjectRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; roleId: string } + { + projectId: Parameters[0] + roleId: Parameters[1] + } >, 'mutationFn' > @@ -6401,7 +6785,10 @@ export function useDeleteProjectRole( return useMutation< Awaited>, ApiError, - { projectId: string; roleId: string } + { + projectId: Parameters[0] + roleId: Parameters[1] + } >({ mutationFn: ({ projectId, roleId }) => deleteProjectRole(projectId, roleId), ...options, @@ -6413,7 +6800,11 @@ export function useAssignProjectUserRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; userId: string; body: Parameters[2] } + { + projectId: Parameters[0] + userId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6421,7 +6812,11 @@ export function useAssignProjectUserRole( return useMutation< Awaited>, ApiError, - { projectId: string; userId: string; body: Parameters[2] } + { + projectId: Parameters[0] + userId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ projectId, userId, body }) => assignProjectUserRole(projectId, userId, body), ...options, @@ -6433,7 +6828,11 @@ export function useUnassignProjectUserRole( UseMutationOptions< Awaited>, ApiError, - { projectId: string; userId: string; roleId: string } + { + projectId: Parameters[0] + userId: Parameters[1] + roleId: Parameters[2] + } >, 'mutationFn' > @@ -6441,7 +6840,11 @@ export function useUnassignProjectUserRole( return useMutation< Awaited>, ApiError, - { projectId: string; userId: string; roleId: string } + { + projectId: Parameters[0] + userId: Parameters[1] + roleId: Parameters[2] + } >({ mutationFn: ({ projectId, userId, roleId }) => unassignProjectUserRole(projectId, userId, roleId), @@ -6474,7 +6877,10 @@ export function useAcceptRealtimeCall( UseMutationOptions< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6482,7 +6888,10 @@ export function useAcceptRealtimeCall( return useMutation< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ callId, body }) => acceptRealtimeCall(callId, body), ...options, @@ -6491,11 +6900,19 @@ export function useAcceptRealtimeCall( export function useHangupRealtimeCall( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (callId) => hangupRealtimeCall(callId), ...options, }) @@ -6506,7 +6923,10 @@ export function useReferRealtimeCall( UseMutationOptions< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6514,7 +6934,10 @@ export function useReferRealtimeCall( return useMutation< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ callId, body }) => referRealtimeCall(callId, body), ...options, @@ -6526,7 +6949,10 @@ export function useRejectRealtimeCall( UseMutationOptions< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6534,7 +6960,10 @@ export function useRejectRealtimeCall( return useMutation< Awaited>, ApiError, - { callId: string; body: Parameters[1] } + { + callId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ callId, body }) => rejectRealtimeCall(callId, body), ...options, @@ -6643,11 +7072,19 @@ export function useCreateResponse( export function useDeleteResponse( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (responseId) => deleteResponse(responseId), ...options, }) @@ -6655,11 +7092,19 @@ export function useDeleteResponse( export function useCancelResponse( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (responseId) => cancelResponse(responseId), ...options, }) @@ -6710,7 +7155,7 @@ export function useModifyThread( UseMutationOptions< Awaited>, ApiError, - { threadId: string; body: Parameters[1] } + { threadId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6718,7 +7163,7 @@ export function useModifyThread( return useMutation< Awaited>, ApiError, - { threadId: string; body: Parameters[1] } + { threadId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ threadId, body }) => modifyThread(threadId, body), ...options, @@ -6727,11 +7172,19 @@ export function useModifyThread( export function useDeleteThread( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (threadId) => deleteThread(threadId), ...options, }) @@ -6742,7 +7195,7 @@ export function useCreateMessage( UseMutationOptions< Awaited>, ApiError, - { threadId: string; body: Parameters[1] } + { threadId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6750,7 +7203,7 @@ export function useCreateMessage( return useMutation< Awaited>, ApiError, - { threadId: string; body: Parameters[1] } + { threadId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ threadId, body }) => createMessage(threadId, body), ...options, @@ -6762,7 +7215,11 @@ export function useModifyMessage( UseMutationOptions< Awaited>, ApiError, - { threadId: string; messageId: string; body: Parameters[2] } + { + threadId: Parameters[0] + messageId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6770,7 +7227,11 @@ export function useModifyMessage( return useMutation< Awaited>, ApiError, - { threadId: string; messageId: string; body: Parameters[2] } + { + threadId: Parameters[0] + messageId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ threadId, messageId, body }) => modifyMessage(threadId, messageId, body), ...options, @@ -6782,7 +7243,10 @@ export function useDeleteMessage( UseMutationOptions< Awaited>, ApiError, - { threadId: string; messageId: string } + { + threadId: Parameters[0] + messageId: Parameters[1] + } >, 'mutationFn' > @@ -6790,7 +7254,10 @@ export function useDeleteMessage( return useMutation< Awaited>, ApiError, - { threadId: string; messageId: string } + { + threadId: Parameters[0] + messageId: Parameters[1] + } >({ mutationFn: ({ threadId, messageId }) => deleteMessage(threadId, messageId), ...options, @@ -6803,7 +7270,7 @@ export function useCreateRun( Awaited>, ApiError, { - threadId: string + threadId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -6815,7 +7282,7 @@ export function useCreateRun( Awaited>, ApiError, { - threadId: string + threadId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -6830,7 +7297,11 @@ export function useModifyRun( UseMutationOptions< Awaited>, ApiError, - { threadId: string; runId: string; body: Parameters[2] } + { + threadId: Parameters[0] + runId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6838,7 +7309,11 @@ export function useModifyRun( return useMutation< Awaited>, ApiError, - { threadId: string; runId: string; body: Parameters[2] } + { + threadId: Parameters[0] + runId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ threadId, runId, body }) => modifyRun(threadId, runId, body), ...options, @@ -6850,7 +7325,7 @@ export function useCancelRun( UseMutationOptions< Awaited>, ApiError, - { threadId: string; runId: string } + { threadId: Parameters[0]; runId: Parameters[1] } >, 'mutationFn' > @@ -6858,7 +7333,7 @@ export function useCancelRun( return useMutation< Awaited>, ApiError, - { threadId: string; runId: string } + { threadId: Parameters[0]; runId: Parameters[1] } >({ mutationFn: ({ threadId, runId }) => cancelRun(threadId, runId), ...options, @@ -6870,7 +7345,11 @@ export function useSubmitToolOuputsToRun( UseMutationOptions< Awaited>, ApiError, - { threadId: string; runId: string; body: Parameters[2] } + { + threadId: Parameters[0] + runId: Parameters[1] + body: Parameters[2] + } >, 'mutationFn' > @@ -6878,7 +7357,11 @@ export function useSubmitToolOuputsToRun( return useMutation< Awaited>, ApiError, - { threadId: string; runId: string; body: Parameters[2] } + { + threadId: Parameters[0] + runId: Parameters[1] + body: Parameters[2] + } >({ mutationFn: ({ threadId, runId, body }) => submitToolOuputsToRun(threadId, runId, body), ...options, @@ -6907,11 +7390,19 @@ export function useCreateUpload( export function useCancelUpload( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (uploadId) => cancelUpload(uploadId), ...options, }) @@ -6922,7 +7413,7 @@ export function useCompleteUpload( UseMutationOptions< Awaited>, ApiError, - { uploadId: string; body: Parameters[1] } + { uploadId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6930,7 +7421,7 @@ export function useCompleteUpload( return useMutation< Awaited>, ApiError, - { uploadId: string; body: Parameters[1] } + { uploadId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ uploadId, body }) => completeUpload(uploadId, body), ...options, @@ -6942,7 +7433,7 @@ export function useAddUploadPart( UseMutationOptions< Awaited>, ApiError, - { uploadId: string; body: Parameters[1] } + { uploadId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -6950,7 +7441,7 @@ export function useAddUploadPart( return useMutation< Awaited>, ApiError, - { uploadId: string; body: Parameters[1] } + { uploadId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ uploadId, body }) => addUploadPart(uploadId, body), ...options, @@ -6982,7 +7473,10 @@ export function useModifyVectorStore( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -6990,7 +7484,10 @@ export function useModifyVectorStore( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, body }) => modifyVectorStore(vectorStoreId, body), ...options, @@ -6999,11 +7496,19 @@ export function useModifyVectorStore( export function useDeleteVectorStore( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (vectorStoreId) => deleteVectorStore(vectorStoreId), ...options, }) @@ -7014,7 +7519,10 @@ export function useCreateVectorStoreFileBatch( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7022,7 +7530,10 @@ export function useCreateVectorStoreFileBatch( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, body }) => createVectorStoreFileBatch(vectorStoreId, body), ...options, @@ -7034,7 +7545,10 @@ export function useCancelVectorStoreFileBatch( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; batchId: string } + { + vectorStoreId: Parameters[0] + batchId: Parameters[1] + } >, 'mutationFn' > @@ -7042,7 +7556,10 @@ export function useCancelVectorStoreFileBatch( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; batchId: string } + { + vectorStoreId: Parameters[0] + batchId: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, batchId }) => cancelVectorStoreFileBatch(vectorStoreId, batchId), ...options, @@ -7054,7 +7571,10 @@ export function useCreateVectorStoreFile( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7062,7 +7582,10 @@ export function useCreateVectorStoreFile( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, body }) => createVectorStoreFile(vectorStoreId, body), ...options, @@ -7075,8 +7598,8 @@ export function useUpdateVectorStoreFileAttributes( Awaited>, ApiError, { - vectorStoreId: string - fileId: string + vectorStoreId: Parameters[0] + fileId: Parameters[1] body: Parameters[2] } >, @@ -7087,8 +7610,8 @@ export function useUpdateVectorStoreFileAttributes( Awaited>, ApiError, { - vectorStoreId: string - fileId: string + vectorStoreId: Parameters[0] + fileId: Parameters[1] body: Parameters[2] } >({ @@ -7103,7 +7626,10 @@ export function useDeleteVectorStoreFile( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; fileId: string } + { + vectorStoreId: Parameters[0] + fileId: Parameters[1] + } >, 'mutationFn' > @@ -7111,7 +7637,10 @@ export function useDeleteVectorStoreFile( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; fileId: string } + { + vectorStoreId: Parameters[0] + fileId: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, fileId }) => deleteVectorStoreFile(vectorStoreId, fileId), ...options, @@ -7123,7 +7652,10 @@ export function useSearchVectorStore( UseMutationOptions< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7131,7 +7663,10 @@ export function useSearchVectorStore( return useMutation< Awaited>, ApiError, - { vectorStoreId: string; body: Parameters[1] } + { + vectorStoreId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ vectorStoreId, body }) => searchVectorStore(vectorStoreId, body), ...options, @@ -7163,7 +7698,10 @@ export function useUpdateConversation( UseMutationOptions< Awaited>, ApiError, - { conversationId: string; body: Parameters[1] } + { + conversationId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7171,7 +7709,10 @@ export function useUpdateConversation( return useMutation< Awaited>, ApiError, - { conversationId: string; body: Parameters[1] } + { + conversationId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ conversationId, body }) => updateConversation(conversationId, body), ...options, @@ -7180,11 +7721,19 @@ export function useUpdateConversation( export function useDeleteConversation( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (conversationId) => deleteConversation(conversationId), ...options, }) @@ -7272,11 +7821,19 @@ export function useCreateVideoExtend( export function useDeleteVideo( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (videoId) => deleteVideo(videoId), ...options, }) @@ -7287,7 +7844,10 @@ export function useCreateVideoRemix( UseMutationOptions< Awaited>, ApiError, - { videoId: string; body: Parameters[1] } + { + videoId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7295,7 +7855,10 @@ export function useCreateVideoRemix( return useMutation< Awaited>, ApiError, - { videoId: string; body: Parameters[1] } + { + videoId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ videoId, body }) => createVideoRemix(videoId, body), ...options, @@ -7367,7 +7930,10 @@ export function useUpdateSkillDefaultVersion( UseMutationOptions< Awaited>, ApiError, - { skillId: string; body: Parameters[1] } + { + skillId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7375,7 +7941,10 @@ export function useUpdateSkillDefaultVersion( return useMutation< Awaited>, ApiError, - { skillId: string; body: Parameters[1] } + { + skillId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ skillId, body }) => updateSkillDefaultVersion(skillId, body), ...options, @@ -7384,11 +7953,19 @@ export function useUpdateSkillDefaultVersion( export function useDeleteSkill( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (skillId) => deleteSkill(skillId), ...options, }) @@ -7399,7 +7976,10 @@ export function useCreateSkillVersion( UseMutationOptions< Awaited>, ApiError, - { skillId: string; body: Parameters[1] } + { + skillId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -7407,7 +7987,10 @@ export function useCreateSkillVersion( return useMutation< Awaited>, ApiError, - { skillId: string; body: Parameters[1] } + { + skillId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ skillId, body }) => createSkillVersion(skillId, body), ...options, @@ -7419,7 +8002,10 @@ export function useDeleteSkillVersion( UseMutationOptions< Awaited>, ApiError, - { skillId: string; version: string } + { + skillId: Parameters[0] + version: Parameters[1] + } >, 'mutationFn' > @@ -7427,7 +8013,10 @@ export function useDeleteSkillVersion( return useMutation< Awaited>, ApiError, - { skillId: string; version: string } + { + skillId: Parameters[0] + version: Parameters[1] + } >({ mutationFn: ({ skillId, version }) => deleteSkillVersion(skillId, version), ...options, @@ -7436,11 +8025,19 @@ export function useDeleteSkillVersion( export function useCancelChatSessionMethod( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (sessionId) => cancelChatSessionMethod(sessionId), ...options, }) @@ -7468,11 +8065,19 @@ export function useCreateChatSessionMethod( export function useDeleteThreadMethod( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (threadId) => deleteThreadMethod(threadId), ...options, }) diff --git a/examples/generated-rq/petstore-3.0/client.ts b/examples/generated-rq/petstore-3.0/client.ts index a960764..d438efb 100644 --- a/examples/generated-rq/petstore-3.0/client.ts +++ b/examples/generated-rq/petstore-3.0/client.ts @@ -128,13 +128,13 @@ export async function findPetsByTags( return res.json() } -export async function getPetById(petId: string, config?: Partial): Promise { +export async function getPetById(petId: number, config?: Partial): Promise { const res = await _request('GET', `/pet/${encodeURIComponent(petId)}`, {}, config) return res.json() } export async function updatePetWithForm( - petId: string, + petId: number, params?: { name?: string status?: string @@ -149,7 +149,7 @@ export async function updatePetWithForm( } export async function deletePet( - petId: string, + petId: number, params?: { api_key?: string }, @@ -162,7 +162,7 @@ export async function deletePet( } export async function uploadFile( - petId: string, + petId: number, params?: { additionalMetadata?: string }, @@ -193,14 +193,14 @@ export async function placeOrder(body: Order, config?: Partial): P } export async function getOrderById( - orderId: string, + orderId: number, config?: Partial ): Promise { const res = await _request('GET', `/store/order/${encodeURIComponent(orderId)}`, {}, config) return res.json() } -export async function deleteOrder(orderId: string, config?: Partial): Promise { +export async function deleteOrder(orderId: number, config?: Partial): Promise { await _request('DELETE', `/store/order/${encodeURIComponent(orderId)}`, {}, config) } diff --git a/examples/generated-rq/petstore-3.0/hooks.ts b/examples/generated-rq/petstore-3.0/hooks.ts index e893bf9..adbd2ca 100644 --- a/examples/generated-rq/petstore-3.0/hooks.ts +++ b/examples/generated-rq/petstore-3.0/hooks.ts @@ -38,20 +38,20 @@ export const petKeys = { ['pet', 'findPetsByStatus', params] as const, findPetsByTags: (params: Parameters[0]) => ['pet', 'findPetsByTags', params] as const, - detail: (petId: string) => ['pet', petId] as const, + detail: (petId: Parameters[0]) => ['pet', petId] as const, } export const storeKeys = { all: () => ['store'] as const, list: () => ['store', 'list'] as const, - detail: (orderId: string) => ['store', orderId] as const, + detail: (orderId: Parameters[0]) => ['store', orderId] as const, } export const userKeys = { all: () => ['user'] as const, loginUser: (params?: Parameters[0]) => ['user', 'loginUser', params] as const, logoutUser: () => ['user', 'logoutUser'] as const, - detail: (username: string) => ['user', username] as const, + detail: (username: Parameters[0]) => ['user', username] as const, } // ── Query options factories ────────────────────────────────── @@ -89,7 +89,7 @@ export function findPetsByTagsQueryOptions( } export function getPetByIdQueryOptions( - petId: string, + petId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -120,7 +120,7 @@ export function getInventoryQueryOptions( } export function getOrderByIdQueryOptions( - orderId: string, + orderId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -167,7 +167,7 @@ export function logoutUserQueryOptions( } export function getUserByNameQueryOptions( - username: string, + username: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -217,7 +217,7 @@ export function useFindPetsByTags( } export function useGetPetById( - petId: string | undefined | null, + petId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -249,7 +249,7 @@ export function useGetInventory( } export function useGetOrderById( - orderId: string | undefined | null, + orderId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -297,7 +297,7 @@ export function useLogoutUser( } export function useGetUserByName( - username: string | undefined | null, + username: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -352,7 +352,10 @@ export function useUpdatePetWithForm( UseMutationOptions< Awaited>, ApiError, - { petId: string; params: Parameters[1] } + { + petId: Parameters[0] + params: Parameters[1] + } >, 'mutationFn' > @@ -360,7 +363,10 @@ export function useUpdatePetWithForm( return useMutation< Awaited>, ApiError, - { petId: string; params: Parameters[1] } + { + petId: Parameters[0] + params: Parameters[1] + } >({ mutationFn: ({ petId, params }) => updatePetWithForm(petId, params), ...options, @@ -372,7 +378,7 @@ export function useDeletePet( UseMutationOptions< Awaited>, ApiError, - { petId: string; params: Parameters[1] } + { petId: Parameters[0]; params: Parameters[1] } >, 'mutationFn' > @@ -380,7 +386,7 @@ export function useDeletePet( return useMutation< Awaited>, ApiError, - { petId: string; params: Parameters[1] } + { petId: Parameters[0]; params: Parameters[1] } >({ mutationFn: ({ petId, params }) => deletePet(petId, params), ...options, @@ -393,7 +399,7 @@ export function useUploadFile( Awaited>, ApiError, { - petId: string + petId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -405,7 +411,7 @@ export function useUploadFile( Awaited>, ApiError, { - petId: string + petId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -437,11 +443,19 @@ export function usePlaceOrder( export function useDeleteOrder( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (orderId) => deleteOrder(orderId), ...options, }) @@ -492,7 +506,7 @@ export function useUpdateUser( UseMutationOptions< Awaited>, ApiError, - { username: string; body: Parameters[1] } + { username: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -500,7 +514,7 @@ export function useUpdateUser( return useMutation< Awaited>, ApiError, - { username: string; body: Parameters[1] } + { username: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ username, body }) => updateUser(username, body), ...options, @@ -509,11 +523,19 @@ export function useUpdateUser( export function useDeleteUser( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (username) => deleteUser(username), ...options, }) diff --git a/examples/generated-rq/redocly-museum/hooks.ts b/examples/generated-rq/redocly-museum/hooks.ts index fbe1e43..d8f0ebd 100644 --- a/examples/generated-rq/redocly-museum/hooks.ts +++ b/examples/generated-rq/redocly-museum/hooks.ts @@ -35,12 +35,12 @@ export const specialEventKeys = { all: () => ['special-events'] as const, list: (params?: Parameters[0]) => ['special-events', 'list', params] as const, - detail: (eventId: string) => ['special-events', eventId] as const, + detail: (eventId: Parameters[0]) => ['special-events', eventId] as const, } export const ticketKeys = { all: () => ['tickets'] as const, - detail: (ticketId: string) => ['tickets', ticketId] as const, + detail: (ticketId: Parameters[0]) => ['tickets', ticketId] as const, } // ── Query options factories ────────────────────────────────── @@ -78,7 +78,7 @@ export function listSpecialEventsQueryOptions( } export function getSpecialEventQueryOptions( - eventId: string, + eventId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -94,7 +94,7 @@ export function getSpecialEventQueryOptions( } export function getTicketCodeQueryOptions( - ticketId: string, + ticketId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -206,7 +206,7 @@ export function useListSpecialEventsInfinite( } export function useGetSpecialEvent( - eventId: string | undefined | null, + eventId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -223,7 +223,7 @@ export function useGetSpecialEvent( } export function useGetTicketCode( - ticketId: string | undefined | null, + ticketId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -266,7 +266,10 @@ export function useUpdateSpecialEvent( UseMutationOptions< Awaited>, ApiError, - { eventId: string; body: Parameters[1] } + { + eventId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -274,7 +277,10 @@ export function useUpdateSpecialEvent( return useMutation< Awaited>, ApiError, - { eventId: string; body: Parameters[1] } + { + eventId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ eventId, body }) => updateSpecialEvent(eventId, body), ...options, @@ -283,11 +289,19 @@ export function useUpdateSpecialEvent( export function useDeleteSpecialEvent( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (eventId) => deleteSpecialEvent(eventId), ...options, }) diff --git a/examples/generated-rq/resend/hooks.ts b/examples/generated-rq/resend/hooks.ts index 8d76210..2f2d2d4 100644 --- a/examples/generated-rq/resend/hooks.ts +++ b/examples/generated-rq/resend/hooks.ts @@ -105,20 +105,26 @@ export const emailKeys = { getEmails: (params?: Parameters[0]) => ['emails', 'getEmails', params] as const, getEmailsReceiving: (params?: Parameters[0]) => ['emails', 'getEmailsReceiving', params] as const, - getEmailsByEmailId: (emailId: string) => ['emails', 'getEmailsByEmailId', emailId] as const, + getEmailsByEmailId: (emailId: Parameters[0]) => + ['emails', 'getEmailsByEmailId', emailId] as const, getEmailsByEmailIdAttachments: ( - emailId: string, + emailId: Parameters[0], params?: Parameters[1] ) => ['emails', 'getEmailsByEmailIdAttachments', emailId, params] as const, - getEmailsByEmailIdAttachmentsByAttachmentId: (emailId: string, attachmentId: string) => - ['emails', 'getEmailsByEmailIdAttachmentsByAttachmentId', emailId, attachmentId] as const, - getEmailsReceivingByEmailId: (emailId: string) => + getEmailsByEmailIdAttachmentsByAttachmentId: ( + emailId: Parameters[0], + attachmentId: Parameters[1] + ) => ['emails', 'getEmailsByEmailIdAttachmentsByAttachmentId', emailId, attachmentId] as const, + getEmailsReceivingByEmailId: (emailId: Parameters[0]) => ['emails', 'getEmailsReceivingByEmailId', emailId] as const, getEmailsReceivingByEmailIdAttachments: ( - emailId: string, + emailId: Parameters[0], params?: Parameters[1] ) => ['emails', 'getEmailsReceivingByEmailIdAttachments', emailId, params] as const, - getEmailsReceivingByEmailIdAttachmentsByAttachmentId: (emailId: string, attachmentId: string) => + getEmailsReceivingByEmailIdAttachmentsByAttachmentId: ( + emailId: Parameters[0], + attachmentId: Parameters[1] + ) => [ 'emails', 'getEmailsReceivingByEmailIdAttachmentsByAttachmentId', @@ -130,7 +136,7 @@ export const emailKeys = { export const domainKeys = { all: () => ['domains'] as const, list: (params?: Parameters[0]) => ['domains', 'list', params] as const, - detail: (domainId: string) => ['domains', domainId] as const, + detail: (domainId: Parameters[0]) => ['domains', domainId] as const, } export const apiKeyKeys = { @@ -141,25 +147,26 @@ export const apiKeyKeys = { export const templateKeys = { all: () => ['templates'] as const, list: (params?: Parameters[0]) => ['templates', 'list', params] as const, - detail: (id: string) => ['templates', id] as const, + detail: (id: Parameters[0]) => ['templates', id] as const, } export const audienceKeys = { all: () => ['audiences'] as const, list: () => ['audiences', 'list'] as const, - detail: (id: string) => ['audiences', id] as const, + detail: (id: Parameters[0]) => ['audiences', id] as const, } export const contactKeys = { all: () => ['contacts'] as const, list: (params?: Parameters[0]) => ['contacts', 'list', params] as const, - getContactsById: (id: string) => ['contacts', 'getContactsById', id] as const, + getContactsById: (id: Parameters[0]) => + ['contacts', 'getContactsById', id] as const, getContactsByContactIdSegments: ( - contactId: string, + contactId: Parameters[0], params?: Parameters[1] ) => ['contacts', 'getContactsByContactIdSegments', contactId, params] as const, getContactsByContactIdTopics: ( - contactId: string, + contactId: Parameters[0], params?: Parameters[1] ) => ['contacts', 'getContactsByContactIdTopics', contactId, params] as const, } @@ -167,57 +174,63 @@ export const contactKeys = { export const broadcastKeys = { all: () => ['broadcasts'] as const, list: (params?: Parameters[0]) => ['broadcasts', 'list', params] as const, - detail: (id: string) => ['broadcasts', id] as const, + detail: (id: Parameters[0]) => ['broadcasts', id] as const, } export const webhookKeys = { all: () => ['webhooks'] as const, list: (params?: Parameters[0]) => ['webhooks', 'list', params] as const, - detail: (webhookId: string) => ['webhooks', webhookId] as const, + detail: (webhookId: Parameters[0]) => + ['webhooks', webhookId] as const, } export const segmentKeys = { all: () => ['segments'] as const, list: (params?: Parameters[0]) => ['segments', 'list', params] as const, - detail: (id: string) => ['segments', id] as const, + detail: (id: Parameters[0]) => ['segments', id] as const, } export const topicKeys = { all: () => ['topics'] as const, list: (params?: Parameters[0]) => ['topics', 'list', params] as const, - detail: (id: string) => ['topics', id] as const, + detail: (id: Parameters[0]) => ['topics', id] as const, } export const contactPropertyKeys = { all: () => ['contact-properties'] as const, list: (params?: Parameters[0]) => ['contact-properties', 'list', params] as const, - detail: (id: string) => ['contact-properties', id] as const, + detail: (id: Parameters[0]) => + ['contact-properties', id] as const, } export const logKeys = { all: () => ['logs'] as const, list: (params?: Parameters[0]) => ['logs', 'list', params] as const, - detail: (logId: string) => ['logs', logId] as const, + detail: (logId: Parameters[0]) => ['logs', logId] as const, } export const automationKeys = { all: () => ['automations'] as const, list: (params?: Parameters[0]) => ['automations', 'list', params] as const, - getAutomationsByAutomationId: (automationId: string) => - ['automations', 'getAutomationsByAutomationId', automationId] as const, + getAutomationsByAutomationId: ( + automationId: Parameters[0] + ) => ['automations', 'getAutomationsByAutomationId', automationId] as const, getAutomationsByAutomationIdRuns: ( - automationId: string, + automationId: Parameters[0], params?: Parameters[1] ) => ['automations', 'getAutomationsByAutomationIdRuns', automationId, params] as const, - getAutomationsByAutomationIdRunsByRunId: (automationId: string, runId: string) => - ['automations', 'getAutomationsByAutomationIdRunsByRunId', automationId, runId] as const, + getAutomationsByAutomationIdRunsByRunId: ( + automationId: Parameters[0], + runId: Parameters[1] + ) => ['automations', 'getAutomationsByAutomationIdRunsByRunId', automationId, runId] as const, } export const eventKeys = { all: () => ['events'] as const, list: (params?: Parameters[0]) => ['events', 'list', params] as const, - detail: (identifier: string) => ['events', identifier] as const, + detail: (identifier: Parameters[0]) => + ['events', identifier] as const, } // ── Query options factories ────────────────────────────────── @@ -239,7 +252,7 @@ export function getEmailsQueryOptions( } export function getEmailsByEmailIdQueryOptions( - emailId: string, + emailId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -255,7 +268,7 @@ export function getEmailsByEmailIdQueryOptions( } export function getEmailsByEmailIdAttachmentsQueryOptions( - emailId: string, + emailId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -272,8 +285,8 @@ export function getEmailsByEmailIdAttachmentsQueryOptions( } export function getEmailsByEmailIdAttachmentsByAttachmentIdQueryOptions( - emailId: string, - attachmentId: string, + emailId: Parameters[0], + attachmentId: Parameters[1], options?: Omit< UseQueryOptions< Awaited>, @@ -311,7 +324,7 @@ export function getEmailsReceivingQueryOptions( } export function getEmailsReceivingByEmailIdQueryOptions( - emailId: string, + emailId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -327,7 +340,7 @@ export function getEmailsReceivingByEmailIdQueryOptions( } export function getEmailsReceivingByEmailIdAttachmentsQueryOptions( - emailId: string, + emailId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -346,8 +359,8 @@ export function getEmailsReceivingByEmailIdAttachmentsQueryOptions( } export function getEmailsReceivingByEmailIdAttachmentsByAttachmentIdQueryOptions( - emailId: string, - attachmentId: string, + emailId: Parameters[0], + attachmentId: Parameters[1], options?: Omit< UseQueryOptions< Awaited>, @@ -385,7 +398,7 @@ export function getDomainsQueryOptions( } export function getDomainsByDomainIdQueryOptions( - domainId: string, + domainId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -433,7 +446,7 @@ export function getTemplatesQueryOptions( } export function getTemplatesByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -466,7 +479,7 @@ export function getAudiencesQueryOptions( /** @deprecated */ export function getAudiencesByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -498,7 +511,7 @@ export function getContactsQueryOptions( } export function getContactsByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -530,7 +543,7 @@ export function getBroadcastsQueryOptions( } export function getBroadcastsByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -562,7 +575,7 @@ export function getWebhooksQueryOptions( } export function getWebhooksByWebhookIdQueryOptions( - webhookId: string, + webhookId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -594,7 +607,7 @@ export function getSegmentsQueryOptions( } export function getSegmentsByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -626,7 +639,7 @@ export function getTopicsQueryOptions( } export function getTopicsByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -658,7 +671,7 @@ export function getContactPropertiesQueryOptions( } export function getContactPropertiesByIdQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -674,7 +687,7 @@ export function getContactPropertiesByIdQueryOptions( } export function getContactsByContactIdSegmentsQueryOptions( - contactId: string, + contactId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -691,7 +704,7 @@ export function getContactsByContactIdSegmentsQueryOptions( } export function getContactsByContactIdTopicsQueryOptions( - contactId: string, + contactId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -724,7 +737,7 @@ export function getLogsQueryOptions( } export function getLogsByLogIdQueryOptions( - logId: string, + logId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -756,7 +769,7 @@ export function getAutomationsQueryOptions( } export function getAutomationsByAutomationIdQueryOptions( - automationId: string, + automationId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -772,7 +785,7 @@ export function getAutomationsByAutomationIdQueryOptions( } export function getAutomationsByAutomationIdRunsQueryOptions( - automationId: string, + automationId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -789,8 +802,8 @@ export function getAutomationsByAutomationIdRunsQueryOptions( } export function getAutomationsByAutomationIdRunsByRunIdQueryOptions( - automationId: string, - runId: string, + automationId: Parameters[0], + runId: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -825,7 +838,7 @@ export function getEventsQueryOptions( } export function getEventsByIdentifierQueryOptions( - identifier: string, + identifier: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -890,7 +903,7 @@ export function useGetEmailsInfinite( } export function useGetEmailsByEmailId( - emailId: string | undefined | null, + emailId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -907,7 +920,7 @@ export function useGetEmailsByEmailId( } export function useGetEmailsByEmailIdAttachments( - emailId: string | undefined | null, + emailId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -925,8 +938,11 @@ export function useGetEmailsByEmailIdAttachments( } export function useGetEmailsByEmailIdAttachmentsByAttachmentId( - emailId: string | undefined | null, - attachmentId: string | undefined | null, + emailId: Parameters[0] | undefined | null, + attachmentId: + | Parameters[1] + | undefined + | null, options?: Omit< UseQueryOptions< Awaited>, @@ -996,7 +1012,7 @@ export function useGetEmailsReceivingInfinite( } export function useGetEmailsReceivingByEmailId( - emailId: string | undefined | null, + emailId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1013,7 +1029,7 @@ export function useGetEmailsReceivingByEmailId( } export function useGetEmailsReceivingByEmailIdAttachments( - emailId: string | undefined | null, + emailId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1031,8 +1047,14 @@ export function useGetEmailsReceivingByEmailIdAttachments( } export function useGetEmailsReceivingByEmailIdAttachmentsByAttachmentId( - emailId: string | undefined | null, - attachmentId: string | undefined | null, + emailId: + | Parameters[0] + | undefined + | null, + attachmentId: + | Parameters[1] + | undefined + | null, options?: Omit< UseQueryOptions< Awaited>, @@ -1105,7 +1127,7 @@ export function useGetDomainsInfinite( } export function useGetDomainsByDomainId( - domainId: string | undefined | null, + domainId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1216,7 +1238,7 @@ export function useGetTemplatesInfinite( } export function useGetTemplatesById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1250,7 +1272,7 @@ export function useGetAudiences( /** @deprecated */ export function useGetAudiencesById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1314,7 +1336,7 @@ export function useGetContactsInfinite( } export function useGetContactsById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1378,7 +1400,7 @@ export function useGetBroadcastsInfinite( } export function useGetBroadcastsById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1442,7 +1464,7 @@ export function useGetWebhooksInfinite( } export function useGetWebhooksByWebhookId( - webhookId: string | undefined | null, + webhookId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1506,7 +1528,7 @@ export function useGetSegmentsInfinite( } export function useGetSegmentsById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1570,7 +1592,7 @@ export function useGetTopicsInfinite( } export function useGetTopicsById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1634,7 +1656,7 @@ export function useGetContactPropertiesInfinite( } export function useGetContactPropertiesById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1651,7 +1673,7 @@ export function useGetContactPropertiesById( } export function useGetContactsByContactIdSegments( - contactId: string | undefined | null, + contactId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1669,7 +1691,7 @@ export function useGetContactsByContactIdSegments( } export function useGetContactsByContactIdTopics( - contactId: string | undefined | null, + contactId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1734,7 +1756,7 @@ export function useGetLogsInfinite( } export function useGetLogsByLogId( - logId: string | undefined | null, + logId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1798,7 +1820,7 @@ export function useGetAutomationsInfinite( } export function useGetAutomationsByAutomationId( - automationId: string | undefined | null, + automationId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1815,7 +1837,7 @@ export function useGetAutomationsByAutomationId( } export function useGetAutomationsByAutomationIdRuns( - automationId: string | undefined | null, + automationId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1833,8 +1855,8 @@ export function useGetAutomationsByAutomationIdRuns( } export function useGetAutomationsByAutomationIdRunsByRunId( - automationId: string | undefined | null, - runId: string | undefined | null, + automationId: Parameters[0] | undefined | null, + runId: Parameters[1] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1898,7 +1920,7 @@ export function useGetEventsInfinite( } export function useGetEventsByIdentifier( - identifier: string | undefined | null, + identifier: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1938,11 +1960,19 @@ export function useCreateEmails( export function usePatchEmailsByEmailId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (emailId) => patchEmailsByEmailId(emailId), ...options, }) @@ -1950,11 +1980,19 @@ export function usePatchEmailsByEmailId( export function useCreateEmailsByEmailIdCancel( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (emailId) => createEmailsByEmailIdCancel(emailId), ...options, }) @@ -2011,7 +2049,10 @@ export function usePatchDomainsByDomainId( UseMutationOptions< Awaited>, ApiError, - { domainId: string; body: Parameters[1] } + { + domainId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2019,7 +2060,10 @@ export function usePatchDomainsByDomainId( return useMutation< Awaited>, ApiError, - { domainId: string; body: Parameters[1] } + { + domainId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ domainId, body }) => patchDomainsByDomainId(domainId, body), ...options, @@ -2028,11 +2072,19 @@ export function usePatchDomainsByDomainId( export function useDeleteDomainsByDomainId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (domainId) => deleteDomainsByDomainId(domainId), ...options, }) @@ -2040,11 +2092,19 @@ export function useDeleteDomainsByDomainId( export function useCreateDomainsByDomainIdVerify( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (domainId) => createDomainsByDomainIdVerify(domainId), ...options, }) @@ -2072,11 +2132,19 @@ export function useCreateApiKeys( export function useDeleteApiKeysByApiKeyId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (apiKeyId) => deleteApiKeysByApiKeyId(apiKeyId), ...options, }) @@ -2107,7 +2175,10 @@ export function usePatchTemplatesById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2115,7 +2186,7 @@ export function usePatchTemplatesById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => patchTemplatesById(id, body), ...options, @@ -2124,11 +2195,19 @@ export function usePatchTemplatesById( export function useDeleteTemplatesById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteTemplatesById(id), ...options, }) @@ -2136,11 +2215,19 @@ export function useDeleteTemplatesById( export function useCreateTemplatesByIdPublish( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => createTemplatesByIdPublish(id), ...options, }) @@ -2148,11 +2235,19 @@ export function useCreateTemplatesByIdPublish( export function useCreateTemplatesByIdDuplicate( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => createTemplatesByIdDuplicate(id), ...options, }) @@ -2182,11 +2277,19 @@ export function useCreateAudiences( /** @deprecated */ export function useDeleteAudiencesById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteAudiencesById(id), ...options, }) @@ -2217,7 +2320,7 @@ export function usePatchContactsById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2225,7 +2328,7 @@ export function usePatchContactsById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => patchContactsById(id, body), ...options, @@ -2234,11 +2337,19 @@ export function usePatchContactsById( export function useDeleteContactsById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteContactsById(id), ...options, }) @@ -2269,7 +2380,10 @@ export function usePatchBroadcastsById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2277,7 +2391,10 @@ export function usePatchBroadcastsById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => patchBroadcastsById(id, body), ...options, @@ -2286,11 +2403,19 @@ export function usePatchBroadcastsById( export function useDeleteBroadcastsById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteBroadcastsById(id), ...options, }) @@ -2301,7 +2426,10 @@ export function useCreateBroadcastsByIdSend( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2309,7 +2437,10 @@ export function useCreateBroadcastsByIdSend( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => createBroadcastsByIdSend(id, body), ...options, @@ -2341,7 +2472,10 @@ export function usePatchWebhooksByWebhookId( UseMutationOptions< Awaited>, ApiError, - { webhookId: string; body: Parameters[1] } + { + webhookId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2349,7 +2483,10 @@ export function usePatchWebhooksByWebhookId( return useMutation< Awaited>, ApiError, - { webhookId: string; body: Parameters[1] } + { + webhookId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ webhookId, body }) => patchWebhooksByWebhookId(webhookId, body), ...options, @@ -2358,11 +2495,19 @@ export function usePatchWebhooksByWebhookId( export function useDeleteWebhooksByWebhookId( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (webhookId) => deleteWebhooksByWebhookId(webhookId), ...options, }) @@ -2390,11 +2535,19 @@ export function useCreateSegments( export function useDeleteSegmentsById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteSegmentsById(id), ...options, }) @@ -2425,7 +2578,7 @@ export function usePatchTopicsById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2433,7 +2586,7 @@ export function usePatchTopicsById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => patchTopicsById(id, body), ...options, @@ -2442,11 +2595,19 @@ export function usePatchTopicsById( export function useDeleteTopicsById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteTopicsById(id), ...options, }) @@ -2477,7 +2638,10 @@ export function usePatchContactPropertiesById( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2485,7 +2649,10 @@ export function usePatchContactPropertiesById( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => patchContactPropertiesById(id, body), ...options, @@ -2494,11 +2661,19 @@ export function usePatchContactPropertiesById( export function useDeleteContactPropertiesById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteContactPropertiesById(id), ...options, }) @@ -2509,7 +2684,10 @@ export function useCreateContactsByContactIdSegmentsBySegmentId( UseMutationOptions< Awaited>, ApiError, - { contactId: string; segmentId: string } + { + contactId: Parameters[0] + segmentId: Parameters[1] + } >, 'mutationFn' > @@ -2517,7 +2695,10 @@ export function useCreateContactsByContactIdSegmentsBySegmentId( return useMutation< Awaited>, ApiError, - { contactId: string; segmentId: string } + { + contactId: Parameters[0] + segmentId: Parameters[1] + } >({ mutationFn: ({ contactId, segmentId }) => createContactsByContactIdSegmentsBySegmentId(contactId, segmentId), @@ -2530,7 +2711,10 @@ export function useDeleteContactsByContactIdSegmentsBySegmentId( UseMutationOptions< Awaited>, ApiError, - { contactId: string; segmentId: string } + { + contactId: Parameters[0] + segmentId: Parameters[1] + } >, 'mutationFn' > @@ -2538,7 +2722,10 @@ export function useDeleteContactsByContactIdSegmentsBySegmentId( return useMutation< Awaited>, ApiError, - { contactId: string; segmentId: string } + { + contactId: Parameters[0] + segmentId: Parameters[1] + } >({ mutationFn: ({ contactId, segmentId }) => deleteContactsByContactIdSegmentsBySegmentId(contactId, segmentId), @@ -2551,7 +2738,10 @@ export function usePatchContactsByContactIdTopics( UseMutationOptions< Awaited>, ApiError, - { contactId: string; body: Parameters[1] } + { + contactId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2559,7 +2749,10 @@ export function usePatchContactsByContactIdTopics( return useMutation< Awaited>, ApiError, - { contactId: string; body: Parameters[1] } + { + contactId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ contactId, body }) => patchContactsByContactIdTopics(contactId, body), ...options, @@ -2591,7 +2784,10 @@ export function usePatchAutomationsByAutomationId( UseMutationOptions< Awaited>, ApiError, - { automationId: string; body: Parameters[1] } + { + automationId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2599,7 +2795,10 @@ export function usePatchAutomationsByAutomationId( return useMutation< Awaited>, ApiError, - { automationId: string; body: Parameters[1] } + { + automationId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ automationId, body }) => patchAutomationsByAutomationId(automationId, body), ...options, @@ -2611,17 +2810,19 @@ export function useDeleteAutomationsByAutomationId( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > ) { - return useMutation>, ApiError, string>( - { - mutationFn: (automationId) => deleteAutomationsByAutomationId(automationId), - ...options, - } - ) + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ + mutationFn: (automationId) => deleteAutomationsByAutomationId(automationId), + ...options, + }) } export function useCreateAutomationsByAutomationIdStop( @@ -2629,7 +2830,7 @@ export function useCreateAutomationsByAutomationIdStop( UseMutationOptions< Awaited>, ApiError, - string + Parameters[0] >, 'mutationFn' > @@ -2637,7 +2838,7 @@ export function useCreateAutomationsByAutomationIdStop( return useMutation< Awaited>, ApiError, - string + Parameters[0] >({ mutationFn: (automationId) => createAutomationsByAutomationIdStop(automationId), ...options, @@ -2689,7 +2890,10 @@ export function usePatchEventsByIdentifier( UseMutationOptions< Awaited>, ApiError, - { identifier: string; body: Parameters[1] } + { + identifier: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2697,7 +2901,10 @@ export function usePatchEventsByIdentifier( return useMutation< Awaited>, ApiError, - { identifier: string; body: Parameters[1] } + { + identifier: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ identifier, body }) => patchEventsByIdentifier(identifier, body), ...options, @@ -2706,11 +2913,19 @@ export function usePatchEventsByIdentifier( export function useDeleteEventsByIdentifier( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (identifier) => deleteEventsByIdentifier(identifier), ...options, }) diff --git a/examples/generated-rq/spotify/client.ts b/examples/generated-rq/spotify/client.ts index 47f25e3..3233c2e 100644 --- a/examples/generated-rq/spotify/client.ts +++ b/examples/generated-rq/spotify/client.ts @@ -466,7 +466,7 @@ export async function getPlaylist( export async function changePlaylistDetails( playlistId: string, - body: Record, + body: { name?: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('PUT', `/playlists/${encodeURIComponent(playlistId)}`, { body }, config) @@ -506,7 +506,7 @@ export async function getPlaylistsTracks( */ export async function addTracksToPlaylist( playlistId: string, - body: Record, + body: { uris?: string[]; position?: number }, params?: { position?: number uris?: string @@ -529,7 +529,13 @@ export async function addTracksToPlaylist( */ export async function reorderOrReplacePlaylistsTracks( playlistId: string, - body: Record, + body: { + uris?: string[] + range_start?: number + insert_before?: number + range_length?: number + snapshot_id?: string + }, params?: { uris?: string }, @@ -550,7 +556,7 @@ export async function reorderOrReplacePlaylistsTracks( */ export async function removeTracksPlaylist( playlistId: string, - body: Record, + body: { tracks: { uri?: string }[]; snapshot_id?: string }, config?: Partial ): Promise { await _request('DELETE', `/playlists/${encodeURIComponent(playlistId)}/tracks`, { body }, config) @@ -584,7 +590,7 @@ export async function getPlaylistsItems( export async function addItemsToPlaylist( playlistId: string, - body: Record, + body: { uris?: string[]; position?: number }, params?: { position?: number uris?: string @@ -604,7 +610,13 @@ export async function addItemsToPlaylist( export async function reorderOrReplacePlaylistsItems( playlistId: string, - body: Record, + body: { + uris?: string[] + range_start?: number + insert_before?: number + range_length?: number + snapshot_id?: string + }, params?: { uris?: string }, @@ -622,7 +634,7 @@ export async function reorderOrReplacePlaylistsItems( export async function removeItemsPlaylist( playlistId: string, - body: Record, + body: { items: { uri?: string }[]; snapshot_id?: string }, config?: Partial ): Promise { await _request('DELETE', `/playlists/${encodeURIComponent(playlistId)}/items`, { body }, config) @@ -642,7 +654,7 @@ export async function getAListOfCurrentUsersPlaylists( } export async function createPlaylist( - body: Record, + body: { name: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('POST', '/me/playlists', { body }, config) @@ -709,7 +721,7 @@ export async function getUsersSavedAlbums( * @deprecated */ export async function saveAlbumsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -724,7 +736,7 @@ export async function saveAlbumsUser( * @deprecated */ export async function removeAlbumsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -768,7 +780,7 @@ export async function getUsersSavedTracks( * @deprecated */ export async function saveTracksUser( - body: Record, + body: { ids: string[]; timestamped_ids?: { id: string; added_at: string }[] }, config?: Partial ): Promise { await _request('PUT', '/me/tracks', { body }, config) @@ -778,7 +790,7 @@ export async function saveTracksUser( * @deprecated */ export async function removeTracksUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -822,7 +834,7 @@ export async function getUsersSavedEpisodes( * @deprecated */ export async function saveEpisodesUser( - body: Record, + body: { ids: string[] }, params: { ids: string }, @@ -837,7 +849,7 @@ export async function saveEpisodesUser( * @deprecated */ export async function removeEpisodesUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -879,7 +891,7 @@ export async function getUsersSavedShows( * @deprecated */ export async function saveShowsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -894,7 +906,7 @@ export async function saveShowsUser( * @deprecated */ export async function removeShowsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string market?: string @@ -953,7 +965,7 @@ export async function getListUsersPlaylists( */ export async function createPlaylistForUser( userId: string, - body: Record, + body: { name: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('POST', `/users/${encodeURIComponent(userId)}/playlists`, { body }, config) @@ -964,7 +976,7 @@ export async function createPlaylistForUser( */ export async function followPlaylist( playlistId: string, - body: Record, + body: { public?: boolean }, config?: Partial ): Promise { await _request('PUT', `/playlists/${encodeURIComponent(playlistId)}/followers`, { body }, config) @@ -1107,7 +1119,7 @@ export async function getFollowed( * @deprecated */ export async function followArtistsUsers( - body: Record, + body: { ids: string[] }, params: { type: 'artist' | 'user' ids: string @@ -1124,7 +1136,7 @@ export async function followArtistsUsers( * @deprecated */ export async function unfollowArtistsUsers( - body: Record, + body: { ids?: string[] }, params: { type: 'artist' | 'user' ids: string @@ -1353,7 +1365,7 @@ export async function getInformationAboutTheUsersCurrentPlayback( } export async function transferAUsersPlayback( - body: Record, + body: { device_ids: string[]; play?: boolean }, config?: Partial ): Promise { await _request('PUT', '/me/player', { body }, config) @@ -1378,7 +1390,12 @@ export async function getTheUsersCurrentlyPlayingTrack( } export async function startAUsersPlayback( - body: Record, + body: { + context_uri?: string + uris?: string[] + offset?: Record + position_ms?: number + }, params?: { deviceId?: string }, diff --git a/examples/generated-rq/spotify/hooks.ts b/examples/generated-rq/spotify/hooks.ts index bfedbca..d6c5ebd 100644 --- a/examples/generated-rq/spotify/hooks.ts +++ b/examples/generated-rq/spotify/hooks.ts @@ -117,38 +117,46 @@ import { export const albumKeys = { all: () => ['albums'] as const, list: (params: Parameters[0]) => ['albums', 'list', params] as const, - getAnAlbum: (id: string, params?: Parameters[1]) => + getAnAlbum: (id: Parameters[0], params?: Parameters[1]) => ['albums', 'getAnAlbum', id, params] as const, - getAnAlbumsTracks: (id: string, params?: Parameters[1]) => - ['albums', 'getAnAlbumsTracks', id, params] as const, + getAnAlbumsTracks: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['albums', 'getAnAlbumsTracks', id, params] as const, } export const artistKeys = { all: () => ['artists'] as const, list: (params: Parameters[0]) => ['artists', 'list', params] as const, - getAnArtist: (id: string) => ['artists', 'getAnArtist', id] as const, - getAnArtistsAlbums: (id: string, params?: Parameters[1]) => - ['artists', 'getAnArtistsAlbums', id, params] as const, - getAnArtistsTopTracks: (id: string, params?: Parameters[1]) => - ['artists', 'getAnArtistsTopTracks', id, params] as const, - getAnArtistsRelatedArtists: (id: string) => + getAnArtist: (id: Parameters[0]) => ['artists', 'getAnArtist', id] as const, + getAnArtistsAlbums: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['artists', 'getAnArtistsAlbums', id, params] as const, + getAnArtistsTopTracks: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['artists', 'getAnArtistsTopTracks', id, params] as const, + getAnArtistsRelatedArtists: (id: Parameters[0]) => ['artists', 'getAnArtistsRelatedArtists', id] as const, } export const showKeys = { all: () => ['shows'] as const, list: (params: Parameters[0]) => ['shows', 'list', params] as const, - getAShow: (id: string, params?: Parameters[1]) => + getAShow: (id: Parameters[0], params?: Parameters[1]) => ['shows', 'getAShow', id, params] as const, - getAShowsEpisodes: (id: string, params?: Parameters[1]) => - ['shows', 'getAShowsEpisodes', id, params] as const, + getAShowsEpisodes: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['shows', 'getAShowsEpisodes', id, params] as const, } export const episodeKeys = { all: () => ['episodes'] as const, list: (params: Parameters[0]) => ['episodes', 'list', params] as const, - detail: (id: string, params?: Parameters[1]) => + detail: (id: Parameters[0], params?: Parameters[1]) => ['episodes', id, params] as const, } @@ -156,10 +164,14 @@ export const audiobookKeys = { all: () => ['audiobooks'] as const, list: (params: Parameters[0]) => ['audiobooks', 'list', params] as const, - getAnAudiobook: (id: string, params?: Parameters[1]) => - ['audiobooks', 'getAnAudiobook', id, params] as const, - getAudiobookChapters: (id: string, params?: Parameters[1]) => - ['audiobooks', 'getAudiobookChapters', id, params] as const, + getAnAudiobook: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['audiobooks', 'getAnAudiobook', id, params] as const, + getAudiobookChapters: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['audiobooks', 'getAudiobookChapters', id, params] as const, } export const meKeys = { @@ -213,14 +225,15 @@ export const meKeys = { export const chapterKeys = { all: () => ['chapters'] as const, list: (params: Parameters[0]) => ['chapters', 'list', params] as const, - detail: (id: string, params?: Parameters[1]) => + detail: (id: Parameters[0], params?: Parameters[1]) => ['chapters', id, params] as const, } export const trackKeys = { all: () => ['tracks'] as const, list: (params: Parameters[0]) => ['tracks', 'list', params] as const, - detail: (id: string, params?: Parameters[1]) => ['tracks', id, params] as const, + detail: (id: Parameters[0], params?: Parameters[1]) => + ['tracks', id, params] as const, } export const searchKeys = { @@ -230,24 +243,34 @@ export const searchKeys = { export const playlistKeys = { all: () => ['playlists'] as const, - getPlaylist: (playlistId: string, params?: Parameters[1]) => - ['playlists', 'getPlaylist', playlistId, params] as const, - getPlaylistsTracks: (playlistId: string, params?: Parameters[1]) => - ['playlists', 'getPlaylistsTracks', playlistId, params] as const, - getPlaylistsItems: (playlistId: string, params?: Parameters[1]) => - ['playlists', 'getPlaylistsItems', playlistId, params] as const, - getPlaylistCover: (playlistId: string) => ['playlists', 'getPlaylistCover', playlistId] as const, + getPlaylist: ( + playlistId: Parameters[0], + params?: Parameters[1] + ) => ['playlists', 'getPlaylist', playlistId, params] as const, + getPlaylistsTracks: ( + playlistId: Parameters[0], + params?: Parameters[1] + ) => ['playlists', 'getPlaylistsTracks', playlistId, params] as const, + getPlaylistsItems: ( + playlistId: Parameters[0], + params?: Parameters[1] + ) => ['playlists', 'getPlaylistsItems', playlistId, params] as const, + getPlaylistCover: (playlistId: Parameters[0]) => + ['playlists', 'getPlaylistCover', playlistId] as const, checkIfUserFollowsPlaylist: ( - playlistId: string, + playlistId: Parameters[0], params?: Parameters[1] ) => ['playlists', 'checkIfUserFollowsPlaylist', playlistId, params] as const, } export const userKeys = { all: () => ['users'] as const, - getUsersProfile: (userId: string) => ['users', 'getUsersProfile', userId] as const, - getListUsersPlaylists: (userId: string, params?: Parameters[1]) => - ['users', 'getListUsersPlaylists', userId, params] as const, + getUsersProfile: (userId: Parameters[0]) => + ['users', 'getUsersProfile', userId] as const, + getListUsersPlaylists: ( + userId: Parameters[0], + params?: Parameters[1] + ) => ['users', 'getListUsersPlaylists', userId, params] as const, } export const browseKeys = { @@ -258,10 +281,12 @@ export const browseKeys = { ['browse', 'getCategories', params] as const, getNewReleases: (params?: Parameters[0]) => ['browse', 'getNewReleases', params] as const, - getACategory: (categoryId: string, params?: Parameters[1]) => - ['browse', 'getACategory', categoryId, params] as const, + getACategory: ( + categoryId: Parameters[0], + params?: Parameters[1] + ) => ['browse', 'getACategory', categoryId, params] as const, getACategoriesPlaylists: ( - categoryId: string, + categoryId: Parameters[0], params?: Parameters[1] ) => ['browse', 'getACategoriesPlaylists', categoryId, params] as const, } @@ -270,12 +295,12 @@ export const audioFeatureKeys = { all: () => ['audio-features'] as const, list: (params: Parameters[0]) => ['audio-features', 'list', params] as const, - detail: (id: string) => ['audio-features', id] as const, + detail: (id: Parameters[0]) => ['audio-features', id] as const, } export const audioAnalysiKeys = { all: () => ['audio-analysis'] as const, - detail: (id: string) => ['audio-analysis', id] as const, + detail: (id: Parameters[0]) => ['audio-analysis', id] as const, } export const recommendationKeys = { @@ -293,7 +318,7 @@ export const marketKeys = { // ── Query options factories ────────────────────────────────── export function getAnAlbumQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -327,7 +352,7 @@ export function getMultipleAlbumsQueryOptions( } export function getAnAlbumsTracksQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -344,7 +369,7 @@ export function getAnAlbumsTracksQueryOptions( } export function getAnArtistQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -377,7 +402,7 @@ export function getMultipleArtistsQueryOptions( } export function getAnArtistsAlbumsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -395,7 +420,7 @@ export function getAnArtistsAlbumsQueryOptions( /** @deprecated */ export function getAnArtistsTopTracksQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -413,7 +438,7 @@ export function getAnArtistsTopTracksQueryOptions( /** @deprecated */ export function getAnArtistsRelatedArtistsQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -429,7 +454,7 @@ export function getAnArtistsRelatedArtistsQueryOptions( } export function getAShowQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -463,7 +488,7 @@ export function getMultipleShowsQueryOptions( } export function getAShowsEpisodesQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -480,7 +505,7 @@ export function getAShowsEpisodesQueryOptions( } export function getAnEpisodeQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -514,7 +539,7 @@ export function getMultipleEpisodesQueryOptions( } export function getAnAudiobookQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -548,7 +573,7 @@ export function getMultipleAudiobooksQueryOptions( } export function getAudiobookChaptersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -598,7 +623,7 @@ export function checkUsersSavedAudiobooksQueryOptions( } export function getAChapterQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -632,7 +657,7 @@ export function getSeveralChaptersQueryOptions( } export function getTrackQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -697,7 +722,7 @@ export function getCurrentUsersProfileQueryOptions( } export function getPlaylistQueryOptions( - playlistId: string, + playlistId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -715,7 +740,7 @@ export function getPlaylistQueryOptions( /** @deprecated */ export function getPlaylistsTracksQueryOptions( - playlistId: string, + playlistId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -732,7 +757,7 @@ export function getPlaylistsTracksQueryOptions( } export function getPlaylistsItemsQueryOptions( - playlistId: string, + playlistId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -914,7 +939,7 @@ export function checkUsersSavedShowsQueryOptions( /** @deprecated */ export function getUsersProfileQueryOptions( - userId: string, + userId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -931,7 +956,7 @@ export function getUsersProfileQueryOptions( /** @deprecated */ export function getListUsersPlaylistsQueryOptions( - userId: string, + userId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -983,7 +1008,7 @@ export function getCategoriesQueryOptions( /** @deprecated */ export function getACategoryQueryOptions( - categoryId: string, + categoryId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1001,7 +1026,7 @@ export function getACategoryQueryOptions( /** @deprecated */ export function getACategoriesPlaylistsQueryOptions( - categoryId: string, + categoryId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1018,7 +1043,7 @@ export function getACategoriesPlaylistsQueryOptions( } export function getPlaylistCoverQueryOptions( - playlistId: string, + playlistId: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1085,7 +1110,7 @@ export function checkCurrentUserFollowsQueryOptions( /** @deprecated */ export function checkIfUserFollowsPlaylistQueryOptions( - playlistId: string, + playlistId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1120,7 +1145,7 @@ export function getSeveralAudioFeaturesQueryOptions( /** @deprecated */ export function getAudioFeaturesQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1137,7 +1162,7 @@ export function getAudioFeaturesQueryOptions( /** @deprecated */ export function getAudioAnalysisQueryOptions( - id: string, + id: Parameters[0], options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1320,7 +1345,7 @@ export function getUsersTopTracksQueryOptions( // ── Queries ────────────────────────────────────────────────── export function useGetAnAlbum( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1355,7 +1380,7 @@ export function useGetMultipleAlbums( } export function useGetAnAlbumsTracks( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1373,7 +1398,7 @@ export function useGetAnAlbumsTracks( } export function useGetAnArtist( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1407,7 +1432,7 @@ export function useGetMultipleArtists( } export function useGetAnArtistsAlbums( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1426,7 +1451,7 @@ export function useGetAnArtistsAlbums( /** @deprecated */ export function useGetAnArtistsTopTracks( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1445,7 +1470,7 @@ export function useGetAnArtistsTopTracks( /** @deprecated */ export function useGetAnArtistsRelatedArtists( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -1462,7 +1487,7 @@ export function useGetAnArtistsRelatedArtists( } export function useGetAShow( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1497,7 +1522,7 @@ export function useGetMultipleShows( } export function useGetAShowsEpisodes( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1515,7 +1540,7 @@ export function useGetAShowsEpisodes( } export function useGetAnEpisode( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1550,7 +1575,7 @@ export function useGetMultipleEpisodes( } export function useGetAnAudiobook( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1585,7 +1610,7 @@ export function useGetMultipleAudiobooks( } export function useGetAudiobookChapters( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1667,7 +1692,7 @@ export function useCheckUsersSavedAudiobooks( } export function useGetAChapter( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1702,7 +1727,7 @@ export function useGetSeveralChapters( } export function useGetTrack( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1799,7 +1824,7 @@ export function useGetCurrentUsersProfile( } export function useGetPlaylist( - playlistId: string | undefined | null, + playlistId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1818,7 +1843,7 @@ export function useGetPlaylist( /** @deprecated */ export function useGetPlaylistsTracks( - playlistId: string | undefined | null, + playlistId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1836,7 +1861,7 @@ export function useGetPlaylistsTracks( } export function useGetPlaylistsItems( - playlistId: string | undefined | null, + playlistId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2175,7 +2200,7 @@ export function useCheckUsersSavedShows( /** @deprecated */ export function useGetUsersProfile( - userId: string | undefined | null, + userId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2193,7 +2218,7 @@ export function useGetUsersProfile( /** @deprecated */ export function useGetListUsersPlaylists( - userId: string | undefined | null, + userId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2310,7 +2335,7 @@ export function useGetCategoriesInfinite( /** @deprecated */ export function useGetACategory( - categoryId: string | undefined | null, + categoryId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2329,7 +2354,7 @@ export function useGetACategory( /** @deprecated */ export function useGetACategoriesPlaylists( - categoryId: string | undefined | null, + categoryId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2347,7 +2372,7 @@ export function useGetACategoriesPlaylists( } export function useGetPlaylistCover( - playlistId: string | undefined | null, + playlistId: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2478,7 +2503,7 @@ export function useCheckCurrentUserFollows( /** @deprecated */ export function useCheckIfUserFollowsPlaylist( - playlistId: string | undefined | null, + playlistId: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -2514,7 +2539,7 @@ export function useGetSeveralAudioFeatures( /** @deprecated */ export function useGetAudioFeatures( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2532,7 +2557,7 @@ export function useGetAudioFeatures( /** @deprecated */ export function useGetAudioAnalysis( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit< UseQueryOptions>, ApiError>, 'queryKey' | 'queryFn' @@ -2854,7 +2879,10 @@ export function useChangePlaylistDetails( UseMutationOptions< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2862,7 +2890,10 @@ export function useChangePlaylistDetails( return useMutation< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ playlistId, body }) => changePlaylistDetails(playlistId, body), ...options, @@ -2876,7 +2907,7 @@ export function useAddTracksToPlaylist( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2888,7 +2919,7 @@ export function useAddTracksToPlaylist( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2905,7 +2936,7 @@ export function useReorderOrReplacePlaylistsTracks( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2917,7 +2948,7 @@ export function useReorderOrReplacePlaylistsTracks( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2934,7 +2965,10 @@ export function useRemoveTracksPlaylist( UseMutationOptions< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2942,7 +2976,10 @@ export function useRemoveTracksPlaylist( return useMutation< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ playlistId, body }) => removeTracksPlaylist(playlistId, body), ...options, @@ -2955,7 +2992,7 @@ export function useAddItemsToPlaylist( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2967,7 +3004,7 @@ export function useAddItemsToPlaylist( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2983,7 +3020,7 @@ export function useReorderOrReplacePlaylistsItems( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -2995,7 +3032,7 @@ export function useReorderOrReplacePlaylistsItems( Awaited>, ApiError, { - playlistId: string + playlistId: Parameters[0] body: Parameters[1] params: Parameters[2] } @@ -3011,7 +3048,10 @@ export function useRemoveItemsPlaylist( UseMutationOptions< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -3019,7 +3059,10 @@ export function useRemoveItemsPlaylist( return useMutation< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ playlistId, body }) => removeItemsPlaylist(playlistId, body), ...options, @@ -3275,7 +3318,10 @@ export function useCreatePlaylistForUser( UseMutationOptions< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { + userId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -3283,7 +3329,10 @@ export function useCreatePlaylistForUser( return useMutation< Awaited>, ApiError, - { userId: string; body: Parameters[1] } + { + userId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ userId, body }) => createPlaylistForUser(userId, body), ...options, @@ -3296,7 +3345,10 @@ export function useFollowPlaylist( UseMutationOptions< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -3304,7 +3356,7 @@ export function useFollowPlaylist( return useMutation< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { playlistId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ playlistId, body }) => followPlaylist(playlistId, body), ...options, @@ -3314,11 +3366,19 @@ export function useFollowPlaylist( /** @deprecated */ export function useUnfollowPlaylist( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (playlistId) => unfollowPlaylist(playlistId), ...options, }) @@ -3329,7 +3389,10 @@ export function useUploadCustomPlaylistCover( UseMutationOptions< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -3337,7 +3400,10 @@ export function useUploadCustomPlaylistCover( return useMutation< Awaited>, ApiError, - { playlistId: string; body: Parameters[1] } + { + playlistId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ playlistId, body }) => uploadCustomPlaylistCover(playlistId, body), ...options, diff --git a/examples/generated-rq/twitter/hooks.ts b/examples/generated-rq/twitter/hooks.ts index 0491d4f..4712880 100644 --- a/examples/generated-rq/twitter/hooks.ts +++ b/examples/generated-rq/twitter/hooks.ts @@ -136,70 +136,120 @@ export const _2Keys = { getUsersComplianceStream: (params: Parameters[0]) => ['2', 'getUsersComplianceStream', params] as const, findMyUser: (params?: Parameters[0]) => ['2', 'findMyUser', params] as const, - getBatchComplianceJob: (id: string, params?: Parameters[1]) => - ['2', 'getBatchComplianceJob', id, params] as const, + getBatchComplianceJob: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'getBatchComplianceJob', id, params] as const, getDmConversationsWithParticipantIdDmEvents: ( - participantId: string, + participantId: Parameters[0], params?: Parameters[1] ) => ['2', 'getDmConversationsWithParticipantIdDmEvents', participantId, params] as const, getDmConversationsIdDmEvents: ( - id: string, + id: Parameters[0], params?: Parameters[1] ) => ['2', 'getDmConversationsIdDmEvents', id, params] as const, - listIdGet: (id: string, params?: Parameters[1]) => + listIdGet: (id: Parameters[0], params?: Parameters[1]) => ['2', 'listIdGet', id, params] as const, - listGetFollowers: (id: string, params?: Parameters[1]) => - ['2', 'listGetFollowers', id, params] as const, - listGetMembers: (id: string, params?: Parameters[1]) => - ['2', 'listGetMembers', id, params] as const, - listsIdTweets: (id: string, params?: Parameters[1]) => - ['2', 'listsIdTweets', id, params] as const, - findSpaceById: (id: string, params?: Parameters[1]) => - ['2', 'findSpaceById', id, params] as const, - spaceBuyers: (id: string, params?: Parameters[1]) => - ['2', 'spaceBuyers', id, params] as const, - spaceTweets: (id: string, params?: Parameters[1]) => - ['2', 'spaceTweets', id, params] as const, - findTweetById: (id: string, params?: Parameters[1]) => - ['2', 'findTweetById', id, params] as const, - tweetsIdLikingUsers: (id: string, params?: Parameters[1]) => - ['2', 'tweetsIdLikingUsers', id, params] as const, + listGetFollowers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'listGetFollowers', id, params] as const, + listGetMembers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'listGetMembers', id, params] as const, + listsIdTweets: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'listsIdTweets', id, params] as const, + findSpaceById: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'findSpaceById', id, params] as const, + spaceBuyers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'spaceBuyers', id, params] as const, + spaceTweets: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'spaceTweets', id, params] as const, + findTweetById: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'findTweetById', id, params] as const, + tweetsIdLikingUsers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'tweetsIdLikingUsers', id, params] as const, findTweetsThatQuoteATweet: ( - id: string, + id: Parameters[0], params?: Parameters[1] ) => ['2', 'findTweetsThatQuoteATweet', id, params] as const, - tweetsIdRetweetingUsers: (id: string, params?: Parameters[1]) => - ['2', 'tweetsIdRetweetingUsers', id, params] as const, - findUserByUsername: (username: string, params?: Parameters[1]) => - ['2', 'findUserByUsername', username, params] as const, - findUserById: (id: string, params?: Parameters[1]) => - ['2', 'findUserById', id, params] as const, - usersIdBlocking: (id: string, params?: Parameters[1]) => - ['2', 'usersIdBlocking', id, params] as const, - getUsersIdBookmarks: (id: string, params?: Parameters[1]) => - ['2', 'getUsersIdBookmarks', id, params] as const, - userFollowedLists: (id: string, params?: Parameters[1]) => - ['2', 'userFollowedLists', id, params] as const, - usersIdFollowers: (id: string, params?: Parameters[1]) => - ['2', 'usersIdFollowers', id, params] as const, - usersIdFollowing: (id: string, params?: Parameters[1]) => - ['2', 'usersIdFollowing', id, params] as const, - usersIdLikedTweets: (id: string, params?: Parameters[1]) => - ['2', 'usersIdLikedTweets', id, params] as const, - getUserListMemberships: (id: string, params?: Parameters[1]) => - ['2', 'getUserListMemberships', id, params] as const, - usersIdMentions: (id: string, params?: Parameters[1]) => - ['2', 'usersIdMentions', id, params] as const, - usersIdMuting: (id: string, params?: Parameters[1]) => - ['2', 'usersIdMuting', id, params] as const, - listUserOwnedLists: (id: string, params?: Parameters[1]) => - ['2', 'listUserOwnedLists', id, params] as const, - listUserPinnedLists: (id: string, params?: Parameters[1]) => - ['2', 'listUserPinnedLists', id, params] as const, - usersIdTimeline: (id: string, params?: Parameters[1]) => - ['2', 'usersIdTimeline', id, params] as const, - usersIdTweets: (id: string, params?: Parameters[1]) => - ['2', 'usersIdTweets', id, params] as const, + tweetsIdRetweetingUsers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'tweetsIdRetweetingUsers', id, params] as const, + findUserByUsername: ( + username: Parameters[0], + params?: Parameters[1] + ) => ['2', 'findUserByUsername', username, params] as const, + findUserById: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'findUserById', id, params] as const, + usersIdBlocking: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdBlocking', id, params] as const, + getUsersIdBookmarks: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'getUsersIdBookmarks', id, params] as const, + userFollowedLists: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'userFollowedLists', id, params] as const, + usersIdFollowers: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdFollowers', id, params] as const, + usersIdFollowing: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdFollowing', id, params] as const, + usersIdLikedTweets: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdLikedTweets', id, params] as const, + getUserListMemberships: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'getUserListMemberships', id, params] as const, + usersIdMentions: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdMentions', id, params] as const, + usersIdMuting: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdMuting', id, params] as const, + listUserOwnedLists: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'listUserOwnedLists', id, params] as const, + listUserPinnedLists: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'listUserPinnedLists', id, params] as const, + usersIdTimeline: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdTimeline', id, params] as const, + usersIdTweets: ( + id: Parameters[0], + params?: Parameters[1] + ) => ['2', 'usersIdTweets', id, params] as const, } // ── Query options factories ────────────────────────────────── @@ -221,7 +271,7 @@ export function listBatchComplianceJobsQueryOptions( } export function getBatchComplianceJobQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -238,7 +288,7 @@ export function getBatchComplianceJobQueryOptions( } export function getDmConversationsWithParticipantIdDmEventsQueryOptions( - participantId: string, + participantId: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions< @@ -261,7 +311,7 @@ export function getDmConversationsWithParticipantIdDmEventsQueryOptions( } export function getDmConversationsIdDmEventsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -294,7 +344,7 @@ export function getDmEventsQueryOptions( } export function listIdGetQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -311,7 +361,7 @@ export function listIdGetQueryOptions( } export function listGetFollowersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -328,7 +378,7 @@ export function listGetFollowersQueryOptions( } export function listGetMembersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -345,7 +395,7 @@ export function listGetMembersQueryOptions( } export function listsIdTweetsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -425,7 +475,7 @@ export function searchSpacesQueryOptions( } export function findSpaceByIdQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -442,7 +492,7 @@ export function findSpaceByIdQueryOptions( } export function spaceBuyersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -459,7 +509,7 @@ export function spaceBuyersQueryOptions( } export function spaceTweetsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -668,7 +718,7 @@ export function getRulesQueryOptions( } export function findTweetByIdQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -685,7 +735,7 @@ export function findTweetByIdQueryOptions( } export function tweetsIdLikingUsersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -702,7 +752,7 @@ export function tweetsIdLikingUsersQueryOptions( } export function findTweetsThatQuoteATweetQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -719,7 +769,7 @@ export function findTweetsThatQuoteATweetQueryOptions( } export function tweetsIdRetweetingUsersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -768,7 +818,7 @@ export function findUsersByUsernameQueryOptions( } export function findUserByUsernameQueryOptions( - username: string, + username: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -817,7 +867,7 @@ export function findMyUserQueryOptions( } export function findUserByIdQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -834,7 +884,7 @@ export function findUserByIdQueryOptions( } export function usersIdBlockingQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -851,7 +901,7 @@ export function usersIdBlockingQueryOptions( } export function getUsersIdBookmarksQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -868,7 +918,7 @@ export function getUsersIdBookmarksQueryOptions( } export function userFollowedListsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -885,7 +935,7 @@ export function userFollowedListsQueryOptions( } export function usersIdFollowersQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -902,7 +952,7 @@ export function usersIdFollowersQueryOptions( } export function usersIdFollowingQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -919,7 +969,7 @@ export function usersIdFollowingQueryOptions( } export function usersIdLikedTweetsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -936,7 +986,7 @@ export function usersIdLikedTweetsQueryOptions( } export function getUserListMembershipsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -953,7 +1003,7 @@ export function getUserListMembershipsQueryOptions( } export function usersIdMentionsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -970,7 +1020,7 @@ export function usersIdMentionsQueryOptions( } export function usersIdMutingQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -987,7 +1037,7 @@ export function usersIdMutingQueryOptions( } export function listUserOwnedListsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1004,7 +1054,7 @@ export function listUserOwnedListsQueryOptions( } export function listUserPinnedListsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1021,7 +1071,7 @@ export function listUserPinnedListsQueryOptions( } export function usersIdTimelineQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1038,7 +1088,7 @@ export function usersIdTimelineQueryOptions( } export function usersIdTweetsQueryOptions( - id: string, + id: Parameters[0], params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1073,7 +1123,7 @@ export function useListBatchComplianceJobs( } export function useGetBatchComplianceJob( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1091,7 +1141,10 @@ export function useGetBatchComplianceJob( } export function useGetDmConversationsWithParticipantIdDmEvents( - participantId: string | undefined | null, + participantId: + | Parameters[0] + | undefined + | null, params?: Parameters[1], options?: Omit< UseQueryOptions< @@ -1115,7 +1168,7 @@ export function useGetDmConversationsWithParticipantIdDmEvents( } export function useGetDmConversationsIdDmEvents( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1149,7 +1202,7 @@ export function useGetDmEvents( } export function useListIdGet( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1167,7 +1220,7 @@ export function useListIdGet( } export function useListGetFollowers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1185,7 +1238,7 @@ export function useListGetFollowers( } export function useListGetMembers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1203,7 +1256,7 @@ export function useListGetMembers( } export function useListsIdTweets( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1284,7 +1337,7 @@ export function useSearchSpaces( } export function useFindSpaceById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1302,7 +1355,7 @@ export function useFindSpaceById( } export function useSpaceBuyers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1320,7 +1373,7 @@ export function useSpaceBuyers( } export function useSpaceTweets( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1530,7 +1583,7 @@ export function useGetRules( } export function useFindTweetById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1548,7 +1601,7 @@ export function useFindTweetById( } export function useTweetsIdLikingUsers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1566,7 +1619,7 @@ export function useTweetsIdLikingUsers( } export function useFindTweetsThatQuoteATweet( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1584,7 +1637,7 @@ export function useFindTweetsThatQuoteATweet( } export function useTweetsIdRetweetingUsers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1634,7 +1687,7 @@ export function useFindUsersByUsername( } export function useFindUserByUsername( - username: string | undefined | null, + username: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1684,7 +1737,7 @@ export function useFindMyUser( } export function useFindUserById( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1702,7 +1755,7 @@ export function useFindUserById( } export function useUsersIdBlocking( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1720,7 +1773,7 @@ export function useUsersIdBlocking( } export function useGetUsersIdBookmarks( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1738,7 +1791,7 @@ export function useGetUsersIdBookmarks( } export function useUserFollowedLists( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1756,7 +1809,7 @@ export function useUserFollowedLists( } export function useUsersIdFollowers( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1774,7 +1827,7 @@ export function useUsersIdFollowers( } export function useUsersIdFollowing( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1792,7 +1845,7 @@ export function useUsersIdFollowing( } export function useUsersIdLikedTweets( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1810,7 +1863,7 @@ export function useUsersIdLikedTweets( } export function useGetUserListMemberships( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1828,7 +1881,7 @@ export function useGetUserListMemberships( } export function useUsersIdMentions( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1846,7 +1899,7 @@ export function useUsersIdMentions( } export function useUsersIdMuting( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1864,7 +1917,7 @@ export function useUsersIdMuting( } export function useListUserOwnedLists( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1882,7 +1935,7 @@ export function useListUserOwnedLists( } export function useListUserPinnedLists( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1900,7 +1953,7 @@ export function useListUserPinnedLists( } export function useUsersIdTimeline( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1918,7 +1971,7 @@ export function useUsersIdTimeline( } export function useUsersIdTweets( - id: string | undefined | null, + id: Parameters[0] | undefined | null, params?: Parameters[1], options?: Omit< UseQueryOptions>, ApiError>, @@ -1982,7 +2035,10 @@ export function useDmConversationWithUserEventIdCreate( UseMutationOptions< Awaited>, ApiError, - { participantId: string; body: Parameters[1] } + { + participantId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -1990,7 +2046,10 @@ export function useDmConversationWithUserEventIdCreate( return useMutation< Awaited>, ApiError, - { participantId: string; body: Parameters[1] } + { + participantId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ participantId, body }) => dmConversationWithUserEventIdCreate(participantId, body), @@ -2003,7 +2062,10 @@ export function useDmConversationByIdEventIdCreate( UseMutationOptions< Awaited>, ApiError, - { dmConversationId: string; body: Parameters[1] } + { + dmConversationId: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2011,7 +2073,10 @@ export function useDmConversationByIdEventIdCreate( return useMutation< Awaited>, ApiError, - { dmConversationId: string; body: Parameters[1] } + { + dmConversationId: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ dmConversationId, body }) => dmConversationByIdEventIdCreate(dmConversationId, body), @@ -2044,7 +2109,7 @@ export function useListIdUpdate( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2052,7 +2117,7 @@ export function useListIdUpdate( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => listIdUpdate(id, body), ...options, @@ -2061,11 +2126,19 @@ export function useListIdUpdate( export function useListIdDelete( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => listIdDelete(id), ...options, }) @@ -2076,7 +2149,7 @@ export function useListAddMember( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2084,7 +2157,7 @@ export function useListAddMember( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => listAddMember(id, body), ...options, @@ -2096,7 +2169,7 @@ export function useListRemoveMember( UseMutationOptions< Awaited>, ApiError, - { id: string; userId: string } + { id: Parameters[0]; userId: Parameters[1] } >, 'mutationFn' > @@ -2104,7 +2177,7 @@ export function useListRemoveMember( return useMutation< Awaited>, ApiError, - { id: string; userId: string } + { id: Parameters[0]; userId: Parameters[1] } >({ mutationFn: ({ id, userId }) => listRemoveMember(id, userId), ...options, @@ -2156,11 +2229,19 @@ export function useAddOrDeleteRules( export function useDeleteTweetById( options?: Omit< - UseMutationOptions>, ApiError, string>, + UseMutationOptions< + Awaited>, + ApiError, + Parameters[0] + >, 'mutationFn' > ) { - return useMutation>, ApiError, string>({ + return useMutation< + Awaited>, + ApiError, + Parameters[0] + >({ mutationFn: (id) => deleteTweetById(id), ...options, }) @@ -2171,7 +2252,7 @@ export function useHideReplyById( UseMutationOptions< Awaited>, ApiError, - { tweetId: string; body: Parameters[1] } + { tweetId: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2179,7 +2260,7 @@ export function useHideReplyById( return useMutation< Awaited>, ApiError, - { tweetId: string; body: Parameters[1] } + { tweetId: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ tweetId, body }) => hideReplyById(tweetId, body), ...options, @@ -2191,7 +2272,7 @@ export function useUsersIdBlock( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2199,7 +2280,7 @@ export function useUsersIdBlock( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => usersIdBlock(id, body), ...options, @@ -2211,7 +2292,10 @@ export function usePostUsersIdBookmarks( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >, 'mutationFn' > @@ -2219,7 +2303,10 @@ export function usePostUsersIdBookmarks( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { + id: Parameters[0] + body: Parameters[1] + } >({ mutationFn: ({ id, body }) => postUsersIdBookmarks(id, body), ...options, @@ -2231,7 +2318,10 @@ export function useUsersIdBookmarksDelete( UseMutationOptions< Awaited>, ApiError, - { id: string; tweetId: string } + { + id: Parameters[0] + tweetId: Parameters[1] + } >, 'mutationFn' > @@ -2239,7 +2329,10 @@ export function useUsersIdBookmarksDelete( return useMutation< Awaited>, ApiError, - { id: string; tweetId: string } + { + id: Parameters[0] + tweetId: Parameters[1] + } >({ mutationFn: ({ id, tweetId }) => usersIdBookmarksDelete(id, tweetId), ...options, @@ -2251,7 +2344,7 @@ export function useListUserFollow( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2259,7 +2352,7 @@ export function useListUserFollow( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => listUserFollow(id, body), ...options, @@ -2271,7 +2364,7 @@ export function useListUserUnfollow( UseMutationOptions< Awaited>, ApiError, - { id: string; listId: string } + { id: Parameters[0]; listId: Parameters[1] } >, 'mutationFn' > @@ -2279,7 +2372,7 @@ export function useListUserUnfollow( return useMutation< Awaited>, ApiError, - { id: string; listId: string } + { id: Parameters[0]; listId: Parameters[1] } >({ mutationFn: ({ id, listId }) => listUserUnfollow(id, listId), ...options, @@ -2291,7 +2384,7 @@ export function useUsersIdFollow( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2299,7 +2392,7 @@ export function useUsersIdFollow( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => usersIdFollow(id, body), ...options, @@ -2311,7 +2404,7 @@ export function useUsersIdLike( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2319,7 +2412,7 @@ export function useUsersIdLike( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => usersIdLike(id, body), ...options, @@ -2331,7 +2424,7 @@ export function useUsersIdUnlike( UseMutationOptions< Awaited>, ApiError, - { id: string; tweetId: string } + { id: Parameters[0]; tweetId: Parameters[1] } >, 'mutationFn' > @@ -2339,7 +2432,7 @@ export function useUsersIdUnlike( return useMutation< Awaited>, ApiError, - { id: string; tweetId: string } + { id: Parameters[0]; tweetId: Parameters[1] } >({ mutationFn: ({ id, tweetId }) => usersIdUnlike(id, tweetId), ...options, @@ -2351,7 +2444,7 @@ export function useUsersIdMute( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2359,7 +2452,7 @@ export function useUsersIdMute( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => usersIdMute(id, body), ...options, @@ -2371,7 +2464,7 @@ export function useListUserPin( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2379,7 +2472,7 @@ export function useListUserPin( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => listUserPin(id, body), ...options, @@ -2391,7 +2484,7 @@ export function useListUserUnpin( UseMutationOptions< Awaited>, ApiError, - { id: string; listId: string } + { id: Parameters[0]; listId: Parameters[1] } >, 'mutationFn' > @@ -2399,7 +2492,7 @@ export function useListUserUnpin( return useMutation< Awaited>, ApiError, - { id: string; listId: string } + { id: Parameters[0]; listId: Parameters[1] } >({ mutationFn: ({ id, listId }) => listUserUnpin(id, listId), ...options, @@ -2411,7 +2504,7 @@ export function useUsersIdRetweets( UseMutationOptions< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >, 'mutationFn' > @@ -2419,7 +2512,7 @@ export function useUsersIdRetweets( return useMutation< Awaited>, ApiError, - { id: string; body: Parameters[1] } + { id: Parameters[0]; body: Parameters[1] } >({ mutationFn: ({ id, body }) => usersIdRetweets(id, body), ...options, @@ -2431,7 +2524,10 @@ export function useUsersIdUnretweets( UseMutationOptions< Awaited>, ApiError, - { id: string; sourceTweetId: string } + { + id: Parameters[0] + sourceTweetId: Parameters[1] + } >, 'mutationFn' > @@ -2439,7 +2535,10 @@ export function useUsersIdUnretweets( return useMutation< Awaited>, ApiError, - { id: string; sourceTweetId: string } + { + id: Parameters[0] + sourceTweetId: Parameters[1] + } >({ mutationFn: ({ id, sourceTweetId }) => usersIdUnretweets(id, sourceTweetId), ...options, @@ -2451,7 +2550,10 @@ export function useUsersIdUnblock( UseMutationOptions< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >, 'mutationFn' > @@ -2459,7 +2561,10 @@ export function useUsersIdUnblock( return useMutation< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >({ mutationFn: ({ sourceUserId, targetUserId }) => usersIdUnblock(sourceUserId, targetUserId), ...options, @@ -2471,7 +2576,10 @@ export function useUsersIdUnfollow( UseMutationOptions< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >, 'mutationFn' > @@ -2479,7 +2587,10 @@ export function useUsersIdUnfollow( return useMutation< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >({ mutationFn: ({ sourceUserId, targetUserId }) => usersIdUnfollow(sourceUserId, targetUserId), ...options, @@ -2491,7 +2602,10 @@ export function useUsersIdUnmute( UseMutationOptions< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >, 'mutationFn' > @@ -2499,7 +2613,10 @@ export function useUsersIdUnmute( return useMutation< Awaited>, ApiError, - { sourceUserId: string; targetUserId: string } + { + sourceUserId: Parameters[0] + targetUserId: Parameters[1] + } >({ mutationFn: ({ sourceUserId, targetUserId }) => usersIdUnmute(sourceUserId, targetUserId), ...options, diff --git a/examples/generated/1password-connect/client.ts b/examples/generated/1password-connect/client.ts index 403a389..8a5b612 100644 --- a/examples/generated/1password-connect/client.ts +++ b/examples/generated/1password-connect/client.ts @@ -1,6 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit -import type { APIRequest, File, FullItem, Item, Patch, Vault } from './models.js' +import type { APIRequest, File, FullItem, Item, Patch, ServiceDependency, Vault } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' import { z } from 'zod' import { @@ -338,7 +338,7 @@ export async function getHeartbeat(config?: Partial): Promise -): Promise> { +): Promise<{ name: string; version: string; dependencies?: ServiceDependency[] }> { const res = await _request('GET', '/health', {}, config) return res.json() } diff --git a/examples/generated/canada_holidays/client.ts b/examples/generated/canada_holidays/client.ts index 1aa71f3..0717ead 100644 --- a/examples/generated/canada_holidays/client.ts +++ b/examples/generated/canada_holidays/client.ts @@ -1,5 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit +import type { Holiday, Province } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' export class ApiError extends Error { @@ -83,7 +84,17 @@ async function _request( return res } -export async function root(config?: Partial): Promise> { +export async function root( + config?: Partial +): Promise<{ + _links?: { + holidays?: { href?: string } + provinces?: { href?: string } + self?: { href?: string } + spec?: { href?: string } + } + message?: string +}> { const res = await _request('GET', '/api/v1', {}, config) return res.json() } @@ -95,7 +106,7 @@ export async function holidays( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ holidays?: Holiday[] }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.federal != null) searchParams.set('federal', String(params.federal)) @@ -105,13 +116,13 @@ export async function holidays( } export async function holiday( - holidayId: string, + holidayId: number, params?: { year?: number optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ holiday?: Holiday }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) @@ -130,7 +141,7 @@ export async function provinces( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ provinces?: Province[] }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) @@ -145,7 +156,7 @@ export async function province( optional?: '1' | '0' | 'true' | 'false' }, config?: Partial -): Promise> { +): Promise<{ province?: Province }> { const searchParams = new URLSearchParams() if (params?.year != null) searchParams.set('year', String(params.year)) if (params?.optional != null) searchParams.set('optional', String(params.optional)) diff --git a/examples/generated/devto/client.ts b/examples/generated/devto/client.ts index ed48cac..e0d2711 100644 --- a/examples/generated/devto/client.ts +++ b/examples/generated/devto/client.ts @@ -139,7 +139,7 @@ export async function getAgentSessions( } export async function createAgentSession( - body: Record, + body: { title?: string; curated_data: string; s3_key?: string; tool_name?: string }, config?: Partial ): Promise { const res = await _request('POST', '/api/agent_sessions', { body }, config) @@ -202,7 +202,7 @@ export async function getLatestArticles( } export async function getArticleById( - id: string, + id: number, config?: Partial ): Promise> { const res = await _request('GET', `/api/articles/${encodeURIComponent(id)}`, {}, config) @@ -210,7 +210,7 @@ export async function getArticleById( } export async function updateArticle( - id: string, + id: number, body: Article, config?: Partial ): Promise { @@ -289,7 +289,7 @@ export async function getUserAllArticles( } export async function unpublishArticle( - id: string, + id: number, params?: { note?: string }, @@ -322,19 +322,19 @@ export async function createSegment(config?: Partial): Promise ): Promise> { const res = await _request('GET', `/api/segments/${encodeURIComponent(id)}`, {}, config) return res.json() } -export async function deleteSegment(id: string, config?: Partial): Promise { +export async function deleteSegment(id: number, config?: Partial): Promise { await _request('DELETE', `/api/segments/${encodeURIComponent(id)}`, {}, config) } export async function getUsersInSegment( - id: string, + id: number, params?: { perPage?: number }, @@ -352,7 +352,7 @@ export async function getUsersInSegment( } export async function addUsersToSegment( - id: string, + id: number, body: SegmentUserIds, config?: Partial ): Promise { @@ -361,7 +361,7 @@ export async function addUsersToSegment( } export async function removeUsersFromSegment( - id: string, + id: number, body: SegmentUserIds, config?: Partial ): Promise { @@ -383,14 +383,14 @@ export async function createApiBillboards( } export async function getApiBillboardsById( - id: string, + id: number, config?: Partial ): Promise { await _request('GET', `/api/billboards/${encodeURIComponent(id)}`, {}, config) } export async function updateApiBillboardsById( - id: string, + id: number, body: Record, config?: Partial ): Promise> { @@ -399,7 +399,7 @@ export async function updateApiBillboardsById( } export async function updateApiBillboardsByIdUnpublish( - id: string, + id: number, config?: Partial ): Promise { await _request('PUT', `/api/billboards/${encodeURIComponent(id)}/unpublish`, {}, config) @@ -423,7 +423,7 @@ export async function getCommentsByArticleId( return z.array(CommentSchema).parse(await res.json()) } -export async function getCommentById(id: string, config?: Partial): Promise { +export async function getCommentById(id: number, config?: Partial): Promise { await _request('GET', `/api/comments/${encodeURIComponent(id)}`, {}, config) } @@ -524,7 +524,7 @@ export async function createOrganization( } export async function getOrganizationById( - id: string, + id: number, config?: Partial ): Promise> { const res = await _request('GET', `/api/organizations/${encodeURIComponent(id)}`, {}, config) @@ -532,7 +532,7 @@ export async function getOrganizationById( } export async function updateApiOrganizationsById( - id: string, + id: number, body: Organization, config?: Partial ): Promise { @@ -541,7 +541,7 @@ export async function updateApiOrganizationsById( } export async function deleteApiOrganizationsById( - id: string, + id: number, config?: Partial ): Promise { await _request('DELETE', `/api/organizations/${encodeURIComponent(id)}`, {}, config) @@ -553,19 +553,27 @@ export async function getApiPages(config?: Partial): Promise, + body: { + title?: string + slug?: string + description?: string + body_markdown?: string + body_json?: string + is_top_level_path?: boolean + template?: string + }, config?: Partial ): Promise { await _request('POST', '/api/pages', { body }, config) } -export async function getApiPagesById(id: string, config?: Partial): Promise { +export async function getApiPagesById(id: number, config?: Partial): Promise { const res = await _request('GET', `/api/pages/${encodeURIComponent(id)}`, {}, config) return PageSchema.parse(await res.json()) } export async function updateApiPagesById( - id: string, + id: number, body: Page, config?: Partial ): Promise { @@ -575,7 +583,7 @@ export async function updateApiPagesById( } export async function deleteApiPagesById( - id: string, + id: number, config?: Partial ): Promise { const res = await _request('DELETE', `/api/pages/${encodeURIComponent(id)}`, {}, config) @@ -735,31 +743,31 @@ export async function getTags( return z.array(TagSchema).parse(await res.json()) } -export async function suspendUser(id: string, config?: Partial): Promise { +export async function suspendUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/suspend`, {}, config) } -export async function limitUser(id: string, config?: Partial): Promise { +export async function limitUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/limited`, {}, config) } -export async function unLimitUser(id: string, config?: Partial): Promise { +export async function unLimitUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/limited`, {}, config) } -export async function spamUser(id: string, config?: Partial): Promise { +export async function spamUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/spam`, {}, config) } -export async function unSpamUser(id: string, config?: Partial): Promise { +export async function unSpamUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/spam`, {}, config) } -export async function trustUser(id: string, config?: Partial): Promise { +export async function trustUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/trusted`, {}, config) } -export async function unTrustUser(id: string, config?: Partial): Promise { +export async function unTrustUser(id: number, config?: Partial): Promise { await _request('DELETE', `/api/users/${encodeURIComponent(id)}/trusted`, {}, config) } @@ -776,7 +784,7 @@ export async function getUser( return res.json() } -export async function unpublishUser(id: string, config?: Partial): Promise { +export async function unpublishUser(id: number, config?: Partial): Promise { await _request('PUT', `/api/users/${encodeURIComponent(id)}/unpublish`, {}, config) } diff --git a/examples/generated/exchangerate/client.ts b/examples/generated/exchangerate/client.ts index 19f7b45..6397f52 100644 --- a/examples/generated/exchangerate/client.ts +++ b/examples/generated/exchangerate/client.ts @@ -86,7 +86,12 @@ async function _request( export async function getLatestByBaseCurrency( baseCurrency: string, config?: Partial -): Promise> { +): Promise<{ + base?: string + date?: string + rates?: Record + time_last_updated?: number +}> { const res = await _request('GET', `/latest/${encodeURIComponent(baseCurrency)}`, {}, config) return res.json() } diff --git a/examples/generated/open-meteo/client.ts b/examples/generated/open-meteo/client.ts index fa673d9..99b9492 100644 --- a/examples/generated/open-meteo/client.ts +++ b/examples/generated/open-meteo/client.ts @@ -1,5 +1,6 @@ // This file is auto-generated by openapi-zod-ts — do not edit +import type { CurrentWeather, DailyResponse, HourlyResponse } from './models.js' import { getConfig, type ClientConfig } from './client-config.js' export class ApiError extends Error { @@ -97,7 +98,18 @@ export async function getV1Forecast( pastDays?: number }, config?: Partial -): Promise> { +): Promise<{ + latitude?: number + longitude?: number + elevation?: number + generationtime_ms?: number + utc_offset_seconds?: number + hourly?: HourlyResponse + hourly_units?: Record + daily?: DailyResponse + daily_units?: Record + current_weather?: CurrentWeather +}> { const searchParams = new URLSearchParams() if (params?.hourly != null) { for (const v of params.hourly) searchParams.append('hourly', String(v)) diff --git a/examples/generated/openai/client.ts b/examples/generated/openai/client.ts index 21129bc..d15cb2d 100644 --- a/examples/generated/openai/client.ts +++ b/examples/generated/openai/client.ts @@ -6,6 +6,7 @@ import type { ApiKeyList, AssistantObject, Batch, + BatchFileExpirationAfter, Certificate, ChatCompletionDeleted, ChatCompletionList, @@ -88,6 +89,7 @@ import type { GroupUserAssignment, GroupUserDeletedResource, ImagesResponse, + InputItem, Invite, InviteDeleteResponse, InviteListResponse, @@ -110,6 +112,7 @@ import type { ListVectorStoreFilesResponse, ListVectorStoresResponse, MessageObject, + Metadata, Model, ModifyAssistantRequest, ModifyCertificateRequest, @@ -468,7 +471,13 @@ export async function listBatches( } export async function createBatch( - body: Record, + body: { + input_file_id: string + endpoint: string + completion_window: string + metadata?: Metadata + output_expires_after?: BatchFileExpirationAfter + }, config?: Partial ): Promise { const res = await _request('POST', '/batches', { body }, config) @@ -531,7 +540,7 @@ export async function getChatCompletion( export async function updateChatCompletion( completionId: string, - body: Record, + body: { metadata: Metadata }, config?: Partial ): Promise { const res = await _request( @@ -826,7 +835,7 @@ export async function getEval(evalId: string, config?: Partial): P export async function updateEval( evalId: string, - body: Record, + body: { name?: string; metadata?: Metadata }, config?: Partial ): Promise { const res = await _request('POST', `/evals/${encodeURIComponent(evalId)}`, { body }, config) @@ -839,7 +848,7 @@ export async function updateEval( export async function deleteEval( evalId: string, config?: Partial -): Promise> { +): Promise<{ object: string; deleted: boolean; eval_id: string }> { const res = await _request('DELETE', `/evals/${encodeURIComponent(evalId)}`, {}, config) return res.json() } @@ -915,7 +924,7 @@ export async function deleteEvalRun( evalId: string, runId: string, config?: Partial -): Promise> { +): Promise<{ object?: string; deleted?: boolean; run_id?: string }> { const res = await _request( 'DELETE', `/evals/${encodeURIComponent(evalId)}/runs/${encodeURIComponent(runId)}`, @@ -1262,7 +1271,7 @@ export async function adminApiKeysList( } export async function adminApiKeysCreate( - body: Record, + body: { name: string }, config?: Partial ): Promise { const res = await _request('POST', '/organization/admin_api_keys', { body }, config) @@ -1285,7 +1294,7 @@ export async function adminApiKeysGet( export async function adminApiKeysDelete( keyId: string, config?: Partial -): Promise> { +): Promise<{ id: string; object: string; deleted: boolean }> { const res = await _request( 'DELETE', `/organization/admin_api_keys/${encodeURIComponent(keyId)}`, @@ -1298,11 +1307,11 @@ export async function adminApiKeysDelete( export async function listAuditLogs( params?: { effectiveAt?: unknown - projectIds?: string[] - eventTypes?: string[] - actorIds?: string[] - actorEmails?: string[] - resourceIds?: string[] + 'project_ids[]'?: string[] + 'event_types[]'?: string[] + 'actor_ids[]'?: string[] + 'actor_emails[]'?: string[] + 'resource_ids[]'?: string[] limit?: number after?: string before?: string @@ -1311,20 +1320,20 @@ export async function listAuditLogs( ): Promise { const searchParams = new URLSearchParams() if (params?.effectiveAt != null) searchParams.set('effective_at', String(params.effectiveAt)) - if (params?.projectIds != null) { - for (const v of params.projectIds) searchParams.append('project_ids[]', String(v)) + if (params?.['project_ids[]'] != null) { + for (const v of params['project_ids[]']) searchParams.append('project_ids[]', String(v)) } - if (params?.eventTypes != null) { - for (const v of params.eventTypes) searchParams.append('event_types[]', String(v)) + if (params?.['event_types[]'] != null) { + for (const v of params['event_types[]']) searchParams.append('event_types[]', String(v)) } - if (params?.actorIds != null) { - for (const v of params.actorIds) searchParams.append('actor_ids[]', String(v)) + if (params?.['actor_ids[]'] != null) { + for (const v of params['actor_ids[]']) searchParams.append('actor_ids[]', String(v)) } - if (params?.actorEmails != null) { - for (const v of params.actorEmails) searchParams.append('actor_emails[]', String(v)) + if (params?.['actor_emails[]'] != null) { + for (const v of params['actor_emails[]']) searchParams.append('actor_emails[]', String(v)) } - if (params?.resourceIds != null) { - for (const v of params.resourceIds) searchParams.append('resource_ids[]', String(v)) + if (params?.['resource_ids[]'] != null) { + for (const v of params['resource_ids[]']) searchParams.append('resource_ids[]', String(v)) } if (params?.limit != null) searchParams.set('limit', String(params.limit)) if (params?.after != null) searchParams.set('after', String(params.after)) @@ -3013,13 +3022,13 @@ export async function createRun( threadId: string, body: CreateRunRequest, params?: { - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { const searchParams = new URLSearchParams() - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'POST', @@ -3081,7 +3090,7 @@ export async function listRunSteps( order?: 'asc' | 'desc' after?: string before?: string - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { @@ -3090,8 +3099,8 @@ export async function listRunSteps( if (params?.order != null) searchParams.set('order', String(params.order)) if (params?.after != null) searchParams.set('after', String(params.after)) if (params?.before != null) searchParams.set('before', String(params.before)) - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'GET', @@ -3107,13 +3116,13 @@ export async function getRunStep( runId: string, stepId: string, params?: { - include?: string[] + 'include[]'?: string[] }, config?: Partial ): Promise { const searchParams = new URLSearchParams() - if (params?.include != null) { - for (const v of params.include) searchParams.append('include[]', String(v)) + if (params?.['include[]'] != null) { + for (const v of params['include[]']) searchParams.append('include[]', String(v)) } const res = await _request( 'GET', diff --git a/examples/generated/petstore-3.0/client.ts b/examples/generated/petstore-3.0/client.ts index 972fe90..6f8b096 100644 --- a/examples/generated/petstore-3.0/client.ts +++ b/examples/generated/petstore-3.0/client.ts @@ -132,13 +132,13 @@ export async function findPetsByTags( return z.array(PetSchema).parse(await res.json()) } -export async function getPetById(petId: string, config?: Partial): Promise { +export async function getPetById(petId: number, config?: Partial): Promise { const res = await _request('GET', `/pet/${encodeURIComponent(petId)}`, {}, config) return PetSchema.parse(await res.json()) } export async function updatePetWithForm( - petId: string, + petId: number, params?: { name?: string status?: string @@ -153,7 +153,7 @@ export async function updatePetWithForm( } export async function deletePet( - petId: string, + petId: number, params?: { api_key?: string }, @@ -166,7 +166,7 @@ export async function deletePet( } export async function uploadFile( - petId: string, + petId: number, params?: { additionalMetadata?: string }, @@ -198,14 +198,14 @@ export async function placeOrder(body: Order, config?: Partial): P } export async function getOrderById( - orderId: string, + orderId: number, config?: Partial ): Promise { const res = await _request('GET', `/store/order/${encodeURIComponent(orderId)}`, {}, config) return OrderSchema.parse(await res.json()) } -export async function deleteOrder(orderId: string, config?: Partial): Promise { +export async function deleteOrder(orderId: number, config?: Partial): Promise { await _request('DELETE', `/store/order/${encodeURIComponent(orderId)}`, {}, config) } diff --git a/examples/generated/spotify/client.ts b/examples/generated/spotify/client.ts index 47f25e3..3233c2e 100644 --- a/examples/generated/spotify/client.ts +++ b/examples/generated/spotify/client.ts @@ -466,7 +466,7 @@ export async function getPlaylist( export async function changePlaylistDetails( playlistId: string, - body: Record, + body: { name?: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('PUT', `/playlists/${encodeURIComponent(playlistId)}`, { body }, config) @@ -506,7 +506,7 @@ export async function getPlaylistsTracks( */ export async function addTracksToPlaylist( playlistId: string, - body: Record, + body: { uris?: string[]; position?: number }, params?: { position?: number uris?: string @@ -529,7 +529,13 @@ export async function addTracksToPlaylist( */ export async function reorderOrReplacePlaylistsTracks( playlistId: string, - body: Record, + body: { + uris?: string[] + range_start?: number + insert_before?: number + range_length?: number + snapshot_id?: string + }, params?: { uris?: string }, @@ -550,7 +556,7 @@ export async function reorderOrReplacePlaylistsTracks( */ export async function removeTracksPlaylist( playlistId: string, - body: Record, + body: { tracks: { uri?: string }[]; snapshot_id?: string }, config?: Partial ): Promise { await _request('DELETE', `/playlists/${encodeURIComponent(playlistId)}/tracks`, { body }, config) @@ -584,7 +590,7 @@ export async function getPlaylistsItems( export async function addItemsToPlaylist( playlistId: string, - body: Record, + body: { uris?: string[]; position?: number }, params?: { position?: number uris?: string @@ -604,7 +610,13 @@ export async function addItemsToPlaylist( export async function reorderOrReplacePlaylistsItems( playlistId: string, - body: Record, + body: { + uris?: string[] + range_start?: number + insert_before?: number + range_length?: number + snapshot_id?: string + }, params?: { uris?: string }, @@ -622,7 +634,7 @@ export async function reorderOrReplacePlaylistsItems( export async function removeItemsPlaylist( playlistId: string, - body: Record, + body: { items: { uri?: string }[]; snapshot_id?: string }, config?: Partial ): Promise { await _request('DELETE', `/playlists/${encodeURIComponent(playlistId)}/items`, { body }, config) @@ -642,7 +654,7 @@ export async function getAListOfCurrentUsersPlaylists( } export async function createPlaylist( - body: Record, + body: { name: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('POST', '/me/playlists', { body }, config) @@ -709,7 +721,7 @@ export async function getUsersSavedAlbums( * @deprecated */ export async function saveAlbumsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -724,7 +736,7 @@ export async function saveAlbumsUser( * @deprecated */ export async function removeAlbumsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -768,7 +780,7 @@ export async function getUsersSavedTracks( * @deprecated */ export async function saveTracksUser( - body: Record, + body: { ids: string[]; timestamped_ids?: { id: string; added_at: string }[] }, config?: Partial ): Promise { await _request('PUT', '/me/tracks', { body }, config) @@ -778,7 +790,7 @@ export async function saveTracksUser( * @deprecated */ export async function removeTracksUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -822,7 +834,7 @@ export async function getUsersSavedEpisodes( * @deprecated */ export async function saveEpisodesUser( - body: Record, + body: { ids: string[] }, params: { ids: string }, @@ -837,7 +849,7 @@ export async function saveEpisodesUser( * @deprecated */ export async function removeEpisodesUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -879,7 +891,7 @@ export async function getUsersSavedShows( * @deprecated */ export async function saveShowsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string }, @@ -894,7 +906,7 @@ export async function saveShowsUser( * @deprecated */ export async function removeShowsUser( - body: Record, + body: { ids?: string[] }, params: { ids: string market?: string @@ -953,7 +965,7 @@ export async function getListUsersPlaylists( */ export async function createPlaylistForUser( userId: string, - body: Record, + body: { name: string; public?: boolean; collaborative?: boolean; description?: string }, config?: Partial ): Promise { await _request('POST', `/users/${encodeURIComponent(userId)}/playlists`, { body }, config) @@ -964,7 +976,7 @@ export async function createPlaylistForUser( */ export async function followPlaylist( playlistId: string, - body: Record, + body: { public?: boolean }, config?: Partial ): Promise { await _request('PUT', `/playlists/${encodeURIComponent(playlistId)}/followers`, { body }, config) @@ -1107,7 +1119,7 @@ export async function getFollowed( * @deprecated */ export async function followArtistsUsers( - body: Record, + body: { ids: string[] }, params: { type: 'artist' | 'user' ids: string @@ -1124,7 +1136,7 @@ export async function followArtistsUsers( * @deprecated */ export async function unfollowArtistsUsers( - body: Record, + body: { ids?: string[] }, params: { type: 'artist' | 'user' ids: string @@ -1353,7 +1365,7 @@ export async function getInformationAboutTheUsersCurrentPlayback( } export async function transferAUsersPlayback( - body: Record, + body: { device_ids: string[]; play?: boolean }, config?: Partial ): Promise { await _request('PUT', '/me/player', { body }, config) @@ -1378,7 +1390,12 @@ export async function getTheUsersCurrentlyPlayingTrack( } export async function startAUsersPlayback( - body: Record, + body: { + context_uri?: string + uris?: string[] + offset?: Record + position_ms?: number + }, params?: { deviceId?: string }, diff --git a/packages/openapi-react-query/src/__tests__/__snapshots__/hooks.test.ts.snap b/packages/openapi-react-query/src/__tests__/__snapshots__/hooks.test.ts.snap index 7197723..560d5bc 100644 --- a/packages/openapi-react-query/src/__tests__/__snapshots__/hooks.test.ts.snap +++ b/packages/openapi-react-query/src/__tests__/__snapshots__/hooks.test.ts.snap @@ -11,7 +11,7 @@ import { createPost, getPost, listPosts, type ApiError } from './client.js' export const postKeys = { all: () => ["posts"] as const, list: (params?: Parameters[0]) => ["posts", 'list', params] as const, - detail: (id: string) => ["posts", id] as const, + detail: (id: Parameters[0]) => ["posts", id] as const, } // ── Query options factories ────────────────────────────────── @@ -30,7 +30,7 @@ export function listPostsQueryOptions( } export function getPostQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -74,7 +74,7 @@ export function useListPostsInfinite( } export function useGetPost( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -111,7 +111,7 @@ import { createTask, deleteTask, getTask, listTasks, updateTask, type ApiError } export const taskKeys = { all: () => ["tasks"] as const, list: (params?: Parameters[0]) => ["tasks", 'list', params] as const, - detail: (id: string) => ["tasks", id] as const, + detail: (id: Parameters[0]) => ["tasks", id] as const, } // ── Query options factories ────────────────────────────────── @@ -130,7 +130,7 @@ export function listTasksQueryOptions( } export function getTaskQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -174,7 +174,7 @@ export function useListTasksInfinite( } export function useGetTask( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -204,10 +204,10 @@ export function useCreateTask( } export function useUpdateTask( - options?: Omit>, ApiError, { id: string; body: Parameters[1] }>, 'mutationFn'>, + options?: Omit>, ApiError, { id: Parameters[0]; body: Parameters[1] }>, 'mutationFn'>, ) { const queryClient = useQueryClient() - return useMutation>, ApiError, { id: string; body: Parameters[1] }>({ + return useMutation>, ApiError, { id: Parameters[0]; body: Parameters[1] }>({ mutationFn: ({ id, body }) => updateTask(id, body), ...options, onSuccess: (...args) => { @@ -220,10 +220,10 @@ export function useUpdateTask( } export function useDeleteTask( - options?: Omit>, ApiError, string>, 'mutationFn'>, + options?: Omit>, ApiError, Parameters[0]>, 'mutationFn'>, ) { const queryClient = useQueryClient() - return useMutation>, ApiError, string>({ + return useMutation>, ApiError, Parameters[0]>({ mutationFn: (id) => deleteTask(id), ...options, onSuccess: (...args) => { @@ -246,7 +246,7 @@ import { createTask, deleteTask, getTask, listTasks, updateTask, type ApiError } export const taskKeys = { all: () => ["tasks"] as const, list: (params?: Parameters[0]) => ["tasks", 'list', params] as const, - detail: (id: string) => ["tasks", id] as const, + detail: (id: Parameters[0]) => ["tasks", id] as const, } // ── Query options factories ────────────────────────────────── @@ -265,7 +265,7 @@ export function listTasksQueryOptions( } export function getTaskQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -322,7 +322,7 @@ export function useListTasksInfinite( } export function useGetTask( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -336,7 +336,7 @@ export function useGetTask( } export function useSuspenseGetTask( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useSuspenseQuery>, ApiError>({ @@ -365,10 +365,10 @@ export function useCreateTask( } export function useUpdateTask( - options?: Omit>, ApiError, { id: string; body: Parameters[1] }>, 'mutationFn'>, + options?: Omit>, ApiError, { id: Parameters[0]; body: Parameters[1] }>, 'mutationFn'>, ) { const queryClient = useQueryClient() - return useMutation>, ApiError, { id: string; body: Parameters[1] }>({ + return useMutation>, ApiError, { id: Parameters[0]; body: Parameters[1] }>({ mutationFn: ({ id, body }) => updateTask(id, body), ...options, onSuccess: (...args) => { @@ -381,10 +381,10 @@ export function useUpdateTask( } export function useDeleteTask( - options?: Omit>, ApiError, string>, 'mutationFn'>, + options?: Omit>, ApiError, Parameters[0]>, 'mutationFn'>, ) { const queryClient = useQueryClient() - return useMutation>, ApiError, string>({ + return useMutation>, ApiError, Parameters[0]>({ mutationFn: (id) => deleteTask(id), ...options, onSuccess: (...args) => { @@ -407,7 +407,7 @@ import { createTask, deleteTask, getTask, listTasks, updateTask, type ApiError } export const taskKeys = { all: () => ["tasks"] as const, list: (params?: Parameters[0]) => ["tasks", 'list', params] as const, - detail: (id: string) => ["tasks", id] as const, + detail: (id: Parameters[0]) => ["tasks", id] as const, } // ── Query options factories ────────────────────────────────── @@ -426,7 +426,7 @@ export function listTasksQueryOptions( } export function getTaskQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -470,7 +470,7 @@ export function useListTasksInfinite( } export function useGetTask( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -495,18 +495,18 @@ export function useCreateTask( } export function useUpdateTask( - options?: Omit>, ApiError, { id: string; body: Parameters[1] }>, 'mutationFn'>, + options?: Omit>, ApiError, { id: Parameters[0]; body: Parameters[1] }>, 'mutationFn'>, ) { - return useMutation>, ApiError, { id: string; body: Parameters[1] }>({ + return useMutation>, ApiError, { id: Parameters[0]; body: Parameters[1] }>({ mutationFn: ({ id, body }) => updateTask(id, body), ...options, }) } export function useDeleteTask( - options?: Omit>, ApiError, string>, 'mutationFn'>, + options?: Omit>, ApiError, Parameters[0]>, 'mutationFn'>, ) { - return useMutation>, ApiError, string>({ + return useMutation>, ApiError, Parameters[0]>({ mutationFn: (id) => deleteTask(id), ...options, }) @@ -525,7 +525,7 @@ import { createTask, deleteTask, getTask, listTasks, updateTask, type ApiError } export const taskKeys = { all: () => ["tasks"] as const, list: (params?: Parameters[0]) => ["tasks", 'list', params] as const, - detail: (id: string) => ["tasks", id] as const, + detail: (id: Parameters[0]) => ["tasks", id] as const, } // ── Query options factories ────────────────────────────────── @@ -544,7 +544,7 @@ export function listTasksQueryOptions( } export function getTaskQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -588,7 +588,7 @@ export function useListTasksInfinite( } export function useGetTask( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -613,18 +613,18 @@ export function useCreateTask( } export function useUpdateTask( - options?: Omit>, ApiError, { id: string; body: Parameters[1] }>, 'mutationFn'>, + options?: Omit>, ApiError, { id: Parameters[0]; body: Parameters[1] }>, 'mutationFn'>, ) { - return useMutation>, ApiError, { id: string; body: Parameters[1] }>({ + return useMutation>, ApiError, { id: Parameters[0]; body: Parameters[1] }>({ mutationFn: ({ id, body }) => updateTask(id, body), ...options, }) } export function useDeleteTask( - options?: Omit>, ApiError, string>, 'mutationFn'>, + options?: Omit>, ApiError, Parameters[0]>, 'mutationFn'>, ) { - return useMutation>, ApiError, string>({ + return useMutation>, ApiError, Parameters[0]>({ mutationFn: (id) => deleteTask(id), ...options, }) @@ -643,7 +643,7 @@ import { createTask, deleteTask, getTask, listTasks, updateTask, type ApiError } export const taskKeys = { all: () => ["tasks"] as const, list: (params?: Parameters[0]) => ["tasks", 'list', params] as const, - detail: (id: string) => ["tasks", id] as const, + detail: (id: Parameters[0]) => ["tasks", id] as const, } // ── Query options factories ────────────────────────────────── @@ -662,7 +662,7 @@ export function listTasksQueryOptions( } export function getTaskQueryOptions( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return queryOptions>, ApiError>({ @@ -719,7 +719,7 @@ export function useListTasksInfinite( } export function useGetTask( - id: string | undefined | null, + id: Parameters[0] | undefined | null, options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useQuery>, ApiError>({ @@ -733,7 +733,7 @@ export function useGetTask( } export function useSuspenseGetTask( - id: string, + id: Parameters[0], options?: Omit>, ApiError>, 'queryKey' | 'queryFn'>, ) { return useSuspenseQuery>, ApiError>({ @@ -757,18 +757,18 @@ export function useCreateTask( } export function useUpdateTask( - options?: Omit>, ApiError, { id: string; body: Parameters[1] }>, 'mutationFn'>, + options?: Omit>, ApiError, { id: Parameters[0]; body: Parameters[1] }>, 'mutationFn'>, ) { - return useMutation>, ApiError, { id: string; body: Parameters[1] }>({ + return useMutation>, ApiError, { id: Parameters[0]; body: Parameters[1] }>({ mutationFn: ({ id, body }) => updateTask(id, body), ...options, }) } export function useDeleteTask( - options?: Omit>, ApiError, string>, 'mutationFn'>, + options?: Omit>, ApiError, Parameters[0]>, 'mutationFn'>, ) { - return useMutation>, ApiError, string>({ + return useMutation>, ApiError, Parameters[0]>({ mutationFn: (id) => deleteTask(id), ...options, }) diff --git a/packages/openapi-react-query/src/__tests__/hooks.test.ts b/packages/openapi-react-query/src/__tests__/hooks.test.ts index 6d7b738..72f4590 100644 --- a/packages/openapi-react-query/src/__tests__/hooks.test.ts +++ b/packages/openapi-react-query/src/__tests__/hooks.test.ts @@ -125,7 +125,7 @@ describe('generateHooks — task-hooks.json fixture', () => { it('useGetTask accepts id as positional arg and uses taskKeys.detail(id!)', () => { expect(content).toContain('useGetTask') - expect(content).toContain('id: string | undefined | null') + expect(content).toContain('id: Parameters[0] | undefined | null') expect(content).toContain('queryKey: taskKeys.detail(id!)') }) @@ -134,9 +134,9 @@ describe('generateHooks — task-hooks.json fixture', () => { expect(content).toContain('Parameters[0]') }) - it('useUpdateTask variables type has { id: string; body: Parameters[1] }', () => { + it('useUpdateTask variables type has { id: Parameters[0]; body: Parameters[1] }', () => { expect(content).toContain('useUpdateTask') - expect(content).toContain('{ id: string; body: Parameters[1] }') + expect(content).toContain('{ id: Parameters[0]; body: Parameters[1] }') }) it('useUpdateTask mutationFn destructures { id, body }', () => { @@ -170,7 +170,7 @@ describe('generateHooks — task-hooks.json fixture', () => { describe('generateHooks — Feature #61: nullish path params auto-disable', () => { it('useGetTask signature contains string | undefined | null for id', () => { - expect(content).toContain('id: string | undefined | null') + expect(content).toContain('id: Parameters[0] | undefined | null') }) it('useGetTask generated hook contains enabled: id != null guard', () => { @@ -210,8 +210,8 @@ describe('generateHooks — Feature #61: nullish path params auto-disable', () = }, } const { content: c } = generateHooks(specMultiParam, { staleTime: 0, gcTime: 0 }) - expect(c).toContain('projectId: string | undefined | null') - expect(c).toContain('id: string | undefined | null') + expect(c).toContain('projectId: Parameters[0] | undefined | null') + expect(c).toContain('id: Parameters[1] | undefined | null') expect(c).toContain('enabled: projectId != null && id != null && (options?.enabled ?? true)') }) }) @@ -319,8 +319,8 @@ describe('generateHooks — Bug #53: key factory includes query params when oper it('key factory detail entry includes optional params when path + optional query params', () => { const { content } = generateHooks(specWithPathAndQueryParams, { staleTime: 0, gcTime: 0 }) - // Key factory should accept (uuid: string, params?) - expect(content).toContain('(uuid: string, params?: Parameters[1])') + // Key factory should accept (uuid: Parameters[0], params?) + expect(content).toContain('(uuid: Parameters[0], params?: Parameters[1])') }) it('key factory detail entry includes params value in tuple', () => { @@ -340,7 +340,7 @@ describe('generateHooks — Bug #53: key factory includes query params when oper gcTime: 0, }) // Key factory should accept required params (no ?) - expect(content).toContain('(id: string, params: Parameters[1])') + expect(content).toContain('(id: Parameters[0], params: Parameters[1])') }) it('hook marks params as required when path param + required query param', () => { @@ -440,7 +440,7 @@ describe('generateHooks — Bug #54: mutation hook handles all argument shapes', } const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0 }) // Variables includes id, body, and params - expect(content).toContain('id: string') + expect(content).toContain('id: Parameters[0]') expect(content).toContain('body: Parameters[1]') expect(content).toContain('params: Parameters[2]') // mutationFn destructures all three and passes in correct order @@ -466,7 +466,7 @@ describe('generateHooks — Bug #54: mutation hook handles all argument shapes', } const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0 }) // Variables includes id and params - expect(content).toContain('id: string') + expect(content).toContain('id: Parameters[0]') expect(content).toContain('params: Parameters[1]') // mutationFn destructures and passes both expect(content).toContain('({ id, params }) => deleteOp(id, params)') @@ -617,12 +617,12 @@ describe('generateHooks — Feature #60: suspense query variants', () => { it('suspense detail hook path params are required string (not nullish)', () => { const { content } = generateHooks(suspenseSpec, { staleTime: 0, gcTime: 0, suspense: true }) - // useSuspenseGetTask should have id: string (not string | undefined | null) + // useSuspenseGetTask should have id: Parameters[0] (not nullish widened) const suspenseHookStart = content.indexOf('export function useSuspenseGetTask') const suspenseHookEnd = content.indexOf('\n}', suspenseHookStart) + 2 const suspenseHookContent = content.slice(suspenseHookStart, suspenseHookEnd) - expect(suspenseHookContent).toContain('id: string') - expect(suspenseHookContent).not.toContain('id: string | undefined | null') + expect(suspenseHookContent).toContain('id: Parameters[0]') + expect(suspenseHookContent).not.toContain('id: Parameters[0] | undefined | null') }) it('when suspense: false (default), no useSuspense* hooks generated', () => { @@ -658,7 +658,7 @@ describe('generateHooks — Feature #60: suspense query variants', () => { } const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0, suspense: true }) expect(content).toContain('export function useSuspenseListRepoCommits') - expect(content).toContain('repoId: string') + expect(content).toContain('repoId: Parameters[0]') expect(content).toContain('params?:') }) @@ -682,7 +682,7 @@ describe('generateHooks — Feature #60: suspense query variants', () => { } const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0, suspense: true }) expect(content).toContain('export function useSuspenseSearchCategory') - expect(content).toContain('category: string') + expect(content).toContain('category: Parameters[0]') // Required query param → non-optional params token (no ?) expect(content).toContain('params: Parameters') }) @@ -708,8 +708,8 @@ describe('generateHooks — Feature #60: suspense query variants', () => { const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0, suspense: true }) expect(content).toContain('export function useSuspenseGetOrgRepo') // Both path params appear in the function signature - expect(content).toContain('orgId: string') - expect(content).toContain('repoId: string') + expect(content).toContain('orgId: Parameters[0]') + expect(content).toContain('repoId: Parameters[1]') }) it('suspense hook with 2 path params + query params builds correct queryKey', () => { @@ -733,8 +733,8 @@ describe('generateHooks — Feature #60: suspense query variants', () => { } const { content } = generateHooks(spec, { staleTime: 0, gcTime: 0, suspense: true }) expect(content).toContain('export function useSuspenseListOrgRepoCommits') - expect(content).toContain('orgId: string') - expect(content).toContain('repoId: string') + expect(content).toContain('orgId: Parameters[0]') + expect(content).toContain('repoId: Parameters[1]') expect(content).toContain('params?:') }) @@ -1310,33 +1310,34 @@ describe('mutation hook variables type — all 12 shapes', () => { expect(shapesContent).toContain('mutationFn: ({ body, params }) => postD(body, params)') }) - it('case 5 (1 path param, no body, no query): variablesType is string, mutationFn is (id) => fn(id)', () => { - // string is the entire variables type — only case that uses literal 'string' + it('case 5 (1 path param, no body, no query): variablesType is Parameters[0], mutationFn is (id) => fn(id)', () => { expect(shapesContent).toContain( - 'UseMutationOptions>, ApiError, string>' + 'UseMutationOptions>, ApiError, Parameters[0]>' ) expect(shapesContent).toContain('mutationFn: (id) => deleteE(id)') }) - it('case 6 (1 path param, no body, has query): variablesType is { id: string; params: ...[1] }, mutationFn destructures { id, params }', () => { - expect(shapesContent).toContain('id: string; params: Parameters[1]') + it('case 6 (1 path param, no body, has query): variablesType is { id: Parameters[0]; params: ...[1] }, mutationFn destructures { id, params }', () => { + expect(shapesContent).toContain('id: Parameters[0]; params: Parameters[1]') expect(shapesContent).toContain('mutationFn: ({ id, params }) => deleteF(id, params)') }) - it('case 7 (1 path param, has body, no query): variablesType is { id: string; body: ...[1] }, mutationFn destructures { id, body }', () => { - expect(shapesContent).toContain('id: string; body: Parameters[1]') + it('case 7 (1 path param, has body, no query): variablesType is { id: Parameters[0]; body: ...[1] }, mutationFn destructures { id, body }', () => { + expect(shapesContent).toContain('id: Parameters[0]; body: Parameters[1]') expect(shapesContent).toContain('mutationFn: ({ id, body }) => putG(id, body)') }) it('case 8 (1 path param, has body, has query): variablesType is { id: string; body: ...[1]; params: ...[2] }, mutationFn destructures all', () => { expect(shapesContent).toContain( - 'id: string; body: Parameters[1]; params: Parameters[2]' + 'id: Parameters[0]; body: Parameters[1]; params: Parameters[2]' ) expect(shapesContent).toContain('mutationFn: ({ id, body, params }) => putH(id, body, params)') }) it('case 9 (2+ params, no body, no query): variablesType is { projectId: string; taskId: string }, mutationFn destructures both path params', () => { - expect(shapesContent).toContain('projectId: string; taskId: string }') + expect(shapesContent).toContain( + 'projectId: Parameters[0]; taskId: Parameters[1] }' + ) expect(shapesContent).toContain( 'mutationFn: ({ projectId, taskId }) => deleteI(projectId, taskId)' ) @@ -1344,7 +1345,7 @@ describe('mutation hook variables type — all 12 shapes', () => { it('case 10 (2+ params, no body, has query): variablesType includes both path params and params, mutationFn passes all', () => { expect(shapesContent).toContain( - 'projectId: string; taskId: string; params: Parameters[2]' + 'projectId: Parameters[0]; taskId: Parameters[1]; params: Parameters[2]' ) expect(shapesContent).toContain( 'mutationFn: ({ projectId, taskId, params }) => deleteJ(projectId, taskId, params)' @@ -1353,7 +1354,7 @@ describe('mutation hook variables type — all 12 shapes', () => { it('case 11 (2+ params, has body, no query): variablesType includes both path params and body at index [2]', () => { expect(shapesContent).toContain( - 'projectId: string; taskId: string; body: Parameters[2]' + 'projectId: Parameters[0]; taskId: Parameters[1]; body: Parameters[2]' ) expect(shapesContent).toContain( 'mutationFn: ({ projectId, taskId, body }) => putK(projectId, taskId, body)' @@ -1362,7 +1363,7 @@ describe('mutation hook variables type — all 12 shapes', () => { it('case 12 (2+ params, has body, has query): variablesType includes both path params, body at [2], params at [3]', () => { expect(shapesContent).toContain( - 'projectId: string; taskId: string; body: Parameters[2]; params: Parameters[3]' + 'projectId: Parameters[0]; taskId: Parameters[1]; body: Parameters[2]; params: Parameters[3]' ) expect(shapesContent).toContain( 'mutationFn: ({ projectId, taskId, body, params }) => putL(projectId, taskId, body, params)' @@ -1519,12 +1520,18 @@ describe('query hook key builder — 2+ path params with query params', () => { }) it('key factory detail entry accepts both path params as typed args', () => { - expect(multiParamContent).toContain('(projectId: string, taskId: string,') + expect(multiParamContent).toContain( + '(projectId: Parameters[0], taskId: Parameters[1],' + ) }) - it('hook signature includes both path params as string | undefined | null', () => { - expect(multiParamContent).toContain('projectId: string | undefined | null') - expect(multiParamContent).toContain('taskId: string | undefined | null') + it('hook signature includes both path params as typed (derived) | undefined | null', () => { + expect(multiParamContent).toContain( + 'projectId: Parameters[0] | undefined | null' + ) + expect(multiParamContent).toContain( + 'taskId: Parameters[1] | undefined | null' + ) }) it('enabled guard ANDs both path params', () => { @@ -2018,13 +2025,13 @@ describe('Feature #188: queryOptions factories', () => { expect(factoryBody).not.toContain('taskKeys.detail(id!)') }) - it('getTaskQueryOptions path param is plain string (not nullish widened)', () => { - // Factory takes id: string (not string | undefined | null) + it('getTaskQueryOptions path param is plain (not nullish widened)', () => { + // Factory takes the derived param type (not widened with | undefined | null) const factoryStart = qoContent.indexOf('export function getTaskQueryOptions') const factoryEnd = qoContent.indexOf('\n}', factoryStart) + 2 const factoryBody = qoContent.slice(factoryStart, factoryEnd) - expect(factoryBody).toContain('id: string') - expect(factoryBody).not.toContain('id: string | undefined | null') + expect(factoryBody).toContain('id: Parameters[0]') + expect(factoryBody).not.toContain('| undefined | null') }) it('listTasksQueryOptions contains staleTime and gcTime', () => { @@ -2133,9 +2140,9 @@ describe('Feature #188: queryOptions factories', () => { expect(factoryStart).toBeGreaterThan(-1) const factoryEnd = mpContent.indexOf('\n}', factoryStart) + 2 const factoryBody = mpContent.slice(factoryStart, factoryEnd) - // Plain strings, no nullish widening - expect(factoryBody).toContain('projectId: string') - expect(factoryBody).toContain('taskId: string') + // Derived param types, no nullish widening + expect(factoryBody).toContain('projectId: Parameters[0]') + expect(factoryBody).toContain('taskId: Parameters[1]') expect(factoryBody).not.toContain('projectId!') expect(factoryBody).not.toContain('taskId!') expect(factoryBody).not.toContain('| undefined | null') diff --git a/packages/openapi-react-query/src/plugins/hooks.ts b/packages/openapi-react-query/src/plugins/hooks.ts index e380453..644f756 100644 --- a/packages/openapi-react-query/src/plugins/hooks.ts +++ b/packages/openapi-react-query/src/plugins/hooks.ts @@ -352,24 +352,28 @@ function buildKeyFactory(resource: string, entries: KeyEntry[]): string { // detail: (id) => ['resource', id] or getItemUsage: (id) => ['resource', 'getItemUsage', id] const param = entry.pathParams[0]! lines.push( - ` ${entry.key}: (${param}: string) => [${JSON.stringify(resource)}, ${keySegment}${param}] as const,` + ` ${entry.key}: (${param}: Parameters[0]) => [${JSON.stringify(resource)}, ${keySegment}${param}] as const,` ) } else if (entry.pathParams.length === 1 && entry.hasQueryParams) { // detail with query params const param = entry.pathParams[0]! lines.push( - ` ${entry.key}: (${param}: string, ${paramsArg}) => [${JSON.stringify(resource)}, ${keySegment}${param}, params] as const,` + ` ${entry.key}: (${param}: Parameters[0], ${paramsArg}) => [${JSON.stringify(resource)}, ${keySegment}${param}, params] as const,` ) } else if (!entry.hasQueryParams) { // multiple path params, no query params - const paramList = entry.pathParams.map((p) => `${p}: string`).join(', ') + const paramList = entry.pathParams + .map((p, i) => `${p}: Parameters[${i}]`) + .join(', ') const paramValues = entry.pathParams.join(', ') lines.push( ` ${entry.key}: (${paramList}) => [${JSON.stringify(resource)}, ${keySegment}${paramValues}] as const,` ) } else { // multiple path params + query params - const paramList = entry.pathParams.map((p) => `${p}: string`).join(', ') + const paramList = entry.pathParams + .map((p, i) => `${p}: Parameters[${i}]`) + .join(', ') const paramValues = entry.pathParams.join(', ') lines.push( ` ${entry.key}: (${paramList}, ${paramsArg}) => [${JSON.stringify(resource)}, ${keySegment}${paramValues}, params] as const,` @@ -433,11 +437,13 @@ function buildQueryOptionsFactory( const paramsRequired = keyEntry.hasRequiredQueryParams const pathParams = op.pathParams - // Build parameter list (path params are plain strings here, no nullish widening) + // Build parameter list. Path param types are derived from the client function + // signature (Parameters[i]) rather than hard-coded to string, so + // integer path params stay typed as number (#300). No nullish widening here. const sigParts: string[] = [] - for (const p of pathParams) { - sigParts.push(`${p}: string`) - } + pathParams.forEach((p, i) => { + sigParts.push(`${p}: Parameters[${i}]`) + }) if (hasQueryParams) { const paramsToken = paramsRequired ? 'params' : 'params?' sigParts.push(`${paramsToken}: Parameters[${pathParams.length}]`) @@ -496,10 +502,11 @@ function buildQueryHook( // Build parameter list const sigParts: string[] = [] - for (const p of pathParams) { - // Widen path param types to allow nullish values — enables auto-disable without !!id boilerplate - sigParts.push(`${p}: string | undefined | null`) - } + pathParams.forEach((p, i) => { + // Widen path param types to allow nullish values — enables auto-disable without !!id boilerplate. + // The base type is derived from the client function so integer params stay number (#300). + sigParts.push(`${p}: Parameters[${i}] | undefined | null`) + }) if (hasQueryParams) { const paramsToken = paramsRequired ? 'params' : 'params?' sigParts.push(`${paramsToken}: Parameters[${pathParams.length}]`) @@ -556,11 +563,12 @@ function buildSuspenseQueryHook( const paramsRequired = keyEntry.hasRequiredQueryParams const pathParams = op.pathParams - // Suspense hooks require path params (no nullish widening — suspense doesn't support enabled) + // Suspense hooks require path params (no nullish widening — suspense doesn't support enabled). + // Path param types are derived from the client function so integer params stay number (#300). const sigParts: string[] = [] - for (const p of pathParams) { - sigParts.push(`${p}: string`) - } + pathParams.forEach((p, i) => { + sigParts.push(`${p}: Parameters[${i}]`) + }) if (hasQueryParams) { const paramsToken = paramsRequired ? 'params' : 'params?' sigParts.push(`${paramsToken}: Parameters[${pathParams.length}]`) @@ -734,32 +742,35 @@ function buildMutationVars( const param = pathParams[0]! if (!hasBody && !hasQueryParams) { return { - variablesType: 'string', + variablesType: `Parameters[0]`, mutationFnBody: `(${param}) => ${funcName}(${param})`, } } if (!hasBody && hasQueryParams) { // 1 path param + params only return { - variablesType: `{ ${param}: string; params: Parameters[${paramsArgIndex}] }`, + variablesType: `{ ${param}: Parameters[0]; params: Parameters[${paramsArgIndex}] }`, mutationFnBody: `({ ${param}, params }) => ${funcName}(${param}, params)`, } } if (hasBody && !hasQueryParams) { return { - variablesType: `{ ${param}: string; body: Parameters[1] }`, + variablesType: `{ ${param}: Parameters[0]; body: Parameters[1] }`, mutationFnBody: `({ ${param}, body }) => ${funcName}(${param}, body)`, } } // 1 path param + body + params return { - variablesType: `{ ${param}: string; body: Parameters[1]; params: Parameters[${paramsArgIndex}] }`, + variablesType: `{ ${param}: Parameters[0]; body: Parameters[1]; params: Parameters[${paramsArgIndex}] }`, mutationFnBody: `({ ${param}, body, params }) => ${funcName}(${param}, body, params)`, } } - // Multiple path params - const fields = pathParams.map((p) => `${p}: string`).join('; ') + // Multiple path params. Each path param type is derived from its positional + // index in the client function so integer params stay number (#300). + const fields = pathParams + .map((p, i) => `${p}: Parameters[${i}]`) + .join('; ') if (!hasBody && !hasQueryParams) { const destructured = pathParams.join(', ') return { diff --git a/packages/openapi-zod-ts/src/__tests__/client.test.ts b/packages/openapi-zod-ts/src/__tests__/client.test.ts index 8ee4929..2ac609f 100644 --- a/packages/openapi-zod-ts/src/__tests__/client.test.ts +++ b/packages/openapi-zod-ts/src/__tests__/client.test.ts @@ -220,13 +220,16 @@ describe('required query params', () => { }) describe('inline response schemas', () => { - it('inline object response → Record', async () => { - // searchPosts in blog-api has an inline object response + it('inline object response with properties is expanded to a typed object (#298)', async () => { + // searchPosts in blog-api has an inline object response { results: Post[]; total } const spec = await parseSpec(join(__dirname, '../__fixtures__/specs/blog-api.json')) const out = generateClient(spec).content expect(out).toContain('searchPosts') - // inline object: Record (not 'unknown') - expect(out).toContain('Promise>') + // The inline object must be expanded, not collapsed to the Record catch-all. + expect(out).not.toContain('Promise>') + expect(out).toContain('Promise<{ results?: Post[]; total?: number }>') + // The referenced component schema must be imported from ./models.js. + expect(out).toMatch(/import type \{[^}]*\bPost\b[^}]*\} from '\.\/models\.js'/) }) it('primitive response schema → correct primitive type', async () => { diff --git a/packages/openapi-zod-ts/src/__tests__/codegen-typing-298-299-300.test.ts b/packages/openapi-zod-ts/src/__tests__/codegen-typing-298-299-300.test.ts new file mode 100644 index 0000000..76139b4 --- /dev/null +++ b/packages/openapi-zod-ts/src/__tests__/codegen-typing-298-299-300.test.ts @@ -0,0 +1,372 @@ +/** + * Regression tests for codegen typing bugs #298, #299, #300. + * + * #298 - Inline object response schemas produce Record + * #299 - Array query params with bracket notation (ids[]) typed as unknown and serialized flat + * #300 - Path params typed as string instead of number via $ref to shared parameter component + * + * Each test is written first (TDD) to confirm the existing failure, then a fix is applied. + */ +import { describe, it, expect } from 'vitest' +import type { OpenAPIV3_1 } from 'openapi-types' +import { generateClient } from '../plugins/client.js' +import { generateClientConfig } from '../plugins/client-config.js' +import { generateTypes } from '../plugins/types.js' +import { compileFiles } from './helpers.js' + +// --------------------------------------------------------------------------- +// Bug #298: Inline object response schema produces Record +// --------------------------------------------------------------------------- + +describe('Bug #298: inline object response schema is expanded', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Users API', version: '1' }, + components: { + schemas: { + User: { + type: 'object', + properties: { id: { type: 'integer' }, name: { type: 'string' } }, + }, + }, + }, + paths: { + '/users': { + get: { + operationId: 'listUsers', + responses: { + '200': { + content: { + 'application/json': { + schema: { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'array', + items: { $ref: '#/components/schemas/User' }, + }, + total: { type: 'integer' }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + it('return type is an expanded inline object, not Record', () => { + const { content } = generateClient(spec) + // Must NOT fall back to the Record catch-all + expect(content).not.toContain('Promise>') + // Must expand the inline properties + expect(content).toContain('data: User[]') + expect(content).toContain('total?: number') + }) + + it('required properties are non-optional and optional properties carry ?', () => { + const { content } = generateClient(spec) + // data is in required[], total is not + expect(content).toContain('data: User[]') + expect(content).not.toMatch(/data\?:\s*User\[\]/) + expect(content).toContain('total?: number') + }) + + it('generated client compiles without TypeScript errors', () => { + const modelsContent = generateTypes(spec).content + const clientContent = generateClient(spec).content + const configContent = generateClientConfig().content + + const diagnostics = compileFiles({ + 'models.ts': modelsContent, + 'client-config.ts': configContent, + 'client.ts': clientContent, + }) + expect(diagnostics).toHaveLength(0) + }) +}) + +describe('Bug #298: inline object with only additionalProperties still produces Record', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Dict API', version: '1' }, + paths: { + '/dict': { + get: { + operationId: 'getDict', + responses: { + '200': { + content: { + 'application/json': { + schema: { + type: 'object', + additionalProperties: { type: 'string' }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + it('additionalProperties-only object still maps to Record', () => { + const { content } = generateClient(spec) + expect(content).toContain('Promise>') + }) +}) + +// --------------------------------------------------------------------------- +// Bug #299: Array query params with bracket notation +// --------------------------------------------------------------------------- + +describe('Bug #299: bracket-notation array query params keep wire name as interface key', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Search API', version: '1' }, + paths: { + '/search': { + get: { + operationId: 'search', + parameters: [ + { + name: 'ids[]', + in: 'query', + required: false, + schema: { type: 'array', items: { type: 'integer' } }, + style: 'form', + explode: true, + }, + ], + responses: { + '200': { + content: { + 'application/json': { + schema: { type: 'array', items: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + }, + } + + it('params interface key is the wire name "ids[]" (with bracket notation)', () => { + const { content } = generateClient(spec) + // The interface should preserve the bracket notation in the key + expect(content).toContain('"ids[]"') + // The normalized plain name should NOT appear as the field key + expect(content).not.toMatch(/params\?\s*:\s*\{[^}]*\bids\?:\s*number/) + }) + + it('params field is typed number[] for integer array items', () => { + const { content } = generateClient(spec) + expect(content).toContain("'ids[]'?: number[]") + }) + + it('serialization uses for-of loop with append (not String() + set)', () => { + const { content } = generateClient(spec) + // Must use for...of with append (multi-value serialization) + expect(content).toContain('searchParams.append') + expect(content).not.toMatch(/searchParams\.set\('ids\[\]'/) + // Must iterate over the wire-name key + expect(content).toContain('params["ids[]"]') + }) + + it('serialization appends with the wire key "ids[]"', () => { + const { content } = generateClient(spec) + expect(content).toContain("searchParams.append('ids[]'") + }) +}) + +describe('Bug #299: string array bracket-notation param', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Tags API', version: '1' }, + paths: { + '/items': { + get: { + operationId: 'listItems', + parameters: [ + { + name: 'tags[]', + in: 'query', + required: false, + schema: { type: 'array', items: { type: 'string' } }, + }, + ], + responses: { + '200': { + content: { + 'application/json': { schema: { type: 'array', items: { type: 'string' } } }, + }, + }, + }, + }, + }, + }, + } + + it('string array bracket param is typed string[]', () => { + const { content } = generateClient(spec) + expect(content).toContain("'tags[]'?: string[]") + }) +}) + +describe('Bug #299: non-bracket params still use normalized name', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Items API', version: '1' }, + paths: { + '/items': { + get: { + operationId: 'listItems', + parameters: [ + { + name: 'place.fields', + in: 'query', + required: false, + schema: { type: 'string' }, + }, + ], + responses: { + '200': { + content: { + 'application/json': { schema: { type: 'array', items: { type: 'string' } } }, + }, + }, + }, + }, + }, + }, + } + + it('non-bracket dot-separated param is still normalized to camelCase', () => { + const { content } = generateClient(spec) + // Dot-separated names are still normalized (camelCase) + expect(content).toContain('placeFields?: string') + }) +}) + +// --------------------------------------------------------------------------- +// Bug #300: Path params typed as string instead of number via $ref +// --------------------------------------------------------------------------- + +describe('Bug #300: path param via $ref to component with integer schema typed as number', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Users API', version: '1' }, + components: { + parameters: { + PathId: { + name: 'id', + in: 'path', + required: true, + schema: { type: 'integer', minimum: 1 }, + }, + }, + schemas: { + User: { + type: 'object', + properties: { id: { type: 'integer' }, name: { type: 'string' } }, + }, + }, + }, + paths: { + '/users/{id}': { + get: { + operationId: 'getUserById', + parameters: [{ $ref: '#/components/parameters/PathId' } as any], + responses: { + '200': { + content: { + 'application/json': { schema: { $ref: '#/components/schemas/User' } }, + }, + }, + }, + }, + }, + }, + } + + it('path param referenced via $ref with integer schema is typed number, not string', () => { + const { content } = generateClient(spec) + expect(content).toContain('id: number') + expect(content).not.toMatch(/getUserById\([^)]*id:\s*string/) + }) + + it('generated client with $ref path param compiles without TypeScript errors', () => { + const modelsContent = generateTypes(spec).content + const clientContent = generateClient(spec).content + const configContent = generateClientConfig().content + + const diagnostics = compileFiles({ + 'models.ts': modelsContent, + 'client-config.ts': configContent, + 'client.ts': clientContent, + }) + expect(diagnostics).toHaveLength(0) + }) +}) + +describe('Bug #300: inline path param with integer schema also typed number', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Posts API', version: '1' }, + paths: { + '/posts/{postId}': { + get: { + operationId: 'getPost', + parameters: [ + { name: 'postId', in: 'path', required: true, schema: { type: 'integer' } }, + ], + responses: { + '200': { + content: { + 'application/json': { schema: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + } + + it('inline path param with integer schema is typed number', () => { + const { content } = generateClient(spec) + expect(content).toContain('postId: number') + expect(content).not.toMatch(/getPost\([^)]*postId:\s*string/) + }) +}) + +describe('Bug #300: path param with string schema stays typed as string', () => { + const spec: OpenAPIV3_1.Document = { + openapi: '3.1.0', + info: { title: 'Fictional Items API', version: '1' }, + paths: { + '/items/{slug}': { + get: { + operationId: 'getItem', + parameters: [{ name: 'slug', in: 'path', required: true, schema: { type: 'string' } }], + responses: { + '200': { + content: { + 'application/json': { schema: { type: 'string' } }, + }, + }, + }, + }, + }, + }, + } + + it('path param with string schema stays string', () => { + const { content } = generateClient(spec) + expect(content).toContain('slug: string') + }) +}) diff --git a/packages/openapi-zod-ts/src/plugins/client.ts b/packages/openapi-zod-ts/src/plugins/client.ts index ae676d7..055e602 100644 --- a/packages/openapi-zod-ts/src/plugins/client.ts +++ b/packages/openapi-zod-ts/src/plugins/client.ts @@ -52,15 +52,31 @@ function resolveDeepRefToTs( } /** - * Resolve the TypeScript Record type for an inline object schema. - * When additionalProperties is a schema object, recurse to produce Record. - * Otherwise fall back to Record. + * Resolve the TypeScript type for an inline object schema. + * + * Priority: + * 1. When the schema has explicit `properties`, expand them to an inline object + * type respecting the `required` array (missing from required -> optional `?`). + * 2. When the schema has only `additionalProperties` (no explicit properties), + * produce Record where T is the value schema. + * 3. Fall back to Record. */ function inlineObjectSchemaToTs( s: SchemaObject, spec?: OpenAPIV3_1.Document, visited?: Set ): string { + const props = s.properties as Record | undefined + if (props !== undefined && Object.keys(props).length > 0) { + const required = new Set(Array.isArray(s.required) ? (s.required as string[]) : []) + const fields = Object.entries(props).map(([key, propSchema]) => { + const optional = !required.has(key) + const propKey = toPropertyKey(key) + const typStr = inlineSchemaToTs(propSchema, spec, visited) + return `${propKey}${optional ? '?' : ''}: ${typStr}` + }) + return `{ ${fields.join('; ')} }` + } if ( s.additionalProperties !== undefined && s.additionalProperties !== true && @@ -143,6 +159,70 @@ function resolveSchema( return { typeName: inlineSchemaToTs(s, spec), isArray: false } } +/** + * Walk a schema tree and collect the names of every component schema $ref + * (#/components/schemas/X), mapped through refToTypeName. These are the named + * types the generated client must import from ./models.js when a response type + * is an inline-expanded object or array that references component schemas + * (e.g. an envelope { data: User[]; total?: number }). + * + * Mirrors the traversal in inlineSchemaToTs so the collected set matches exactly + * what the rendered type string references: deep (non-component) refs are + * resolved inline by inlineSchemaToTs, so we follow them here too in case their + * targets contain component refs. A visited set breaks ref cycles. + */ +// fallow-ignore-next-line complexity +function collectComponentRefNames( + schema: SchemaObject | ReferenceObject | undefined, + spec: OpenAPIV3_1.Document, + out: Set, + visited?: Set +): void { + if (schema === undefined) return + const visitedSet = visited ?? new Set() + if (isRef(schema)) { + const ref = (schema as ReferenceObject).$ref + if (isDeepRef(ref)) { + if (visitedSet.has(ref)) return + visitedSet.add(ref) + const resolved = resolveJsonPointer(spec, ref) as SchemaObject | ReferenceObject | undefined + collectComponentRefNames(resolved, spec, out, visitedSet) + visitedSet.delete(ref) + return + } + const name = refToTypeName(ref) + if (isImportableType(name)) out.add(name) + return + } + const s = schema as SchemaObject + if (s.type === 'array') { + const items = (s as OpenAPIV3_1.ArraySchemaObject).items as + | SchemaObject + | ReferenceObject + | undefined + collectComponentRefNames(items, spec, out, visitedSet) + return + } + const props = s.properties as Record | undefined + if (props !== undefined) { + for (const propSchema of Object.values(props)) { + collectComponentRefNames(propSchema, spec, out, visitedSet) + } + } + if ( + s.additionalProperties !== undefined && + s.additionalProperties !== true && + s.additionalProperties !== false + ) { + collectComponentRefNames( + s.additionalProperties as SchemaObject | ReferenceObject, + spec, + out, + visitedSet + ) + } +} + function primitiveToTs(type: string | undefined): string { switch (type) { case 'string': @@ -279,7 +359,8 @@ function pickResponseContent( // fallow-ignore-next-line complexity function getReturnType( operation: OperationObject, - spec?: OpenAPIV3_1.Document + spec?: OpenAPIV3_1.Document, + importsOut?: Set ): { typeName: string isArray: boolean @@ -315,6 +396,11 @@ function getReturnType( if (picked.kind === 'json') { if (picked.entry.schema === undefined) continue + // Collect component schema names referenced anywhere in the response type so + // inline-expanded objects/arrays (e.g. { data: User[] }) import their members. + if (importsOut !== undefined && spec !== undefined) { + collectComponentRefNames(picked.entry.schema, spec, importsOut) + } const resolved = resolveSchema(picked.entry.schema, spec) return { ...resolved, isVoid: false, bodyKind: 'json', mayBeEmpty: has204 } } @@ -413,6 +499,21 @@ function mergeParams( interface PathParam { name: string // sanitized camelCase TS identifier (e.g. 'changeSetId' from 'change-set-id') urlName: string // original name for URL template (e.g. 'change-set-id') + type: string // TypeScript type derived from the parameter schema (default: 'string') +} + +/** + * Map a path parameter schema to its TypeScript type. + * Path params are always required positional values; only primitives make sense here. + * Defaults to 'string' when the schema is absent, a $ref, or has no recognised type. + */ +function pathParamType(schema: SchemaObject | ReferenceObject | undefined): string { + if (schema === undefined || isRef(schema)) return 'string' + const s = schema as SchemaObject + const type = s.type as string | undefined + if (type === 'integer' || type === 'number') return 'number' + if (type === 'boolean') return 'boolean' + return 'string' } function getPathParams( @@ -425,6 +526,7 @@ function getPathParams( .map((p) => ({ name: sanitizeOperationId(p.name), urlName: p.name, + type: pathParamType(p.schema as SchemaObject | ReferenceObject | undefined), })) } @@ -634,7 +736,8 @@ interface RequestBodyInfo { function getRequestBodyInfo( operation: OperationObject, spec?: OpenAPIV3_1.Document, - writableVariantMap?: Map + writableVariantMap?: Map, + importsOut?: Set ): RequestBodyInfo | undefined { const requestBody = operation.requestBody as RequestBodyObject | ReferenceObject | undefined if (requestBody === undefined) return undefined @@ -705,6 +808,12 @@ function getRequestBodyInfo( return { typeName: writableName, kind: 'json' } } } + // No writable redirect on this path, so the rendered inline type references the + // read-shape component names. Collect them so inline-expanded objects/arrays + // (e.g. { push: Push }) import their members from ./models.js (#298). + if (importsOut !== undefined && spec !== undefined) { + collectComponentRefNames(schema, spec, importsOut) + } return { typeName: inlineSchemaToTs(schema, spec), kind: 'json' } } @@ -723,6 +832,9 @@ function getRequestBodyInfo( return { typeName: writableName, kind: 'form' } } } + if (importsOut !== undefined && spec !== undefined) { + collectComponentRefNames(formSchema, spec, importsOut) + } return { typeName: inlineSchemaToTs(formSchema, spec), kind: 'form' } } @@ -1273,19 +1385,25 @@ function generateFunctionCode( // Build function signature const sigParts: string[] = [] - // Path params first (positional) — use sanitized TS name + // Path params first (positional) — use sanitized TS name with schema-derived type for (const param of pathParams) { - sigParts.push(`${param.name}: string`) + sigParts.push(`${param.name}: ${param.type}`) } // Body param if (bodyInfo !== undefined) { sigParts.push(`body: ${bodyInfo.typeName}`) } - // Query params + header params share the same params object + // Query params + header params share the same params object. + // When the wire name ends with '[]' (PHP/Rails bracket notation), preserve the wire + // name as the interface key so callers see params["ids[]"] — the original API name. + // For all other params, use the normalized camelCase identifier (qp.name). const allParamFields: string[] = [] for (const qp of queryParams) { - allParamFields.push(` ${toPropertyKey(qp.name)}${qp.required ? '' : '?'}: ${qp.type}`) + const fieldKey = qp.urlName.endsWith('[]') + ? toPropertyKey(qp.urlName) + : toPropertyKey(qp.name) + allParamFields.push(` ${fieldKey}${qp.required ? '' : '?'}: ${qp.type}`) } for (const hp of headerParams) { allParamFields.push(` ${hp.name}${hp.required ? '' : '?'}: ${hp.type}`) @@ -1336,15 +1454,25 @@ function generateFunctionCode( if (queryParams.length > 0) { lines.push(` const searchParams = new URLSearchParams()`) for (const qp of queryParams) { + // When the wire name uses bracket notation (e.g. 'ids[]'), use bracket access in + // the generated code so the property key matches the interface declaration. + // For all other params, use dot notation with the normalized identifier. + const isBracket = qp.urlName.endsWith('[]') + const access = isBracket + ? `params?.[${JSON.stringify(qp.urlName)}]` + : `params?.${qp.name}` + const valueAccess = isBracket + ? `params[${JSON.stringify(qp.urlName)}]` + : `params.${qp.name}` if (qp.type.endsWith('[]')) { - // Array params: use append in a loop (not set) so multiple values are preserved - // Use urlName for the wire format (may differ from TS name, e.g. 'ids[]' vs 'ids') + // Array params: use append in a loop (not set) so multiple values are preserved. + // urlName is used as the wire key (e.g. 'ids[]' -> searchParams.append('ids[]', ...)). lines.push( - ` if (params?.${qp.name} != null) { for (const v of params.${qp.name}) searchParams.append('${qp.urlName}', String(v)) }` + ` if (${access} != null) { for (const v of ${valueAccess}) searchParams.append('${qp.urlName}', String(v)) }` ) } else { lines.push( - ` if (params?.${qp.name} != null) searchParams.set('${qp.urlName}', String(params.${qp.name}))` + ` if (${access} != null) searchParams.set('${qp.urlName}', String(${valueAccess}))` ) } } @@ -1599,8 +1727,13 @@ export function generateClient( const pathParams = getPathParams(pathItem, operation, spec) const queryParams = getQueryParams(pathItem, operation, spec) const headerParams = getHeaderParams(pathItem, operation, spec) - const bodyInfo = getRequestBodyInfo(operation, spec, resolvedWritableVariantMap) - const returnType = getReturnType(operation, spec) + const bodyInfo = getRequestBodyInfo( + operation, + spec, + resolvedWritableVariantMap, + collectedTypeNames + ) + const returnType = getReturnType(operation, spec, collectedTypeNames) const deprecated = operation.deprecated === true const throwsTags = getThrowsTags(operation)