public async Task <string> GetFrob() { var rawRsp = await rawClient.Invoke("rtm.auth.getFrob", new Dictionary <string, string>()); var element = XElement.Parse(rawRsp); var frobElement = element.Descendants("frob").First(); var frob = frobElement.Value; return(frob); }
public IObservable <MilkTask> GetList() { const string method = "rtm.tasks.getList"; IDictionary <string, string> parameters = new Dictionary <string, string>(); return(rawClient.Invoke(method, parameters) .ToObservable() .Select(rawXml => XDocument.Parse(rawXml)) .SelectMany(xml => xml.Descendants("list")) .SelectMany(listElement => listElement.Elements("taskseries") .Select(taskSeriesElement => ( listId: int.Parse(listElement.Attribute("id").Value), taskSeries: MilkParser.ParseTaskSeries(taskSeriesElement), taskElements: taskSeriesElement.Elements("task") ) ) ) .SelectMany(tuple => tuple.taskElements .Select(taskElement => new MilkTask { ListId = tuple.listId, TaskSeries = tuple.taskSeries, Id = int.Parse(taskElement.Attribute("id").Value), } ) ) ); }
public async Task <IDictionary <string, string> > Echo(IDictionary <string, string> parameters) { const string method = "rtm.test.echo"; var rawRsp = await rawClient.Invoke(method, parameters); var rsp = MilkParser.ParseEchoResponse(rawRsp); return(rsp); }
public IObservable <MilkList> GetList() { const string method = "rtm.lists.getList"; IDictionary <string, string> parameters = new Dictionary <string, string>(); var task = rawClient.Invoke(method, parameters); return(task.ToObservable() .Select(rawRsp => XElement.Parse(rawRsp)) .Select(xmlRsp => xmlRsp.Descendants("list")) .SelectMany(_ => _) .Select(e => MilkParser.ParseList(e))); }