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