public void Test_Put_Request_With_Issue()
        {
            _restSharpConnection.Authenticate("*****@*****.**", "mozart");
            dynamic issue = new Issue();

            issue.Summary          = "YT Test Issue";
            issue.Description      = "YT test description";
            issue.ProjectShortName = "NAT";
            var     comments = new List <Comment>();
            Comment comment  = new Comment();

            comment.Author    = "Meagan";
            comment.Text      = "comment added from apitest";
            issue.Comments    = comments;
            issue.Subsystem   = "Documentation";
            issue.Type        = "task";
            issue.Assignee    = "Meagan Combs";
            issue.Priority    = "Critical";
            issue.WorkHours   = 8;
            issue.CustomField = "customfield";
            issue.Created     = "";

            var fieldList = issue.ToExpandoObject();

            IssueManagement issueManagement = new IssueManagement(_restSharpConnection);

            //  var issueId = issueManagement.CreateIssue(issue);
            issueManagement.ApplyCommand("NAT-41", "Assignee Meagan_Combs", "");
            var issues = issueManagement.GetAllIssuesForProject("NAT");
        }
        /// <summary>
        /// Ons the given event.
        /// </summary>
        /// <param name="event"> The event.</param>
        public void On(Event <LogEventData> @event)
        {
            var connection = GetConnection();

            if (connection == null)
            {
                return;
            }

            try
            {
                var issueManagement = new IssueManagement(connection);

                dynamic issue = new Issue();

                var payload = GetPayload(@event);
                issue.Summary          = this._summaryTemplate.Value(payload);
                issue.Description      = this._bodyTemplate.Value(payload);
                issue.ProjectShortName = this.ProjectId;
                issue.Type             = this.YouTrackIssueType.IsSet() ? this.YouTrackIssueType : "Auto-reported Exception";

                string issueNumber = issueManagement.CreateIssue(issue);

                if (issueNumber.IsSet())
                {
                    Log.Information(
                        "Issue {YouTrackIssueNumber} Created in YouTrack {IssueUrl}",
                        issueNumber,
                        $"{GetYouTrackUri().ToFormattedUrl()}/issue/{issueNumber}");

                    issueManagement.ApplyCommand(issueNumber, "comment", $"Posted from Seq Event Timestamp UTC: {@event.TimestampUtc}");

                    if (AttachCopyOfEventToIssue)
                    {
                        var file = GetJsonEventFile(@event, issueNumber);
                        issueManagement.AttachFileToIssue(issueNumber, file);
                        try
                        {
                            File.Delete(file);
                        }
                        catch
                        {
                            // can't say I care too much...
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                // failure creating issue
                this.Log.Error(ex, "Failure Creating Issue on YouTrack {YouTrackUrl}", GetYouTrackUri().ToFormattedUrl());
            }
        }
예제 #3
0
 protected override void ProcessRecord()
 {
     IssueManagement.ApplyCommand(IssueId, Command, Comment);
 }
예제 #4
0
        public void SubmitComment(string issueId, string text)
        {
            var im = new IssueManagement(Connection);

            im.ApplyCommand(issueId, null, text);
        }