/// <summary>
 /// Gets the list of issues in the repository.
 /// If you issue this call without filtering parameters, the count value contains the total number of issues in the repository's tracker.
 /// If you filter this call, the count value contains the total number of issues that meet the filter criteria.
 /// </summary>
 /// <returns></returns>
 public IssuesInfo ListIssues(IssueSearchParameters parameters = null)
 {
     return(_repositoriesEndPoint.ListIssues(parameters));
 }
        /// <summary>
        /// Used to load bugs into the project object
        /// Gets issues from repository. Checks if there is a revision set, checks if issue has related then adds to project bugs
        /// </summary>
        /// <param name="p">the project to load the bugs for</param>
        /// <param name="branch">teh branch to load the bugs from</param>
        /// <param name="revision">the revision that the bug is for</param>
        internal void LoadBugs(Project p, string branch, string revision = null, bool myBugs = false)
        {
            currentProject = p;
            p.ResetBugList();
            bugPanel.Controls.Clear();
            branchCurrent = branch;
            auditLogPanel.Controls.Clear();

            List <Issue> correctBugs = new List <Issue>();
            //limit searches to bugs
            IssueSearchParameters searchParam = new IssueSearchParameters();

            searchParam.kind = "bug";
            //if we just want the current users assigned bugs then add responsible to the search param
            if (myBugs)
            {
                searchParam.responsible = u.AccountName;
            }
            //get list of issues
            List <Issue> issues = u.V1Api.RepositoriesEndPoint(p.ProjectOwner, p.ProjectName).IssuesResource().ListIssues(searchParam).issues;



            projectOwner.Text = p.ProjectOwner;
            projectTitle.Text = p.ProjectName;
            // serializer.Converters.Add(new StringEnumConverter());

            //if there are no issues of type bug then we have nobugs so inform the user
            if (issues == null || issues.Count == 0)
            {
                MessageBox.Show("No Bugs were found", "No Bugs were Found", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }
            foreach (Issue i in issues)
            {
                //Format of bug content
                //is issue text[REVISION:asdsadas,CLASSNAME:asdasdsa,METHODBLOCK:asdsada,LINENUM:dsasdas]
                //We need to strip out the formatting from the data in the bug content string
                string content = i.content;

                //removes left brace gives the bug issue in position 0 and rest of data in position 1
                string[] splitRemoveBracket = content.Split('[');
                string   issue = splitRemoveBracket[0];
                //we then split on comma to give revision class name etc into separete array locations
                string[] bugData = splitRemoveBracket[1].Split(',');
                //we then split each bugdata postion on: and take position 1 which gives us the correct data
                string revsionData = bugData[0].Split(':')[1];
                string classData   = bugData[1].Split(':')[1];
                string methodData  = bugData[2].Split(':')[1];
                string lineData    = bugData[3].Split(':')[1];
                string lineDataEnd = bugData[4].Split(':')[1];
                //for the last value we need to remove the ending brace so split and take the position 0
                lineDataEnd = lineDataEnd.Split(']')[0];


                Bug temp = new Bug(revsionData, classData, methodData, lineData, issue, i.reported_by.username, i.title, i.status, lineDataEnd);
                if (temp == null)
                {
                    Console.WriteLine("tmp is null");
                }

                if (i.responsible != null)
                {
                    //if username is null sets the value to a blank string
                    temp.Responsible = i.responsible.username ?? "";
                }
                //set the values of the temp bug
                temp.BugID     = (int)i.local_id;
                temp.CreatedOn = i.created_on;
                temp           = LoadBugsAuditLogs(temp, p);
                //checks if we are looking for bugs relating to a specific version
                if (revision != null)
                {
                    //if not null be only show certain bugs
                    if (temp.Revision.Equals(revision))
                    {
                        p.AddBug(temp);
                    }
                }
                else
                {
                    p.AddBug(temp);
                }

                //we also need to get all of the comments
            }
            int bugX = 2;
            int bugY = 10;

            // Console.WriteLine(p.Bugs.Count + "num of bugs");
            //we clear the bug panel just before adding the new ones
            bugPanel.Controls.Clear();
            foreach (Bug bug in p.Bugs)
            {
                BugList bl = new BugList(this, p, bug);
                bl.Location = new System.Drawing.Point(bugX, bugY);
                bugPanel.Controls.Add(bl);
                bugY = bugY + 100;
            }
        }
 internal IssuesInfo ListIssues(IssueSearchParameters parameters = null)
 {
     return(_sharpBucketV1.Get <IssuesInfo>(_issuesUrl, parameters));
 }