mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Add ghost backend get-posts request
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user