Skip to content

Commit

Permalink
Added missing Options from @hey-api/client-fetch (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
onurgenes authored Nov 4, 2024
1 parent 4e98360 commit 63b223a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/createImports.mts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ export const createImports = ({
const serviceNames = serviceExports;

const imports = [
ts.factory.createImportDeclaration(
undefined,
ts.factory.createImportClause(
false,
undefined,
ts.factory.createNamedImports([
ts.factory.createImportSpecifier(
true,
undefined,
ts.factory.createIdentifier("Options"),
),
]),
),
ts.factory.createStringLiteral(
client === "@hey-api/client-axios"
? "@hey-api/client-axios"
: "@hey-api/client-fetch",
),
undefined,
),
ts.factory.createImportDeclaration(
undefined,
ts.factory.createImportClause(
Expand Down
8 changes: 8 additions & 0 deletions tests/__snapshots__/createSource.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from "./queries";
exports[`createSource > createSource - @hey-api/client-axios 2`] = `
"// generated with @7nohe/[email protected]
import { type Options } from "@hey-api/client-axios";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand Down Expand Up @@ -47,6 +48,7 @@ exports[`createSource > createSource - @hey-api/client-axios 3`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-axios";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand All @@ -65,6 +67,7 @@ exports[`createSource > createSource - @hey-api/client-axios 4`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-axios";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand All @@ -80,6 +83,7 @@ exports[`createSource > createSource - @hey-api/client-axios 5`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-axios";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand All @@ -102,6 +106,7 @@ export * from "./queries";
exports[`createSource > createSource - @hey-api/client-fetch 2`] = `
"// generated with @7nohe/[email protected]
import { type Options } from "@hey-api/client-fetch";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand Down Expand Up @@ -137,6 +142,7 @@ exports[`createSource > createSource - @hey-api/client-fetch 3`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-fetch";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand All @@ -154,6 +160,7 @@ exports[`createSource > createSource - @hey-api/client-fetch 4`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-fetch";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand All @@ -168,6 +175,7 @@ exports[`createSource > createSource - @hey-api/client-fetch 5`] = `
"// generated with @7nohe/[email protected]
import * as Common from "./common";
import { type Options } from "@hey-api/client-fetch";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { client, findPets, addPet, getNotDefined, postNotDefined, findPetById, deletePet, findPaginatedPets } from "../requests/services.gen";
import { Pet, NewPet, Error, FindPetsData, FindPetsResponse, FindPetsError, AddPetData, AddPetResponse, AddPetError, GetNotDefinedResponse, GetNotDefinedError, PostNotDefinedResponse, PostNotDefinedError, FindPetByIdData, FindPetByIdResponse, FindPetByIdError, DeletePetData, DeletePetResponse, DeletePetError, FindPaginatedPetsData, FindPaginatedPetsResponse, FindPaginatedPetsError } from "../requests/types.gen";
Expand Down
2 changes: 2 additions & 0 deletions tests/createImports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe(fileName, () => {
// @ts-ignore
const moduleNames = imports.map((i) => i.moduleSpecifier.text);
expect(moduleNames).toStrictEqual([
"@hey-api/client-fetch",
"@tanstack/react-query",
"../requests/services.gen",
"../requests/types.gen",
Expand All @@ -41,6 +42,7 @@ describe(fileName, () => {
// @ts-ignore
const moduleNames = imports.map((i) => i.moduleSpecifier.text);
expect(moduleNames).toStrictEqual([
"@hey-api/client-fetch",
"@tanstack/react-query",
"../requests/services.gen",
"../requests/types.gen",
Expand Down

0 comments on commit 63b223a

Please sign in to comment.