Show More
@@ -141,7 +141,8 b' def get_pull_request(request, apiuser, p' | |||||
141 |
|
141 | |||
142 |
|
142 | |||
143 | @jsonrpc_method() |
|
143 | @jsonrpc_method() | |
144 |
def get_pull_requests(request, apiuser, repoid, status=Optional('new') |
|
144 | def get_pull_requests(request, apiuser, repoid, status=Optional('new'), | |
|
145 | merge_state=Optional(True)): | |||
145 | """ |
|
146 | """ | |
146 | Get all pull requests from the repository specified in `repoid`. |
|
147 | Get all pull requests from the repository specified in `repoid`. | |
147 |
|
148 | |||
@@ -155,6 +156,9 b' def get_pull_requests(request, apiuser, ' | |||||
155 | * ``open`` |
|
156 | * ``open`` | |
156 | * ``closed`` |
|
157 | * ``closed`` | |
157 | :type status: str |
|
158 | :type status: str | |
|
159 | :param merge_state: Optional calculate merge state for each repository. | |||
|
160 | This could result in longer time to fetch the data | |||
|
161 | :type merge_state: bool | |||
158 |
|
162 | |||
159 | Example output: |
|
163 | Example output: | |
160 |
|
164 | |||
@@ -232,8 +236,10 b' def get_pull_requests(request, apiuser, ' | |||||
232 | validate_repo_permissions(apiuser, repoid, repo, _perms) |
|
236 | validate_repo_permissions(apiuser, repoid, repo, _perms) | |
233 |
|
237 | |||
234 | status = Optional.extract(status) |
|
238 | status = Optional.extract(status) | |
235 | pull_requests = PullRequestModel().get_all(repo, statuses=[status]) |
|
239 | merge_state = Optional.extract(merge_state, binary=True) | |
236 | data = [pr.get_api_data() for pr in pull_requests] |
|
240 | pull_requests = PullRequestModel().get_all(repo, statuses=[status], | |
|
241 | order_by='id', order_dir='desc') | |||
|
242 | data = [pr.get_api_data(with_merge_state=merge_state) for pr in pull_requests] | |||
237 | return data |
|
243 | return data | |
238 |
|
244 | |||
239 |
|
245 |
@@ -167,6 +167,7 b' class PullRequestModel(BaseModel):' | |||||
167 | if order_by: |
|
167 | if order_by: | |
168 | order_map = { |
|
168 | order_map = { | |
169 | 'name_raw': PullRequest.pull_request_id, |
|
169 | 'name_raw': PullRequest.pull_request_id, | |
|
170 | 'id': PullRequest.pull_request_id, | |||
170 | 'title': PullRequest.title, |
|
171 | 'title': PullRequest.title, | |
171 | 'updated_on_raw': PullRequest.updated_on, |
|
172 | 'updated_on_raw': PullRequest.updated_on, | |
172 | 'target_repo': PullRequest.target_repo_id |
|
173 | 'target_repo': PullRequest.target_repo_id |
General Comments 0
You need to be logged in to leave comments.
Login now