|
|
@ -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 |
|
|
|
|
|
|
|
} |