コード例 #1
0
        public UpdateResult Write(IList <DocumentEntry> entries)
        {
            var oldPage = _api.Get(_cfg.PageId);
            var oldHash = _hasher.Hash(oldPage.body.view.value);

            var sb = new StringBuilder();

            foreach (var documentEntry in entries)
            {
                sb.AppendLine(documentEntry.Title);
                sb.AppendLine(documentEntry.Content);
            }

            var convertedContent = CommonMarkConverter.Convert(sb.ToString(), CommonMarkSettings.Default);
            var hash             = _hasher.Hash(convertedContent);

            //TODO: Figure out how to detect if this has changed or not. Hashing the confluence content is not the correct approach.
            //TODO: Maybe just look for a key/value pair you can REGEX out that is in the footer
            if (hash == oldHash)
            {
                Debug.WriteLine("HASHes match, ignoring.");
                return(new UpdateResult(ContentResult.Duplicate));
            }

            _api.Put(oldPage, sb.ToString());

            return(new UpdateResult(ContentResult.Ok));
        }
コード例 #2
0
        public void X()
        {
            var oldPage = _updater.Get(pageId);

            var newContent = $@"# Hi

All the things

[Link](http://google.com)

> Quotes

---

**BOB**";
            var result     = _updater.Put(oldPage, newContent);

            Console.WriteLine(result);
        }