Add ghost backend get-posts request

pull/1/head
Nikita Tokarchuk 3 years ago
parent 7fbb921516
commit 85ade84d3d
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 13
      frontend/ghost/client.go

@ -11,6 +11,7 @@ import (
// Ghost content data URIs: // Ghost content data URIs:
const ( const (
ghostAPIPrefix = "/ghost/api/v3/" ghostAPIPrefix = "/ghost/api/v3/"
ghostAPIGetPosts = ghostAPIPrefix + "content/posts/"
ghostAPIGetPageBySlug = ghostAPIPrefix + "content/pages/slug/%s/" ghostAPIGetPageBySlug = ghostAPIPrefix + "content/pages/slug/%s/"
) )
@ -95,5 +96,17 @@ func (g *HTTPClient) GetPageBySlug(slug string) (pages *Pages, err error) {
pages = nil 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 return
} }
Loading…
Cancel
Save