-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
105 lines (90 loc) · 2.12 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
export type RawFeed = {
rss: {
channel: RawFeedChannel[];
[key: string]: any;
};
};
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 isRawFeed(
feed: any,
): feed is { rss: { channel: RawFeedChannel[] } };
export function isRawFeedChannel(channel: any): channel is RawFeedChannel;
export const CORS_PROXY: string;
export function getRawXMLSubstackFeed(feedUrl: string): Promise<string>;
export function parseXML(
xml?: string,
callback?: (err: Error | null, result: any) => void,
): Promise<void>;
export function transformRawItem(item: RawItem): SubstackItem;
export function getSubstackFeed(
feedUrl: string,
callback: (err: Error | null, result: any) => void,
): Promise<void>;
export function getFeedByLink(rawFeed: any, link: string): RawFeedChannel[];
export function getPosts(channels: RawFeedChannel[]): SubstackItem[];