storyblok

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, token string, emptyCacheToken string, cache headless_cms.Cache, httpClient HTTPClient) *Client

func (*Client) AuthToken added in v0.2.0

func (c *Client) AuthToken() string

func (*Client) Cache

func (c *Client) Cache() headless_cms.Cache

func (*Client) CacheKey

func (c *Client) CacheKey(prefix, page, version, language string) string

func (*Client) EmptyCache

func (c *Client) EmptyCache(ctx context.Context, token string) error

func (*Client) EmptyCacheToken

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

func (*Client) GetPage added in v0.2.0

func (c *Client) GetPage(ctx context.Context, page string, version string, language string) (map[string]any, error)

func (*Client) GetPageAsJSON added in v0.2.0

func (c *Client) GetPageAsJSON(ctx context.Context, page string, version string, language string) ([]byte, error)

GetPageAsJSON story for example /login or "" for getting all stories

func (*Client) GetPageAsSimpleBlocksWithID added in v0.2.0

func (c *Client) GetPageAsSimpleBlocksWithID(ctx context.Context, page string, version string, language string) (map[string]map[string]any, error)

type Content

type Content struct {
	UID       string           `json:"_uid"`
	Body      []map[string]any `json:"body"`
	Component string           `json:"component"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type SimpleBlockskWithID

type SimpleBlockskWithID struct {
	Story Story         `json:"story"`
	Cv    int           `json:"cv"`
	Rels  []interface{} `json:"rels"`
	Links []interface{} `json:"links"`
}

type Story

type Story struct {
	Name             string        `json:"name"`
	CreatedAt        time.Time     `json:"created_at"`
	PublishedAt      time.Time     `json:"published_at"`
	ID               int           `json:"id"`
	UUID             string        `json:"uuid"`
	Content          Content       `json:"content"`
	Slug             string        `json:"slug"`
	FullSlug         string        `json:"full_slug"`
	SortByDate       interface{}   `json:"sort_by_date"`
	Position         int           `json:"position"`
	TagList          []interface{} `json:"tag_list"`
	IsStartpage      bool          `json:"is_startpage"`
	ParentID         interface{}   `json:"parent_id"`
	MetaData         interface{}   `json:"meta_data"`
	GroupID          string        `json:"group_id"`
	FirstPublishedAt time.Time     `json:"first_published_at"`
	ReleaseID        interface{}   `json:"release_id"`
	Lang             string        `json:"lang"`
	Path             interface{}   `json:"path"`
	Alternates       []interface{} `json:"alternates"`
	DefaultFullSlug  interface{}   `json:"default_full_slug"`
	TranslatedSlugs  interface{}   `json:"translated_slugs"`
}

Jump to

Keyboard shortcuts

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