@@ -111,6 +111,9 @@ public class IssuesWs implements WebService { | |||
action.createParam("assigned") | |||
.setDescription("To retrieve assigned or unassigned issues") | |||
.setBooleanPossibleValues(); | |||
action.createParam("extra_fields") | |||
.setDescription("Add some extra fields on each issue. Available since 4.4") | |||
.setPossibleValues("actions", "transitions"); | |||
action.createParam("createdAfter") | |||
.setDescription("To retrieve issues created after the given date (inclusive). Format: date or datetime ISO formats") | |||
.setExampleValue("2013-05-01 (or 2013-05-01T13:00:00+0100)"); |
@@ -28,6 +28,12 @@ | |||
"htmlText": "foooooo", | |||
"createdAt": "2013-05-13T18:08:34+0200" | |||
} | |||
], | |||
"actions": ["link-to-jira"], | |||
"transitions": [ | |||
"unconfirm", | |||
"resolve", | |||
"falsepositive" | |||
] | |||
} | |||
], |
@@ -32,7 +32,7 @@ class Api::IssuesController < Api::ApiController | |||
hash = { | |||
:maxResultsReached => results.maxResultsReached, | |||
:paging => paging_to_hash(results.paging), | |||
:issues => results.issues.map { |issue| Issue.to_hash(issue) }, | |||
:issues => results.issues.map { |issue| Issue.to_hash(issue, params[:extra_fields]) }, | |||
:components => results.components.map { |component| component_to_hash(component) }, | |||
:projects => results.projects.map { |project| component_to_hash(project) }, | |||
:rules => results.rules.map { |rule| Rule.to_hash(rule) }, |
@@ -20,7 +20,7 @@ | |||
class Issue | |||
def self.to_hash(issue) | |||
def self.to_hash(issue, extra_params={}) | |||
hash = { | |||
:key => issue.key, | |||
:component => issue.componentKey, | |||
@@ -47,6 +47,10 @@ class Issue | |||
if issue.comments.size>0 | |||
hash[:comments] = issue.comments.map { |c| comment_to_hash(c) } | |||
end | |||
unless extra_params.blank? | |||
hash[:actions] = Internal.issues.listActions(issue).map { |t| t.key() } if extra_params.include? 'actions' | |||
hash[:transitions] = Internal.issues.listTransitions(issue).map { |t| t.key() } if extra_params.include? 'transitions' | |||
end | |||
hash | |||
end | |||
@@ -89,7 +89,7 @@ public class IssuesWsTest { | |||
assertThat(show.isInternal()).isFalse(); | |||
assertThat(show.handler()).isInstanceOf(RailsHandler.class); | |||
assertThat(show.responseExampleAsString()).isNotEmpty(); | |||
assertThat(show.params()).hasSize(18); | |||
assertThat(show.params()).hasSize(19); | |||
} | |||
@Test |