Skip to content

Commit f1fc378

Browse files
committed
Added new fields to the question details object
1 parent 30fd926 commit f1fc378

File tree

3 files changed

+150
-1
lines changed

3 files changed

+150
-1
lines changed

docs/GraphqlQuestionDetail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
88
**bound_topic_id** | **str** | | [optional]
99
**title** | **str** | | [optional]
1010
**frequency** | **float** | | [optional]
11+
**freq_bar** | **float** | | [optional]
1112
**content** | **str** | | [optional]
1213
**translated_title** | **str** | | [optional]
1314
**translated_content** | **str** | | [optional]
@@ -16,15 +17,19 @@ Name | Type | Description | Notes
1617
**likes** | **int** | | [optional]
1718
**dislikes** | **int** | | [optional]
1819
**is_liked** | **bool** | | [optional]
20+
**is_favor** | **bool** | | [optional]
1921
**similar_questions** | **str** | | [optional]
2022
**contributors** | [**list[GraphqlQuestionContributor]**](GraphqlQuestionContributor.md) | | [optional]
2123
**lang_to_valid_playground** | **str** | | [optional]
2224
**topic_tags** | [**list[GraphqlQuestionTopicTag]**](GraphqlQuestionTopicTag.md) | | [optional]
2325
**company_tag_stats** | **str** | | [optional]
2426
**code_snippets** | [**list[GraphqlQuestionCodeSnippet]**](GraphqlQuestionCodeSnippet.md) | | [optional]
2527
**stats** | **str** | | [optional]
28+
**ac_rate** | **float** | | [optional]
2629
**hints** | **list[str]** | | [optional]
2730
**solution** | [**AnyOfGraphqlQuestionDetailSolution**](AnyOfGraphqlQuestionDetailSolution.md) | | [optional]
31+
**has_solution** | **bool** | | [optional]
32+
**has_video_solution** | **bool** | | [optional]
2833
**status** | **str** | | [optional]
2934
**sample_test_case** | **str** | | [optional]
3035
**judger_available** | **bool** | | [optional]

leetcode/models/graphql_question_detail.py

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class GraphqlQuestionDetail(object):
3333
'bound_topic_id': 'str',
3434
'title': 'str',
3535
'frequency': 'float',
36+
'freq_bar': 'float',
3637
'content': 'str',
3738
'translated_title': 'str',
3839
'translated_content': 'str',
@@ -41,15 +42,19 @@ class GraphqlQuestionDetail(object):
4142
'likes': 'int',
4243
'dislikes': 'int',
4344
'is_liked': 'bool',
45+
'is_favor': 'bool',
4446
'similar_questions': 'str',
4547
'contributors': 'list[GraphqlQuestionContributor]',
4648
'lang_to_valid_playground': 'str',
4749
'topic_tags': 'list[GraphqlQuestionTopicTag]',
4850
'company_tag_stats': 'str',
4951
'code_snippets': 'list[GraphqlQuestionCodeSnippet]',
5052
'stats': 'str',
53+
'ac_rate': 'float',
5154
'hints': 'list[str]',
5255
'solution': 'AnyOfGraphqlQuestionDetailSolution',
56+
'has_solution': 'bool',
57+
'has_video_solution': 'bool',
5358
'status': 'str',
5459
'sample_test_case': 'str',
5560
'judger_available': 'bool',
@@ -68,6 +73,7 @@ class GraphqlQuestionDetail(object):
6873
'bound_topic_id': 'boundTopicId',
6974
'title': 'title',
7075
'frequency': 'frequency',
76+
'freq_bar': 'freqBar',
7177
'content': 'content',
7278
'translated_title': 'translatedTitle',
7379
'translated_content': 'translatedContent',
@@ -76,15 +82,19 @@ class GraphqlQuestionDetail(object):
7682
'likes': 'likes',
7783
'dislikes': 'dislikes',
7884
'is_liked': 'isLiked',
85+
'is_favor': 'isFavor',
7986
'similar_questions': 'similarQuestions',
8087
'contributors': 'contributors',
8188
'lang_to_valid_playground': 'langToValidPlayground',
8289
'topic_tags': 'topicTags',
8390
'company_tag_stats': 'companyTagStats',
8491
'code_snippets': 'codeSnippets',
8592
'stats': 'stats',
93+
'ac_rate': 'acRate',
8694
'hints': 'hints',
8795
'solution': 'solution',
96+
'has_solution': 'hasSolution',
97+
'has_video_solution': 'hasVideoSolution',
8898
'status': 'status',
8999
'sample_test_case': 'sampleTestCase',
90100
'judger_available': 'judgerAvailable',
@@ -97,13 +107,14 @@ class GraphqlQuestionDetail(object):
97107
'code_definition': 'codeDefinition'
98108
}
99109

100-
def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=None, title=None, frequency=None, content=None, translated_title=None, translated_content=None, is_paid_only=None, difficulty=None, likes=None, dislikes=None, is_liked=None, similar_questions=None, contributors=None, lang_to_valid_playground=None, topic_tags=None, company_tag_stats=None, code_snippets=None, stats=None, hints=None, solution=None, status=None, sample_test_case=None, judger_available=None, judge_type=None, mysql_schemas=None, enable_run_code=None, enable_test_mode=None, env_info=None, meta_data=None, code_definition=None): # noqa: E501
110+
def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=None, title=None, frequency=None, freq_bar=None, content=None, translated_title=None, translated_content=None, is_paid_only=None, difficulty=None, likes=None, dislikes=None, is_liked=None, is_favor=None, similar_questions=None, contributors=None, lang_to_valid_playground=None, topic_tags=None, company_tag_stats=None, code_snippets=None, stats=None, ac_rate=None, hints=None, solution=None, has_solution=None, has_video_solution=None, status=None, sample_test_case=None, judger_available=None, judge_type=None, mysql_schemas=None, enable_run_code=None, enable_test_mode=None, env_info=None, meta_data=None, code_definition=None): # noqa: E501
101111
"""GraphqlQuestionDetail - a model defined in Swagger""" # noqa: E501
102112
self._question_id = None
103113
self._question_frontend_id = None
104114
self._bound_topic_id = None
105115
self._title = None
106116
self._frequency = None
117+
self._freq_bar = None
107118
self._content = None
108119
self._translated_title = None
109120
self._translated_content = None
@@ -112,15 +123,19 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
112123
self._likes = None
113124
self._dislikes = None
114125
self._is_liked = None
126+
self._is_favor = None
115127
self._similar_questions = None
116128
self._contributors = None
117129
self._lang_to_valid_playground = None
118130
self._topic_tags = None
119131
self._company_tag_stats = None
120132
self._code_snippets = None
121133
self._stats = None
134+
self._ac_rate = None
122135
self._hints = None
123136
self._solution = None
137+
self._has_solution = None
138+
self._has_video_solution = None
124139
self._status = None
125140
self._sample_test_case = None
126141
self._judger_available = None
@@ -142,6 +157,8 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
142157
self.title = title
143158
if frequency is not None:
144159
self.frequency = frequency
160+
if freq_bar is not None:
161+
self.freq_bar = freq_bar
145162
if content is not None:
146163
self.content = content
147164
if translated_title is not None:
@@ -158,6 +175,8 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
158175
self.dislikes = dislikes
159176
if is_liked is not None:
160177
self.is_liked = is_liked
178+
if is_favor is not None:
179+
self.is_favor = is_favor
161180
if similar_questions is not None:
162181
self.similar_questions = similar_questions
163182
if contributors is not None:
@@ -172,10 +191,16 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
172191
self.code_snippets = code_snippets
173192
if stats is not None:
174193
self.stats = stats
194+
if ac_rate is not None:
195+
self.ac_rate = ac_rate
175196
if hints is not None:
176197
self.hints = hints
177198
if solution is not None:
178199
self.solution = solution
200+
if has_solution is not None:
201+
self.has_solution = has_solution
202+
if has_video_solution is not None:
203+
self.has_video_solution = has_video_solution
179204
if status is not None:
180205
self.status = status
181206
if sample_test_case is not None:
@@ -302,6 +327,27 @@ def frequency(self, frequency):
302327

303328
self._frequency = frequency
304329

330+
@property
331+
def freq_bar(self):
332+
"""Gets the freq_bar of this GraphqlQuestionDetail. # noqa: E501
333+
334+
335+
:return: The freq_bar of this GraphqlQuestionDetail. # noqa: E501
336+
:rtype: float
337+
"""
338+
return self._freq_bar
339+
340+
@freq_bar.setter
341+
def freq_bar(self, freq_bar):
342+
"""Sets the freq_bar of this GraphqlQuestionDetail.
343+
344+
345+
:param freq_bar: The freq_bar of this GraphqlQuestionDetail. # noqa: E501
346+
:type: float
347+
"""
348+
349+
self._freq_bar = freq_bar
350+
305351
@property
306352
def content(self):
307353
"""Gets the content of this GraphqlQuestionDetail. # noqa: E501
@@ -470,6 +516,27 @@ def is_liked(self, is_liked):
470516

471517
self._is_liked = is_liked
472518

519+
@property
520+
def is_favor(self):
521+
"""Gets the is_favor of this GraphqlQuestionDetail. # noqa: E501
522+
523+
524+
:return: The is_favor of this GraphqlQuestionDetail. # noqa: E501
525+
:rtype: bool
526+
"""
527+
return self._is_favor
528+
529+
@is_favor.setter
530+
def is_favor(self, is_favor):
531+
"""Sets the is_favor of this GraphqlQuestionDetail.
532+
533+
534+
:param is_favor: The is_favor of this GraphqlQuestionDetail. # noqa: E501
535+
:type: bool
536+
"""
537+
538+
self._is_favor = is_favor
539+
473540
@property
474541
def similar_questions(self):
475542
"""Gets the similar_questions of this GraphqlQuestionDetail. # noqa: E501
@@ -617,6 +684,27 @@ def stats(self, stats):
617684

618685
self._stats = stats
619686

687+
@property
688+
def ac_rate(self):
689+
"""Gets the ac_rate of this GraphqlQuestionDetail. # noqa: E501
690+
691+
692+
:return: The ac_rate of this GraphqlQuestionDetail. # noqa: E501
693+
:rtype: float
694+
"""
695+
return self._ac_rate
696+
697+
@ac_rate.setter
698+
def ac_rate(self, ac_rate):
699+
"""Sets the ac_rate of this GraphqlQuestionDetail.
700+
701+
702+
:param ac_rate: The ac_rate of this GraphqlQuestionDetail. # noqa: E501
703+
:type: float
704+
"""
705+
706+
self._ac_rate = ac_rate
707+
620708
@property
621709
def hints(self):
622710
"""Gets the hints of this GraphqlQuestionDetail. # noqa: E501
@@ -659,6 +747,48 @@ def solution(self, solution):
659747

660748
self._solution = solution
661749

750+
@property
751+
def has_solution(self):
752+
"""Gets the has_solution of this GraphqlQuestionDetail. # noqa: E501
753+
754+
755+
:return: The has_solution of this GraphqlQuestionDetail. # noqa: E501
756+
:rtype: bool
757+
"""
758+
return self._has_solution
759+
760+
@has_solution.setter
761+
def has_solution(self, has_solution):
762+
"""Sets the has_solution of this GraphqlQuestionDetail.
763+
764+
765+
:param has_solution: The has_solution of this GraphqlQuestionDetail. # noqa: E501
766+
:type: bool
767+
"""
768+
769+
self._has_solution = has_solution
770+
771+
@property
772+
def has_video_solution(self):
773+
"""Gets the has_video_solution of this GraphqlQuestionDetail. # noqa: E501
774+
775+
776+
:return: The has_video_solution of this GraphqlQuestionDetail. # noqa: E501
777+
:rtype: bool
778+
"""
779+
return self._has_video_solution
780+
781+
@has_video_solution.setter
782+
def has_video_solution(self, has_video_solution):
783+
"""Sets the has_video_solution of this GraphqlQuestionDetail.
784+
785+
786+
:param has_video_solution: The has_video_solution of this GraphqlQuestionDetail. # noqa: E501
787+
:type: bool
788+
"""
789+
790+
self._has_video_solution = has_video_solution
791+
662792
@property
663793
def status(self):
664794
"""Gets the status of this GraphqlQuestionDetail. # noqa: E501

test/test_graphql_request_get_question_detail.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ def test_request(self) -> None:
1414
questionFrontendId
1515
boundTopicId
1616
title
17+
frequency
18+
freqBar
1719
content
1820
translatedTitle
1921
isPaidOnly
2022
difficulty
2123
likes
2224
dislikes
2325
isLiked
26+
isFavor
2427
similarQuestions
2528
contributors {
2629
username
@@ -43,13 +46,16 @@ def test_request(self) -> None:
4346
__typename
4447
}
4548
stats
49+
acRate
4650
codeDefinition
4751
hints
4852
solution {
4953
id
5054
canSeeDetail
5155
__typename
5256
}
57+
hasSolution
58+
hasVideoSolution
5359
status
5460
sampleTestCase
5561
enableRunCode
@@ -83,13 +89,16 @@ def test_request(self) -> None:
8389
assert question.question_frontend_id == "1"
8490
assert question.bound_topic_id is None
8591
assert question.title == "Two Sum"
92+
assert question.frequency == 0.0
93+
assert question.freq_bar > 0
8694
assert len(question.content) > 10
8795
assert question.translated_title is None
8896
assert question.is_paid_only is False
8997
assert question.difficulty == "Easy"
9098
assert question.likes > 0
9199
assert question.dislikes > 0
92100
assert question.is_liked is None
101+
assert question.is_favor in (True, False)
93102
assert json.loads(question.similar_questions)[0]["difficulty"] in (
94103
"Easy",
95104
"Medium",
@@ -126,6 +135,8 @@ def test_request(self) -> None:
126135
assert int(stats["totalAcceptedRaw"]) > 0
127136
assert int(stats["totalSubmissionRaw"]) > 0
128137

138+
assert question.ac_rate > 0
139+
129140
code_definition = json.loads(question.code_definition)[0]
130141

131142
assert len(code_definition["value"]) > 0
@@ -144,6 +155,9 @@ def test_request(self) -> None:
144155
assert solution["canSeeDetail"] in (True, False)
145156
assert int(solution["id"]) > 0
146157

158+
assert question.has_solution in (True, False)
159+
assert question.has_video_solution in (True, False)
160+
147161
assert question.status in ("ac", "not_started", "tried")
148162

149163
assert len(question.sample_test_case) > 0

0 commit comments

Comments
 (0)