Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

2439 řádky
81 KiB

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