1// Copyright 2021 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package pagespeedonline provides access to the PageSpeed Insights API.
8//
9// For product documentation, see: https://developers.google.com/speed/docs/insights/v5/about
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/pagespeedonline/v5"
16//   ...
17//   ctx := context.Background()
18//   pagespeedonlineService, err := pagespeedonline.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
27//
28//   pagespeedonlineService, err := pagespeedonline.NewService(ctx, option.WithAPIKey("AIza..."))
29//
30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
31//
32//   config := &oauth2.Config{...}
33//   // ...
34//   token, err := config.Exchange(ctx, ...)
35//   pagespeedonlineService, err := pagespeedonline.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
36//
37// See https://godoc.org/google.golang.org/api/option/ for details on options.
38package pagespeedonline // import "google.golang.org/api/pagespeedonline/v5"
39
40import (
41	"bytes"
42	"context"
43	"encoding/json"
44	"errors"
45	"fmt"
46	"io"
47	"net/http"
48	"net/url"
49	"strconv"
50	"strings"
51
52	googleapi "google.golang.org/api/googleapi"
53	gensupport "google.golang.org/api/internal/gensupport"
54	option "google.golang.org/api/option"
55	internaloption "google.golang.org/api/option/internaloption"
56	htransport "google.golang.org/api/transport/http"
57)
58
59// Always reference these packages, just in case the auto-generated code
60// below doesn't.
61var _ = bytes.NewBuffer
62var _ = strconv.Itoa
63var _ = fmt.Sprintf
64var _ = json.NewDecoder
65var _ = io.Copy
66var _ = url.Parse
67var _ = gensupport.MarshalJSON
68var _ = googleapi.Version
69var _ = errors.New
70var _ = strings.Replace
71var _ = context.Canceled
72var _ = internaloption.WithDefaultEndpoint
73
74const apiId = "pagespeedonline:v5"
75const apiName = "pagespeedonline"
76const apiVersion = "v5"
77const basePath = "https://pagespeedonline.googleapis.com/"
78const mtlsBasePath = "https://pagespeedonline.mtls.googleapis.com/"
79
80// OAuth2 scopes used by this API.
81const (
82	// Associate you with your personal info on Google
83	OpenIDScope = "openid"
84)
85
86// NewService creates a new Service.
87func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
88	scopesOption := option.WithScopes(
89		"openid",
90	)
91	// NOTE: prepend, so we don't override user-specified scopes.
92	opts = append([]option.ClientOption{scopesOption}, opts...)
93	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
94	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
95	client, endpoint, err := htransport.NewClient(ctx, opts...)
96	if err != nil {
97		return nil, err
98	}
99	s, err := New(client)
100	if err != nil {
101		return nil, err
102	}
103	if endpoint != "" {
104		s.BasePath = endpoint
105	}
106	return s, nil
107}
108
109// New creates a new Service. It uses the provided http.Client for requests.
110//
111// Deprecated: please use NewService instead.
112// To provide a custom HTTP client, use option.WithHTTPClient.
113// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
114func New(client *http.Client) (*Service, error) {
115	if client == nil {
116		return nil, errors.New("client is nil")
117	}
118	s := &Service{client: client, BasePath: basePath}
119	s.Pagespeedapi = NewPagespeedapiService(s)
120	return s, nil
121}
122
123type Service struct {
124	client    *http.Client
125	BasePath  string // API endpoint base URL
126	UserAgent string // optional additional User-Agent fragment
127
128	Pagespeedapi *PagespeedapiService
129}
130
131func (s *Service) userAgent() string {
132	if s.UserAgent == "" {
133		return googleapi.UserAgent
134	}
135	return googleapi.UserAgent + " " + s.UserAgent
136}
137
138func NewPagespeedapiService(s *Service) *PagespeedapiService {
139	rs := &PagespeedapiService{s: s}
140	return rs
141}
142
143type PagespeedapiService struct {
144	s *Service
145}
146
147// AuditRefs: A light reference to an audit by id, used to group and
148// weight audits in a given category.
149type AuditRefs struct {
150	// Acronym: The conventional acronym for the audit/metric.
151	Acronym string `json:"acronym,omitempty"`
152
153	// Group: The category group that the audit belongs to (optional).
154	Group string `json:"group,omitempty"`
155
156	// Id: The audit ref id.
157	Id string `json:"id,omitempty"`
158
159	// RelevantAudits: Any audit IDs closely relevant to this one.
160	RelevantAudits []string `json:"relevantAudits,omitempty"`
161
162	// Weight: The weight this audit's score has on the overall category
163	// score.
164	Weight float64 `json:"weight,omitempty"`
165
166	// ForceSendFields is a list of field names (e.g. "Acronym") to
167	// unconditionally include in API requests. By default, fields with
168	// empty or default values are omitted from API requests. However, any
169	// non-pointer, non-interface field appearing in ForceSendFields will be
170	// sent to the server regardless of whether the field is empty or not.
171	// This may be used to include empty fields in Patch requests.
172	ForceSendFields []string `json:"-"`
173
174	// NullFields is a list of field names (e.g. "Acronym") to include in
175	// API requests with the JSON null value. By default, fields with empty
176	// values are omitted from API requests. However, any field with an
177	// empty value appearing in NullFields will be sent to the server as
178	// null. It is an error if a field in this list has a non-empty value.
179	// This may be used to include null fields in Patch requests.
180	NullFields []string `json:"-"`
181}
182
183func (s *AuditRefs) MarshalJSON() ([]byte, error) {
184	type NoMethod AuditRefs
185	raw := NoMethod(*s)
186	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
187}
188
189func (s *AuditRefs) UnmarshalJSON(data []byte) error {
190	type NoMethod AuditRefs
191	var s1 struct {
192		Weight gensupport.JSONFloat64 `json:"weight"`
193		*NoMethod
194	}
195	s1.NoMethod = (*NoMethod)(s)
196	if err := json.Unmarshal(data, &s1); err != nil {
197		return err
198	}
199	s.Weight = float64(s1.Weight)
200	return nil
201}
202
203// Bucket: A proportion of data in the total distribution, bucketed by a
204// min/max percentage. Each bucket's range is bounded by min <= x < max,
205// In millisecond.
206type Bucket struct {
207	// Max: Upper bound for a bucket's range.
208	Max int64 `json:"max,omitempty"`
209
210	// Min: Lower bound for a bucket's range.
211	Min int64 `json:"min,omitempty"`
212
213	// Proportion: The proportion of data in this bucket.
214	Proportion float64 `json:"proportion,omitempty"`
215
216	// ForceSendFields is a list of field names (e.g. "Max") to
217	// unconditionally include in API requests. By default, fields with
218	// empty or default values are omitted from API requests. However, any
219	// non-pointer, non-interface field appearing in ForceSendFields will be
220	// sent to the server regardless of whether the field is empty or not.
221	// This may be used to include empty fields in Patch requests.
222	ForceSendFields []string `json:"-"`
223
224	// NullFields is a list of field names (e.g. "Max") to include in API
225	// requests with the JSON null value. By default, fields with empty
226	// values are omitted from API requests. However, any field with an
227	// empty value appearing in NullFields will be sent to the server as
228	// null. It is an error if a field in this list has a non-empty value.
229	// This may be used to include null fields in Patch requests.
230	NullFields []string `json:"-"`
231}
232
233func (s *Bucket) MarshalJSON() ([]byte, error) {
234	type NoMethod Bucket
235	raw := NoMethod(*s)
236	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
237}
238
239func (s *Bucket) UnmarshalJSON(data []byte) error {
240	type NoMethod Bucket
241	var s1 struct {
242		Proportion gensupport.JSONFloat64 `json:"proportion"`
243		*NoMethod
244	}
245	s1.NoMethod = (*NoMethod)(s)
246	if err := json.Unmarshal(data, &s1); err != nil {
247		return err
248	}
249	s.Proportion = float64(s1.Proportion)
250	return nil
251}
252
253// Categories: The categories in a Lighthouse run.
254type Categories struct {
255	// Accessibility: The accessibility category, containing all
256	// accessibility related audits.
257	Accessibility *LighthouseCategoryV5 `json:"accessibility,omitempty"`
258
259	// BestPractices: The best practices category, containing all best
260	// practices related audits.
261	BestPractices *LighthouseCategoryV5 `json:"best-practices,omitempty"`
262
263	// Performance: The performance category, containing all performance
264	// related audits.
265	Performance *LighthouseCategoryV5 `json:"performance,omitempty"`
266
267	// Pwa: The Progressive-Web-App (PWA) category, containing all pwa
268	// related audits.
269	Pwa *LighthouseCategoryV5 `json:"pwa,omitempty"`
270
271	// Seo: The Search-Engine-Optimization (SEO) category, containing all
272	// seo related audits.
273	Seo *LighthouseCategoryV5 `json:"seo,omitempty"`
274
275	// ForceSendFields is a list of field names (e.g. "Accessibility") to
276	// unconditionally include in API requests. By default, fields with
277	// empty or default values are omitted from API requests. However, any
278	// non-pointer, non-interface field appearing in ForceSendFields will be
279	// sent to the server regardless of whether the field is empty or not.
280	// This may be used to include empty fields in Patch requests.
281	ForceSendFields []string `json:"-"`
282
283	// NullFields is a list of field names (e.g. "Accessibility") to include
284	// in API requests with the JSON null value. By default, fields with
285	// empty values are omitted from API requests. However, any field with
286	// an empty value appearing in NullFields will be sent to the server as
287	// null. It is an error if a field in this list has a non-empty value.
288	// This may be used to include null fields in Patch requests.
289	NullFields []string `json:"-"`
290}
291
292func (s *Categories) MarshalJSON() ([]byte, error) {
293	type NoMethod Categories
294	raw := NoMethod(*s)
295	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
296}
297
298// CategoryGroupV5: Message containing a category
299type CategoryGroupV5 struct {
300	// Description: The description of what the category is grouping
301	Description string `json:"description,omitempty"`
302
303	// Title: The human readable title of the group
304	Title string `json:"title,omitempty"`
305
306	// ForceSendFields is a list of field names (e.g. "Description") to
307	// unconditionally include in API requests. By default, fields with
308	// empty or default values are omitted from API requests. However, any
309	// non-pointer, non-interface field appearing in ForceSendFields will be
310	// sent to the server regardless of whether the field is empty or not.
311	// This may be used to include empty fields in Patch requests.
312	ForceSendFields []string `json:"-"`
313
314	// NullFields is a list of field names (e.g. "Description") to include
315	// in API requests with the JSON null value. By default, fields with
316	// empty values are omitted from API requests. However, any field with
317	// an empty value appearing in NullFields will be sent to the server as
318	// null. It is an error if a field in this list has a non-empty value.
319	// This may be used to include null fields in Patch requests.
320	NullFields []string `json:"-"`
321}
322
323func (s *CategoryGroupV5) MarshalJSON() ([]byte, error) {
324	type NoMethod CategoryGroupV5
325	raw := NoMethod(*s)
326	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
327}
328
329// ConfigSettings: Message containing the configuration settings for the
330// Lighthouse run.
331type ConfigSettings struct {
332	// Channel: How Lighthouse was run, e.g. from the Chrome extension or
333	// from the npm module.
334	Channel string `json:"channel,omitempty"`
335
336	// EmulatedFormFactor: The form factor the emulation should use. This
337	// field is deprecated, form_factor should be used instead.
338	EmulatedFormFactor string `json:"emulatedFormFactor,omitempty"`
339
340	// FormFactor: How Lighthouse should interpret this run in regards to
341	// scoring performance metrics and skipping mobile-only tests in
342	// desktop.
343	FormFactor string `json:"formFactor,omitempty"`
344
345	// Locale: The locale setting.
346	Locale string `json:"locale,omitempty"`
347
348	// OnlyCategories: List of categories of audits the run should conduct.
349	OnlyCategories interface{} `json:"onlyCategories,omitempty"`
350
351	// ForceSendFields is a list of field names (e.g. "Channel") to
352	// unconditionally include in API requests. By default, fields with
353	// empty or default values are omitted from API requests. However, any
354	// non-pointer, non-interface field appearing in ForceSendFields will be
355	// sent to the server regardless of whether the field is empty or not.
356	// This may be used to include empty fields in Patch requests.
357	ForceSendFields []string `json:"-"`
358
359	// NullFields is a list of field names (e.g. "Channel") to include in
360	// API requests with the JSON null value. By default, fields with empty
361	// values are omitted from API requests. However, any field with an
362	// empty value appearing in NullFields will be sent to the server as
363	// null. It is an error if a field in this list has a non-empty value.
364	// This may be used to include null fields in Patch requests.
365	NullFields []string `json:"-"`
366}
367
368func (s *ConfigSettings) MarshalJSON() ([]byte, error) {
369	type NoMethod ConfigSettings
370	raw := NoMethod(*s)
371	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
372}
373
374// Environment: Message containing environment configuration for a
375// Lighthouse run.
376type Environment struct {
377	// BenchmarkIndex: The benchmark index number that indicates rough
378	// device class.
379	BenchmarkIndex float64 `json:"benchmarkIndex,omitempty"`
380
381	// HostUserAgent: The user agent string of the version of Chrome used.
382	HostUserAgent string `json:"hostUserAgent,omitempty"`
383
384	// NetworkUserAgent: The user agent string that was sent over the
385	// network.
386	NetworkUserAgent string `json:"networkUserAgent,omitempty"`
387
388	// ForceSendFields is a list of field names (e.g. "BenchmarkIndex") to
389	// unconditionally include in API requests. By default, fields with
390	// empty or default values are omitted from API requests. However, any
391	// non-pointer, non-interface field appearing in ForceSendFields will be
392	// sent to the server regardless of whether the field is empty or not.
393	// This may be used to include empty fields in Patch requests.
394	ForceSendFields []string `json:"-"`
395
396	// NullFields is a list of field names (e.g. "BenchmarkIndex") to
397	// include in API requests with the JSON null value. By default, fields
398	// with empty values are omitted from API requests. However, any field
399	// with an empty value appearing in NullFields will be sent to the
400	// server as null. It is an error if a field in this list has a
401	// non-empty value. This may be used to include null fields in Patch
402	// requests.
403	NullFields []string `json:"-"`
404}
405
406func (s *Environment) MarshalJSON() ([]byte, error) {
407	type NoMethod Environment
408	raw := NoMethod(*s)
409	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
410}
411
412func (s *Environment) UnmarshalJSON(data []byte) error {
413	type NoMethod Environment
414	var s1 struct {
415		BenchmarkIndex gensupport.JSONFloat64 `json:"benchmarkIndex"`
416		*NoMethod
417	}
418	s1.NoMethod = (*NoMethod)(s)
419	if err := json.Unmarshal(data, &s1); err != nil {
420		return err
421	}
422	s.BenchmarkIndex = float64(s1.BenchmarkIndex)
423	return nil
424}
425
426// I18n: Message containing the i18n data for the LHR - Version 1.
427type I18n struct {
428	// RendererFormattedStrings: Internationalized strings that are
429	// formatted to the locale in configSettings.
430	RendererFormattedStrings *RendererFormattedStrings `json:"rendererFormattedStrings,omitempty"`
431
432	// ForceSendFields is a list of field names (e.g.
433	// "RendererFormattedStrings") to unconditionally include in API
434	// requests. By default, fields with empty or default values are omitted
435	// from API requests. However, any non-pointer, non-interface field
436	// appearing in ForceSendFields will be sent to the server regardless of
437	// whether the field is empty or not. This may be used to include empty
438	// fields in Patch requests.
439	ForceSendFields []string `json:"-"`
440
441	// NullFields is a list of field names (e.g. "RendererFormattedStrings")
442	// to include in API requests with the JSON null value. By default,
443	// fields with empty values are omitted from API requests. However, any
444	// field with an empty value appearing in NullFields will be sent to the
445	// server as null. It is an error if a field in this list has a
446	// non-empty value. This may be used to include null fields in Patch
447	// requests.
448	NullFields []string `json:"-"`
449}
450
451func (s *I18n) MarshalJSON() ([]byte, error) {
452	type NoMethod I18n
453	raw := NoMethod(*s)
454	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
455}
456
457// LighthouseAuditResultV5: An audit's result object in a Lighthouse
458// result.
459type LighthouseAuditResultV5 struct {
460	// Description: The description of the audit.
461	Description string `json:"description,omitempty"`
462
463	// Details: Freeform details section of the audit.
464	Details googleapi.RawMessage `json:"details,omitempty"`
465
466	// DisplayValue: The value that should be displayed on the UI for this
467	// audit.
468	DisplayValue string `json:"displayValue,omitempty"`
469
470	// ErrorMessage: An error message from a thrown error inside the audit.
471	ErrorMessage string `json:"errorMessage,omitempty"`
472
473	// Explanation: An explanation of the errors in the audit.
474	Explanation string `json:"explanation,omitempty"`
475
476	// Id: The audit's id.
477	Id string `json:"id,omitempty"`
478
479	// NumericUnit: The unit of the numeric_value field. Used to format the
480	// numeric value for display.
481	NumericUnit string `json:"numericUnit,omitempty"`
482
483	// NumericValue: A numeric value that has a meaning specific to the
484	// audit, e.g. the number of nodes in the DOM or the timestamp of a
485	// specific load event. More information can be found in the audit
486	// details, if present.
487	NumericValue float64 `json:"numericValue,omitempty"`
488
489	// Score: The score of the audit, can be null.
490	Score interface{} `json:"score,omitempty"`
491
492	// ScoreDisplayMode: The enumerated score display mode.
493	ScoreDisplayMode string `json:"scoreDisplayMode,omitempty"`
494
495	// Title: The human readable title.
496	Title string `json:"title,omitempty"`
497
498	// Warnings: Possible warnings that occurred in the audit, can be null.
499	Warnings interface{} `json:"warnings,omitempty"`
500
501	// ForceSendFields is a list of field names (e.g. "Description") to
502	// unconditionally include in API requests. By default, fields with
503	// empty or default values are omitted from API requests. However, any
504	// non-pointer, non-interface field appearing in ForceSendFields will be
505	// sent to the server regardless of whether the field is empty or not.
506	// This may be used to include empty fields in Patch requests.
507	ForceSendFields []string `json:"-"`
508
509	// NullFields is a list of field names (e.g. "Description") to include
510	// in API requests with the JSON null value. By default, fields with
511	// empty values are omitted from API requests. However, any field with
512	// an empty value appearing in NullFields will be sent to the server as
513	// null. It is an error if a field in this list has a non-empty value.
514	// This may be used to include null fields in Patch requests.
515	NullFields []string `json:"-"`
516}
517
518func (s *LighthouseAuditResultV5) MarshalJSON() ([]byte, error) {
519	type NoMethod LighthouseAuditResultV5
520	raw := NoMethod(*s)
521	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
522}
523
524func (s *LighthouseAuditResultV5) UnmarshalJSON(data []byte) error {
525	type NoMethod LighthouseAuditResultV5
526	var s1 struct {
527		NumericValue gensupport.JSONFloat64 `json:"numericValue"`
528		*NoMethod
529	}
530	s1.NoMethod = (*NoMethod)(s)
531	if err := json.Unmarshal(data, &s1); err != nil {
532		return err
533	}
534	s.NumericValue = float64(s1.NumericValue)
535	return nil
536}
537
538// LighthouseCategoryV5: A Lighthouse category.
539type LighthouseCategoryV5 struct {
540	// AuditRefs: An array of references to all the audit members of this
541	// category.
542	AuditRefs []*AuditRefs `json:"auditRefs,omitempty"`
543
544	// Description: A more detailed description of the category and its
545	// importance.
546	Description string `json:"description,omitempty"`
547
548	// Id: The string identifier of the category.
549	Id string `json:"id,omitempty"`
550
551	// ManualDescription: A description for the manual audits in the
552	// category.
553	ManualDescription string `json:"manualDescription,omitempty"`
554
555	// Score: The overall score of the category, the weighted average of all
556	// its audits. (The category's score, can be null.)
557	Score interface{} `json:"score,omitempty"`
558
559	// Title: The human-friendly name of the category.
560	Title string `json:"title,omitempty"`
561
562	// ForceSendFields is a list of field names (e.g. "AuditRefs") to
563	// unconditionally include in API requests. By default, fields with
564	// empty or default values are omitted from API requests. However, any
565	// non-pointer, non-interface field appearing in ForceSendFields will be
566	// sent to the server regardless of whether the field is empty or not.
567	// This may be used to include empty fields in Patch requests.
568	ForceSendFields []string `json:"-"`
569
570	// NullFields is a list of field names (e.g. "AuditRefs") to include in
571	// API requests with the JSON null value. By default, fields with empty
572	// values are omitted from API requests. However, any field with an
573	// empty value appearing in NullFields will be sent to the server as
574	// null. It is an error if a field in this list has a non-empty value.
575	// This may be used to include null fields in Patch requests.
576	NullFields []string `json:"-"`
577}
578
579func (s *LighthouseCategoryV5) MarshalJSON() ([]byte, error) {
580	type NoMethod LighthouseCategoryV5
581	raw := NoMethod(*s)
582	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
583}
584
585// LighthouseResultV5: The Lighthouse result object.
586type LighthouseResultV5 struct {
587	// Audits: Map of audits in the LHR.
588	Audits map[string]LighthouseAuditResultV5 `json:"audits,omitempty"`
589
590	// Categories: Map of categories in the LHR.
591	Categories *Categories `json:"categories,omitempty"`
592
593	// CategoryGroups: Map of category groups in the LHR.
594	CategoryGroups map[string]CategoryGroupV5 `json:"categoryGroups,omitempty"`
595
596	// ConfigSettings: The configuration settings for this LHR.
597	ConfigSettings *ConfigSettings `json:"configSettings,omitempty"`
598
599	// Environment: Environment settings that were used when making this
600	// LHR.
601	Environment *Environment `json:"environment,omitempty"`
602
603	// FetchTime: The time that this run was fetched.
604	FetchTime string `json:"fetchTime,omitempty"`
605
606	// FinalUrl: The final resolved url that was audited.
607	FinalUrl string `json:"finalUrl,omitempty"`
608
609	// I18n: The internationalization strings that are required to render
610	// the LHR.
611	I18n *I18n `json:"i18n,omitempty"`
612
613	// LighthouseVersion: The lighthouse version that was used to generate
614	// this LHR.
615	LighthouseVersion string `json:"lighthouseVersion,omitempty"`
616
617	// RequestedUrl: The original requested url.
618	RequestedUrl string `json:"requestedUrl,omitempty"`
619
620	// RunWarnings: List of all run warnings in the LHR. Will always output
621	// to at least `[]`.
622	RunWarnings []interface{} `json:"runWarnings,omitempty"`
623
624	// RuntimeError: A top-level error message that, if present, indicates a
625	// serious enough problem that this Lighthouse result may need to be
626	// discarded.
627	RuntimeError *RuntimeError `json:"runtimeError,omitempty"`
628
629	// StackPacks: The Stack Pack advice strings.
630	StackPacks []*StackPack `json:"stackPacks,omitempty"`
631
632	// Timing: Timing information for this LHR.
633	Timing *Timing `json:"timing,omitempty"`
634
635	// UserAgent: The user agent that was used to run this LHR.
636	UserAgent string `json:"userAgent,omitempty"`
637
638	// ForceSendFields is a list of field names (e.g. "Audits") to
639	// unconditionally include in API requests. By default, fields with
640	// empty or default values are omitted from API requests. However, any
641	// non-pointer, non-interface field appearing in ForceSendFields will be
642	// sent to the server regardless of whether the field is empty or not.
643	// This may be used to include empty fields in Patch requests.
644	ForceSendFields []string `json:"-"`
645
646	// NullFields is a list of field names (e.g. "Audits") to include in API
647	// requests with the JSON null value. By default, fields with empty
648	// values are omitted from API requests. However, any field with an
649	// empty value appearing in NullFields will be sent to the server as
650	// null. It is an error if a field in this list has a non-empty value.
651	// This may be used to include null fields in Patch requests.
652	NullFields []string `json:"-"`
653}
654
655func (s *LighthouseResultV5) MarshalJSON() ([]byte, error) {
656	type NoMethod LighthouseResultV5
657	raw := NoMethod(*s)
658	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
659}
660
661// PagespeedApiLoadingExperienceV5: The CrUX loading experience object
662// that contains CrUX data breakdowns.
663type PagespeedApiLoadingExperienceV5 struct {
664	// Id: The url, pattern or origin which the metrics are on.
665	Id string `json:"id,omitempty"`
666
667	// InitialUrl: The requested URL, which may differ from the resolved
668	// "id".
669	InitialUrl string `json:"initial_url,omitempty"`
670
671	// Metrics: The map of .
672	Metrics map[string]UserPageLoadMetricV5 `json:"metrics,omitempty"`
673
674	// OriginFallback: True if the result is an origin fallback from a page,
675	// false otherwise.
676	OriginFallback bool `json:"origin_fallback,omitempty"`
677
678	// OverallCategory: The human readable speed "category" of the id.
679	OverallCategory string `json:"overall_category,omitempty"`
680
681	// ForceSendFields is a list of field names (e.g. "Id") to
682	// unconditionally include in API requests. By default, fields with
683	// empty or default values are omitted from API requests. However, any
684	// non-pointer, non-interface field appearing in ForceSendFields will be
685	// sent to the server regardless of whether the field is empty or not.
686	// This may be used to include empty fields in Patch requests.
687	ForceSendFields []string `json:"-"`
688
689	// NullFields is a list of field names (e.g. "Id") to include in API
690	// requests with the JSON null value. By default, fields with empty
691	// values are omitted from API requests. However, any field with an
692	// empty value appearing in NullFields will be sent to the server as
693	// null. It is an error if a field in this list has a non-empty value.
694	// This may be used to include null fields in Patch requests.
695	NullFields []string `json:"-"`
696}
697
698func (s *PagespeedApiLoadingExperienceV5) MarshalJSON() ([]byte, error) {
699	type NoMethod PagespeedApiLoadingExperienceV5
700	raw := NoMethod(*s)
701	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
702}
703
704// PagespeedApiPagespeedResponseV5: The Pagespeed API response object.
705type PagespeedApiPagespeedResponseV5 struct {
706	// AnalysisUTCTimestamp: The UTC timestamp of this analysis.
707	AnalysisUTCTimestamp string `json:"analysisUTCTimestamp,omitempty"`
708
709	// CaptchaResult: The captcha verify result
710	CaptchaResult string `json:"captchaResult,omitempty"`
711
712	// Id: Canonicalized and final URL for the document, after following
713	// page redirects (if any).
714	Id string `json:"id,omitempty"`
715
716	// Kind: Kind of result.
717	Kind string `json:"kind,omitempty"`
718
719	// LighthouseResult: Lighthouse response for the audit url as an object.
720	LighthouseResult *LighthouseResultV5 `json:"lighthouseResult,omitempty"`
721
722	// LoadingExperience: Metrics of end users' page loading experience.
723	LoadingExperience *PagespeedApiLoadingExperienceV5 `json:"loadingExperience,omitempty"`
724
725	// OriginLoadingExperience: Metrics of the aggregated page loading
726	// experience of the origin
727	OriginLoadingExperience *PagespeedApiLoadingExperienceV5 `json:"originLoadingExperience,omitempty"`
728
729	// Version: The version of PageSpeed used to generate these results.
730	Version *PagespeedVersion `json:"version,omitempty"`
731
732	// ServerResponse contains the HTTP response code and headers from the
733	// server.
734	googleapi.ServerResponse `json:"-"`
735
736	// ForceSendFields is a list of field names (e.g.
737	// "AnalysisUTCTimestamp") to unconditionally include in API requests.
738	// By default, fields with empty or default values are omitted from API
739	// requests. However, any non-pointer, non-interface field appearing in
740	// ForceSendFields will be sent to the server regardless of whether the
741	// field is empty or not. This may be used to include empty fields in
742	// Patch requests.
743	ForceSendFields []string `json:"-"`
744
745	// NullFields is a list of field names (e.g. "AnalysisUTCTimestamp") to
746	// include in API requests with the JSON null value. By default, fields
747	// with empty values are omitted from API requests. However, any field
748	// with an empty value appearing in NullFields will be sent to the
749	// server as null. It is an error if a field in this list has a
750	// non-empty value. This may be used to include null fields in Patch
751	// requests.
752	NullFields []string `json:"-"`
753}
754
755func (s *PagespeedApiPagespeedResponseV5) MarshalJSON() ([]byte, error) {
756	type NoMethod PagespeedApiPagespeedResponseV5
757	raw := NoMethod(*s)
758	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
759}
760
761// PagespeedVersion: The Pagespeed Version object.
762type PagespeedVersion struct {
763	// Major: The major version number of PageSpeed used to generate these
764	// results.
765	Major string `json:"major,omitempty"`
766
767	// Minor: The minor version number of PageSpeed used to generate these
768	// results.
769	Minor string `json:"minor,omitempty"`
770
771	// ForceSendFields is a list of field names (e.g. "Major") to
772	// unconditionally include in API requests. By default, fields with
773	// empty or default values are omitted from API requests. However, any
774	// non-pointer, non-interface field appearing in ForceSendFields will be
775	// sent to the server regardless of whether the field is empty or not.
776	// This may be used to include empty fields in Patch requests.
777	ForceSendFields []string `json:"-"`
778
779	// NullFields is a list of field names (e.g. "Major") to include in API
780	// requests with the JSON null value. By default, fields with empty
781	// values are omitted from API requests. However, any field with an
782	// empty value appearing in NullFields will be sent to the server as
783	// null. It is an error if a field in this list has a non-empty value.
784	// This may be used to include null fields in Patch requests.
785	NullFields []string `json:"-"`
786}
787
788func (s *PagespeedVersion) MarshalJSON() ([]byte, error) {
789	type NoMethod PagespeedVersion
790	raw := NoMethod(*s)
791	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
792}
793
794// RendererFormattedStrings: Message holding the formatted strings used
795// in the renderer.
796type RendererFormattedStrings struct {
797	// AuditGroupExpandTooltip: The tooltip text on an expandable chevron
798	// icon.
799	AuditGroupExpandTooltip string `json:"auditGroupExpandTooltip,omitempty"`
800
801	// CalculatorLink: Text link pointing to the Lighthouse scoring
802	// calculator. This link immediately follows a sentence stating the
803	// performance score is calculated from the perf metrics.
804	CalculatorLink string `json:"calculatorLink,omitempty"`
805
806	// CrcInitialNavigation: The label for the initial request in a critical
807	// request chain.
808	CrcInitialNavigation string `json:"crcInitialNavigation,omitempty"`
809
810	// CrcLongestDurationLabel: The label for values shown in the summary of
811	// critical request chains.
812	CrcLongestDurationLabel string `json:"crcLongestDurationLabel,omitempty"`
813
814	// DropdownCopyJSON: Option in a dropdown menu that copies the
815	// Lighthouse JSON object to the system clipboard.
816	DropdownCopyJSON string `json:"dropdownCopyJSON,omitempty"`
817
818	// DropdownDarkTheme: Option in a dropdown menu that toggles the
819	// themeing of the report between Light(default) and Dark themes.
820	DropdownDarkTheme string `json:"dropdownDarkTheme,omitempty"`
821
822	// DropdownPrintExpanded: Option in a dropdown menu that opens a full
823	// Lighthouse report in a print dialog.
824	DropdownPrintExpanded string `json:"dropdownPrintExpanded,omitempty"`
825
826	// DropdownPrintSummary: Option in a dropdown menu that opens a small,
827	// summary report in a print dialog.
828	DropdownPrintSummary string `json:"dropdownPrintSummary,omitempty"`
829
830	// DropdownSaveGist: Option in a dropdown menu that saves the current
831	// report as a new GitHub Gist.
832	DropdownSaveGist string `json:"dropdownSaveGist,omitempty"`
833
834	// DropdownSaveHTML: Option in a dropdown menu that saves the Lighthouse
835	// report HTML locally to the system as a '.html' file.
836	DropdownSaveHTML string `json:"dropdownSaveHTML,omitempty"`
837
838	// DropdownSaveJSON: Option in a dropdown menu that saves the Lighthouse
839	// JSON object to the local system as a '.json' file.
840	DropdownSaveJSON string `json:"dropdownSaveJSON,omitempty"`
841
842	// DropdownViewer: Option in a dropdown menu that opens the current
843	// report in the Lighthouse Viewer Application.
844	DropdownViewer string `json:"dropdownViewer,omitempty"`
845
846	// ErrorLabel: The label shown next to an audit or metric that has had
847	// an error.
848	ErrorLabel string `json:"errorLabel,omitempty"`
849
850	// ErrorMissingAuditInfo: The error string shown next to an erroring
851	// audit.
852	ErrorMissingAuditInfo string `json:"errorMissingAuditInfo,omitempty"`
853
854	// FooterIssue: Label for button to create an issue against the
855	// Lighthouse GitHub project.
856	FooterIssue string `json:"footerIssue,omitempty"`
857
858	// LabDataTitle: The title of the lab data performance category.
859	LabDataTitle string `json:"labDataTitle,omitempty"`
860
861	// LsPerformanceCategoryDescription: The disclaimer shown under
862	// performance explaining that the network can vary.
863	LsPerformanceCategoryDescription string `json:"lsPerformanceCategoryDescription,omitempty"`
864
865	// ManualAuditsGroupTitle: The heading shown above a list of audits that
866	// were not computerd in the run.
867	ManualAuditsGroupTitle string `json:"manualAuditsGroupTitle,omitempty"`
868
869	// NotApplicableAuditsGroupTitle: The heading shown above a list of
870	// audits that do not apply to a page.
871	NotApplicableAuditsGroupTitle string `json:"notApplicableAuditsGroupTitle,omitempty"`
872
873	// OpportunityResourceColumnLabel: The heading for the estimated page
874	// load savings opportunity of an audit.
875	OpportunityResourceColumnLabel string `json:"opportunityResourceColumnLabel,omitempty"`
876
877	// OpportunitySavingsColumnLabel: The heading for the estimated page
878	// load savings of opportunity audits.
879	OpportunitySavingsColumnLabel string `json:"opportunitySavingsColumnLabel,omitempty"`
880
881	// PassedAuditsGroupTitle: The heading that is shown above a list of
882	// audits that are passing.
883	PassedAuditsGroupTitle string `json:"passedAuditsGroupTitle,omitempty"`
884
885	// RuntimeDesktopEmulation: Descriptive explanation for emulation
886	// setting when emulating a generic desktop form factor, as opposed to a
887	// mobile-device like form factor.
888	RuntimeDesktopEmulation string `json:"runtimeDesktopEmulation,omitempty"`
889
890	// RuntimeMobileEmulation: Descriptive explanation for emulation setting
891	// when emulating a Nexus 5X mobile device.
892	RuntimeMobileEmulation string `json:"runtimeMobileEmulation,omitempty"`
893
894	// RuntimeNoEmulation: Descriptive explanation for emulation setting
895	// when no device emulation is set.
896	RuntimeNoEmulation string `json:"runtimeNoEmulation,omitempty"`
897
898	// RuntimeSettingsAxeVersion: Label for a row in a table that shows the
899	// version of the Axe library used
900	RuntimeSettingsAxeVersion string `json:"runtimeSettingsAxeVersion,omitempty"`
901
902	// RuntimeSettingsBenchmark: Label for a row in a table that shows the
903	// estimated CPU power of the machine running Lighthouse. Example row
904	// values: 532, 1492, 783.
905	RuntimeSettingsBenchmark string `json:"runtimeSettingsBenchmark,omitempty"`
906
907	// RuntimeSettingsCPUThrottling: Label for a row in a table that
908	// describes the CPU throttling conditions that were used during a
909	// Lighthouse run, if any.
910	RuntimeSettingsCPUThrottling string `json:"runtimeSettingsCPUThrottling,omitempty"`
911
912	// RuntimeSettingsChannel: Label for a row in a table that shows in what
913	// tool Lighthouse is being run (e.g. The lighthouse CLI, Chrome
914	// DevTools, Lightrider, WebPageTest, etc).
915	RuntimeSettingsChannel string `json:"runtimeSettingsChannel,omitempty"`
916
917	// RuntimeSettingsDevice: Label for a row in a table that describes the
918	// kind of device that was emulated for the Lighthouse run. Example
919	// values for row elements: 'No Emulation', 'Emulated Desktop', etc.
920	RuntimeSettingsDevice string `json:"runtimeSettingsDevice,omitempty"`
921
922	// RuntimeSettingsFetchTime: Label for a row in a table that shows the
923	// time at which a Lighthouse run was conducted; formatted as a
924	// timestamp, e.g. Jan 1, 1970 12:00 AM UTC.
925	RuntimeSettingsFetchTime string `json:"runtimeSettingsFetchTime,omitempty"`
926
927	// RuntimeSettingsNetworkThrottling: Label for a row in a table that
928	// describes the network throttling conditions that were used during a
929	// Lighthouse run, if any.
930	RuntimeSettingsNetworkThrottling string `json:"runtimeSettingsNetworkThrottling,omitempty"`
931
932	// RuntimeSettingsTitle: Title of the Runtime settings table in a
933	// Lighthouse report. Runtime settings are the environment
934	// configurations that a specific report used at auditing time.
935	RuntimeSettingsTitle string `json:"runtimeSettingsTitle,omitempty"`
936
937	// RuntimeSettingsUA: Label for a row in a table that shows the User
938	// Agent that was detected on the Host machine that ran Lighthouse.
939	RuntimeSettingsUA string `json:"runtimeSettingsUA,omitempty"`
940
941	// RuntimeSettingsUANetwork: Label for a row in a table that shows the
942	// User Agent that was used to send out all network requests during the
943	// Lighthouse run.
944	RuntimeSettingsUANetwork string `json:"runtimeSettingsUANetwork,omitempty"`
945
946	// RuntimeSettingsUrl: Label for a row in a table that shows the URL
947	// that was audited during a Lighthouse run.
948	RuntimeSettingsUrl string `json:"runtimeSettingsUrl,omitempty"`
949
950	// RuntimeUnknown: Descriptive explanation for a runtime setting that is
951	// set to an unknown value.
952	RuntimeUnknown string `json:"runtimeUnknown,omitempty"`
953
954	// ScorescaleLabel: The label that explains the score gauges scale
955	// (0-49, 50-89, 90-100).
956	ScorescaleLabel string `json:"scorescaleLabel,omitempty"`
957
958	// ShowRelevantAudits: Label preceding a radio control for filtering the
959	// list of audits. The radio choices are various performance metrics
960	// (FCP, LCP, TBT), and if chosen, the audits in the report are hidden
961	// if they are not relevant to the selected metric.
962	ShowRelevantAudits string `json:"showRelevantAudits,omitempty"`
963
964	// SnippetCollapseButtonLabel: The label for the button to show only a
965	// few lines of a snippet
966	SnippetCollapseButtonLabel string `json:"snippetCollapseButtonLabel,omitempty"`
967
968	// SnippetExpandButtonLabel: The label for the button to show all lines
969	// of a snippet
970	SnippetExpandButtonLabel string `json:"snippetExpandButtonLabel,omitempty"`
971
972	// ThirdPartyResourcesLabel: This label is for a filter checkbox above a
973	// table of items
974	ThirdPartyResourcesLabel string `json:"thirdPartyResourcesLabel,omitempty"`
975
976	// ThrottlingProvided: Descriptive explanation for environment
977	// throttling that was provided by the runtime environment instead of
978	// provided by Lighthouse throttling.
979	ThrottlingProvided string `json:"throttlingProvided,omitempty"`
980
981	// ToplevelWarningsMessage: The label shown preceding important warnings
982	// that may have invalidated an entire report.
983	ToplevelWarningsMessage string `json:"toplevelWarningsMessage,omitempty"`
984
985	// VarianceDisclaimer: The disclaimer shown below a performance metric
986	// value.
987	VarianceDisclaimer string `json:"varianceDisclaimer,omitempty"`
988
989	// ViewTreemapLabel: Label for a button that opens the Treemap App
990	ViewTreemapLabel string `json:"viewTreemapLabel,omitempty"`
991
992	// WarningAuditsGroupTitle: The heading that is shown above a list of
993	// audits that have warnings
994	WarningAuditsGroupTitle string `json:"warningAuditsGroupTitle,omitempty"`
995
996	// WarningHeader: The label shown above a bulleted list of warnings.
997	WarningHeader string `json:"warningHeader,omitempty"`
998
999	// ForceSendFields is a list of field names (e.g.
1000	// "AuditGroupExpandTooltip") to unconditionally include in API
1001	// requests. By default, fields with empty or default values are omitted
1002	// from API requests. However, any non-pointer, non-interface field
1003	// appearing in ForceSendFields will be sent to the server regardless of
1004	// whether the field is empty or not. This may be used to include empty
1005	// fields in Patch requests.
1006	ForceSendFields []string `json:"-"`
1007
1008	// NullFields is a list of field names (e.g. "AuditGroupExpandTooltip")
1009	// to include in API requests with the JSON null value. By default,
1010	// fields with empty values are omitted from API requests. However, any
1011	// field with an empty value appearing in NullFields will be sent to the
1012	// server as null. It is an error if a field in this list has a
1013	// non-empty value. This may be used to include null fields in Patch
1014	// requests.
1015	NullFields []string `json:"-"`
1016}
1017
1018func (s *RendererFormattedStrings) MarshalJSON() ([]byte, error) {
1019	type NoMethod RendererFormattedStrings
1020	raw := NoMethod(*s)
1021	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1022}
1023
1024// RuntimeError: Message containing a runtime error config.
1025type RuntimeError struct {
1026	// Code: The enumerated Lighthouse Error code.
1027	Code string `json:"code,omitempty"`
1028
1029	// Message: A human readable message explaining the error code.
1030	Message string `json:"message,omitempty"`
1031
1032	// ForceSendFields is a list of field names (e.g. "Code") to
1033	// unconditionally include in API requests. By default, fields with
1034	// empty or default values are omitted from API requests. However, any
1035	// non-pointer, non-interface field appearing in ForceSendFields will be
1036	// sent to the server regardless of whether the field is empty or not.
1037	// This may be used to include empty fields in Patch requests.
1038	ForceSendFields []string `json:"-"`
1039
1040	// NullFields is a list of field names (e.g. "Code") to include in API
1041	// requests with the JSON null value. By default, fields with empty
1042	// values are omitted from API requests. However, any field with an
1043	// empty value appearing in NullFields will be sent to the server as
1044	// null. It is an error if a field in this list has a non-empty value.
1045	// This may be used to include null fields in Patch requests.
1046	NullFields []string `json:"-"`
1047}
1048
1049func (s *RuntimeError) MarshalJSON() ([]byte, error) {
1050	type NoMethod RuntimeError
1051	raw := NoMethod(*s)
1052	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1053}
1054
1055// StackPack: Message containing Stack Pack information.
1056type StackPack struct {
1057	// Descriptions: The stack pack advice strings.
1058	Descriptions map[string]string `json:"descriptions,omitempty"`
1059
1060	// IconDataURL: The stack pack icon data uri.
1061	IconDataURL string `json:"iconDataURL,omitempty"`
1062
1063	// Id: The stack pack id.
1064	Id string `json:"id,omitempty"`
1065
1066	// Title: The stack pack title.
1067	Title string `json:"title,omitempty"`
1068
1069	// ForceSendFields is a list of field names (e.g. "Descriptions") to
1070	// unconditionally include in API requests. By default, fields with
1071	// empty or default values are omitted from API requests. However, any
1072	// non-pointer, non-interface field appearing in ForceSendFields will be
1073	// sent to the server regardless of whether the field is empty or not.
1074	// This may be used to include empty fields in Patch requests.
1075	ForceSendFields []string `json:"-"`
1076
1077	// NullFields is a list of field names (e.g. "Descriptions") to include
1078	// in API requests with the JSON null value. By default, fields with
1079	// empty values are omitted from API requests. However, any field with
1080	// an empty value appearing in NullFields will be sent to the server as
1081	// null. It is an error if a field in this list has a non-empty value.
1082	// This may be used to include null fields in Patch requests.
1083	NullFields []string `json:"-"`
1084}
1085
1086func (s *StackPack) MarshalJSON() ([]byte, error) {
1087	type NoMethod StackPack
1088	raw := NoMethod(*s)
1089	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1090}
1091
1092// Timing: Message containing the performance timing data for the
1093// Lighthouse run.
1094type Timing struct {
1095	// Total: The total duration of Lighthouse's run.
1096	Total float64 `json:"total,omitempty"`
1097
1098	// ForceSendFields is a list of field names (e.g. "Total") to
1099	// unconditionally include in API requests. By default, fields with
1100	// empty or default values are omitted from API requests. However, any
1101	// non-pointer, non-interface field appearing in ForceSendFields will be
1102	// sent to the server regardless of whether the field is empty or not.
1103	// This may be used to include empty fields in Patch requests.
1104	ForceSendFields []string `json:"-"`
1105
1106	// NullFields is a list of field names (e.g. "Total") to include in API
1107	// requests with the JSON null value. By default, fields with empty
1108	// values are omitted from API requests. However, any field with an
1109	// empty value appearing in NullFields will be sent to the server as
1110	// null. It is an error if a field in this list has a non-empty value.
1111	// This may be used to include null fields in Patch requests.
1112	NullFields []string `json:"-"`
1113}
1114
1115func (s *Timing) MarshalJSON() ([]byte, error) {
1116	type NoMethod Timing
1117	raw := NoMethod(*s)
1118	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1119}
1120
1121func (s *Timing) UnmarshalJSON(data []byte) error {
1122	type NoMethod Timing
1123	var s1 struct {
1124		Total gensupport.JSONFloat64 `json:"total"`
1125		*NoMethod
1126	}
1127	s1.NoMethod = (*NoMethod)(s)
1128	if err := json.Unmarshal(data, &s1); err != nil {
1129		return err
1130	}
1131	s.Total = float64(s1.Total)
1132	return nil
1133}
1134
1135// UserPageLoadMetricV5: A CrUX metric object for a single metric and
1136// form factor.
1137type UserPageLoadMetricV5 struct {
1138	// Category: The category of the specific time metric.
1139	Category string `json:"category,omitempty"`
1140
1141	// Distributions: Metric distributions. Proportions should sum up to 1.
1142	Distributions []*Bucket `json:"distributions,omitempty"`
1143
1144	// FormFactor: Identifies the form factor of the metric being collected.
1145	FormFactor string `json:"formFactor,omitempty"`
1146
1147	// Median: The median number of the metric, in millisecond.
1148	Median int64 `json:"median,omitempty"`
1149
1150	// MetricId: Identifies the type of the metric.
1151	MetricId string `json:"metricId,omitempty"`
1152
1153	// Percentile: We use this field to store certain percentile value for
1154	// this metric. For v4, this field contains pc50. For v5, this field
1155	// contains pc90.
1156	Percentile int64 `json:"percentile,omitempty"`
1157
1158	// ForceSendFields is a list of field names (e.g. "Category") to
1159	// unconditionally include in API requests. By default, fields with
1160	// empty or default values are omitted from API requests. However, any
1161	// non-pointer, non-interface field appearing in ForceSendFields will be
1162	// sent to the server regardless of whether the field is empty or not.
1163	// This may be used to include empty fields in Patch requests.
1164	ForceSendFields []string `json:"-"`
1165
1166	// NullFields is a list of field names (e.g. "Category") to include in
1167	// API requests with the JSON null value. By default, fields with empty
1168	// values are omitted from API requests. However, any field with an
1169	// empty value appearing in NullFields will be sent to the server as
1170	// null. It is an error if a field in this list has a non-empty value.
1171	// This may be used to include null fields in Patch requests.
1172	NullFields []string `json:"-"`
1173}
1174
1175func (s *UserPageLoadMetricV5) MarshalJSON() ([]byte, error) {
1176	type NoMethod UserPageLoadMetricV5
1177	raw := NoMethod(*s)
1178	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1179}
1180
1181// method id "pagespeedonline.pagespeedapi.runpagespeed":
1182
1183type PagespeedapiRunpagespeedCall struct {
1184	s            *Service
1185	urlParams_   gensupport.URLParams
1186	ifNoneMatch_ string
1187	ctx_         context.Context
1188	header_      http.Header
1189}
1190
1191// Runpagespeed: Runs PageSpeed analysis on the page at the specified
1192// URL, and returns PageSpeed scores, a list of suggestions to make that
1193// page faster, and other information.
1194//
1195// - url: The URL to fetch and analyze.
1196func (r *PagespeedapiService) Runpagespeed(url string) *PagespeedapiRunpagespeedCall {
1197	c := &PagespeedapiRunpagespeedCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1198	c.urlParams_.Set("url", url)
1199	return c
1200}
1201
1202// CaptchaToken sets the optional parameter "captchaToken": The captcha
1203// token passed when filling out a captcha.
1204func (c *PagespeedapiRunpagespeedCall) CaptchaToken(captchaToken string) *PagespeedapiRunpagespeedCall {
1205	c.urlParams_.Set("captchaToken", captchaToken)
1206	return c
1207}
1208
1209// Category sets the optional parameter "category": A Lighthouse
1210// category to run; if none are given, only Performance category will be
1211// run
1212//
1213// Possible values:
1214//   "CATEGORY_UNSPECIFIED" - Default UNDEFINED category.
1215//   "ACCESSIBILITY" - Accessibility (a11y), category pertaining to a
1216// website's capacity to be accessible to all users.
1217//   "BEST_PRACTICES" - Best Practices, category pertaining to a
1218// website's conformance to web best practice.
1219//   "PERFORMANCE" - Performance, category pertaining to a website's
1220// performance.
1221//   "PWA" - Progressive Web App (PWA), category pertaining to a
1222// website's ability to be run as a PWA.
1223//   "SEO" - Search Engine Optimization (SEO), category pertaining to a
1224// website's ability to be indexed by search engines.
1225func (c *PagespeedapiRunpagespeedCall) Category(category ...string) *PagespeedapiRunpagespeedCall {
1226	c.urlParams_.SetMulti("category", append([]string{}, category...))
1227	return c
1228}
1229
1230// Locale sets the optional parameter "locale": The locale used to
1231// localize formatted results
1232func (c *PagespeedapiRunpagespeedCall) Locale(locale string) *PagespeedapiRunpagespeedCall {
1233	c.urlParams_.Set("locale", locale)
1234	return c
1235}
1236
1237// Strategy sets the optional parameter "strategy": The analysis
1238// strategy (desktop or mobile) to use, and desktop is the default
1239//
1240// Possible values:
1241//   "STRATEGY_UNSPECIFIED" - UNDEFINED.
1242//   "DESKTOP" - Fetch and analyze the URL for desktop browsers.
1243//   "MOBILE" - Fetch and analyze the URL for mobile devices.
1244func (c *PagespeedapiRunpagespeedCall) Strategy(strategy string) *PagespeedapiRunpagespeedCall {
1245	c.urlParams_.Set("strategy", strategy)
1246	return c
1247}
1248
1249// UtmCampaign sets the optional parameter "utm_campaign": Campaign name
1250// for analytics.
1251func (c *PagespeedapiRunpagespeedCall) UtmCampaign(utmCampaign string) *PagespeedapiRunpagespeedCall {
1252	c.urlParams_.Set("utm_campaign", utmCampaign)
1253	return c
1254}
1255
1256// UtmSource sets the optional parameter "utm_source": Campaign source
1257// for analytics.
1258func (c *PagespeedapiRunpagespeedCall) UtmSource(utmSource string) *PagespeedapiRunpagespeedCall {
1259	c.urlParams_.Set("utm_source", utmSource)
1260	return c
1261}
1262
1263// Fields allows partial responses to be retrieved. See
1264// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1265// for more information.
1266func (c *PagespeedapiRunpagespeedCall) Fields(s ...googleapi.Field) *PagespeedapiRunpagespeedCall {
1267	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1268	return c
1269}
1270
1271// IfNoneMatch sets the optional parameter which makes the operation
1272// fail if the object's ETag matches the given value. This is useful for
1273// getting updates only after the object has changed since the last
1274// request. Use googleapi.IsNotModified to check whether the response
1275// error from Do is the result of In-None-Match.
1276func (c *PagespeedapiRunpagespeedCall) IfNoneMatch(entityTag string) *PagespeedapiRunpagespeedCall {
1277	c.ifNoneMatch_ = entityTag
1278	return c
1279}
1280
1281// Context sets the context to be used in this call's Do method. Any
1282// pending HTTP request will be aborted if the provided context is
1283// canceled.
1284func (c *PagespeedapiRunpagespeedCall) Context(ctx context.Context) *PagespeedapiRunpagespeedCall {
1285	c.ctx_ = ctx
1286	return c
1287}
1288
1289// Header returns an http.Header that can be modified by the caller to
1290// add HTTP headers to the request.
1291func (c *PagespeedapiRunpagespeedCall) Header() http.Header {
1292	if c.header_ == nil {
1293		c.header_ = make(http.Header)
1294	}
1295	return c.header_
1296}
1297
1298func (c *PagespeedapiRunpagespeedCall) doRequest(alt string) (*http.Response, error) {
1299	reqHeaders := make(http.Header)
1300	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211201")
1301	for k, v := range c.header_ {
1302		reqHeaders[k] = v
1303	}
1304	reqHeaders.Set("User-Agent", c.s.userAgent())
1305	if c.ifNoneMatch_ != "" {
1306		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1307	}
1308	var body io.Reader = nil
1309	c.urlParams_.Set("alt", alt)
1310	c.urlParams_.Set("prettyPrint", "false")
1311	urls := googleapi.ResolveRelative(c.s.BasePath, "pagespeedonline/v5/runPagespeed")
1312	urls += "?" + c.urlParams_.Encode()
1313	req, err := http.NewRequest("GET", urls, body)
1314	if err != nil {
1315		return nil, err
1316	}
1317	req.Header = reqHeaders
1318	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1319}
1320
1321// Do executes the "pagespeedonline.pagespeedapi.runpagespeed" call.
1322// Exactly one of *PagespeedApiPagespeedResponseV5 or error will be
1323// non-nil. Any non-2xx status code is an error. Response headers are in
1324// either *PagespeedApiPagespeedResponseV5.ServerResponse.Header or (if
1325// a response was returned at all) in error.(*googleapi.Error).Header.
1326// Use googleapi.IsNotModified to check whether the returned error was
1327// because http.StatusNotModified was returned.
1328func (c *PagespeedapiRunpagespeedCall) Do(opts ...googleapi.CallOption) (*PagespeedApiPagespeedResponseV5, error) {
1329	gensupport.SetOptions(c.urlParams_, opts...)
1330	res, err := c.doRequest("json")
1331	if res != nil && res.StatusCode == http.StatusNotModified {
1332		if res.Body != nil {
1333			res.Body.Close()
1334		}
1335		return nil, &googleapi.Error{
1336			Code:   res.StatusCode,
1337			Header: res.Header,
1338		}
1339	}
1340	if err != nil {
1341		return nil, err
1342	}
1343	defer googleapi.CloseBody(res)
1344	if err := googleapi.CheckResponse(res); err != nil {
1345		return nil, err
1346	}
1347	ret := &PagespeedApiPagespeedResponseV5{
1348		ServerResponse: googleapi.ServerResponse{
1349			Header:         res.Header,
1350			HTTPStatusCode: res.StatusCode,
1351		},
1352	}
1353	target := &ret
1354	if err := gensupport.DecodeResponse(target, res); err != nil {
1355		return nil, err
1356	}
1357	return ret, nil
1358	// {
1359	//   "description": "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.",
1360	//   "flatPath": "pagespeedonline/v5/runPagespeed",
1361	//   "httpMethod": "GET",
1362	//   "id": "pagespeedonline.pagespeedapi.runpagespeed",
1363	//   "parameterOrder": [
1364	//     "url"
1365	//   ],
1366	//   "parameters": {
1367	//     "captchaToken": {
1368	//       "description": "The captcha token passed when filling out a captcha.",
1369	//       "location": "query",
1370	//       "type": "string"
1371	//     },
1372	//     "category": {
1373	//       "description": "A Lighthouse category to run; if none are given, only Performance category will be run",
1374	//       "enum": [
1375	//         "CATEGORY_UNSPECIFIED",
1376	//         "ACCESSIBILITY",
1377	//         "BEST_PRACTICES",
1378	//         "PERFORMANCE",
1379	//         "PWA",
1380	//         "SEO"
1381	//       ],
1382	//       "enumDescriptions": [
1383	//         "Default UNDEFINED category.",
1384	//         "Accessibility (a11y), category pertaining to a website's capacity to be accessible to all users.",
1385	//         "Best Practices, category pertaining to a website's conformance to web best practice.",
1386	//         "Performance, category pertaining to a website's performance.",
1387	//         "Progressive Web App (PWA), category pertaining to a website's ability to be run as a PWA.",
1388	//         "Search Engine Optimization (SEO), category pertaining to a website's ability to be indexed by search engines."
1389	//       ],
1390	//       "location": "query",
1391	//       "repeated": true,
1392	//       "type": "string"
1393	//     },
1394	//     "locale": {
1395	//       "description": "The locale used to localize formatted results",
1396	//       "location": "query",
1397	//       "pattern": "[a-zA-Z]+((_|-)[a-zA-Z]+)?",
1398	//       "type": "string"
1399	//     },
1400	//     "strategy": {
1401	//       "description": "The analysis strategy (desktop or mobile) to use, and desktop is the default",
1402	//       "enum": [
1403	//         "STRATEGY_UNSPECIFIED",
1404	//         "DESKTOP",
1405	//         "MOBILE"
1406	//       ],
1407	//       "enumDescriptions": [
1408	//         "UNDEFINED.",
1409	//         "Fetch and analyze the URL for desktop browsers.",
1410	//         "Fetch and analyze the URL for mobile devices."
1411	//       ],
1412	//       "location": "query",
1413	//       "type": "string"
1414	//     },
1415	//     "url": {
1416	//       "description": "Required. The URL to fetch and analyze",
1417	//       "location": "query",
1418	//       "pattern": "(?i)(url:|origin:)?http(s)?://.*",
1419	//       "required": true,
1420	//       "type": "string"
1421	//     },
1422	//     "utm_campaign": {
1423	//       "description": "Campaign name for analytics.",
1424	//       "location": "query",
1425	//       "type": "string"
1426	//     },
1427	//     "utm_source": {
1428	//       "description": "Campaign source for analytics.",
1429	//       "location": "query",
1430	//       "type": "string"
1431	//     }
1432	//   },
1433	//   "path": "pagespeedonline/v5/runPagespeed",
1434	//   "response": {
1435	//     "$ref": "PagespeedApiPagespeedResponseV5"
1436	//   },
1437	//   "scopes": [
1438	//     "openid"
1439	//   ]
1440	// }
1441
1442}
1443