Add ghost backend get-posts request

This commit is contained in:
2021-12-03 03:58:36 +01:00
parent 7fbb921516
commit 85ade84d3d
+13
View File
@@ -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/"
) )
@@ -97,3 +98,15 @@ func (g *HTTPClient) GetPageBySlug(slug string) (pages *Pages, err error) {
return 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
}