-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathentities.ts
185 lines (172 loc) · 4.13 KB
/
entities.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
export type TagCategory =
| "fandom"
| "character"
| "relationship"
| "archive warning"
| "additional tags";
export interface Tag {
name: string;
// Not all tags have user-facing IDs Example: additional tags.
// TODO: figure out other types (or whether they can be extracted from somewhere else).
id: string | null;
category: TagCategory;
canonical: boolean;
common: boolean;
// Canonical name will be the same as "name" on canonical tags, and different on tags
// that have been synned to a canonical. It will be null when tags haven't been marked as
// common and cannot be filtered on.
canonicalName: string | null;
parentTags: string[];
childTags: Array<{
tagName: string;
category: TagCategory;
}>;
subTags: Array<{
tagName: string;
parentSubTag: string | null;
}>;
}
export interface User {
id: string;
username: string;
pseuds: string;
url: string;
icon: string;
header: string | null;
joined: string;
location: string | null;
birthday: string | null;
works: number;
series: number;
bookmarks: number;
collections: number;
gifts: number;
bioHtml: string | null;
}
export interface SeriesWorkSummary
extends Omit<
WorkSummary,
| "category"
| "publishedAt"
| "rating"
| "tags"
| "stats"
| "locked"
| "chapterInfo"
| "series"
> {
url: string;
tags: Omit<WorkSummary["tags"], "warnings">;
stats: Omit<WorkSummary["stats"], "comments">;
}
export interface Series {
id: string;
name: string;
startedAt: string;
updatedAt: string;
authors: WorkSummary["authors"];
description: string | null;
notes: string | null;
words: number;
bookmarks: number;
complete: boolean;
workCount: number;
works: SeriesWorkSummary[];
}
export enum WorkRatings {
NOT_RATED = "Not Rated",
GENERAL_AUDIENCES = "General Audiences",
TEEN_AND_UP_AUDIENCES = "Teen And Up Audiences",
MATURE = "Mature",
EXPLICIT = "Explicit",
}
export enum WorkCategory {
FF = "F/F",
FM = "F/M",
GEN = "Gen",
MM = "M/M",
MULTI = "Multi",
OTHER = "Other",
}
export enum WorkWarningStatus {
NO_WARNINGS_APPLY = "Author indicated no warnings apply",
CHOOSE_NOT_TO_WARN = "Author chose not to warn",
EXTERNAL = "External work",
HAS_WARNING = "Work has one or more warning",
}
export enum WorkWarnings {
GRAPHIC_VIOLENCE = "Graphic Depictions Of Violence",
MAJOR_CHARACTER_DEATH = "Major Character Death",
NO_WARNINGS_APPLY = "No Archive Warnings Apply",
NONCON = "Rape/Non-Con",
UNDERAGE = "Underage Sex",
CHOOSE_NOT_TO_WARN = "Creator Chose Not To Use Archive Warnings",
}
export interface BasicSeries {
id: string;
index: number;
name: string;
}
export interface Author {
username: string;
pseud: string;
anonymous: boolean;
}
export interface WorkSummary {
id: string;
title: string;
category: WorkCategory[] | null;
// Date in ISO format. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
// Note that AO3 doesn't publish the actual time of publish, just the date.
publishedAt: string;
updatedAt: string | null;
// TODO: should this be in HTML?
summary: string | null;
rating: WorkRatings;
// Whether this work will display the "this work could have adult content" banner
// upon access.
adult: boolean;
fandoms: string[];
tags: {
warnings: WorkWarnings[];
characters: string[];
relationships: string[];
additional: string[];
};
// If the author is anonymous this array will contain a single
// entry whose "anonymous" property is "true".
authors: Author[];
language: string;
words: number;
chapters: {
published: number;
total: number | null;
};
chapterInfo: {
id: string;
index: number;
name: string | null;
summary: string | null;
} | null;
series: BasicSeries[];
complete: boolean;
stats: {
bookmarks: number;
comments: number;
kudos: number;
hits: number;
};
locked: false;
}
export interface LockedWorkSummary {
id: string;
locked: true;
}
export interface Chapter {
id: string;
workId: string;
index: number;
title: string;
publishedAt: string;
url: string;
}