wordpress

package
v0.0.0-...-f49f377 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Protected bool   `json:"protected"`
	Rendered  string `json:"rendered"`
}

Content contains rendered HTML code

type Excerpt

type Excerpt struct {
	Protected bool   `json:"protected"`
	Rendered  string `json:"rendered"`
}

Excerpt contains rendered HTML code

type GUID

type GUID struct {
	Rendered string `json:"rendered"`
}

GUID contains a globally unique identifier

type Meta

type Meta struct {
	ID    bool   `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

Meta contains key/value pairs

type Metas

type Metas []Meta

Metas is a collection of Meta objects

type Metric

type Metric struct {
	Page         string  `json:"page"`
	ContentSize  int     `json:"content_size"`
	PageLoad     float64 `json:"page_load"`
	ResourceLoad float64 `json:"resource_load"`
	TotalLoad    float64 `json:"total_load"`
}

Metric contains load times in milliseconds

type Metrics

type Metrics []Metric

Metrics is a collection of Metric objects

type Page

type Page struct {
	Date          string  `json:"date"`
	DateGmt       string  `json:"date_gmt"`
	GUID          GUID    `json:"guid"`
	ID            int     `json:"id"`
	Link          string  `json:"link"`
	Modified      string  `json:"modified"`
	ModifiedGmt   string  `json:"modified_gmt"`
	Slug          string  `json:"slug"`
	Status        string  `json:"status"`
	Type          string  `json:"type"`
	Parent        int     `json:"parent"`
	Title         Title   `json:"title"`
	Content       Content `json:"content"`
	Author        int     `json:"author"`
	Excerpt       Excerpt `json:"excerpt"`
	FeaturedMedia int     `json:"featured_media"`
	CommentStatus string  `json:"comment_status"`
	PingStatus    string  `json:"ping_status"`
	MenuOrder     int     `json:"menu_order"`
	Meta          Metas   `json:"meta"`
	Template      string  `json:"template"`
}

Page represents a WordPress page

func (*Page) GetPageMetrics

func (p *Page) GetPageMetrics() Metric

GetPageMetrics calculates the time in milliseconds to load the page and resources

type Pages

type Pages []Page

Pages is a collection of Page objects

func GetPages

func GetPages(site string) (Pages, error)

GetPages retrieves an array of Page objects from a WordPress site

type Title

type Title struct {
	Rendered string `json:"rendered"`
}

Title contains the rendered page name

type WordPress

type WordPress struct {
	Initialized bool
}

WordPress is our client object

func New

func New() *WordPress

New instantiates our client

func (*WordPress) CollectMetrics

func (w *WordPress) CollectMetrics(mts []plugin.Metric) ([]plugin.Metric, error)

CollectMetrics is called by Snap-Telemetry to gather metrics

func (*WordPress) GetConfigPolicy

func (w *WordPress) GetConfigPolicy() (plugin.ConfigPolicy, error)

GetConfigPolicy returns the configPolicy for your plugin

func (*WordPress) GetMetricTypes

func (w *WordPress) GetMetricTypes(cfg plugin.Config) ([]plugin.Metric, error)

GetMetricTypes returns metric types for testing

Jump to

Keyboard shortcuts

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