-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathapi-types.d.ts
293 lines (263 loc) · 5.91 KB
/
api-types.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
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/* ============================= MastoAPI Types ============================= */
/* Date string like 2025-01-01T10:34:12.000000Z */
export type Timestamp = string
export type Visibility = 'public' | 'unlisted' | 'private' | 'direct' | 'draft'
export type MediaType = 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
export type PreviewCardType = 'link' | 'photo' | 'video' | 'rich'
export type Application = {
name: string
website: string | undefined
scopes: Array<string>
redirect_uris: Array<string>
// Deprecated:
redirect_uri: string | undefined
vapid_key: string | undefined
}
export type MediaAttachment = {
id: string
type: MediaType
url: string
preview_url: string | null
remote_url: string | null
meta: MediaMetadata
description: string | null
blurhash: string | null
// Deprecated:
text_url: string | undefined
}
export type MediaMetadata = any // TODO
export type Mention = {
id: string
username: string
url: string
acct: string
}
export type Tag = {
name: string
url: string
}
export type CustomEmoji = {
shortcode: string
url: string
static_url: string
visible_in_picker: boolean
category: string | null
}
export type PreviewCard = {
url: string
title: string
description: string
type: PreviewCardType
authors: Array<PreviewCardAuthor>
author_name: string
author_url: string
provider_name: string
provider_url: string
html: string
width: number
height: number
image: string | null
embed_url: string
blurhash: string | null
}
export type PreviewCardAuthor = {
name: string
url: string
account: Account | null
}
export type Poll = {
id: string
expires_at: Timestamp | null
expired: boolean
multiple: boolean
votes_count: number
voters_count: number | null
options: PollOptions
emojis: Array<CustomEmoji>
voted: boolean
own_votes: Array<number>
}
export type PollOptions = {
title: string
votes_count: number | null
}
export type Relationship = {
blocking: boolean
domain_blocking
endorsed: boolean
followed_by?: boolean
following: boolean
following_since
id
muting: boolean
muting_notifications
requested: boolean
showing_reblogs
}
export type RelationshipFromFollowAPIResponse = {
blocking: boolean
domain_blocking: any | null
endorsed: boolean
followed_by?: boolean
following: boolean
id: string
muting: boolean
muting_notifications: any | null
requested: boolean
showing_reblogs: any | null
}
export type Account = {
/** value is username */
acct: string
avatar: string
created_at: Timestamp
discoverable: boolean
display_name: string
followers_count: number
following_count: number
header_bg: string | null
id: string
is_admin: boolean
last_fetched_at: null
local //: true,
location // : null
locked: boolean
/** bio */
note: string
/** bio */
note_text: string
pronouns: string[]
source: LoginUserSource
/** url of profile, for pixelfed: https://<instance>/<username> */
url: string
username: string
website: string
}
/** this is saved */
export interface LoginUserResponse extends Account {
statuses_count: number
settings: LoginUserSettings
}
export type LoginUserSettings = {
crawlable: boolean
disable_embeds: boolean
high_contrast_mode: boolean
indexable: boolean
is_suggestable: boolean
media_descriptions: boolean
public_dm: boolean
reduce_motion: boolean
show_atom: boolean
show_profile_follower_count: boolean
show_profile_following_count: boolean
video_autoplay: boolean
}
export type LoginUserSource = {
privacy: Visibility
sensitive: boolean
/** language code like 'en' */
language: string
/** bio */
note: string
fields: any[]
}
export type Status = {
id: string
created_at: Timestamp
in_reply_to_id: string | null
in_reply_to_account_id: string | null
sensitive: boolean
spoiler_text: string
visibility: Visibility
language: string | null
uri: string
url: string | null
replies_count: number
reblogs_count: number
favourites_count: number
edited_at: Timestamp | null
favourited: boolean | undefined
liked_at: Timestamp | null
reblogged: boolean | undefined
muted: boolean | undefined
bookmarked: boolean | undefined
pinned: boolean | undefined
filtered: boolean | undefined
content: string
reblog: Status | null
application: Application | undefined
account: Account
media_attachments: Array<MediaAttachment>
mentions: Array<Mention>
tags: Array<Tag>
emojis: Array<CustomEmoji>
card: Array<PreviewCard>
poll: Poll | null
local: boolean | undefined
liked_by: StatusLikedBy | null
pf_type: string | undefined
}
export type StatusLikedBy = {
id: string
others: boolean
total_count: number
total_count_pretty: number
url: string
username: string
}
type UpdateCredentialsParams = {
bio: string
website: string
display_name: string
note: string
avatar
locked: boolean
show_profile_follower_count: boolean
show_profile_following_count: boolean
crawlable: boolean
public_dm: boolean
disable_embeds: boolean
show_atom: boolean
is_suggestable: boolean
}
/* ========================== Infinite query types ========================== */
export type PaginatedStatus = {
data: Array<Status>
nextPage: string | undefined
prevPage: string | undefined
}
export type UploadV2Response = {
blurhash: string
description: string
id: string
preview_url: string
remote_url: string
text_url: string
type: string
url: string
}
export type UploadV2ErrorResponse = {
errors: {
file: string[]
}
message: string
}
type UploadV2ResponseOrError = UploadV2Response | UploadV2ErrorResponse
type UploadV2Params =
| {
file: unknown
}
| {
file: unknown
description: string
}
interface OpenServer {
domain: string
header_thumbnail: string
mobile_registration: boolean
version: string
short_description: string
user_count: number
last_seen_at: string
}
type OpenServersResponse = Array<OpenServer>