Example #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);
        }
Example #2
0
        public static NextcloudNote GetNoteData(ISimpleJsonRest web, int id, NextcloudConfig config)
        {
            var result = web.Get <ApiNoteResult>("notes/" + id);

            var rnote = new NextcloudNote(result.id, Guid.NewGuid(), 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));
            return(rnote);
        }