1// Copyright 2021 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package youtubereporting provides access to the YouTube Reporting API. 8// 9// For product documentation, see: https://developers.google.com/youtube/reporting/v1/reports/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/youtubereporting/v1" 16// ... 17// ctx := context.Background() 18// youtubereportingService, err := youtubereporting.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// youtubereportingService, err := youtubereporting.NewService(ctx, option.WithScopes(youtubereporting.YtAnalyticsReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// youtubereportingService, err := youtubereporting.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// youtubereportingService, err := youtubereporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package youtubereporting // import "google.golang.org/api/youtubereporting/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "youtubereporting:v1" 79const apiName = "youtubereporting" 80const apiVersion = "v1" 81const basePath = "https://youtubereporting.googleapis.com/" 82const mtlsBasePath = "https://youtubereporting.mtls.googleapis.com/" 83 84// OAuth2 scopes used by this API. 85const ( 86 // View monetary and non-monetary YouTube Analytics reports for your 87 // YouTube content 88 YtAnalyticsMonetaryReadonlyScope = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly" 89 90 // View YouTube Analytics reports for your YouTube content 91 YtAnalyticsReadonlyScope = "https://www.googleapis.com/auth/yt-analytics.readonly" 92) 93 94// NewService creates a new Service. 95func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 96 scopesOption := option.WithScopes( 97 "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 98 "https://www.googleapis.com/auth/yt-analytics.readonly", 99 ) 100 // NOTE: prepend, so we don't override user-specified scopes. 101 opts = append([]option.ClientOption{scopesOption}, opts...) 102 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 103 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 104 client, endpoint, err := htransport.NewClient(ctx, opts...) 105 if err != nil { 106 return nil, err 107 } 108 s, err := New(client) 109 if err != nil { 110 return nil, err 111 } 112 if endpoint != "" { 113 s.BasePath = endpoint 114 } 115 return s, nil 116} 117 118// New creates a new Service. It uses the provided http.Client for requests. 119// 120// Deprecated: please use NewService instead. 121// To provide a custom HTTP client, use option.WithHTTPClient. 122// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 123func New(client *http.Client) (*Service, error) { 124 if client == nil { 125 return nil, errors.New("client is nil") 126 } 127 s := &Service{client: client, BasePath: basePath} 128 s.Jobs = NewJobsService(s) 129 s.Media = NewMediaService(s) 130 s.ReportTypes = NewReportTypesService(s) 131 return s, nil 132} 133 134type Service struct { 135 client *http.Client 136 BasePath string // API endpoint base URL 137 UserAgent string // optional additional User-Agent fragment 138 139 Jobs *JobsService 140 141 Media *MediaService 142 143 ReportTypes *ReportTypesService 144} 145 146func (s *Service) userAgent() string { 147 if s.UserAgent == "" { 148 return googleapi.UserAgent 149 } 150 return googleapi.UserAgent + " " + s.UserAgent 151} 152 153func NewJobsService(s *Service) *JobsService { 154 rs := &JobsService{s: s} 155 rs.Reports = NewJobsReportsService(s) 156 return rs 157} 158 159type JobsService struct { 160 s *Service 161 162 Reports *JobsReportsService 163} 164 165func NewJobsReportsService(s *Service) *JobsReportsService { 166 rs := &JobsReportsService{s: s} 167 return rs 168} 169 170type JobsReportsService struct { 171 s *Service 172} 173 174func NewMediaService(s *Service) *MediaService { 175 rs := &MediaService{s: s} 176 return rs 177} 178 179type MediaService struct { 180 s *Service 181} 182 183func NewReportTypesService(s *Service) *ReportTypesService { 184 rs := &ReportTypesService{s: s} 185 return rs 186} 187 188type ReportTypesService struct { 189 s *Service 190} 191 192// Empty: A generic empty message that you can re-use to avoid defining 193// duplicated empty messages in your APIs. A typical example is to use 194// it as the request or the response type of an API method. For 195// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 196// (google.protobuf.Empty); } The JSON representation for `Empty` is 197// empty JSON object `{}`. 198type Empty struct { 199 // ServerResponse contains the HTTP response code and headers from the 200 // server. 201 googleapi.ServerResponse `json:"-"` 202} 203 204// GdataBlobstore2Info: gdata 205type GdataBlobstore2Info struct { 206 // BlobGeneration: gdata 207 BlobGeneration int64 `json:"blobGeneration,omitempty,string"` 208 209 // BlobId: gdata 210 BlobId string `json:"blobId,omitempty"` 211 212 // DownloadReadHandle: gdata 213 DownloadReadHandle string `json:"downloadReadHandle,omitempty"` 214 215 // ReadToken: gdata 216 ReadToken string `json:"readToken,omitempty"` 217 218 // UploadMetadataContainer: gdata 219 UploadMetadataContainer string `json:"uploadMetadataContainer,omitempty"` 220 221 // ForceSendFields is a list of field names (e.g. "BlobGeneration") to 222 // unconditionally include in API requests. By default, fields with 223 // empty or default values are omitted from API requests. However, any 224 // non-pointer, non-interface field appearing in ForceSendFields will be 225 // sent to the server regardless of whether the field is empty or not. 226 // This may be used to include empty fields in Patch requests. 227 ForceSendFields []string `json:"-"` 228 229 // NullFields is a list of field names (e.g. "BlobGeneration") to 230 // include in API requests with the JSON null value. By default, fields 231 // with empty values are omitted from API requests. However, any field 232 // with an empty value appearing in NullFields will be sent to the 233 // server as null. It is an error if a field in this list has a 234 // non-empty value. This may be used to include null fields in Patch 235 // requests. 236 NullFields []string `json:"-"` 237} 238 239func (s *GdataBlobstore2Info) MarshalJSON() ([]byte, error) { 240 type NoMethod GdataBlobstore2Info 241 raw := NoMethod(*s) 242 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 243} 244 245// GdataCompositeMedia: gdata 246type GdataCompositeMedia struct { 247 // BlobRef: gdata 248 BlobRef string `json:"blobRef,omitempty"` 249 250 // Blobstore2Info: gdata 251 Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"` 252 253 // CosmoBinaryReference: gdata 254 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"` 255 256 // Crc32cHash: gdata 257 Crc32cHash int64 `json:"crc32cHash,omitempty"` 258 259 // Inline: gdata 260 Inline string `json:"inline,omitempty"` 261 262 // Length: gdata 263 Length int64 `json:"length,omitempty,string"` 264 265 // Md5Hash: gdata 266 Md5Hash string `json:"md5Hash,omitempty"` 267 268 // ObjectId: gdata 269 ObjectId *GdataObjectId `json:"objectId,omitempty"` 270 271 // Path: gdata 272 Path string `json:"path,omitempty"` 273 274 // ReferenceType: gdata 275 // 276 // Possible values: 277 // "PATH" - gdata 278 // "BLOB_REF" - gdata 279 // "INLINE" - gdata 280 // "BIGSTORE_REF" - gdata 281 // "COSMO_BINARY_REFERENCE" - gdata 282 ReferenceType string `json:"referenceType,omitempty"` 283 284 // Sha1Hash: gdata 285 Sha1Hash string `json:"sha1Hash,omitempty"` 286 287 // ForceSendFields is a list of field names (e.g. "BlobRef") to 288 // unconditionally include in API requests. By default, fields with 289 // empty or default values are omitted from API requests. However, any 290 // non-pointer, non-interface field appearing in ForceSendFields will be 291 // sent to the server regardless of whether the field is empty or not. 292 // This may be used to include empty fields in Patch requests. 293 ForceSendFields []string `json:"-"` 294 295 // NullFields is a list of field names (e.g. "BlobRef") to include in 296 // API requests with the JSON null value. By default, fields with empty 297 // values are omitted from API requests. However, any field with an 298 // empty value appearing in NullFields will be sent to the server as 299 // null. It is an error if a field in this list has a non-empty value. 300 // This may be used to include null fields in Patch requests. 301 NullFields []string `json:"-"` 302} 303 304func (s *GdataCompositeMedia) MarshalJSON() ([]byte, error) { 305 type NoMethod GdataCompositeMedia 306 raw := NoMethod(*s) 307 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 308} 309 310// GdataContentTypeInfo: gdata 311type GdataContentTypeInfo struct { 312 // BestGuess: gdata 313 BestGuess string `json:"bestGuess,omitempty"` 314 315 // FromBytes: gdata 316 FromBytes string `json:"fromBytes,omitempty"` 317 318 // FromFileName: gdata 319 FromFileName string `json:"fromFileName,omitempty"` 320 321 // FromHeader: gdata 322 FromHeader string `json:"fromHeader,omitempty"` 323 324 // FromUrlPath: gdata 325 FromUrlPath string `json:"fromUrlPath,omitempty"` 326 327 // ForceSendFields is a list of field names (e.g. "BestGuess") to 328 // unconditionally include in API requests. By default, fields with 329 // empty or default values are omitted from API requests. However, any 330 // non-pointer, non-interface field appearing in ForceSendFields will be 331 // sent to the server regardless of whether the field is empty or not. 332 // This may be used to include empty fields in Patch requests. 333 ForceSendFields []string `json:"-"` 334 335 // NullFields is a list of field names (e.g. "BestGuess") to include in 336 // API requests with the JSON null value. By default, fields with empty 337 // values are omitted from API requests. However, any field with an 338 // empty value appearing in NullFields will be sent to the server as 339 // null. It is an error if a field in this list has a non-empty value. 340 // This may be used to include null fields in Patch requests. 341 NullFields []string `json:"-"` 342} 343 344func (s *GdataContentTypeInfo) MarshalJSON() ([]byte, error) { 345 type NoMethod GdataContentTypeInfo 346 raw := NoMethod(*s) 347 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 348} 349 350// GdataDiffChecksumsResponse: gdata 351type GdataDiffChecksumsResponse struct { 352 // ChecksumsLocation: gdata 353 ChecksumsLocation *GdataCompositeMedia `json:"checksumsLocation,omitempty"` 354 355 // ChunkSizeBytes: gdata 356 ChunkSizeBytes int64 `json:"chunkSizeBytes,omitempty,string"` 357 358 // ObjectLocation: gdata 359 ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"` 360 361 // ObjectSizeBytes: gdata 362 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"` 363 364 // ObjectVersion: gdata 365 ObjectVersion string `json:"objectVersion,omitempty"` 366 367 // ForceSendFields is a list of field names (e.g. "ChecksumsLocation") 368 // to unconditionally include in API requests. By default, fields with 369 // empty or default values are omitted from API requests. However, any 370 // non-pointer, non-interface field appearing in ForceSendFields will be 371 // sent to the server regardless of whether the field is empty or not. 372 // This may be used to include empty fields in Patch requests. 373 ForceSendFields []string `json:"-"` 374 375 // NullFields is a list of field names (e.g. "ChecksumsLocation") to 376 // include in API requests with the JSON null value. By default, fields 377 // with empty values are omitted from API requests. However, any field 378 // with an empty value appearing in NullFields will be sent to the 379 // server as null. It is an error if a field in this list has a 380 // non-empty value. This may be used to include null fields in Patch 381 // requests. 382 NullFields []string `json:"-"` 383} 384 385func (s *GdataDiffChecksumsResponse) MarshalJSON() ([]byte, error) { 386 type NoMethod GdataDiffChecksumsResponse 387 raw := NoMethod(*s) 388 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 389} 390 391// GdataDiffDownloadResponse: gdata 392type GdataDiffDownloadResponse struct { 393 // ObjectLocation: gdata 394 ObjectLocation *GdataCompositeMedia `json:"objectLocation,omitempty"` 395 396 // ForceSendFields is a list of field names (e.g. "ObjectLocation") to 397 // unconditionally include in API requests. By default, fields with 398 // empty or default values are omitted from API requests. However, any 399 // non-pointer, non-interface field appearing in ForceSendFields will be 400 // sent to the server regardless of whether the field is empty or not. 401 // This may be used to include empty fields in Patch requests. 402 ForceSendFields []string `json:"-"` 403 404 // NullFields is a list of field names (e.g. "ObjectLocation") to 405 // include in API requests with the JSON null value. By default, fields 406 // with empty values are omitted from API requests. However, any field 407 // with an empty value appearing in NullFields will be sent to the 408 // server as null. It is an error if a field in this list has a 409 // non-empty value. This may be used to include null fields in Patch 410 // requests. 411 NullFields []string `json:"-"` 412} 413 414func (s *GdataDiffDownloadResponse) MarshalJSON() ([]byte, error) { 415 type NoMethod GdataDiffDownloadResponse 416 raw := NoMethod(*s) 417 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 418} 419 420// GdataDiffUploadRequest: gdata 421type GdataDiffUploadRequest struct { 422 // ChecksumsInfo: gdata 423 ChecksumsInfo *GdataCompositeMedia `json:"checksumsInfo,omitempty"` 424 425 // ObjectInfo: gdata 426 ObjectInfo *GdataCompositeMedia `json:"objectInfo,omitempty"` 427 428 // ObjectVersion: gdata 429 ObjectVersion string `json:"objectVersion,omitempty"` 430 431 // ForceSendFields is a list of field names (e.g. "ChecksumsInfo") to 432 // unconditionally include in API requests. By default, fields with 433 // empty or default values are omitted from API requests. However, any 434 // non-pointer, non-interface field appearing in ForceSendFields will be 435 // sent to the server regardless of whether the field is empty or not. 436 // This may be used to include empty fields in Patch requests. 437 ForceSendFields []string `json:"-"` 438 439 // NullFields is a list of field names (e.g. "ChecksumsInfo") to include 440 // in API requests with the JSON null value. By default, fields with 441 // empty values are omitted from API requests. However, any field with 442 // an empty value appearing in NullFields will be sent to the server as 443 // null. It is an error if a field in this list has a non-empty value. 444 // This may be used to include null fields in Patch requests. 445 NullFields []string `json:"-"` 446} 447 448func (s *GdataDiffUploadRequest) MarshalJSON() ([]byte, error) { 449 type NoMethod GdataDiffUploadRequest 450 raw := NoMethod(*s) 451 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 452} 453 454// GdataDiffUploadResponse: gdata 455type GdataDiffUploadResponse struct { 456 // ObjectVersion: gdata 457 ObjectVersion string `json:"objectVersion,omitempty"` 458 459 // OriginalObject: gdata 460 OriginalObject *GdataCompositeMedia `json:"originalObject,omitempty"` 461 462 // ForceSendFields is a list of field names (e.g. "ObjectVersion") to 463 // unconditionally include in API requests. By default, fields with 464 // empty or default values are omitted from API requests. However, any 465 // non-pointer, non-interface field appearing in ForceSendFields will be 466 // sent to the server regardless of whether the field is empty or not. 467 // This may be used to include empty fields in Patch requests. 468 ForceSendFields []string `json:"-"` 469 470 // NullFields is a list of field names (e.g. "ObjectVersion") to include 471 // in API requests with the JSON null value. By default, fields with 472 // empty values are omitted from API requests. However, any field with 473 // an empty value appearing in NullFields will be sent to the server as 474 // null. It is an error if a field in this list has a non-empty value. 475 // This may be used to include null fields in Patch requests. 476 NullFields []string `json:"-"` 477} 478 479func (s *GdataDiffUploadResponse) MarshalJSON() ([]byte, error) { 480 type NoMethod GdataDiffUploadResponse 481 raw := NoMethod(*s) 482 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 483} 484 485// GdataDiffVersionResponse: gdata 486type GdataDiffVersionResponse struct { 487 // ObjectSizeBytes: gdata 488 ObjectSizeBytes int64 `json:"objectSizeBytes,omitempty,string"` 489 490 // ObjectVersion: gdata 491 ObjectVersion string `json:"objectVersion,omitempty"` 492 493 // ForceSendFields is a list of field names (e.g. "ObjectSizeBytes") to 494 // unconditionally include in API requests. By default, fields with 495 // empty or default values are omitted from API requests. However, any 496 // non-pointer, non-interface field appearing in ForceSendFields will be 497 // sent to the server regardless of whether the field is empty or not. 498 // This may be used to include empty fields in Patch requests. 499 ForceSendFields []string `json:"-"` 500 501 // NullFields is a list of field names (e.g. "ObjectSizeBytes") to 502 // include in API requests with the JSON null value. By default, fields 503 // with empty values are omitted from API requests. However, any field 504 // with an empty value appearing in NullFields will be sent to the 505 // server as null. It is an error if a field in this list has a 506 // non-empty value. This may be used to include null fields in Patch 507 // requests. 508 NullFields []string `json:"-"` 509} 510 511func (s *GdataDiffVersionResponse) MarshalJSON() ([]byte, error) { 512 type NoMethod GdataDiffVersionResponse 513 raw := NoMethod(*s) 514 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 515} 516 517// GdataDownloadParameters: gdata 518type GdataDownloadParameters struct { 519 // AllowGzipCompression: gdata 520 AllowGzipCompression bool `json:"allowGzipCompression,omitempty"` 521 522 // IgnoreRange: gdata 523 IgnoreRange bool `json:"ignoreRange,omitempty"` 524 525 // ForceSendFields is a list of field names (e.g. 526 // "AllowGzipCompression") to unconditionally include in API requests. 527 // By default, fields with empty or default values are omitted from API 528 // requests. However, any non-pointer, non-interface field appearing in 529 // ForceSendFields will be sent to the server regardless of whether the 530 // field is empty or not. This may be used to include empty fields in 531 // Patch requests. 532 ForceSendFields []string `json:"-"` 533 534 // NullFields is a list of field names (e.g. "AllowGzipCompression") to 535 // include in API requests with the JSON null value. By default, fields 536 // with empty values are omitted from API requests. However, any field 537 // with an empty value appearing in NullFields will be sent to the 538 // server as null. It is an error if a field in this list has a 539 // non-empty value. This may be used to include null fields in Patch 540 // requests. 541 NullFields []string `json:"-"` 542} 543 544func (s *GdataDownloadParameters) MarshalJSON() ([]byte, error) { 545 type NoMethod GdataDownloadParameters 546 raw := NoMethod(*s) 547 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 548} 549 550// GdataMedia: gdata 551type GdataMedia struct { 552 // Algorithm: gdata 553 Algorithm string `json:"algorithm,omitempty"` 554 555 // BigstoreObjectRef: gdata 556 BigstoreObjectRef string `json:"bigstoreObjectRef,omitempty"` 557 558 // BlobRef: gdata 559 BlobRef string `json:"blobRef,omitempty"` 560 561 // Blobstore2Info: gdata 562 Blobstore2Info *GdataBlobstore2Info `json:"blobstore2Info,omitempty"` 563 564 // CompositeMedia: gdata 565 CompositeMedia []*GdataCompositeMedia `json:"compositeMedia,omitempty"` 566 567 // ContentType: gdata 568 ContentType string `json:"contentType,omitempty"` 569 570 // ContentTypeInfo: gdata 571 ContentTypeInfo *GdataContentTypeInfo `json:"contentTypeInfo,omitempty"` 572 573 // CosmoBinaryReference: gdata 574 CosmoBinaryReference string `json:"cosmoBinaryReference,omitempty"` 575 576 // Crc32cHash: gdata 577 Crc32cHash int64 `json:"crc32cHash,omitempty"` 578 579 // DiffChecksumsResponse: gdata 580 DiffChecksumsResponse *GdataDiffChecksumsResponse `json:"diffChecksumsResponse,omitempty"` 581 582 // DiffDownloadResponse: gdata 583 DiffDownloadResponse *GdataDiffDownloadResponse `json:"diffDownloadResponse,omitempty"` 584 585 // DiffUploadRequest: gdata 586 DiffUploadRequest *GdataDiffUploadRequest `json:"diffUploadRequest,omitempty"` 587 588 // DiffUploadResponse: gdata 589 DiffUploadResponse *GdataDiffUploadResponse `json:"diffUploadResponse,omitempty"` 590 591 // DiffVersionResponse: gdata 592 DiffVersionResponse *GdataDiffVersionResponse `json:"diffVersionResponse,omitempty"` 593 594 // DownloadParameters: gdata 595 DownloadParameters *GdataDownloadParameters `json:"downloadParameters,omitempty"` 596 597 // Filename: gdata 598 Filename string `json:"filename,omitempty"` 599 600 // Hash: gdata 601 Hash string `json:"hash,omitempty"` 602 603 // HashVerified: gdata 604 HashVerified bool `json:"hashVerified,omitempty"` 605 606 // Inline: gdata 607 Inline string `json:"inline,omitempty"` 608 609 // IsPotentialRetry: gdata 610 IsPotentialRetry bool `json:"isPotentialRetry,omitempty"` 611 612 // Length: gdata 613 Length int64 `json:"length,omitempty,string"` 614 615 // Md5Hash: gdata 616 Md5Hash string `json:"md5Hash,omitempty"` 617 618 // MediaId: gdata 619 MediaId string `json:"mediaId,omitempty"` 620 621 // ObjectId: gdata 622 ObjectId *GdataObjectId `json:"objectId,omitempty"` 623 624 // Path: gdata 625 Path string `json:"path,omitempty"` 626 627 // ReferenceType: gdata 628 // 629 // Possible values: 630 // "PATH" - gdata 631 // "BLOB_REF" - gdata 632 // "INLINE" - gdata 633 // "GET_MEDIA" - gdata 634 // "COMPOSITE_MEDIA" - gdata 635 // "BIGSTORE_REF" - gdata 636 // "DIFF_VERSION_RESPONSE" - gdata 637 // "DIFF_CHECKSUMS_RESPONSE" - gdata 638 // "DIFF_DOWNLOAD_RESPONSE" - gdata 639 // "DIFF_UPLOAD_REQUEST" - gdata 640 // "DIFF_UPLOAD_RESPONSE" - gdata 641 // "COSMO_BINARY_REFERENCE" - gdata 642 // "ARBITRARY_BYTES" - gdata 643 ReferenceType string `json:"referenceType,omitempty"` 644 645 // Sha1Hash: gdata 646 Sha1Hash string `json:"sha1Hash,omitempty"` 647 648 // Sha256Hash: gdata 649 Sha256Hash string `json:"sha256Hash,omitempty"` 650 651 // Timestamp: gdata 652 Timestamp uint64 `json:"timestamp,omitempty,string"` 653 654 // Token: gdata 655 Token string `json:"token,omitempty"` 656 657 // ServerResponse contains the HTTP response code and headers from the 658 // server. 659 googleapi.ServerResponse `json:"-"` 660 661 // ForceSendFields is a list of field names (e.g. "Algorithm") to 662 // unconditionally include in API requests. By default, fields with 663 // empty or default values are omitted from API requests. However, any 664 // non-pointer, non-interface field appearing in ForceSendFields will be 665 // sent to the server regardless of whether the field is empty or not. 666 // This may be used to include empty fields in Patch requests. 667 ForceSendFields []string `json:"-"` 668 669 // NullFields is a list of field names (e.g. "Algorithm") to include in 670 // API requests with the JSON null value. By default, fields with empty 671 // values are omitted from API requests. However, any field with an 672 // empty value appearing in NullFields will be sent to the server as 673 // null. It is an error if a field in this list has a non-empty value. 674 // This may be used to include null fields in Patch requests. 675 NullFields []string `json:"-"` 676} 677 678func (s *GdataMedia) MarshalJSON() ([]byte, error) { 679 type NoMethod GdataMedia 680 raw := NoMethod(*s) 681 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 682} 683 684// GdataObjectId: gdata 685type GdataObjectId struct { 686 // BucketName: gdata 687 BucketName string `json:"bucketName,omitempty"` 688 689 // Generation: gdata 690 Generation int64 `json:"generation,omitempty,string"` 691 692 // ObjectName: gdata 693 ObjectName string `json:"objectName,omitempty"` 694 695 // ForceSendFields is a list of field names (e.g. "BucketName") to 696 // unconditionally include in API requests. By default, fields with 697 // empty or default values are omitted from API requests. However, any 698 // non-pointer, non-interface field appearing in ForceSendFields will be 699 // sent to the server regardless of whether the field is empty or not. 700 // This may be used to include empty fields in Patch requests. 701 ForceSendFields []string `json:"-"` 702 703 // NullFields is a list of field names (e.g. "BucketName") to include in 704 // API requests with the JSON null value. By default, fields with empty 705 // values are omitted from API requests. However, any field with an 706 // empty value appearing in NullFields will be sent to the server as 707 // null. It is an error if a field in this list has a non-empty value. 708 // This may be used to include null fields in Patch requests. 709 NullFields []string `json:"-"` 710} 711 712func (s *GdataObjectId) MarshalJSON() ([]byte, error) { 713 type NoMethod GdataObjectId 714 raw := NoMethod(*s) 715 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 716} 717 718// Job: A job creating reports of a specific type. 719type Job struct { 720 // CreateTime: The creation date/time of the job. 721 CreateTime string `json:"createTime,omitempty"` 722 723 // ExpireTime: The date/time when this job will expire/expired. After a 724 // job expired, no new reports are generated. 725 ExpireTime string `json:"expireTime,omitempty"` 726 727 // Id: The server-generated ID of the job (max. 40 characters). 728 Id string `json:"id,omitempty"` 729 730 // Name: The name of the job (max. 100 characters). 731 Name string `json:"name,omitempty"` 732 733 // ReportTypeId: The type of reports this job creates. Corresponds to 734 // the ID of a ReportType. 735 ReportTypeId string `json:"reportTypeId,omitempty"` 736 737 // SystemManaged: True if this a system-managed job that cannot be 738 // modified by the user; otherwise false. 739 SystemManaged bool `json:"systemManaged,omitempty"` 740 741 // ServerResponse contains the HTTP response code and headers from the 742 // server. 743 googleapi.ServerResponse `json:"-"` 744 745 // ForceSendFields is a list of field names (e.g. "CreateTime") to 746 // unconditionally include in API requests. By default, fields with 747 // empty or default values are omitted from API requests. However, any 748 // non-pointer, non-interface field appearing in ForceSendFields will be 749 // sent to the server regardless of whether the field is empty or not. 750 // This may be used to include empty fields in Patch requests. 751 ForceSendFields []string `json:"-"` 752 753 // NullFields is a list of field names (e.g. "CreateTime") to include in 754 // API requests with the JSON null value. By default, fields with empty 755 // values are omitted from API requests. However, any field with an 756 // empty value appearing in NullFields will be sent to the server as 757 // null. It is an error if a field in this list has a non-empty value. 758 // This may be used to include null fields in Patch requests. 759 NullFields []string `json:"-"` 760} 761 762func (s *Job) MarshalJSON() ([]byte, error) { 763 type NoMethod Job 764 raw := NoMethod(*s) 765 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 766} 767 768// ListJobsResponse: Response message for ReportingService.ListJobs. 769type ListJobsResponse struct { 770 // Jobs: The list of jobs. 771 Jobs []*Job `json:"jobs,omitempty"` 772 773 // NextPageToken: A token to retrieve next page of results. Pass this 774 // value in the ListJobsRequest.page_token field in the subsequent call 775 // to `ListJobs` method to retrieve the next page of results. 776 NextPageToken string `json:"nextPageToken,omitempty"` 777 778 // ServerResponse contains the HTTP response code and headers from the 779 // server. 780 googleapi.ServerResponse `json:"-"` 781 782 // ForceSendFields is a list of field names (e.g. "Jobs") to 783 // unconditionally include in API requests. By default, fields with 784 // empty or default values are omitted from API requests. However, any 785 // non-pointer, non-interface field appearing in ForceSendFields will be 786 // sent to the server regardless of whether the field is empty or not. 787 // This may be used to include empty fields in Patch requests. 788 ForceSendFields []string `json:"-"` 789 790 // NullFields is a list of field names (e.g. "Jobs") to include in API 791 // requests with the JSON null value. By default, fields with empty 792 // values are omitted from API requests. However, any field with an 793 // empty value appearing in NullFields will be sent to the server as 794 // null. It is an error if a field in this list has a non-empty value. 795 // This may be used to include null fields in Patch requests. 796 NullFields []string `json:"-"` 797} 798 799func (s *ListJobsResponse) MarshalJSON() ([]byte, error) { 800 type NoMethod ListJobsResponse 801 raw := NoMethod(*s) 802 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 803} 804 805// ListReportTypesResponse: Response message for 806// ReportingService.ListReportTypes. 807type ListReportTypesResponse struct { 808 // NextPageToken: A token to retrieve next page of results. Pass this 809 // value in the ListReportTypesRequest.page_token field in the 810 // subsequent call to `ListReportTypes` method to retrieve the next page 811 // of results. 812 NextPageToken string `json:"nextPageToken,omitempty"` 813 814 // ReportTypes: The list of report types. 815 ReportTypes []*ReportType `json:"reportTypes,omitempty"` 816 817 // ServerResponse contains the HTTP response code and headers from the 818 // server. 819 googleapi.ServerResponse `json:"-"` 820 821 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 822 // unconditionally include in API requests. By default, fields with 823 // empty or default values are omitted from API requests. However, any 824 // non-pointer, non-interface field appearing in ForceSendFields will be 825 // sent to the server regardless of whether the field is empty or not. 826 // This may be used to include empty fields in Patch requests. 827 ForceSendFields []string `json:"-"` 828 829 // NullFields is a list of field names (e.g. "NextPageToken") to include 830 // in API requests with the JSON null value. By default, fields with 831 // empty values are omitted from API requests. However, any field with 832 // an empty value appearing in NullFields will be sent to the server as 833 // null. It is an error if a field in this list has a non-empty value. 834 // This may be used to include null fields in Patch requests. 835 NullFields []string `json:"-"` 836} 837 838func (s *ListReportTypesResponse) MarshalJSON() ([]byte, error) { 839 type NoMethod ListReportTypesResponse 840 raw := NoMethod(*s) 841 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 842} 843 844// ListReportsResponse: Response message for 845// ReportingService.ListReports. 846type ListReportsResponse struct { 847 // NextPageToken: A token to retrieve next page of results. Pass this 848 // value in the ListReportsRequest.page_token field in the subsequent 849 // call to `ListReports` method to retrieve the next page of results. 850 NextPageToken string `json:"nextPageToken,omitempty"` 851 852 // Reports: The list of report types. 853 Reports []*Report `json:"reports,omitempty"` 854 855 // ServerResponse contains the HTTP response code and headers from the 856 // server. 857 googleapi.ServerResponse `json:"-"` 858 859 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 860 // unconditionally include in API requests. By default, fields with 861 // empty or default values are omitted from API requests. However, any 862 // non-pointer, non-interface field appearing in ForceSendFields will be 863 // sent to the server regardless of whether the field is empty or not. 864 // This may be used to include empty fields in Patch requests. 865 ForceSendFields []string `json:"-"` 866 867 // NullFields is a list of field names (e.g. "NextPageToken") to include 868 // in API requests with the JSON null value. By default, fields with 869 // empty values are omitted from API requests. However, any field with 870 // an empty value appearing in NullFields will be sent to the server as 871 // null. It is an error if a field in this list has a non-empty value. 872 // This may be used to include null fields in Patch requests. 873 NullFields []string `json:"-"` 874} 875 876func (s *ListReportsResponse) MarshalJSON() ([]byte, error) { 877 type NoMethod ListReportsResponse 878 raw := NoMethod(*s) 879 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 880} 881 882// Report: A report's metadata including the URL from which the report 883// itself can be downloaded. 884type Report struct { 885 // CreateTime: The date/time when this report was created. 886 CreateTime string `json:"createTime,omitempty"` 887 888 // DownloadUrl: The URL from which the report can be downloaded (max. 889 // 1000 characters). 890 DownloadUrl string `json:"downloadUrl,omitempty"` 891 892 // EndTime: The end of the time period that the report instance covers. 893 // The value is exclusive. 894 EndTime string `json:"endTime,omitempty"` 895 896 // Id: The server-generated ID of the report. 897 Id string `json:"id,omitempty"` 898 899 // JobExpireTime: The date/time when the job this report belongs to will 900 // expire/expired. 901 JobExpireTime string `json:"jobExpireTime,omitempty"` 902 903 // JobId: The ID of the job that created this report. 904 JobId string `json:"jobId,omitempty"` 905 906 // StartTime: The start of the time period that the report instance 907 // covers. The value is inclusive. 908 StartTime string `json:"startTime,omitempty"` 909 910 // ServerResponse contains the HTTP response code and headers from the 911 // server. 912 googleapi.ServerResponse `json:"-"` 913 914 // ForceSendFields is a list of field names (e.g. "CreateTime") to 915 // unconditionally include in API requests. By default, fields with 916 // empty or default values are omitted from API requests. However, any 917 // non-pointer, non-interface field appearing in ForceSendFields will be 918 // sent to the server regardless of whether the field is empty or not. 919 // This may be used to include empty fields in Patch requests. 920 ForceSendFields []string `json:"-"` 921 922 // NullFields is a list of field names (e.g. "CreateTime") to include in 923 // API requests with the JSON null value. By default, fields with empty 924 // values are omitted from API requests. However, any field with an 925 // empty value appearing in NullFields will be sent to the server as 926 // null. It is an error if a field in this list has a non-empty value. 927 // This may be used to include null fields in Patch requests. 928 NullFields []string `json:"-"` 929} 930 931func (s *Report) MarshalJSON() ([]byte, error) { 932 type NoMethod Report 933 raw := NoMethod(*s) 934 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 935} 936 937// ReportType: A report type. 938type ReportType struct { 939 // DeprecateTime: The date/time when this report type was/will be 940 // deprecated. 941 DeprecateTime string `json:"deprecateTime,omitempty"` 942 943 // Id: The ID of the report type (max. 100 characters). 944 Id string `json:"id,omitempty"` 945 946 // Name: The name of the report type (max. 100 characters). 947 Name string `json:"name,omitempty"` 948 949 // SystemManaged: True if this a system-managed report type; otherwise 950 // false. Reporting jobs for system-managed report types are created 951 // automatically and can thus not be used in the `CreateJob` method. 952 SystemManaged bool `json:"systemManaged,omitempty"` 953 954 // ForceSendFields is a list of field names (e.g. "DeprecateTime") to 955 // unconditionally include in API requests. By default, fields with 956 // empty or default values are omitted from API requests. However, any 957 // non-pointer, non-interface field appearing in ForceSendFields will be 958 // sent to the server regardless of whether the field is empty or not. 959 // This may be used to include empty fields in Patch requests. 960 ForceSendFields []string `json:"-"` 961 962 // NullFields is a list of field names (e.g. "DeprecateTime") to include 963 // in API requests with the JSON null value. By default, fields with 964 // empty values are omitted from API requests. However, any field with 965 // an empty value appearing in NullFields will be sent to the server as 966 // null. It is an error if a field in this list has a non-empty value. 967 // This may be used to include null fields in Patch requests. 968 NullFields []string `json:"-"` 969} 970 971func (s *ReportType) MarshalJSON() ([]byte, error) { 972 type NoMethod ReportType 973 raw := NoMethod(*s) 974 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 975} 976 977// method id "youtubereporting.jobs.create": 978 979type JobsCreateCall struct { 980 s *Service 981 job *Job 982 urlParams_ gensupport.URLParams 983 ctx_ context.Context 984 header_ http.Header 985} 986 987// Create: Creates a job and returns it. 988func (r *JobsService) Create(job *Job) *JobsCreateCall { 989 c := &JobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 990 c.job = job 991 return c 992} 993 994// OnBehalfOfContentOwner sets the optional parameter 995// "onBehalfOfContentOwner": The content owner's external ID on which 996// behalf the user is acting on. If not set, the user is acting for 997// himself (his own channel). 998func (c *JobsCreateCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsCreateCall { 999 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1000 return c 1001} 1002 1003// Fields allows partial responses to be retrieved. See 1004// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1005// for more information. 1006func (c *JobsCreateCall) Fields(s ...googleapi.Field) *JobsCreateCall { 1007 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1008 return c 1009} 1010 1011// Context sets the context to be used in this call's Do method. Any 1012// pending HTTP request will be aborted if the provided context is 1013// canceled. 1014func (c *JobsCreateCall) Context(ctx context.Context) *JobsCreateCall { 1015 c.ctx_ = ctx 1016 return c 1017} 1018 1019// Header returns an http.Header that can be modified by the caller to 1020// add HTTP headers to the request. 1021func (c *JobsCreateCall) Header() http.Header { 1022 if c.header_ == nil { 1023 c.header_ = make(http.Header) 1024 } 1025 return c.header_ 1026} 1027 1028func (c *JobsCreateCall) doRequest(alt string) (*http.Response, error) { 1029 reqHeaders := make(http.Header) 1030 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1031 for k, v := range c.header_ { 1032 reqHeaders[k] = v 1033 } 1034 reqHeaders.Set("User-Agent", c.s.userAgent()) 1035 var body io.Reader = nil 1036 body, err := googleapi.WithoutDataWrapper.JSONReader(c.job) 1037 if err != nil { 1038 return nil, err 1039 } 1040 reqHeaders.Set("Content-Type", "application/json") 1041 c.urlParams_.Set("alt", alt) 1042 c.urlParams_.Set("prettyPrint", "false") 1043 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs") 1044 urls += "?" + c.urlParams_.Encode() 1045 req, err := http.NewRequest("POST", urls, body) 1046 if err != nil { 1047 return nil, err 1048 } 1049 req.Header = reqHeaders 1050 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1051} 1052 1053// Do executes the "youtubereporting.jobs.create" call. 1054// Exactly one of *Job or error will be non-nil. Any non-2xx status code 1055// is an error. Response headers are in either 1056// *Job.ServerResponse.Header or (if a response was returned at all) in 1057// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1058// whether the returned error was because http.StatusNotModified was 1059// returned. 1060func (c *JobsCreateCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1061 gensupport.SetOptions(c.urlParams_, opts...) 1062 res, err := c.doRequest("json") 1063 if res != nil && res.StatusCode == http.StatusNotModified { 1064 if res.Body != nil { 1065 res.Body.Close() 1066 } 1067 return nil, &googleapi.Error{ 1068 Code: res.StatusCode, 1069 Header: res.Header, 1070 } 1071 } 1072 if err != nil { 1073 return nil, err 1074 } 1075 defer googleapi.CloseBody(res) 1076 if err := googleapi.CheckResponse(res); err != nil { 1077 return nil, err 1078 } 1079 ret := &Job{ 1080 ServerResponse: googleapi.ServerResponse{ 1081 Header: res.Header, 1082 HTTPStatusCode: res.StatusCode, 1083 }, 1084 } 1085 target := &ret 1086 if err := gensupport.DecodeResponse(target, res); err != nil { 1087 return nil, err 1088 } 1089 return ret, nil 1090 // { 1091 // "description": "Creates a job and returns it.", 1092 // "flatPath": "v1/jobs", 1093 // "httpMethod": "POST", 1094 // "id": "youtubereporting.jobs.create", 1095 // "parameterOrder": [], 1096 // "parameters": { 1097 // "onBehalfOfContentOwner": { 1098 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1099 // "location": "query", 1100 // "type": "string" 1101 // } 1102 // }, 1103 // "path": "v1/jobs", 1104 // "request": { 1105 // "$ref": "Job" 1106 // }, 1107 // "response": { 1108 // "$ref": "Job" 1109 // }, 1110 // "scopes": [ 1111 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 1112 // "https://www.googleapis.com/auth/yt-analytics.readonly" 1113 // ] 1114 // } 1115 1116} 1117 1118// method id "youtubereporting.jobs.delete": 1119 1120type JobsDeleteCall struct { 1121 s *Service 1122 jobId string 1123 urlParams_ gensupport.URLParams 1124 ctx_ context.Context 1125 header_ http.Header 1126} 1127 1128// Delete: Deletes a job. 1129// 1130// - jobId: The ID of the job to delete. 1131func (r *JobsService) Delete(jobId string) *JobsDeleteCall { 1132 c := &JobsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1133 c.jobId = jobId 1134 return c 1135} 1136 1137// OnBehalfOfContentOwner sets the optional parameter 1138// "onBehalfOfContentOwner": The content owner's external ID on which 1139// behalf the user is acting on. If not set, the user is acting for 1140// himself (his own channel). 1141func (c *JobsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsDeleteCall { 1142 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1143 return c 1144} 1145 1146// Fields allows partial responses to be retrieved. See 1147// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1148// for more information. 1149func (c *JobsDeleteCall) Fields(s ...googleapi.Field) *JobsDeleteCall { 1150 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1151 return c 1152} 1153 1154// Context sets the context to be used in this call's Do method. Any 1155// pending HTTP request will be aborted if the provided context is 1156// canceled. 1157func (c *JobsDeleteCall) Context(ctx context.Context) *JobsDeleteCall { 1158 c.ctx_ = ctx 1159 return c 1160} 1161 1162// Header returns an http.Header that can be modified by the caller to 1163// add HTTP headers to the request. 1164func (c *JobsDeleteCall) Header() http.Header { 1165 if c.header_ == nil { 1166 c.header_ = make(http.Header) 1167 } 1168 return c.header_ 1169} 1170 1171func (c *JobsDeleteCall) doRequest(alt string) (*http.Response, error) { 1172 reqHeaders := make(http.Header) 1173 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1174 for k, v := range c.header_ { 1175 reqHeaders[k] = v 1176 } 1177 reqHeaders.Set("User-Agent", c.s.userAgent()) 1178 var body io.Reader = nil 1179 c.urlParams_.Set("alt", alt) 1180 c.urlParams_.Set("prettyPrint", "false") 1181 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}") 1182 urls += "?" + c.urlParams_.Encode() 1183 req, err := http.NewRequest("DELETE", urls, body) 1184 if err != nil { 1185 return nil, err 1186 } 1187 req.Header = reqHeaders 1188 googleapi.Expand(req.URL, map[string]string{ 1189 "jobId": c.jobId, 1190 }) 1191 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1192} 1193 1194// Do executes the "youtubereporting.jobs.delete" call. 1195// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1196// code is an error. Response headers are in either 1197// *Empty.ServerResponse.Header or (if a response was returned at all) 1198// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1199// check whether the returned error was because http.StatusNotModified 1200// was returned. 1201func (c *JobsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1202 gensupport.SetOptions(c.urlParams_, opts...) 1203 res, err := c.doRequest("json") 1204 if res != nil && res.StatusCode == http.StatusNotModified { 1205 if res.Body != nil { 1206 res.Body.Close() 1207 } 1208 return nil, &googleapi.Error{ 1209 Code: res.StatusCode, 1210 Header: res.Header, 1211 } 1212 } 1213 if err != nil { 1214 return nil, err 1215 } 1216 defer googleapi.CloseBody(res) 1217 if err := googleapi.CheckResponse(res); err != nil { 1218 return nil, err 1219 } 1220 ret := &Empty{ 1221 ServerResponse: googleapi.ServerResponse{ 1222 Header: res.Header, 1223 HTTPStatusCode: res.StatusCode, 1224 }, 1225 } 1226 target := &ret 1227 if err := gensupport.DecodeResponse(target, res); err != nil { 1228 return nil, err 1229 } 1230 return ret, nil 1231 // { 1232 // "description": "Deletes a job.", 1233 // "flatPath": "v1/jobs/{jobId}", 1234 // "httpMethod": "DELETE", 1235 // "id": "youtubereporting.jobs.delete", 1236 // "parameterOrder": [ 1237 // "jobId" 1238 // ], 1239 // "parameters": { 1240 // "jobId": { 1241 // "description": "The ID of the job to delete.", 1242 // "location": "path", 1243 // "required": true, 1244 // "type": "string" 1245 // }, 1246 // "onBehalfOfContentOwner": { 1247 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1248 // "location": "query", 1249 // "type": "string" 1250 // } 1251 // }, 1252 // "path": "v1/jobs/{jobId}", 1253 // "response": { 1254 // "$ref": "Empty" 1255 // }, 1256 // "scopes": [ 1257 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 1258 // "https://www.googleapis.com/auth/yt-analytics.readonly" 1259 // ] 1260 // } 1261 1262} 1263 1264// method id "youtubereporting.jobs.get": 1265 1266type JobsGetCall struct { 1267 s *Service 1268 jobId string 1269 urlParams_ gensupport.URLParams 1270 ifNoneMatch_ string 1271 ctx_ context.Context 1272 header_ http.Header 1273} 1274 1275// Get: Gets a job. 1276// 1277// - jobId: The ID of the job to retrieve. 1278func (r *JobsService) Get(jobId string) *JobsGetCall { 1279 c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1280 c.jobId = jobId 1281 return c 1282} 1283 1284// OnBehalfOfContentOwner sets the optional parameter 1285// "onBehalfOfContentOwner": The content owner's external ID on which 1286// behalf the user is acting on. If not set, the user is acting for 1287// himself (his own channel). 1288func (c *JobsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsGetCall { 1289 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1290 return c 1291} 1292 1293// Fields allows partial responses to be retrieved. See 1294// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1295// for more information. 1296func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall { 1297 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1298 return c 1299} 1300 1301// IfNoneMatch sets the optional parameter which makes the operation 1302// fail if the object's ETag matches the given value. This is useful for 1303// getting updates only after the object has changed since the last 1304// request. Use googleapi.IsNotModified to check whether the response 1305// error from Do is the result of In-None-Match. 1306func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall { 1307 c.ifNoneMatch_ = entityTag 1308 return c 1309} 1310 1311// Context sets the context to be used in this call's Do method. Any 1312// pending HTTP request will be aborted if the provided context is 1313// canceled. 1314func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall { 1315 c.ctx_ = ctx 1316 return c 1317} 1318 1319// Header returns an http.Header that can be modified by the caller to 1320// add HTTP headers to the request. 1321func (c *JobsGetCall) Header() http.Header { 1322 if c.header_ == nil { 1323 c.header_ = make(http.Header) 1324 } 1325 return c.header_ 1326} 1327 1328func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) { 1329 reqHeaders := make(http.Header) 1330 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1331 for k, v := range c.header_ { 1332 reqHeaders[k] = v 1333 } 1334 reqHeaders.Set("User-Agent", c.s.userAgent()) 1335 if c.ifNoneMatch_ != "" { 1336 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1337 } 1338 var body io.Reader = nil 1339 c.urlParams_.Set("alt", alt) 1340 c.urlParams_.Set("prettyPrint", "false") 1341 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}") 1342 urls += "?" + c.urlParams_.Encode() 1343 req, err := http.NewRequest("GET", urls, body) 1344 if err != nil { 1345 return nil, err 1346 } 1347 req.Header = reqHeaders 1348 googleapi.Expand(req.URL, map[string]string{ 1349 "jobId": c.jobId, 1350 }) 1351 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1352} 1353 1354// Do executes the "youtubereporting.jobs.get" call. 1355// Exactly one of *Job or error will be non-nil. Any non-2xx status code 1356// is an error. Response headers are in either 1357// *Job.ServerResponse.Header or (if a response was returned at all) in 1358// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1359// whether the returned error was because http.StatusNotModified was 1360// returned. 1361func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) { 1362 gensupport.SetOptions(c.urlParams_, opts...) 1363 res, err := c.doRequest("json") 1364 if res != nil && res.StatusCode == http.StatusNotModified { 1365 if res.Body != nil { 1366 res.Body.Close() 1367 } 1368 return nil, &googleapi.Error{ 1369 Code: res.StatusCode, 1370 Header: res.Header, 1371 } 1372 } 1373 if err != nil { 1374 return nil, err 1375 } 1376 defer googleapi.CloseBody(res) 1377 if err := googleapi.CheckResponse(res); err != nil { 1378 return nil, err 1379 } 1380 ret := &Job{ 1381 ServerResponse: googleapi.ServerResponse{ 1382 Header: res.Header, 1383 HTTPStatusCode: res.StatusCode, 1384 }, 1385 } 1386 target := &ret 1387 if err := gensupport.DecodeResponse(target, res); err != nil { 1388 return nil, err 1389 } 1390 return ret, nil 1391 // { 1392 // "description": "Gets a job.", 1393 // "flatPath": "v1/jobs/{jobId}", 1394 // "httpMethod": "GET", 1395 // "id": "youtubereporting.jobs.get", 1396 // "parameterOrder": [ 1397 // "jobId" 1398 // ], 1399 // "parameters": { 1400 // "jobId": { 1401 // "description": "The ID of the job to retrieve.", 1402 // "location": "path", 1403 // "required": true, 1404 // "type": "string" 1405 // }, 1406 // "onBehalfOfContentOwner": { 1407 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1408 // "location": "query", 1409 // "type": "string" 1410 // } 1411 // }, 1412 // "path": "v1/jobs/{jobId}", 1413 // "response": { 1414 // "$ref": "Job" 1415 // }, 1416 // "scopes": [ 1417 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 1418 // "https://www.googleapis.com/auth/yt-analytics.readonly" 1419 // ] 1420 // } 1421 1422} 1423 1424// method id "youtubereporting.jobs.list": 1425 1426type JobsListCall struct { 1427 s *Service 1428 urlParams_ gensupport.URLParams 1429 ifNoneMatch_ string 1430 ctx_ context.Context 1431 header_ http.Header 1432} 1433 1434// List: Lists jobs. 1435func (r *JobsService) List() *JobsListCall { 1436 c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1437 return c 1438} 1439 1440// IncludeSystemManaged sets the optional parameter 1441// "includeSystemManaged": If set to true, also system-managed jobs will 1442// be returned; otherwise only user-created jobs will be returned. 1443// System-managed jobs can neither be modified nor deleted. 1444func (c *JobsListCall) IncludeSystemManaged(includeSystemManaged bool) *JobsListCall { 1445 c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged)) 1446 return c 1447} 1448 1449// OnBehalfOfContentOwner sets the optional parameter 1450// "onBehalfOfContentOwner": The content owner's external ID on which 1451// behalf the user is acting on. If not set, the user is acting for 1452// himself (his own channel). 1453func (c *JobsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsListCall { 1454 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1455 return c 1456} 1457 1458// PageSize sets the optional parameter "pageSize": Requested page size. 1459// Server may return fewer jobs than requested. If unspecified, server 1460// will pick an appropriate default. 1461func (c *JobsListCall) PageSize(pageSize int64) *JobsListCall { 1462 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1463 return c 1464} 1465 1466// PageToken sets the optional parameter "pageToken": A token 1467// identifying a page of results the server should return. Typically, 1468// this is the value of ListReportTypesResponse.next_page_token returned 1469// in response to the previous call to the `ListJobs` method. 1470func (c *JobsListCall) PageToken(pageToken string) *JobsListCall { 1471 c.urlParams_.Set("pageToken", pageToken) 1472 return c 1473} 1474 1475// Fields allows partial responses to be retrieved. See 1476// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1477// for more information. 1478func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall { 1479 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1480 return c 1481} 1482 1483// IfNoneMatch sets the optional parameter which makes the operation 1484// fail if the object's ETag matches the given value. This is useful for 1485// getting updates only after the object has changed since the last 1486// request. Use googleapi.IsNotModified to check whether the response 1487// error from Do is the result of In-None-Match. 1488func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall { 1489 c.ifNoneMatch_ = entityTag 1490 return c 1491} 1492 1493// Context sets the context to be used in this call's Do method. Any 1494// pending HTTP request will be aborted if the provided context is 1495// canceled. 1496func (c *JobsListCall) Context(ctx context.Context) *JobsListCall { 1497 c.ctx_ = ctx 1498 return c 1499} 1500 1501// Header returns an http.Header that can be modified by the caller to 1502// add HTTP headers to the request. 1503func (c *JobsListCall) Header() http.Header { 1504 if c.header_ == nil { 1505 c.header_ = make(http.Header) 1506 } 1507 return c.header_ 1508} 1509 1510func (c *JobsListCall) doRequest(alt string) (*http.Response, error) { 1511 reqHeaders := make(http.Header) 1512 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1513 for k, v := range c.header_ { 1514 reqHeaders[k] = v 1515 } 1516 reqHeaders.Set("User-Agent", c.s.userAgent()) 1517 if c.ifNoneMatch_ != "" { 1518 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1519 } 1520 var body io.Reader = nil 1521 c.urlParams_.Set("alt", alt) 1522 c.urlParams_.Set("prettyPrint", "false") 1523 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs") 1524 urls += "?" + c.urlParams_.Encode() 1525 req, err := http.NewRequest("GET", urls, body) 1526 if err != nil { 1527 return nil, err 1528 } 1529 req.Header = reqHeaders 1530 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1531} 1532 1533// Do executes the "youtubereporting.jobs.list" call. 1534// Exactly one of *ListJobsResponse or error will be non-nil. Any 1535// non-2xx status code is an error. Response headers are in either 1536// *ListJobsResponse.ServerResponse.Header or (if a response was 1537// returned at all) in error.(*googleapi.Error).Header. Use 1538// googleapi.IsNotModified to check whether the returned error was 1539// because http.StatusNotModified was returned. 1540func (c *JobsListCall) Do(opts ...googleapi.CallOption) (*ListJobsResponse, error) { 1541 gensupport.SetOptions(c.urlParams_, opts...) 1542 res, err := c.doRequest("json") 1543 if res != nil && res.StatusCode == http.StatusNotModified { 1544 if res.Body != nil { 1545 res.Body.Close() 1546 } 1547 return nil, &googleapi.Error{ 1548 Code: res.StatusCode, 1549 Header: res.Header, 1550 } 1551 } 1552 if err != nil { 1553 return nil, err 1554 } 1555 defer googleapi.CloseBody(res) 1556 if err := googleapi.CheckResponse(res); err != nil { 1557 return nil, err 1558 } 1559 ret := &ListJobsResponse{ 1560 ServerResponse: googleapi.ServerResponse{ 1561 Header: res.Header, 1562 HTTPStatusCode: res.StatusCode, 1563 }, 1564 } 1565 target := &ret 1566 if err := gensupport.DecodeResponse(target, res); err != nil { 1567 return nil, err 1568 } 1569 return ret, nil 1570 // { 1571 // "description": "Lists jobs.", 1572 // "flatPath": "v1/jobs", 1573 // "httpMethod": "GET", 1574 // "id": "youtubereporting.jobs.list", 1575 // "parameterOrder": [], 1576 // "parameters": { 1577 // "includeSystemManaged": { 1578 // "description": "If set to true, also system-managed jobs will be returned; otherwise only user-created jobs will be returned. System-managed jobs can neither be modified nor deleted.", 1579 // "location": "query", 1580 // "type": "boolean" 1581 // }, 1582 // "onBehalfOfContentOwner": { 1583 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1584 // "location": "query", 1585 // "type": "string" 1586 // }, 1587 // "pageSize": { 1588 // "description": "Requested page size. Server may return fewer jobs than requested. If unspecified, server will pick an appropriate default.", 1589 // "format": "int32", 1590 // "location": "query", 1591 // "type": "integer" 1592 // }, 1593 // "pageToken": { 1594 // "description": "A token identifying a page of results the server should return. Typically, this is the value of ListReportTypesResponse.next_page_token returned in response to the previous call to the `ListJobs` method.", 1595 // "location": "query", 1596 // "type": "string" 1597 // } 1598 // }, 1599 // "path": "v1/jobs", 1600 // "response": { 1601 // "$ref": "ListJobsResponse" 1602 // }, 1603 // "scopes": [ 1604 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 1605 // "https://www.googleapis.com/auth/yt-analytics.readonly" 1606 // ] 1607 // } 1608 1609} 1610 1611// Pages invokes f for each page of results. 1612// A non-nil error returned from f will halt the iteration. 1613// The provided context supersedes any context provided to the Context method. 1614func (c *JobsListCall) Pages(ctx context.Context, f func(*ListJobsResponse) error) error { 1615 c.ctx_ = ctx 1616 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1617 for { 1618 x, err := c.Do() 1619 if err != nil { 1620 return err 1621 } 1622 if err := f(x); err != nil { 1623 return err 1624 } 1625 if x.NextPageToken == "" { 1626 return nil 1627 } 1628 c.PageToken(x.NextPageToken) 1629 } 1630} 1631 1632// method id "youtubereporting.jobs.reports.get": 1633 1634type JobsReportsGetCall struct { 1635 s *Service 1636 jobId string 1637 reportId string 1638 urlParams_ gensupport.URLParams 1639 ifNoneMatch_ string 1640 ctx_ context.Context 1641 header_ http.Header 1642} 1643 1644// Get: Gets the metadata of a specific report. 1645// 1646// - jobId: The ID of the job. 1647// - reportId: The ID of the report to retrieve. 1648func (r *JobsReportsService) Get(jobId string, reportId string) *JobsReportsGetCall { 1649 c := &JobsReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1650 c.jobId = jobId 1651 c.reportId = reportId 1652 return c 1653} 1654 1655// OnBehalfOfContentOwner sets the optional parameter 1656// "onBehalfOfContentOwner": The content owner's external ID on which 1657// behalf the user is acting on. If not set, the user is acting for 1658// himself (his own channel). 1659func (c *JobsReportsGetCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsGetCall { 1660 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1661 return c 1662} 1663 1664// Fields allows partial responses to be retrieved. See 1665// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1666// for more information. 1667func (c *JobsReportsGetCall) Fields(s ...googleapi.Field) *JobsReportsGetCall { 1668 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1669 return c 1670} 1671 1672// IfNoneMatch sets the optional parameter which makes the operation 1673// fail if the object's ETag matches the given value. This is useful for 1674// getting updates only after the object has changed since the last 1675// request. Use googleapi.IsNotModified to check whether the response 1676// error from Do is the result of In-None-Match. 1677func (c *JobsReportsGetCall) IfNoneMatch(entityTag string) *JobsReportsGetCall { 1678 c.ifNoneMatch_ = entityTag 1679 return c 1680} 1681 1682// Context sets the context to be used in this call's Do method. Any 1683// pending HTTP request will be aborted if the provided context is 1684// canceled. 1685func (c *JobsReportsGetCall) Context(ctx context.Context) *JobsReportsGetCall { 1686 c.ctx_ = ctx 1687 return c 1688} 1689 1690// Header returns an http.Header that can be modified by the caller to 1691// add HTTP headers to the request. 1692func (c *JobsReportsGetCall) Header() http.Header { 1693 if c.header_ == nil { 1694 c.header_ = make(http.Header) 1695 } 1696 return c.header_ 1697} 1698 1699func (c *JobsReportsGetCall) doRequest(alt string) (*http.Response, error) { 1700 reqHeaders := make(http.Header) 1701 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1702 for k, v := range c.header_ { 1703 reqHeaders[k] = v 1704 } 1705 reqHeaders.Set("User-Agent", c.s.userAgent()) 1706 if c.ifNoneMatch_ != "" { 1707 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1708 } 1709 var body io.Reader = nil 1710 c.urlParams_.Set("alt", alt) 1711 c.urlParams_.Set("prettyPrint", "false") 1712 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports/{reportId}") 1713 urls += "?" + c.urlParams_.Encode() 1714 req, err := http.NewRequest("GET", urls, body) 1715 if err != nil { 1716 return nil, err 1717 } 1718 req.Header = reqHeaders 1719 googleapi.Expand(req.URL, map[string]string{ 1720 "jobId": c.jobId, 1721 "reportId": c.reportId, 1722 }) 1723 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1724} 1725 1726// Do executes the "youtubereporting.jobs.reports.get" call. 1727// Exactly one of *Report or error will be non-nil. Any non-2xx status 1728// code is an error. Response headers are in either 1729// *Report.ServerResponse.Header or (if a response was returned at all) 1730// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1731// check whether the returned error was because http.StatusNotModified 1732// was returned. 1733func (c *JobsReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) { 1734 gensupport.SetOptions(c.urlParams_, opts...) 1735 res, err := c.doRequest("json") 1736 if res != nil && res.StatusCode == http.StatusNotModified { 1737 if res.Body != nil { 1738 res.Body.Close() 1739 } 1740 return nil, &googleapi.Error{ 1741 Code: res.StatusCode, 1742 Header: res.Header, 1743 } 1744 } 1745 if err != nil { 1746 return nil, err 1747 } 1748 defer googleapi.CloseBody(res) 1749 if err := googleapi.CheckResponse(res); err != nil { 1750 return nil, err 1751 } 1752 ret := &Report{ 1753 ServerResponse: googleapi.ServerResponse{ 1754 Header: res.Header, 1755 HTTPStatusCode: res.StatusCode, 1756 }, 1757 } 1758 target := &ret 1759 if err := gensupport.DecodeResponse(target, res); err != nil { 1760 return nil, err 1761 } 1762 return ret, nil 1763 // { 1764 // "description": "Gets the metadata of a specific report.", 1765 // "flatPath": "v1/jobs/{jobId}/reports/{reportId}", 1766 // "httpMethod": "GET", 1767 // "id": "youtubereporting.jobs.reports.get", 1768 // "parameterOrder": [ 1769 // "jobId", 1770 // "reportId" 1771 // ], 1772 // "parameters": { 1773 // "jobId": { 1774 // "description": "The ID of the job.", 1775 // "location": "path", 1776 // "required": true, 1777 // "type": "string" 1778 // }, 1779 // "onBehalfOfContentOwner": { 1780 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1781 // "location": "query", 1782 // "type": "string" 1783 // }, 1784 // "reportId": { 1785 // "description": "The ID of the report to retrieve.", 1786 // "location": "path", 1787 // "required": true, 1788 // "type": "string" 1789 // } 1790 // }, 1791 // "path": "v1/jobs/{jobId}/reports/{reportId}", 1792 // "response": { 1793 // "$ref": "Report" 1794 // }, 1795 // "scopes": [ 1796 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 1797 // "https://www.googleapis.com/auth/yt-analytics.readonly" 1798 // ] 1799 // } 1800 1801} 1802 1803// method id "youtubereporting.jobs.reports.list": 1804 1805type JobsReportsListCall struct { 1806 s *Service 1807 jobId string 1808 urlParams_ gensupport.URLParams 1809 ifNoneMatch_ string 1810 ctx_ context.Context 1811 header_ http.Header 1812} 1813 1814// List: Lists reports created by a specific job. Returns NOT_FOUND if 1815// the job does not exist. 1816// 1817// - jobId: The ID of the job. 1818func (r *JobsReportsService) List(jobId string) *JobsReportsListCall { 1819 c := &JobsReportsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1820 c.jobId = jobId 1821 return c 1822} 1823 1824// CreatedAfter sets the optional parameter "createdAfter": If set, only 1825// reports created after the specified date/time are returned. 1826func (c *JobsReportsListCall) CreatedAfter(createdAfter string) *JobsReportsListCall { 1827 c.urlParams_.Set("createdAfter", createdAfter) 1828 return c 1829} 1830 1831// OnBehalfOfContentOwner sets the optional parameter 1832// "onBehalfOfContentOwner": The content owner's external ID on which 1833// behalf the user is acting on. If not set, the user is acting for 1834// himself (his own channel). 1835func (c *JobsReportsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *JobsReportsListCall { 1836 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 1837 return c 1838} 1839 1840// PageSize sets the optional parameter "pageSize": Requested page size. 1841// Server may return fewer report types than requested. If unspecified, 1842// server will pick an appropriate default. 1843func (c *JobsReportsListCall) PageSize(pageSize int64) *JobsReportsListCall { 1844 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1845 return c 1846} 1847 1848// PageToken sets the optional parameter "pageToken": A token 1849// identifying a page of results the server should return. Typically, 1850// this is the value of ListReportsResponse.next_page_token returned in 1851// response to the previous call to the `ListReports` method. 1852func (c *JobsReportsListCall) PageToken(pageToken string) *JobsReportsListCall { 1853 c.urlParams_.Set("pageToken", pageToken) 1854 return c 1855} 1856 1857// StartTimeAtOrAfter sets the optional parameter "startTimeAtOrAfter": 1858// If set, only reports whose start time is greater than or equal the 1859// specified date/time are returned. 1860func (c *JobsReportsListCall) StartTimeAtOrAfter(startTimeAtOrAfter string) *JobsReportsListCall { 1861 c.urlParams_.Set("startTimeAtOrAfter", startTimeAtOrAfter) 1862 return c 1863} 1864 1865// StartTimeBefore sets the optional parameter "startTimeBefore": If 1866// set, only reports whose start time is smaller than the specified 1867// date/time are returned. 1868func (c *JobsReportsListCall) StartTimeBefore(startTimeBefore string) *JobsReportsListCall { 1869 c.urlParams_.Set("startTimeBefore", startTimeBefore) 1870 return c 1871} 1872 1873// Fields allows partial responses to be retrieved. See 1874// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1875// for more information. 1876func (c *JobsReportsListCall) Fields(s ...googleapi.Field) *JobsReportsListCall { 1877 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1878 return c 1879} 1880 1881// IfNoneMatch sets the optional parameter which makes the operation 1882// fail if the object's ETag matches the given value. This is useful for 1883// getting updates only after the object has changed since the last 1884// request. Use googleapi.IsNotModified to check whether the response 1885// error from Do is the result of In-None-Match. 1886func (c *JobsReportsListCall) IfNoneMatch(entityTag string) *JobsReportsListCall { 1887 c.ifNoneMatch_ = entityTag 1888 return c 1889} 1890 1891// Context sets the context to be used in this call's Do method. Any 1892// pending HTTP request will be aborted if the provided context is 1893// canceled. 1894func (c *JobsReportsListCall) Context(ctx context.Context) *JobsReportsListCall { 1895 c.ctx_ = ctx 1896 return c 1897} 1898 1899// Header returns an http.Header that can be modified by the caller to 1900// add HTTP headers to the request. 1901func (c *JobsReportsListCall) Header() http.Header { 1902 if c.header_ == nil { 1903 c.header_ = make(http.Header) 1904 } 1905 return c.header_ 1906} 1907 1908func (c *JobsReportsListCall) doRequest(alt string) (*http.Response, error) { 1909 reqHeaders := make(http.Header) 1910 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1911 for k, v := range c.header_ { 1912 reqHeaders[k] = v 1913 } 1914 reqHeaders.Set("User-Agent", c.s.userAgent()) 1915 if c.ifNoneMatch_ != "" { 1916 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1917 } 1918 var body io.Reader = nil 1919 c.urlParams_.Set("alt", alt) 1920 c.urlParams_.Set("prettyPrint", "false") 1921 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports") 1922 urls += "?" + c.urlParams_.Encode() 1923 req, err := http.NewRequest("GET", urls, body) 1924 if err != nil { 1925 return nil, err 1926 } 1927 req.Header = reqHeaders 1928 googleapi.Expand(req.URL, map[string]string{ 1929 "jobId": c.jobId, 1930 }) 1931 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1932} 1933 1934// Do executes the "youtubereporting.jobs.reports.list" call. 1935// Exactly one of *ListReportsResponse or error will be non-nil. Any 1936// non-2xx status code is an error. Response headers are in either 1937// *ListReportsResponse.ServerResponse.Header or (if a response was 1938// returned at all) in error.(*googleapi.Error).Header. Use 1939// googleapi.IsNotModified to check whether the returned error was 1940// because http.StatusNotModified was returned. 1941func (c *JobsReportsListCall) Do(opts ...googleapi.CallOption) (*ListReportsResponse, error) { 1942 gensupport.SetOptions(c.urlParams_, opts...) 1943 res, err := c.doRequest("json") 1944 if res != nil && res.StatusCode == http.StatusNotModified { 1945 if res.Body != nil { 1946 res.Body.Close() 1947 } 1948 return nil, &googleapi.Error{ 1949 Code: res.StatusCode, 1950 Header: res.Header, 1951 } 1952 } 1953 if err != nil { 1954 return nil, err 1955 } 1956 defer googleapi.CloseBody(res) 1957 if err := googleapi.CheckResponse(res); err != nil { 1958 return nil, err 1959 } 1960 ret := &ListReportsResponse{ 1961 ServerResponse: googleapi.ServerResponse{ 1962 Header: res.Header, 1963 HTTPStatusCode: res.StatusCode, 1964 }, 1965 } 1966 target := &ret 1967 if err := gensupport.DecodeResponse(target, res); err != nil { 1968 return nil, err 1969 } 1970 return ret, nil 1971 // { 1972 // "description": "Lists reports created by a specific job. Returns NOT_FOUND if the job does not exist.", 1973 // "flatPath": "v1/jobs/{jobId}/reports", 1974 // "httpMethod": "GET", 1975 // "id": "youtubereporting.jobs.reports.list", 1976 // "parameterOrder": [ 1977 // "jobId" 1978 // ], 1979 // "parameters": { 1980 // "createdAfter": { 1981 // "description": "If set, only reports created after the specified date/time are returned.", 1982 // "format": "google-datetime", 1983 // "location": "query", 1984 // "type": "string" 1985 // }, 1986 // "jobId": { 1987 // "description": "The ID of the job.", 1988 // "location": "path", 1989 // "required": true, 1990 // "type": "string" 1991 // }, 1992 // "onBehalfOfContentOwner": { 1993 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 1994 // "location": "query", 1995 // "type": "string" 1996 // }, 1997 // "pageSize": { 1998 // "description": "Requested page size. Server may return fewer report types than requested. If unspecified, server will pick an appropriate default.", 1999 // "format": "int32", 2000 // "location": "query", 2001 // "type": "integer" 2002 // }, 2003 // "pageToken": { 2004 // "description": "A token identifying a page of results the server should return. Typically, this is the value of ListReportsResponse.next_page_token returned in response to the previous call to the `ListReports` method.", 2005 // "location": "query", 2006 // "type": "string" 2007 // }, 2008 // "startTimeAtOrAfter": { 2009 // "description": "If set, only reports whose start time is greater than or equal the specified date/time are returned.", 2010 // "format": "google-datetime", 2011 // "location": "query", 2012 // "type": "string" 2013 // }, 2014 // "startTimeBefore": { 2015 // "description": "If set, only reports whose start time is smaller than the specified date/time are returned.", 2016 // "format": "google-datetime", 2017 // "location": "query", 2018 // "type": "string" 2019 // } 2020 // }, 2021 // "path": "v1/jobs/{jobId}/reports", 2022 // "response": { 2023 // "$ref": "ListReportsResponse" 2024 // }, 2025 // "scopes": [ 2026 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 2027 // "https://www.googleapis.com/auth/yt-analytics.readonly" 2028 // ] 2029 // } 2030 2031} 2032 2033// Pages invokes f for each page of results. 2034// A non-nil error returned from f will halt the iteration. 2035// The provided context supersedes any context provided to the Context method. 2036func (c *JobsReportsListCall) Pages(ctx context.Context, f func(*ListReportsResponse) error) error { 2037 c.ctx_ = ctx 2038 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2039 for { 2040 x, err := c.Do() 2041 if err != nil { 2042 return err 2043 } 2044 if err := f(x); err != nil { 2045 return err 2046 } 2047 if x.NextPageToken == "" { 2048 return nil 2049 } 2050 c.PageToken(x.NextPageToken) 2051 } 2052} 2053 2054// method id "youtubereporting.media.download": 2055 2056type MediaDownloadCall struct { 2057 s *Service 2058 resourceName string 2059 urlParams_ gensupport.URLParams 2060 ifNoneMatch_ string 2061 ctx_ context.Context 2062 header_ http.Header 2063} 2064 2065// Download: Method for media download. Download is supported on the URI 2066// `/v1/media/{+name}?alt=media`. 2067// 2068// - resourceName: Name of the media that is being downloaded. 2069func (r *MediaService) Download(resourceName string) *MediaDownloadCall { 2070 c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2071 c.resourceName = resourceName 2072 return c 2073} 2074 2075// Fields allows partial responses to be retrieved. See 2076// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2077// for more information. 2078func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall { 2079 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2080 return c 2081} 2082 2083// IfNoneMatch sets the optional parameter which makes the operation 2084// fail if the object's ETag matches the given value. This is useful for 2085// getting updates only after the object has changed since the last 2086// request. Use googleapi.IsNotModified to check whether the response 2087// error from Do is the result of In-None-Match. 2088func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall { 2089 c.ifNoneMatch_ = entityTag 2090 return c 2091} 2092 2093// Context sets the context to be used in this call's Do and Download 2094// methods. Any pending HTTP request will be aborted if the provided 2095// context is canceled. 2096func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall { 2097 c.ctx_ = ctx 2098 return c 2099} 2100 2101// Header returns an http.Header that can be modified by the caller to 2102// add HTTP headers to the request. 2103func (c *MediaDownloadCall) Header() http.Header { 2104 if c.header_ == nil { 2105 c.header_ = make(http.Header) 2106 } 2107 return c.header_ 2108} 2109 2110func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) { 2111 reqHeaders := make(http.Header) 2112 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2113 for k, v := range c.header_ { 2114 reqHeaders[k] = v 2115 } 2116 reqHeaders.Set("User-Agent", c.s.userAgent()) 2117 if c.ifNoneMatch_ != "" { 2118 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2119 } 2120 var body io.Reader = nil 2121 c.urlParams_.Set("alt", alt) 2122 c.urlParams_.Set("prettyPrint", "false") 2123 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/media/{+resourceName}") 2124 urls += "?" + c.urlParams_.Encode() 2125 req, err := http.NewRequest("GET", urls, body) 2126 if err != nil { 2127 return nil, err 2128 } 2129 req.Header = reqHeaders 2130 googleapi.Expand(req.URL, map[string]string{ 2131 "resourceName": c.resourceName, 2132 }) 2133 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2134} 2135 2136// Download fetches the API endpoint's "media" value, instead of the normal 2137// API response value. If the returned error is nil, the Response is guaranteed to 2138// have a 2xx status code. Callers must close the Response.Body as usual. 2139func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 2140 gensupport.SetOptions(c.urlParams_, opts...) 2141 res, err := c.doRequest("media") 2142 if err != nil { 2143 return nil, err 2144 } 2145 if err := googleapi.CheckResponse(res); err != nil { 2146 res.Body.Close() 2147 return nil, err 2148 } 2149 return res, nil 2150} 2151 2152// Do executes the "youtubereporting.media.download" call. 2153// Exactly one of *GdataMedia or error will be non-nil. Any non-2xx 2154// status code is an error. Response headers are in either 2155// *GdataMedia.ServerResponse.Header or (if a response was returned at 2156// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2157// to check whether the returned error was because 2158// http.StatusNotModified was returned. 2159func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*GdataMedia, error) { 2160 gensupport.SetOptions(c.urlParams_, opts...) 2161 res, err := c.doRequest("json") 2162 if res != nil && res.StatusCode == http.StatusNotModified { 2163 if res.Body != nil { 2164 res.Body.Close() 2165 } 2166 return nil, &googleapi.Error{ 2167 Code: res.StatusCode, 2168 Header: res.Header, 2169 } 2170 } 2171 if err != nil { 2172 return nil, err 2173 } 2174 defer googleapi.CloseBody(res) 2175 if err := googleapi.CheckResponse(res); err != nil { 2176 return nil, err 2177 } 2178 ret := &GdataMedia{ 2179 ServerResponse: googleapi.ServerResponse{ 2180 Header: res.Header, 2181 HTTPStatusCode: res.StatusCode, 2182 }, 2183 } 2184 target := &ret 2185 if err := gensupport.DecodeResponse(target, res); err != nil { 2186 return nil, err 2187 } 2188 return ret, nil 2189 // { 2190 // "description": "Method for media download. Download is supported on the URI `/v1/media/{+name}?alt=media`.", 2191 // "flatPath": "v1/media/{mediaId}", 2192 // "httpMethod": "GET", 2193 // "id": "youtubereporting.media.download", 2194 // "parameterOrder": [ 2195 // "resourceName" 2196 // ], 2197 // "parameters": { 2198 // "resourceName": { 2199 // "description": "Name of the media that is being downloaded.", 2200 // "location": "path", 2201 // "pattern": "^.*$", 2202 // "required": true, 2203 // "type": "string" 2204 // } 2205 // }, 2206 // "path": "v1/media/{+resourceName}", 2207 // "response": { 2208 // "$ref": "GdataMedia" 2209 // }, 2210 // "scopes": [ 2211 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 2212 // "https://www.googleapis.com/auth/yt-analytics.readonly" 2213 // ], 2214 // "supportsMediaDownload": true, 2215 // "useMediaDownloadService": true 2216 // } 2217 2218} 2219 2220// method id "youtubereporting.reportTypes.list": 2221 2222type ReportTypesListCall struct { 2223 s *Service 2224 urlParams_ gensupport.URLParams 2225 ifNoneMatch_ string 2226 ctx_ context.Context 2227 header_ http.Header 2228} 2229 2230// List: Lists report types. 2231func (r *ReportTypesService) List() *ReportTypesListCall { 2232 c := &ReportTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2233 return c 2234} 2235 2236// IncludeSystemManaged sets the optional parameter 2237// "includeSystemManaged": If set to true, also system-managed report 2238// types will be returned; otherwise only the report types that can be 2239// used to create new reporting jobs will be returned. 2240func (c *ReportTypesListCall) IncludeSystemManaged(includeSystemManaged bool) *ReportTypesListCall { 2241 c.urlParams_.Set("includeSystemManaged", fmt.Sprint(includeSystemManaged)) 2242 return c 2243} 2244 2245// OnBehalfOfContentOwner sets the optional parameter 2246// "onBehalfOfContentOwner": The content owner's external ID on which 2247// behalf the user is acting on. If not set, the user is acting for 2248// himself (his own channel). 2249func (c *ReportTypesListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *ReportTypesListCall { 2250 c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner) 2251 return c 2252} 2253 2254// PageSize sets the optional parameter "pageSize": Requested page size. 2255// Server may return fewer report types than requested. If unspecified, 2256// server will pick an appropriate default. 2257func (c *ReportTypesListCall) PageSize(pageSize int64) *ReportTypesListCall { 2258 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2259 return c 2260} 2261 2262// PageToken sets the optional parameter "pageToken": A token 2263// identifying a page of results the server should return. Typically, 2264// this is the value of ListReportTypesResponse.next_page_token returned 2265// in response to the previous call to the `ListReportTypes` method. 2266func (c *ReportTypesListCall) PageToken(pageToken string) *ReportTypesListCall { 2267 c.urlParams_.Set("pageToken", pageToken) 2268 return c 2269} 2270 2271// Fields allows partial responses to be retrieved. See 2272// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2273// for more information. 2274func (c *ReportTypesListCall) Fields(s ...googleapi.Field) *ReportTypesListCall { 2275 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2276 return c 2277} 2278 2279// IfNoneMatch sets the optional parameter which makes the operation 2280// fail if the object's ETag matches the given value. This is useful for 2281// getting updates only after the object has changed since the last 2282// request. Use googleapi.IsNotModified to check whether the response 2283// error from Do is the result of In-None-Match. 2284func (c *ReportTypesListCall) IfNoneMatch(entityTag string) *ReportTypesListCall { 2285 c.ifNoneMatch_ = entityTag 2286 return c 2287} 2288 2289// Context sets the context to be used in this call's Do method. Any 2290// pending HTTP request will be aborted if the provided context is 2291// canceled. 2292func (c *ReportTypesListCall) Context(ctx context.Context) *ReportTypesListCall { 2293 c.ctx_ = ctx 2294 return c 2295} 2296 2297// Header returns an http.Header that can be modified by the caller to 2298// add HTTP headers to the request. 2299func (c *ReportTypesListCall) Header() http.Header { 2300 if c.header_ == nil { 2301 c.header_ = make(http.Header) 2302 } 2303 return c.header_ 2304} 2305 2306func (c *ReportTypesListCall) doRequest(alt string) (*http.Response, error) { 2307 reqHeaders := make(http.Header) 2308 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2309 for k, v := range c.header_ { 2310 reqHeaders[k] = v 2311 } 2312 reqHeaders.Set("User-Agent", c.s.userAgent()) 2313 if c.ifNoneMatch_ != "" { 2314 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2315 } 2316 var body io.Reader = nil 2317 c.urlParams_.Set("alt", alt) 2318 c.urlParams_.Set("prettyPrint", "false") 2319 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/reportTypes") 2320 urls += "?" + c.urlParams_.Encode() 2321 req, err := http.NewRequest("GET", urls, body) 2322 if err != nil { 2323 return nil, err 2324 } 2325 req.Header = reqHeaders 2326 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2327} 2328 2329// Do executes the "youtubereporting.reportTypes.list" call. 2330// Exactly one of *ListReportTypesResponse or error will be non-nil. Any 2331// non-2xx status code is an error. Response headers are in either 2332// *ListReportTypesResponse.ServerResponse.Header or (if a response was 2333// returned at all) in error.(*googleapi.Error).Header. Use 2334// googleapi.IsNotModified to check whether the returned error was 2335// because http.StatusNotModified was returned. 2336func (c *ReportTypesListCall) Do(opts ...googleapi.CallOption) (*ListReportTypesResponse, error) { 2337 gensupport.SetOptions(c.urlParams_, opts...) 2338 res, err := c.doRequest("json") 2339 if res != nil && res.StatusCode == http.StatusNotModified { 2340 if res.Body != nil { 2341 res.Body.Close() 2342 } 2343 return nil, &googleapi.Error{ 2344 Code: res.StatusCode, 2345 Header: res.Header, 2346 } 2347 } 2348 if err != nil { 2349 return nil, err 2350 } 2351 defer googleapi.CloseBody(res) 2352 if err := googleapi.CheckResponse(res); err != nil { 2353 return nil, err 2354 } 2355 ret := &ListReportTypesResponse{ 2356 ServerResponse: googleapi.ServerResponse{ 2357 Header: res.Header, 2358 HTTPStatusCode: res.StatusCode, 2359 }, 2360 } 2361 target := &ret 2362 if err := gensupport.DecodeResponse(target, res); err != nil { 2363 return nil, err 2364 } 2365 return ret, nil 2366 // { 2367 // "description": "Lists report types.", 2368 // "flatPath": "v1/reportTypes", 2369 // "httpMethod": "GET", 2370 // "id": "youtubereporting.reportTypes.list", 2371 // "parameterOrder": [], 2372 // "parameters": { 2373 // "includeSystemManaged": { 2374 // "description": "If set to true, also system-managed report types will be returned; otherwise only the report types that can be used to create new reporting jobs will be returned.", 2375 // "location": "query", 2376 // "type": "boolean" 2377 // }, 2378 // "onBehalfOfContentOwner": { 2379 // "description": "The content owner's external ID on which behalf the user is acting on. If not set, the user is acting for himself (his own channel).", 2380 // "location": "query", 2381 // "type": "string" 2382 // }, 2383 // "pageSize": { 2384 // "description": "Requested page size. Server may return fewer report types than requested. If unspecified, server will pick an appropriate default.", 2385 // "format": "int32", 2386 // "location": "query", 2387 // "type": "integer" 2388 // }, 2389 // "pageToken": { 2390 // "description": "A token identifying a page of results the server should return. Typically, this is the value of ListReportTypesResponse.next_page_token returned in response to the previous call to the `ListReportTypes` method.", 2391 // "location": "query", 2392 // "type": "string" 2393 // } 2394 // }, 2395 // "path": "v1/reportTypes", 2396 // "response": { 2397 // "$ref": "ListReportTypesResponse" 2398 // }, 2399 // "scopes": [ 2400 // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", 2401 // "https://www.googleapis.com/auth/yt-analytics.readonly" 2402 // ] 2403 // } 2404 2405} 2406 2407// Pages invokes f for each page of results. 2408// A non-nil error returned from f will halt the iteration. 2409// The provided context supersedes any context provided to the Context method. 2410func (c *ReportTypesListCall) Pages(ctx context.Context, f func(*ListReportTypesResponse) error) error { 2411 c.ctx_ = ctx 2412 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2413 for { 2414 x, err := c.Do() 2415 if err != nil { 2416 return err 2417 } 2418 if err := f(x); err != nil { 2419 return err 2420 } 2421 if x.NextPageToken == "" { 2422 return nil 2423 } 2424 c.PageToken(x.NextPageToken) 2425 } 2426} 2427