From 85ade84d3d9b12f934b9e62b4bd299eea88103a8 Mon Sep 17 00:00:00 2001 From: Nikita Tokarchuk Date: Fri, 3 Dec 2021 03:58:36 +0100 Subject: [PATCH] Add ghost backend get-posts request --- frontend/ghost/client.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/ghost/client.go b/frontend/ghost/client.go index 5d135e5..8222cee 100644 --- a/frontend/ghost/client.go +++ b/frontend/ghost/client.go @@ -11,6 +11,7 @@ import ( // Ghost content data URIs: const ( ghostAPIPrefix = "/ghost/api/v3/" + ghostAPIGetPosts = ghostAPIPrefix + "content/posts/" ghostAPIGetPageBySlug = ghostAPIPrefix + "content/pages/slug/%s/" ) @@ -95,5 +96,17 @@ func (g *HTTPClient) GetPageBySlug(slug string) (pages *Pages, err error) { pages = nil } + return +} + +// GetPosts returns posts +func (g *HTTPClient) GetPosts(params ...QueryParam) (posts *Posts, err error) { + + posts = &Posts{} + err = g.doQuery(ghostAPIGetPosts, posts, params...) + if err != nil { + posts = nil + } + return } \ No newline at end of file