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.
 
 
 

1855 lines
69 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package youtubeanalytics provides access to the YouTube Analytics API.
  6. //
  7. // For product documentation, see: http://developers.google.com/youtube/analytics/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/youtubeanalytics/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // youtubeanalyticsService, err := youtubeanalytics.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // youtubeanalyticsService, err := youtubeanalytics.NewService(ctx, option.WithScopes(youtubeanalytics.YtAnalyticsReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // youtubeanalyticsService, err := youtubeanalytics.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // youtubeanalyticsService, err := youtubeanalytics.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package youtubeanalytics // import "google.golang.org/api/youtubeanalytics/v1beta1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "youtubeAnalytics:v1beta1"
  71. const apiName = "youtubeAnalytics"
  72. const apiVersion = "v1beta1"
  73. const basePath = "https://www.googleapis.com/youtube/analytics/v1beta1/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // Manage your YouTube account
  77. YoutubeScope = "https://www.googleapis.com/auth/youtube"
  78. // View your YouTube account
  79. YoutubeReadonlyScope = "https://www.googleapis.com/auth/youtube.readonly"
  80. // View and manage your assets and associated content on YouTube
  81. YoutubepartnerScope = "https://www.googleapis.com/auth/youtubepartner"
  82. // View monetary and non-monetary YouTube Analytics reports for your
  83. // YouTube content
  84. YtAnalyticsMonetaryReadonlyScope = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly"
  85. // View YouTube Analytics reports for your YouTube content
  86. YtAnalyticsReadonlyScope = "https://www.googleapis.com/auth/yt-analytics.readonly"
  87. )
  88. // NewService creates a new Service.
  89. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  90. scopesOption := option.WithScopes(
  91. "https://www.googleapis.com/auth/youtube",
  92. "https://www.googleapis.com/auth/youtube.readonly",
  93. "https://www.googleapis.com/auth/youtubepartner",
  94. "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  95. "https://www.googleapis.com/auth/yt-analytics.readonly",
  96. )
  97. // NOTE: prepend, so we don't override user-specified scopes.
  98. opts = append([]option.ClientOption{scopesOption}, opts...)
  99. client, endpoint, err := htransport.NewClient(ctx, opts...)
  100. if err != nil {
  101. return nil, err
  102. }
  103. s, err := New(client)
  104. if err != nil {
  105. return nil, err
  106. }
  107. if endpoint != "" {
  108. s.BasePath = endpoint
  109. }
  110. return s, nil
  111. }
  112. // New creates a new Service. It uses the provided http.Client for requests.
  113. //
  114. // Deprecated: please use NewService instead.
  115. // To provide a custom HTTP client, use option.WithHTTPClient.
  116. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  117. func New(client *http.Client) (*Service, error) {
  118. if client == nil {
  119. return nil, errors.New("client is nil")
  120. }
  121. s := &Service{client: client, BasePath: basePath}
  122. s.GroupItems = NewGroupItemsService(s)
  123. s.Groups = NewGroupsService(s)
  124. s.Reports = NewReportsService(s)
  125. return s, nil
  126. }
  127. type Service struct {
  128. client *http.Client
  129. BasePath string // API endpoint base URL
  130. UserAgent string // optional additional User-Agent fragment
  131. GroupItems *GroupItemsService
  132. Groups *GroupsService
  133. Reports *ReportsService
  134. }
  135. func (s *Service) userAgent() string {
  136. if s.UserAgent == "" {
  137. return googleapi.UserAgent
  138. }
  139. return googleapi.UserAgent + " " + s.UserAgent
  140. }
  141. func NewGroupItemsService(s *Service) *GroupItemsService {
  142. rs := &GroupItemsService{s: s}
  143. return rs
  144. }
  145. type GroupItemsService struct {
  146. s *Service
  147. }
  148. func NewGroupsService(s *Service) *GroupsService {
  149. rs := &GroupsService{s: s}
  150. return rs
  151. }
  152. type GroupsService struct {
  153. s *Service
  154. }
  155. func NewReportsService(s *Service) *ReportsService {
  156. rs := &ReportsService{s: s}
  157. return rs
  158. }
  159. type ReportsService struct {
  160. s *Service
  161. }
  162. type Group struct {
  163. ContentDetails *GroupContentDetails `json:"contentDetails,omitempty"`
  164. Etag string `json:"etag,omitempty"`
  165. Id string `json:"id,omitempty"`
  166. Kind string `json:"kind,omitempty"`
  167. Snippet *GroupSnippet `json:"snippet,omitempty"`
  168. // ServerResponse contains the HTTP response code and headers from the
  169. // server.
  170. googleapi.ServerResponse `json:"-"`
  171. // ForceSendFields is a list of field names (e.g. "ContentDetails") to
  172. // unconditionally include in API requests. By default, fields with
  173. // empty values are omitted from API requests. However, any non-pointer,
  174. // non-interface field appearing in ForceSendFields will be sent to the
  175. // server regardless of whether the field is empty or not. This may be
  176. // used to include empty fields in Patch requests.
  177. ForceSendFields []string `json:"-"`
  178. // NullFields is a list of field names (e.g. "ContentDetails") to
  179. // include in API requests with the JSON null value. By default, fields
  180. // with empty values are omitted from API requests. However, any field
  181. // with an empty value appearing in NullFields will be sent to the
  182. // server as null. It is an error if a field in this list has a
  183. // non-empty value. This may be used to include null fields in Patch
  184. // requests.
  185. NullFields []string `json:"-"`
  186. }
  187. func (s *Group) MarshalJSON() ([]byte, error) {
  188. type NoMethod Group
  189. raw := NoMethod(*s)
  190. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  191. }
  192. type GroupContentDetails struct {
  193. ItemCount uint64 `json:"itemCount,omitempty,string"`
  194. ItemType string `json:"itemType,omitempty"`
  195. // ForceSendFields is a list of field names (e.g. "ItemCount") to
  196. // unconditionally include in API requests. By default, fields with
  197. // empty values are omitted from API requests. However, any non-pointer,
  198. // non-interface field appearing in ForceSendFields will be sent to the
  199. // server regardless of whether the field is empty or not. This may be
  200. // used to include empty fields in Patch requests.
  201. ForceSendFields []string `json:"-"`
  202. // NullFields is a list of field names (e.g. "ItemCount") to include in
  203. // API requests with the JSON null value. By default, fields with empty
  204. // values are omitted from API requests. However, any field with an
  205. // empty value appearing in NullFields will be sent to the server as
  206. // null. It is an error if a field in this list has a non-empty value.
  207. // This may be used to include null fields in Patch requests.
  208. NullFields []string `json:"-"`
  209. }
  210. func (s *GroupContentDetails) MarshalJSON() ([]byte, error) {
  211. type NoMethod GroupContentDetails
  212. raw := NoMethod(*s)
  213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  214. }
  215. type GroupSnippet struct {
  216. PublishedAt string `json:"publishedAt,omitempty"`
  217. Title string `json:"title,omitempty"`
  218. // ForceSendFields is a list of field names (e.g. "PublishedAt") to
  219. // unconditionally include in API requests. By default, fields with
  220. // empty values are omitted from API requests. However, any non-pointer,
  221. // non-interface field appearing in ForceSendFields will be sent to the
  222. // server regardless of whether the field is empty or not. This may be
  223. // used to include empty fields in Patch requests.
  224. ForceSendFields []string `json:"-"`
  225. // NullFields is a list of field names (e.g. "PublishedAt") to include
  226. // in API requests with the JSON null value. By default, fields with
  227. // empty values are omitted from API requests. However, any field with
  228. // an empty value appearing in NullFields will be sent to the server as
  229. // null. It is an error if a field in this list has a non-empty value.
  230. // This may be used to include null fields in Patch requests.
  231. NullFields []string `json:"-"`
  232. }
  233. func (s *GroupSnippet) MarshalJSON() ([]byte, error) {
  234. type NoMethod GroupSnippet
  235. raw := NoMethod(*s)
  236. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  237. }
  238. type GroupItem struct {
  239. Etag string `json:"etag,omitempty"`
  240. GroupId string `json:"groupId,omitempty"`
  241. Id string `json:"id,omitempty"`
  242. Kind string `json:"kind,omitempty"`
  243. Resource *GroupItemResource `json:"resource,omitempty"`
  244. // ServerResponse contains the HTTP response code and headers from the
  245. // server.
  246. googleapi.ServerResponse `json:"-"`
  247. // ForceSendFields is a list of field names (e.g. "Etag") to
  248. // unconditionally include in API requests. By default, fields with
  249. // empty values are omitted from API requests. However, any non-pointer,
  250. // non-interface field appearing in ForceSendFields will be sent to the
  251. // server regardless of whether the field is empty or not. This may be
  252. // used to include empty fields in Patch requests.
  253. ForceSendFields []string `json:"-"`
  254. // NullFields is a list of field names (e.g. "Etag") to include in API
  255. // requests with the JSON null value. By default, fields with empty
  256. // values are omitted from API requests. However, any field with an
  257. // empty value appearing in NullFields will be sent to the server as
  258. // null. It is an error if a field in this list has a non-empty value.
  259. // This may be used to include null fields in Patch requests.
  260. NullFields []string `json:"-"`
  261. }
  262. func (s *GroupItem) MarshalJSON() ([]byte, error) {
  263. type NoMethod GroupItem
  264. raw := NoMethod(*s)
  265. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  266. }
  267. type GroupItemResource struct {
  268. Id string `json:"id,omitempty"`
  269. Kind string `json:"kind,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "Id") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. // NullFields is a list of field names (e.g. "Id") to include in API
  278. // requests with the JSON null value. By default, fields with empty
  279. // values are omitted from API requests. However, any field with an
  280. // empty value appearing in NullFields will be sent to the server as
  281. // null. It is an error if a field in this list has a non-empty value.
  282. // This may be used to include null fields in Patch requests.
  283. NullFields []string `json:"-"`
  284. }
  285. func (s *GroupItemResource) MarshalJSON() ([]byte, error) {
  286. type NoMethod GroupItemResource
  287. raw := NoMethod(*s)
  288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  289. }
  290. // GroupItemListResponse: A paginated list of grouList resources
  291. // returned in response to a youtubeAnalytics.groupApi.list request.
  292. type GroupItemListResponse struct {
  293. Etag string `json:"etag,omitempty"`
  294. Items []*GroupItem `json:"items,omitempty"`
  295. Kind string `json:"kind,omitempty"`
  296. // ServerResponse contains the HTTP response code and headers from the
  297. // server.
  298. googleapi.ServerResponse `json:"-"`
  299. // ForceSendFields is a list of field names (e.g. "Etag") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. // NullFields is a list of field names (e.g. "Etag") to include in API
  307. // requests with the JSON null value. By default, fields with empty
  308. // values are omitted from API requests. However, any field with an
  309. // empty value appearing in NullFields will be sent to the server as
  310. // null. It is an error if a field in this list has a non-empty value.
  311. // This may be used to include null fields in Patch requests.
  312. NullFields []string `json:"-"`
  313. }
  314. func (s *GroupItemListResponse) MarshalJSON() ([]byte, error) {
  315. type NoMethod GroupItemListResponse
  316. raw := NoMethod(*s)
  317. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  318. }
  319. // GroupListResponse: A paginated list of grouList resources returned in
  320. // response to a youtubeAnalytics.groupApi.list request.
  321. type GroupListResponse struct {
  322. Etag string `json:"etag,omitempty"`
  323. Items []*Group `json:"items,omitempty"`
  324. Kind string `json:"kind,omitempty"`
  325. NextPageToken string `json:"nextPageToken,omitempty"`
  326. // ServerResponse contains the HTTP response code and headers from the
  327. // server.
  328. googleapi.ServerResponse `json:"-"`
  329. // ForceSendFields is a list of field names (e.g. "Etag") to
  330. // unconditionally include in API requests. By default, fields with
  331. // empty values are omitted from API requests. However, any non-pointer,
  332. // non-interface field appearing in ForceSendFields will be sent to the
  333. // server regardless of whether the field is empty or not. This may be
  334. // used to include empty fields in Patch requests.
  335. ForceSendFields []string `json:"-"`
  336. // NullFields is a list of field names (e.g. "Etag") to include in API
  337. // requests with the JSON null value. By default, fields with empty
  338. // values are omitted from API requests. However, any field with an
  339. // empty value appearing in NullFields will be sent to the server as
  340. // null. It is an error if a field in this list has a non-empty value.
  341. // This may be used to include null fields in Patch requests.
  342. NullFields []string `json:"-"`
  343. }
  344. func (s *GroupListResponse) MarshalJSON() ([]byte, error) {
  345. type NoMethod GroupListResponse
  346. raw := NoMethod(*s)
  347. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  348. }
  349. // ResultTable: Contains a single result table. The table is returned as
  350. // an array of rows that contain the values for the cells of the table.
  351. // Depending on the metric or dimension, the cell can contain a string
  352. // (video ID, country code) or a number (number of views or number of
  353. // likes).
  354. type ResultTable struct {
  355. // ColumnHeaders: This value specifies information about the data
  356. // returned in the rows fields. Each item in the columnHeaders list
  357. // identifies a field returned in the rows value, which contains a list
  358. // of comma-delimited data. The columnHeaders list will begin with the
  359. // dimensions specified in the API request, which will be followed by
  360. // the metrics specified in the API request. The order of both
  361. // dimensions and metrics will match the ordering in the API request.
  362. // For example, if the API request contains the parameters
  363. // dimensions=ageGroup,gender&metrics=viewerPercentage, the API response
  364. // will return columns in this order: ageGroup,gender,viewerPercentage.
  365. ColumnHeaders []*ResultTableColumnHeaders `json:"columnHeaders,omitempty"`
  366. // Kind: This value specifies the type of data included in the API
  367. // response. For the query method, the kind property value will be
  368. // youtubeAnalytics#resultTable.
  369. Kind string `json:"kind,omitempty"`
  370. // Rows: The list contains all rows of the result table. Each item in
  371. // the list is an array that contains comma-delimited data corresponding
  372. // to a single row of data. The order of the comma-delimited data fields
  373. // will match the order of the columns listed in the columnHeaders
  374. // field. If no data is available for the given query, the rows element
  375. // will be omitted from the response. The response for a query with the
  376. // day dimension will not contain rows for the most recent days.
  377. Rows [][]interface{} `json:"rows,omitempty"`
  378. // ServerResponse contains the HTTP response code and headers from the
  379. // server.
  380. googleapi.ServerResponse `json:"-"`
  381. // ForceSendFields is a list of field names (e.g. "ColumnHeaders") to
  382. // unconditionally include in API requests. By default, fields with
  383. // empty values are omitted from API requests. However, any non-pointer,
  384. // non-interface field appearing in ForceSendFields will be sent to the
  385. // server regardless of whether the field is empty or not. This may be
  386. // used to include empty fields in Patch requests.
  387. ForceSendFields []string `json:"-"`
  388. // NullFields is a list of field names (e.g. "ColumnHeaders") to include
  389. // in API requests with the JSON null value. By default, fields with
  390. // empty values are omitted from API requests. However, any field with
  391. // an empty value appearing in NullFields will be sent to the server as
  392. // null. It is an error if a field in this list has a non-empty value.
  393. // This may be used to include null fields in Patch requests.
  394. NullFields []string `json:"-"`
  395. }
  396. func (s *ResultTable) MarshalJSON() ([]byte, error) {
  397. type NoMethod ResultTable
  398. raw := NoMethod(*s)
  399. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  400. }
  401. type ResultTableColumnHeaders struct {
  402. // ColumnType: The type of the column (DIMENSION or METRIC).
  403. ColumnType string `json:"columnType,omitempty"`
  404. // DataType: The type of the data in the column (STRING, INTEGER, FLOAT,
  405. // etc.).
  406. DataType string `json:"dataType,omitempty"`
  407. // Name: The name of the dimension or metric.
  408. Name string `json:"name,omitempty"`
  409. // ForceSendFields is a list of field names (e.g. "ColumnType") to
  410. // unconditionally include in API requests. By default, fields with
  411. // empty values are omitted from API requests. However, any non-pointer,
  412. // non-interface field appearing in ForceSendFields will be sent to the
  413. // server regardless of whether the field is empty or not. This may be
  414. // used to include empty fields in Patch requests.
  415. ForceSendFields []string `json:"-"`
  416. // NullFields is a list of field names (e.g. "ColumnType") to include in
  417. // API requests with the JSON null value. By default, fields with empty
  418. // values are omitted from API requests. However, any field with an
  419. // empty value appearing in NullFields will be sent to the server as
  420. // null. It is an error if a field in this list has a non-empty value.
  421. // This may be used to include null fields in Patch requests.
  422. NullFields []string `json:"-"`
  423. }
  424. func (s *ResultTableColumnHeaders) MarshalJSON() ([]byte, error) {
  425. type NoMethod ResultTableColumnHeaders
  426. raw := NoMethod(*s)
  427. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  428. }
  429. // method id "youtubeAnalytics.groupItems.delete":
  430. type GroupItemsDeleteCall struct {
  431. s *Service
  432. urlParams_ gensupport.URLParams
  433. ctx_ context.Context
  434. header_ http.Header
  435. }
  436. // Delete: Removes an item from a group.
  437. func (r *GroupItemsService) Delete(id string) *GroupItemsDeleteCall {
  438. c := &GroupItemsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  439. c.urlParams_.Set("id", id)
  440. return c
  441. }
  442. // OnBehalfOfContentOwner sets the optional parameter
  443. // "onBehalfOfContentOwner": Note: This parameter is intended
  444. // exclusively for YouTube content partners.
  445. //
  446. // The onBehalfOfContentOwner parameter indicates that the request's
  447. // authorization credentials identify a YouTube CMS user who is acting
  448. // on behalf of the content owner specified in the parameter value. This
  449. // parameter is intended for YouTube content partners that own and
  450. // manage many different YouTube channels. It allows content owners to
  451. // authenticate once and get access to all their video and channel data,
  452. // without having to provide authentication credentials for each
  453. // individual channel. The CMS account that the user authenticates with
  454. // must be linked to the specified YouTube content owner.
  455. func (c *GroupItemsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsDeleteCall {
  456. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  457. return c
  458. }
  459. // Fields allows partial responses to be retrieved. See
  460. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  461. // for more information.
  462. func (c *GroupItemsDeleteCall) Fields(s ...googleapi.Field) *GroupItemsDeleteCall {
  463. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  464. return c
  465. }
  466. // Context sets the context to be used in this call's Do method. Any
  467. // pending HTTP request will be aborted if the provided context is
  468. // canceled.
  469. func (c *GroupItemsDeleteCall) Context(ctx context.Context) *GroupItemsDeleteCall {
  470. c.ctx_ = ctx
  471. return c
  472. }
  473. // Header returns an http.Header that can be modified by the caller to
  474. // add HTTP headers to the request.
  475. func (c *GroupItemsDeleteCall) Header() http.Header {
  476. if c.header_ == nil {
  477. c.header_ = make(http.Header)
  478. }
  479. return c.header_
  480. }
  481. func (c *GroupItemsDeleteCall) doRequest(alt string) (*http.Response, error) {
  482. reqHeaders := make(http.Header)
  483. for k, v := range c.header_ {
  484. reqHeaders[k] = v
  485. }
  486. reqHeaders.Set("User-Agent", c.s.userAgent())
  487. var body io.Reader = nil
  488. c.urlParams_.Set("alt", alt)
  489. c.urlParams_.Set("prettyPrint", "false")
  490. urls := googleapi.ResolveRelative(c.s.BasePath, "groupItems")
  491. urls += "?" + c.urlParams_.Encode()
  492. req, err := http.NewRequest("DELETE", urls, body)
  493. if err != nil {
  494. return nil, err
  495. }
  496. req.Header = reqHeaders
  497. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  498. }
  499. // Do executes the "youtubeAnalytics.groupItems.delete" call.
  500. func (c *GroupItemsDeleteCall) Do(opts ...googleapi.CallOption) error {
  501. gensupport.SetOptions(c.urlParams_, opts...)
  502. res, err := c.doRequest("json")
  503. if err != nil {
  504. return err
  505. }
  506. defer googleapi.CloseBody(res)
  507. if err := googleapi.CheckResponse(res); err != nil {
  508. return err
  509. }
  510. return nil
  511. // {
  512. // "description": "Removes an item from a group.",
  513. // "httpMethod": "DELETE",
  514. // "id": "youtubeAnalytics.groupItems.delete",
  515. // "parameterOrder": [
  516. // "id"
  517. // ],
  518. // "parameters": {
  519. // "id": {
  520. // "description": "The id parameter specifies the YouTube group item ID for the group that is being deleted.",
  521. // "location": "query",
  522. // "required": true,
  523. // "type": "string"
  524. // },
  525. // "onBehalfOfContentOwner": {
  526. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  527. // "location": "query",
  528. // "type": "string"
  529. // }
  530. // },
  531. // "path": "groupItems",
  532. // "scopes": [
  533. // "https://www.googleapis.com/auth/youtube",
  534. // "https://www.googleapis.com/auth/youtubepartner"
  535. // ]
  536. // }
  537. }
  538. // method id "youtubeAnalytics.groupItems.insert":
  539. type GroupItemsInsertCall struct {
  540. s *Service
  541. groupitem *GroupItem
  542. urlParams_ gensupport.URLParams
  543. ctx_ context.Context
  544. header_ http.Header
  545. }
  546. // Insert: Creates a group item.
  547. func (r *GroupItemsService) Insert(groupitem *GroupItem) *GroupItemsInsertCall {
  548. c := &GroupItemsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  549. c.groupitem = groupitem
  550. return c
  551. }
  552. // OnBehalfOfContentOwner sets the optional parameter
  553. // "onBehalfOfContentOwner": Note: This parameter is intended
  554. // exclusively for YouTube content partners.
  555. //
  556. // The onBehalfOfContentOwner parameter indicates that the request's
  557. // authorization credentials identify a YouTube CMS user who is acting
  558. // on behalf of the content owner specified in the parameter value. This
  559. // parameter is intended for YouTube content partners that own and
  560. // manage many different YouTube channels. It allows content owners to
  561. // authenticate once and get access to all their video and channel data,
  562. // without having to provide authentication credentials for each
  563. // individual channel. The CMS account that the user authenticates with
  564. // must be linked to the specified YouTube content owner.
  565. func (c *GroupItemsInsertCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsInsertCall {
  566. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  567. return c
  568. }
  569. // Fields allows partial responses to be retrieved. See
  570. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  571. // for more information.
  572. func (c *GroupItemsInsertCall) Fields(s ...googleapi.Field) *GroupItemsInsertCall {
  573. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  574. return c
  575. }
  576. // Context sets the context to be used in this call's Do method. Any
  577. // pending HTTP request will be aborted if the provided context is
  578. // canceled.
  579. func (c *GroupItemsInsertCall) Context(ctx context.Context) *GroupItemsInsertCall {
  580. c.ctx_ = ctx
  581. return c
  582. }
  583. // Header returns an http.Header that can be modified by the caller to
  584. // add HTTP headers to the request.
  585. func (c *GroupItemsInsertCall) Header() http.Header {
  586. if c.header_ == nil {
  587. c.header_ = make(http.Header)
  588. }
  589. return c.header_
  590. }
  591. func (c *GroupItemsInsertCall) doRequest(alt string) (*http.Response, error) {
  592. reqHeaders := make(http.Header)
  593. for k, v := range c.header_ {
  594. reqHeaders[k] = v
  595. }
  596. reqHeaders.Set("User-Agent", c.s.userAgent())
  597. var body io.Reader = nil
  598. body, err := googleapi.WithoutDataWrapper.JSONReader(c.groupitem)
  599. if err != nil {
  600. return nil, err
  601. }
  602. reqHeaders.Set("Content-Type", "application/json")
  603. c.urlParams_.Set("alt", alt)
  604. c.urlParams_.Set("prettyPrint", "false")
  605. urls := googleapi.ResolveRelative(c.s.BasePath, "groupItems")
  606. urls += "?" + c.urlParams_.Encode()
  607. req, err := http.NewRequest("POST", urls, body)
  608. if err != nil {
  609. return nil, err
  610. }
  611. req.Header = reqHeaders
  612. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  613. }
  614. // Do executes the "youtubeAnalytics.groupItems.insert" call.
  615. // Exactly one of *GroupItem or error will be non-nil. Any non-2xx
  616. // status code is an error. Response headers are in either
  617. // *GroupItem.ServerResponse.Header or (if a response was returned at
  618. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  619. // to check whether the returned error was because
  620. // http.StatusNotModified was returned.
  621. func (c *GroupItemsInsertCall) Do(opts ...googleapi.CallOption) (*GroupItem, error) {
  622. gensupport.SetOptions(c.urlParams_, opts...)
  623. res, err := c.doRequest("json")
  624. if res != nil && res.StatusCode == http.StatusNotModified {
  625. if res.Body != nil {
  626. res.Body.Close()
  627. }
  628. return nil, &googleapi.Error{
  629. Code: res.StatusCode,
  630. Header: res.Header,
  631. }
  632. }
  633. if err != nil {
  634. return nil, err
  635. }
  636. defer googleapi.CloseBody(res)
  637. if err := googleapi.CheckResponse(res); err != nil {
  638. return nil, err
  639. }
  640. ret := &GroupItem{
  641. ServerResponse: googleapi.ServerResponse{
  642. Header: res.Header,
  643. HTTPStatusCode: res.StatusCode,
  644. },
  645. }
  646. target := &ret
  647. if err := gensupport.DecodeResponse(target, res); err != nil {
  648. return nil, err
  649. }
  650. return ret, nil
  651. // {
  652. // "description": "Creates a group item.",
  653. // "httpMethod": "POST",
  654. // "id": "youtubeAnalytics.groupItems.insert",
  655. // "parameters": {
  656. // "onBehalfOfContentOwner": {
  657. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  658. // "location": "query",
  659. // "type": "string"
  660. // }
  661. // },
  662. // "path": "groupItems",
  663. // "request": {
  664. // "$ref": "GroupItem"
  665. // },
  666. // "response": {
  667. // "$ref": "GroupItem"
  668. // },
  669. // "scopes": [
  670. // "https://www.googleapis.com/auth/youtube",
  671. // "https://www.googleapis.com/auth/youtubepartner"
  672. // ]
  673. // }
  674. }
  675. // method id "youtubeAnalytics.groupItems.list":
  676. type GroupItemsListCall struct {
  677. s *Service
  678. urlParams_ gensupport.URLParams
  679. ifNoneMatch_ string
  680. ctx_ context.Context
  681. header_ http.Header
  682. }
  683. // List: Returns a collection of group items that match the API request
  684. // parameters.
  685. func (r *GroupItemsService) List(groupId string) *GroupItemsListCall {
  686. c := &GroupItemsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  687. c.urlParams_.Set("groupId", groupId)
  688. return c
  689. }
  690. // OnBehalfOfContentOwner sets the optional parameter
  691. // "onBehalfOfContentOwner": Note: This parameter is intended
  692. // exclusively for YouTube content partners.
  693. //
  694. // The onBehalfOfContentOwner parameter indicates that the request's
  695. // authorization credentials identify a YouTube CMS user who is acting
  696. // on behalf of the content owner specified in the parameter value. This
  697. // parameter is intended for YouTube content partners that own and
  698. // manage many different YouTube channels. It allows content owners to
  699. // authenticate once and get access to all their video and channel data,
  700. // without having to provide authentication credentials for each
  701. // individual channel. The CMS account that the user authenticates with
  702. // must be linked to the specified YouTube content owner.
  703. func (c *GroupItemsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsListCall {
  704. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  705. return c
  706. }
  707. // Fields allows partial responses to be retrieved. See
  708. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  709. // for more information.
  710. func (c *GroupItemsListCall) Fields(s ...googleapi.Field) *GroupItemsListCall {
  711. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  712. return c
  713. }
  714. // IfNoneMatch sets the optional parameter which makes the operation
  715. // fail if the object's ETag matches the given value. This is useful for
  716. // getting updates only after the object has changed since the last
  717. // request. Use googleapi.IsNotModified to check whether the response
  718. // error from Do is the result of In-None-Match.
  719. func (c *GroupItemsListCall) IfNoneMatch(entityTag string) *GroupItemsListCall {
  720. c.ifNoneMatch_ = entityTag
  721. return c
  722. }
  723. // Context sets the context to be used in this call's Do method. Any
  724. // pending HTTP request will be aborted if the provided context is
  725. // canceled.
  726. func (c *GroupItemsListCall) Context(ctx context.Context) *GroupItemsListCall {
  727. c.ctx_ = ctx
  728. return c
  729. }
  730. // Header returns an http.Header that can be modified by the caller to
  731. // add HTTP headers to the request.
  732. func (c *GroupItemsListCall) Header() http.Header {
  733. if c.header_ == nil {
  734. c.header_ = make(http.Header)
  735. }
  736. return c.header_
  737. }
  738. func (c *GroupItemsListCall) doRequest(alt string) (*http.Response, error) {
  739. reqHeaders := make(http.Header)
  740. for k, v := range c.header_ {
  741. reqHeaders[k] = v
  742. }
  743. reqHeaders.Set("User-Agent", c.s.userAgent())
  744. if c.ifNoneMatch_ != "" {
  745. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  746. }
  747. var body io.Reader = nil
  748. c.urlParams_.Set("alt", alt)
  749. c.urlParams_.Set("prettyPrint", "false")
  750. urls := googleapi.ResolveRelative(c.s.BasePath, "groupItems")
  751. urls += "?" + c.urlParams_.Encode()
  752. req, err := http.NewRequest("GET", urls, body)
  753. if err != nil {
  754. return nil, err
  755. }
  756. req.Header = reqHeaders
  757. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  758. }
  759. // Do executes the "youtubeAnalytics.groupItems.list" call.
  760. // Exactly one of *GroupItemListResponse or error will be non-nil. Any
  761. // non-2xx status code is an error. Response headers are in either
  762. // *GroupItemListResponse.ServerResponse.Header or (if a response was
  763. // returned at all) in error.(*googleapi.Error).Header. Use
  764. // googleapi.IsNotModified to check whether the returned error was
  765. // because http.StatusNotModified was returned.
  766. func (c *GroupItemsListCall) Do(opts ...googleapi.CallOption) (*GroupItemListResponse, error) {
  767. gensupport.SetOptions(c.urlParams_, opts...)
  768. res, err := c.doRequest("json")
  769. if res != nil && res.StatusCode == http.StatusNotModified {
  770. if res.Body != nil {
  771. res.Body.Close()
  772. }
  773. return nil, &googleapi.Error{
  774. Code: res.StatusCode,
  775. Header: res.Header,
  776. }
  777. }
  778. if err != nil {
  779. return nil, err
  780. }
  781. defer googleapi.CloseBody(res)
  782. if err := googleapi.CheckResponse(res); err != nil {
  783. return nil, err
  784. }
  785. ret := &GroupItemListResponse{
  786. ServerResponse: googleapi.ServerResponse{
  787. Header: res.Header,
  788. HTTPStatusCode: res.StatusCode,
  789. },
  790. }
  791. target := &ret
  792. if err := gensupport.DecodeResponse(target, res); err != nil {
  793. return nil, err
  794. }
  795. return ret, nil
  796. // {
  797. // "description": "Returns a collection of group items that match the API request parameters.",
  798. // "httpMethod": "GET",
  799. // "id": "youtubeAnalytics.groupItems.list",
  800. // "parameterOrder": [
  801. // "groupId"
  802. // ],
  803. // "parameters": {
  804. // "groupId": {
  805. // "description": "The id parameter specifies the unique ID of the group for which you want to retrieve group items.",
  806. // "location": "query",
  807. // "required": true,
  808. // "type": "string"
  809. // },
  810. // "onBehalfOfContentOwner": {
  811. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  812. // "location": "query",
  813. // "type": "string"
  814. // }
  815. // },
  816. // "path": "groupItems",
  817. // "response": {
  818. // "$ref": "GroupItemListResponse"
  819. // },
  820. // "scopes": [
  821. // "https://www.googleapis.com/auth/youtube",
  822. // "https://www.googleapis.com/auth/youtube.readonly",
  823. // "https://www.googleapis.com/auth/youtubepartner",
  824. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  825. // ]
  826. // }
  827. }
  828. // method id "youtubeAnalytics.groups.delete":
  829. type GroupsDeleteCall struct {
  830. s *Service
  831. urlParams_ gensupport.URLParams
  832. ctx_ context.Context
  833. header_ http.Header
  834. }
  835. // Delete: Deletes a group.
  836. func (r *GroupsService) Delete(id string) *GroupsDeleteCall {
  837. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  838. c.urlParams_.Set("id", id)
  839. return c
  840. }
  841. // OnBehalfOfContentOwner sets the optional parameter
  842. // "onBehalfOfContentOwner": Note: This parameter is intended
  843. // exclusively for YouTube content partners.
  844. //
  845. // The onBehalfOfContentOwner parameter indicates that the request's
  846. // authorization credentials identify a YouTube CMS user who is acting
  847. // on behalf of the content owner specified in the parameter value. This
  848. // parameter is intended for YouTube content partners that own and
  849. // manage many different YouTube channels. It allows content owners to
  850. // authenticate once and get access to all their video and channel data,
  851. // without having to provide authentication credentials for each
  852. // individual channel. The CMS account that the user authenticates with
  853. // must be linked to the specified YouTube content owner.
  854. func (c *GroupsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsDeleteCall {
  855. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  856. return c
  857. }
  858. // Fields allows partial responses to be retrieved. See
  859. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  860. // for more information.
  861. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  862. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  863. return c
  864. }
  865. // Context sets the context to be used in this call's Do method. Any
  866. // pending HTTP request will be aborted if the provided context is
  867. // canceled.
  868. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  869. c.ctx_ = ctx
  870. return c
  871. }
  872. // Header returns an http.Header that can be modified by the caller to
  873. // add HTTP headers to the request.
  874. func (c *GroupsDeleteCall) Header() http.Header {
  875. if c.header_ == nil {
  876. c.header_ = make(http.Header)
  877. }
  878. return c.header_
  879. }
  880. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  881. reqHeaders := make(http.Header)
  882. for k, v := range c.header_ {
  883. reqHeaders[k] = v
  884. }
  885. reqHeaders.Set("User-Agent", c.s.userAgent())
  886. var body io.Reader = nil
  887. c.urlParams_.Set("alt", alt)
  888. c.urlParams_.Set("prettyPrint", "false")
  889. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  890. urls += "?" + c.urlParams_.Encode()
  891. req, err := http.NewRequest("DELETE", urls, body)
  892. if err != nil {
  893. return nil, err
  894. }
  895. req.Header = reqHeaders
  896. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  897. }
  898. // Do executes the "youtubeAnalytics.groups.delete" call.
  899. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) error {
  900. gensupport.SetOptions(c.urlParams_, opts...)
  901. res, err := c.doRequest("json")
  902. if err != nil {
  903. return err
  904. }
  905. defer googleapi.CloseBody(res)
  906. if err := googleapi.CheckResponse(res); err != nil {
  907. return err
  908. }
  909. return nil
  910. // {
  911. // "description": "Deletes a group.",
  912. // "httpMethod": "DELETE",
  913. // "id": "youtubeAnalytics.groups.delete",
  914. // "parameterOrder": [
  915. // "id"
  916. // ],
  917. // "parameters": {
  918. // "id": {
  919. // "description": "The id parameter specifies the YouTube group ID for the group that is being deleted.",
  920. // "location": "query",
  921. // "required": true,
  922. // "type": "string"
  923. // },
  924. // "onBehalfOfContentOwner": {
  925. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  926. // "location": "query",
  927. // "type": "string"
  928. // }
  929. // },
  930. // "path": "groups",
  931. // "scopes": [
  932. // "https://www.googleapis.com/auth/youtube",
  933. // "https://www.googleapis.com/auth/youtubepartner"
  934. // ]
  935. // }
  936. }
  937. // method id "youtubeAnalytics.groups.insert":
  938. type GroupsInsertCall struct {
  939. s *Service
  940. group *Group
  941. urlParams_ gensupport.URLParams
  942. ctx_ context.Context
  943. header_ http.Header
  944. }
  945. // Insert: Creates a group.
  946. func (r *GroupsService) Insert(group *Group) *GroupsInsertCall {
  947. c := &GroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  948. c.group = group
  949. return c
  950. }
  951. // OnBehalfOfContentOwner sets the optional parameter
  952. // "onBehalfOfContentOwner": Note: This parameter is intended
  953. // exclusively for YouTube content partners.
  954. //
  955. // The onBehalfOfContentOwner parameter indicates that the request's
  956. // authorization credentials identify a YouTube CMS user who is acting
  957. // on behalf of the content owner specified in the parameter value. This
  958. // parameter is intended for YouTube content partners that own and
  959. // manage many different YouTube channels. It allows content owners to
  960. // authenticate once and get access to all their video and channel data,
  961. // without having to provide authentication credentials for each
  962. // individual channel. The CMS account that the user authenticates with
  963. // must be linked to the specified YouTube content owner.
  964. func (c *GroupsInsertCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsInsertCall {
  965. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  966. return c
  967. }
  968. // Fields allows partial responses to be retrieved. See
  969. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  970. // for more information.
  971. func (c *GroupsInsertCall) Fields(s ...googleapi.Field) *GroupsInsertCall {
  972. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  973. return c
  974. }
  975. // Context sets the context to be used in this call's Do method. Any
  976. // pending HTTP request will be aborted if the provided context is
  977. // canceled.
  978. func (c *GroupsInsertCall) Context(ctx context.Context) *GroupsInsertCall {
  979. c.ctx_ = ctx
  980. return c
  981. }
  982. // Header returns an http.Header that can be modified by the caller to
  983. // add HTTP headers to the request.
  984. func (c *GroupsInsertCall) Header() http.Header {
  985. if c.header_ == nil {
  986. c.header_ = make(http.Header)
  987. }
  988. return c.header_
  989. }
  990. func (c *GroupsInsertCall) doRequest(alt string) (*http.Response, error) {
  991. reqHeaders := make(http.Header)
  992. for k, v := range c.header_ {
  993. reqHeaders[k] = v
  994. }
  995. reqHeaders.Set("User-Agent", c.s.userAgent())
  996. var body io.Reader = nil
  997. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  998. if err != nil {
  999. return nil, err
  1000. }
  1001. reqHeaders.Set("Content-Type", "application/json")
  1002. c.urlParams_.Set("alt", alt)
  1003. c.urlParams_.Set("prettyPrint", "false")
  1004. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  1005. urls += "?" + c.urlParams_.Encode()
  1006. req, err := http.NewRequest("POST", urls, body)
  1007. if err != nil {
  1008. return nil, err
  1009. }
  1010. req.Header = reqHeaders
  1011. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1012. }
  1013. // Do executes the "youtubeAnalytics.groups.insert" call.
  1014. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  1015. // code is an error. Response headers are in either
  1016. // *Group.ServerResponse.Header or (if a response was returned at all)
  1017. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1018. // check whether the returned error was because http.StatusNotModified
  1019. // was returned.
  1020. func (c *GroupsInsertCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  1021. gensupport.SetOptions(c.urlParams_, opts...)
  1022. res, err := c.doRequest("json")
  1023. if res != nil && res.StatusCode == http.StatusNotModified {
  1024. if res.Body != nil {
  1025. res.Body.Close()
  1026. }
  1027. return nil, &googleapi.Error{
  1028. Code: res.StatusCode,
  1029. Header: res.Header,
  1030. }
  1031. }
  1032. if err != nil {
  1033. return nil, err
  1034. }
  1035. defer googleapi.CloseBody(res)
  1036. if err := googleapi.CheckResponse(res); err != nil {
  1037. return nil, err
  1038. }
  1039. ret := &Group{
  1040. ServerResponse: googleapi.ServerResponse{
  1041. Header: res.Header,
  1042. HTTPStatusCode: res.StatusCode,
  1043. },
  1044. }
  1045. target := &ret
  1046. if err := gensupport.DecodeResponse(target, res); err != nil {
  1047. return nil, err
  1048. }
  1049. return ret, nil
  1050. // {
  1051. // "description": "Creates a group.",
  1052. // "httpMethod": "POST",
  1053. // "id": "youtubeAnalytics.groups.insert",
  1054. // "parameters": {
  1055. // "onBehalfOfContentOwner": {
  1056. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  1057. // "location": "query",
  1058. // "type": "string"
  1059. // }
  1060. // },
  1061. // "path": "groups",
  1062. // "request": {
  1063. // "$ref": "Group"
  1064. // },
  1065. // "response": {
  1066. // "$ref": "Group"
  1067. // },
  1068. // "scopes": [
  1069. // "https://www.googleapis.com/auth/youtube",
  1070. // "https://www.googleapis.com/auth/youtubepartner"
  1071. // ]
  1072. // }
  1073. }
  1074. // method id "youtubeAnalytics.groups.list":
  1075. type GroupsListCall struct {
  1076. s *Service
  1077. urlParams_ gensupport.URLParams
  1078. ifNoneMatch_ string
  1079. ctx_ context.Context
  1080. header_ http.Header
  1081. }
  1082. // List: Returns a collection of groups that match the API request
  1083. // parameters. For example, you can retrieve all groups that the
  1084. // authenticated user owns, or you can retrieve one or more groups by
  1085. // their unique IDs.
  1086. func (r *GroupsService) List() *GroupsListCall {
  1087. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1088. return c
  1089. }
  1090. // Id sets the optional parameter "id": The id parameter specifies a
  1091. // comma-separated list of the YouTube group ID(s) for the resource(s)
  1092. // that are being retrieved. In a group resource, the id property
  1093. // specifies the group's YouTube group ID.
  1094. func (c *GroupsListCall) Id(id string) *GroupsListCall {
  1095. c.urlParams_.Set("id", id)
  1096. return c
  1097. }
  1098. // Mine sets the optional parameter "mine": Set this parameter's value
  1099. // to true to instruct the API to only return groups owned by the
  1100. // authenticated user.
  1101. func (c *GroupsListCall) Mine(mine bool) *GroupsListCall {
  1102. c.urlParams_.Set("mine", fmt.Sprint(mine))
  1103. return c
  1104. }
  1105. // OnBehalfOfContentOwner sets the optional parameter
  1106. // "onBehalfOfContentOwner": Note: This parameter is intended
  1107. // exclusively for YouTube content partners.
  1108. //
  1109. // The onBehalfOfContentOwner parameter indicates that the request's
  1110. // authorization credentials identify a YouTube CMS user who is acting
  1111. // on behalf of the content owner specified in the parameter value. This
  1112. // parameter is intended for YouTube content partners that own and
  1113. // manage many different YouTube channels. It allows content owners to
  1114. // authenticate once and get access to all their video and channel data,
  1115. // without having to provide authentication credentials for each
  1116. // individual channel. The CMS account that the user authenticates with
  1117. // must be linked to the specified YouTube content owner.
  1118. func (c *GroupsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsListCall {
  1119. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1120. return c
  1121. }
  1122. // PageToken sets the optional parameter "pageToken": The pageToken
  1123. // parameter identifies a specific page in the result set that should be
  1124. // returned. In an API response, the nextPageToken property identifies
  1125. // the next page that can be retrieved.
  1126. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  1127. c.urlParams_.Set("pageToken", pageToken)
  1128. return c
  1129. }
  1130. // Fields allows partial responses to be retrieved. See
  1131. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1132. // for more information.
  1133. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  1134. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1135. return c
  1136. }
  1137. // IfNoneMatch sets the optional parameter which makes the operation
  1138. // fail if the object's ETag matches the given value. This is useful for
  1139. // getting updates only after the object has changed since the last
  1140. // request. Use googleapi.IsNotModified to check whether the response
  1141. // error from Do is the result of In-None-Match.
  1142. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  1143. c.ifNoneMatch_ = entityTag
  1144. return c
  1145. }
  1146. // Context sets the context to be used in this call's Do method. Any
  1147. // pending HTTP request will be aborted if the provided context is
  1148. // canceled.
  1149. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  1150. c.ctx_ = ctx
  1151. return c
  1152. }
  1153. // Header returns an http.Header that can be modified by the caller to
  1154. // add HTTP headers to the request.
  1155. func (c *GroupsListCall) Header() http.Header {
  1156. if c.header_ == nil {
  1157. c.header_ = make(http.Header)
  1158. }
  1159. return c.header_
  1160. }
  1161. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  1162. reqHeaders := make(http.Header)
  1163. for k, v := range c.header_ {
  1164. reqHeaders[k] = v
  1165. }
  1166. reqHeaders.Set("User-Agent", c.s.userAgent())
  1167. if c.ifNoneMatch_ != "" {
  1168. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1169. }
  1170. var body io.Reader = nil
  1171. c.urlParams_.Set("alt", alt)
  1172. c.urlParams_.Set("prettyPrint", "false")
  1173. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  1174. urls += "?" + c.urlParams_.Encode()
  1175. req, err := http.NewRequest("GET", urls, body)
  1176. if err != nil {
  1177. return nil, err
  1178. }
  1179. req.Header = reqHeaders
  1180. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1181. }
  1182. // Do executes the "youtubeAnalytics.groups.list" call.
  1183. // Exactly one of *GroupListResponse or error will be non-nil. Any
  1184. // non-2xx status code is an error. Response headers are in either
  1185. // *GroupListResponse.ServerResponse.Header or (if a response was
  1186. // returned at all) in error.(*googleapi.Error).Header. Use
  1187. // googleapi.IsNotModified to check whether the returned error was
  1188. // because http.StatusNotModified was returned.
  1189. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*GroupListResponse, error) {
  1190. gensupport.SetOptions(c.urlParams_, opts...)
  1191. res, err := c.doRequest("json")
  1192. if res != nil && res.StatusCode == http.StatusNotModified {
  1193. if res.Body != nil {
  1194. res.Body.Close()
  1195. }
  1196. return nil, &googleapi.Error{
  1197. Code: res.StatusCode,
  1198. Header: res.Header,
  1199. }
  1200. }
  1201. if err != nil {
  1202. return nil, err
  1203. }
  1204. defer googleapi.CloseBody(res)
  1205. if err := googleapi.CheckResponse(res); err != nil {
  1206. return nil, err
  1207. }
  1208. ret := &GroupListResponse{
  1209. ServerResponse: googleapi.ServerResponse{
  1210. Header: res.Header,
  1211. HTTPStatusCode: res.StatusCode,
  1212. },
  1213. }
  1214. target := &ret
  1215. if err := gensupport.DecodeResponse(target, res); err != nil {
  1216. return nil, err
  1217. }
  1218. return ret, nil
  1219. // {
  1220. // "description": "Returns a collection of groups that match the API request parameters. For example, you can retrieve all groups that the authenticated user owns, or you can retrieve one or more groups by their unique IDs.",
  1221. // "httpMethod": "GET",
  1222. // "id": "youtubeAnalytics.groups.list",
  1223. // "parameters": {
  1224. // "id": {
  1225. // "description": "The id parameter specifies a comma-separated list of the YouTube group ID(s) for the resource(s) that are being retrieved. In a group resource, the id property specifies the group's YouTube group ID.",
  1226. // "location": "query",
  1227. // "type": "string"
  1228. // },
  1229. // "mine": {
  1230. // "description": "Set this parameter's value to true to instruct the API to only return groups owned by the authenticated user.",
  1231. // "location": "query",
  1232. // "type": "boolean"
  1233. // },
  1234. // "onBehalfOfContentOwner": {
  1235. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  1236. // "location": "query",
  1237. // "type": "string"
  1238. // },
  1239. // "pageToken": {
  1240. // "description": "The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page that can be retrieved.",
  1241. // "location": "query",
  1242. // "type": "string"
  1243. // }
  1244. // },
  1245. // "path": "groups",
  1246. // "response": {
  1247. // "$ref": "GroupListResponse"
  1248. // },
  1249. // "scopes": [
  1250. // "https://www.googleapis.com/auth/youtube",
  1251. // "https://www.googleapis.com/auth/youtube.readonly",
  1252. // "https://www.googleapis.com/auth/youtubepartner",
  1253. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1254. // ]
  1255. // }
  1256. }
  1257. // Pages invokes f for each page of results.
  1258. // A non-nil error returned from f will halt the iteration.
  1259. // The provided context supersedes any context provided to the Context method.
  1260. func (c *GroupsListCall) Pages(ctx context.Context, f func(*GroupListResponse) error) error {
  1261. c.ctx_ = ctx
  1262. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1263. for {
  1264. x, err := c.Do()
  1265. if err != nil {
  1266. return err
  1267. }
  1268. if err := f(x); err != nil {
  1269. return err
  1270. }
  1271. if x.NextPageToken == "" {
  1272. return nil
  1273. }
  1274. c.PageToken(x.NextPageToken)
  1275. }
  1276. }
  1277. // method id "youtubeAnalytics.groups.update":
  1278. type GroupsUpdateCall struct {
  1279. s *Service
  1280. group *Group
  1281. urlParams_ gensupport.URLParams
  1282. ctx_ context.Context
  1283. header_ http.Header
  1284. }
  1285. // Update: Modifies a group. For example, you could change a group's
  1286. // title.
  1287. func (r *GroupsService) Update(group *Group) *GroupsUpdateCall {
  1288. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1289. c.group = group
  1290. return c
  1291. }
  1292. // OnBehalfOfContentOwner sets the optional parameter
  1293. // "onBehalfOfContentOwner": Note: This parameter is intended
  1294. // exclusively for YouTube content partners.
  1295. //
  1296. // The onBehalfOfContentOwner parameter indicates that the request's
  1297. // authorization credentials identify a YouTube CMS user who is acting
  1298. // on behalf of the content owner specified in the parameter value. This
  1299. // parameter is intended for YouTube content partners that own and
  1300. // manage many different YouTube channels. It allows content owners to
  1301. // authenticate once and get access to all their video and channel data,
  1302. // without having to provide authentication credentials for each
  1303. // individual channel. The CMS account that the user authenticates with
  1304. // must be linked to the specified YouTube content owner.
  1305. func (c *GroupsUpdateCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsUpdateCall {
  1306. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1307. return c
  1308. }
  1309. // Fields allows partial responses to be retrieved. See
  1310. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1311. // for more information.
  1312. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  1313. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1314. return c
  1315. }
  1316. // Context sets the context to be used in this call's Do method. Any
  1317. // pending HTTP request will be aborted if the provided context is
  1318. // canceled.
  1319. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  1320. c.ctx_ = ctx
  1321. return c
  1322. }
  1323. // Header returns an http.Header that can be modified by the caller to
  1324. // add HTTP headers to the request.
  1325. func (c *GroupsUpdateCall) Header() http.Header {
  1326. if c.header_ == nil {
  1327. c.header_ = make(http.Header)
  1328. }
  1329. return c.header_
  1330. }
  1331. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1332. reqHeaders := make(http.Header)
  1333. for k, v := range c.header_ {
  1334. reqHeaders[k] = v
  1335. }
  1336. reqHeaders.Set("User-Agent", c.s.userAgent())
  1337. var body io.Reader = nil
  1338. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  1339. if err != nil {
  1340. return nil, err
  1341. }
  1342. reqHeaders.Set("Content-Type", "application/json")
  1343. c.urlParams_.Set("alt", alt)
  1344. c.urlParams_.Set("prettyPrint", "false")
  1345. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  1346. urls += "?" + c.urlParams_.Encode()
  1347. req, err := http.NewRequest("PUT", urls, body)
  1348. if err != nil {
  1349. return nil, err
  1350. }
  1351. req.Header = reqHeaders
  1352. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1353. }
  1354. // Do executes the "youtubeAnalytics.groups.update" call.
  1355. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  1356. // code is an error. Response headers are in either
  1357. // *Group.ServerResponse.Header or (if a response was returned at all)
  1358. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1359. // check whether the returned error was because http.StatusNotModified
  1360. // was returned.
  1361. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  1362. gensupport.SetOptions(c.urlParams_, opts...)
  1363. res, err := c.doRequest("json")
  1364. if res != nil && res.StatusCode == http.StatusNotModified {
  1365. if res.Body != nil {
  1366. res.Body.Close()
  1367. }
  1368. return nil, &googleapi.Error{
  1369. Code: res.StatusCode,
  1370. Header: res.Header,
  1371. }
  1372. }
  1373. if err != nil {
  1374. return nil, err
  1375. }
  1376. defer googleapi.CloseBody(res)
  1377. if err := googleapi.CheckResponse(res); err != nil {
  1378. return nil, err
  1379. }
  1380. ret := &Group{
  1381. ServerResponse: googleapi.ServerResponse{
  1382. Header: res.Header,
  1383. HTTPStatusCode: res.StatusCode,
  1384. },
  1385. }
  1386. target := &ret
  1387. if err := gensupport.DecodeResponse(target, res); err != nil {
  1388. return nil, err
  1389. }
  1390. return ret, nil
  1391. // {
  1392. // "description": "Modifies a group. For example, you could change a group's title.",
  1393. // "httpMethod": "PUT",
  1394. // "id": "youtubeAnalytics.groups.update",
  1395. // "parameters": {
  1396. // "onBehalfOfContentOwner": {
  1397. // "description": "Note: This parameter is intended exclusively for YouTube content partners.\n\nThe onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.",
  1398. // "location": "query",
  1399. // "type": "string"
  1400. // }
  1401. // },
  1402. // "path": "groups",
  1403. // "request": {
  1404. // "$ref": "Group"
  1405. // },
  1406. // "response": {
  1407. // "$ref": "Group"
  1408. // },
  1409. // "scopes": [
  1410. // "https://www.googleapis.com/auth/youtube",
  1411. // "https://www.googleapis.com/auth/youtubepartner"
  1412. // ]
  1413. // }
  1414. }
  1415. // method id "youtubeAnalytics.reports.query":
  1416. type ReportsQueryCall struct {
  1417. s *Service
  1418. urlParams_ gensupport.URLParams
  1419. ifNoneMatch_ string
  1420. ctx_ context.Context
  1421. header_ http.Header
  1422. }
  1423. // Query: Retrieve your YouTube Analytics reports.
  1424. func (r *ReportsService) Query(ids string, startDate string, endDate string, metrics string) *ReportsQueryCall {
  1425. c := &ReportsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1426. c.urlParams_.Set("ids", ids)
  1427. c.urlParams_.Set("start-date", startDate)
  1428. c.urlParams_.Set("end-date", endDate)
  1429. c.urlParams_.Set("metrics", metrics)
  1430. return c
  1431. }
  1432. // Currency sets the optional parameter "currency": The currency to
  1433. // which financial metrics should be converted. The default is US Dollar
  1434. // (USD). If the result contains no financial metrics, this flag will be
  1435. // ignored. Responds with an error if the specified currency is not
  1436. // recognized.
  1437. func (c *ReportsQueryCall) Currency(currency string) *ReportsQueryCall {
  1438. c.urlParams_.Set("currency", currency)
  1439. return c
  1440. }
  1441. // Dimensions sets the optional parameter "dimensions": A
  1442. // comma-separated list of YouTube Analytics dimensions, such as views
  1443. // or ageGroup,gender. See the Available Reports document for a list of
  1444. // the reports that you can retrieve and the dimensions used for those
  1445. // reports. Also see the Dimensions document for definitions of those
  1446. // dimensions.
  1447. func (c *ReportsQueryCall) Dimensions(dimensions string) *ReportsQueryCall {
  1448. c.urlParams_.Set("dimensions", dimensions)
  1449. return c
  1450. }
  1451. // Filters sets the optional parameter "filters": A list of filters that
  1452. // should be applied when retrieving YouTube Analytics data. The
  1453. // Available Reports document identifies the dimensions that can be used
  1454. // to filter each report, and the Dimensions document defines those
  1455. // dimensions. If a request uses multiple filters, join them together
  1456. // with a semicolon (;), and the returned result table will satisfy both
  1457. // filters. For example, a filters parameter value of
  1458. // video==dMH0bHeiRNg;country==IT restricts the result set to include
  1459. // data for the given video in Italy.
  1460. func (c *ReportsQueryCall) Filters(filters string) *ReportsQueryCall {
  1461. c.urlParams_.Set("filters", filters)
  1462. return c
  1463. }
  1464. // IncludeHistoricalChannelData sets the optional parameter
  1465. // "include-historical-channel-data": If set to true historical data
  1466. // (i.e. channel data from before the linking of the channel to the
  1467. // content owner) will be retrieved.
  1468. func (c *ReportsQueryCall) IncludeHistoricalChannelData(includeHistoricalChannelData bool) *ReportsQueryCall {
  1469. c.urlParams_.Set("include-historical-channel-data", fmt.Sprint(includeHistoricalChannelData))
  1470. return c
  1471. }
  1472. // MaxResults sets the optional parameter "max-results": The maximum
  1473. // number of rows to include in the response.
  1474. func (c *ReportsQueryCall) MaxResults(maxResults int64) *ReportsQueryCall {
  1475. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  1476. return c
  1477. }
  1478. // Sort sets the optional parameter "sort": A comma-separated list of
  1479. // dimensions or metrics that determine the sort order for YouTube
  1480. // Analytics data. By default the sort order is ascending. The '-'
  1481. // prefix causes descending sort order.
  1482. func (c *ReportsQueryCall) Sort(sort string) *ReportsQueryCall {
  1483. c.urlParams_.Set("sort", sort)
  1484. return c
  1485. }
  1486. // StartIndex sets the optional parameter "start-index": An index of the
  1487. // first entity to retrieve. Use this parameter as a pagination
  1488. // mechanism along with the max-results parameter (one-based,
  1489. // inclusive).
  1490. func (c *ReportsQueryCall) StartIndex(startIndex int64) *ReportsQueryCall {
  1491. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  1492. return c
  1493. }
  1494. // Fields allows partial responses to be retrieved. See
  1495. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1496. // for more information.
  1497. func (c *ReportsQueryCall) Fields(s ...googleapi.Field) *ReportsQueryCall {
  1498. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1499. return c
  1500. }
  1501. // IfNoneMatch sets the optional parameter which makes the operation
  1502. // fail if the object's ETag matches the given value. This is useful for
  1503. // getting updates only after the object has changed since the last
  1504. // request. Use googleapi.IsNotModified to check whether the response
  1505. // error from Do is the result of In-None-Match.
  1506. func (c *ReportsQueryCall) IfNoneMatch(entityTag string) *ReportsQueryCall {
  1507. c.ifNoneMatch_ = entityTag
  1508. return c
  1509. }
  1510. // Context sets the context to be used in this call's Do method. Any
  1511. // pending HTTP request will be aborted if the provided context is
  1512. // canceled.
  1513. func (c *ReportsQueryCall) Context(ctx context.Context) *ReportsQueryCall {
  1514. c.ctx_ = ctx
  1515. return c
  1516. }
  1517. // Header returns an http.Header that can be modified by the caller to
  1518. // add HTTP headers to the request.
  1519. func (c *ReportsQueryCall) Header() http.Header {
  1520. if c.header_ == nil {
  1521. c.header_ = make(http.Header)
  1522. }
  1523. return c.header_
  1524. }
  1525. func (c *ReportsQueryCall) doRequest(alt string) (*http.Response, error) {
  1526. reqHeaders := make(http.Header)
  1527. for k, v := range c.header_ {
  1528. reqHeaders[k] = v
  1529. }
  1530. reqHeaders.Set("User-Agent", c.s.userAgent())
  1531. if c.ifNoneMatch_ != "" {
  1532. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1533. }
  1534. var body io.Reader = nil
  1535. c.urlParams_.Set("alt", alt)
  1536. c.urlParams_.Set("prettyPrint", "false")
  1537. urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  1538. urls += "?" + c.urlParams_.Encode()
  1539. req, err := http.NewRequest("GET", urls, body)
  1540. if err != nil {
  1541. return nil, err
  1542. }
  1543. req.Header = reqHeaders
  1544. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1545. }
  1546. // Do executes the "youtubeAnalytics.reports.query" call.
  1547. // Exactly one of *ResultTable or error will be non-nil. Any non-2xx
  1548. // status code is an error. Response headers are in either
  1549. // *ResultTable.ServerResponse.Header or (if a response was returned at
  1550. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1551. // to check whether the returned error was because
  1552. // http.StatusNotModified was returned.
  1553. func (c *ReportsQueryCall) Do(opts ...googleapi.CallOption) (*ResultTable, error) {
  1554. gensupport.SetOptions(c.urlParams_, opts...)
  1555. res, err := c.doRequest("json")
  1556. if res != nil && res.StatusCode == http.StatusNotModified {
  1557. if res.Body != nil {
  1558. res.Body.Close()
  1559. }
  1560. return nil, &googleapi.Error{
  1561. Code: res.StatusCode,
  1562. Header: res.Header,
  1563. }
  1564. }
  1565. if err != nil {
  1566. return nil, err
  1567. }
  1568. defer googleapi.CloseBody(res)
  1569. if err := googleapi.CheckResponse(res); err != nil {
  1570. return nil, err
  1571. }
  1572. ret := &ResultTable{
  1573. ServerResponse: googleapi.ServerResponse{
  1574. Header: res.Header,
  1575. HTTPStatusCode: res.StatusCode,
  1576. },
  1577. }
  1578. target := &ret
  1579. if err := gensupport.DecodeResponse(target, res); err != nil {
  1580. return nil, err
  1581. }
  1582. return ret, nil
  1583. // {
  1584. // "description": "Retrieve your YouTube Analytics reports.",
  1585. // "httpMethod": "GET",
  1586. // "id": "youtubeAnalytics.reports.query",
  1587. // "parameterOrder": [
  1588. // "ids",
  1589. // "start-date",
  1590. // "end-date",
  1591. // "metrics"
  1592. // ],
  1593. // "parameters": {
  1594. // "currency": {
  1595. // "description": "The currency to which financial metrics should be converted. The default is US Dollar (USD). If the result contains no financial metrics, this flag will be ignored. Responds with an error if the specified currency is not recognized.",
  1596. // "location": "query",
  1597. // "pattern": "[A-Z]{3}",
  1598. // "type": "string"
  1599. // },
  1600. // "dimensions": {
  1601. // "description": "A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See the Available Reports document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the Dimensions document for definitions of those dimensions.",
  1602. // "location": "query",
  1603. // "pattern": "[0-9a-zA-Z,]+",
  1604. // "type": "string"
  1605. // },
  1606. // "end-date": {
  1607. // "description": "The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.",
  1608. // "location": "query",
  1609. // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
  1610. // "required": true,
  1611. // "type": "string"
  1612. // },
  1613. // "filters": {
  1614. // "description": "A list of filters that should be applied when retrieving YouTube Analytics data. The Available Reports document identifies the dimensions that can be used to filter each report, and the Dimensions document defines those dimensions. If a request uses multiple filters, join them together with a semicolon (;), and the returned result table will satisfy both filters. For example, a filters parameter value of video==dMH0bHeiRNg;country==IT restricts the result set to include data for the given video in Italy.",
  1615. // "location": "query",
  1616. // "type": "string"
  1617. // },
  1618. // "ids": {
  1619. // "description": "Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics data.\n- To request data for a YouTube user, set the ids parameter value to channel==CHANNEL_ID, where CHANNEL_ID specifies the unique YouTube channel ID.\n- To request data for a YouTube CMS content owner, set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the CMS name of the content owner.",
  1620. // "location": "query",
  1621. // "pattern": "[a-zA-Z]+==[a-zA-Z0-9_+-]+",
  1622. // "required": true,
  1623. // "type": "string"
  1624. // },
  1625. // "include-historical-channel-data": {
  1626. // "description": "If set to true historical data (i.e. channel data from before the linking of the channel to the content owner) will be retrieved.",
  1627. // "location": "query",
  1628. // "type": "boolean"
  1629. // },
  1630. // "max-results": {
  1631. // "description": "The maximum number of rows to include in the response.",
  1632. // "format": "int32",
  1633. // "location": "query",
  1634. // "minimum": "1",
  1635. // "type": "integer"
  1636. // },
  1637. // "metrics": {
  1638. // "description": "A comma-separated list of YouTube Analytics metrics, such as views or likes,dislikes. See the Available Reports document for a list of the reports that you can retrieve and the metrics available in each report, and see the Metrics document for definitions of those metrics.",
  1639. // "location": "query",
  1640. // "pattern": "[0-9a-zA-Z,]+",
  1641. // "required": true,
  1642. // "type": "string"
  1643. // },
  1644. // "sort": {
  1645. // "description": "A comma-separated list of dimensions or metrics that determine the sort order for YouTube Analytics data. By default the sort order is ascending. The '-' prefix causes descending sort order.",
  1646. // "location": "query",
  1647. // "pattern": "[-0-9a-zA-Z,]+",
  1648. // "type": "string"
  1649. // },
  1650. // "start-date": {
  1651. // "description": "The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.",
  1652. // "location": "query",
  1653. // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
  1654. // "required": true,
  1655. // "type": "string"
  1656. // },
  1657. // "start-index": {
  1658. // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter (one-based, inclusive).",
  1659. // "format": "int32",
  1660. // "location": "query",
  1661. // "minimum": "1",
  1662. // "type": "integer"
  1663. // }
  1664. // },
  1665. // "path": "reports",
  1666. // "response": {
  1667. // "$ref": "ResultTable"
  1668. // },
  1669. // "scopes": [
  1670. // "https://www.googleapis.com/auth/youtube",
  1671. // "https://www.googleapis.com/auth/youtube.readonly",
  1672. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1673. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1674. // ]
  1675. // }
  1676. }