Debian Codegraph @

youtubereporting/v1/youtubereporting-gen.go

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