public async Task <IEnumerable <JiraIssue> > Find(Jql searchQuery) { var body = new { jql = searchQuery.ToString(), startAt = 0 }; HttpResponseMessage response = await this.jiraRestClient.Post(JiraEndpoint.Search, body); if (!response.IsSuccessStatusCode) { return(null); // TODO } string json = await response.Content.ReadAsStringAsync(); JiraResponse jiraResponse = JsonConvert.DeserializeObject <JiraResponse>(json); IEnumerable <JiraIssue> jiraIssues = jiraResponse.Issues; foreach (JiraIssue jiraIssue in jiraIssues) { jiraIssue.JiraRestClient = this.jiraRestClient; } return(jiraResponse.Issues); }
public async Task <IEnumerable <JiraTransition> > GetPossibleTransitions() { HttpResponseMessage response = await this.JiraRestClient.Get(JiraEndpoint.ForTransitions(this.Key)); if (!response.IsSuccessStatusCode) { return(null); // TODO } string json = await response.Content.ReadAsStringAsync(); JiraResponse jiraResponse = JsonConvert.DeserializeObject <JiraResponse>(json); return(jiraResponse.Transitions); }
public async Task <JiraResponse> SubmitComment(string issueKey, string commentText) { var body = new { body = commentText }; HttpResponseMessage response = await this.jiraRestClient.Post( JiraEndpoint.ForComment(issueKey), body); if (!response.IsSuccessStatusCode) { return(null); // TODO } string json = await response.Content.ReadAsStringAsync(); JiraResponse jiraResponse = JsonConvert.DeserializeObject <JiraResponse>(json); return(jiraResponse); }
public async Task <JiraResponse> TransitionTo(string transitionName) { string transitionId = await GetTransitionId(transitionName); if (transitionId == null) { return(null); // TODO } var body = new { transition = new { id = transitionId } }; HttpResponseMessage response = await this.JiraRestClient.Post( JiraEndpoint.ForTransitions(this.Key), body); if (!response.IsSuccessStatusCode) { return(null); // TODO } string json = await response.Content.ReadAsStringAsync(); JiraResponse jiraResponse = JsonConvert.DeserializeObject <JiraResponse>(json); return(jiraResponse); }