Skip to content

Commit d72a19d

Browse files
committed
overwork types directory
1 parent a9e4595 commit d72a19d

File tree

6 files changed

+125
-130
lines changed

6 files changed

+125
-130
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"version": "0.0.1",
44
"description": "A library to search for offers on marktguru.at",
55
"main": "dist/index.js",
6-
"types": "src/index.d.ts",
6+
"types": "typings/index.d.ts",
7+
"files": [
8+
"dist/",
9+
"typings/"
10+
],
711
"scripts": {
812
"build": "tsc --project tsconfig.json",
913
"test": "jest",

src/@types/marktguru.d.ts

Lines changed: 0 additions & 119 deletions
This file was deleted.

src/index.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { marktguru } from './@types/marktguru';
2+
import * as marktguru from '../typings/index';
33

44
const defaultOptions: marktguru.SearchOptions = {
55
limit: 1000,

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
100100
},
101101
"include": [
102-
",./node_modules",
103102
"./src",
104103
]
105104
}

typings/index.d.ts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
export type Retailer =
2+
| 'billa'
3+
| 'billa-plus'
4+
| 'penny'
5+
| 'hofer'
6+
| 'lidl'
7+
| 'spar'
8+
| 'eurospar'
9+
| 'interspar'
10+
| 'adeg-nahversorger'
11+
| 'mpreis'
12+
| 'unimarkt'
13+
| string;
14+
15+
export type Config = {
16+
config: {
17+
apiKey: string;
18+
clientKey: string;
19+
};
20+
};
21+
22+
export type Brand = {
23+
uniqueName: string;
24+
indexOffer: boolean;
25+
indexLeaflet: boolean;
26+
id: number;
27+
name: string;
28+
industryId: number;
29+
};
30+
31+
export type Advertiser = {
32+
uniqueName: Retailer;
33+
indexOffer: boolean;
34+
indexLeaflet: boolean;
35+
id: string;
36+
name: string;
37+
industryId: number;
38+
};
39+
40+
export type Category = {
41+
uniqueName: string | null;
42+
indexOffer: boolean;
43+
indexLeaflet: boolean;
44+
id: number;
45+
name: string;
46+
description: string;
47+
parentId: number;
48+
};
49+
50+
export type ValidityDates = {
51+
from: string;
52+
to: string;
53+
};
54+
55+
export type Industry = {
56+
id: number;
57+
name: string;
58+
};
59+
60+
export type Product = {
61+
id: number;
62+
name: string;
63+
description: string | null;
64+
};
65+
66+
export type Unit = {
67+
shortName: string;
68+
id: number;
69+
name: string;
70+
};
71+
72+
export type ImageMetadata = {
73+
aspectRatio: number;
74+
height: number;
75+
width: number;
76+
};
77+
78+
export type Images = {
79+
count: number;
80+
metadata: ImageMetadata[];
81+
urls: {
82+
small: string;
83+
medium: string;
84+
large: string;
85+
};
86+
};
87+
88+
export type Offer = {
89+
brand: Brand;
90+
advertisers: Advertiser[];
91+
categories: Category[];
92+
id: number;
93+
description: string;
94+
price: number;
95+
oldPrice: number | null;
96+
referencePrice: number;
97+
requiresLoyalityMembership: boolean;
98+
leafletFlightId: number;
99+
validityDates: ValidityDates[];
100+
externalId: number | null;
101+
externalTrackingUrls: string[];
102+
externalUrl: string | null;
103+
trackFlightImpression: null;
104+
type: 'standard';
105+
industries: Industry[];
106+
product: Product;
107+
unit: Unit;
108+
images: Images;
109+
imageType: 'offer';
110+
};
111+
112+
export type SearchOptions = {
113+
allowedRetailers?: Retailer[];
114+
limit?: number;
115+
offset?: number;
116+
zipCode?: number;
117+
};
118+
119+
export function search(query: string, options?: SearchOptions): Promise<Offer[]>;

0 commit comments

Comments
 (0)