Пример #1
0
        public object Get(PostQueryRequest req)
        {
            GhostPosts posts = null;

            posts = GhostPostRequest(req);

            return(new QueryResponse <Post>()
            {
                Results = posts.Posts,
                Offset = req.Skip.Value * req.Take.Value,
                Total = posts.Meta.Pagination.Total
            });
        }
Пример #2
0
        public object Get(GhostPostsProxyRequest req)
        {
            GhostPosts posts = null;

            var json = $"{AppSettings.Get<string>("GhostApi:BaseUrl")}/posts/?key={AppSettings.Get<string>("GhostApi:ContentKey")}&include=authors,tags&page={req.Page}&limit={req.Limit}".GetJsonFromUrl();

            using (JsConfig.With(new ServiceStack.Text.Config {
                TextCase = TextCase.SnakeCase,
                PropertyConvention = PropertyConvention.Lenient
            }))
            {
                posts = json.FromJson <GhostPosts>();
            }

            return(posts);
        }