Example #1
0
        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);
        }
Example #2
0
        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),
            }
                                       )
                               )
                   );
        }
Example #3
0
        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);
        }
Example #4
0
        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)));
        }