Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }