protected void Button10_Click(object sender, EventArgs e) { var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager); var noteApi = new YDNoteAPI(youDao,this.AccessToken); var note = noteApi.GetNote("/8F970E0A60B743408C9F4B85B2FC081E/CC13776676444A3AA7416465266AE6BE"); var noteBookApi = new YDNoteBookAPI(youDao, this.AccessToken); var books = noteBookApi.GetAllNoteBooks(); this.lbl.Text = noteApi.MoveNote(note, books[0]).path; }
protected void Button12_Click(object sender, EventArgs e) { var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager); var bookApi = new YDNoteBookAPI(youDao, this.AccessToken); var books = bookApi.GetAllNoteBooks(); var notes = bookApi.GetNotesInBook(books[0].path); var noteApi = new YDNoteAPI(youDao, this.AccessToken); var note = noteApi.GetNote(notes[0].path); noteApi.DeleteNote(note); }
protected void Button7_Click(object sender, EventArgs e) { var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager); var noteApi = new YDNoteAPI(youDao,this.AccessToken); string path = "/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE"; var newNote = noteApi.GetNote(path); this.lbl.Text = newNote.content; }
protected void Button8_Click(object sender, EventArgs e) { var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager); var noteApi = new YDNoteAPI(youDao,this.AccessToken); string path = "/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE"; var newNote = noteApi.GetNote(path); newNote.content = "<html><body>去你妈的</body></html>"; newNote.title = "test"; noteApi.UpdateNote(newNote); }
/// <summary> /// 获取笔记本下的笔记列表 /// </summary> /// <param name="consumer"></param> /// <param name="tokenManager"></param> /// <param name="bookPath">笔记本路径</param> /// <returns></returns> public IList<YDNote> GetNotesInBook(string bookPath) { var extraData = new Dictionary<string, string>() { { "notebook", bookPath } }; var noteApi = new YDNoteAPI(this.Consumer,this.AccessToken); var request = Consumer.PrepareAuthorizedRequest(_getNotesInBookEndpoint, this.AccessToken, extraData); var response = Consumer.Channel.WebRequestHandler.GetResponse(request); string body = response.GetResponseReader().ReadToEnd(); var notes = JsonConvert.DeserializeObject<IList<string>>(body); var listNote = new List<YDNote>(); foreach (var path in notes) { var note = noteApi.GetNote(path); listNote.Add(note); } return listNote; }