...

Source file src/google.golang.org/api/chromeuxreport/v1/chromeuxreport-gen.go

Documentation: google.golang.org/api/chromeuxreport/v1

     1  // Copyright 2024 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 chromeuxreport provides access to the Chrome UX Report API.
     8  //
     9  // For product documentation, see: https://developers.google.com/web/tools/chrome-user-experience-report/api/reference
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/chromeuxreport/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	chromeuxreportService, err := chromeuxreport.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	chromeuxreportService, err := chromeuxreport.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	chromeuxreportService, err := chromeuxreport.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package chromeuxreport // import "google.golang.org/api/chromeuxreport/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "chromeuxreport:v1"
    90  const apiName = "chromeuxreport"
    91  const apiVersion = "v1"
    92  const basePath = "https://chromeuxreport.googleapis.com/"
    93  const basePathTemplate = "https://chromeuxreport.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://chromeuxreport.mtls.googleapis.com/"
    95  
    96  // NewService creates a new Service.
    97  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    98  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
    99  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   100  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   101  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   102  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	s, err := New(client)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	if endpoint != "" {
   111  		s.BasePath = endpoint
   112  	}
   113  	return s, nil
   114  }
   115  
   116  // New creates a new Service. It uses the provided http.Client for requests.
   117  //
   118  // Deprecated: please use NewService instead.
   119  // To provide a custom HTTP client, use option.WithHTTPClient.
   120  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   121  func New(client *http.Client) (*Service, error) {
   122  	if client == nil {
   123  		return nil, errors.New("client is nil")
   124  	}
   125  	s := &Service{client: client, BasePath: basePath}
   126  	s.Records = NewRecordsService(s)
   127  	return s, nil
   128  }
   129  
   130  type Service struct {
   131  	client    *http.Client
   132  	BasePath  string // API endpoint base URL
   133  	UserAgent string // optional additional User-Agent fragment
   134  
   135  	Records *RecordsService
   136  }
   137  
   138  func (s *Service) userAgent() string {
   139  	if s.UserAgent == "" {
   140  		return googleapi.UserAgent
   141  	}
   142  	return googleapi.UserAgent + " " + s.UserAgent
   143  }
   144  
   145  func NewRecordsService(s *Service) *RecordsService {
   146  	rs := &RecordsService{s: s}
   147  	return rs
   148  }
   149  
   150  type RecordsService struct {
   151  	s *Service
   152  }
   153  
   154  // Bin: A bin is a discrete portion of data spanning from start to end, or if
   155  // no end is given, then from start to +inf. A bin's start and end values are
   156  // given in the value type of the metric it represents. For example, "first
   157  // contentful paint" is measured in milliseconds and exposed as ints, therefore
   158  // its metric bins will use int32s for its start and end types. However,
   159  // "cumulative layout shift" is measured in unitless decimals and is exposed as
   160  // a decimal encoded as a string, therefore its metric bins will use strings
   161  // for its value type.
   162  type Bin struct {
   163  	// Density: The proportion of users that experienced this bin's value for the
   164  	// given metric.
   165  	Density float64 `json:"density,omitempty"`
   166  	// End: End is the end of the data bin. If end is not populated, then the bin
   167  	// has no end and is valid from start to +inf.
   168  	End interface{} `json:"end,omitempty"`
   169  	// Start: Start is the beginning of the data bin.
   170  	Start interface{} `json:"start,omitempty"`
   171  	// ForceSendFields is a list of field names (e.g. "Density") to unconditionally
   172  	// include in API requests. By default, fields with empty or default values are
   173  	// omitted from API requests. See
   174  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   175  	// details.
   176  	ForceSendFields []string `json:"-"`
   177  	// NullFields is a list of field names (e.g. "Density") to include in API
   178  	// requests with the JSON null value. By default, fields with empty values are
   179  	// omitted from API requests. See
   180  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   181  	NullFields []string `json:"-"`
   182  }
   183  
   184  func (s *Bin) MarshalJSON() ([]byte, error) {
   185  	type NoMethod Bin
   186  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   187  }
   188  
   189  func (s *Bin) UnmarshalJSON(data []byte) error {
   190  	type NoMethod Bin
   191  	var s1 struct {
   192  		Density gensupport.JSONFloat64 `json:"density"`
   193  		*NoMethod
   194  	}
   195  	s1.NoMethod = (*NoMethod)(s)
   196  	if err := json.Unmarshal(data, &s1); err != nil {
   197  		return err
   198  	}
   199  	s.Density = float64(s1.Density)
   200  	return nil
   201  }
   202  
   203  // CollectionPeriod: The collection period is a date range which includes the
   204  // `first` and `last` day.
   205  type CollectionPeriod struct {
   206  	// FirstDate: The first day in the collection period, inclusive.
   207  	FirstDate *Date `json:"firstDate,omitempty"`
   208  	// LastDate: The last day in the collection period, inclusive.
   209  	LastDate *Date `json:"lastDate,omitempty"`
   210  	// ForceSendFields is a list of field names (e.g. "FirstDate") to
   211  	// unconditionally include in API requests. By default, fields with empty or
   212  	// default values are omitted from API requests. See
   213  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   214  	// details.
   215  	ForceSendFields []string `json:"-"`
   216  	// NullFields is a list of field names (e.g. "FirstDate") to include in API
   217  	// requests with the JSON null value. By default, fields with empty values are
   218  	// omitted from API requests. See
   219  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   220  	NullFields []string `json:"-"`
   221  }
   222  
   223  func (s *CollectionPeriod) MarshalJSON() ([]byte, error) {
   224  	type NoMethod CollectionPeriod
   225  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   226  }
   227  
   228  // Date: Represents a whole or partial calendar date, such as a birthday. The
   229  // time of day and time zone are either specified elsewhere or are
   230  // insignificant. The date is relative to the Gregorian Calendar. This can
   231  // represent one of the following: * A full date, with non-zero year, month,
   232  // and day values. * A month and day, with a zero year (for example, an
   233  // anniversary). * A year on its own, with a zero month and a zero day. * A
   234  // year and month, with a zero day (for example, a credit card expiration
   235  // date). Related types: * google.type.TimeOfDay * google.type.DateTime *
   236  // google.protobuf.Timestamp
   237  type Date struct {
   238  	// Day: Day of a month. Must be from 1 to 31 and valid for the year and month,
   239  	// or 0 to specify a year by itself or a year and month where the day isn't
   240  	// significant.
   241  	Day int64 `json:"day,omitempty"`
   242  	// Month: Month of a year. Must be from 1 to 12, or 0 to specify a year without
   243  	// a month and day.
   244  	Month int64 `json:"month,omitempty"`
   245  	// Year: Year of the date. Must be from 1 to 9999, or 0 to specify a date
   246  	// without a year.
   247  	Year int64 `json:"year,omitempty"`
   248  	// ForceSendFields is a list of field names (e.g. "Day") to unconditionally
   249  	// include in API requests. By default, fields with empty or default values are
   250  	// omitted from API requests. See
   251  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   252  	// details.
   253  	ForceSendFields []string `json:"-"`
   254  	// NullFields is a list of field names (e.g. "Day") to include in API requests
   255  	// with the JSON null value. By default, fields with empty values are omitted
   256  	// from API requests. See
   257  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   258  	NullFields []string `json:"-"`
   259  }
   260  
   261  func (s *Date) MarshalJSON() ([]byte, error) {
   262  	type NoMethod Date
   263  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   264  }
   265  
   266  // FractionTimeseries: For enum metrics, provides fraction timeseries which add
   267  // up to approximately 1.0 per entry (k-th element into the repeated fractions
   268  // field for any k <= len) across fraction_timeseries.
   269  type FractionTimeseries struct {
   270  	// Fractions: Values between 0.0 and 1.0 (inclusive) and NaN.
   271  	Fractions []float64 `json:"fractions,omitempty"`
   272  	// ForceSendFields is a list of field names (e.g. "Fractions") to
   273  	// unconditionally include in API requests. By default, fields with empty or
   274  	// default values are omitted from API requests. See
   275  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   276  	// details.
   277  	ForceSendFields []string `json:"-"`
   278  	// NullFields is a list of field names (e.g. "Fractions") to include in API
   279  	// requests with the JSON null value. By default, fields with empty values are
   280  	// omitted from API requests. See
   281  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   282  	NullFields []string `json:"-"`
   283  }
   284  
   285  func (s *FractionTimeseries) MarshalJSON() ([]byte, error) {
   286  	type NoMethod FractionTimeseries
   287  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   288  }
   289  
   290  func (s *FractionTimeseries) UnmarshalJSON(data []byte) error {
   291  	type NoMethod FractionTimeseries
   292  	var s1 struct {
   293  		Fractions []gensupport.JSONFloat64 `json:"fractions"`
   294  		*NoMethod
   295  	}
   296  	s1.NoMethod = (*NoMethod)(s)
   297  	if err := json.Unmarshal(data, &s1); err != nil {
   298  		return err
   299  	}
   300  	s.Fractions = make([]float64, len(s1.Fractions))
   301  	for i := range s1.Fractions {
   302  		s.Fractions[i] = float64(s1.Fractions[i])
   303  	}
   304  	return nil
   305  }
   306  
   307  // HistoryKey: Key defines all the dimensions that identify this record as
   308  // unique.
   309  type HistoryKey struct {
   310  	// FormFactor: The form factor is the device class that all users used to
   311  	// access the site for this record. If the form factor is unspecified, then
   312  	// aggregated data over all form factors will be returned.
   313  	//
   314  	// Possible values:
   315  	//   "ALL_FORM_FACTORS" - The default value, representing all device classes.
   316  	//   "PHONE" - The device class representing a "mobile"/"phone" sized client.
   317  	//   "DESKTOP" - The device class representing a "desktop"/"laptop" type full
   318  	// size client.
   319  	//   "TABLET" - The device class representing a "tablet" type client.
   320  	FormFactor string `json:"formFactor,omitempty"`
   321  	// Origin: Origin specifies the origin that this record is for. Note: When
   322  	// specifying an origin, data for loads under this origin over all pages are
   323  	// aggregated into origin level user experience data.
   324  	Origin string `json:"origin,omitempty"`
   325  	// Url: Url specifies a specific url that this record is for. This url should
   326  	// be normalized, following the normalization actions taken in the request to
   327  	// increase the chances of successful lookup. Note: When specifying a "url"
   328  	// only data for that specific url will be aggregated.
   329  	Url string `json:"url,omitempty"`
   330  	// ForceSendFields is a list of field names (e.g. "FormFactor") to
   331  	// unconditionally include in API requests. By default, fields with empty or
   332  	// default values are omitted from API requests. See
   333  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   334  	// details.
   335  	ForceSendFields []string `json:"-"`
   336  	// NullFields is a list of field names (e.g. "FormFactor") to include in API
   337  	// requests with the JSON null value. By default, fields with empty values are
   338  	// omitted from API requests. See
   339  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   340  	NullFields []string `json:"-"`
   341  }
   342  
   343  func (s *HistoryKey) MarshalJSON() ([]byte, error) {
   344  	type NoMethod HistoryKey
   345  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   346  }
   347  
   348  // HistoryRecord: HistoryRecord is a timeseries of Chrome UX Report data. It
   349  // contains user experience statistics for a single url pattern and a set of
   350  // dimensions.
   351  type HistoryRecord struct {
   352  	// CollectionPeriods: The collection periods indicate when each of the data
   353  	// points reflected in the time series data in metrics was collected. Note that
   354  	// all the time series share the same collection periods, and it is enforced in
   355  	// the CrUX pipeline that every time series has the same number of data points.
   356  	CollectionPeriods []*CollectionPeriod `json:"collectionPeriods,omitempty"`
   357  	// Key: Key defines all of the unique querying parameters needed to look up a
   358  	// user experience history record.
   359  	Key *HistoryKey `json:"key,omitempty"`
   360  	// Metrics: Metrics is the map of user experience time series data available
   361  	// for the record defined in the key field. Metrics are keyed on the metric
   362  	// name. Allowed key values: ["first_contentful_paint", "first_input_delay",
   363  	// "largest_contentful_paint", "cumulative_layout_shift",
   364  	// "experimental_time_to_first_byte", "experimental_interaction_to_next_paint"]
   365  	Metrics map[string]MetricTimeseries `json:"metrics,omitempty"`
   366  	// ForceSendFields is a list of field names (e.g. "CollectionPeriods") to
   367  	// unconditionally include in API requests. By default, fields with empty or
   368  	// default values are omitted from API requests. See
   369  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   370  	// details.
   371  	ForceSendFields []string `json:"-"`
   372  	// NullFields is a list of field names (e.g. "CollectionPeriods") to include in
   373  	// API requests with the JSON null value. By default, fields with empty values
   374  	// are omitted from API requests. See
   375  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   376  	NullFields []string `json:"-"`
   377  }
   378  
   379  func (s *HistoryRecord) MarshalJSON() ([]byte, error) {
   380  	type NoMethod HistoryRecord
   381  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   382  }
   383  
   384  // Key: Key defines all the dimensions that identify this record as unique.
   385  type Key struct {
   386  	// EffectiveConnectionType: The effective connection type is the general
   387  	// connection class that all users experienced for this record. This field uses
   388  	// the values ["offline", "slow-2G", "2G", "3G", "4G"] as specified in:
   389  	// https://wicg.github.io/netinfo/#effective-connection-types If the effective
   390  	// connection type is unspecified, then aggregated data over all effective
   391  	// connection types will be returned.
   392  	EffectiveConnectionType string `json:"effectiveConnectionType,omitempty"`
   393  	// FormFactor: The form factor is the device class that all users used to
   394  	// access the site for this record. If the form factor is unspecified, then
   395  	// aggregated data over all form factors will be returned.
   396  	//
   397  	// Possible values:
   398  	//   "ALL_FORM_FACTORS" - The default value, representing all device classes.
   399  	//   "PHONE" - The device class representing a "mobile"/"phone" sized client.
   400  	//   "DESKTOP" - The device class representing a "desktop"/"laptop" type full
   401  	// size client.
   402  	//   "TABLET" - The device class representing a "tablet" type client.
   403  	FormFactor string `json:"formFactor,omitempty"`
   404  	// Origin: Origin specifies the origin that this record is for. Note: When
   405  	// specifying an origin, data for loads under this origin over all pages are
   406  	// aggregated into origin level user experience data.
   407  	Origin string `json:"origin,omitempty"`
   408  	// Url: Url specifies a specific url that this record is for. Note: When
   409  	// specifying a "url" only data for that specific url will be aggregated.
   410  	Url string `json:"url,omitempty"`
   411  	// ForceSendFields is a list of field names (e.g. "EffectiveConnectionType") to
   412  	// unconditionally include in API requests. By default, fields with empty or
   413  	// default values are omitted from API requests. See
   414  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   415  	// details.
   416  	ForceSendFields []string `json:"-"`
   417  	// NullFields is a list of field names (e.g. "EffectiveConnectionType") to
   418  	// include in API requests with the JSON null value. By default, fields with
   419  	// empty values are omitted from API requests. See
   420  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   421  	NullFields []string `json:"-"`
   422  }
   423  
   424  func (s *Key) MarshalJSON() ([]byte, error) {
   425  	type NoMethod Key
   426  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   427  }
   428  
   429  // Metric: A `metric` is a set of user experience data for a single web
   430  // performance metric, like "first contentful paint". It contains a summary
   431  // histogram of real world Chrome usage as a series of `bins`.
   432  type Metric struct {
   433  	// Fractions: For enum metrics, provides fractions which add up to
   434  	// approximately 1.0.
   435  	Fractions map[string]float64 `json:"fractions,omitempty"`
   436  	// Histogram: The histogram of user experiences for a metric. The histogram
   437  	// will have at least one bin and the densities of all bins will add up to ~1.
   438  	Histogram []*Bin `json:"histogram,omitempty"`
   439  	// Percentiles: Commonly useful percentiles of the Metric. The value type for
   440  	// the percentiles will be the same as the value types given for the Histogram
   441  	// bins.
   442  	Percentiles *Percentiles `json:"percentiles,omitempty"`
   443  	// ForceSendFields is a list of field names (e.g. "Fractions") to
   444  	// unconditionally include in API requests. By default, fields with empty or
   445  	// default values are omitted from API requests. See
   446  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   447  	// details.
   448  	ForceSendFields []string `json:"-"`
   449  	// NullFields is a list of field names (e.g. "Fractions") to include in API
   450  	// requests with the JSON null value. By default, fields with empty values are
   451  	// omitted from API requests. See
   452  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   453  	NullFields []string `json:"-"`
   454  }
   455  
   456  func (s *Metric) MarshalJSON() ([]byte, error) {
   457  	type NoMethod Metric
   458  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   459  }
   460  
   461  // MetricTimeseries: A `metric timeseries` is a set of user experience data for
   462  // a single web performance metric, like "first contentful paint". It contains
   463  // a summary histogram of real world Chrome usage as a series of `bins`, where
   464  // each bin has density values for a particular time period.
   465  type MetricTimeseries struct {
   466  	// FractionTimeseries: Mapping from labels to timeseries of fractions
   467  	// attributed to this label.
   468  	FractionTimeseries map[string]FractionTimeseries `json:"fractionTimeseries,omitempty"`
   469  	// HistogramTimeseries: The histogram of user experiences for a metric. The
   470  	// histogram will have at least one bin and the densities of all bins will add
   471  	// up to ~1, for each timeseries entry.
   472  	HistogramTimeseries []*TimeseriesBin `json:"histogramTimeseries,omitempty"`
   473  	// PercentilesTimeseries: Commonly useful percentiles of the Metric. The value
   474  	// type for the percentiles will be the same as the value types given for the
   475  	// Histogram bins.
   476  	PercentilesTimeseries *TimeseriesPercentiles `json:"percentilesTimeseries,omitempty"`
   477  	// ForceSendFields is a list of field names (e.g. "FractionTimeseries") to
   478  	// unconditionally include in API requests. By default, fields with empty or
   479  	// default values are omitted from API requests. See
   480  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   481  	// details.
   482  	ForceSendFields []string `json:"-"`
   483  	// NullFields is a list of field names (e.g. "FractionTimeseries") to include
   484  	// in API requests with the JSON null value. By default, fields with empty
   485  	// values are omitted from API requests. See
   486  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   487  	NullFields []string `json:"-"`
   488  }
   489  
   490  func (s *MetricTimeseries) MarshalJSON() ([]byte, error) {
   491  	type NoMethod MetricTimeseries
   492  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   493  }
   494  
   495  // Percentiles: Percentiles contains synthetic values of a metric at a given
   496  // statistical percentile. These are used for estimating a metric's value as
   497  // experienced by a percentage of users out of the total number of users.
   498  type Percentiles struct {
   499  	// P75: 75% of users experienced the given metric at or below this value.
   500  	P75 interface{} `json:"p75,omitempty"`
   501  	// ForceSendFields is a list of field names (e.g. "P75") to unconditionally
   502  	// include in API requests. By default, fields with empty or default values are
   503  	// omitted from API requests. See
   504  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   505  	// details.
   506  	ForceSendFields []string `json:"-"`
   507  	// NullFields is a list of field names (e.g. "P75") to include in API requests
   508  	// with the JSON null value. By default, fields with empty values are omitted
   509  	// from API requests. See
   510  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   511  	NullFields []string `json:"-"`
   512  }
   513  
   514  func (s *Percentiles) MarshalJSON() ([]byte, error) {
   515  	type NoMethod Percentiles
   516  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   517  }
   518  
   519  // QueryHistoryRequest: Request payload sent by a physical web client. This
   520  // request includes all necessary context to load a particular user experience
   521  // history record.
   522  type QueryHistoryRequest struct {
   523  	// FormFactor: The form factor is a query dimension that specifies the device
   524  	// class that the record's data should belong to. Note: If no form factor is
   525  	// specified, then a special record with aggregated data over all form factors
   526  	// will be returned.
   527  	//
   528  	// Possible values:
   529  	//   "ALL_FORM_FACTORS" - The default value, representing all device classes.
   530  	//   "PHONE" - The device class representing a "mobile"/"phone" sized client.
   531  	//   "DESKTOP" - The device class representing a "desktop"/"laptop" type full
   532  	// size client.
   533  	//   "TABLET" - The device class representing a "tablet" type client.
   534  	FormFactor string `json:"formFactor,omitempty"`
   535  	// Metrics: The metrics that should be included in the response. If none are
   536  	// specified then any metrics found will be returned. Allowed values:
   537  	// ["first_contentful_paint", "first_input_delay", "largest_contentful_paint",
   538  	// "cumulative_layout_shift", "experimental_time_to_first_byte",
   539  	// "experimental_interaction_to_next_paint"]
   540  	Metrics []string `json:"metrics,omitempty"`
   541  	// Origin: The url pattern "origin" refers to a url pattern that is the origin
   542  	// of a website. Examples: "https://example.com", "https://cloud.google.com"
   543  	Origin string `json:"origin,omitempty"`
   544  	// Url: The url pattern "url" refers to a url pattern that is any arbitrary
   545  	// url. Examples: "https://example.com/",
   546  	// "https://cloud.google.com/why-google-cloud/"
   547  	Url string `json:"url,omitempty"`
   548  	// ForceSendFields is a list of field names (e.g. "FormFactor") to
   549  	// unconditionally include in API requests. By default, fields with empty or
   550  	// default values are omitted from API requests. See
   551  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   552  	// details.
   553  	ForceSendFields []string `json:"-"`
   554  	// NullFields is a list of field names (e.g. "FormFactor") to include in API
   555  	// requests with the JSON null value. By default, fields with empty values are
   556  	// omitted from API requests. See
   557  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   558  	NullFields []string `json:"-"`
   559  }
   560  
   561  func (s *QueryHistoryRequest) MarshalJSON() ([]byte, error) {
   562  	type NoMethod QueryHistoryRequest
   563  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   564  }
   565  
   566  // QueryHistoryResponse: Response payload sent back to a physical web client.
   567  // This response contains the record found based on the identiers present in a
   568  // `QueryHistoryRequest`. The returned response will have a history record, and
   569  // sometimes details on normalization actions taken on the request that were
   570  // necessary to make the request successful.
   571  type QueryHistoryResponse struct {
   572  	// Record: The record that was found.
   573  	Record *HistoryRecord `json:"record,omitempty"`
   574  	// UrlNormalizationDetails: These are details about automated normalization
   575  	// actions that were taken in order to make the requested `url_pattern` valid.
   576  	UrlNormalizationDetails *UrlNormalization `json:"urlNormalizationDetails,omitempty"`
   577  
   578  	// ServerResponse contains the HTTP response code and headers from the server.
   579  	googleapi.ServerResponse `json:"-"`
   580  	// ForceSendFields is a list of field names (e.g. "Record") to unconditionally
   581  	// include in API requests. By default, fields with empty or default values are
   582  	// omitted from API requests. See
   583  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   584  	// details.
   585  	ForceSendFields []string `json:"-"`
   586  	// NullFields is a list of field names (e.g. "Record") to include in API
   587  	// requests with the JSON null value. By default, fields with empty values are
   588  	// omitted from API requests. See
   589  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   590  	NullFields []string `json:"-"`
   591  }
   592  
   593  func (s *QueryHistoryResponse) MarshalJSON() ([]byte, error) {
   594  	type NoMethod QueryHistoryResponse
   595  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   596  }
   597  
   598  // QueryRequest: Request payload sent by a physical web client. This request
   599  // includes all necessary context to load a particular user experience record.
   600  type QueryRequest struct {
   601  	// EffectiveConnectionType: The effective connection type is a query dimension
   602  	// that specifies the effective network class that the record's data should
   603  	// belong to. This field uses the values ["offline", "slow-2G", "2G", "3G",
   604  	// "4G"] as specified in:
   605  	// https://wicg.github.io/netinfo/#effective-connection-types Note: If no
   606  	// effective connection type is specified, then a special record with
   607  	// aggregated data over all effective connection types will be returned.
   608  	EffectiveConnectionType string `json:"effectiveConnectionType,omitempty"`
   609  	// FormFactor: The form factor is a query dimension that specifies the device
   610  	// class that the record's data should belong to. Note: If no form factor is
   611  	// specified, then a special record with aggregated data over all form factors
   612  	// will be returned.
   613  	//
   614  	// Possible values:
   615  	//   "ALL_FORM_FACTORS" - The default value, representing all device classes.
   616  	//   "PHONE" - The device class representing a "mobile"/"phone" sized client.
   617  	//   "DESKTOP" - The device class representing a "desktop"/"laptop" type full
   618  	// size client.
   619  	//   "TABLET" - The device class representing a "tablet" type client.
   620  	FormFactor string `json:"formFactor,omitempty"`
   621  	// Metrics: The metrics that should be included in the response. If none are
   622  	// specified then any metrics found will be returned. Allowed values:
   623  	// ["first_contentful_paint", "first_input_delay", "largest_contentful_paint",
   624  	// "cumulative_layout_shift", "experimental_time_to_first_byte",
   625  	// "experimental_interaction_to_next_paint"]
   626  	Metrics []string `json:"metrics,omitempty"`
   627  	// Origin: The url pattern "origin" refers to a url pattern that is the origin
   628  	// of a website. Examples: "https://example.com", "https://cloud.google.com"
   629  	Origin string `json:"origin,omitempty"`
   630  	// Url: The url pattern "url" refers to a url pattern that is any arbitrary
   631  	// url. Examples: "https://example.com/",
   632  	// "https://cloud.google.com/why-google-cloud/"
   633  	Url string `json:"url,omitempty"`
   634  	// ForceSendFields is a list of field names (e.g. "EffectiveConnectionType") to
   635  	// unconditionally include in API requests. By default, fields with empty or
   636  	// default values are omitted from API requests. See
   637  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   638  	// details.
   639  	ForceSendFields []string `json:"-"`
   640  	// NullFields is a list of field names (e.g. "EffectiveConnectionType") to
   641  	// include in API requests with the JSON null value. By default, fields with
   642  	// empty values are omitted from API requests. See
   643  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   644  	NullFields []string `json:"-"`
   645  }
   646  
   647  func (s *QueryRequest) MarshalJSON() ([]byte, error) {
   648  	type NoMethod QueryRequest
   649  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   650  }
   651  
   652  // QueryResponse: Response payload sent back to a physical web client. This
   653  // response contains the record found based on the identiers present in a
   654  // `QueryRequest`. The returned response will have a record, and sometimes
   655  // details on normalization actions taken on the request that were necessary to
   656  // make the request successful.
   657  type QueryResponse struct {
   658  	// Record: The record that was found.
   659  	Record *Record `json:"record,omitempty"`
   660  	// UrlNormalizationDetails: These are details about automated normalization
   661  	// actions that were taken in order to make the requested `url_pattern` valid.
   662  	UrlNormalizationDetails *UrlNormalization `json:"urlNormalizationDetails,omitempty"`
   663  
   664  	// ServerResponse contains the HTTP response code and headers from the server.
   665  	googleapi.ServerResponse `json:"-"`
   666  	// ForceSendFields is a list of field names (e.g. "Record") to unconditionally
   667  	// include in API requests. By default, fields with empty or default values are
   668  	// omitted from API requests. See
   669  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   670  	// details.
   671  	ForceSendFields []string `json:"-"`
   672  	// NullFields is a list of field names (e.g. "Record") to include in API
   673  	// requests with the JSON null value. By default, fields with empty values are
   674  	// omitted from API requests. See
   675  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   676  	NullFields []string `json:"-"`
   677  }
   678  
   679  func (s *QueryResponse) MarshalJSON() ([]byte, error) {
   680  	type NoMethod QueryResponse
   681  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   682  }
   683  
   684  // Record: Record is a single Chrome UX report data record. It contains use
   685  // experience statistics for a single url pattern and set of dimensions.
   686  type Record struct {
   687  	// CollectionPeriod: The collection period indicates when the data reflected in
   688  	// this record was collected.
   689  	CollectionPeriod *CollectionPeriod `json:"collectionPeriod,omitempty"`
   690  	// Key: Key defines all of the unique querying parameters needed to look up a
   691  	// user experience record.
   692  	Key *Key `json:"key,omitempty"`
   693  	// Metrics: Metrics is the map of user experience data available for the record
   694  	// defined in the key field. Metrics are keyed on the metric name. Allowed key
   695  	// values: ["first_contentful_paint", "first_input_delay",
   696  	// "largest_contentful_paint", "cumulative_layout_shift",
   697  	// "experimental_time_to_first_byte", "experimental_interaction_to_next_paint"]
   698  	Metrics map[string]Metric `json:"metrics,omitempty"`
   699  	// ForceSendFields is a list of field names (e.g. "CollectionPeriod") to
   700  	// unconditionally include in API requests. By default, fields with empty or
   701  	// default values are omitted from API requests. See
   702  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   703  	// details.
   704  	ForceSendFields []string `json:"-"`
   705  	// NullFields is a list of field names (e.g. "CollectionPeriod") to include in
   706  	// API requests with the JSON null value. By default, fields with empty values
   707  	// are omitted from API requests. See
   708  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   709  	NullFields []string `json:"-"`
   710  }
   711  
   712  func (s *Record) MarshalJSON() ([]byte, error) {
   713  	type NoMethod Record
   714  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   715  }
   716  
   717  // TimeseriesBin: A bin is a discrete portion of data spanning from start to
   718  // end, or if no end is given, then from start to +inf. A bin's start and end
   719  // values are given in the value type of the metric it represents. For example,
   720  // "first contentful paint" is measured in milliseconds and exposed as ints,
   721  // therefore its metric bins will use int32s for its start and end types.
   722  // However, "cumulative layout shift" is measured in unitless decimals and is
   723  // exposed as a decimal encoded as a string, therefore its metric bins will use
   724  // strings for its value type.
   725  type TimeseriesBin struct {
   726  	// Densities: The proportion of users that experienced this bin's value for the
   727  	// given metric in a given collection period; the index for each of these
   728  	// entries corresponds to an entry in the CollectionPeriods field in the
   729  	// HistoryRecord message, which describes when the density was observed in the
   730  	// field. Thus, the length of this list of densities is equal to the length of
   731  	// the CollectionPeriods field in the HistoryRecord message.
   732  	Densities []float64 `json:"densities,omitempty"`
   733  	// End: End is the end of the data bin. If end is not populated, then the bin
   734  	// has no end and is valid from start to +inf.
   735  	End interface{} `json:"end,omitempty"`
   736  	// Start: Start is the beginning of the data bin.
   737  	Start interface{} `json:"start,omitempty"`
   738  	// ForceSendFields is a list of field names (e.g. "Densities") to
   739  	// unconditionally include in API requests. By default, fields with empty or
   740  	// default values are omitted from API requests. See
   741  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   742  	// details.
   743  	ForceSendFields []string `json:"-"`
   744  	// NullFields is a list of field names (e.g. "Densities") to include in API
   745  	// requests with the JSON null value. By default, fields with empty values are
   746  	// omitted from API requests. See
   747  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   748  	NullFields []string `json:"-"`
   749  }
   750  
   751  func (s *TimeseriesBin) MarshalJSON() ([]byte, error) {
   752  	type NoMethod TimeseriesBin
   753  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   754  }
   755  
   756  func (s *TimeseriesBin) UnmarshalJSON(data []byte) error {
   757  	type NoMethod TimeseriesBin
   758  	var s1 struct {
   759  		Densities []gensupport.JSONFloat64 `json:"densities"`
   760  		*NoMethod
   761  	}
   762  	s1.NoMethod = (*NoMethod)(s)
   763  	if err := json.Unmarshal(data, &s1); err != nil {
   764  		return err
   765  	}
   766  	s.Densities = make([]float64, len(s1.Densities))
   767  	for i := range s1.Densities {
   768  		s.Densities[i] = float64(s1.Densities[i])
   769  	}
   770  	return nil
   771  }
   772  
   773  // TimeseriesPercentiles: Percentiles contains synthetic values of a metric at
   774  // a given statistical percentile. These are used for estimating a metric's
   775  // value as experienced by a percentage of users out of the total number of
   776  // users.
   777  type TimeseriesPercentiles struct {
   778  	// P75s: 75% of users experienced the given metric at or below this value. The
   779  	// length of this list of densities is equal to the length of the
   780  	// CollectionPeriods field in the HistoryRecord message, which describes when
   781  	// the density was observed in the field.
   782  	P75s []interface{} `json:"p75s,omitempty"`
   783  	// ForceSendFields is a list of field names (e.g. "P75s") to unconditionally
   784  	// include in API requests. By default, fields with empty or default values are
   785  	// omitted from API requests. See
   786  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   787  	// details.
   788  	ForceSendFields []string `json:"-"`
   789  	// NullFields is a list of field names (e.g. "P75s") to include in API requests
   790  	// with the JSON null value. By default, fields with empty values are omitted
   791  	// from API requests. See
   792  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   793  	NullFields []string `json:"-"`
   794  }
   795  
   796  func (s *TimeseriesPercentiles) MarshalJSON() ([]byte, error) {
   797  	type NoMethod TimeseriesPercentiles
   798  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   799  }
   800  
   801  // UrlNormalization: Object representing the normalization actions taken to
   802  // normalize a url to achieve a higher chance of successful lookup. These are
   803  // simple automated changes that are taken when looking up the provided
   804  // `url_patten` would be known to fail. Complex actions like following
   805  // redirects are not handled.
   806  type UrlNormalization struct {
   807  	// NormalizedUrl: The URL after any normalization actions. This is a valid user
   808  	// experience URL that could reasonably be looked up.
   809  	NormalizedUrl string `json:"normalizedUrl,omitempty"`
   810  	// OriginalUrl: The original requested URL prior to any normalization actions.
   811  	OriginalUrl string `json:"originalUrl,omitempty"`
   812  	// ForceSendFields is a list of field names (e.g. "NormalizedUrl") to
   813  	// unconditionally include in API requests. By default, fields with empty or
   814  	// default values are omitted from API requests. See
   815  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   816  	// details.
   817  	ForceSendFields []string `json:"-"`
   818  	// NullFields is a list of field names (e.g. "NormalizedUrl") to include in API
   819  	// requests with the JSON null value. By default, fields with empty values are
   820  	// omitted from API requests. See
   821  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   822  	NullFields []string `json:"-"`
   823  }
   824  
   825  func (s *UrlNormalization) MarshalJSON() ([]byte, error) {
   826  	type NoMethod UrlNormalization
   827  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   828  }
   829  
   830  type RecordsQueryHistoryRecordCall struct {
   831  	s                   *Service
   832  	queryhistoryrequest *QueryHistoryRequest
   833  	urlParams_          gensupport.URLParams
   834  	ctx_                context.Context
   835  	header_             http.Header
   836  }
   837  
   838  // QueryHistoryRecord: Queries the Chrome User Experience Report for a
   839  // timeseries `history record` for a given site. Returns a `history record`
   840  // that contains one or more `metric timeseries` corresponding to performance
   841  // data about the requested site.
   842  func (r *RecordsService) QueryHistoryRecord(queryhistoryrequest *QueryHistoryRequest) *RecordsQueryHistoryRecordCall {
   843  	c := &RecordsQueryHistoryRecordCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   844  	c.queryhistoryrequest = queryhistoryrequest
   845  	return c
   846  }
   847  
   848  // Fields allows partial responses to be retrieved. See
   849  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   850  // details.
   851  func (c *RecordsQueryHistoryRecordCall) Fields(s ...googleapi.Field) *RecordsQueryHistoryRecordCall {
   852  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   853  	return c
   854  }
   855  
   856  // Context sets the context to be used in this call's Do method.
   857  func (c *RecordsQueryHistoryRecordCall) Context(ctx context.Context) *RecordsQueryHistoryRecordCall {
   858  	c.ctx_ = ctx
   859  	return c
   860  }
   861  
   862  // Header returns a http.Header that can be modified by the caller to add
   863  // headers to the request.
   864  func (c *RecordsQueryHistoryRecordCall) Header() http.Header {
   865  	if c.header_ == nil {
   866  		c.header_ = make(http.Header)
   867  	}
   868  	return c.header_
   869  }
   870  
   871  func (c *RecordsQueryHistoryRecordCall) doRequest(alt string) (*http.Response, error) {
   872  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   873  	var body io.Reader = nil
   874  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryhistoryrequest)
   875  	if err != nil {
   876  		return nil, err
   877  	}
   878  	c.urlParams_.Set("alt", alt)
   879  	c.urlParams_.Set("prettyPrint", "false")
   880  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/records:queryHistoryRecord")
   881  	urls += "?" + c.urlParams_.Encode()
   882  	req, err := http.NewRequest("POST", urls, body)
   883  	if err != nil {
   884  		return nil, err
   885  	}
   886  	req.Header = reqHeaders
   887  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   888  }
   889  
   890  // Do executes the "chromeuxreport.records.queryHistoryRecord" call.
   891  // Any non-2xx status code is an error. Response headers are in either
   892  // *QueryHistoryResponse.ServerResponse.Header or (if a response was returned
   893  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   894  // check whether the returned error was because http.StatusNotModified was
   895  // returned.
   896  func (c *RecordsQueryHistoryRecordCall) Do(opts ...googleapi.CallOption) (*QueryHistoryResponse, error) {
   897  	gensupport.SetOptions(c.urlParams_, opts...)
   898  	res, err := c.doRequest("json")
   899  	if res != nil && res.StatusCode == http.StatusNotModified {
   900  		if res.Body != nil {
   901  			res.Body.Close()
   902  		}
   903  		return nil, gensupport.WrapError(&googleapi.Error{
   904  			Code:   res.StatusCode,
   905  			Header: res.Header,
   906  		})
   907  	}
   908  	if err != nil {
   909  		return nil, err
   910  	}
   911  	defer googleapi.CloseBody(res)
   912  	if err := googleapi.CheckResponse(res); err != nil {
   913  		return nil, gensupport.WrapError(err)
   914  	}
   915  	ret := &QueryHistoryResponse{
   916  		ServerResponse: googleapi.ServerResponse{
   917  			Header:         res.Header,
   918  			HTTPStatusCode: res.StatusCode,
   919  		},
   920  	}
   921  	target := &ret
   922  	if err := gensupport.DecodeResponse(target, res); err != nil {
   923  		return nil, err
   924  	}
   925  	return ret, nil
   926  }
   927  
   928  type RecordsQueryRecordCall struct {
   929  	s            *Service
   930  	queryrequest *QueryRequest
   931  	urlParams_   gensupport.URLParams
   932  	ctx_         context.Context
   933  	header_      http.Header
   934  }
   935  
   936  // QueryRecord: Queries the Chrome User Experience for a single `record` for a
   937  // given site. Returns a `record` that contains one or more `metrics`
   938  // corresponding to performance data about the requested site.
   939  func (r *RecordsService) QueryRecord(queryrequest *QueryRequest) *RecordsQueryRecordCall {
   940  	c := &RecordsQueryRecordCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   941  	c.queryrequest = queryrequest
   942  	return c
   943  }
   944  
   945  // Fields allows partial responses to be retrieved. See
   946  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   947  // details.
   948  func (c *RecordsQueryRecordCall) Fields(s ...googleapi.Field) *RecordsQueryRecordCall {
   949  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   950  	return c
   951  }
   952  
   953  // Context sets the context to be used in this call's Do method.
   954  func (c *RecordsQueryRecordCall) Context(ctx context.Context) *RecordsQueryRecordCall {
   955  	c.ctx_ = ctx
   956  	return c
   957  }
   958  
   959  // Header returns a http.Header that can be modified by the caller to add
   960  // headers to the request.
   961  func (c *RecordsQueryRecordCall) Header() http.Header {
   962  	if c.header_ == nil {
   963  		c.header_ = make(http.Header)
   964  	}
   965  	return c.header_
   966  }
   967  
   968  func (c *RecordsQueryRecordCall) doRequest(alt string) (*http.Response, error) {
   969  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   970  	var body io.Reader = nil
   971  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryrequest)
   972  	if err != nil {
   973  		return nil, err
   974  	}
   975  	c.urlParams_.Set("alt", alt)
   976  	c.urlParams_.Set("prettyPrint", "false")
   977  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/records:queryRecord")
   978  	urls += "?" + c.urlParams_.Encode()
   979  	req, err := http.NewRequest("POST", urls, body)
   980  	if err != nil {
   981  		return nil, err
   982  	}
   983  	req.Header = reqHeaders
   984  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   985  }
   986  
   987  // Do executes the "chromeuxreport.records.queryRecord" call.
   988  // Any non-2xx status code is an error. Response headers are in either
   989  // *QueryResponse.ServerResponse.Header or (if a response was returned at all)
   990  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   991  // whether the returned error was because http.StatusNotModified was returned.
   992  func (c *RecordsQueryRecordCall) Do(opts ...googleapi.CallOption) (*QueryResponse, error) {
   993  	gensupport.SetOptions(c.urlParams_, opts...)
   994  	res, err := c.doRequest("json")
   995  	if res != nil && res.StatusCode == http.StatusNotModified {
   996  		if res.Body != nil {
   997  			res.Body.Close()
   998  		}
   999  		return nil, gensupport.WrapError(&googleapi.Error{
  1000  			Code:   res.StatusCode,
  1001  			Header: res.Header,
  1002  		})
  1003  	}
  1004  	if err != nil {
  1005  		return nil, err
  1006  	}
  1007  	defer googleapi.CloseBody(res)
  1008  	if err := googleapi.CheckResponse(res); err != nil {
  1009  		return nil, gensupport.WrapError(err)
  1010  	}
  1011  	ret := &QueryResponse{
  1012  		ServerResponse: googleapi.ServerResponse{
  1013  			Header:         res.Header,
  1014  			HTTPStatusCode: res.StatusCode,
  1015  		},
  1016  	}
  1017  	target := &ret
  1018  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1019  		return nil, err
  1020  	}
  1021  	return ret, nil
  1022  }
  1023  

View as plain text