go-ghost-sdk: github.com/acburdine/go-ghost-sdk/contentapi Index | Files

package contentapi

import "github.com/acburdine/go-ghost-sdk/contentapi"

Package contentapi implements the Ghost Content SDK

Index

Package Files

authors.go client.go errors.go meta.go options.go pages.go posts.go tags.go

type AuthorResource Uses

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

AuthorResource represents actions that can be done on the Author resource

func (*AuthorResource) Browse Uses

func (a *AuthorResource) Browse(opts *BrowseOptions) ([]*models.Author, *Meta, error)

Browse returns a list of authors

func (*AuthorResource) BrowseAll Uses

func (a *AuthorResource) BrowseAll(opts *BrowseOptions, fn func([]*models.Author, bool) bool) error

BrowseAll iterates through all authors, calling the callback with the result of each request

func (*AuthorResource) Read Uses

func (a *AuthorResource) Read(id string, opts *ReadOptions) (*models.Author, error)

Read reads a specific author

type BrowseOptions Uses

type BrowseOptions struct {
    ReadOptions

    Filter string
    Limit  int64
    Page   int64
    Order  string
}

BrowseOptions represents options that can be passed to Browse methods

type Client Uses

type Client struct {
    Posts   *PostResource
    Pages   *PageResource
    Authors *AuthorResource
    Tags    *TagResource
    // contains filtered or unexported fields
}

Client represents a Ghost Content API client

func New Uses

func New(httpClient *http.Client, opts *ClientOptions) (*Client, error)

New takes in options and returns a new Client

type ClientOptions Uses

type ClientOptions struct {
    Host      string
    GhostPath string
    Version   string
    Key       string
}

ClientOptions represents options given when creating a Client

func (*ClientOptions) Validate Uses

func (opts *ClientOptions) Validate() error

Validate validations the options

type ErrorList Uses

type ErrorList []*GhostError

ErrorList represents a list of errors

func (ErrorList) Error Uses

func (l ErrorList) Error() string

type GhostError Uses

type GhostError struct {
    Message   string `json:"message"`
    ErrorType string `json:"errorType"`
}

GhostError represents an error returned from the Ghost API

type Meta Uses

type Meta struct {
    Pagination *Pagination `json:"pagination"`
}

Meta represents the meta information returned from browse endpoints

type PageResource Uses

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

PageResource represents actions that can be done on the Page resource

func (*PageResource) Browse Uses

func (p *PageResource) Browse(opts *BrowseOptions) ([]*models.Post, *Meta, error)

Browse returns a list of pages

func (*PageResource) BrowseAll Uses

func (p *PageResource) BrowseAll(opts *BrowseOptions, fn func([]*models.Post, bool) bool) error

BrowseAll iterates through all posts, calling the callback with the result of each request

func (*PageResource) Read Uses

func (p *PageResource) Read(id string, opts *ReadOptions) (*models.Post, error)

type Pagination Uses

type Pagination struct {
    Page  int64 `json:"page"`
    Limit int64 `json:"limit"`
    Pages int64 `json:"pages"`
    Total int64 `json:"total"`
    Next  int64 `json:"next"`
    Prev  int64 `json:"prev"`
}

Pagination represents pagination info returned from browse endpoints

type PostResource Uses

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

PostResource represents actions that can be done on the Posts resource

func (*PostResource) Browse Uses

func (p *PostResource) Browse(opts *BrowseOptions) ([]*models.Post, *Meta, error)

Browse returns a list of posts

func (*PostResource) BrowseAll Uses

func (p *PostResource) BrowseAll(opts *BrowseOptions, fn func([]*models.Post, bool) bool) error

BrowseAll iterates through all posts, calling the callback with the result of each request

func (*PostResource) Read Uses

func (p *PostResource) Read(id string, opts *ReadOptions) (*models.Post, error)

type ReadOptions Uses

type ReadOptions struct {
    Include string
    Fields  string
    Formats string
}

ReadOptions represents options that can be passed to Read methods

type TagResource Uses

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

TagResource represents actions that can be done on the Tag resource

func (*TagResource) Browse Uses

func (t *TagResource) Browse(opts *BrowseOptions) ([]*models.Tag, *Meta, error)

Browse returns a list of tags

func (*TagResource) BrowseAll Uses

func (t *TagResource) BrowseAll(opts *BrowseOptions, fn func([]*models.Tag, bool) bool) error

BrowseAll iterates through all authors, calling the callback with the result of each request

func (*TagResource) Read Uses

func (t *TagResource) Read(id string, opts *ReadOptions) (*models.Tag, error)

Read reads a specific author

Package contentapi imports 9 packages (graph). Updated 2019-02-20. Refresh now. Tools for package owners.