...

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

Documentation: google.golang.org/api/youtubereporting/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 youtubereporting provides access to the YouTube Reporting API.
     8  //
     9  // For product documentation, see: https://developers.google.com/youtube/reporting/v1/reports/
    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/youtubereporting/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	youtubereportingService, err := youtubereporting.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  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	youtubereportingService, err := youtubereporting.NewService(ctx, option.WithScopes(youtubereporting.YtAnalyticsReadonlyScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	youtubereportingService, err := youtubereporting.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	youtubereportingService, err := youtubereporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package youtubereporting // import "google.golang.org/api/youtubereporting/v1"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "youtubereporting:v1"
    95  const apiName = "youtubereporting"
    96  const apiVersion = "v1"
    97  const basePath = "https://youtubereporting.googleapis.com/"
    98  const basePathTemplate = "https://youtubereporting.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://youtubereporting.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// View monetary and non-monetary YouTube Analytics reports for your YouTube
   104  	// content
   105  	YtAnalyticsMonetaryReadonlyScope = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly"
   106  
   107  	// View YouTube Analytics reports for your YouTube content
   108  	YtAnalyticsReadonlyScope = "https://www.googleapis.com/auth/yt-analytics.readonly"
   109  )
   110  
   111  // NewService creates a new Service.
   112  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   113  	scopesOption := internaloption.WithDefaultScopes(
   114  		"https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
   115  		"https://www.googleapis.com/auth/yt-analytics.readonly",
   116  	)
   117  	// NOTE: prepend, so we don't override user-specified scopes.
   118  	opts = append([]option.ClientOption{scopesOption}, opts...)
   119  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   120  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   121  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   122  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   123  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	s, err := New(client)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	if endpoint != "" {
   132  		s.BasePath = endpoint
   133  	}
   134  	return s, nil
   135  }
   136  
   137  // New creates a new Service. It uses the provided http.Client for requests.
   138  //
   139  // Deprecated: please use NewService instead.
   140  // To provide a custom HTTP client, use option.WithHTTPClient.
   141  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   142  func New(client *http.Client) (*Service, error) {
   143  	if client == nil {
   144  		return nil, errors.New("client is nil")
   145  	}
   146  	s := &Service{client: client, BasePath: basePath}
   147  	s.Jobs = NewJobsService(s)
   148  	s.Media = NewMediaService(s)
   149  	s.ReportTypes = NewReportTypesService(s)
   150  	return s, nil
   151  }
   152  
   153  type Service struct {
   154  	client    *http.Client
   155  	BasePath  string // API endpoint base URL
   156  	UserAgent string // optional additional User-Agent fragment
   157  
   158  	Jobs *JobsService
   159  
   160  	Media *MediaService
   161  
   162  	ReportTypes *ReportTypesService
   163  }
   164  
   165  func (s *Service) userAgent() string {
   166  	if s.UserAgent == "" {
   167  		return googleapi.UserAgent
   168  	}
   169  	return googleapi.UserAgent + " " + s.UserAgent
   170  }
   171  
   172  func NewJobsService(s *Service) *JobsService {
   173  	rs := &JobsService{s: s}
   174  	rs.Reports = NewJobsReportsService(s)
   175  	return rs
   176  }
   177  
   178  type JobsService struct {
   179  	s *Service
   180  
   181  	Reports *JobsReportsService
   182  }
   183  
   184  func NewJobsReportsService(s *Service) *JobsReportsService {
   185  	rs := &JobsReportsService{s: s}
   186  	return rs
   187  }
   188  
   189  type JobsReportsService struct {
   190  	s *Service
   191  }
   192  
   193  func NewMediaService(s *Service) *MediaService {
   194  	rs := &MediaService{s: s}
   195  	return rs
   196  }
   197  
   198  type MediaService struct {
   199  	s *Service
   200  }
   201  
   202  func NewReportTypesService(s *Service) *ReportTypesService {
   203  	rs := &ReportTypesService{s: s}
   204  	return rs
   205  }
   206  
   207  type ReportTypesService struct {
   208  	s *Service
   209  }
   210  
   211  // Empty: A generic empty message that you can re-use to avoid defining
   212  // duplicated empty messages in your APIs. A typical example is to use it as
   213  // the request or the response type of an API method. For instance: service Foo
   214  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   215  type Empty struct {
   216  	// ServerResponse contains the HTTP response code and headers from the server.
   217  	googleapi.ServerResponse `json:"-"`
   218  }
   219  
   220  // GdataBlobstore2Info: gdata
   221  type GdataBlobstore2Info struct {
   222  	// BlobGeneration: gdata
   223  	BlobGeneration int64 `json:"blobGeneration,omitempty,string"`
   224  	// BlobId: gdata
   225  	BlobId string `json:"blobId,omitempty"`
   226  	// DownloadReadHandle: gdata
   227  	DownloadReadHandle string `json:"downloadReadHandle,omitempty"`
   228  	// ReadToken: gdata
   229  	ReadToken string `json:"readToken,omitempty"`
   230  	// UploadMetadataContainer: gdata
   231  	UploadMetadataContainer string `json:"uploadMetadataContainer,omitempty"`
   232  	// ForceSendFields is a list of field names (e.g. "BlobGeneration") to
   233  	// unconditionally include in API requests. By default, fields with empty or
   234  	// default values are omitted from API requests. See
   235  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   236  	// details.
   237  	ForceSendFields []string `json:"-"`
   238  	// NullFields is a list of field names (e.g. "BlobGeneration") to include in
   239  	// API requests with the JSON null value. By default, fields with empty values
   240  	// are omitted from API requests. See
   241  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   242  	NullFields []string `json:"-"`
   243  }
   244  
   245  func (s *GdataBlobstore2Info) MarshalJSON() ([]byte, error) {
   246  	type NoMethod GdataBlobstore2Info
   247  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   248  }
   249  
   250  // GdataCompositeMedia: gdata
   251  type GdataCompositeMedia struct {
   252  	// BlobRef: gdata
   253  	BlobRef string `json:"blobRef,omitempty"`
   254  	// Blobstore2Info: gdata
   255  	Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"`
   256  	// CosmoBinaryReference: gdata
   257  	CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"`
   258  	// Crc32cHash: gdata
   259  	Crc32cHash int64 `json:"crc32cHash,omitempty"`
   260  	// Inline: gdata
   261  	Inline string `json:"inline,omitempty"`
   262  	// Length: gdata
   263  	Length int64 `json:"length,omitempty,string"`
   264  	// Md5Hash: gdata
   265  	Md5Hash string `json:"md5Hash,omitempty"`
   266  	// ObjectId: gdata
   267  	ObjectId *GdataObjectId `json:"objectId,omitempty"`
   268  	// Path: gdata
   269  	Path string `json:"path,omitempty"`
   270  	// ReferenceType: gdata
   271  	//
   272  	// Possible values:
   273  	//   "PATH" - gdata
   274  	//   "BLOB_REF" - gdata
   275  	//   "INLINE" - gdata
   276  	//   "BIGSTORE_REF" - gdata
   277  	//   "COSMO_BINARY_REFERENCE" - gdata
   278  	ReferenceType string `json:"referenceType,omitempty"`
   279  	// Sha1Hash: gdata
   280  	Sha1Hash string `json:"sha1Hash,omitempty"`
   281  	// ForceSendFields is a list of field names (e.g. "BlobRef") to unconditionally
   282  	// include in API requests. By default, fields with empty or default values are
   283  	// omitted from API requests. See
   284  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   285  	// details.
   286  	ForceSendFields []string `json:"-"`
   287  	// NullFields is a list of field names (e.g. "BlobRef") to include in API
   288  	// requests with the JSON null value. By default, fields with empty values are
   289  	// omitted from API requests. See
   290  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   291  	NullFields []string `json:"-"`
   292  }
   293  
   294  func (s *GdataCompositeMedia) MarshalJSON() ([]byte, error) {
   295  	type NoMethod GdataCompositeMedia
   296  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   297  }
   298  
   299  // GdataContentTypeInfo: gdata
   300  type GdataContentTypeInfo struct {
   301  	// BestGuess: gdata
   302  	BestGuess string `json:"bestGuess,omitempty"`
   303  	// FromBytes: gdata
   304  	FromBytes string `json:"fromBytes,omitempty"`
   305  	// FromFileName: gdata
   306  	FromFileName string `json:"fromFileName,omitempty"`
   307  	// FromHeader: gdata
   308  	FromHeader string `json:"fromHeader,omitempty"`
   309  	// FromUrlPath: gdata
   310  	FromUrlPath string `json:"fromUrlPath,omitempty"`
   311  	// ForceSendFields is a list of field names (e.g. "BestGuess") to
   312  	// unconditionally include in API requests. By default, fields with empty or
   313  	// default values are omitted from API requests. See
   314  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   315  	// details.
   316  	ForceSendFields []string `json:"-"`
   317  	// NullFields is a list of field names (e.g. "BestGuess") to include in API
   318  	// requests with the JSON null value. By default, fields with empty values are
   319  	// omitted from API requests. See
   320  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   321  	NullFields []string `json:"-"`
   322  }
   323  
   324  func (s *GdataContentTypeInfo) MarshalJSON() ([]byte, error) {
   325  	type NoMethod GdataContentTypeInfo
   326  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   327  }
   328  
   329  // GdataDiffChecksumsResponse: gdata
   330  type GdataDiffChecksumsResponse struct {
   331  	// ChecksumsLocation: gdata
   332  	ChecksumsLocation *GdataCompositeMedia `json:"checksumsLocation,omitempty"`
   333  	// ChunkSizeBytes: gdata
   334  	ChunkSizeBytes int64 `json:"chunkSizeBytes,omitempty,string"`
   335  	// ObjectLocation: gdata
   336  	ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"`
   337  	// ObjectSizeBytes: gdata
   338  	ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"`
   339  	// ObjectVersion: gdata
   340  	ObjectVersion string `json:"objectVersion,omitempty"`
   341  	// ForceSendFields is a list of field names (e.g. "ChecksumsLocation") to
   342  	// unconditionally include in API requests. By default, fields with empty or
   343  	// default values are omitted from API requests. See
   344  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   345  	// details.
   346  	ForceSendFields []string `json:"-"`
   347  	// NullFields is a list of field names (e.g. "ChecksumsLocation") to include in
   348  	// API requests with the JSON null value. By default, fields with empty values
   349  	// are omitted from API requests. See
   350  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   351  	NullFields []string `json:"-"`
   352  }
   353  
   354  func (s *GdataDiffChecksumsResponse) MarshalJSON() ([]byte, error) {
   355  	type NoMethod GdataDiffChecksumsResponse
   356  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   357  }
   358  
   359  // GdataDiffDownloadResponse: gdata
   360  type GdataDiffDownloadResponse struct {
   361  	// ObjectLocation: gdata
   362  	ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"`
   363  	// ForceSendFields is a list of field names (e.g. "ObjectLocation") to
   364  	// unconditionally include in API requests. By default, fields with empty or
   365  	// default values are omitted from API requests. See
   366  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   367  	// details.
   368  	ForceSendFields []string `json:"-"`
   369  	// NullFields is a list of field names (e.g. "ObjectLocation") to include in
   370  	// API requests with the JSON null value. By default, fields with empty values
   371  	// are omitted from API requests. See
   372  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   373  	NullFields []string `json:"-"`
   374  }
   375  
   376  func (s *GdataDiffDownloadResponse) MarshalJSON() ([]byte, error) {
   377  	type NoMethod GdataDiffDownloadResponse
   378  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   379  }
   380  
   381  // GdataDiffUploadRequest: gdata
   382  type GdataDiffUploadRequest struct {
   383  	// ChecksumsInfo: gdata
   384  	ChecksumsInfo *GdataCompositeMedia `json:"checksumsInfo,omitempty"`
   385  	// ObjectInfo: gdata
   386  	ObjectInfo *GdataCompositeMedia `json:"objectInfo,omitempty"`
   387  	// ObjectVersion: gdata
   388  	ObjectVersion string `json:"objectVersion,omitempty"`
   389  	// ForceSendFields is a list of field names (e.g. "ChecksumsInfo") to
   390  	// unconditionally include in API requests. By default, fields with empty or
   391  	// default values are omitted from API requests. See
   392  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   393  	// details.
   394  	ForceSendFields []string `json:"-"`
   395  	// NullFields is a list of field names (e.g. "ChecksumsInfo") to include in API
   396  	// requests with the JSON null value. By default, fields with empty values are
   397  	// omitted from API requests. See
   398  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   399  	NullFields []string `json:"-"`
   400  }
   401  
   402  func (s *GdataDiffUploadRequest) MarshalJSON() ([]byte, error) {
   403  	type NoMethod GdataDiffUploadRequest
   404  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   405  }
   406  
   407  // GdataDiffUploadResponse: gdata
   408  type GdataDiffUploadResponse struct {
   409  	// ObjectVersion: gdata
   410  	ObjectVersion string `json:"objectVersion,omitempty"`
   411  	// OriginalObject: gdata
   412  	OriginalObject *GdataCompositeMedia `json:"originalObject,omitempty"`
   413  	// ForceSendFields is a list of field names (e.g. "ObjectVersion") to
   414  	// unconditionally include in API requests. By default, fields with empty or
   415  	// default values are omitted from API requests. See
   416  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   417  	// details.
   418  	ForceSendFields []string `json:"-"`
   419  	// NullFields is a list of field names (e.g. "ObjectVersion") to include in API
   420  	// requests with the JSON null value. By default, fields with empty values are
   421  	// omitted from API requests. See
   422  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   423  	NullFields []string `json:"-"`
   424  }
   425  
   426  func (s *GdataDiffUploadResponse) MarshalJSON() ([]byte, error) {
   427  	type NoMethod GdataDiffUploadResponse
   428  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   429  }
   430  
   431  // GdataDiffVersionResponse: gdata
   432  type GdataDiffVersionResponse struct {
   433  	// ObjectSizeBytes: gdata
   434  	ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"`
   435  	// ObjectVersion: gdata
   436  	ObjectVersion string `json:"objectVersion,omitempty"`
   437  	// ForceSendFields is a list of field names (e.g. "ObjectSizeBytes") to
   438  	// unconditionally include in API requests. By default, fields with empty or
   439  	// default values are omitted from API requests. See
   440  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   441  	// details.
   442  	ForceSendFields []string `json:"-"`
   443  	// NullFields is a list of field names (e.g. "ObjectSizeBytes") to include in
   444  	// API requests with the JSON null value. By default, fields with empty values
   445  	// are omitted from API requests. See
   446  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   447  	NullFields []string `json:"-"`
   448  }
   449  
   450  func (s *GdataDiffVersionResponse) MarshalJSON() ([]byte, error) {
   451  	type NoMethod GdataDiffVersionResponse
   452  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   453  }
   454  
   455  // GdataDownloadParameters: gdata
   456  type GdataDownloadParameters struct {
   457  	// AllowGzipCompression: gdata
   458  	AllowGzipCompression bool `json:"allowGzipCompression,omitempty"`
   459  	// IgnoreRange: gdata
   460  	IgnoreRange bool `json:"ignoreRange,omitempty"`
   461  	// ForceSendFields is a list of field names (e.g. "AllowGzipCompression") to
   462  	// unconditionally include in API requests. By default, fields with empty or
   463  	// default values are omitted from API requests. See
   464  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   465  	// details.
   466  	ForceSendFields []string `json:"-"`
   467  	// NullFields is a list of field names (e.g. "AllowGzipCompression") to include
   468  	// in API requests with the JSON null value. By default, fields with empty
   469  	// values are omitted from API requests. See
   470  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   471  	NullFields []string `json:"-"`
   472  }
   473  
   474  func (s *GdataDownloadParameters) MarshalJSON() ([]byte, error) {
   475  	type NoMethod GdataDownloadParameters
   476  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   477  }
   478  
   479  // GdataMedia: gdata
   480  type GdataMedia struct {
   481  	// Algorithm: gdata
   482  	Algorithm string `json:"algorithm,omitempty"`
   483  	// BigstoreObjectRef: gdata
   484  	BigstoreObjectRef string `json:"bigstoreObjectRef,omitempty"`
   485  	// BlobRef: gdata
   486  	BlobRef string `json:"blobRef,omitempty"`
   487  	// Blobstore2Info: gdata
   488  	Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"`
   489  	// CompositeMedia: gdata
   490  	CompositeMedia []*GdataCompositeMedia `json:"compositeMedia,omitempty"`
   491  	// ContentType: gdata
   492  	ContentType string `json:"contentType,omitempty"`
   493  	// ContentTypeInfo: gdata
   494  	ContentTypeInfo *GdataContentTypeInfo `json:"contentTypeInfo,omitempty"`
   495  	// CosmoBinaryReference: gdata
   496  	CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"`
   497  	// Crc32cHash: gdata
   498  	Crc32cHash int64 `json:"crc32cHash,omitempty"`
   499  	// DiffChecksumsResponse: gdata
   500  	DiffChecksumsResponse *GdataDiffChecksumsResponse `json:"diffChecksumsResponse,omitempty"`
   501  	// DiffDownloadResponse: gdata
   502  	DiffDownloadResponse *GdataDiffDownloadResponse `json:"diffDownloadResponse,omitempty"`
   503  	// DiffUploadRequest: gdata
   504  	DiffUploadRequest *GdataDiffUploadRequest `json:"diffUploadRequest,omitempty"`
   505  	// DiffUploadResponse: gdata
   506  	DiffUploadResponse *GdataDiffUploadResponse `json:"diffUploadResponse,omitempty"`
   507  	// DiffVersionResponse: gdata
   508  	DiffVersionResponse *GdataDiffVersionResponse `json:"diffVersionResponse,omitempty"`
   509  	// DownloadParameters: gdata
   510  	DownloadParameters *GdataDownloadParameters `json:"downloadParameters,omitempty"`
   511  	// Filename: gdata
   512  	Filename string `json:"filename,omitempty"`
   513  	// Hash: gdata
   514  	Hash string `json:"hash,omitempty"`
   515  	// HashVerified: gdata
   516  	HashVerified bool `json:"hashVerified,omitempty"`
   517  	// Inline: gdata
   518  	Inline string `json:"inline,omitempty"`
   519  	// IsPotentialRetry: gdata
   520  	IsPotentialRetry bool `json:"isPotentialRetry,omitempty"`
   521  	// Length: gdata
   522  	Length int64 `json:"length,omitempty,string"`
   523  	// Md5Hash: gdata
   524  	Md5Hash string `json:"md5Hash,omitempty"`
   525  	// MediaId: gdata
   526  	MediaId string `json:"mediaId,omitempty"`
   527  	// ObjectId: gdata
   528  	ObjectId *GdataObjectId `json:"objectId,omitempty"`
   529  	// Path: gdata
   530  	Path string `json:"path,omitempty"`
   531  	// ReferenceType: gdata
   532  	//
   533  	// Possible values:
   534  	//   "PATH" - gdata
   535  	//   "BLOB_REF" - gdata
   536  	//   "INLINE" - gdata
   537  	//   "GET_MEDIA" - gdata
   538  	//   "COMPOSITE_MEDIA" - gdata
   539  	//   "BIGSTORE_REF" - gdata
   540  	//   "DIFF_VERSION_RESPONSE" - gdata
   541  	//   "DIFF_CHECKSUMS_RESPONSE" - gdata
   542  	//   "DIFF_DOWNLOAD_RESPONSE" - gdata
   543  	//   "DIFF_UPLOAD_REQUEST" - gdata
   544  	//   "DIFF_UPLOAD_RESPONSE" - gdata
   545  	//   "COSMO_BINARY_REFERENCE" - gdata
   546  	//   "ARBITRARY_BYTES" - gdata
   547  	ReferenceType string `json:"referenceType,omitempty"`
   548  	// Sha1Hash: gdata
   549  	Sha1Hash string `json:"sha1Hash,omitempty"`
   550  	// Sha256Hash: gdata
   551  	Sha256Hash string `json:"sha256Hash,omitempty"`
   552  	// Timestamp: gdata
   553  	Timestamp uint64 `json:"timestamp,omitempty,string"`
   554  	// Token: gdata
   555  	Token string `json:"token,omitempty"`
   556  
   557  	// ServerResponse contains the HTTP response code and headers from the server.
   558  	googleapi.ServerResponse `json:"-"`
   559  	// ForceSendFields is a list of field names (e.g. "Algorithm") to
   560  	// unconditionally include in API requests. By default, fields with empty or
   561  	// default values are omitted from API requests. See
   562  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   563  	// details.
   564  	ForceSendFields []string `json:"-"`
   565  	// NullFields is a list of field names (e.g. "Algorithm") to include in API
   566  	// requests with the JSON null value. By default, fields with empty values are
   567  	// omitted from API requests. See
   568  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   569  	NullFields []string `json:"-"`
   570  }
   571  
   572  func (s *GdataMedia) MarshalJSON() ([]byte, error) {
   573  	type NoMethod GdataMedia
   574  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   575  }
   576  
   577  // GdataObjectId: gdata
   578  type GdataObjectId struct {
   579  	// BucketName: gdata
   580  	BucketName string `json:"bucketName,omitempty"`
   581  	// Generation: gdata
   582  	Generation int64 `json:"generation,omitempty,string"`
   583  	// ObjectName: gdata
   584  	ObjectName string `json:"objectName,omitempty"`
   585  	// ForceSendFields is a list of field names (e.g. "BucketName") to
   586  	// unconditionally include in API requests. By default, fields with empty or
   587  	// default values are omitted from API requests. See
   588  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   589  	// details.
   590  	ForceSendFields []string `json:"-"`
   591  	// NullFields is a list of field names (e.g. "BucketName") to include in API
   592  	// requests with the JSON null value. By default, fields with empty values are
   593  	// omitted from API requests. See
   594  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   595  	NullFields []string `json:"-"`
   596  }
   597  
   598  func (s *GdataObjectId) MarshalJSON() ([]byte, error) {
   599  	type NoMethod GdataObjectId
   600  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   601  }
   602  
   603  // Job: A job creating reports of a specific type.
   604  type Job struct {
   605  	// CreateTime: The creation date/time of the job.
   606  	CreateTime string `json:"createTime,omitempty"`
   607  	// ExpireTime: The date/time when this job will expire/expired. After a job
   608  	// expired, no new reports are generated.
   609  	ExpireTime string `json:"expireTime,omitempty"`
   610  	// Id: The server-generated ID of the job (max. 40 characters).
   611  	Id string `json:"id,omitempty"`
   612  	// Name: The name of the job (max. 100 characters).
   613  	Name string `json:"name,omitempty"`
   614  	// ReportTypeId: The type of reports this job creates. Corresponds to the ID of
   615  	// a ReportType.
   616  	ReportTypeId string `json:"reportTypeId,omitempty"`
   617  	// SystemManaged: True if this a system-managed job that cannot be modified by
   618  	// the user; otherwise false.
   619  	SystemManaged bool `json:"systemManaged,omitempty"`
   620  
   621  	// ServerResponse contains the HTTP response code and headers from the server.
   622  	googleapi.ServerResponse `json:"-"`
   623  	// ForceSendFields is a list of field names (e.g. "CreateTime") to
   624  	// unconditionally include in API requests. By default, fields with empty or
   625  	// default values are omitted from API requests. See
   626  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   627  	// details.
   628  	ForceSendFields []string `json:"-"`
   629  	// NullFields is a list of field names (e.g. "CreateTime") to include in API
   630  	// requests with the JSON null value. By default, fields with empty values are
   631  	// omitted from API requests. See
   632  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   633  	NullFields []string `json:"-"`
   634  }
   635  
   636  func (s *Job) MarshalJSON() ([]byte, error) {
   637  	type NoMethod Job
   638  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   639  }
   640  
   641  // ListJobsResponse: Response message for ReportingService.ListJobs.
   642  type ListJobsResponse struct {
   643  	// Jobs: The list of jobs.
   644  	Jobs []*Job `json:"jobs,omitempty"`
   645  	// NextPageToken: A token to retrieve next page of results. Pass this value in
   646  	// the ListJobsRequest.page_token field in the subsequent call to `ListJobs`
   647  	// method to retrieve the next page of results.
   648  	NextPageToken string `json:"nextPageToken,omitempty"`
   649  
   650  	// ServerResponse contains the HTTP response code and headers from the server.
   651  	googleapi.ServerResponse `json:"-"`
   652  	// ForceSendFields is a list of field names (e.g. "Jobs") to unconditionally
   653  	// include in API requests. By default, fields with empty or default values are
   654  	// omitted from API requests. See
   655  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   656  	// details.
   657  	ForceSendFields []string `json:"-"`
   658  	// NullFields is a list of field names (e.g. "Jobs") to include in API requests
   659  	// with the JSON null value. By default, fields with empty values are omitted
   660  	// from API requests. See
   661  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   662  	NullFields []string `json:"-"`
   663  }
   664  
   665  func (s *ListJobsResponse) MarshalJSON() ([]byte, error) {
   666  	type NoMethod ListJobsResponse
   667  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   668  }
   669  
   670  // ListReportTypesResponse: Response message for
   671  // ReportingService.ListReportTypes.
   672  type ListReportTypesResponse struct {
   673  	// NextPageToken: A token to retrieve next page of results. Pass this value in
   674  	// the ListReportTypesRequest.page_token field in the subsequent call to
   675  	// `ListReportTypes` method to retrieve the next page of results.
   676  	NextPageToken string `json:"nextPageToken,omitempty"`
   677  	// ReportTypes: The list of report types.
   678  	ReportTypes []*ReportType `json:"reportTypes,omitempty"`
   679  
   680  	// ServerResponse contains the HTTP response code and headers from the server.
   681  	googleapi.ServerResponse `json:"-"`
   682  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   683  	// unconditionally include in API requests. By default, fields with empty or
   684  	// default values are omitted from API requests. See
   685  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   686  	// details.
   687  	ForceSendFields []string `json:"-"`
   688  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   689  	// requests with the JSON null value. By default, fields with empty values are
   690  	// omitted from API requests. See
   691  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   692  	NullFields []string `json:"-"`
   693  }
   694  
   695  func (s *ListReportTypesResponse) MarshalJSON() ([]byte, error) {
   696  	type NoMethod ListReportTypesResponse
   697  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   698  }
   699  
   700  // ListReportsResponse: Response message for ReportingService.ListReports.
   701  type ListReportsResponse struct {
   702  	// NextPageToken: A token to retrieve next page of results. Pass this value in
   703  	// the ListReportsRequest.page_token field in the subsequent call to
   704  	// `ListReports` method to retrieve the next page of results.
   705  	NextPageToken string `json:"nextPageToken,omitempty"`
   706  	// Reports: The list of report types.
   707  	Reports []*Report `json:"reports,omitempty"`
   708  
   709  	// ServerResponse contains the HTTP response code and headers from the server.
   710  	googleapi.ServerResponse `json:"-"`
   711  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   712  	// unconditionally include in API requests. By default, fields with empty or
   713  	// default values are omitted from API requests. See
   714  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   715  	// details.
   716  	ForceSendFields []string `json:"-"`
   717  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   718  	// requests with the JSON null value. By default, fields with empty values are
   719  	// omitted from API requests. See
   720  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   721  	NullFields []string `json:"-"`
   722  }
   723  
   724  func (s *ListReportsResponse) MarshalJSON() ([]byte, error) {
   725  	type NoMethod ListReportsResponse
   726  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   727  }
   728  
   729  // Report: A report's metadata including the URL from which the report itself
   730  // can be downloaded.
   731  type Report struct {
   732  	// CreateTime: The date/time when this report was created.
   733  	CreateTime string `json:"createTime,omitempty"`
   734  	// DownloadUrl: The URL from which the report can be downloaded (max. 1000
   735  	// characters).
   736  	DownloadUrl string `json:"downloadUrl,omitempty"`
   737  	// EndTime: The end of the time period that the report instance covers. The
   738  	// value is exclusive.
   739  	EndTime string `json:"endTime,omitempty"`
   740  	// Id: The server-generated ID of the report.
   741  	Id string `json:"id,omitempty"`
   742  	// JobExpireTime: The date/time when the job this report belongs to will
   743  	// expire/expired.
   744  	JobExpireTime string `json:"jobExpireTime,omitempty"`
   745  	// JobId: The ID of the job that created this report.
   746  	JobId string `json:"jobId,omitempty"`
   747  	// StartTime: The start of the time period that the report instance covers. The
   748  	// value is inclusive.
   749  	StartTime string `json:"startTime,omitempty"`
   750  
   751  	// ServerResponse contains the HTTP response code and headers from the server.
   752  	googleapi.ServerResponse `json:"-"`
   753  	// ForceSendFields is a list of field names (e.g. "CreateTime") to
   754  	// unconditionally include in API requests. By default, fields with empty or
   755  	// default values are omitted from API requests. See
   756  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   757  	// details.
   758  	ForceSendFields []string `json:"-"`
   759  	// NullFields is a list of field names (e.g. "CreateTime") to include in API
   760  	// requests with the JSON null value. By default, fields with empty values are
   761  	// omitted from API requests. See
   762  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   763  	NullFields []string `json:"-"`
   764  }
   765  
   766  func (s *Report) MarshalJSON() ([]byte, error) {
   767  	type NoMethod Report
   768  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   769  }
   770  
   771  // ReportType: A report type.
   772  type ReportType struct {
   773  	// DeprecateTime: The date/time when this report type was/will be deprecated.
   774  	DeprecateTime string `json:"deprecateTime,omitempty"`
   775  	// Id: The ID of the report type (max. 100 characters).
   776  	Id string `json:"id,omitempty"`
   777  	// Name: The name of the report type (max. 100 characters).
   778  	Name string `json:"name,omitempty"`
   779  	// SystemManaged: True if this a system-managed report type; otherwise false.
   780  	// Reporting jobs for system-managed report types are created automatically and
   781  	// can thus not be used in the `CreateJob` method.
   782  	SystemManaged bool `json:"systemManaged,omitempty"`
   783  	// ForceSendFields is a list of field names (e.g. "DeprecateTime") to
   784  	// unconditionally include in API requests. By default, fields with empty or
   785  	// default values are 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. "DeprecateTime") to include in API
   790  	// requests with the JSON null value. By default, fields with empty values are
   791  	// omitted 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 *ReportType) MarshalJSON() ([]byte, error) {
   797  	type NoMethod ReportType
   798  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   799  }
   800  
   801  type JobsCreateCall struct {
   802  	s          *Service
   803  	job        *Job
   804  	urlParams_ gensupport.URLParams
   805  	ctx_       context.Context
   806  	header_    http.Header
   807  }
   808  
   809  // Create: Creates a job and returns it.
   810  func (r *JobsService) Create(job *Job) *JobsCreateCall {
   811  	c := &JobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   812  	c.job = job
   813  	return c
   814  }
   815  
   816  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
   817  // The content owner's external ID on which behalf the user is acting on. If
   818  // not set, the user is acting for himself (his own channel).
   819  func (c *JobsCreateCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsCreateCall {
   820  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
   821  	return c
   822  }
   823  
   824  // Fields allows partial responses to be retrieved. See
   825  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   826  // details.
   827  func (c *JobsCreateCall) Fields(s ...googleapi.Field) *JobsCreateCall {
   828  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   829  	return c
   830  }
   831  
   832  // Context sets the context to be used in this call's Do method.
   833  func (c *JobsCreateCall) Context(ctx context.Context) *JobsCreateCall {
   834  	c.ctx_ = ctx
   835  	return c
   836  }
   837  
   838  // Header returns a http.Header that can be modified by the caller to add
   839  // headers to the request.
   840  func (c *JobsCreateCall) Header() http.Header {
   841  	if c.header_ == nil {
   842  		c.header_ = make(http.Header)
   843  	}
   844  	return c.header_
   845  }
   846  
   847  func (c *JobsCreateCall) doRequest(alt string) (*http.Response, error) {
   848  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   849  	var body io.Reader = nil
   850  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.job)
   851  	if err != nil {
   852  		return nil, err
   853  	}
   854  	c.urlParams_.Set("alt", alt)
   855  	c.urlParams_.Set("prettyPrint", "false")
   856  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs")
   857  	urls += "?" + c.urlParams_.Encode()
   858  	req, err := http.NewRequest("POST", urls, body)
   859  	if err != nil {
   860  		return nil, err
   861  	}
   862  	req.Header = reqHeaders
   863  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   864  }
   865  
   866  // Do executes the "youtubereporting.jobs.create" call.
   867  // Any non-2xx status code is an error. Response headers are in either
   868  // *Job.ServerResponse.Header or (if a response was returned at all) in
   869  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   870  // whether the returned error was because http.StatusNotModified was returned.
   871  func (c *JobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) {
   872  	gensupport.SetOptions(c.urlParams_, opts...)
   873  	res, err := c.doRequest("json")
   874  	if res != nil && res.StatusCode == http.StatusNotModified {
   875  		if res.Body != nil {
   876  			res.Body.Close()
   877  		}
   878  		return nil, gensupport.WrapError(&googleapi.Error{
   879  			Code:   res.StatusCode,
   880  			Header: res.Header,
   881  		})
   882  	}
   883  	if err != nil {
   884  		return nil, err
   885  	}
   886  	defer googleapi.CloseBody(res)
   887  	if err := googleapi.CheckResponse(res); err != nil {
   888  		return nil, gensupport.WrapError(err)
   889  	}
   890  	ret := &Job{
   891  		ServerResponse: googleapi.ServerResponse{
   892  			Header:         res.Header,
   893  			HTTPStatusCode: res.StatusCode,
   894  		},
   895  	}
   896  	target := &ret
   897  	if err := gensupport.DecodeResponse(target, res); err != nil {
   898  		return nil, err
   899  	}
   900  	return ret, nil
   901  }
   902  
   903  type JobsDeleteCall struct {
   904  	s          *Service
   905  	jobId      string
   906  	urlParams_ gensupport.URLParams
   907  	ctx_       context.Context
   908  	header_    http.Header
   909  }
   910  
   911  // Delete: Deletes a job.
   912  //
   913  // - jobId: The ID of the job to delete.
   914  func (r *JobsService) Delete(jobId string) *JobsDeleteCall {
   915  	c := &JobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   916  	c.jobId = jobId
   917  	return c
   918  }
   919  
   920  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
   921  // The content owner's external ID on which behalf the user is acting on. If
   922  // not set, the user is acting for himself (his own channel).
   923  func (c *JobsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsDeleteCall {
   924  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
   925  	return c
   926  }
   927  
   928  // Fields allows partial responses to be retrieved. See
   929  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   930  // details.
   931  func (c *JobsDeleteCall) Fields(s ...googleapi.Field) *JobsDeleteCall {
   932  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   933  	return c
   934  }
   935  
   936  // Context sets the context to be used in this call's Do method.
   937  func (c *JobsDeleteCall) Context(ctx context.Context) *JobsDeleteCall {
   938  	c.ctx_ = ctx
   939  	return c
   940  }
   941  
   942  // Header returns a http.Header that can be modified by the caller to add
   943  // headers to the request.
   944  func (c *JobsDeleteCall) Header() http.Header {
   945  	if c.header_ == nil {
   946  		c.header_ = make(http.Header)
   947  	}
   948  	return c.header_
   949  }
   950  
   951  func (c *JobsDeleteCall) doRequest(alt string) (*http.Response, error) {
   952  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   953  	var body io.Reader = nil
   954  	c.urlParams_.Set("alt", alt)
   955  	c.urlParams_.Set("prettyPrint", "false")
   956  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}")
   957  	urls += "?" + c.urlParams_.Encode()
   958  	req, err := http.NewRequest("DELETE", urls, body)
   959  	if err != nil {
   960  		return nil, err
   961  	}
   962  	req.Header = reqHeaders
   963  	googleapi.Expand(req.URL, map[string]string{
   964  		"jobId": c.jobId,
   965  	})
   966  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   967  }
   968  
   969  // Do executes the "youtubereporting.jobs.delete" call.
   970  // Any non-2xx status code is an error. Response headers are in either
   971  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   972  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   973  // whether the returned error was because http.StatusNotModified was returned.
   974  func (c *JobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   975  	gensupport.SetOptions(c.urlParams_, opts...)
   976  	res, err := c.doRequest("json")
   977  	if res != nil && res.StatusCode == http.StatusNotModified {
   978  		if res.Body != nil {
   979  			res.Body.Close()
   980  		}
   981  		return nil, gensupport.WrapError(&googleapi.Error{
   982  			Code:   res.StatusCode,
   983  			Header: res.Header,
   984  		})
   985  	}
   986  	if err != nil {
   987  		return nil, err
   988  	}
   989  	defer googleapi.CloseBody(res)
   990  	if err := googleapi.CheckResponse(res); err != nil {
   991  		return nil, gensupport.WrapError(err)
   992  	}
   993  	ret := &Empty{
   994  		ServerResponse: googleapi.ServerResponse{
   995  			Header:         res.Header,
   996  			HTTPStatusCode: res.StatusCode,
   997  		},
   998  	}
   999  	target := &ret
  1000  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1001  		return nil, err
  1002  	}
  1003  	return ret, nil
  1004  }
  1005  
  1006  type JobsGetCall struct {
  1007  	s            *Service
  1008  	jobId        string
  1009  	urlParams_   gensupport.URLParams
  1010  	ifNoneMatch_ string
  1011  	ctx_         context.Context
  1012  	header_      http.Header
  1013  }
  1014  
  1015  // Get: Gets a job.
  1016  //
  1017  // - jobId: The ID of the job to retrieve.
  1018  func (r *JobsService) Get(jobId string) *JobsGetCall {
  1019  	c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1020  	c.jobId = jobId
  1021  	return c
  1022  }
  1023  
  1024  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
  1025  // The content owner's external ID on which behalf the user is acting on. If
  1026  // not set, the user is acting for himself (his own channel).
  1027  func (c *JobsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsGetCall {
  1028  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1029  	return c
  1030  }
  1031  
  1032  // Fields allows partial responses to be retrieved. See
  1033  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1034  // details.
  1035  func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall {
  1036  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1037  	return c
  1038  }
  1039  
  1040  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1041  // object's ETag matches the given value. This is useful for getting updates
  1042  // only after the object has changed since the last request.
  1043  func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall {
  1044  	c.ifNoneMatch_ = entityTag
  1045  	return c
  1046  }
  1047  
  1048  // Context sets the context to be used in this call's Do method.
  1049  func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall {
  1050  	c.ctx_ = ctx
  1051  	return c
  1052  }
  1053  
  1054  // Header returns a http.Header that can be modified by the caller to add
  1055  // headers to the request.
  1056  func (c *JobsGetCall) Header() http.Header {
  1057  	if c.header_ == nil {
  1058  		c.header_ = make(http.Header)
  1059  	}
  1060  	return c.header_
  1061  }
  1062  
  1063  func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) {
  1064  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1065  	if c.ifNoneMatch_ != "" {
  1066  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1067  	}
  1068  	var body io.Reader = nil
  1069  	c.urlParams_.Set("alt", alt)
  1070  	c.urlParams_.Set("prettyPrint", "false")
  1071  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}")
  1072  	urls += "?" + c.urlParams_.Encode()
  1073  	req, err := http.NewRequest("GET", urls, body)
  1074  	if err != nil {
  1075  		return nil, err
  1076  	}
  1077  	req.Header = reqHeaders
  1078  	googleapi.Expand(req.URL, map[string]string{
  1079  		"jobId": c.jobId,
  1080  	})
  1081  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1082  }
  1083  
  1084  // Do executes the "youtubereporting.jobs.get" call.
  1085  // Any non-2xx status code is an error. Response headers are in either
  1086  // *Job.ServerResponse.Header or (if a response was returned at all) in
  1087  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1088  // whether the returned error was because http.StatusNotModified was returned.
  1089  func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  1090  	gensupport.SetOptions(c.urlParams_, opts...)
  1091  	res, err := c.doRequest("json")
  1092  	if res != nil && res.StatusCode == http.StatusNotModified {
  1093  		if res.Body != nil {
  1094  			res.Body.Close()
  1095  		}
  1096  		return nil, gensupport.WrapError(&googleapi.Error{
  1097  			Code:   res.StatusCode,
  1098  			Header: res.Header,
  1099  		})
  1100  	}
  1101  	if err != nil {
  1102  		return nil, err
  1103  	}
  1104  	defer googleapi.CloseBody(res)
  1105  	if err := googleapi.CheckResponse(res); err != nil {
  1106  		return nil, gensupport.WrapError(err)
  1107  	}
  1108  	ret := &Job{
  1109  		ServerResponse: googleapi.ServerResponse{
  1110  			Header:         res.Header,
  1111  			HTTPStatusCode: res.StatusCode,
  1112  		},
  1113  	}
  1114  	target := &ret
  1115  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1116  		return nil, err
  1117  	}
  1118  	return ret, nil
  1119  }
  1120  
  1121  type JobsListCall struct {
  1122  	s            *Service
  1123  	urlParams_   gensupport.URLParams
  1124  	ifNoneMatch_ string
  1125  	ctx_         context.Context
  1126  	header_      http.Header
  1127  }
  1128  
  1129  // List: Lists jobs.
  1130  func (r *JobsService) List() *JobsListCall {
  1131  	c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1132  	return c
  1133  }
  1134  
  1135  // IncludeSystemManaged sets the optional parameter "includeSystemManaged": If
  1136  // set to true, also system-managed jobs will be returned; otherwise only
  1137  // user-created jobs will be returned. System-managed jobs can neither be
  1138  // modified nor deleted.
  1139  func (c *JobsListCall) IncludeSystemManaged(includeSystemManaged bool) *JobsListCall {
  1140  	c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged))
  1141  	return c
  1142  }
  1143  
  1144  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
  1145  // The content owner's external ID on which behalf the user is acting on. If
  1146  // not set, the user is acting for himself (his own channel).
  1147  func (c *JobsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsListCall {
  1148  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1149  	return c
  1150  }
  1151  
  1152  // PageSize sets the optional parameter "pageSize": Requested page size. Server
  1153  // may return fewer jobs than requested. If unspecified, server will pick an
  1154  // appropriate default.
  1155  func (c *JobsListCall) PageSize(pageSize int64) *JobsListCall {
  1156  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1157  	return c
  1158  }
  1159  
  1160  // PageToken sets the optional parameter "pageToken": A token identifying a
  1161  // page of results the server should return. Typically, this is the value of
  1162  // ListReportTypesResponse.next_page_token returned in response to the previous
  1163  // call to the `ListJobs` method.
  1164  func (c *JobsListCall) PageToken(pageToken string) *JobsListCall {
  1165  	c.urlParams_.Set("pageToken", pageToken)
  1166  	return c
  1167  }
  1168  
  1169  // Fields allows partial responses to be retrieved. See
  1170  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1171  // details.
  1172  func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall {
  1173  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1174  	return c
  1175  }
  1176  
  1177  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1178  // object's ETag matches the given value. This is useful for getting updates
  1179  // only after the object has changed since the last request.
  1180  func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall {
  1181  	c.ifNoneMatch_ = entityTag
  1182  	return c
  1183  }
  1184  
  1185  // Context sets the context to be used in this call's Do method.
  1186  func (c *JobsListCall) Context(ctx context.Context) *JobsListCall {
  1187  	c.ctx_ = ctx
  1188  	return c
  1189  }
  1190  
  1191  // Header returns a http.Header that can be modified by the caller to add
  1192  // headers to the request.
  1193  func (c *JobsListCall) Header() http.Header {
  1194  	if c.header_ == nil {
  1195  		c.header_ = make(http.Header)
  1196  	}
  1197  	return c.header_
  1198  }
  1199  
  1200  func (c *JobsListCall) doRequest(alt string) (*http.Response, error) {
  1201  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1202  	if c.ifNoneMatch_ != "" {
  1203  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1204  	}
  1205  	var body io.Reader = nil
  1206  	c.urlParams_.Set("alt", alt)
  1207  	c.urlParams_.Set("prettyPrint", "false")
  1208  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs")
  1209  	urls += "?" + c.urlParams_.Encode()
  1210  	req, err := http.NewRequest("GET", urls, body)
  1211  	if err != nil {
  1212  		return nil, err
  1213  	}
  1214  	req.Header = reqHeaders
  1215  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1216  }
  1217  
  1218  // Do executes the "youtubereporting.jobs.list" call.
  1219  // Any non-2xx status code is an error. Response headers are in either
  1220  // *ListJobsResponse.ServerResponse.Header or (if a response was returned at
  1221  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1222  // check whether the returned error was because http.StatusNotModified was
  1223  // returned.
  1224  func (c *JobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) {
  1225  	gensupport.SetOptions(c.urlParams_, opts...)
  1226  	res, err := c.doRequest("json")
  1227  	if res != nil && res.StatusCode == http.StatusNotModified {
  1228  		if res.Body != nil {
  1229  			res.Body.Close()
  1230  		}
  1231  		return nil, gensupport.WrapError(&googleapi.Error{
  1232  			Code:   res.StatusCode,
  1233  			Header: res.Header,
  1234  		})
  1235  	}
  1236  	if err != nil {
  1237  		return nil, err
  1238  	}
  1239  	defer googleapi.CloseBody(res)
  1240  	if err := googleapi.CheckResponse(res); err != nil {
  1241  		return nil, gensupport.WrapError(err)
  1242  	}
  1243  	ret := &ListJobsResponse{
  1244  		ServerResponse: googleapi.ServerResponse{
  1245  			Header:         res.Header,
  1246  			HTTPStatusCode: res.StatusCode,
  1247  		},
  1248  	}
  1249  	target := &ret
  1250  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1251  		return nil, err
  1252  	}
  1253  	return ret, nil
  1254  }
  1255  
  1256  // Pages invokes f for each page of results.
  1257  // A non-nil error returned from f will halt the iteration.
  1258  // The provided context supersedes any context provided to the Context method.
  1259  func (c *JobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error {
  1260  	c.ctx_ = ctx
  1261  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1262  	for {
  1263  		x, err := c.Do()
  1264  		if err != nil {
  1265  			return err
  1266  		}
  1267  		if err := f(x); err != nil {
  1268  			return err
  1269  		}
  1270  		if x.NextPageToken == "" {
  1271  			return nil
  1272  		}
  1273  		c.PageToken(x.NextPageToken)
  1274  	}
  1275  }
  1276  
  1277  type JobsReportsGetCall struct {
  1278  	s            *Service
  1279  	jobId        string
  1280  	reportId     string
  1281  	urlParams_   gensupport.URLParams
  1282  	ifNoneMatch_ string
  1283  	ctx_         context.Context
  1284  	header_      http.Header
  1285  }
  1286  
  1287  // Get: Gets the metadata of a specific report.
  1288  //
  1289  // - jobId: The ID of the job.
  1290  // - reportId: The ID of the report to retrieve.
  1291  func (r *JobsReportsService) Get(jobId string, reportId string) *JobsReportsGetCall {
  1292  	c := &JobsReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1293  	c.jobId = jobId
  1294  	c.reportId = reportId
  1295  	return c
  1296  }
  1297  
  1298  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
  1299  // The content owner's external ID on which behalf the user is acting on. If
  1300  // not set, the user is acting for himself (his own channel).
  1301  func (c *JobsReportsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsGetCall {
  1302  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1303  	return c
  1304  }
  1305  
  1306  // Fields allows partial responses to be retrieved. See
  1307  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1308  // details.
  1309  func (c *JobsReportsGetCall) Fields(s ...googleapi.Field) *JobsReportsGetCall {
  1310  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1311  	return c
  1312  }
  1313  
  1314  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1315  // object's ETag matches the given value. This is useful for getting updates
  1316  // only after the object has changed since the last request.
  1317  func (c *JobsReportsGetCall) IfNoneMatch(entityTag string) *JobsReportsGetCall {
  1318  	c.ifNoneMatch_ = entityTag
  1319  	return c
  1320  }
  1321  
  1322  // Context sets the context to be used in this call's Do method.
  1323  func (c *JobsReportsGetCall) Context(ctx context.Context) *JobsReportsGetCall {
  1324  	c.ctx_ = ctx
  1325  	return c
  1326  }
  1327  
  1328  // Header returns a http.Header that can be modified by the caller to add
  1329  // headers to the request.
  1330  func (c *JobsReportsGetCall) Header() http.Header {
  1331  	if c.header_ == nil {
  1332  		c.header_ = make(http.Header)
  1333  	}
  1334  	return c.header_
  1335  }
  1336  
  1337  func (c *JobsReportsGetCall) doRequest(alt string) (*http.Response, error) {
  1338  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1339  	if c.ifNoneMatch_ != "" {
  1340  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1341  	}
  1342  	var body io.Reader = nil
  1343  	c.urlParams_.Set("alt", alt)
  1344  	c.urlParams_.Set("prettyPrint", "false")
  1345  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports/{reportId}")
  1346  	urls += "?" + c.urlParams_.Encode()
  1347  	req, err := http.NewRequest("GET", urls, body)
  1348  	if err != nil {
  1349  		return nil, err
  1350  	}
  1351  	req.Header = reqHeaders
  1352  	googleapi.Expand(req.URL, map[string]string{
  1353  		"jobId":    c.jobId,
  1354  		"reportId": c.reportId,
  1355  	})
  1356  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1357  }
  1358  
  1359  // Do executes the "youtubereporting.jobs.reports.get" call.
  1360  // Any non-2xx status code is an error. Response headers are in either
  1361  // *Report.ServerResponse.Header or (if a response was returned at all) in
  1362  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1363  // whether the returned error was because http.StatusNotModified was returned.
  1364  func (c *JobsReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  1365  	gensupport.SetOptions(c.urlParams_, opts...)
  1366  	res, err := c.doRequest("json")
  1367  	if res != nil && res.StatusCode == http.StatusNotModified {
  1368  		if res.Body != nil {
  1369  			res.Body.Close()
  1370  		}
  1371  		return nil, gensupport.WrapError(&googleapi.Error{
  1372  			Code:   res.StatusCode,
  1373  			Header: res.Header,
  1374  		})
  1375  	}
  1376  	if err != nil {
  1377  		return nil, err
  1378  	}
  1379  	defer googleapi.CloseBody(res)
  1380  	if err := googleapi.CheckResponse(res); err != nil {
  1381  		return nil, gensupport.WrapError(err)
  1382  	}
  1383  	ret := &Report{
  1384  		ServerResponse: googleapi.ServerResponse{
  1385  			Header:         res.Header,
  1386  			HTTPStatusCode: res.StatusCode,
  1387  		},
  1388  	}
  1389  	target := &ret
  1390  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1391  		return nil, err
  1392  	}
  1393  	return ret, nil
  1394  }
  1395  
  1396  type JobsReportsListCall struct {
  1397  	s            *Service
  1398  	jobId        string
  1399  	urlParams_   gensupport.URLParams
  1400  	ifNoneMatch_ string
  1401  	ctx_         context.Context
  1402  	header_      http.Header
  1403  }
  1404  
  1405  // List: Lists reports created by a specific job. Returns NOT_FOUND if the job
  1406  // does not exist.
  1407  //
  1408  // - jobId: The ID of the job.
  1409  func (r *JobsReportsService) List(jobId string) *JobsReportsListCall {
  1410  	c := &JobsReportsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1411  	c.jobId = jobId
  1412  	return c
  1413  }
  1414  
  1415  // CreatedAfter sets the optional parameter "createdAfter": If set, only
  1416  // reports created after the specified date/time are returned.
  1417  func (c *JobsReportsListCall) CreatedAfter(createdAfter string) *JobsReportsListCall {
  1418  	c.urlParams_.Set("createdAfter", createdAfter)
  1419  	return c
  1420  }
  1421  
  1422  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
  1423  // The content owner's external ID on which behalf the user is acting on. If
  1424  // not set, the user is acting for himself (his own channel).
  1425  func (c *JobsReportsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsListCall {
  1426  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1427  	return c
  1428  }
  1429  
  1430  // PageSize sets the optional parameter "pageSize": Requested page size. Server
  1431  // may return fewer report types than requested. If unspecified, server will
  1432  // pick an appropriate default.
  1433  func (c *JobsReportsListCall) PageSize(pageSize int64) *JobsReportsListCall {
  1434  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1435  	return c
  1436  }
  1437  
  1438  // PageToken sets the optional parameter "pageToken": A token identifying a
  1439  // page of results the server should return. Typically, this is the value of
  1440  // ListReportsResponse.next_page_token returned in response to the previous
  1441  // call to the `ListReports` method.
  1442  func (c *JobsReportsListCall) PageToken(pageToken string) *JobsReportsListCall {
  1443  	c.urlParams_.Set("pageToken", pageToken)
  1444  	return c
  1445  }
  1446  
  1447  // StartTimeAtOrAfter sets the optional parameter "startTimeAtOrAfter": If set,
  1448  // only reports whose start time is greater than or equal the specified
  1449  // date/time are returned.
  1450  func (c *JobsReportsListCall) StartTimeAtOrAfter(startTimeAtOrAfter string) *JobsReportsListCall {
  1451  	c.urlParams_.Set("startTimeAtOrAfter", startTimeAtOrAfter)
  1452  	return c
  1453  }
  1454  
  1455  // StartTimeBefore sets the optional parameter "startTimeBefore": If set, only
  1456  // reports whose start time is smaller than the specified date/time are
  1457  // returned.
  1458  func (c *JobsReportsListCall) StartTimeBefore(startTimeBefore string) *JobsReportsListCall {
  1459  	c.urlParams_.Set("startTimeBefore", startTimeBefore)
  1460  	return c
  1461  }
  1462  
  1463  // Fields allows partial responses to be retrieved. See
  1464  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1465  // details.
  1466  func (c *JobsReportsListCall) Fields(s ...googleapi.Field) *JobsReportsListCall {
  1467  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1468  	return c
  1469  }
  1470  
  1471  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1472  // object's ETag matches the given value. This is useful for getting updates
  1473  // only after the object has changed since the last request.
  1474  func (c *JobsReportsListCall) IfNoneMatch(entityTag string) *JobsReportsListCall {
  1475  	c.ifNoneMatch_ = entityTag
  1476  	return c
  1477  }
  1478  
  1479  // Context sets the context to be used in this call's Do method.
  1480  func (c *JobsReportsListCall) Context(ctx context.Context) *JobsReportsListCall {
  1481  	c.ctx_ = ctx
  1482  	return c
  1483  }
  1484  
  1485  // Header returns a http.Header that can be modified by the caller to add
  1486  // headers to the request.
  1487  func (c *JobsReportsListCall) Header() http.Header {
  1488  	if c.header_ == nil {
  1489  		c.header_ = make(http.Header)
  1490  	}
  1491  	return c.header_
  1492  }
  1493  
  1494  func (c *JobsReportsListCall) doRequest(alt string) (*http.Response, error) {
  1495  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1496  	if c.ifNoneMatch_ != "" {
  1497  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1498  	}
  1499  	var body io.Reader = nil
  1500  	c.urlParams_.Set("alt", alt)
  1501  	c.urlParams_.Set("prettyPrint", "false")
  1502  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports")
  1503  	urls += "?" + c.urlParams_.Encode()
  1504  	req, err := http.NewRequest("GET", urls, body)
  1505  	if err != nil {
  1506  		return nil, err
  1507  	}
  1508  	req.Header = reqHeaders
  1509  	googleapi.Expand(req.URL, map[string]string{
  1510  		"jobId": c.jobId,
  1511  	})
  1512  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1513  }
  1514  
  1515  // Do executes the "youtubereporting.jobs.reports.list" call.
  1516  // Any non-2xx status code is an error. Response headers are in either
  1517  // *ListReportsResponse.ServerResponse.Header or (if a response was returned at
  1518  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1519  // check whether the returned error was because http.StatusNotModified was
  1520  // returned.
  1521  func (c *JobsReportsListCall) Do(opts ...googleapi.CallOption) (*ListReportsResponse, error) {
  1522  	gensupport.SetOptions(c.urlParams_, opts...)
  1523  	res, err := c.doRequest("json")
  1524  	if res != nil && res.StatusCode == http.StatusNotModified {
  1525  		if res.Body != nil {
  1526  			res.Body.Close()
  1527  		}
  1528  		return nil, gensupport.WrapError(&googleapi.Error{
  1529  			Code:   res.StatusCode,
  1530  			Header: res.Header,
  1531  		})
  1532  	}
  1533  	if err != nil {
  1534  		return nil, err
  1535  	}
  1536  	defer googleapi.CloseBody(res)
  1537  	if err := googleapi.CheckResponse(res); err != nil {
  1538  		return nil, gensupport.WrapError(err)
  1539  	}
  1540  	ret := &ListReportsResponse{
  1541  		ServerResponse: googleapi.ServerResponse{
  1542  			Header:         res.Header,
  1543  			HTTPStatusCode: res.StatusCode,
  1544  		},
  1545  	}
  1546  	target := &ret
  1547  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1548  		return nil, err
  1549  	}
  1550  	return ret, nil
  1551  }
  1552  
  1553  // Pages invokes f for each page of results.
  1554  // A non-nil error returned from f will halt the iteration.
  1555  // The provided context supersedes any context provided to the Context method.
  1556  func (c *JobsReportsListCall) Pages(ctx context.Context, f func(*ListReportsResponse) error) error {
  1557  	c.ctx_ = ctx
  1558  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1559  	for {
  1560  		x, err := c.Do()
  1561  		if err != nil {
  1562  			return err
  1563  		}
  1564  		if err := f(x); err != nil {
  1565  			return err
  1566  		}
  1567  		if x.NextPageToken == "" {
  1568  			return nil
  1569  		}
  1570  		c.PageToken(x.NextPageToken)
  1571  	}
  1572  }
  1573  
  1574  type MediaDownloadCall struct {
  1575  	s            *Service
  1576  	resourceName string
  1577  	urlParams_   gensupport.URLParams
  1578  	ifNoneMatch_ string
  1579  	ctx_         context.Context
  1580  	header_      http.Header
  1581  }
  1582  
  1583  // Download: Method for media download. Download is supported on the URI
  1584  // `/v1/media/{+name}?alt=media`.
  1585  //
  1586  // - resourceName: Name of the media that is being downloaded.
  1587  func (r *MediaService) Download(resourceName string) *MediaDownloadCall {
  1588  	c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1589  	c.resourceName = resourceName
  1590  	return c
  1591  }
  1592  
  1593  // Fields allows partial responses to be retrieved. See
  1594  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1595  // details.
  1596  func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {
  1597  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1598  	return c
  1599  }
  1600  
  1601  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1602  // object's ETag matches the given value. This is useful for getting updates
  1603  // only after the object has changed since the last request.
  1604  func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {
  1605  	c.ifNoneMatch_ = entityTag
  1606  	return c
  1607  }
  1608  
  1609  // Context sets the context to be used in this call's Do and Download methods.
  1610  func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall {
  1611  	c.ctx_ = ctx
  1612  	return c
  1613  }
  1614  
  1615  // Header returns a http.Header that can be modified by the caller to add
  1616  // headers to the request.
  1617  func (c *MediaDownloadCall) Header() http.Header {
  1618  	if c.header_ == nil {
  1619  		c.header_ = make(http.Header)
  1620  	}
  1621  	return c.header_
  1622  }
  1623  
  1624  func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) {
  1625  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1626  	if c.ifNoneMatch_ != "" {
  1627  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1628  	}
  1629  	var body io.Reader = nil
  1630  	c.urlParams_.Set("alt", alt)
  1631  	c.urlParams_.Set("prettyPrint", "false")
  1632  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/media/{+resourceName}")
  1633  	urls += "?" + c.urlParams_.Encode()
  1634  	req, err := http.NewRequest("GET", urls, body)
  1635  	if err != nil {
  1636  		return nil, err
  1637  	}
  1638  	req.Header = reqHeaders
  1639  	googleapi.Expand(req.URL, map[string]string{
  1640  		"resourceName": c.resourceName,
  1641  	})
  1642  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1643  }
  1644  
  1645  // Download fetches the API endpoint's "media" value, instead of the normal
  1646  // API response value. If the returned error is nil, the Response is guaranteed to
  1647  // have a 2xx status code. Callers must close the Response.Body as usual.
  1648  func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  1649  	gensupport.SetOptions(c.urlParams_, opts...)
  1650  	res, err := c.doRequest("media")
  1651  	if err != nil {
  1652  		return nil, err
  1653  	}
  1654  	if err := googleapi.CheckResponse(res); err != nil {
  1655  		res.Body.Close()
  1656  		return nil, gensupport.WrapError(err)
  1657  	}
  1658  	return res, nil
  1659  }
  1660  
  1661  // Do executes the "youtubereporting.media.download" call.
  1662  // Any non-2xx status code is an error. Response headers are in either
  1663  // *GdataMedia.ServerResponse.Header or (if a response was returned at all) in
  1664  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1665  // whether the returned error was because http.StatusNotModified was returned.
  1666  func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*GdataMedia, error) {
  1667  	gensupport.SetOptions(c.urlParams_, opts...)
  1668  	res, err := c.doRequest("json")
  1669  	if res != nil && res.StatusCode == http.StatusNotModified {
  1670  		if res.Body != nil {
  1671  			res.Body.Close()
  1672  		}
  1673  		return nil, gensupport.WrapError(&googleapi.Error{
  1674  			Code:   res.StatusCode,
  1675  			Header: res.Header,
  1676  		})
  1677  	}
  1678  	if err != nil {
  1679  		return nil, err
  1680  	}
  1681  	defer googleapi.CloseBody(res)
  1682  	if err := googleapi.CheckResponse(res); err != nil {
  1683  		return nil, gensupport.WrapError(err)
  1684  	}
  1685  	ret := &GdataMedia{
  1686  		ServerResponse: googleapi.ServerResponse{
  1687  			Header:         res.Header,
  1688  			HTTPStatusCode: res.StatusCode,
  1689  		},
  1690  	}
  1691  	target := &ret
  1692  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1693  		return nil, err
  1694  	}
  1695  	return ret, nil
  1696  }
  1697  
  1698  type ReportTypesListCall struct {
  1699  	s            *Service
  1700  	urlParams_   gensupport.URLParams
  1701  	ifNoneMatch_ string
  1702  	ctx_         context.Context
  1703  	header_      http.Header
  1704  }
  1705  
  1706  // List: Lists report types.
  1707  func (r *ReportTypesService) List() *ReportTypesListCall {
  1708  	c := &ReportTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1709  	return c
  1710  }
  1711  
  1712  // IncludeSystemManaged sets the optional parameter "includeSystemManaged": If
  1713  // set to true, also system-managed report types will be returned; otherwise
  1714  // only the report types that can be used to create new reporting jobs will be
  1715  // returned.
  1716  func (c *ReportTypesListCall) IncludeSystemManaged(includeSystemManaged bool) *ReportTypesListCall {
  1717  	c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged))
  1718  	return c
  1719  }
  1720  
  1721  // OnBehalfOfContentOwner sets the optional parameter "onBehalfOfContentOwner":
  1722  // The content owner's external ID on which behalf the user is acting on. If
  1723  // not set, the user is acting for himself (his own channel).
  1724  func (c *ReportTypesListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *ReportTypesListCall {
  1725  	c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1726  	return c
  1727  }
  1728  
  1729  // PageSize sets the optional parameter "pageSize": Requested page size. Server
  1730  // may return fewer report types than requested. If unspecified, server will
  1731  // pick an appropriate default.
  1732  func (c *ReportTypesListCall) PageSize(pageSize int64) *ReportTypesListCall {
  1733  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1734  	return c
  1735  }
  1736  
  1737  // PageToken sets the optional parameter "pageToken": A token identifying a
  1738  // page of results the server should return. Typically, this is the value of
  1739  // ListReportTypesResponse.next_page_token returned in response to the previous
  1740  // call to the `ListReportTypes` method.
  1741  func (c *ReportTypesListCall) PageToken(pageToken string) *ReportTypesListCall {
  1742  	c.urlParams_.Set("pageToken", pageToken)
  1743  	return c
  1744  }
  1745  
  1746  // Fields allows partial responses to be retrieved. See
  1747  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1748  // details.
  1749  func (c *ReportTypesListCall) Fields(s ...googleapi.Field) *ReportTypesListCall {
  1750  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1751  	return c
  1752  }
  1753  
  1754  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1755  // object's ETag matches the given value. This is useful for getting updates
  1756  // only after the object has changed since the last request.
  1757  func (c *ReportTypesListCall) IfNoneMatch(entityTag string) *ReportTypesListCall {
  1758  	c.ifNoneMatch_ = entityTag
  1759  	return c
  1760  }
  1761  
  1762  // Context sets the context to be used in this call's Do method.
  1763  func (c *ReportTypesListCall) Context(ctx context.Context) *ReportTypesListCall {
  1764  	c.ctx_ = ctx
  1765  	return c
  1766  }
  1767  
  1768  // Header returns a http.Header that can be modified by the caller to add
  1769  // headers to the request.
  1770  func (c *ReportTypesListCall) Header() http.Header {
  1771  	if c.header_ == nil {
  1772  		c.header_ = make(http.Header)
  1773  	}
  1774  	return c.header_
  1775  }
  1776  
  1777  func (c *ReportTypesListCall) doRequest(alt string) (*http.Response, error) {
  1778  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1779  	if c.ifNoneMatch_ != "" {
  1780  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1781  	}
  1782  	var body io.Reader = nil
  1783  	c.urlParams_.Set("alt", alt)
  1784  	c.urlParams_.Set("prettyPrint", "false")
  1785  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/reportTypes")
  1786  	urls += "?" + c.urlParams_.Encode()
  1787  	req, err := http.NewRequest("GET", urls, body)
  1788  	if err != nil {
  1789  		return nil, err
  1790  	}
  1791  	req.Header = reqHeaders
  1792  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1793  }
  1794  
  1795  // Do executes the "youtubereporting.reportTypes.list" call.
  1796  // Any non-2xx status code is an error. Response headers are in either
  1797  // *ListReportTypesResponse.ServerResponse.Header or (if a response was
  1798  // returned at all) in error.(*googleapi.Error).Header. Use
  1799  // googleapi.IsNotModified to check whether the returned error was because
  1800  // http.StatusNotModified was returned.
  1801  func (c *ReportTypesListCall) Do(opts ...googleapi.CallOption) (*ListReportTypesResponse, error) {
  1802  	gensupport.SetOptions(c.urlParams_, opts...)
  1803  	res, err := c.doRequest("json")
  1804  	if res != nil && res.StatusCode == http.StatusNotModified {
  1805  		if res.Body != nil {
  1806  			res.Body.Close()
  1807  		}
  1808  		return nil, gensupport.WrapError(&googleapi.Error{
  1809  			Code:   res.StatusCode,
  1810  			Header: res.Header,
  1811  		})
  1812  	}
  1813  	if err != nil {
  1814  		return nil, err
  1815  	}
  1816  	defer googleapi.CloseBody(res)
  1817  	if err := googleapi.CheckResponse(res); err != nil {
  1818  		return nil, gensupport.WrapError(err)
  1819  	}
  1820  	ret := &ListReportTypesResponse{
  1821  		ServerResponse: googleapi.ServerResponse{
  1822  			Header:         res.Header,
  1823  			HTTPStatusCode: res.StatusCode,
  1824  		},
  1825  	}
  1826  	target := &ret
  1827  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1828  		return nil, err
  1829  	}
  1830  	return ret, nil
  1831  }
  1832  
  1833  // Pages invokes f for each page of results.
  1834  // A non-nil error returned from f will halt the iteration.
  1835  // The provided context supersedes any context provided to the Context method.
  1836  func (c *ReportTypesListCall) Pages(ctx context.Context, f func(*ListReportTypesResponse) error) error {
  1837  	c.ctx_ = ctx
  1838  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1839  	for {
  1840  		x, err := c.Do()
  1841  		if err != nil {
  1842  			return err
  1843  		}
  1844  		if err := f(x); err != nil {
  1845  			return err
  1846  		}
  1847  		if x.NextPageToken == "" {
  1848  			return nil
  1849  		}
  1850  		c.PageToken(x.NextPageToken)
  1851  	}
  1852  }
  1853  

View as plain text