-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapiTypes.ts
68 lines (56 loc) · 1.42 KB
/
apiTypes.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
// eslint-disable-next-line @typescript-eslint/triple-slash-reference,spaced-comment
/// <reference path="sefaria.d.ts" />
import {HighlightColor} from "./js/google_drive/types";
export interface Amud {
id: string;
sections: Section[];
}
export type CommentaryMap = Record<string, Commentary>;
export interface Commentary {
comments: ApiComment[];
}
interface Highlightable {
unhighlighted?: {he: sefaria.TextType, en: sefaria.TextType};
highlightColors?: Set<HighlightColor>;
}
export interface Section extends Highlightable {
ref: string;
he: sefaria.TextType;
en: sefaria.TextType;
commentary?: CommentaryMap;
hadran?: true;
steinsaltz_start_of_sugya?: true; // eslint-disable-line camelcase
startOfSection?: true;
lastSegmentOfSection?: true;
defaultMergeWithNext?: true;
}
export interface ApiComment extends Highlightable {
ref: string;
he: sefaria.TextType;
en: sefaria.TextType;
sourceRef: string;
sourceHeRef: string;
link?: string;
commentary?: CommentaryMap;
originalRefsBeforeRewriting?: string[];
expandedRefsAfterRewriting?: string[];
duplicateRefs?: string[];
}
export interface ApiResponse {
title: string;
titleHebrew: string;
id: string;
sections: Section[];
}
export interface ApiErrorResponse {
error: string;
code?: number;
id?: string;
}
export interface QueryGuess {
text: string;
url: string;
}
export interface QueryGuesses {
guesses: QueryGuess[];
}