ghostclient

package module
v0.0.0-...-c4dc246 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ghost-client-go

Inclomplete api client for https://github.com/TryGhost/Ghost.

Getting Started

u, _ := url.Parse("http://localhost:3001/ghost/api/v3")

ghostClient := ghostclient.New(
    ghostclient.WithBaseURL(u),
)

posts, _ := ghostClient.ContentPosts(
	ghostclient.WithKey("62ebdfd5992678506b1e7ddbc3"),
	ghostclient.WithInclude("tags", "authors"),
)

litter.Dump(posts) // Print posts to stdout

Example

Documentation

Index

Constants

View Source
const (
	RoutePosts       string = "/content/posts/"
	RoutePostsById   string = "/content/posts/{id}/"
	RoutePostsBySlug string = "/content/posts/slug/{slug}/"

	RouteAuthors       string = "/content/authors/"
	RouteAuthorsById   string = "/content/authors/{id}/"
	RouteAuthorsBySlug string = "/content/authors/slug/{slug}/ "

	RouteTags       string = "/content/tags/"
	RouteTagsById   string = "/content/tags/{id}/"
	RouteTagsBySlug string = "/content/tags/slug/{slug}/"

	RoutePages       string = "/content/pages/"
	RoutePagesById   string = "/content/pages/{id}/"
	RoutePagesBySlug string = "/content/pages/slug/{slug}/"

	RouteSettings string = "/content/settings/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C struct {
	// contains filtered or unexported fields
}

C client type for ghost api

func New

func New(opts ...Option) *C

func (*C) ContentPosts

func (c *C) ContentPosts(opts ...ContentOption) (posts *content.Posts, err error)

ContentPosts call /posts/ api Example: http://localhost:3001/ghost/api/v3/content/posts/?key=62ebdfd5992678506b1e7ddbc3&include=authors,tags

type ContentOption

type ContentOption func(*url.URL)

func WithInclude

func WithInclude(includes ...string) ContentOption

WithInclude request addiional parmeters from the api

func WithKey

func WithKey(key string) ContentOption

WithKey for authetication

type Option

type Option func(*C)

Options ...

func WithBaseURL

func WithBaseURL(u *url.URL) Option

func WithBasicAuth

func WithBasicAuth(username, password string) Option

func WithVerbose

func WithVerbose() Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址