public IList <FBug> Search(string statusFilter, string titleFilter) { List <FBug> resultList = new List <FBug>(); string url = string.Format("{0}/api.asp?cmd=search&token={1}&cols=sTitle,sStatus,sProject,sCategory", this.baseURL, this.token); if (!titleFilter.IsNull()) { //Fogbugz doesn't like dashes in their query filters? url += "&q=" + titleFilter.Replace("-", ""); } this.GetWebRequestContent(url); XmlNodeList casesList = webRequestDoc.SelectNodes("response/cases/case"); foreach (XmlNode caseNode in casesList) { FBug bug = new FBug() { Id = int.Parse(caseNode.Attributes["ixBug"].Value), Status = caseNode.SelectSingleNode("sStatus").InnerText, Title = caseNode.SelectSingleNode("sTitle").InnerText, Project = caseNode.SelectSingleNode("sProject").InnerText, Category = caseNode.SelectSingleNode("sCategory").InnerText }; if (statusFilter.IsNull() || statusFilter == bug.Status) { resultList.Add(bug); } } return(resultList); }
public FBug CreateBug(FBug bugToSave) { string url = string.Format("{0}/api.asp?cmd=new&token={1}&sTitle={2}&sEvent={3}&sProject={4}&sCategory={5}", this.baseURL, this.token, bugToSave.Title, bugToSave.Description, bugToSave.Project, bugToSave.Category); this.GetWebRequestContent(url); bugToSave.Id = int.Parse(this.webRequestDoc.SelectSingleNode("response/case").Attributes["ixBug"].Value); return(bugToSave); }