internal static JsonObject Generate(LinkIssuesInput linkIssuesInput, ServerInfo serverInfo)
        {
            var json = new JsonObject();

            if (serverInfo.BuildNumber >= ServerVersionConstants.BuildNumberJira5)
            {
                var jsonType = new JsonObject {
                    { "name", linkIssuesInput.LinkType }
                };
                var jsonInward = new JsonObject {
                    { "key", linkIssuesInput.FromIssueKey }
                };
                var jsonOutward = new JsonObject {
                    { "key", linkIssuesInput.ToIssueKey }
                };

                json.Add("type", jsonType.ToJson());
                json.Add("inwardIssue", jsonInward.ToJson());
                json.Add("outwardIssue", jsonOutward.ToJson());
            }
            else
            {
                json.Add("linkType", linkIssuesInput.LinkType);
                json.Add("fromIssueKey", linkIssuesInput.FromIssueKey);
                json.Add("toIssueKey", linkIssuesInput.ToIssueKey);
            }

            if (linkIssuesInput.Comment != null)
            {
                json.Add("comment", CommentJsonGenerator.Generate(linkIssuesInput.Comment, serverInfo).ToJson());
            }

            return(json);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates link between two issues and adds a comment (optional) to the source issues.
 /// </summary>
 /// <param name="linkIssuesInput">Details for the link and the comment (optional) to be created.</param>
 /// <exception cref="WebServiceException">If there was a problem linking the issues, or the the calling user does not have permission to link issues.</exception>
 public void LinkIssue(LinkIssuesInput linkIssuesInput)
 {
     client.Post <JsonObject>("issueLink", LinkIssuesInputJsonGenerator.Generate(linkIssuesInput, GetServerInfo()));
 }