/// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public UploadSuccessModel(PivotalProject pivotalProject, IEnumerable<PivotalMembership> pivotalMemberships, IEnumerable<PivotalStory> projectStories)
 {
     PivotalProject = pivotalProject;
     PivotalMemberships = pivotalMemberships;
     ProjectStories = projectStories;
 }
 /// <summary>
 /// Adds a member to a project
 /// </summary>
 /// <param name="user">The user to get the ApiToken from</param>
 /// <param name="project">The project to get membership info for</param>
 /// <param name="member">The person and role to add to the project</param>
 /// <returns>The added member's identity</returns>
 public static PivotalMembership AddMember(PivotalUser user, PivotalProject project, PivotalMembership member)
 {
   string url = String.Format("{0}/projects/{1}/memberships?token={2}", PivotalService.BaseUrl, project.Id.ToString(), user.ApiToken);
   XmlDocument xml = SerializationHelper.SerializeToXmlDocument<PivotalMembership>(member);
   string memberXml = PivotalService.CleanXmlForSubmission(xml, "//membership", ExcludeNodesOnSubmit, true);
   XmlDocument response = PivotalService.SubmitData(url, memberXml, ServiceMethod.POST);
   return SerializationHelper.DeserializeFromXmlDocument<PivotalMembership>(response);
 }
 /// <summary>
 /// Removes a member from a project in Pivotal
 /// </summary>
 /// <param name="user">The user to get the ApiToken from</param>
 /// <param name="project">The project to remove the person from</param>
 /// <param name="member">The member to remove</param>
 /// <returns>The member that was removed</returns>
 public static PivotalMembership RemoveMember(PivotalUser user, PivotalProject project, PivotalMembership member)
 {
   string url = String.Format("{0}/projects/{1}/memberships/{2}?token={3}", PivotalService.BaseUrl, project.Id.GetValueOrDefault(), member.Id.GetValueOrDefault(), user.ApiToken);
   XmlDocument response = PivotalService.SubmitData(url, null, ServiceMethod.DELETE);
   return member;
 }
 /// <summary>
 /// Retrieves the membership information for a project
 /// </summary>
 /// <param name="user">The user to get the ApiToken from</param>
 /// <param name="project">The project to get membership info for</param>
 /// <returns>List of members in the project</returns>
 public static PivotalMembershipList FetchMembers(PivotalUser user, PivotalProject project)
 {
   string url = String.Format("{0}/projects/{1}/memberships?token={2}", PivotalService.BaseUrl, project.Id.ToString(), user.ApiToken);
   XmlDocument xml = PivotalService.GetData(url);
   PivotalMembershipList memberships = SerializationHelper.DeserializeFromXmlDocument<PivotalMembershipList>(xml);
   return memberships;
 }
 /// <summary>
 /// Removes a project in Pivotal (not sure this works)
 /// </summary>
 /// <param name="user">The user to get the ApiToken from</param>
 /// <param name="project">The project to remove</param>
 /// <returns>The project that was removed</returns>
 public static PivotalProject DeleteProject(PivotalUser user, PivotalProject project)
 {
   string url = String.Format("{0}/projects/{1}?token={2}", PivotalService.BaseUrl, project.Id.GetValueOrDefault(), user.ApiToken);
   XmlDocument response = PivotalService.SubmitData(url, null, ServiceMethod.DELETE);
   return project;
 }
 /// <summary>
 /// Updates a project in Pivotal
 /// </summary>
 /// <param name="user">The user to get the ApiToken from (user will be owner of the project)</param>
 /// <param name="project">Project information to update</param>
 /// <returns>The updated project</returns>
 public static PivotalProject UpdateProject(PivotalUser user, PivotalProject project)
 {
   string url = String.Format("{0}/projects/{1}?token={2}", PivotalService.BaseUrl, project.Id.GetValueOrDefault(), user.ApiToken);
   XmlDocument xml = SerializationHelper.SerializeToXmlDocument<PivotalProject>(project);
   string projectXml = PivotalService.CleanXmlForSubmission(xml, "//project", ExcludeNodesOnSubmit, true);
   XmlDocument response = PivotalService.SubmitData(url, projectXml, ServiceMethod.PUT);
   return SerializationHelper.DeserializeFromXmlDocument<PivotalProject>(response);
 }
Exemple #7
0
 /// <summary>
 /// Retrieves the projects the user has access to
 /// </summary>
 /// <returns>The list of projects</returns>
 public IList <PivotalProject> FetchProjects()
 {
     return(PivotalProject.FetchProjects(this));
 }
 /// <summary>
 /// Fetches a single project from Pivotal and does not fetch the stories
 /// </summary>
 /// <param name="user">The user to get the ApiToken from</param>
 /// <param name="projectId">The id of the project to retrieve</param>
 /// <returns>project</returns>
 public static PivotalProject FetchProject(PivotalUser user, int projectId)
 {
     return(PivotalProject.FetchProject(user, projectId, false));
 }