@cardog/api 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +327 -0
- package/cardog-icon.png +0 -0
- package/dist/index.d.mts +1591 -0
- package/dist/index.d.ts +1591 -0
- package/dist/index.js +2245 -0
- package/dist/index.mjs +2208 -0
- package/dist/react/index.d.mts +91 -0
- package/dist/react/index.d.ts +91 -0
- package/dist/react/index.js +1967 -0
- package/dist/react/index.mjs +1964 -0
- package/package.json +94 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { UseQueryOptions, useQuery, UseInfiniteQueryOptions, QueryKey, useInfiniteQuery } from '@tanstack/react-query';
|
|
2
|
+
import { VinDecodeResponse, VinImageResponse, MarketAnalysis, MarketOverview, MarketPricing, BreakdownResponse, MarketOdometer, MarketGeography, MarketTrends, MarketPosition, MarketPulse, LocalMarketResponse, FuelTypeString, FuelStationResponse, ChargingParams, ChargingStationResponse, LineupResponse, Variant, ResearchImage, ColorData, RecallSearchParams, RecallResponse } from '@cardog/contracts';
|
|
3
|
+
import CardogClient, { ListingsSearchParams, ListingsResponse, ListingsCountResponse, Listing, ListingsFacetsResponse, LocationsSearchParams, LocationsSearchResponse, LocationDetailResponse, ComplaintsSearchParams, ComplaintsResponse } from '../index.mjs';
|
|
4
|
+
export { queryKeys } from '../index.mjs';
|
|
5
|
+
import 'axios';
|
|
6
|
+
import 'zod';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* React Hooks for @cardog/api
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.cardog.app
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type QueryConfig<TData, TError> = Omit<UseQueryOptions<TData, TError, TData>, "queryKey" | "queryFn">;
|
|
15
|
+
type InfiniteQueryConfig<TData, TError> = Omit<UseInfiniteQueryOptions<TData, TError, TData, QueryKey, number>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
16
|
+
/**
|
|
17
|
+
* Public Cardog React Hooks
|
|
18
|
+
*/
|
|
19
|
+
interface CardogHooks {
|
|
20
|
+
useVinDecode: (vin: string, options?: QueryConfig<VinDecodeResponse, Error>) => ReturnType<typeof useQuery<VinDecodeResponse, Error>>;
|
|
21
|
+
useVinImage: (base64: string, options?: QueryConfig<VinImageResponse, Error>) => ReturnType<typeof useQuery<VinImageResponse, Error>>;
|
|
22
|
+
useMarketAnalysis: (vin: string, options?: QueryConfig<MarketAnalysis, Error>) => ReturnType<typeof useQuery<MarketAnalysis, Error>>;
|
|
23
|
+
useMarketOverview: (params: {
|
|
24
|
+
make: string;
|
|
25
|
+
model: string;
|
|
26
|
+
year: number;
|
|
27
|
+
}, options?: QueryConfig<MarketOverview, Error>) => ReturnType<typeof useQuery<MarketOverview, Error>>;
|
|
28
|
+
useMarketPricing: (make: string, model: string, year: number, options?: QueryConfig<MarketPricing, Error>) => ReturnType<typeof useQuery<MarketPricing, Error>>;
|
|
29
|
+
useMarketBreakdown: (make: string, model: string, year: number, options?: QueryConfig<BreakdownResponse, Error>) => ReturnType<typeof useQuery<BreakdownResponse, Error>>;
|
|
30
|
+
useMarketOdometer: (make: string, model: string, year: number, options?: QueryConfig<MarketOdometer, Error>) => ReturnType<typeof useQuery<MarketOdometer, Error>>;
|
|
31
|
+
useMarketGeography: (make: string, model: string, year: number, options?: QueryConfig<MarketGeography, Error>) => ReturnType<typeof useQuery<MarketGeography, Error>>;
|
|
32
|
+
useMarketTrends: (make: string, model: string, year: number, period: "week" | "month", options?: QueryConfig<MarketTrends, Error>) => ReturnType<typeof useQuery<MarketTrends, Error>>;
|
|
33
|
+
useMarketPosition: (listingId: string, options?: QueryConfig<MarketPosition, Error>) => ReturnType<typeof useQuery<MarketPosition, Error>>;
|
|
34
|
+
useMarketPulse: (options: Parameters<CardogClient["market"]["pulse"]>[0], queryOptions?: QueryConfig<MarketPulse, Error>) => ReturnType<typeof useQuery<MarketPulse, Error>>;
|
|
35
|
+
useLocalMarket: (params: {
|
|
36
|
+
make: string;
|
|
37
|
+
model: string;
|
|
38
|
+
year: number;
|
|
39
|
+
lat: number;
|
|
40
|
+
lng: number;
|
|
41
|
+
radius?: number;
|
|
42
|
+
}, options?: QueryConfig<LocalMarketResponse, Error>) => ReturnType<typeof useQuery<LocalMarketResponse, Error>>;
|
|
43
|
+
useListingsSearch: (params: ListingsSearchParams, options?: QueryConfig<ListingsResponse, Error>) => ReturnType<typeof useQuery<ListingsResponse, Error>>;
|
|
44
|
+
useListingsCount: (params: ListingsSearchParams, options?: QueryConfig<ListingsCountResponse, Error>) => ReturnType<typeof useQuery<ListingsCountResponse, Error>>;
|
|
45
|
+
useInfiniteListingsSearch: (params: Omit<ListingsSearchParams, "pagination">, options?: InfiniteQueryConfig<ListingsResponse, Error>) => ReturnType<typeof useInfiniteQuery>;
|
|
46
|
+
useListingById: (id: string, options?: QueryConfig<Listing, Error>) => ReturnType<typeof useQuery<Listing, Error>>;
|
|
47
|
+
useListingsFacets: (params: ListingsSearchParams, options?: QueryConfig<ListingsFacetsResponse, Error>) => ReturnType<typeof useQuery<ListingsFacetsResponse, Error>>;
|
|
48
|
+
useLocationsSearch: (params: LocationsSearchParams, options?: QueryConfig<LocationsSearchResponse, Error>) => ReturnType<typeof useQuery<LocationsSearchResponse, Error>>;
|
|
49
|
+
useLocationById: (id: string, options?: QueryConfig<LocationDetailResponse, Error>) => ReturnType<typeof useQuery<LocationDetailResponse, Error>>;
|
|
50
|
+
useFuelSearch: (params: {
|
|
51
|
+
country: string;
|
|
52
|
+
fuelType: FuelTypeString;
|
|
53
|
+
lat: number;
|
|
54
|
+
lng: number;
|
|
55
|
+
radius?: number;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}, options?: QueryConfig<FuelStationResponse, Error>) => ReturnType<typeof useQuery<FuelStationResponse, Error>>;
|
|
58
|
+
useChargingStations: (params: ChargingParams, options?: QueryConfig<ChargingStationResponse, Error>) => ReturnType<typeof useQuery<ChargingStationResponse, Error>>;
|
|
59
|
+
useResearchLineup: (make: string, options?: QueryConfig<LineupResponse, Error>) => ReturnType<typeof useQuery<LineupResponse, Error>>;
|
|
60
|
+
useResearchByMake: (make: string, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
61
|
+
useResearchById: (id: string, options?: QueryConfig<Variant | null, Error>) => ReturnType<typeof useQuery<Variant | null, Error>>;
|
|
62
|
+
useResearchByModel: (make: string, model: string, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
63
|
+
useResearchByModelYear: (make: string, model: string, year: number, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
64
|
+
useResearchImages: (params: {
|
|
65
|
+
make: string;
|
|
66
|
+
model: string;
|
|
67
|
+
year: number;
|
|
68
|
+
limit?: number;
|
|
69
|
+
shotType?: string;
|
|
70
|
+
category?: string;
|
|
71
|
+
}, options?: QueryConfig<ResearchImage[], Error>) => ReturnType<typeof useQuery<ResearchImage[], Error>>;
|
|
72
|
+
useResearchColors: (params: {
|
|
73
|
+
make: string;
|
|
74
|
+
model: string;
|
|
75
|
+
year: number;
|
|
76
|
+
}, options?: QueryConfig<ColorData, Error>) => ReturnType<typeof useQuery<ColorData, Error>>;
|
|
77
|
+
useRecalls: (params: RecallSearchParams, options?: QueryConfig<RecallResponse, Error>) => ReturnType<typeof useQuery<RecallResponse, Error>>;
|
|
78
|
+
useComplaints: (params: ComplaintsSearchParams, options?: QueryConfig<ComplaintsResponse, Error>) => ReturnType<typeof useQuery<ComplaintsResponse, Error>>;
|
|
79
|
+
}
|
|
80
|
+
declare function createHooks(client: CardogClient): CardogHooks;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* React Hooks for @cardog/api
|
|
84
|
+
*
|
|
85
|
+
* @see https://docs.cardog.app
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
type InferQueryResult<T> = T extends (...args: any[]) => Promise<infer U> ? U : never;
|
|
89
|
+
type RouteParams<T> = T extends (params: infer P) => any ? P : never;
|
|
90
|
+
|
|
91
|
+
export { type CardogHooks, type InferQueryResult, type RouteParams, createHooks };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { UseQueryOptions, useQuery, UseInfiniteQueryOptions, QueryKey, useInfiniteQuery } from '@tanstack/react-query';
|
|
2
|
+
import { VinDecodeResponse, VinImageResponse, MarketAnalysis, MarketOverview, MarketPricing, BreakdownResponse, MarketOdometer, MarketGeography, MarketTrends, MarketPosition, MarketPulse, LocalMarketResponse, FuelTypeString, FuelStationResponse, ChargingParams, ChargingStationResponse, LineupResponse, Variant, ResearchImage, ColorData, RecallSearchParams, RecallResponse } from '@cardog/contracts';
|
|
3
|
+
import CardogClient, { ListingsSearchParams, ListingsResponse, ListingsCountResponse, Listing, ListingsFacetsResponse, LocationsSearchParams, LocationsSearchResponse, LocationDetailResponse, ComplaintsSearchParams, ComplaintsResponse } from '../index.js';
|
|
4
|
+
export { queryKeys } from '../index.js';
|
|
5
|
+
import 'axios';
|
|
6
|
+
import 'zod';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* React Hooks for @cardog/api
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.cardog.app
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type QueryConfig<TData, TError> = Omit<UseQueryOptions<TData, TError, TData>, "queryKey" | "queryFn">;
|
|
15
|
+
type InfiniteQueryConfig<TData, TError> = Omit<UseInfiniteQueryOptions<TData, TError, TData, QueryKey, number>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
|
|
16
|
+
/**
|
|
17
|
+
* Public Cardog React Hooks
|
|
18
|
+
*/
|
|
19
|
+
interface CardogHooks {
|
|
20
|
+
useVinDecode: (vin: string, options?: QueryConfig<VinDecodeResponse, Error>) => ReturnType<typeof useQuery<VinDecodeResponse, Error>>;
|
|
21
|
+
useVinImage: (base64: string, options?: QueryConfig<VinImageResponse, Error>) => ReturnType<typeof useQuery<VinImageResponse, Error>>;
|
|
22
|
+
useMarketAnalysis: (vin: string, options?: QueryConfig<MarketAnalysis, Error>) => ReturnType<typeof useQuery<MarketAnalysis, Error>>;
|
|
23
|
+
useMarketOverview: (params: {
|
|
24
|
+
make: string;
|
|
25
|
+
model: string;
|
|
26
|
+
year: number;
|
|
27
|
+
}, options?: QueryConfig<MarketOverview, Error>) => ReturnType<typeof useQuery<MarketOverview, Error>>;
|
|
28
|
+
useMarketPricing: (make: string, model: string, year: number, options?: QueryConfig<MarketPricing, Error>) => ReturnType<typeof useQuery<MarketPricing, Error>>;
|
|
29
|
+
useMarketBreakdown: (make: string, model: string, year: number, options?: QueryConfig<BreakdownResponse, Error>) => ReturnType<typeof useQuery<BreakdownResponse, Error>>;
|
|
30
|
+
useMarketOdometer: (make: string, model: string, year: number, options?: QueryConfig<MarketOdometer, Error>) => ReturnType<typeof useQuery<MarketOdometer, Error>>;
|
|
31
|
+
useMarketGeography: (make: string, model: string, year: number, options?: QueryConfig<MarketGeography, Error>) => ReturnType<typeof useQuery<MarketGeography, Error>>;
|
|
32
|
+
useMarketTrends: (make: string, model: string, year: number, period: "week" | "month", options?: QueryConfig<MarketTrends, Error>) => ReturnType<typeof useQuery<MarketTrends, Error>>;
|
|
33
|
+
useMarketPosition: (listingId: string, options?: QueryConfig<MarketPosition, Error>) => ReturnType<typeof useQuery<MarketPosition, Error>>;
|
|
34
|
+
useMarketPulse: (options: Parameters<CardogClient["market"]["pulse"]>[0], queryOptions?: QueryConfig<MarketPulse, Error>) => ReturnType<typeof useQuery<MarketPulse, Error>>;
|
|
35
|
+
useLocalMarket: (params: {
|
|
36
|
+
make: string;
|
|
37
|
+
model: string;
|
|
38
|
+
year: number;
|
|
39
|
+
lat: number;
|
|
40
|
+
lng: number;
|
|
41
|
+
radius?: number;
|
|
42
|
+
}, options?: QueryConfig<LocalMarketResponse, Error>) => ReturnType<typeof useQuery<LocalMarketResponse, Error>>;
|
|
43
|
+
useListingsSearch: (params: ListingsSearchParams, options?: QueryConfig<ListingsResponse, Error>) => ReturnType<typeof useQuery<ListingsResponse, Error>>;
|
|
44
|
+
useListingsCount: (params: ListingsSearchParams, options?: QueryConfig<ListingsCountResponse, Error>) => ReturnType<typeof useQuery<ListingsCountResponse, Error>>;
|
|
45
|
+
useInfiniteListingsSearch: (params: Omit<ListingsSearchParams, "pagination">, options?: InfiniteQueryConfig<ListingsResponse, Error>) => ReturnType<typeof useInfiniteQuery>;
|
|
46
|
+
useListingById: (id: string, options?: QueryConfig<Listing, Error>) => ReturnType<typeof useQuery<Listing, Error>>;
|
|
47
|
+
useListingsFacets: (params: ListingsSearchParams, options?: QueryConfig<ListingsFacetsResponse, Error>) => ReturnType<typeof useQuery<ListingsFacetsResponse, Error>>;
|
|
48
|
+
useLocationsSearch: (params: LocationsSearchParams, options?: QueryConfig<LocationsSearchResponse, Error>) => ReturnType<typeof useQuery<LocationsSearchResponse, Error>>;
|
|
49
|
+
useLocationById: (id: string, options?: QueryConfig<LocationDetailResponse, Error>) => ReturnType<typeof useQuery<LocationDetailResponse, Error>>;
|
|
50
|
+
useFuelSearch: (params: {
|
|
51
|
+
country: string;
|
|
52
|
+
fuelType: FuelTypeString;
|
|
53
|
+
lat: number;
|
|
54
|
+
lng: number;
|
|
55
|
+
radius?: number;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}, options?: QueryConfig<FuelStationResponse, Error>) => ReturnType<typeof useQuery<FuelStationResponse, Error>>;
|
|
58
|
+
useChargingStations: (params: ChargingParams, options?: QueryConfig<ChargingStationResponse, Error>) => ReturnType<typeof useQuery<ChargingStationResponse, Error>>;
|
|
59
|
+
useResearchLineup: (make: string, options?: QueryConfig<LineupResponse, Error>) => ReturnType<typeof useQuery<LineupResponse, Error>>;
|
|
60
|
+
useResearchByMake: (make: string, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
61
|
+
useResearchById: (id: string, options?: QueryConfig<Variant | null, Error>) => ReturnType<typeof useQuery<Variant | null, Error>>;
|
|
62
|
+
useResearchByModel: (make: string, model: string, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
63
|
+
useResearchByModelYear: (make: string, model: string, year: number, options?: QueryConfig<Variant[], Error>) => ReturnType<typeof useQuery<Variant[], Error>>;
|
|
64
|
+
useResearchImages: (params: {
|
|
65
|
+
make: string;
|
|
66
|
+
model: string;
|
|
67
|
+
year: number;
|
|
68
|
+
limit?: number;
|
|
69
|
+
shotType?: string;
|
|
70
|
+
category?: string;
|
|
71
|
+
}, options?: QueryConfig<ResearchImage[], Error>) => ReturnType<typeof useQuery<ResearchImage[], Error>>;
|
|
72
|
+
useResearchColors: (params: {
|
|
73
|
+
make: string;
|
|
74
|
+
model: string;
|
|
75
|
+
year: number;
|
|
76
|
+
}, options?: QueryConfig<ColorData, Error>) => ReturnType<typeof useQuery<ColorData, Error>>;
|
|
77
|
+
useRecalls: (params: RecallSearchParams, options?: QueryConfig<RecallResponse, Error>) => ReturnType<typeof useQuery<RecallResponse, Error>>;
|
|
78
|
+
useComplaints: (params: ComplaintsSearchParams, options?: QueryConfig<ComplaintsResponse, Error>) => ReturnType<typeof useQuery<ComplaintsResponse, Error>>;
|
|
79
|
+
}
|
|
80
|
+
declare function createHooks(client: CardogClient): CardogHooks;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* React Hooks for @cardog/api
|
|
84
|
+
*
|
|
85
|
+
* @see https://docs.cardog.app
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
type InferQueryResult<T> = T extends (...args: any[]) => Promise<infer U> ? U : never;
|
|
89
|
+
type RouteParams<T> = T extends (params: infer P) => any ? P : never;
|
|
90
|
+
|
|
91
|
+
export { type CardogHooks, type InferQueryResult, type RouteParams, createHooks };
|