-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.go
379 lines (360 loc) · 14.1 KB
/
model.go
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
package yuqueg
import "time"
var (
// BaseAPI address
BaseAPI = "https://www.yuque.com/api/v2/"
//EmptyRO empty options
EmptyRO = new(RequestOption)
)
// User UserSerializer
type User struct {
ID int `json:"id"`
Type string `json:"type"`
SpaceID int `json:"space_id"`
AccountID int `json:"account_id"`
Login string `json:"login"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
Public int `json:"public"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
}
//UserInfo JSON structure for the authorized user
type UserInfo struct {
Data User `json:"data"`
}
//Doc JSON structure for doc
type Doc struct {
ID int `json:"id"`
Slug string `json:"slug"`
Title string `json:"title"`
BookID int `json:"book_id"`
Book struct {
ID int `json:"id"`
Type string `json:"type"`
Slug string `json:"slug"`
Name string `json:"name"`
UserID int `json:"user_id"`
Description string `json:"description"`
CreatorID int `json:"creator_id"`
Public int `json:"public"`
ItemsCount int `json:"items_count"`
LikesCount int `json:"likes_count"`
WatchesCount int `json:"watches_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Namespace string `json:"namespace"`
User struct {
ID int `json:"id"`
Type string `json:"type"`
Login string `json:"login"`
Name string `json:"name"`
Description interface{} `json:"description"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
} `json:"user"`
Serializer string `json:"_serializer"`
} `json:"book"`
UserID int `json:"user_id"`
Creator struct {
ID int `json:"id"`
Type string `json:"type"`
Login string `json:"login"`
Name string `json:"name"`
Description string `json:"description"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
} `json:"creator"`
Format string `json:"format"`
Body string `json:"body"`
BodyDraft string `json:"body_draft"`
BodyHTML string `json:"body_html"`
BodyLake string `json:"body_lake"`
Public int `json:"public"`
Status int `json:"status"`
LikesCount int `json:"likes_count"`
CommentsCount int `json:"comments_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
DeletedAt interface{} `json:"deleted_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PublishedAt time.Time `json:"published_at"`
FirstPublishedAt time.Time `json:"first_published_at"`
WordCount int `json:"word_count"`
Cover interface{} `json:"cover"`
Description string `json:"description"`
CustomDescription interface{} `json:"custom_description"`
Serializer string `json:"_serializer"`
}
// DocDetail JSON structure for a yuque document detail contents
type DocDetail struct {
Abilities struct {
Update bool `json:"update"`
Destroy bool `json:"destroy"`
} `json:"abilities"`
Data Doc `json:"data"`
}
//DocBookDetail of doc
type DocBookDetail struct {
ID int `json:"id"`
Slug string `json:"slug"`
Title string `json:"title"`
Description string `json:"description"`
UserID int `json:"user_id"`
BookID int `json:"book_id"`
Format string `json:"format"`
Public int `json:"public"`
Status int `json:"status"`
LikesCount int `json:"likes_count"`
CommentsCount int `json:"comments_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PublishedAt time.Time `json:"published_at"`
FirstPublishedAt time.Time `json:"first_published_at"`
DraftVersion int `json:"draft_version"`
LastEditorID int `json:"last_editor_id"`
WordCount int `json:"word_count"`
Cover interface{} `json:"cover"`
CustomDescription interface{} `json:"custom_description"`
LastEditor struct {
ID int `json:"id"`
Type string `json:"type"`
Login string `json:"login"`
Name string `json:"name"`
Description string `json:"description"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
} `json:"last_editor"`
Book Book `json:"book"`
Serializer string `json:"_serializer"`
}
// BookDetail JSON structure for a list of articles in the library
type BookDetail struct {
Data []DocBookDetail `json:"data"`
}
// Book JSON structure for a list of repositories in the group
type Book struct {
Data []struct {
ID int `json:"id"`
Type string `json:"type"`
Slug string `json:"slug"`
Name string `json:"name"`
UserID int `json:"user_id"`
Description string `json:"description"`
CreatorID int `json:"creator_id"`
Public int `json:"public"`
ItemsCount int `json:"items_count"`
LikesCount int `json:"likes_count"`
WatchesCount int `json:"watches_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Namespace string `json:"namespace"`
User User `json:"user"`
Serializer string `json:"_serializer"`
} `json:"data"`
}
//Groups JSON structure for user's groups
type Groups struct {
Data []struct {
ID int `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
TopicsCount int `json:"topics_count"`
PublicTopicsCount int `json:"public_topics_count"`
MembersCount int `json:"members_count"`
Public int `json:"public"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
} `json:"data"`
Abilities struct {
Read bool `json:"read"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
GroupUser struct {
Create bool `json:"create"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
} `json:"group_user"`
Repo struct {
Create bool `json:"create"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
} `json:"repo"`
} `json:"abilities"`
}
//GroupDetail JSON structure for user's groups
type GroupDetail struct {
Data struct {
ID int `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
TopicsCount int `json:"topics_count"`
PublicTopicsCount int `json:"public_topics_count"`
MembersCount int `json:"members_count"`
Public int `json:"public"`
OwnerId int `json:"owner_id"`
SpaceId int `json:"space_id"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
} `json:"data"`
Abilities struct {
Read bool `json:"read"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
GroupUser struct {
Create bool `json:"create"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
} `json:"group_user"`
Repo struct {
Create bool `json:"create"`
Update bool `json:"update"`
Destroy bool `json:"destroy"`
} `json:"repo"`
} `json:"abilities"`
}
type GroupUser struct {
ID int `json:"id"`
GroupId int `json:"group_id"`
UserId int `json:"user_id"`
Role int `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
User User `json:"user"`
Serializer string `json:"_serializer"`
}
type GroupUserInfo struct {
Data GroupUser `json:"data"`
}
type GroupUsers struct {
Data []GroupUser `json:"data"`
}
type RemoveUserResponse struct {
Data struct {
UserId int `json:"user_id"`
} `json:"data"`
}
//RepoUser
type RepoUser struct {
ID int `json:"id"`
Type string `json:"type"`
Login string `json:"login"`
Name string `json:"name"`
Description string `json:"description"`
AvatarURL string `json:"avatar_url"`
LargeAvatarURL string `json:"large_avatar_url"`
MediumAvatarURL string `json:"medium_avatar_url"`
SmallAvatarURL string `json:"small_avatar_url"`
BooksCount int `json:"books_count"`
PublicBooksCount int `json:"public_books_count"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Serializer string `json:"_serializer"`
}
// UserRepos JSON structure for user's repos
type UserRepos struct {
Data []struct {
ID int `json:"id"`
Type string `json:"type"`
Slug string `json:"slug"`
Name string `json:"name"`
UserID int `json:"user_id"`
Description string `json:"description"`
CreatorID int `json:"creator_id"`
Public int `json:"public"`
ItemsCount int `json:"items_count"`
LikesCount int `json:"likes_count"`
WatchesCount int `json:"watches_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Namespace string `json:"namespace"`
User RepoUser `json:"user"`
Serializer string `json:"_serializer"`
} `json:"data"`
}
// UserRepo JSON structure for create user's repo
type CreateUserRepo struct {
Data struct {
ID int `json:"id"`
Type string `json:"type"`
Slug string `json:"slug"`
Name string `json:"name"`
UserID int `json:"user_id"`
Description string `json:"description"`
CreatorID int `json:"creator_id"`
Public int `json:"public"`
ItemsCount int `json:"items_count"`
LikesCount int `json:"likes_count"`
WatchesCount int `json:"watches_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Namespace string `json:"namespace"`
User RepoUser `json:"user"`
TocYml string `json:"toc_yml"`
Serializer string `json:"_serializer"`
} `json:"data"`
}
type RepoToc struct {
Data []struct {
Title string `json:"title"`
Slug string `json:"slug"`
Depth int `json:"depth"`
} `json:"data"`
}