-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
111 lines (96 loc) · 2.17 KB
/
index.d.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
export type RawFeed = {
rss: {
channel: RawFeedChannel[];
[key: string]: unknown;
};
};
export interface RawFeedChannel {
title: string[];
description: string[];
link: string[];
image: RawImage[];
generator: string[];
lastBuildDate: string[];
"atom:link": AtomLink[];
copyright: string[];
language: string[];
webMaster: string[];
"itunes:owner": ItunesOwner[];
"itunes:author": string[];
"googleplay:owner": string[];
"googleplay:email": string[];
"googleplay:author": string[];
item: RawItem[];
}
export interface RawImage {
url: string[];
title: string[];
link: string[];
}
export interface AtomLink {
$: GeneratedType;
}
export interface GeneratedType {
href: string;
rel: string;
type: string;
}
export interface ItunesOwner {
"itunes:email": string[];
"itunes:name": string[];
}
export interface RawItem {
title: string[];
description: string[];
link: string[];
guid: Guid[];
"dc:creator": string[];
pubDate: string[];
enclosure: Enclosure[];
"content:encoded": string[];
}
export interface Guid {
_: string;
$: GeneratedType2;
}
export interface GeneratedType2 {
isPermaLink: string;
}
export interface Enclosure {
$: GeneratedType3;
}
export interface GeneratedType3 {
url: string;
length: string;
type: string;
}
export type SubstackItem = {
title: string;
description: string;
link: string;
pubDate: string;
content: string;
};
export function getSubstackFeed(
feedUrl: string,
proxy?: boolean,
callback?: (err: Error | null, result: unknown) => void,
): Promise<string | undefined>;
export function getFeedByLink(rawFeed: unknown, link: string): RawFeedChannel[];
export function getPosts(channels: RawFeedChannel[]): SubstackItem[];
// Goodreads RSS Feed Parser
// Goodreads Public Types
export type GoodreadsItem = {
title: string;
link: string;
book_image_url: string;
author_name: string;
book_description: string;
[key: string]: unknown;
};
// Goodreads Public API
export const getGoodreadsFeed: (
feedUrl: string,
callback?: (err: Error | null, result: unknown) => void,
) => Promise<unknown>;
export const getGoodreadsFeedItems: (rawFeed: unknown) => GoodreadsItem[];