Esempio n. 1
0
        public static async Task <IEnumerable <JiraIssue> > GetIssuesAsync(JiraOptions opts)
        {
            ValidateOptions(opts);

            var awaitableJsonIssues = JiraConnector.GetIssuesAsync(opts);

            opts.ThrowIfCancellationRequested();

            var jsonStatuses = await JiraConnector.GetStatusesAsync(opts);

            opts.ThrowIfCancellationRequested();

            var jsonVersions = await JiraConnector.GetVersionsAsync(opts);

            opts.ThrowIfCancellationRequested();

            var statuses = new JiraStatusCollection(jsonStatuses.Select(j => new JiraStatus(j)));
            var versions = new JiraFixVersionCollection(jsonVersions.Select(j => new JiraFixVersion(j)));
            var issues   = new JiraIssueCollection();

            if (opts.MaxResults.HasValue && opts.MaxResults > 0)
            {
                awaitableJsonIssues = awaitableJsonIssues.Take(opts.MaxResults.Value);
            }

            await foreach (var issue in awaitableJsonIssues)
            {
                opts.ThrowIfCancellationRequested();
                issues.Add(JiraIssueAssembler.Assemble(opts, issue, statuses, versions));
            }

            return(issues);
        }
 private JiraIssueAssembler(JiraOptions options, JsonJiraIssue jsonIssue, JiraStatusCollection statuses, JiraFixVersionCollection versions)
 {
     this._options    = options;
     this._jsonIssue  = jsonIssue;
     this._statuses   = statuses;
     this._versions   = versions;
     this._components = new JiraComponentCollection();
     this._issueTypes = new JiraIssueTypeCollection();
     this._issue      = new JiraIssue();
 }
 public static JiraIssue Assemble(JiraOptions options, JsonJiraIssue jsonIssue, JiraStatusCollection statuses, JiraFixVersionCollection versions)
 {
     return(new JiraIssueAssembler(options, jsonIssue, statuses, versions).Assemble());
 }