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