-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathglobal-types.ts
More file actions
123 lines (104 loc) · 3.57 KB
/
global-types.ts
File metadata and controls
123 lines (104 loc) · 3.57 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
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
import type { ApiQueryParams } from 'types-mediawiki-api';
type OneOrMore<T> = T | T[];
// Generators (modified from their ApiQueryParams counterparts)
export interface ApiQueryAllPagesGeneratorParameters extends ApiQueryParams {
gapfrom?: string;
gapcontinue?: string;
gapto?: string;
gapprefix?: string;
gapnamespace?: number;
gapfilterredir?: 'all' | 'nonredirects' | 'redirects';
gapminsize?: number;
gapmaxsize?: number;
gapprtype?: OneOrMore<'edit' | 'move' | 'upload'>;
gapprlevel?: OneOrMore<'' | 'autoconfirmed' | 'extendedconfirmed' | 'sysop' | 'templateeditor'>;
gapprfiltercascade?: 'all' | 'cascading' | 'noncascading';
gaplimit?: number | 'max';
gapdir?: 'ascending' | 'descending';
gapfilterlanglinks?: 'all' | 'withlanglinks' | 'withoutlanglinks';
gapprexpiry?: 'all' | 'definite' | 'indefinite';
}
// Page searches
export interface BacklinksResult {
query?: { backlinks: unknown[] };
}
export interface EmbeddedinResult {
query?: { embeddedin: unknown[] };
}
export interface SearchResult {
query?: { searchinfo: { totalhits: number } };
}
export interface CategoryMembersResult {
query: { categorymembers: { title: string }[] };
}
export interface LinksHereResult {
query: { pages: { title: string; linkshere?: { title: string; redirect: boolean }[] }[] };
}
export interface RedirectsResult {
query: { pages: { title: string; redirects?: { ns: number; title: string }[] }[] };
}
// Page information
export interface PageInfoResult {
query?: { pages: { missing?: string; redirect?: string }[] };
}
export interface PageParseResult {
parse?: { title: string; redirects: { to: string; tofragment: string }[]; sections: { line: string }[] };
}
export interface PagepropsResult {
query?: { pages: { pageprops?: { defaultsort?: string; disambiguation?: string; displaytitle?: string } }[] };
}
export interface CategoriesResult {
query?: { pages: { title: string; categories?: { title: string }[] }[] };
}
export interface AllMessagesResult {
query?: { allmessages: { name: string; content: string }[] };
}
export interface PageRevisionsResult {
batchcomplete: true;
query: {
pages: {
ns: number;
title: string;
missing?: true;
revisions?: {
slots: {
main: {
content: string;
contentmodel: string;
contentformat: string;
};
};
}[];
}[];
};
}
export interface TemplateDataParameterData {
type: string;
aliases: string[];
suggested: boolean;
required: boolean;
default: { en: string } | null;
example: { en: string } | null;
description: { en: string } | null;
label: { en: string } | null;
}
export interface TemplateDataResult {
pages: Record<
number,
{
title: string;
ns: number;
description: { en: string } | null;
format: string | null;
params: Record<number, TemplateDataParameterData>;
}
>;
}
// Other
export interface PageTriageListResponse {
pagetriagelist: { pages: { user_name: string; patrol_status: string }[]; result: string }; // eslint-disable-line @typescript-eslint/naming-convention
}
export type MediaWikiDataError = { error?: { code: string; info: string } } | undefined;
export type QueryContinuation =
| { batchcomplete?: true }
| { continue: { continue: string; [key: `${string}continue`]: string }; limits: Record<string, number> };