readme

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Id    string `json:"_id,omitempty"`
	Slug  string `json:"slug,omitempty"`
	Title string `json:"title,omitempty"`
}

type Client

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

func NewClient

func NewClient(ctx context.Context, apiKey string, version string) (*Client, error)

func (*Client) CreateCategory

func (c *Client) CreateCategory(ctx context.Context, cat Category) error

Creates a category with the given name and a slug equivalent to the slugified name First creates the category with the slug title, then updates it to the original title if the title is not equal to the slug (change in case, spacing, etc) This is necessary due to lack of slug field on category creation.

func (*Client) CreateDoc

func (c *Client) CreateDoc(ctx context.Context, doc Document) error

func (*Client) DeleteCategory

func (c *Client) DeleteCategory(ctx context.Context, slug string) error

func (*Client) DeleteDoc

func (c *Client) DeleteDoc(ctx context.Context, slug string) error

func (*Client) GetCategories

func (c *Client) GetCategories(ctx context.Context) ([]Category, error)

TODO: add auto paging

func (*Client) GetCategory

func (c *Client) GetCategory(ctx context.Context, slug string) (Category, error)

func (*Client) GetDoc

func (c *Client) GetDoc(ctx context.Context, slug string) (Document, error)

func (*Client) GetDocsForCategory

func (c *Client) GetDocsForCategory(ctx context.Context, slug string) ([]Document, error)

TODO: add auto paging

func (*Client) PutDoc

func (c *Client) PutDoc(ctx context.Context, doc Document) error

func (*Client) UpdateCategory

func (c *Client) UpdateCategory(ctx context.Context, cat Category) error

type Document

type Document struct {
	Id       string `json:"_id,omitempty"`
	Slug     string `json:"slug"`
	Title    string `json:"title"`
	Excerpt  string `json:"excerpt"`
	Body     string `json:"body"`
	Category string `json:"categorySlug"`
	Parent   string `json:"parentDocSlug"`
	Hidden   bool   `json:"hidden"`
	Order    int    `json:"order"`
}

Jump to

Keyboard shortcuts

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