api

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type V1

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

func NewV1

func NewV1(ss *plex.Sources, appVersion string, b *bus.Broker, allowOrigins []string) *V1

func (V1) ConfigHandler

func (api V1) ConfigHandler(w http.ResponseWriter, r *http.Request)

ConfigHandler responds with a configuration object.

Handles these URLs:

/api/v1/config

func (V1) HTTPMux

func (api V1) HTTPMux() http.Handler

HTTPMux returns a HTTP mux that can be mounted onto a root mux.

func (V1) HelloHandler

func (api V1) HelloHandler(w http.ResponseWriter, r *http.Request)

Says hello :)

Handles these URLs:

/api/v1/hello

func (*V1) MessagesHandler

func (api *V1) MessagesHandler(w http.ResponseWriter, r *http.Request)

WebSocket endpoint for receiving notifications.

Handles these URLs:

/api/v1/messages

func (V1) NewConfig

func (api V1) NewConfig(s *plex.Source) (*V1Config, error)

func (V1) NewHello

func (api V1) NewHello(s *plex.Source) (*V1Hello, error)

func (V1) NewNode

func (api V1) NewNode(n *ddt.Node, s *plex.Source) (*V1Node, error)

func (V1) NewNodeAsset

func (api V1) NewNodeAsset(a *ddt.NodeAsset) (*V1NodeAsset, error)

func (V1) NewSources

func (api V1) NewSources(ss *plex.Sources) (*V1Sources, error)

func (V1) NewTree

func (api V1) NewTree(t *ddt.Tree, s *plex.Source) (*V1Tree, error)

func (V1) NewTreeNode

func (api V1) NewTreeNode(n *ddt.Node, s *plex.Source) (*V1TreeNode, error)

func (V1) NewTreeSearchResults

func (api V1) NewTreeSearchResults(nodes []*ddt.Node, total int, took time.Duration) *V1SearchResults

func (V1) NodeAssetHandler

func (api V1) NodeAssetHandler(w http.ResponseWriter, r *http.Request)

Returns a node asset.

Handles these kinds of URLs:

/api/v1/tree/Button/foo.mp4&v={version}
/api/v1/tree/Button/colors.json&v={version}
/api/v1/tree/Button/colors.yaml&v={version}

func (V1) NodeHandler

func (api V1) NodeHandler(w http.ResponseWriter, r *http.Request)

Returns information about a single ddt.

Handles these kinds of URLs:

/api/v1/tree/DisplayData/Table?v={version}

func (V1) NotFoundHandler

func (api V1) NotFoundHandler(w http.ResponseWriter, r *http.Request)

func (V1) SearchHandler

func (api V1) SearchHandler(w http.ResponseWriter, r *http.Request)

Performs a search over the design defintions tree and returns results in form of a flat list of URLs of matched nodes.

Handles these URL:

/api/v1/search?q={query}
/api/v1/search?q={query}&v={version}

func (V1) SourcesHandler

func (api V1) SourcesHandler(w http.ResponseWriter, r *http.Request)

List available DDT sources.

Handles this URL:

/api/v1/sources

func (V1) TreeHandler

func (api V1) TreeHandler(w http.ResponseWriter, r *http.Request)

Returns all nodes in the design defintions tree, as nested nodes.

Handles these URLs:

/api/v1/tree
/api/v1/tree&v={version}

type V1Config

type V1Config struct {
	*config.Config
}

type V1Hello

type V1Hello struct {
	Hello   string `json:"hello"`
	Org     string `json:"org"`
	Project string `json:"project"`
	Version string `json:"version"`
}

type V1Message

type V1Message struct {
	Topic string `json:"topic"`
	Text  string `json:"text"`

	// Deprecated in favor of Topic
	Typ string `json:"type,omitempty"`
}

type V1Node

type V1Node struct {
	Hash        string          `json:"hash"`
	URL         string          `json:"url"`
	Parent      *V1RefNode      `json:"parent"`
	Children    []*V1RefNode    `json:"children"`
	Title       string          `json:"title"`
	Description string          `json:"description"`
	Authors     []*V1NodeAuthor `json:"authors"`
	Modified    int64           `json:"modified"`
	Version     string          `json:"version"`
	Tags        []string        `json:"tags"`
	Custom      interface{}     `json:"custom"`
	Docs        []*V1NodeDoc    `json:"docs"`
	Assets      []*V1NodeAsset  `json:"assets"`
	Crumbs      []*V1RefNode    `json:"crumbs"`
	Related     []*V1RefNode    `json:"related"`
	Prev        *V1RefNode      `json:"prev"`
	Next        *V1RefNode      `json:"next"`

	// Deprecated, to be removed in APIv3, please use Assets:
	Downloads []*V1NodeAsset `json:"downloads"`
}

type V1NodeAsset

type V1NodeAsset struct {
	URL      string `json:"url"`
	Name     string `json:"name"`
	Modified int64  `json:"modified"`
	Size     int64  `json:"size"`

	// Optional, format dependent, fields.
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

type V1NodeAuthor

type V1NodeAuthor struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

type V1NodeDoc

type V1NodeDoc struct {
	Title      string                `json:"title"`
	HTML       string                `json:"html"`
	Raw        string                `json:"raw"`
	Components []*V1NodeDocComponent `json:"components"`
}

type V1NodeDocComponent

type V1NodeDocComponent struct {
	Raw      string `json:"raw"`
	Position int    `json:"position"`
}

type V1RefNode

type V1RefNode struct {
	URL   string `json:"url"`
	Title string `json:"title"`
}

V1NodeRef have no parent and children. References must be looked up using the URL to get more information about them.

type V1SearchResults

type V1SearchResults struct {
	URLs  []string `json:"urls"`
	Total int      `json:"total"`
	Took  int64    `json:"took"` // nanoseconds
}

type V1Source

type V1Source struct {
	Name    string `json:"name"`
	IsReady bool   `json:"is_ready"`
}

type V1Sources

type V1Sources struct {
	Sources []*V1Source `json:"sources"`
}

type V1Tree

type V1Tree struct {
	Hash  string      `json:"hash"`
	Root  *V1TreeNode `json:"root"`
	Total uint16      `json:"total"`
}

type V1TreeNode

type V1TreeNode struct {
	Hash     string        `json:"hash"`
	URL      string        `json:"url"`
	Children []*V1TreeNode `json:"children"`
	Title    string        `json:"title"`
}

V1TreeMode is a light top down representation of a part of the DDT.

type V2

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

func NewV2

func NewV2(ss *plex.Sources, appVersion string, b *bus.Broker, allowOrigins []string) *V2

func (V2) FilterHandler

func (api V2) FilterHandler(w http.ResponseWriter, r *http.Request)

Performs a restricted narrow search over the design defintions tree.

Handles these URLs:

/api/v2/filter?q={query}
/api/v2/filter?q={query}&v={version}

func (V2) HTTPMux

func (api V2) HTTPMux() http.Handler

HTTPMux returns a HTTP mux that can be mounted onto a root mux.

func (V2) NewTreeFilterResults

func (api V2) NewTreeFilterResults(nodes []*ddt.Node, total int, took time.Duration) *V2FilterResults

func (V2) NewTreeSearchResults

func (api V2) NewTreeSearchResults(hs []*search.FullSearchHit, total int, took time.Duration) *V2FullSearchResults

func (V2) SearchHandler

func (api V2) SearchHandler(w http.ResponseWriter, r *http.Request)

Performs a full broad search over the design defintions tree.

Handles these URLs:

/api/v2/search?q={query}
/api/v2/search?q={query}&v={version}

type V2FilterResults

type V2FilterResults struct {
	Nodes []*V1RefNode `json:"nodes"`
	Total int          `json:"total"`
	Took  int64        `json:"took"` // nanoseconds
}

type V2FullSearchHit

type V2FullSearchHit struct {
	V1RefNode
	Description string   `json:"description"`
	Fragments   []string `json:"fragments"`
}

type V2FullSearchResults

type V2FullSearchResults struct {
	Hits  []*V2FullSearchHit `json:"hits"`
	Total int                `json:"total"`
	Took  int64              `json:"took"` // nanoseconds
}

V2FullSearchResults differs from V2FilterResults in some important ways: The results may be paginated. FilterResults always contains all found results in form of a list of node URLs.

Jump to

Keyboard shortcuts

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