You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2346 rivejä
78 KiB

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