예제 #1
0
 /// <summary>
 /// Construct new model by copying the contents of another model.
 /// </summary>
 /// <param name="other">The other model to copy from.</param>
 public JiraConnectionModel(JiraConnectionModel other)
 {
     this.server_name = other.ServerName;
     this.user = other.User;
     this.password = other.Password;
     this.selected_project = other.SelectedProject;
 }
예제 #2
0
 /// <summary>
 /// Get a list of all projects the current user has visibility of.
 /// </summary>
 /// <returns>A JArray of the projects.</returns>
 /// <see cref="https://docs.atlassian.com/jira/REST/latest/#idp2300240"/>
 public List<JiraProject> GetProjects(out string error)
 {
     JToken result = JiraComm.GetJson(this.Server, "/rest/api/2/project", this.User, this.Password, out error);
     if (null != result)
     {
         if (result.GetType() == typeof(JArray))
         {
             JArray jsonProjects = result as JArray;
             List<JiraProject> projects = new List<JiraProject>(jsonProjects.Count);
             foreach (JToken jsonProject in jsonProjects)
             {
                 JiraProject project = new JiraProject();
                 JsonConvert.PopulateObject(jsonProject.ToString(), project);
                 projects.Add(project);
             }
             return projects;
         }
     }
     return null;
 }