Ejemplo n.º 1
0
        public async Task UpdateIssueLinks()
        {
            var issue = await Client.Issue.GetAsync(TestIssueKey);

            var issueLink = new IssueLink
            {
                Add = new IssueLinkAdd
                {
                    Type = new IssuelinkType
                    {
                        Name    = "Relates",
                        Inward  = "relates to",
                        Outward = "relates to"
                    }
                }
            };

            var updateIssue = new Issue
            {
                Key    = issue.Key,
                Update = new Update
                {
                    IssueLinks = new List <IssueLink>()
                    {
                        issueLink
                    }
                }
            };
            await Client.Issue.UpdateAsync(updateIssue);
        }
Ejemplo n.º 2
0
 public static IssueLinkLight ToIssueLinkLight(IssueLink issueLink)
 => new IssueLinkLight
 {
     LinkType        = issueLink.LinkType.ToNamedObjectLight(),
     InwardIssueKey  = issueLink.InwardIssue.Key.Value,
     OutwardIssueKey = issueLink.OutwardIssue.Key.Value
 };
Ejemplo n.º 3
0
        /// <summary>
        ///     Create an issue link
        /// </summary>
        /// <param name="jiraClient">IIssueDomain to bind the extension method to</param>
        /// <param name="issueLink">IssueLink</param>
        /// <param name="cancellationToken">CancellationToken</param>
        public static async Task CreateIssueLinkAsync(this IIssueDomain jiraClient, IssueLink issueLink, CancellationToken cancellationToken = new CancellationToken())
        {
            var issueLinkUri = jiraClient.JiraRestUri.AppendSegments("issueLink");

            jiraClient.Behaviour.MakeCurrent();
            var response = await issueLinkUri.PostAsync <HttpResponse>(issueLink, cancellationToken).ConfigureAwait(false);

            response.HandleStatusCode(HttpStatusCode.Created);
        }
Ejemplo n.º 4
0
        public void DeleteIssueLink(IssueLink link)
        {
            try
            {
                var path    = $"issueLink/{link.id}";
                var request = CreateRequest(Method.DELETE, path);

                var response = ExecuteRequest(request);
                AssertStatus(response, HttpStatusCode.NoContent);
            }
            catch (Exception ex)
            {
                Trace.TraceError("DeleteIssueLink(link) error: {0}", ex);
                throw new JiraClientException("Could not delete issue link", ex);
            }
        }
Ejemplo n.º 5
0
        public async Task Test_ChangeIssueLinks()
        {
            var issue = await Client.Issue.GetAsync(TestIssueKey);

            var issueLinkCount = issue.Fields.IssueLinks.Count;

            var issueLinkTypes = await Client.Issue.GetIssueLinkTypesAsync();


            var issueLink = new IssueLink()
            {
                InwardIssue = new LinkedIssue
                {
                    Key = TestIssueKey
                },
                IssueLinkType = issueLinkTypes[0],
                OutwardIssue  = new LinkedIssue
                {
                    Key = TestIssueKey2
                }
            };

            await Client.Issue.CreateIssueLinkAsync(issueLink);

            issue = await Client.Issue.GetAsync(TestIssueKey);

            Assert.Equal(issueLinkCount + 1, issue.Fields.IssueLinks.Count);
            foreach (var issueLinkToDelete in issue.Fields.IssueLinks)
            {
                await Client.Issue.DeleteIssueLinkAsync(issueLinkToDelete.Id);
            }

            issue = await Client.Issue.GetAsync(TestIssueKey);

            Assert.Empty(issue.Fields.IssueLinks);
        }
Ejemplo n.º 6
0
 public void DeleteIssueLink(IssueLink link)
 {
     _client.DeleteIssueLink(link);
 }