Ejemplo n.º 1
0
        public virtual BlogPost GetBlogPostById(int wordpressId)
        {
            if (string.IsNullOrEmpty(Token))
            {
                throw new WordpressAuthorizationException("You have to authorize a user to invoke this.");
            }

            var     blogPostJson     = _client.GetRawResultOfBearerRequest(HttpMethod.Get, $"{PostsEndpoint}/{wordpressId}", Token);
            dynamic blogPostContents = JsonConvert.DeserializeObject(blogPostJson);

            return(new BlogPost()
            {
                Content = HttpUtility.HtmlDecode((string)blogPostContents.content.rendered).ReplaceWeirdQuotes()
            });
        }