pagespeedonline

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: BSD-3-Clause Imports: 15 Imported by: 7

Documentation

Overview

Package pagespeedonline provides access to the PageSpeed Insights API.

For product documentation, see: https://developers.google.com/speed/docs/insights/v5/about

Creating a client

Usage example:

import "google.golang.org/api/pagespeedonline/v5"
...
ctx := context.Background()
pagespeedonlineService, err := pagespeedonline.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

pagespeedonlineService, err := pagespeedonline.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
pagespeedonlineService, err := pagespeedonline.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (
	// Associate you with your personal info on Google
	OpenIDScope = "openid"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditRefs added in v0.16.0

type AuditRefs struct {
	// Group: The category group that the audit belongs to (optional).
	Group string `json:"group,omitempty"`

	// Id: The audit ref id.
	Id string `json:"id,omitempty"`

	// Weight: The weight this audit's score has on the overall category
	// score.
	Weight float64 `json:"weight,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Group") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Group") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

AuditRefs: A light reference to an audit by id, used to group and weight audits in a given category.

func (*AuditRefs) MarshalJSON added in v0.16.0

func (s *AuditRefs) MarshalJSON() ([]byte, error)

func (*AuditRefs) UnmarshalJSON added in v0.16.0

func (s *AuditRefs) UnmarshalJSON(data []byte) error

type Bucket added in v0.16.0

type Bucket struct {
	// Max: Upper bound for a bucket's range.
	Max int64 `json:"max,omitempty"`

	// Min: Lower bound for a bucket's range.
	Min int64 `json:"min,omitempty"`

	// Proportion: The proportion of data in this bucket.
	Proportion float64 `json:"proportion,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Max") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Max") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

Bucket: A proportion of data in the total distribution, bucketed by a min/max percentage. Each bucket's range is bounded by min <= x < max, In millisecond.

func (*Bucket) MarshalJSON added in v0.16.0

func (s *Bucket) MarshalJSON() ([]byte, error)

func (*Bucket) UnmarshalJSON added in v0.16.0

func (s *Bucket) UnmarshalJSON(data []byte) error

type Categories added in v0.16.0

type Categories struct {
	// Accessibility: The accessibility category, containing all
	// accessibility related audits.
	Accessibility *LighthouseCategoryV5 `json:"accessibility,omitempty"`

	// BestPractices: The best practices category, containing all best
	// practices related
	// audits.
	BestPractices *LighthouseCategoryV5 `json:"best-practices,omitempty"`

	// Performance: The performance category, containing all performance
	// related audits.
	Performance *LighthouseCategoryV5 `json:"performance,omitempty"`

	// Pwa: The Progressive-Web-App (PWA) category, containing all pwa
	// related
	// audits.
	Pwa *LighthouseCategoryV5 `json:"pwa,omitempty"`

	// Seo: The Search-Engine-Optimization (SEO) category, containing all
	// seo related
	// audits.
	Seo *LighthouseCategoryV5 `json:"seo,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Accessibility") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Accessibility") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

Categories: The categories in a Lighthouse run.

func (*Categories) MarshalJSON added in v0.16.0

func (s *Categories) MarshalJSON() ([]byte, error)

type CategoryGroupV5 added in v0.16.0

type CategoryGroupV5 struct {
	// Description: The description of what the category is grouping
	Description string `json:"description,omitempty"`

	// Title: The human readable title of the group
	Title string `json:"title,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Description") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Description") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

CategoryGroupV5: Message containing a category

func (*CategoryGroupV5) MarshalJSON added in v0.16.0

func (s *CategoryGroupV5) MarshalJSON() ([]byte, error)

type ConfigSettings added in v0.16.0

type ConfigSettings struct {
	// Channel: How Lighthouse was run, e.g. from the Chrome extension or
	// from the npm
	// module.
	Channel string `json:"channel,omitempty"`

	// EmulatedFormFactor: The form factor the emulation should use.
	EmulatedFormFactor string `json:"emulatedFormFactor,omitempty"`

	// Locale: The locale setting.
	Locale string `json:"locale,omitempty"`

	// OnlyCategories: List of categories of audits the run should conduct.
	OnlyCategories interface{} `json:"onlyCategories,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Channel") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Channel") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

ConfigSettings: Message containing the configuration settings for the Lighthouse run.

func (*ConfigSettings) MarshalJSON added in v0.16.0

func (s *ConfigSettings) MarshalJSON() ([]byte, error)

type Environment added in v0.16.0

type Environment struct {
	// BenchmarkIndex: The benchmark index number that indicates rough
	// device class.
	BenchmarkIndex float64 `json:"benchmarkIndex,omitempty"`

	// HostUserAgent: The user agent string of the version of Chrome used.
	HostUserAgent string `json:"hostUserAgent,omitempty"`

	// NetworkUserAgent: The user agent string that was sent over the
	// network.
	NetworkUserAgent string `json:"networkUserAgent,omitempty"`

	// ForceSendFields is a list of field names (e.g. "BenchmarkIndex") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "BenchmarkIndex") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

Environment: Message containing environment configuration for a Lighthouse run.

func (*Environment) MarshalJSON added in v0.16.0

func (s *Environment) MarshalJSON() ([]byte, error)

func (*Environment) UnmarshalJSON added in v0.16.0

func (s *Environment) UnmarshalJSON(data []byte) error

type I18n added in v0.16.0

type I18n struct {
	// RendererFormattedStrings: Internationalized strings that are
	// formatted to the locale in
	// configSettings.
	RendererFormattedStrings *RendererFormattedStrings `json:"rendererFormattedStrings,omitempty"`

	// ForceSendFields is a list of field names (e.g.
	// "RendererFormattedStrings") to unconditionally include in API
	// requests. By default, fields with empty values are omitted from API
	// requests. However, any non-pointer, non-interface field appearing in
	// ForceSendFields will be sent to the server regardless of whether the
	// field is empty or not. This may be used to include empty fields in
	// Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "RendererFormattedStrings")
	// to include in API requests with the JSON null value. By default,
	// fields with empty values are omitted from API requests. However, any
	// field with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

I18n: Message containing the i18n data for the LHR - Version 1.

func (*I18n) MarshalJSON added in v0.16.0

func (s *I18n) MarshalJSON() ([]byte, error)

type LighthouseAuditResultV5

type LighthouseAuditResultV5 struct {
	// Description: The description of the audit.
	Description string `json:"description,omitempty"`

	// Details: Freeform details section of the audit.
	Details googleapi.RawMessage `json:"details,omitempty"`

	// DisplayValue: The value that should be displayed on the UI for this
	// audit.
	DisplayValue string `json:"displayValue,omitempty"`

	// ErrorMessage: An error message from a thrown error inside the audit.
	ErrorMessage string `json:"errorMessage,omitempty"`

	// Explanation: An explanation of the errors in the audit.
	Explanation string `json:"explanation,omitempty"`

	// Id: The audit's id.
	Id string `json:"id,omitempty"`

	// NumericValue: A numeric value that has a meaning specific to the
	// audit, e.g. the number
	// of nodes in the DOM or the timestamp of a specific load event.
	// More
	// information can be found in the audit details, if present.
	NumericValue float64 `json:"numericValue,omitempty"`

	// Score: The score of the audit, can be null.
	Score interface{} `json:"score,omitempty"`

	// ScoreDisplayMode: The enumerated score display mode.
	ScoreDisplayMode string `json:"scoreDisplayMode,omitempty"`

	// Title: The human readable title.
	Title string `json:"title,omitempty"`

	// Warnings: Possible warnings that occurred in the audit, can be null.
	Warnings interface{} `json:"warnings,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Description") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Description") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LighthouseAuditResultV5: An audit's result object in a Lighthouse result.

func (*LighthouseAuditResultV5) MarshalJSON

func (s *LighthouseAuditResultV5) MarshalJSON() ([]byte, error)

func (*LighthouseAuditResultV5) UnmarshalJSON added in v0.14.0

func (s *LighthouseAuditResultV5) UnmarshalJSON(data []byte) error

type LighthouseCategoryV5

type LighthouseCategoryV5 struct {
	// AuditRefs: An array of references to all the audit members of this
	// category.
	AuditRefs []*AuditRefs `json:"auditRefs,omitempty"`

	// Description: A more detailed description of the category and its
	// importance.
	Description string `json:"description,omitempty"`

	// Id: The string identifier of the category.
	Id string `json:"id,omitempty"`

	// ManualDescription: A description for the manual audits in the
	// category.
	ManualDescription string `json:"manualDescription,omitempty"`

	// Score: The overall score of the category, the weighted average of all
	// its audits.
	// (The category's score, can be null.)
	Score interface{} `json:"score,omitempty"`

	// Title: The human-friendly name of the category.
	Title string `json:"title,omitempty"`

	// ForceSendFields is a list of field names (e.g. "AuditRefs") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "AuditRefs") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LighthouseCategoryV5: A Lighthouse category.

func (*LighthouseCategoryV5) MarshalJSON

func (s *LighthouseCategoryV5) MarshalJSON() ([]byte, error)

type LighthouseResultV5

type LighthouseResultV5 struct {
	// Audits: Map of audits in the LHR.
	Audits map[string]LighthouseAuditResultV5 `json:"audits,omitempty"`

	// Categories: Map of categories in the LHR.
	Categories *Categories `json:"categories,omitempty"`

	// CategoryGroups: Map of category groups in the LHR.
	CategoryGroups map[string]CategoryGroupV5 `json:"categoryGroups,omitempty"`

	// ConfigSettings: The configuration settings for this LHR.
	ConfigSettings *ConfigSettings `json:"configSettings,omitempty"`

	// Environment: Environment settings that were used when making this
	// LHR.
	Environment *Environment `json:"environment,omitempty"`

	// FetchTime: The time that this run was fetched.
	FetchTime string `json:"fetchTime,omitempty"`

	// FinalUrl: The final resolved url that was audited.
	FinalUrl string `json:"finalUrl,omitempty"`

	// I18n: The internationalization strings that are required to render
	// the LHR.
	I18n *I18n `json:"i18n,omitempty"`

	// LighthouseVersion: The lighthouse version that was used to generate
	// this LHR.
	LighthouseVersion string `json:"lighthouseVersion,omitempty"`

	// RequestedUrl: The original requested url.
	RequestedUrl string `json:"requestedUrl,omitempty"`

	// RunWarnings: List of all run warnings in the LHR.  Will always output
	// to at least `[]`.
	RunWarnings []interface{} `json:"runWarnings,omitempty"`

	// RuntimeError: A top-level error message that, if present, indicates a
	// serious enough
	// problem that this Lighthouse result may need to be discarded.
	RuntimeError *RuntimeError `json:"runtimeError,omitempty"`

	// StackPacks: The Stack Pack advice strings.
	StackPacks []*StackPack `json:"stackPacks,omitempty"`

	// Timing: Timing information for this LHR.
	Timing *Timing `json:"timing,omitempty"`

	// UserAgent: The user agent that was used to run this LHR.
	UserAgent string `json:"userAgent,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Audits") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Audits") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LighthouseResultV5: The Lighthouse result object.

func (*LighthouseResultV5) MarshalJSON

func (s *LighthouseResultV5) MarshalJSON() ([]byte, error)

type PagespeedApiLoadingExperienceV5

type PagespeedApiLoadingExperienceV5 struct {
	// Id: The url, pattern or origin which the metrics are on.
	Id string `json:"id,omitempty"`

	// InitialUrl: The requested URL, which may differ from the resolved
	// "id".
	InitialUrl string `json:"initial_url,omitempty"`

	// Metrics: The map of <metrics, data>.
	Metrics map[string]UserPageLoadMetricV5 `json:"metrics,omitempty"`

	// OriginFallback: True if the result is an origin fallback from a page,
	// false otherwise.
	OriginFallback bool `json:"origin_fallback,omitempty"`

	// OverallCategory: The human readable speed "category" of the id.
	OverallCategory string `json:"overall_category,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Id") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Id") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

PagespeedApiLoadingExperienceV5: The CrUX loading experience object that contains CrUX data breakdowns.

func (*PagespeedApiLoadingExperienceV5) MarshalJSON

func (s *PagespeedApiLoadingExperienceV5) MarshalJSON() ([]byte, error)

type PagespeedApiPagespeedResponseV5

type PagespeedApiPagespeedResponseV5 struct {
	// AnalysisUTCTimestamp: The UTC timestamp of this analysis.
	AnalysisUTCTimestamp string `json:"analysisUTCTimestamp,omitempty"`

	// CaptchaResult: The captcha verify result
	CaptchaResult string `json:"captchaResult,omitempty"`

	// Id: Canonicalized and final URL for the document, after following
	// page
	// redirects (if any).
	Id string `json:"id,omitempty"`

	// Kind: Kind of result.
	Kind string `json:"kind,omitempty"`

	// LighthouseResult: Lighthouse response for the audit url as an object.
	LighthouseResult *LighthouseResultV5 `json:"lighthouseResult,omitempty"`

	// LoadingExperience: Metrics of end users' page loading experience.
	LoadingExperience *PagespeedApiLoadingExperienceV5 `json:"loadingExperience,omitempty"`

	// OriginLoadingExperience: Metrics of the aggregated page loading
	// experience of the origin
	OriginLoadingExperience *PagespeedApiLoadingExperienceV5 `json:"originLoadingExperience,omitempty"`

	// Version: The version of PageSpeed used to generate these results.
	Version *PagespeedVersion `json:"version,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g.
	// "AnalysisUTCTimestamp") to unconditionally include in API requests.
	// By default, fields with empty values are omitted from API requests.
	// However, any non-pointer, non-interface field appearing in
	// ForceSendFields will be sent to the server regardless of whether the
	// field is empty or not. This may be used to include empty fields in
	// Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "AnalysisUTCTimestamp") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

PagespeedApiPagespeedResponseV5: The Pagespeed API response object.

func (*PagespeedApiPagespeedResponseV5) MarshalJSON

func (s *PagespeedApiPagespeedResponseV5) MarshalJSON() ([]byte, error)

type PagespeedVersion added in v0.16.0

type PagespeedVersion struct {
	// Major: The major version number of PageSpeed used to generate these
	// results.
	Major string `json:"major,omitempty"`

	// Minor: The minor version number of PageSpeed used to generate these
	// results.
	Minor string `json:"minor,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Major") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Major") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

PagespeedVersion: The Pagespeed Version object.

func (*PagespeedVersion) MarshalJSON added in v0.16.0

func (s *PagespeedVersion) MarshalJSON() ([]byte, error)

type PagespeedapiRunpagespeedCall

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

func (*PagespeedapiRunpagespeedCall) CaptchaToken added in v0.16.0

func (c *PagespeedapiRunpagespeedCall) CaptchaToken(captchaToken string) *PagespeedapiRunpagespeedCall

CaptchaToken sets the optional parameter "captchaToken": The captcha token passed when filling out a captcha.

func (*PagespeedapiRunpagespeedCall) Category

Category sets the optional parameter "category": A Lighthouse category to run; if none are given, only Performance category will be run

Possible values:

"CATEGORY_UNSPECIFIED"
"ACCESSIBILITY"
"BEST_PRACTICES"
"PERFORMANCE"
"PWA"
"SEO"

func (*PagespeedapiRunpagespeedCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*PagespeedapiRunpagespeedCall) Do

Do executes the "pagespeedonline.pagespeedapi.runpagespeed" call. Exactly one of *PagespeedApiPagespeedResponseV5 or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *PagespeedApiPagespeedResponseV5.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*PagespeedapiRunpagespeedCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*PagespeedapiRunpagespeedCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*PagespeedapiRunpagespeedCall) IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*PagespeedapiRunpagespeedCall) Locale

Locale sets the optional parameter "locale": The locale used to localize formatted results

func (*PagespeedapiRunpagespeedCall) Strategy

Strategy sets the optional parameter "strategy": The analysis strategy (desktop or mobile) to use, and desktop is the default

Possible values:

"STRATEGY_UNSPECIFIED"
"DESKTOP"
"MOBILE"

func (*PagespeedapiRunpagespeedCall) Url added in v0.16.0

Url sets the optional parameter "url": The URL to fetch and analyze

func (*PagespeedapiRunpagespeedCall) UtmCampaign

UtmCampaign sets the optional parameter "utm_campaign": Campaign name for analytics.

func (*PagespeedapiRunpagespeedCall) UtmSource

UtmSource sets the optional parameter "utm_source": Campaign source for analytics.

type PagespeedapiService

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

func NewPagespeedapiService

func NewPagespeedapiService(s *Service) *PagespeedapiService

func (*PagespeedapiService) Runpagespeed

Runpagespeed: Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information.

type RendererFormattedStrings added in v0.16.0

type RendererFormattedStrings struct {
	// AuditGroupExpandTooltip: The tooltip text on an expandable chevron
	// icon.
	AuditGroupExpandTooltip string `json:"auditGroupExpandTooltip,omitempty"`

	// CrcInitialNavigation: The label for the initial request in a critical
	// request chain.
	CrcInitialNavigation string `json:"crcInitialNavigation,omitempty"`

	// CrcLongestDurationLabel: The label for values shown in the summary of
	// critical request chains.
	CrcLongestDurationLabel string `json:"crcLongestDurationLabel,omitempty"`

	// ErrorLabel: The label shown next to an audit or metric that has had
	// an error.
	ErrorLabel string `json:"errorLabel,omitempty"`

	// ErrorMissingAuditInfo: The error string shown next to an erroring
	// audit.
	ErrorMissingAuditInfo string `json:"errorMissingAuditInfo,omitempty"`

	// LabDataTitle: The title of the lab data performance category.
	LabDataTitle string `json:"labDataTitle,omitempty"`

	// LsPerformanceCategoryDescription: The disclaimer shown under
	// performance explaning that the network can
	// vary.
	LsPerformanceCategoryDescription string `json:"lsPerformanceCategoryDescription,omitempty"`

	// ManualAuditsGroupTitle: The heading shown above a list of audits that
	// were not computerd in the
	// run.
	ManualAuditsGroupTitle string `json:"manualAuditsGroupTitle,omitempty"`

	// NotApplicableAuditsGroupTitle: The heading shown above a list of
	// audits that do not apply to a page.
	NotApplicableAuditsGroupTitle string `json:"notApplicableAuditsGroupTitle,omitempty"`

	// OpportunityResourceColumnLabel: The heading for the estimated page
	// load savings opportunity of an
	// audit.
	OpportunityResourceColumnLabel string `json:"opportunityResourceColumnLabel,omitempty"`

	// OpportunitySavingsColumnLabel: The heading for the estimated page
	// load savings of opportunity audits.
	OpportunitySavingsColumnLabel string `json:"opportunitySavingsColumnLabel,omitempty"`

	// PassedAuditsGroupTitle: The heading that is shown above a list of
	// audits that are passing.
	PassedAuditsGroupTitle string `json:"passedAuditsGroupTitle,omitempty"`

	// ScorescaleLabel: The label that explains the score gauges scale
	// (0-49, 50-89, 90-100).
	ScorescaleLabel string `json:"scorescaleLabel,omitempty"`

	// ToplevelWarningsMessage: The label shown preceding important warnings
	// that may have invalidated
	// an entire report.
	ToplevelWarningsMessage string `json:"toplevelWarningsMessage,omitempty"`

	// VarianceDisclaimer: The disclaimer shown below a performance metric
	// value.
	VarianceDisclaimer string `json:"varianceDisclaimer,omitempty"`

	// WarningHeader: The label shown above a bulleted list of warnings.
	WarningHeader string `json:"warningHeader,omitempty"`

	// ForceSendFields is a list of field names (e.g.
	// "AuditGroupExpandTooltip") to unconditionally include in API
	// requests. By default, fields with empty values are omitted from API
	// requests. However, any non-pointer, non-interface field appearing in
	// ForceSendFields will be sent to the server regardless of whether the
	// field is empty or not. This may be used to include empty fields in
	// Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "AuditGroupExpandTooltip")
	// to include in API requests with the JSON null value. By default,
	// fields with empty values are omitted from API requests. However, any
	// field with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

RendererFormattedStrings: Message holding the formatted strings used in the renderer.

func (*RendererFormattedStrings) MarshalJSON added in v0.16.0

func (s *RendererFormattedStrings) MarshalJSON() ([]byte, error)

type RuntimeError added in v0.16.0

type RuntimeError struct {
	// Code: The enumerated Lighthouse Error code.
	Code string `json:"code,omitempty"`

	// Message: A human readable message explaining the error code.
	Message string `json:"message,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Code") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Code") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

RuntimeError: Message containing a runtime error config.

func (*RuntimeError) MarshalJSON added in v0.16.0

func (s *RuntimeError) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Pagespeedapi *PagespeedapiService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService added in v0.3.0

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type StackPack added in v0.16.0

type StackPack struct {
	// Descriptions: The stack pack advice strings.
	Descriptions map[string]string `json:"descriptions,omitempty"`

	// IconDataURL: The stack pack icon data uri.
	IconDataURL string `json:"iconDataURL,omitempty"`

	// Id: The stack pack id.
	Id string `json:"id,omitempty"`

	// Title: The stack pack title.
	Title string `json:"title,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Descriptions") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Descriptions") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

StackPack: Message containing Stack Pack information.

func (*StackPack) MarshalJSON added in v0.16.0

func (s *StackPack) MarshalJSON() ([]byte, error)

type Timing added in v0.16.0

type Timing struct {
	// Total: The total duration of Lighthouse's run.
	Total float64 `json:"total,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Total") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Total") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

Timing: Message containing the performance timing data for the Lighthouse run.

func (*Timing) MarshalJSON added in v0.16.0

func (s *Timing) MarshalJSON() ([]byte, error)

func (*Timing) UnmarshalJSON added in v0.16.0

func (s *Timing) UnmarshalJSON(data []byte) error

type UserPageLoadMetricV5 added in v0.16.0

type UserPageLoadMetricV5 struct {
	// Category: The category of the specific time metric.
	Category string `json:"category,omitempty"`

	// Distributions: Metric distributions. Proportions should sum up to 1.
	Distributions []*Bucket `json:"distributions,omitempty"`

	// FormFactor: Identifies the form factor of the metric being collected.
	FormFactor string `json:"formFactor,omitempty"`

	// Median: The median number of the metric, in millisecond.
	Median int64 `json:"median,omitempty"`

	// MetricId: Identifies the type of the metric.
	MetricId string `json:"metricId,omitempty"`

	// Percentile: We use this field to store certain percentile value for
	// this metric.
	// For v4, this field contains pc50.
	// For v5, this field contains pc90.
	Percentile int64 `json:"percentile,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Category") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Category") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

UserPageLoadMetricV5: A CrUX metric object for a single metric and form factor.

func (*UserPageLoadMetricV5) MarshalJSON added in v0.16.0

func (s *UserPageLoadMetricV5) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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