// Copyright 2026 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Code generated file. DO NOT EDIT.

// Package versionhistory provides access to the versionhistory.googleapis.com API.
//
// For product documentation, see: https://developer.chrome.com/docs/web-platform/versionhistory/guide
//
// # Library status
//
// These client libraries are officially supported by Google. However, this
// library is considered complete and is in maintenance mode. This means
// that we will address critical bugs and security issues but will not add
// any new features.
//
// When possible, we recommend using our newer
// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
// that are still actively being worked and iterated on.
//
// # Creating a client
//
// Usage example:
//
//	import "google.golang.org/api/versionhistory/v1"
//	...
//	ctx := context.Background()
//	versionhistoryService, err := versionhistory.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for
// authentication. For information on how to create and obtain Application
// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// # Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API
// keys), use [google.golang.org/api/option.WithAPIKey]:
//
//	versionhistoryService, err := versionhistory.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
// flow, use [google.golang.org/api/option.WithTokenSource]:
//
//	config := &oauth2.Config{...}
//	// ...
//	token, err := config.Exchange(ctx, ...)
//	versionhistoryService, err := versionhistory.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See [google.golang.org/api/option.ClientOption] for details on options.
package versionhistory // import "google.golang.org/api/versionhistory/v1"

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"log/slog"
	"net/http"
	"net/url"
	"strconv"
	"strings"

	"github.com/googleapis/gax-go/v2/internallog"
	googleapi "google.golang.org/api/googleapi"
	internal "google.golang.org/api/internal"
	gensupport "google.golang.org/api/internal/gensupport"
	option "google.golang.org/api/option"
	internaloption "google.golang.org/api/option/internaloption"
	htransport "google.golang.org/api/transport/http"
)

// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
var _ = internal.Version
var _ = internallog.New

const apiId = "versionhistory:v1"
const apiName = "versionhistory"
const apiVersion = "v1"
const basePath = "https://versionhistory.googleapis.com/"
const basePathTemplate = "https://versionhistory.UNIVERSE_DOMAIN/"
const mtlsBasePath = "https://versionhistory.mtls.googleapis.com/"

// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
	opts = append(opts, internaloption.EnableNewAuthLibrary())
	client, endpoint, err := htransport.NewClient(ctx, opts...)
	if err != nil {
		return nil, err
	}
	s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
	s.Platforms = NewPlatformsService(s)
	if endpoint != "" {
		s.BasePath = endpoint
	}
	return s, nil
}

// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
	if client == nil {
		return nil, errors.New("client is nil")
	}
	return NewService(context.TODO(), option.WithHTTPClient(client))
}

type Service struct {
	client    *http.Client
	logger    *slog.Logger
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Platforms *PlatformsService
}

func (s *Service) userAgent() string {
	if s.UserAgent == "" {
		return googleapi.UserAgent
	}
	return googleapi.UserAgent + " " + s.UserAgent
}

func NewPlatformsService(s *Service) *PlatformsService {
	rs := &PlatformsService{s: s}
	rs.Channels = NewPlatformsChannelsService(s)
	return rs
}

type PlatformsService struct {
	s *Service

	Channels *PlatformsChannelsService
}

func NewPlatformsChannelsService(s *Service) *PlatformsChannelsService {
	rs := &PlatformsChannelsService{s: s}
	rs.Versions = NewPlatformsChannelsVersionsService(s)
	return rs
}

type PlatformsChannelsService struct {
	s *Service

	Versions *PlatformsChannelsVersionsService
}

func NewPlatformsChannelsVersionsService(s *Service) *PlatformsChannelsVersionsService {
	rs := &PlatformsChannelsVersionsService{s: s}
	rs.Releases = NewPlatformsChannelsVersionsReleasesService(s)
	return rs
}

type PlatformsChannelsVersionsService struct {
	s *Service

	Releases *PlatformsChannelsVersionsReleasesService
}

func NewPlatformsChannelsVersionsReleasesService(s *Service) *PlatformsChannelsVersionsReleasesService {
	rs := &PlatformsChannelsVersionsReleasesService{s: s}
	return rs
}

type PlatformsChannelsVersionsReleasesService struct {
	s *Service
}

// Channel: Each Channel is owned by a Platform and owns a collection of
// versions. Possible Channels are listed in the Channel enum below. Not all
// Channels are available for every Platform (e.g. CANARY does not exist for
// LINUX).
type Channel struct {
	// ChannelType: Type of channel.
	//
	// Possible values:
	//   "CHANNEL_TYPE_UNSPECIFIED"
	//   "STABLE" - The Stable channel.
	//   "BETA" - The Beta channel.
	//   "DEV" - The Dev channel.
	//   "CANARY" - The Canary channel.
	//   "CANARY_ASAN" - The Canary channel for Chrome, with DCHECK/ASAN enabled.
	//   "ALL"
	//   "EXTENDED" - The Extended Stable channel for Chrome.
	//   "LTS" - The Long-term support channel for ChromeOS.
	//   "LTC" - The Long-term support candidate channel for ChromeOS.
	ChannelType string `json:"channelType,omitempty"`
	// Name: Channel name. Format is
	// "{product}/platforms/{platform}/channels/{channel}"
	Name string `json:"name,omitempty"`
	// ForceSendFields is a list of field names (e.g. "ChannelType") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "ChannelType") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s Channel) MarshalJSON() ([]byte, error) {
	type NoMethod Channel
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// Interval: Represents a time interval, encoded as a Timestamp start
// (inclusive) and a Timestamp end (exclusive). The start must be less than or
// equal to the end. When the start equals the end, the interval is empty
// (matches no time). When both start and end are unspecified, the interval
// matches any time.
type Interval struct {
	// EndTime: Optional. Exclusive end of the interval. If specified, a Timestamp
	// matching this interval will have to be before the end.
	EndTime string `json:"endTime,omitempty"`
	// StartTime: Optional. Inclusive start of the interval. If specified, a
	// Timestamp matching this interval will have to be the same or after the
	// start.
	StartTime string `json:"startTime,omitempty"`
	// ForceSendFields is a list of field names (e.g. "EndTime") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "EndTime") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s Interval) MarshalJSON() ([]byte, error) {
	type NoMethod Interval
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// ListChannelsResponse: Response message for ListChannels.
type ListChannelsResponse struct {
	// Channels: The list of channels.
	Channels []*Channel `json:"channels,omitempty"`
	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
	// next page. If this field is omitted, there are no subsequent pages.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "Channels") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Channels") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s ListChannelsResponse) MarshalJSON() ([]byte, error) {
	type NoMethod ListChannelsResponse
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// ListPlatformsResponse: Response message for ListPlatforms.
type ListPlatformsResponse struct {
	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
	// next page. If this field is omitted, there are no subsequent pages.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// Platforms: The list of platforms.
	Platforms []*Platform `json:"platforms,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s ListPlatformsResponse) MarshalJSON() ([]byte, error) {
	type NoMethod ListPlatformsResponse
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// ListReleasesResponse: Response message for ListReleases.
type ListReleasesResponse struct {
	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
	// next page. If this field is omitted, there are no subsequent pages.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// Releases: The list of releases.
	Releases []*Release `json:"releases,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s ListReleasesResponse) MarshalJSON() ([]byte, error) {
	type NoMethod ListReleasesResponse
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// ListVersionsResponse: Response message for ListVersions.
type ListVersionsResponse struct {
	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
	// next page. If this field is omitted, there are no subsequent pages.
	NextPageToken string `json:"nextPageToken,omitempty"`
	// Versions: The list of versions.
	Versions []*Version `json:"versions,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s ListVersionsResponse) MarshalJSON() ([]byte, error) {
	type NoMethod ListVersionsResponse
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// Platform: Each Platform is owned by a Product and owns a collection of
// channels. Available platforms are listed in Platform enum below. Not all
// Channels are available for every Platform (e.g. CANARY does not exist for
// LINUX).
type Platform struct {
	// Name: Platform name. Format is "{product}/platforms/{platform}"
	Name string `json:"name,omitempty"`
	// PlatformType: Type of platform.
	//
	// Possible values:
	//   "PLATFORM_TYPE_UNSPECIFIED"
	//   "WIN" - Chrome Desktop for Windows (32-bit).
	//   "WIN64" - Chrome Desktop for Windows (x86_64).
	//   "MAC" - Chrome Desktop for macOS (x86_64).
	//   "LINUX" - Chrome Desktop for Linux.
	//   "ANDROID" - Chrome for Android.
	//   "WEBVIEW" - WebView for Android.
	//   "IOS" - Chrome for iOS.
	//   "ALL"
	//   "MAC_ARM64" - Chrome for macOS (ARM64).
	//   "LACROS" - ChromeOS Lacros (x86_64).
	//   "LACROS_ARM32" - ChromeOS Lacros (ARM).
	//   "CHROMEOS" - ChromeOS.
	//   "LACROS_ARM64" - ChromeOS Lacros (ARM64).
	//   "FUCHSIA" - Chrome for Fuchsia.
	//   "WIN_ARM64" - Chrome Desktop for Windows (ARM64).
	PlatformType string `json:"platformType,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Name") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s Platform) MarshalJSON() ([]byte, error) {
	type NoMethod Platform
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// Release: A Release is owned by a Version. A Release contains information
// about the release(s) of its parent version. This includes when the release
// began and ended, as well as what percentage it was released at. If the
// version is released again, or if the serving percentage changes, it will
// create another release under the version.
type Release struct {
	// Fraction: Rollout fraction. This fraction indicates the fraction of people
	// that should receive this version in this release. If the fraction is not
	// specified in ReleaseManager, the API will assume fraction is 1.
	Fraction float64 `json:"fraction,omitempty"`
	// FractionGroup: Rollout fraction group. Only fractions with the same
	// fraction_group are statistically comparable: there may be non-fractional
	// differences between different fraction groups.
	FractionGroup int64 `json:"fractionGroup,omitempty,string"`
	// Name: Release name. Format is
	// "{product}/platforms/{platform}/channels/{channel}/versions/{version}/release
	// s/{release}"
	Name string `json:"name,omitempty"`
	// Pinnable: Whether or not the release was available for version pinning.
	Pinnable bool `json:"pinnable,omitempty"`
	// RolloutData: Rollout-related metadata. Some releases are part of one or more
	// A/B rollouts. This field contains the names and data describing this
	// release's role in any rollouts.
	RolloutData []*RolloutData `json:"rolloutData,omitempty"`
	// Serving: Timestamp interval of when the release was live. If end_time is
	// unspecified, the release is currently live.
	Serving *Interval `json:"serving,omitempty"`
	// Version: String containing just the version number. e.g. "84.0.4147.38"
	Version string `json:"version,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Fraction") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Fraction") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s Release) MarshalJSON() ([]byte, error) {
	type NoMethod Release
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

func (s *Release) UnmarshalJSON(data []byte) error {
	type NoMethod Release
	var s1 struct {
		Fraction gensupport.JSONFloat64 `json:"fraction"`
		*NoMethod
	}
	s1.NoMethod = (*NoMethod)(s)
	if err := json.Unmarshal(data, &s1); err != nil {
		return err
	}
	s.Fraction = float64(s1.Fraction)
	return nil
}

// RolloutData: Rollout-related metadata for a release.
type RolloutData struct {
	// RolloutName: The name of the rollout.
	RolloutName string `json:"rolloutName,omitempty"`
	// Tag: Tags associated with a release's role in a rollout. Most rollouts will
	// have at least one release with a "rollout" tag and another release with a
	// "control" tag. Some rollouts may have additional named arms.
	Tag []string `json:"tag,omitempty"`
	// ForceSendFields is a list of field names (e.g. "RolloutName") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "RolloutName") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s RolloutData) MarshalJSON() ([]byte, error) {
	type NoMethod RolloutData
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

// Version: Each Version is owned by a Channel. A Version only displays the
// Version number (e.g. 84.0.4147.38). A Version owns a collection of releases.
type Version struct {
	// Name: Version name. Format is
	// "{product}/platforms/{platform}/channels/{channel}/versions/{version}" e.g.
	// "chrome/platforms/win/channels/beta/versions/84.0.4147.38"
	Name string `json:"name,omitempty"`
	// Version: String containing just the version number. e.g. "84.0.4147.38"
	Version string `json:"version,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Name") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

func (s Version) MarshalJSON() ([]byte, error) {
	type NoMethod Version
	return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}

type PlatformsListCall struct {
	s            *Service
	parent       string
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Returns list of platforms that are available for a given product. The
// resource "product" has no resource name in its name.
//
//   - parent: The product, which owns this collection of platforms. Format:
//     {product}.
func (r *PlatformsService) List(parent string) *PlatformsListCall {
	c := &PlatformsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.parent = parent
	return c
}

// PageSize sets the optional parameter "pageSize": Optional limit on the
// number of channels to include in the response. If unspecified, the server
// will pick an appropriate default.
func (c *PlatformsListCall) PageSize(pageSize int64) *PlatformsListCall {
	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
	return c
}

// PageToken sets the optional parameter "pageToken": A page token, received
// from a previous `ListChannels` call. Provide this to retrieve the subsequent
// page.
func (c *PlatformsListCall) PageToken(pageToken string) *PlatformsListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *PlatformsListCall) Fields(s ...googleapi.Field) *PlatformsListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *PlatformsListCall) IfNoneMatch(entityTag string) *PlatformsListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method.
func (c *PlatformsListCall) Context(ctx context.Context) *PlatformsListCall {
	c.ctx_ = ctx
	return c
}

// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *PlatformsListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *PlatformsListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/platforms")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, nil)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"parent": c.parent,
	})
	c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "versionhistory.platforms.list", "request", internallog.HTTPRequest(req, nil))
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "versionhistory.platforms.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListPlatformsResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *PlatformsListCall) Do(opts ...googleapi.CallOption) (*ListPlatformsResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, gensupport.WrapError(&googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		})
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, gensupport.WrapError(err)
	}
	ret := &ListPlatformsResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	b, err := gensupport.DecodeResponseBytes(target, res)
	if err != nil {
		return nil, err
	}
	c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "versionhistory.platforms.list", "response", internallog.HTTPResponse(res, b))
	return ret, nil
}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *PlatformsListCall) Pages(ctx context.Context, f func(*ListPlatformsResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken"))
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}

type PlatformsChannelsListCall struct {
	s            *Service
	parent       string
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Returns list of channels that are available for a given platform.
//
//   - parent: The platform, which owns this collection of channels. Format:
//     {product}/platforms/{platform}.
func (r *PlatformsChannelsService) List(parent string) *PlatformsChannelsListCall {
	c := &PlatformsChannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.parent = parent
	return c
}

// PageSize sets the optional parameter "pageSize": Optional limit on the
// number of channels to include in the response. If unspecified, the server
// will pick an appropriate default.
func (c *PlatformsChannelsListCall) PageSize(pageSize int64) *PlatformsChannelsListCall {
	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
	return c
}

// PageToken sets the optional parameter "pageToken": A page token, received
// from a previous `ListChannels` call. Provide this to retrieve the subsequent
// page.
func (c *PlatformsChannelsListCall) PageToken(pageToken string) *PlatformsChannelsListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *PlatformsChannelsListCall) Fields(s ...googleapi.Field) *PlatformsChannelsListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *PlatformsChannelsListCall) IfNoneMatch(entityTag string) *PlatformsChannelsListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method.
func (c *PlatformsChannelsListCall) Context(ctx context.Context) *PlatformsChannelsListCall {
	c.ctx_ = ctx
	return c
}

// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *PlatformsChannelsListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *PlatformsChannelsListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/channels")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, nil)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"parent": c.parent,
	})
	c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.list", "request", internallog.HTTPRequest(req, nil))
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "versionhistory.platforms.channels.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListChannelsResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *PlatformsChannelsListCall) Do(opts ...googleapi.CallOption) (*ListChannelsResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, gensupport.WrapError(&googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		})
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, gensupport.WrapError(err)
	}
	ret := &ListChannelsResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	b, err := gensupport.DecodeResponseBytes(target, res)
	if err != nil {
		return nil, err
	}
	c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.list", "response", internallog.HTTPResponse(res, b))
	return ret, nil
}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *PlatformsChannelsListCall) Pages(ctx context.Context, f func(*ListChannelsResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken"))
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}

type PlatformsChannelsVersionsListCall struct {
	s            *Service
	parent       string
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Returns list of version for the given platform/channel.
//
//   - parent: The channel, which owns this collection of versions. Format:
//     {product}/platforms/{platform}/channels/{channel}.
func (r *PlatformsChannelsVersionsService) List(parent string) *PlatformsChannelsVersionsListCall {
	c := &PlatformsChannelsVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.parent = parent
	return c
}

// Filter sets the optional parameter "filter": Filter string. Format is a
// comma separated list of All comma separated filter clauses are conjoined
// with a logical "and". Valid field_names are "version", "name", "platform",
// and "channel". Valid operators are "<", "<=", "=", ">=", and ">". Channel
// comparison is done by distance from stable. Ex) stable < beta, beta < dev,
// canary < canary_asan. Version comparison is done numerically. If version is
// not entirely written, the version will be appended with 0 in missing fields.
// Ex) version > 80 becoms version > 80.0.0.0 Name and platform are filtered by
// string comparison. Ex) "...?filter=channel<=beta, version >= 80 Ex)
// "...?filter=version > 80, version < 81
func (c *PlatformsChannelsVersionsListCall) Filter(filter string) *PlatformsChannelsVersionsListCall {
	c.urlParams_.Set("filter", filter)
	return c
}

// OrderBy sets the optional parameter "orderBy": Ordering string. Valid
// order_by strings are "version", "name", "platform", and "channel".
// Optionally, you can append " desc" or " asc" to specify the sorting order.
// Multiple order_by strings can be used in a comma separated list. Ordering by
// channel will sort by distance from the stable channel (not alphabetically).
// A list of channels sorted in this order is: stable, beta, dev, canary, and
// canary_asan. Sorting by name may cause unexpected behaviour as it is a naive
// string sort. For example, 1.0.0.8 will be before 1.0.0.10 in descending
// order. If order_by is not specified the response will be sorted by version
// in descending order. Ex) "...?order_by=version asc" Ex)
// "...?order_by=platform desc, channel, version"
func (c *PlatformsChannelsVersionsListCall) OrderBy(orderBy string) *PlatformsChannelsVersionsListCall {
	c.urlParams_.Set("orderBy", orderBy)
	return c
}

// PageSize sets the optional parameter "pageSize": Optional limit on the
// number of versions to include in the response. If unspecified, the server
// will pick an appropriate default.
func (c *PlatformsChannelsVersionsListCall) PageSize(pageSize int64) *PlatformsChannelsVersionsListCall {
	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
	return c
}

// PageToken sets the optional parameter "pageToken": A page token, received
// from a previous `ListVersions` call. Provide this to retrieve the subsequent
// page.
func (c *PlatformsChannelsVersionsListCall) PageToken(pageToken string) *PlatformsChannelsVersionsListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *PlatformsChannelsVersionsListCall) Fields(s ...googleapi.Field) *PlatformsChannelsVersionsListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *PlatformsChannelsVersionsListCall) IfNoneMatch(entityTag string) *PlatformsChannelsVersionsListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method.
func (c *PlatformsChannelsVersionsListCall) Context(ctx context.Context) *PlatformsChannelsVersionsListCall {
	c.ctx_ = ctx
	return c
}

// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *PlatformsChannelsVersionsListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *PlatformsChannelsVersionsListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/versions")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, nil)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"parent": c.parent,
	})
	c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.versions.list", "request", internallog.HTTPRequest(req, nil))
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "versionhistory.platforms.channels.versions.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListVersionsResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *PlatformsChannelsVersionsListCall) Do(opts ...googleapi.CallOption) (*ListVersionsResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, gensupport.WrapError(&googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		})
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, gensupport.WrapError(err)
	}
	ret := &ListVersionsResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	b, err := gensupport.DecodeResponseBytes(target, res)
	if err != nil {
		return nil, err
	}
	c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.versions.list", "response", internallog.HTTPResponse(res, b))
	return ret, nil
}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *PlatformsChannelsVersionsListCall) Pages(ctx context.Context, f func(*ListVersionsResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken"))
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}

type PlatformsChannelsVersionsReleasesListCall struct {
	s            *Service
	parent       string
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Returns list of releases of the given version.
//
//   - parent: The version, which owns this collection of releases. Format:
//     {product}/platforms/{platform}/channels/{channel}/versions/{version}.
func (r *PlatformsChannelsVersionsReleasesService) List(parent string) *PlatformsChannelsVersionsReleasesListCall {
	c := &PlatformsChannelsVersionsReleasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.parent = parent
	return c
}

// Filter sets the optional parameter "filter": Filter string. Format is a
// comma separated list of All comma separated filter clauses are conjoined
// with a logical "and". Valid field_names are "version", "name", "platform",
// "channel", "fraction" "starttime", and "endtime". Valid operators are "<",
// "<=", "=", ">=", and ">". Channel comparison is done by distance from
// stable. must be a valid channel when filtering by channel. Ex) stable <
// beta, beta < dev, canary < canary_asan. Version comparison is done
// numerically. Ex) 1.0.0.8 < 1.0.0.10. If version is not entirely written, the
// version will be appended with 0 for the missing fields. Ex) version > 80
// becoms version > 80.0.0.0 When filtering by starttime or endtime, string
// must be in RFC 3339 date string format. Name and platform are filtered by
// string comparison. Ex) "...?filter=channel<=beta, version >= 80 Ex)
// "...?filter=version > 80, version < 81 Ex)
// "...?filter=starttime>2020-01-01T00:00:00Z
func (c *PlatformsChannelsVersionsReleasesListCall) Filter(filter string) *PlatformsChannelsVersionsReleasesListCall {
	c.urlParams_.Set("filter", filter)
	return c
}

// OrderBy sets the optional parameter "orderBy": Ordering string. Valid
// order_by strings are "version", "name", "starttime", "endtime", "platform",
// "channel", and "fraction". Optionally, you can append "desc" or "asc" to
// specify the sorting order. Multiple order_by strings can be used in a comma
// separated list. Ordering by channel will sort by distance from the stable
// channel (not alphabetically). A list of channels sorted in this order is:
// stable, beta, dev, canary, and canary_asan. Sorting by name may cause
// unexpected behaviour as it is a naive string sort. For example, 1.0.0.8 will
// be before 1.0.0.10 in descending order. If order_by is not specified the
// response will be sorted by starttime in descending order. Ex)
// "...?order_by=starttime asc" Ex) "...?order_by=platform desc, channel,
// startime desc"
func (c *PlatformsChannelsVersionsReleasesListCall) OrderBy(orderBy string) *PlatformsChannelsVersionsReleasesListCall {
	c.urlParams_.Set("orderBy", orderBy)
	return c
}

// PageSize sets the optional parameter "pageSize": Optional limit on the
// number of releases to include in the response. If unspecified, the server
// will pick an appropriate default.
func (c *PlatformsChannelsVersionsReleasesListCall) PageSize(pageSize int64) *PlatformsChannelsVersionsReleasesListCall {
	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
	return c
}

// PageToken sets the optional parameter "pageToken": A page token, received
// from a previous `ListReleases` call. Provide this to retrieve the subsequent
// page.
func (c *PlatformsChannelsVersionsReleasesListCall) PageToken(pageToken string) *PlatformsChannelsVersionsReleasesListCall {
	c.urlParams_.Set("pageToken", pageToken)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
// details.
func (c *PlatformsChannelsVersionsReleasesListCall) Fields(s ...googleapi.Field) *PlatformsChannelsVersionsReleasesListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets an optional parameter which makes the operation fail if the
// object's ETag matches the given value. This is useful for getting updates
// only after the object has changed since the last request.
func (c *PlatformsChannelsVersionsReleasesListCall) IfNoneMatch(entityTag string) *PlatformsChannelsVersionsReleasesListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method.
func (c *PlatformsChannelsVersionsReleasesListCall) Context(ctx context.Context) *PlatformsChannelsVersionsReleasesListCall {
	c.ctx_ = ctx
	return c
}

// Header returns a http.Header that can be modified by the caller to add
// headers to the request.
func (c *PlatformsChannelsVersionsReleasesListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *PlatformsChannelsVersionsReleasesListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/releases")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, nil)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"parent": c.parent,
	})
	c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.versions.releases.list", "request", internallog.HTTPRequest(req, nil))
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "versionhistory.platforms.channels.versions.releases.list" call.
// Any non-2xx status code is an error. Response headers are in either
// *ListReleasesResponse.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified was
// returned.
func (c *PlatformsChannelsVersionsReleasesListCall) Do(opts ...googleapi.CallOption) (*ListReleasesResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, gensupport.WrapError(&googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		})
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, gensupport.WrapError(err)
	}
	ret := &ListReleasesResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	b, err := gensupport.DecodeResponseBytes(target, res)
	if err != nil {
		return nil, err
	}
	c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "versionhistory.platforms.channels.versions.releases.list", "response", internallog.HTTPResponse(res, b))
	return ret, nil
}

// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *PlatformsChannelsVersionsReleasesListCall) Pages(ctx context.Context, f func(*ListReleasesResponse) error) error {
	c.ctx_ = ctx
	defer c.PageToken(c.urlParams_.Get("pageToken"))
	for {
		x, err := c.Do()
		if err != nil {
			return err
		}
		if err := f(x); err != nil {
			return err
		}
		if x.NextPageToken == "" {
			return nil
		}
		c.PageToken(x.NextPageToken)
	}
}
