-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
71 lines (60 loc) · 1.43 KB
/
index.d.ts
File metadata and controls
71 lines (60 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export type SelectorMap<TRaw extends Record<string, string>> = Partial<
Record<keyof TRaw, string>
>;
export type ParseRssOptions<TRaw extends Record<string, string>> = {
itemSelector?: string;
selectors?: SelectorMap<TRaw>;
fallback?: TRaw[];
};
export function parseRssItems<TRaw extends Record<string, string>>(
xml: string,
options?: ParseRssOptions<TRaw>,
): TRaw[];
export type SubstackItem = {
title: string;
description: string;
link: string;
pubDate: string;
content: string;
};
export function parseSubstackRss(
xml: string,
options?: Omit<ParseRssOptions<SubstackItem>, "selectors"> & {
selectors?: SelectorMap<SubstackItem>;
},
): SubstackItem[];
export type BookAuthor = {
name: string;
};
export type GoodreadsBook = {
title: string;
description: string;
cover: string;
authors?: BookAuthor[];
};
export type GoodreadsReadingStatus =
| "IS_READING"
| "FINISHED"
| "WANTS_TO_READ";
export const READING_STATES: readonly [
"IS_READING",
"FINISHED",
"WANTS_TO_READ",
];
export type GoodreadsReadingState = {
book: GoodreadsBook;
status: GoodreadsReadingStatus;
};
export type GoodreadsRaw = {
title: string;
description: string;
cover: string;
author: string;
shelves: string;
};
export function parseGoodreadsRss(
xml: string,
options?: Omit<ParseRssOptions<GoodreadsRaw>, "selectors"> & {
selectors?: SelectorMap<GoodreadsRaw>;
},
): GoodreadsReadingState[];