diff --git a/examples/output/github/hooks/fetcher.ts b/examples/output/github/hooks/fetcher.ts index 0d10b73..51f83bb 100644 --- a/examples/output/github/hooks/fetcher.ts +++ b/examples/output/github/hooks/fetcher.ts @@ -9,7 +9,7 @@ export interface FetcherOptions { - content: TResponse; + body: TResponse; headers: TResponseHeaders; } @@ -20,7 +20,7 @@ export async function fetcher< THeaderParams = HeadersInit, >( options: FetcherOptions, -): Promise>> { +): Promise> { const { body, url, queryParams, headers, ...rest } = options; const response = await fetch(url, { @@ -39,8 +39,8 @@ export async function fetcher< if (response.ok) { return { - content: data, - headers: {}, + body: data, + headers: response.headers, }; } diff --git a/examples/output/github/hooks/useReposListForAuthenticatedUserQuery.ts b/examples/output/github/hooks/useReposListForAuthenticatedUserQuery.ts index 02aa3e4..6ca0029 100644 --- a/examples/output/github/hooks/useReposListForAuthenticatedUserQuery.ts +++ b/examples/output/github/hooks/useReposListForAuthenticatedUserQuery.ts @@ -60,8 +60,8 @@ export interface ReposListForAuthenticatedUserProps } export interface ReposListForAuthenticatedUserResponseContainer { - content: ReposListForAuthenticatedUserOkResponse; - headers: Record; + body: ReposListForAuthenticatedUserOkResponse; + headers: Headers; } export function reposListForAuthenticatedUser( diff --git a/examples/output/petstore-openapi-v3.0/hooks/fetcher.ts b/examples/output/petstore-openapi-v3.0/hooks/fetcher.ts index 0d10b73..51f83bb 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/fetcher.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/fetcher.ts @@ -9,7 +9,7 @@ export interface FetcherOptions { - content: TResponse; + body: TResponse; headers: TResponseHeaders; } @@ -20,7 +20,7 @@ export async function fetcher< THeaderParams = HeadersInit, >( options: FetcherOptions, -): Promise>> { +): Promise> { const { body, url, queryParams, headers, ...rest } = options; const response = await fetch(url, { @@ -39,8 +39,8 @@ export async function fetcher< if (response.ok) { return { - content: data, - headers: {}, + body: data, + headers: response.headers, }; } diff --git a/examples/output/petstore-openapi-v3.0/hooks/useAddPetMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useAddPetMutation.ts index 034d331..4241299 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useAddPetMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useAddPetMutation.ts @@ -17,8 +17,8 @@ export interface AddPetProps extends Omit; + body: AddPetOkResponse; + headers: Headers; } export function addPet(props: AddPetProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useCreateUserMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useCreateUserMutation.ts index af49fe8..ca87aeb 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useCreateUserMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useCreateUserMutation.ts @@ -18,8 +18,8 @@ export interface CreateUserProps } export interface CreateUserResponseContainer { - content: CreateUserOkResponse; - headers: Record; + body: CreateUserOkResponse; + headers: Headers; } export function createUser(props: CreateUserProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useCreateUsersWithListInputMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useCreateUsersWithListInputMutation.ts index 60a55fb..872da20 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useCreateUsersWithListInputMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useCreateUsersWithListInputMutation.ts @@ -18,8 +18,8 @@ export interface CreateUsersWithListInputProps } export interface CreateUsersWithListInputResponseContainer { - content: CreateUsersWithListInputOkResponse; - headers: Record; + body: CreateUsersWithListInputOkResponse; + headers: Headers; } export function createUsersWithListInput( diff --git a/examples/output/petstore-openapi-v3.0/hooks/useDeleteOrderMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useDeleteOrderMutation.ts index 8b1279e..0645ace 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useDeleteOrderMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useDeleteOrderMutation.ts @@ -21,8 +21,8 @@ export interface DeleteOrderProps Omit, 'url'> {} export interface DeleteOrderResponseContainer { - content: DeleteOrderOkResponse; - headers: Record; + body: DeleteOrderOkResponse; + headers: Headers; } export function deleteOrder(props: DeleteOrderProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useDeletePetMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useDeletePetMutation.ts index 9dee67d..914a6de 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useDeletePetMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useDeletePetMutation.ts @@ -25,8 +25,8 @@ export interface DeletePetProps Omit, 'url'> {} export interface DeletePetResponseContainer { - content: DeletePetOkResponse; - headers: Record; + body: DeletePetOkResponse; + headers: Headers; } export function deletePet(props: DeletePetProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useDeleteUserMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useDeleteUserMutation.ts index 41b32c8..156b8f5 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useDeleteUserMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useDeleteUserMutation.ts @@ -18,8 +18,8 @@ export interface DeleteUserProps Omit, 'url'> {} export interface DeleteUserResponseContainer { - content: DeleteUserOkResponse; - headers: Record; + body: DeleteUserOkResponse; + headers: Headers; } export function deleteUser(props: DeleteUserProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByStatusQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByStatusQuery.ts index 64f30d0..c73f70d 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByStatusQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByStatusQuery.ts @@ -23,8 +23,8 @@ export interface FindPetsByStatusProps } export interface FindPetsByStatusResponseContainer { - content: FindPetsByStatusOkResponse; - headers: Record; + body: FindPetsByStatusOkResponse; + headers: Headers; } export function findPetsByStatus( diff --git a/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByTagsQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByTagsQuery.ts index 9fee40f..b791e36 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByTagsQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useFindPetsByTagsQuery.ts @@ -20,8 +20,8 @@ export interface FindPetsByTagsProps } export interface FindPetsByTagsResponseContainer { - content: FindPetsByTagsOkResponse; - headers: Record; + body: FindPetsByTagsOkResponse; + headers: Headers; } export function findPetsByTags( diff --git a/examples/output/petstore-openapi-v3.0/hooks/useGetInventoryQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useGetInventoryQuery.ts index 9a9ae33..4bbc225 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useGetInventoryQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useGetInventoryQuery.ts @@ -12,8 +12,8 @@ export type GetInventoryErrorResponse = unknown; export interface GetInventoryProps extends Omit, 'url'> {} export interface GetInventoryResponseContainer { - content: GetInventoryOkResponse; - headers: Record; + body: GetInventoryOkResponse; + headers: Headers; } export function getInventory(props: GetInventoryProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useGetOrderByIdQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useGetOrderByIdQuery.ts index 9121b08..c835d24 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useGetOrderByIdQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useGetOrderByIdQuery.ts @@ -22,8 +22,8 @@ export interface GetOrderByIdProps Omit, 'url'> {} export interface GetOrderByIdResponseContainer { - content: GetOrderByIdOkResponse; - headers: Record; + body: GetOrderByIdOkResponse; + headers: Headers; } export function getOrderById(props: GetOrderByIdProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useGetPetByIdQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useGetPetByIdQuery.ts index f94e87c..b928596 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useGetPetByIdQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useGetPetByIdQuery.ts @@ -22,8 +22,8 @@ export interface GetPetByIdProps Omit, 'url'> {} export interface GetPetByIdResponseContainer { - content: GetPetByIdOkResponse; - headers: Record; + body: GetPetByIdOkResponse; + headers: Headers; } export function getPetById(props: GetPetByIdProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useGetUserByNameQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useGetUserByNameQuery.ts index 2d14e72..6f5a485 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useGetUserByNameQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useGetUserByNameQuery.ts @@ -19,8 +19,8 @@ export interface GetUserByNameProps Omit, 'url'> {} export interface GetUserByNameResponseContainer { - content: GetUserByNameOkResponse; - headers: Record; + body: GetUserByNameOkResponse; + headers: Headers; } export function getUserByName(props: GetUserByNameProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useLoginUserQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useLoginUserQuery.ts index d167525..ec0fcfd 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useLoginUserQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useLoginUserQuery.ts @@ -20,8 +20,8 @@ export interface LoginUserProps } export interface LoginUserResponseContainer { - content: LoginUserOkResponse; - headers: Record; + body: LoginUserOkResponse; + headers: Headers; } export function loginUser(props: LoginUserProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useLogoutUserQuery.ts b/examples/output/petstore-openapi-v3.0/hooks/useLogoutUserQuery.ts index bfb2466..141caec 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useLogoutUserQuery.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useLogoutUserQuery.ts @@ -12,8 +12,8 @@ export type LogoutUserErrorResponse = unknown; export interface LogoutUserProps extends Omit, 'url'> {} export interface LogoutUserResponseContainer { - content: LogoutUserOkResponse; - headers: Record; + body: LogoutUserOkResponse; + headers: Headers; } export function logoutUser(props: LogoutUserProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/usePlaceOrderMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/usePlaceOrderMutation.ts index becd840..26a8431 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/usePlaceOrderMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/usePlaceOrderMutation.ts @@ -18,8 +18,8 @@ export interface PlaceOrderProps } export interface PlaceOrderResponseContainer { - content: PlaceOrderOkResponse; - headers: Record; + body: PlaceOrderOkResponse; + headers: Headers; } export function placeOrder(props: PlaceOrderProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetMutation.ts index 62c9c33..a0b5589 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetMutation.ts @@ -17,8 +17,8 @@ export interface UpdatePetProps extends Omit; + body: UpdatePetOkResponse; + headers: Headers; } export function updatePet(props: UpdatePetProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetWithFormMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetWithFormMutation.ts index 9469e2b..eef3a18 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetWithFormMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useUpdatePetWithFormMutation.ts @@ -28,8 +28,8 @@ export interface UpdatePetWithFormProps } export interface UpdatePetWithFormResponseContainer { - content: UpdatePetWithFormOkResponse; - headers: Record; + body: UpdatePetWithFormOkResponse; + headers: Headers; } export function updatePetWithForm( diff --git a/examples/output/petstore-openapi-v3.0/hooks/useUpdateUserMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useUpdateUserMutation.ts index 012104e..9dce44c 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useUpdateUserMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useUpdateUserMutation.ts @@ -23,8 +23,8 @@ export interface UpdateUserProps } export interface UpdateUserResponseContainer { - content: UpdateUserOkResponse; - headers: Record; + body: UpdateUserOkResponse; + headers: Headers; } export function updateUser(props: UpdateUserProps): Promise { diff --git a/examples/output/petstore-openapi-v3.0/hooks/useUploadFileMutation.ts b/examples/output/petstore-openapi-v3.0/hooks/useUploadFileMutation.ts index b2ce2f7..48d722f 100644 --- a/examples/output/petstore-openapi-v3.0/hooks/useUploadFileMutation.ts +++ b/examples/output/petstore-openapi-v3.0/hooks/useUploadFileMutation.ts @@ -31,8 +31,8 @@ export interface UploadFileProps } export interface UploadFileResponseContainer { - content: UploadFileOkResponse; - headers: Record; + body: UploadFileOkResponse; + headers: Headers; } export function uploadFile(props: UploadFileProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/fetcher.ts b/examples/output/petstore-swagger/hooks/fetcher.ts index f2aca3c..4d3fdc1 100644 --- a/examples/output/petstore-swagger/hooks/fetcher.ts +++ b/examples/output/petstore-swagger/hooks/fetcher.ts @@ -10,7 +10,7 @@ export interface FetcherOptions { - content: TResponse; + body: TResponse; headers: TResponseHeaders; } @@ -21,7 +21,7 @@ export async function fetcher< THeaderParams = HeadersInit, >( options: FetcherOptions, -): Promise>> { +): Promise> { const { body, url, queryParams, headers, ...rest } = options; const response = await fetch(url, { @@ -40,8 +40,8 @@ export async function fetcher< if (response.ok) { return { - content: data, - headers: {}, + body: data, + headers: response.headers, }; } diff --git a/examples/output/petstore-swagger/hooks/useAddPetMutation.ts b/examples/output/petstore-swagger/hooks/useAddPetMutation.ts index 768d1b1..4f927da 100644 --- a/examples/output/petstore-swagger/hooks/useAddPetMutation.ts +++ b/examples/output/petstore-swagger/hooks/useAddPetMutation.ts @@ -18,8 +18,8 @@ export interface AddPetProps extends Omit; + body: AddPetOkResponse; + headers: Headers; } export function addPet(props: AddPetProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useCreateUserMutation.ts b/examples/output/petstore-swagger/hooks/useCreateUserMutation.ts index cd25a62..2182154 100644 --- a/examples/output/petstore-swagger/hooks/useCreateUserMutation.ts +++ b/examples/output/petstore-swagger/hooks/useCreateUserMutation.ts @@ -19,8 +19,8 @@ export interface CreateUserProps } export interface CreateUserResponseContainer { - content: CreateUserOkResponse; - headers: Record; + body: CreateUserOkResponse; + headers: Headers; } export function createUser(props: CreateUserProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useCreateUsersWithArrayInputMutation.ts b/examples/output/petstore-swagger/hooks/useCreateUsersWithArrayInputMutation.ts index 5d905f9..cd7b3e9 100644 --- a/examples/output/petstore-swagger/hooks/useCreateUsersWithArrayInputMutation.ts +++ b/examples/output/petstore-swagger/hooks/useCreateUsersWithArrayInputMutation.ts @@ -19,8 +19,8 @@ export interface CreateUsersWithArrayInputProps } export interface CreateUsersWithArrayInputResponseContainer { - content: CreateUsersWithArrayInputOkResponse; - headers: Record; + body: CreateUsersWithArrayInputOkResponse; + headers: Headers; } export function createUsersWithArrayInput( diff --git a/examples/output/petstore-swagger/hooks/useCreateUsersWithListInputMutation.ts b/examples/output/petstore-swagger/hooks/useCreateUsersWithListInputMutation.ts index ed2e53e..323cac6 100644 --- a/examples/output/petstore-swagger/hooks/useCreateUsersWithListInputMutation.ts +++ b/examples/output/petstore-swagger/hooks/useCreateUsersWithListInputMutation.ts @@ -19,8 +19,8 @@ export interface CreateUsersWithListInputProps } export interface CreateUsersWithListInputResponseContainer { - content: CreateUsersWithListInputOkResponse; - headers: Record; + body: CreateUsersWithListInputOkResponse; + headers: Headers; } export function createUsersWithListInput( diff --git a/examples/output/petstore-swagger/hooks/useDeleteOrderMutation.ts b/examples/output/petstore-swagger/hooks/useDeleteOrderMutation.ts index 10971d4..4adcb4c 100644 --- a/examples/output/petstore-swagger/hooks/useDeleteOrderMutation.ts +++ b/examples/output/petstore-swagger/hooks/useDeleteOrderMutation.ts @@ -22,8 +22,8 @@ export interface DeleteOrderProps Omit, 'url'> {} export interface DeleteOrderResponseContainer { - content: DeleteOrderOkResponse; - headers: Record; + body: DeleteOrderOkResponse; + headers: Headers; } export function deleteOrder(props: DeleteOrderProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useDeletePetMutation.ts b/examples/output/petstore-swagger/hooks/useDeletePetMutation.ts index 36a3df5..ffaf6fb 100644 --- a/examples/output/petstore-swagger/hooks/useDeletePetMutation.ts +++ b/examples/output/petstore-swagger/hooks/useDeletePetMutation.ts @@ -26,8 +26,8 @@ export interface DeletePetProps Omit, 'url'> {} export interface DeletePetResponseContainer { - content: DeletePetOkResponse; - headers: Record; + body: DeletePetOkResponse; + headers: Headers; } export function deletePet(props: DeletePetProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useDeleteUserMutation.ts b/examples/output/petstore-swagger/hooks/useDeleteUserMutation.ts index 710cc96..a668f55 100644 --- a/examples/output/petstore-swagger/hooks/useDeleteUserMutation.ts +++ b/examples/output/petstore-swagger/hooks/useDeleteUserMutation.ts @@ -19,8 +19,8 @@ export interface DeleteUserProps Omit, 'url'> {} export interface DeleteUserResponseContainer { - content: DeleteUserOkResponse; - headers: Record; + body: DeleteUserOkResponse; + headers: Headers; } export function deleteUser(props: DeleteUserProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useFindPetsByStatusQuery.ts b/examples/output/petstore-swagger/hooks/useFindPetsByStatusQuery.ts index f726741..8c6f476 100644 --- a/examples/output/petstore-swagger/hooks/useFindPetsByStatusQuery.ts +++ b/examples/output/petstore-swagger/hooks/useFindPetsByStatusQuery.ts @@ -21,8 +21,8 @@ export interface FindPetsByStatusProps } export interface FindPetsByStatusResponseContainer { - content: FindPetsByStatusOkResponse; - headers: Record; + body: FindPetsByStatusOkResponse; + headers: Headers; } export function findPetsByStatus( diff --git a/examples/output/petstore-swagger/hooks/useFindPetsByTagsQuery.ts b/examples/output/petstore-swagger/hooks/useFindPetsByTagsQuery.ts index a43cc76..5389ea6 100644 --- a/examples/output/petstore-swagger/hooks/useFindPetsByTagsQuery.ts +++ b/examples/output/petstore-swagger/hooks/useFindPetsByTagsQuery.ts @@ -21,8 +21,8 @@ export interface FindPetsByTagsProps } export interface FindPetsByTagsResponseContainer { - content: FindPetsByTagsOkResponse; - headers: Record; + body: FindPetsByTagsOkResponse; + headers: Headers; } export function findPetsByTags( diff --git a/examples/output/petstore-swagger/hooks/useGetInventoryQuery.ts b/examples/output/petstore-swagger/hooks/useGetInventoryQuery.ts index 9ccec6a..75235c5 100644 --- a/examples/output/petstore-swagger/hooks/useGetInventoryQuery.ts +++ b/examples/output/petstore-swagger/hooks/useGetInventoryQuery.ts @@ -13,8 +13,8 @@ export type GetInventoryErrorResponse = unknown; export interface GetInventoryProps extends Omit, 'url'> {} export interface GetInventoryResponseContainer { - content: GetInventoryOkResponse; - headers: Record; + body: GetInventoryOkResponse; + headers: Headers; } export function getInventory(props: GetInventoryProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useGetOrderByIdQuery.ts b/examples/output/petstore-swagger/hooks/useGetOrderByIdQuery.ts index 97dab1f..f04a3a7 100644 --- a/examples/output/petstore-swagger/hooks/useGetOrderByIdQuery.ts +++ b/examples/output/petstore-swagger/hooks/useGetOrderByIdQuery.ts @@ -23,8 +23,8 @@ export interface GetOrderByIdProps Omit, 'url'> {} export interface GetOrderByIdResponseContainer { - content: GetOrderByIdOkResponse; - headers: Record; + body: GetOrderByIdOkResponse; + headers: Headers; } export function getOrderById(props: GetOrderByIdProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useGetPetByIdQuery.ts b/examples/output/petstore-swagger/hooks/useGetPetByIdQuery.ts index 3d6ec36..ae92ed8 100644 --- a/examples/output/petstore-swagger/hooks/useGetPetByIdQuery.ts +++ b/examples/output/petstore-swagger/hooks/useGetPetByIdQuery.ts @@ -23,8 +23,8 @@ export interface GetPetByIdProps Omit, 'url'> {} export interface GetPetByIdResponseContainer { - content: GetPetByIdOkResponse; - headers: Record; + body: GetPetByIdOkResponse; + headers: Headers; } export function getPetById(props: GetPetByIdProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useGetUserByNameQuery.ts b/examples/output/petstore-swagger/hooks/useGetUserByNameQuery.ts index 25dcd62..19fa8c3 100644 --- a/examples/output/petstore-swagger/hooks/useGetUserByNameQuery.ts +++ b/examples/output/petstore-swagger/hooks/useGetUserByNameQuery.ts @@ -20,8 +20,8 @@ export interface GetUserByNameProps Omit, 'url'> {} export interface GetUserByNameResponseContainer { - content: GetUserByNameOkResponse; - headers: Record; + body: GetUserByNameOkResponse; + headers: Headers; } export function getUserByName(props: GetUserByNameProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useLoginUserQuery.ts b/examples/output/petstore-swagger/hooks/useLoginUserQuery.ts index 600af2a..30ff328 100644 --- a/examples/output/petstore-swagger/hooks/useLoginUserQuery.ts +++ b/examples/output/petstore-swagger/hooks/useLoginUserQuery.ts @@ -21,8 +21,8 @@ export interface LoginUserProps } export interface LoginUserResponseContainer { - content: LoginUserOkResponse; - headers: Record; + body: LoginUserOkResponse; + headers: Headers; } export function loginUser(props: LoginUserProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useLogoutUserQuery.ts b/examples/output/petstore-swagger/hooks/useLogoutUserQuery.ts index ca5c618..2205b05 100644 --- a/examples/output/petstore-swagger/hooks/useLogoutUserQuery.ts +++ b/examples/output/petstore-swagger/hooks/useLogoutUserQuery.ts @@ -13,8 +13,8 @@ export type LogoutUserErrorResponse = unknown; export interface LogoutUserProps extends Omit, 'url'> {} export interface LogoutUserResponseContainer { - content: LogoutUserOkResponse; - headers: Record; + body: LogoutUserOkResponse; + headers: Headers; } export function logoutUser(props: LogoutUserProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/usePlaceOrderMutation.ts b/examples/output/petstore-swagger/hooks/usePlaceOrderMutation.ts index bcd30db..3c98a3f 100644 --- a/examples/output/petstore-swagger/hooks/usePlaceOrderMutation.ts +++ b/examples/output/petstore-swagger/hooks/usePlaceOrderMutation.ts @@ -19,8 +19,8 @@ export interface PlaceOrderProps } export interface PlaceOrderResponseContainer { - content: PlaceOrderOkResponse; - headers: Record; + body: PlaceOrderOkResponse; + headers: Headers; } export function placeOrder(props: PlaceOrderProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useUpdatePetMutation.ts b/examples/output/petstore-swagger/hooks/useUpdatePetMutation.ts index d139455..b9186c1 100644 --- a/examples/output/petstore-swagger/hooks/useUpdatePetMutation.ts +++ b/examples/output/petstore-swagger/hooks/useUpdatePetMutation.ts @@ -18,8 +18,8 @@ export interface UpdatePetProps extends Omit; + body: UpdatePetOkResponse; + headers: Headers; } export function updatePet(props: UpdatePetProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useUpdatePetWithFormMutation.ts b/examples/output/petstore-swagger/hooks/useUpdatePetWithFormMutation.ts index ff1531e..e109133 100644 --- a/examples/output/petstore-swagger/hooks/useUpdatePetWithFormMutation.ts +++ b/examples/output/petstore-swagger/hooks/useUpdatePetWithFormMutation.ts @@ -26,8 +26,8 @@ export interface UpdatePetWithFormProps } export interface UpdatePetWithFormResponseContainer { - content: UpdatePetWithFormOkResponse; - headers: Record; + body: UpdatePetWithFormOkResponse; + headers: Headers; } export function updatePetWithForm( diff --git a/examples/output/petstore-swagger/hooks/useUpdateUserMutation.ts b/examples/output/petstore-swagger/hooks/useUpdateUserMutation.ts index ec620dc..36de31b 100644 --- a/examples/output/petstore-swagger/hooks/useUpdateUserMutation.ts +++ b/examples/output/petstore-swagger/hooks/useUpdateUserMutation.ts @@ -24,8 +24,8 @@ export interface UpdateUserProps } export interface UpdateUserResponseContainer { - content: UpdateUserOkResponse; - headers: Record; + body: UpdateUserOkResponse; + headers: Headers; } export function updateUser(props: UpdateUserProps): Promise { diff --git a/examples/output/petstore-swagger/hooks/useUploadFileMutation.ts b/examples/output/petstore-swagger/hooks/useUploadFileMutation.ts index fcf63fe..d7be9b7 100644 --- a/examples/output/petstore-swagger/hooks/useUploadFileMutation.ts +++ b/examples/output/petstore-swagger/hooks/useUploadFileMutation.ts @@ -27,8 +27,8 @@ export interface UploadFileProps } export interface UploadFileResponseContainer { - content: UploadFileOkResponse; - headers: Record; + body: UploadFileOkResponse; + headers: Headers; } export function uploadFile(props: UploadFileProps): Promise { diff --git a/packages/plugin-react-query/package.json b/packages/plugin-react-query/package.json index d2979b0..008e912 100644 --- a/packages/plugin-react-query/package.json +++ b/packages/plugin-react-query/package.json @@ -1,6 +1,6 @@ { "name": "@harnessio/oats-plugin-react-query", - "version": "4.0.3", + "version": "5.0.0", "license": "MIT", "type": "module", "repository": { diff --git a/packages/plugin-react-query/src/templates/defaultFetcher.liquid b/packages/plugin-react-query/src/templates/defaultFetcher.liquid index a31bebb..3c8126c 100644 --- a/packages/plugin-react-query/src/templates/defaultFetcher.liquid +++ b/packages/plugin-react-query/src/templates/defaultFetcher.liquid @@ -9,7 +9,7 @@ export interface FetcherOptions { - content: TResponse; + body: TResponse; headers: TResponseHeaders; } @@ -18,7 +18,7 @@ export async function fetcher< TQueryParams = never, TBody = never, THeaderParams = HeadersInit, ->(options: FetcherOptions): Promise>> { +>(options: FetcherOptions): Promise> { const { body, url, queryParams, headers, ...rest } = options; const response = await fetch(url, { @@ -37,8 +37,8 @@ export async function fetcher< if (response.ok) { return { - content: data, - headers: {} + body: data, + headers: response.headers }; } diff --git a/packages/plugin-react-query/src/templates/reactQueryCommon.liquid b/packages/plugin-react-query/src/templates/reactQueryCommon.liquid index e0a0d58..9498ce6 100644 --- a/packages/plugin-react-query/src/templates/reactQueryCommon.liquid +++ b/packages/plugin-react-query/src/templates/reactQueryCommon.liquid @@ -40,8 +40,8 @@ Omit + body: {{okResponseName}} + headers: Headers } export function {{fetcherName}}(props: {{fetcherPropsName}}): Promise<{{typeName}}ResponseContainer> {