コード例 #1
0
 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;
 }
コード例 #2
0
 protected void Button11_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);
     noteApi.DeleteNote(notes[0]);
 }
コード例 #3
0
 protected void Button9_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao, this.AccessToken);
     this.lbl.Text = noteApi.MoveNote("/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE", "/8F970E0A60B743408C9F4B85B2FC081E").modify_time.ToString();
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 protected void Button6_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao, this.AccessToken);
     var note = new YDNote()
                    {
                       source="",author = "kklldog",
                       content = "<content>内容</content><br/><finishtime>ttt</finishtime>",
                       notebook ="",title = "testNote1"
                    };
     var newNote = noteApi.CreateNote(note);
     this.lbl.Text = newNote.content + newNote.create_time;
 }
コード例 #7
0
        /// <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;
        }