示例#1
0
        public static NextcloudNote ChangeExistingNote(ISimpleJsonRest web, NextcloudNote note, NextcloudConfig config)
        {
            var data = new ApiUpdateNote {
                content = note.Content, category = CreateCategoryFromPath(note.Path)
            };
            var result = web.PutTwoWay <ApiNoteResult>(data, "notes/" + note.RemoteID);

            var rnote = new NextcloudNote(result.id, note.LocalID, config)
            {
                CreationDate    = DateTime.Now,
                RemoteTimestamp = result.modified,
                Content         = result.content,
                Favorite        = result.favorite,
                Path            = ExtractPathFromCategory(result.category),
                ETag            = result.etag,
            };

            rnote.SetModificationDate(ConvertFromEpochDate(result.modified));

            if (rnote.Title.ToLower() != result.title.ToLower())
            {
                rnote.Title = result.title;
            }
            return(rnote);
        }