public ActionResult <String> Get() { // return new string[] { "value1", "value2" }; DynResp dynResp = pippo.getFromDynalistAsync().Result; DynFile myfile = Man.getFileByName(dynResp, "vidiemme"); DynDoc dynDoc = pippo.getDocFromID(myfile.id).Result; List <Node> todo = Man.getUncheckItem(dynDoc); string res = ""; todo.ForEach(el => res = res + "\n" + el.content); return(res); }
public async System.Threading.Tasks.Task <DynDoc> getDocFromID(string id) { DynDoc resp = new DynDoc(); HttpClient client = new HttpClient(); TokenIDFile tok = new TokenIDFile(); tok.token = API_KEY; tok.file_id = id; using (HttpResponseMessage response = await client.PostAsJsonAsync("https://dynalist.io/api/v1/doc/read", tok)) { if (response.IsSuccessStatusCode) { resp = await response.Content.ReadAsAsync <DynDoc>(); } } return(resp); }
public System.Collections.Generic.List <Node> getUncheckItem(DynDoc doc) { String today = "!(" + DateTime.Now.Year + "-0" + DateTime.Now.Month + "-" + DateTime.Now.Day + ")"; return(doc.nodes.FindAll(elem => [email protected] && elem.content.Contains(today))); }