-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathtypes.lua
413 lines (372 loc) · 11.9 KB
/
types.lua
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
---@alias interpret.state
---| "PENDING"
---| "STARTED"
---| "SUCCESS"
---| "FAILURE"
---@class lc.Interpreter.item
---@field title string
---@field hl string
---@field submission boolean
---@field success boolean
---@class lc.Interpreter.Response
---@field status_code integer
---@field lang string
---@field run_success boolean
---@field compile_error string
---@field full_compile_error string
---@field full_runtime_error string
---@field status_runtime string
---@field memory integer
---@field code_answer string[]
---@field expected_code_answer string[]
---@field code_output table
---@field std_output_list table
---@field task_finish_time integer
---@field task_name string
---@field correct_answer boolean
---@field total_correct any
---@field total_testcases any
---@field runtime_percentile any
---@field status_memory string
---@field memory_percentile any
---@field pretty_lang string
---@field submission_id string
---@field status_msg string
---@field state interpret.state
---@field case_idx integer
---@field _ lc.Interpreter.item
--------------------------------------------
--- Runtime Error | 15
--------------------------------------------
---@class lc.Interpreter.Response.runtime_error
---@field status_code number
---@field lang string
---@field run_success boolean
---@field runtime_error string
---@field full_runtime_error string
---@field status_runtime string
---@field memory number
---@field code_answer table
---@field code_output table
---@field std_output_list table
---@field elapsed_time number
---@field invalid_testcase boolean
---@field task_finish_time number
---@field task_name string
---@field total_correct any
---@field total_testcases any
---@field runtime_percentile any
---@field status_memory string
---@field memory_percentile any
---@field pretty_lang string
---@field submission_id string
---@field status_msg string
---@field state string
---@field question_id string
---@field compare_result string
---@field std_output string
---@field last_testcase string
---@field expected_output string
---@field finished boolean
---@field _ lc.Interpreter.item
---@alias lc.runtime_error lc.Interpreter.Response.runtime_error
--------------------------------------------
--- Runtime | 10
--------------------------------------------
---@class lc.Interpreter.Response.runtime
---@field status_code number
---@field lang string
---@field run_success boolean
---@field status_runtime string
---@field memory number
---@field display_runtime string
---@field code_answer table
---@field code_output table
---@field std_output_list table
---@field elapsed_time number
---@field task_finish_time number
---@field task_name string
---@field expected_status_code number
---@field expected_lang string
---@field expected_run_success boolean
---@field expected_status_runtime string
---@field expected_memory number
---@field expected_code_answer table
---@field expected_code_output table
---@field expected_std_output_list table
---@field expected_elapsed_time number
---@field expected_task_finish_time number
---@field expected_task_name string
---@field correct_answer boolean
---@field compare_result string
---@field total_correct number
---@field total_testcases number
---@field runtime_percentile number | nil
---@field status_memory string
---@field memory_percentile number | nil
---@field pretty_lang string
---@field submission_id string
---@field status_msg string
---@field state string
---@field lcnvim_is_submission boolean
---@field lcnvim_title string
---@field lcnvim_hl string
---@field _ lc.Interpreter.item
---@alias lc.runtime lc.Interpreter.Response.runtime
--------------------------------------------
--- Compile Error | 20
--------------------------------------------
---@class lc.Interpreter.Response.compile_error
---@field status_code number
---@field lang string
---@field run_success boolean
---@field compile_error string
---@field full_compile_error string
---@field status_runtime string
---@field memory number
---@field code_answer table
---@field code_output table
---@field std_output_list table
---@field task_finish_time number
---@field task_name string
---@field total_correct number | nil
---@field total_testcases number | nil
---@field runtime_percentile number | nil
---@field status_memory string
---@field memory_percentile number | nil
---@field pretty_lang string
---@field submission_id string
---@field status_msg string
---@field state string
---@field _ lc.Interpreter.item
---@alias lc.compile_error lc.Interpreter.Response.compile_error
--------------------------------------------
--- Time Limit Exceeded | 13, 14
--------------------------------------------
---@class lc.Interpreter.Response.limit.exceeded
---@field status_code number
---@field lang string
---@field run_success boolean
---@field status_runtime string
---@field memory number
---@field code_answer table
---@field code_output table
---@field std_output_list table
---@field std_output string
---@field task_finish_time number
---@field task_name string
---@field total_correct number | nil
---@field total_testcases number | nil
---@field runtime_percentile number | nil
---@field status_memory string
---@field memory_percentile number | nil
---@field pretty_lang string
---@field submission_id string
---@field status_msg string
---@field state string
---@field compare_result string | nil
---@field question_id string | nil
---@field elapsed_time number | nil
---@field last_testcase string | nil
---@field expected_output string | nil
---@field finished boolean | nil
---@field _ lc.Interpreter.item
---@alias lc.limit_exceeded_error lc.Interpreter.Response.limit.exceeded
--------------------------------------------
--- Time Limit Exceeded | 13, 14
--------------------------------------------
---@class lc.Interpreter.Response.internal.error
---@field status_code integer
---@field status_msg string
---@field state interpret.state
---@alias lc.internal_error lc.Interpreter.Response.internal.error
--------------------------------------------
--- Interpreter responses
--------------------------------------------
---@alias lc.interpreter_response
---| lc.runtime
---| lc.runtime_error
---| lc.compile_error
---| lc.limit_exceeded_error
---| lc.internal_error
--------------------------------------------
--- Code snipppet
--------------------------------------------
---@class lc.QuestionCodeSnippet
---@field lang string
---@field lang_slug string
---@field code string
---@alias code_snippet lc.QuestionCodeSnippet
--------------------------------------------
--- Metadata Param
--------------------------------------------
---@class lc.QuestionResponse.metadata.param
---@field name string
---@field type string
---@alias metadata_param lc.QuestionResponse.metadata.param
--------------------------------------------
--- Metadata Return
--------------------------------------------
---@class lc.QuestionResponse.metadata.return
---@field type string
---@field size integer
---@alias metadata_return lc.QuestionResponse.metadata.return
--------------------------------------------
--- Metadata
--------------------------------------------
---@class lc.QuestionResponse.metadata
---@field manual boolean
---@field name string
---@field database boolean
---@field params metadata_param[]
---@field return metadata_return
---@alias lc.metadata lc.QuestionResponse.metadata
--------------------------------------------
--- Question Response
--------------------------------------------
---@class lc.QuestionResponse.similar
---@field difficulty "Easy" | "Medium" | "Hard"
---@field title_slug string
---@field title string
---@field paid_only boolean
---@class lc.QuestionResponse
---@field id integer
---@field frontend_id integer
---@field title string
---@field translated_title string
---@field title_slug string
---@field is_paid_only boolean
---@field difficulty string
---@field likes integer
---@field dislikes integer
---@field category_title string
---@field content string
---@field translated_content string
---@field mysql_schemas string[]
---@field data_schemas string[]
---@field code_snippets code_snippet[]
---@field testcase_list string[]
---@field meta_data lc.metadata
---@field stats question_stats
---@field topic_tags lc.topic_tag[]
---@field hints table[]
---@field similar lc.QuestionResponse.similar[]
---@alias lc.question_res lc.QuestionResponse
---@class lc.topic_tag
---@field name string
---@field slug string
---@class question_stats
---@field acRate string
---@field totalAccepted string
---@field totalAcceptedRaw string
---@field totalSubmission string
---@field totalSubmissionRaw string
--------------------------------------------
--- Submission
--------------------------------------------
---@class lc.Interpreter.Response.submission
---@field status_code number
---@field lang string
---@field run_success boolean
---@field status_runtime string
---@field memory number
---@field display_runtime string
---@field question_id string
---@field elapsed_time number
---@field compare_result string
---@field code_output string
---@field std_output string
---@field last_testcase string
---@field expected_output string
---@field task_finish_time number
---@field task_name string
---@field finished boolean
---@field total_correct number
---@field total_testcases number
---@field runtime_percentile number | nil
---@field status_memory string
---@field memory_percentile number | nil
---@field pretty_lang string
---@field submission_id string
---@field input_formatted string
---@field input string
---@field status_msg string
---@field state string
---@field _ lc.Interpreter.item
---@alias lc.submission lc.Interpreter.Response.submission
--------------------------------------------
--- UserStatus
--------------------------------------------
---@class lc.UserStatus
---@field name string
---@field is_signed_in boolean
---@field is_premium boolean
---@field is_verified boolean
---@field id integer
---@field session_id integer
--------------------------------------------
--- Statistics
--------------------------------------------
---@class lc.Stats.CalendarData
---@field active_years table
---@field dcc_badges table
---@field streak number
---@field submission_calendar table<string, integer>
---@field total_active_days number
---@class lc.Stats.QuestionCount
---@field count number
---@field difficulty string
---@class lc.Stats.SolvedBeat
---@field difficulty string
---@field percentage number
---@class lc.Stats.SubmissionStat
---@field acSubmissionNum table
---@class lc.Stats.Res
---@field questions_count table<lc.Stats.QuestionCount>
---@field submit_stats lc.Stats.SubmissionStat
--------------------------------------------
--- Companies
--------------------------------------------
---@class lc.Companies.Res
---@field companyTags {name: string, slug: string, questionCount: number}[]
--------------------------------------------
--- Skills
--------------------------------------------
---@class lc.Skills.Skill
---@field tag string
---@field slug string
---@field problems_solved integer
---@class lc.Skills.Res
---@field advanced lc.Skills.Skill
---@field intermediate lc.Skills.Skill
---@field fundamental lc.Skills.Skill
--------------------------------------------
--- Languages
--------------------------------------------
---@class lc.Languages.Res
---@field advanced {tag: string, slug: string, problems_solved: number}[]
---@field intermediate {tag: string, slug: string, problems_solved: number}[]
---@field fundamental {tag: string, slug: string, problems_solved: number}[]
--------------------------------------------
--- Error
--------------------------------------------
---@class lc.Api.err
---@field code integer
---@field err string
---@field out string
---@field response table
---@field status integer
---@field msg string
---@field lvl integer
---@alias lc.err lc.Api.err|nil
--------------------------------------------
--- Sessions
--------------------------------------------
---@class lc.res.session
---@field ac_questions integer
---@field id integer
---@field is_active boolean
---@field name string
---@field submitted_questions integer
---@field total_acs integer
---@field total_submitted integer