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 lines
86 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: https://developers.google.com/youtube/analytics
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/youtubeanalytics/v2"
  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/v2"
  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:v2"
  71. const apiName = "youtubeAnalytics"
  72. const apiVersion = "v2"
  73. const basePath = "https://youtubeanalytics.googleapis.com/"
  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. // EmptyResponse: Empty response.
  163. type EmptyResponse struct {
  164. // Errors: Apiary error details
  165. Errors *Errors `json:"errors,omitempty"`
  166. // ServerResponse contains the HTTP response code and headers from the
  167. // server.
  168. googleapi.ServerResponse `json:"-"`
  169. // ForceSendFields is a list of field names (e.g. "Errors") to
  170. // unconditionally include in API requests. By default, fields with
  171. // empty values are omitted from API requests. However, any non-pointer,
  172. // non-interface field appearing in ForceSendFields will be sent to the
  173. // server regardless of whether the field is empty or not. This may be
  174. // used to include empty fields in Patch requests.
  175. ForceSendFields []string `json:"-"`
  176. // NullFields is a list of field names (e.g. "Errors") to include in API
  177. // requests with the JSON null value. By default, fields with empty
  178. // values are omitted from API requests. However, any field with an
  179. // empty value appearing in NullFields will be sent to the server as
  180. // null. It is an error if a field in this list has a non-empty value.
  181. // This may be used to include null fields in Patch requests.
  182. NullFields []string `json:"-"`
  183. }
  184. func (s *EmptyResponse) MarshalJSON() ([]byte, error) {
  185. type NoMethod EmptyResponse
  186. raw := NoMethod(*s)
  187. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  188. }
  189. // ErrorProto: Describes one specific error.
  190. type ErrorProto struct {
  191. // Argument: Error arguments, to be used when building user-friendly
  192. // error messages
  193. // given the error domain and code. Different error codes require
  194. // different
  195. // arguments.
  196. Argument []string `json:"argument,omitempty"`
  197. // Code: Error code in the error domain. This should correspond to
  198. // a value of the enum type whose name is in domain. See
  199. // the core error domain in error_domain.proto.
  200. Code string `json:"code,omitempty"`
  201. // DebugInfo: Debugging information, which should not be
  202. // shared externally.
  203. DebugInfo string `json:"debugInfo,omitempty"`
  204. // Domain: Error domain. RoSy services can define their own
  205. // domain and error codes. This should normally be
  206. // the name of an enum type, such as: gdata.CoreErrorDomain
  207. Domain string `json:"domain,omitempty"`
  208. // ExternalErrorMessage: A short explanation for the error, which can be
  209. // shared outside Google.
  210. //
  211. // Please set domain, code and arguments whenever possible instead of
  212. // this
  213. // error message so that external APIs can build safe error
  214. // messages
  215. // themselves.
  216. //
  217. // External messages built in a RoSy interface will most likely refer
  218. // to
  219. // information and concepts that are not available externally and should
  220. // not
  221. // be exposed. It is safer if external APIs can understand the errors
  222. // and
  223. // decide what the error message should look like.
  224. ExternalErrorMessage string `json:"externalErrorMessage,omitempty"`
  225. // Location: Location of the error, as specified by the location
  226. // type.
  227. //
  228. // If location_type is PATH, this should be a path to a field
  229. // that's
  230. // relative to the request, using FieldPath
  231. // notation
  232. // (net/proto2/util/public/field_path.h).
  233. //
  234. // Examples:
  235. // authenticated_user.gaia_id
  236. // resource.address[2].country
  237. Location string `json:"location,omitempty"`
  238. // Possible values:
  239. // "PATH" - location is an xpath-like path pointing
  240. // to the request field that caused the error.
  241. // "OTHER" - other location type which can safely be
  242. // shared
  243. // externally.
  244. LocationType string `json:"locationType,omitempty"`
  245. // ForceSendFields is a list of field names (e.g. "Argument") to
  246. // unconditionally include in API requests. By default, fields with
  247. // empty values are omitted from API requests. However, any non-pointer,
  248. // non-interface field appearing in ForceSendFields will be sent to the
  249. // server regardless of whether the field is empty or not. This may be
  250. // used to include empty fields in Patch requests.
  251. ForceSendFields []string `json:"-"`
  252. // NullFields is a list of field names (e.g. "Argument") to include in
  253. // API requests with the JSON null value. By default, fields with empty
  254. // values are omitted from API requests. However, any field with an
  255. // empty value appearing in NullFields will be sent to the server as
  256. // null. It is an error if a field in this list has a non-empty value.
  257. // This may be used to include null fields in Patch requests.
  258. NullFields []string `json:"-"`
  259. }
  260. func (s *ErrorProto) MarshalJSON() ([]byte, error) {
  261. type NoMethod ErrorProto
  262. raw := NoMethod(*s)
  263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  264. }
  265. // Errors: Request Error information.
  266. //
  267. // The presence of an error field signals that the operation
  268. // has failed.
  269. type Errors struct {
  270. // Code: Global error code. Deprecated and ignored.
  271. // Set custom error codes in ErrorProto.domain and
  272. // ErrorProto.code
  273. // instead.
  274. //
  275. // Possible values:
  276. // "BAD_REQUEST"
  277. // "FORBIDDEN"
  278. // "NOT_FOUND"
  279. // "CONFLICT"
  280. // "GONE"
  281. // "PRECONDITION_FAILED"
  282. // "INTERNAL_ERROR"
  283. // "SERVICE_UNAVAILABLE"
  284. Code string `json:"code,omitempty"`
  285. // Error: Specific error description and codes
  286. Error []*ErrorProto `json:"error,omitempty"`
  287. // RequestId: Request identifier generated by the service, which can
  288. // be
  289. // used to identify the error in the logs
  290. RequestId string `json:"requestId,omitempty"`
  291. // ForceSendFields is a list of field names (e.g. "Code") to
  292. // unconditionally include in API requests. By default, fields with
  293. // empty values are omitted from API requests. However, any non-pointer,
  294. // non-interface field appearing in ForceSendFields will be sent to the
  295. // server regardless of whether the field is empty or not. This may be
  296. // used to include empty fields in Patch requests.
  297. ForceSendFields []string `json:"-"`
  298. // NullFields is a list of field names (e.g. "Code") to include in API
  299. // requests with the JSON null value. By default, fields with empty
  300. // values are omitted from API requests. However, any field with an
  301. // empty value appearing in NullFields will be sent to the server as
  302. // null. It is an error if a field in this list has a non-empty value.
  303. // This may be used to include null fields in Patch requests.
  304. NullFields []string `json:"-"`
  305. }
  306. func (s *Errors) MarshalJSON() ([]byte, error) {
  307. type NoMethod Errors
  308. raw := NoMethod(*s)
  309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  310. }
  311. // Group: A group.
  312. type Group struct {
  313. // ContentDetails: The `contentDetails` object contains additional
  314. // information about the
  315. // group, such as the number and type of items that it contains.
  316. ContentDetails *GroupContentDetails `json:"contentDetails,omitempty"`
  317. // Errors: Apiary error details
  318. Errors *Errors `json:"errors,omitempty"`
  319. // Etag: The Etag of this resource.
  320. Etag string `json:"etag,omitempty"`
  321. // Id: The ID that YouTube uses to uniquely identify the group.
  322. Id string `json:"id,omitempty"`
  323. // Kind: Identifies the API resource's type. The value will be
  324. // `youtube#group`.
  325. Kind string `json:"kind,omitempty"`
  326. // Snippet: The `snippet` object contains basic information about the
  327. // group, including
  328. // its creation date and name.
  329. Snippet *GroupSnippet `json:"snippet,omitempty"`
  330. // ServerResponse contains the HTTP response code and headers from the
  331. // server.
  332. googleapi.ServerResponse `json:"-"`
  333. // ForceSendFields is a list of field names (e.g. "ContentDetails") to
  334. // unconditionally include in API requests. By default, fields with
  335. // empty values are omitted from API requests. However, any non-pointer,
  336. // non-interface field appearing in ForceSendFields will be sent to the
  337. // server regardless of whether the field is empty or not. This may be
  338. // used to include empty fields in Patch requests.
  339. ForceSendFields []string `json:"-"`
  340. // NullFields is a list of field names (e.g. "ContentDetails") to
  341. // include in API requests with the JSON null value. By default, fields
  342. // with empty values are omitted from API requests. However, any field
  343. // with an empty value appearing in NullFields will be sent to the
  344. // server as null. It is an error if a field in this list has a
  345. // non-empty value. This may be used to include null fields in Patch
  346. // requests.
  347. NullFields []string `json:"-"`
  348. }
  349. func (s *Group) MarshalJSON() ([]byte, error) {
  350. type NoMethod Group
  351. raw := NoMethod(*s)
  352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  353. }
  354. // GroupContentDetails: A group's content details.
  355. type GroupContentDetails struct {
  356. // ItemCount: The number of items in the group.
  357. ItemCount uint64 `json:"itemCount,omitempty,string"`
  358. // ItemType: The type of resources that the group contains.
  359. //
  360. // Valid values for this property are:
  361. // * `youtube#channel`
  362. // * `youtube#playlist`
  363. // * `youtube#video`
  364. // * `youtubePartner#asset`
  365. ItemType string `json:"itemType,omitempty"`
  366. // ForceSendFields is a list of field names (e.g. "ItemCount") to
  367. // unconditionally include in API requests. By default, fields with
  368. // empty values are omitted from API requests. However, any non-pointer,
  369. // non-interface field appearing in ForceSendFields will be sent to the
  370. // server regardless of whether the field is empty or not. This may be
  371. // used to include empty fields in Patch requests.
  372. ForceSendFields []string `json:"-"`
  373. // NullFields is a list of field names (e.g. "ItemCount") to include in
  374. // API requests with the JSON null value. By default, fields with empty
  375. // values are omitted from API requests. However, any field with an
  376. // empty value appearing in NullFields will be sent to the server as
  377. // null. It is an error if a field in this list has a non-empty value.
  378. // This may be used to include null fields in Patch requests.
  379. NullFields []string `json:"-"`
  380. }
  381. func (s *GroupContentDetails) MarshalJSON() ([]byte, error) {
  382. type NoMethod GroupContentDetails
  383. raw := NoMethod(*s)
  384. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  385. }
  386. // GroupItem: A group item.
  387. type GroupItem struct {
  388. // Errors: Apiary error details
  389. Errors *Errors `json:"errors,omitempty"`
  390. // Etag: The Etag of this resource.
  391. Etag string `json:"etag,omitempty"`
  392. // GroupId: The ID that YouTube uses to uniquely identify the group that
  393. // contains the
  394. // item.
  395. GroupId string `json:"groupId,omitempty"`
  396. // Id: The ID that YouTube uses to uniquely identify the `channel`,
  397. // `video`,
  398. // `playlist`, or `asset` resource that is included in the group. Note
  399. // that
  400. // this ID refers specifically to the inclusion of that resource in
  401. // a
  402. // particular group and is different than the channel ID, video
  403. // ID,
  404. // playlist ID, or asset ID that uniquely identifies the resource
  405. // itself.
  406. // The `resource.id` property's value specifies the unique channel,
  407. // video,
  408. // playlist, or asset ID.
  409. Id string `json:"id,omitempty"`
  410. // Kind: Identifies the API resource's type. The value will be
  411. // `youtube#groupItem`.
  412. Kind string `json:"kind,omitempty"`
  413. // Resource: The `resource` object contains information that identifies
  414. // the item being
  415. // added to the group.
  416. Resource *GroupItemResource `json:"resource,omitempty"`
  417. // ServerResponse contains the HTTP response code and headers from the
  418. // server.
  419. googleapi.ServerResponse `json:"-"`
  420. // ForceSendFields is a list of field names (e.g. "Errors") to
  421. // unconditionally include in API requests. By default, fields with
  422. // empty values are omitted from API requests. However, any non-pointer,
  423. // non-interface field appearing in ForceSendFields will be sent to the
  424. // server regardless of whether the field is empty or not. This may be
  425. // used to include empty fields in Patch requests.
  426. ForceSendFields []string `json:"-"`
  427. // NullFields is a list of field names (e.g. "Errors") to include in API
  428. // requests with the JSON null value. By default, fields with empty
  429. // values are omitted from API requests. However, any field with an
  430. // empty value appearing in NullFields will be sent to the server as
  431. // null. It is an error if a field in this list has a non-empty value.
  432. // This may be used to include null fields in Patch requests.
  433. NullFields []string `json:"-"`
  434. }
  435. func (s *GroupItem) MarshalJSON() ([]byte, error) {
  436. type NoMethod GroupItem
  437. raw := NoMethod(*s)
  438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  439. }
  440. type GroupItemResource struct {
  441. // Id: The channel, video, playlist, or asset ID that YouTube uses to
  442. // uniquely
  443. // identify the item that is being added to the group.
  444. Id string `json:"id,omitempty"`
  445. // Kind: Identifies the type of resource being added to the
  446. // group.
  447. //
  448. // Valid values for this property are:
  449. // * `youtube#channel`
  450. // * `youtube#playlist`
  451. // * `youtube#video`
  452. // * `youtubePartner#asset`
  453. Kind string `json:"kind,omitempty"`
  454. // ForceSendFields is a list of field names (e.g. "Id") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. // NullFields is a list of field names (e.g. "Id") to include in API
  462. // requests with the JSON null value. By default, fields with empty
  463. // values are omitted from API requests. However, any field with an
  464. // empty value appearing in NullFields will be sent to the server as
  465. // null. It is an error if a field in this list has a non-empty value.
  466. // This may be used to include null fields in Patch requests.
  467. NullFields []string `json:"-"`
  468. }
  469. func (s *GroupItemResource) MarshalJSON() ([]byte, error) {
  470. type NoMethod GroupItemResource
  471. raw := NoMethod(*s)
  472. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  473. }
  474. // GroupSnippet: A group snippet.
  475. type GroupSnippet struct {
  476. // PublishedAt: The date and time that the group was created. The value
  477. // is specified in
  478. // ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
  479. PublishedAt string `json:"publishedAt,omitempty"`
  480. // Title: The group name. The value must be a non-empty string.
  481. Title string `json:"title,omitempty"`
  482. // ForceSendFields is a list of field names (e.g. "PublishedAt") to
  483. // unconditionally include in API requests. By default, fields with
  484. // empty values are omitted from API requests. However, any non-pointer,
  485. // non-interface field appearing in ForceSendFields will be sent to the
  486. // server regardless of whether the field is empty or not. This may be
  487. // used to include empty fields in Patch requests.
  488. ForceSendFields []string `json:"-"`
  489. // NullFields is a list of field names (e.g. "PublishedAt") to include
  490. // in API requests with the JSON null value. By default, fields with
  491. // empty values are omitted from API requests. However, any field with
  492. // an empty value appearing in NullFields will be sent to the server as
  493. // null. It is an error if a field in this list has a non-empty value.
  494. // This may be used to include null fields in Patch requests.
  495. NullFields []string `json:"-"`
  496. }
  497. func (s *GroupSnippet) MarshalJSON() ([]byte, error) {
  498. type NoMethod GroupSnippet
  499. raw := NoMethod(*s)
  500. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  501. }
  502. // ListGroupItemsResponse: Response message for
  503. // GroupsService.ListGroupItems.
  504. type ListGroupItemsResponse struct {
  505. // Errors: Apiary error details
  506. Errors *Errors `json:"errors,omitempty"`
  507. // Etag: The Etag of this resource.
  508. Etag string `json:"etag,omitempty"`
  509. // Items: A list of groups that match the API request parameters. Each
  510. // item in the
  511. // list represents a `groupItem` resource.
  512. Items []*GroupItem `json:"items,omitempty"`
  513. // Kind: Identifies the API resource's type. The value will
  514. // be
  515. // `youtube#groupItemListResponse`.
  516. Kind string `json:"kind,omitempty"`
  517. // ServerResponse contains the HTTP response code and headers from the
  518. // server.
  519. googleapi.ServerResponse `json:"-"`
  520. // ForceSendFields is a list of field names (e.g. "Errors") to
  521. // unconditionally include in API requests. By default, fields with
  522. // empty values are omitted from API requests. However, any non-pointer,
  523. // non-interface field appearing in ForceSendFields will be sent to the
  524. // server regardless of whether the field is empty or not. This may be
  525. // used to include empty fields in Patch requests.
  526. ForceSendFields []string `json:"-"`
  527. // NullFields is a list of field names (e.g. "Errors") to include in API
  528. // requests with the JSON null value. By default, fields with empty
  529. // values are omitted from API requests. However, any field with an
  530. // empty value appearing in NullFields will be sent to the server as
  531. // null. It is an error if a field in this list has a non-empty value.
  532. // This may be used to include null fields in Patch requests.
  533. NullFields []string `json:"-"`
  534. }
  535. func (s *ListGroupItemsResponse) MarshalJSON() ([]byte, error) {
  536. type NoMethod ListGroupItemsResponse
  537. raw := NoMethod(*s)
  538. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  539. }
  540. // ListGroupsResponse: Response message for GroupsService.ListGroups.
  541. type ListGroupsResponse struct {
  542. // Errors: Apiary error details
  543. Errors *Errors `json:"errors,omitempty"`
  544. // Etag: The Etag of this resource.
  545. Etag string `json:"etag,omitempty"`
  546. // Items: A list of groups that match the API request parameters. Each
  547. // item in the
  548. // list represents a `group` resource.
  549. Items []*Group `json:"items,omitempty"`
  550. // Kind: Identifies the API resource's type. The value will
  551. // be
  552. // `youtube#groupListResponse`.
  553. Kind string `json:"kind,omitempty"`
  554. // NextPageToken: The token that can be used as the value of the
  555. // `pageToken` parameter to
  556. // retrieve the next page in the result set.
  557. NextPageToken string `json:"nextPageToken,omitempty"`
  558. // ServerResponse contains the HTTP response code and headers from the
  559. // server.
  560. googleapi.ServerResponse `json:"-"`
  561. // ForceSendFields is a list of field names (e.g. "Errors") to
  562. // unconditionally include in API requests. By default, fields with
  563. // empty values are omitted from API requests. However, any non-pointer,
  564. // non-interface field appearing in ForceSendFields will be sent to the
  565. // server regardless of whether the field is empty or not. This may be
  566. // used to include empty fields in Patch requests.
  567. ForceSendFields []string `json:"-"`
  568. // NullFields is a list of field names (e.g. "Errors") to include in API
  569. // requests with the JSON null value. By default, fields with empty
  570. // values are omitted from API requests. However, any field with an
  571. // empty value appearing in NullFields will be sent to the server as
  572. // null. It is an error if a field in this list has a non-empty value.
  573. // This may be used to include null fields in Patch requests.
  574. NullFields []string `json:"-"`
  575. }
  576. func (s *ListGroupsResponse) MarshalJSON() ([]byte, error) {
  577. type NoMethod ListGroupsResponse
  578. raw := NoMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  580. }
  581. // QueryResponse: Response message for TargetedQueriesService.Query.
  582. type QueryResponse struct {
  583. // ColumnHeaders: This value specifies information about the data
  584. // returned in the `rows`
  585. // fields. Each item in the `columnHeaders` list identifies a field
  586. // returned
  587. // in the `rows` value, which contains a list of comma-delimited data.
  588. // The
  589. // `columnHeaders` list will begin with the dimensions specified in the
  590. // API
  591. // request, which will be followed by the metrics specified in the
  592. // API
  593. // request. The order of both dimensions and metrics will match the
  594. // ordering
  595. // in the API request. For example, if the API request contains the
  596. // parameters
  597. // `dimensions=ageGroup,gender&metrics=viewerPercentage`, the API
  598. // response
  599. // will return columns in this order: `ageGroup`,
  600. // `gender`,
  601. // `viewerPercentage`.
  602. ColumnHeaders []*ResultTableColumnHeader `json:"columnHeaders,omitempty"`
  603. // Errors: When set, indicates that the operation failed.
  604. Errors *Errors `json:"errors,omitempty"`
  605. // Kind: This value specifies the type of data included in the API
  606. // response.
  607. // For the query method, the kind property value will
  608. // be
  609. // `youtubeAnalytics#resultTable`.
  610. Kind string `json:"kind,omitempty"`
  611. // Rows: The list contains all rows of the result table. Each item in
  612. // the list is
  613. // an array that contains comma-delimited data corresponding to a single
  614. // row
  615. // of data. The order of the comma-delimited data fields will match
  616. // the
  617. // order of the columns listed in the `columnHeaders` field.
  618. //
  619. // If no data is available for the given query, the `rows` element will
  620. // be
  621. // omitted from the response.
  622. //
  623. // The response for a query with the `day` dimension will not contain
  624. // rows for
  625. // the most recent days.
  626. Rows [][]interface{} `json:"rows,omitempty"`
  627. // ServerResponse contains the HTTP response code and headers from the
  628. // server.
  629. googleapi.ServerResponse `json:"-"`
  630. // ForceSendFields is a list of field names (e.g. "ColumnHeaders") to
  631. // unconditionally include in API requests. By default, fields with
  632. // empty values are omitted from API requests. However, any non-pointer,
  633. // non-interface field appearing in ForceSendFields will be sent to the
  634. // server regardless of whether the field is empty or not. This may be
  635. // used to include empty fields in Patch requests.
  636. ForceSendFields []string `json:"-"`
  637. // NullFields is a list of field names (e.g. "ColumnHeaders") to include
  638. // in API requests with the JSON null value. By default, fields with
  639. // empty values are omitted from API requests. However, any field with
  640. // an empty value appearing in NullFields will be sent to the server as
  641. // null. It is an error if a field in this list has a non-empty value.
  642. // This may be used to include null fields in Patch requests.
  643. NullFields []string `json:"-"`
  644. }
  645. func (s *QueryResponse) MarshalJSON() ([]byte, error) {
  646. type NoMethod QueryResponse
  647. raw := NoMethod(*s)
  648. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  649. }
  650. // ResultTableColumnHeader: The description of a column of the result
  651. // table.
  652. type ResultTableColumnHeader struct {
  653. // ColumnType: The type of the column (`DIMENSION` or `METRIC`).
  654. ColumnType string `json:"columnType,omitempty"`
  655. // DataType: The type of the data in the column (`STRING`, `INTEGER`,
  656. // `FLOAT`, etc.).
  657. DataType string `json:"dataType,omitempty"`
  658. // Name: The name of the dimension or metric.
  659. Name string `json:"name,omitempty"`
  660. // ForceSendFields is a list of field names (e.g. "ColumnType") to
  661. // unconditionally include in API requests. By default, fields with
  662. // empty values are omitted from API requests. However, any non-pointer,
  663. // non-interface field appearing in ForceSendFields will be sent to the
  664. // server regardless of whether the field is empty or not. This may be
  665. // used to include empty fields in Patch requests.
  666. ForceSendFields []string `json:"-"`
  667. // NullFields is a list of field names (e.g. "ColumnType") to include in
  668. // API requests with the JSON null value. By default, fields with empty
  669. // values are omitted from API requests. However, any field with an
  670. // empty value appearing in NullFields will be sent to the server as
  671. // null. It is an error if a field in this list has a non-empty value.
  672. // This may be used to include null fields in Patch requests.
  673. NullFields []string `json:"-"`
  674. }
  675. func (s *ResultTableColumnHeader) MarshalJSON() ([]byte, error) {
  676. type NoMethod ResultTableColumnHeader
  677. raw := NoMethod(*s)
  678. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  679. }
  680. // method id "youtubeAnalytics.groupItems.delete":
  681. type GroupItemsDeleteCall struct {
  682. s *Service
  683. urlParams_ gensupport.URLParams
  684. ctx_ context.Context
  685. header_ http.Header
  686. }
  687. // Delete: Removes an item from a group.
  688. func (r *GroupItemsService) Delete() *GroupItemsDeleteCall {
  689. c := &GroupItemsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  690. return c
  691. }
  692. // Id sets the optional parameter "id": The `id` parameter specifies the
  693. // YouTube group item ID of the group item
  694. // that is being deleted.
  695. func (c *GroupItemsDeleteCall) Id(id string) *GroupItemsDeleteCall {
  696. c.urlParams_.Set("id", id)
  697. return c
  698. }
  699. // OnBehalfOfContentOwner sets the optional parameter
  700. // "onBehalfOfContentOwner": This parameter can only be used in a
  701. // properly authorized request. **Note:**
  702. // This parameter is intended exclusively for YouTube content partners
  703. // that
  704. // own and manage many different YouTube channels.
  705. //
  706. // The `onBehalfOfContentOwner` parameter indicates that the
  707. // request's
  708. // authorization credentials identify a YouTube user who is acting on
  709. // behalf
  710. // of the content owner specified in the parameter value. It allows
  711. // content
  712. // owners to authenticate once and get access to all their video and
  713. // channel
  714. // data, without having to provide authentication credentials for
  715. // each
  716. // individual channel. The account that the user authenticates with must
  717. // be
  718. // linked to the specified YouTube content owner.
  719. func (c *GroupItemsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsDeleteCall {
  720. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  721. return c
  722. }
  723. // Fields allows partial responses to be retrieved. See
  724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  725. // for more information.
  726. func (c *GroupItemsDeleteCall) Fields(s ...googleapi.Field) *GroupItemsDeleteCall {
  727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  728. return c
  729. }
  730. // Context sets the context to be used in this call's Do method. Any
  731. // pending HTTP request will be aborted if the provided context is
  732. // canceled.
  733. func (c *GroupItemsDeleteCall) Context(ctx context.Context) *GroupItemsDeleteCall {
  734. c.ctx_ = ctx
  735. return c
  736. }
  737. // Header returns an http.Header that can be modified by the caller to
  738. // add HTTP headers to the request.
  739. func (c *GroupItemsDeleteCall) Header() http.Header {
  740. if c.header_ == nil {
  741. c.header_ = make(http.Header)
  742. }
  743. return c.header_
  744. }
  745. func (c *GroupItemsDeleteCall) doRequest(alt string) (*http.Response, error) {
  746. reqHeaders := make(http.Header)
  747. for k, v := range c.header_ {
  748. reqHeaders[k] = v
  749. }
  750. reqHeaders.Set("User-Agent", c.s.userAgent())
  751. var body io.Reader = nil
  752. c.urlParams_.Set("alt", alt)
  753. c.urlParams_.Set("prettyPrint", "false")
  754. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groupItems")
  755. urls += "?" + c.urlParams_.Encode()
  756. req, err := http.NewRequest("DELETE", urls, body)
  757. if err != nil {
  758. return nil, err
  759. }
  760. req.Header = reqHeaders
  761. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  762. }
  763. // Do executes the "youtubeAnalytics.groupItems.delete" call.
  764. // Exactly one of *EmptyResponse or error will be non-nil. Any non-2xx
  765. // status code is an error. Response headers are in either
  766. // *EmptyResponse.ServerResponse.Header or (if a response was returned
  767. // at all) in error.(*googleapi.Error).Header. Use
  768. // googleapi.IsNotModified to check whether the returned error was
  769. // because http.StatusNotModified was returned.
  770. func (c *GroupItemsDeleteCall) Do(opts ...googleapi.CallOption) (*EmptyResponse, error) {
  771. gensupport.SetOptions(c.urlParams_, opts...)
  772. res, err := c.doRequest("json")
  773. if res != nil && res.StatusCode == http.StatusNotModified {
  774. if res.Body != nil {
  775. res.Body.Close()
  776. }
  777. return nil, &googleapi.Error{
  778. Code: res.StatusCode,
  779. Header: res.Header,
  780. }
  781. }
  782. if err != nil {
  783. return nil, err
  784. }
  785. defer googleapi.CloseBody(res)
  786. if err := googleapi.CheckResponse(res); err != nil {
  787. return nil, err
  788. }
  789. ret := &EmptyResponse{
  790. ServerResponse: googleapi.ServerResponse{
  791. Header: res.Header,
  792. HTTPStatusCode: res.StatusCode,
  793. },
  794. }
  795. target := &ret
  796. if err := gensupport.DecodeResponse(target, res); err != nil {
  797. return nil, err
  798. }
  799. return ret, nil
  800. // {
  801. // "description": "Removes an item from a group.",
  802. // "flatPath": "v2/groupItems",
  803. // "httpMethod": "DELETE",
  804. // "id": "youtubeAnalytics.groupItems.delete",
  805. // "parameterOrder": [],
  806. // "parameters": {
  807. // "id": {
  808. // "description": "The `id` parameter specifies the YouTube group item ID of the group item\nthat is being deleted.",
  809. // "location": "query",
  810. // "type": "string"
  811. // },
  812. // "onBehalfOfContentOwner": {
  813. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  814. // "location": "query",
  815. // "type": "string"
  816. // }
  817. // },
  818. // "path": "v2/groupItems",
  819. // "response": {
  820. // "$ref": "EmptyResponse"
  821. // },
  822. // "scopes": [
  823. // "https://www.googleapis.com/auth/youtube",
  824. // "https://www.googleapis.com/auth/youtube.readonly",
  825. // "https://www.googleapis.com/auth/youtubepartner",
  826. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  827. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  828. // ]
  829. // }
  830. }
  831. // method id "youtubeAnalytics.groupItems.insert":
  832. type GroupItemsInsertCall struct {
  833. s *Service
  834. groupitem *GroupItem
  835. urlParams_ gensupport.URLParams
  836. ctx_ context.Context
  837. header_ http.Header
  838. }
  839. // Insert: Creates a group item.
  840. func (r *GroupItemsService) Insert(groupitem *GroupItem) *GroupItemsInsertCall {
  841. c := &GroupItemsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  842. c.groupitem = groupitem
  843. return c
  844. }
  845. // OnBehalfOfContentOwner sets the optional parameter
  846. // "onBehalfOfContentOwner": This parameter can only be used in a
  847. // properly authorized request. **Note:**
  848. // This parameter is intended exclusively for YouTube content partners
  849. // that
  850. // own and manage many different YouTube channels.
  851. //
  852. // The `onBehalfOfContentOwner` parameter indicates that the
  853. // request's
  854. // authorization credentials identify a YouTube user who is acting on
  855. // behalf
  856. // of the content owner specified in the parameter value. It allows
  857. // content
  858. // owners to authenticate once and get access to all their video and
  859. // channel
  860. // data, without having to provide authentication credentials for
  861. // each
  862. // individual channel. The account that the user authenticates with must
  863. // be
  864. // linked to the specified YouTube content owner.
  865. func (c *GroupItemsInsertCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsInsertCall {
  866. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  867. return c
  868. }
  869. // Fields allows partial responses to be retrieved. See
  870. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  871. // for more information.
  872. func (c *GroupItemsInsertCall) Fields(s ...googleapi.Field) *GroupItemsInsertCall {
  873. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  874. return c
  875. }
  876. // Context sets the context to be used in this call's Do method. Any
  877. // pending HTTP request will be aborted if the provided context is
  878. // canceled.
  879. func (c *GroupItemsInsertCall) Context(ctx context.Context) *GroupItemsInsertCall {
  880. c.ctx_ = ctx
  881. return c
  882. }
  883. // Header returns an http.Header that can be modified by the caller to
  884. // add HTTP headers to the request.
  885. func (c *GroupItemsInsertCall) Header() http.Header {
  886. if c.header_ == nil {
  887. c.header_ = make(http.Header)
  888. }
  889. return c.header_
  890. }
  891. func (c *GroupItemsInsertCall) doRequest(alt string) (*http.Response, error) {
  892. reqHeaders := make(http.Header)
  893. for k, v := range c.header_ {
  894. reqHeaders[k] = v
  895. }
  896. reqHeaders.Set("User-Agent", c.s.userAgent())
  897. var body io.Reader = nil
  898. body, err := googleapi.WithoutDataWrapper.JSONReader(c.groupitem)
  899. if err != nil {
  900. return nil, err
  901. }
  902. reqHeaders.Set("Content-Type", "application/json")
  903. c.urlParams_.Set("alt", alt)
  904. c.urlParams_.Set("prettyPrint", "false")
  905. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groupItems")
  906. urls += "?" + c.urlParams_.Encode()
  907. req, err := http.NewRequest("POST", urls, body)
  908. if err != nil {
  909. return nil, err
  910. }
  911. req.Header = reqHeaders
  912. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  913. }
  914. // Do executes the "youtubeAnalytics.groupItems.insert" call.
  915. // Exactly one of *GroupItem or error will be non-nil. Any non-2xx
  916. // status code is an error. Response headers are in either
  917. // *GroupItem.ServerResponse.Header or (if a response was returned at
  918. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  919. // to check whether the returned error was because
  920. // http.StatusNotModified was returned.
  921. func (c *GroupItemsInsertCall) Do(opts ...googleapi.CallOption) (*GroupItem, error) {
  922. gensupport.SetOptions(c.urlParams_, opts...)
  923. res, err := c.doRequest("json")
  924. if res != nil && res.StatusCode == http.StatusNotModified {
  925. if res.Body != nil {
  926. res.Body.Close()
  927. }
  928. return nil, &googleapi.Error{
  929. Code: res.StatusCode,
  930. Header: res.Header,
  931. }
  932. }
  933. if err != nil {
  934. return nil, err
  935. }
  936. defer googleapi.CloseBody(res)
  937. if err := googleapi.CheckResponse(res); err != nil {
  938. return nil, err
  939. }
  940. ret := &GroupItem{
  941. ServerResponse: googleapi.ServerResponse{
  942. Header: res.Header,
  943. HTTPStatusCode: res.StatusCode,
  944. },
  945. }
  946. target := &ret
  947. if err := gensupport.DecodeResponse(target, res); err != nil {
  948. return nil, err
  949. }
  950. return ret, nil
  951. // {
  952. // "description": "Creates a group item.",
  953. // "flatPath": "v2/groupItems",
  954. // "httpMethod": "POST",
  955. // "id": "youtubeAnalytics.groupItems.insert",
  956. // "parameterOrder": [],
  957. // "parameters": {
  958. // "onBehalfOfContentOwner": {
  959. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  960. // "location": "query",
  961. // "type": "string"
  962. // }
  963. // },
  964. // "path": "v2/groupItems",
  965. // "request": {
  966. // "$ref": "GroupItem"
  967. // },
  968. // "response": {
  969. // "$ref": "GroupItem"
  970. // },
  971. // "scopes": [
  972. // "https://www.googleapis.com/auth/youtube",
  973. // "https://www.googleapis.com/auth/youtube.readonly",
  974. // "https://www.googleapis.com/auth/youtubepartner",
  975. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  976. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  977. // ]
  978. // }
  979. }
  980. // method id "youtubeAnalytics.groupItems.list":
  981. type GroupItemsListCall struct {
  982. s *Service
  983. urlParams_ gensupport.URLParams
  984. ifNoneMatch_ string
  985. ctx_ context.Context
  986. header_ http.Header
  987. }
  988. // List: Returns a collection of group items that match the API request
  989. // parameters.
  990. func (r *GroupItemsService) List() *GroupItemsListCall {
  991. c := &GroupItemsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  992. return c
  993. }
  994. // GroupId sets the optional parameter "groupId": The `groupId`
  995. // parameter specifies the unique ID of the group for which you
  996. // want to retrieve group items.
  997. func (c *GroupItemsListCall) GroupId(groupId string) *GroupItemsListCall {
  998. c.urlParams_.Set("groupId", groupId)
  999. return c
  1000. }
  1001. // OnBehalfOfContentOwner sets the optional parameter
  1002. // "onBehalfOfContentOwner": This parameter can only be used in a
  1003. // properly authorized request. **Note:**
  1004. // This parameter is intended exclusively for YouTube content partners
  1005. // that
  1006. // own and manage many different YouTube channels.
  1007. //
  1008. // The `onBehalfOfContentOwner` parameter indicates that the
  1009. // request's
  1010. // authorization credentials identify a YouTube user who is acting on
  1011. // behalf
  1012. // of the content owner specified in the parameter value. It allows
  1013. // content
  1014. // owners to authenticate once and get access to all their video and
  1015. // channel
  1016. // data, without having to provide authentication credentials for
  1017. // each
  1018. // individual channel. The account that the user authenticates with must
  1019. // be
  1020. // linked to the specified YouTube content owner.
  1021. func (c *GroupItemsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupItemsListCall {
  1022. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1023. return c
  1024. }
  1025. // Fields allows partial responses to be retrieved. See
  1026. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1027. // for more information.
  1028. func (c *GroupItemsListCall) Fields(s ...googleapi.Field) *GroupItemsListCall {
  1029. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1030. return c
  1031. }
  1032. // IfNoneMatch sets the optional parameter which makes the operation
  1033. // fail if the object's ETag matches the given value. This is useful for
  1034. // getting updates only after the object has changed since the last
  1035. // request. Use googleapi.IsNotModified to check whether the response
  1036. // error from Do is the result of In-None-Match.
  1037. func (c *GroupItemsListCall) IfNoneMatch(entityTag string) *GroupItemsListCall {
  1038. c.ifNoneMatch_ = entityTag
  1039. return c
  1040. }
  1041. // Context sets the context to be used in this call's Do method. Any
  1042. // pending HTTP request will be aborted if the provided context is
  1043. // canceled.
  1044. func (c *GroupItemsListCall) Context(ctx context.Context) *GroupItemsListCall {
  1045. c.ctx_ = ctx
  1046. return c
  1047. }
  1048. // Header returns an http.Header that can be modified by the caller to
  1049. // add HTTP headers to the request.
  1050. func (c *GroupItemsListCall) Header() http.Header {
  1051. if c.header_ == nil {
  1052. c.header_ = make(http.Header)
  1053. }
  1054. return c.header_
  1055. }
  1056. func (c *GroupItemsListCall) doRequest(alt string) (*http.Response, error) {
  1057. reqHeaders := make(http.Header)
  1058. for k, v := range c.header_ {
  1059. reqHeaders[k] = v
  1060. }
  1061. reqHeaders.Set("User-Agent", c.s.userAgent())
  1062. if c.ifNoneMatch_ != "" {
  1063. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1064. }
  1065. var body io.Reader = nil
  1066. c.urlParams_.Set("alt", alt)
  1067. c.urlParams_.Set("prettyPrint", "false")
  1068. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groupItems")
  1069. urls += "?" + c.urlParams_.Encode()
  1070. req, err := http.NewRequest("GET", urls, body)
  1071. if err != nil {
  1072. return nil, err
  1073. }
  1074. req.Header = reqHeaders
  1075. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1076. }
  1077. // Do executes the "youtubeAnalytics.groupItems.list" call.
  1078. // Exactly one of *ListGroupItemsResponse or error will be non-nil. Any
  1079. // non-2xx status code is an error. Response headers are in either
  1080. // *ListGroupItemsResponse.ServerResponse.Header or (if a response was
  1081. // returned at all) in error.(*googleapi.Error).Header. Use
  1082. // googleapi.IsNotModified to check whether the returned error was
  1083. // because http.StatusNotModified was returned.
  1084. func (c *GroupItemsListCall) Do(opts ...googleapi.CallOption) (*ListGroupItemsResponse, error) {
  1085. gensupport.SetOptions(c.urlParams_, opts...)
  1086. res, err := c.doRequest("json")
  1087. if res != nil && res.StatusCode == http.StatusNotModified {
  1088. if res.Body != nil {
  1089. res.Body.Close()
  1090. }
  1091. return nil, &googleapi.Error{
  1092. Code: res.StatusCode,
  1093. Header: res.Header,
  1094. }
  1095. }
  1096. if err != nil {
  1097. return nil, err
  1098. }
  1099. defer googleapi.CloseBody(res)
  1100. if err := googleapi.CheckResponse(res); err != nil {
  1101. return nil, err
  1102. }
  1103. ret := &ListGroupItemsResponse{
  1104. ServerResponse: googleapi.ServerResponse{
  1105. Header: res.Header,
  1106. HTTPStatusCode: res.StatusCode,
  1107. },
  1108. }
  1109. target := &ret
  1110. if err := gensupport.DecodeResponse(target, res); err != nil {
  1111. return nil, err
  1112. }
  1113. return ret, nil
  1114. // {
  1115. // "description": "Returns a collection of group items that match the API request parameters.",
  1116. // "flatPath": "v2/groupItems",
  1117. // "httpMethod": "GET",
  1118. // "id": "youtubeAnalytics.groupItems.list",
  1119. // "parameterOrder": [],
  1120. // "parameters": {
  1121. // "groupId": {
  1122. // "description": "The `groupId` parameter specifies the unique ID of the group for which you\nwant to retrieve group items.",
  1123. // "location": "query",
  1124. // "type": "string"
  1125. // },
  1126. // "onBehalfOfContentOwner": {
  1127. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  1128. // "location": "query",
  1129. // "type": "string"
  1130. // }
  1131. // },
  1132. // "path": "v2/groupItems",
  1133. // "response": {
  1134. // "$ref": "ListGroupItemsResponse"
  1135. // },
  1136. // "scopes": [
  1137. // "https://www.googleapis.com/auth/youtube",
  1138. // "https://www.googleapis.com/auth/youtube.readonly",
  1139. // "https://www.googleapis.com/auth/youtubepartner",
  1140. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1141. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1142. // ]
  1143. // }
  1144. }
  1145. // method id "youtubeAnalytics.groups.delete":
  1146. type GroupsDeleteCall struct {
  1147. s *Service
  1148. urlParams_ gensupport.URLParams
  1149. ctx_ context.Context
  1150. header_ http.Header
  1151. }
  1152. // Delete: Deletes a group.
  1153. func (r *GroupsService) Delete() *GroupsDeleteCall {
  1154. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1155. return c
  1156. }
  1157. // Id sets the optional parameter "id": The `id` parameter specifies the
  1158. // YouTube group ID of the group that is
  1159. // being deleted.
  1160. func (c *GroupsDeleteCall) Id(id string) *GroupsDeleteCall {
  1161. c.urlParams_.Set("id", id)
  1162. return c
  1163. }
  1164. // OnBehalfOfContentOwner sets the optional parameter
  1165. // "onBehalfOfContentOwner": This parameter can only be used in a
  1166. // properly authorized request. **Note:**
  1167. // This parameter is intended exclusively for YouTube content partners
  1168. // that
  1169. // own and manage many different YouTube channels.
  1170. //
  1171. // The `onBehalfOfContentOwner` parameter indicates that the
  1172. // request's
  1173. // authorization credentials identify a YouTube user who is acting on
  1174. // behalf
  1175. // of the content owner specified in the parameter value. It allows
  1176. // content
  1177. // owners to authenticate once and get access to all their video and
  1178. // channel
  1179. // data, without having to provide authentication credentials for
  1180. // each
  1181. // individual channel. The account that the user authenticates with must
  1182. // be
  1183. // linked to the specified YouTube content owner.
  1184. func (c *GroupsDeleteCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsDeleteCall {
  1185. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1186. return c
  1187. }
  1188. // Fields allows partial responses to be retrieved. See
  1189. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1190. // for more information.
  1191. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  1192. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1193. return c
  1194. }
  1195. // Context sets the context to be used in this call's Do method. Any
  1196. // pending HTTP request will be aborted if the provided context is
  1197. // canceled.
  1198. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  1199. c.ctx_ = ctx
  1200. return c
  1201. }
  1202. // Header returns an http.Header that can be modified by the caller to
  1203. // add HTTP headers to the request.
  1204. func (c *GroupsDeleteCall) Header() http.Header {
  1205. if c.header_ == nil {
  1206. c.header_ = make(http.Header)
  1207. }
  1208. return c.header_
  1209. }
  1210. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1211. reqHeaders := make(http.Header)
  1212. for k, v := range c.header_ {
  1213. reqHeaders[k] = v
  1214. }
  1215. reqHeaders.Set("User-Agent", c.s.userAgent())
  1216. var body io.Reader = nil
  1217. c.urlParams_.Set("alt", alt)
  1218. c.urlParams_.Set("prettyPrint", "false")
  1219. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groups")
  1220. urls += "?" + c.urlParams_.Encode()
  1221. req, err := http.NewRequest("DELETE", urls, body)
  1222. if err != nil {
  1223. return nil, err
  1224. }
  1225. req.Header = reqHeaders
  1226. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1227. }
  1228. // Do executes the "youtubeAnalytics.groups.delete" call.
  1229. // Exactly one of *EmptyResponse or error will be non-nil. Any non-2xx
  1230. // status code is an error. Response headers are in either
  1231. // *EmptyResponse.ServerResponse.Header or (if a response was returned
  1232. // at all) in error.(*googleapi.Error).Header. Use
  1233. // googleapi.IsNotModified to check whether the returned error was
  1234. // because http.StatusNotModified was returned.
  1235. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) (*EmptyResponse, error) {
  1236. gensupport.SetOptions(c.urlParams_, opts...)
  1237. res, err := c.doRequest("json")
  1238. if res != nil && res.StatusCode == http.StatusNotModified {
  1239. if res.Body != nil {
  1240. res.Body.Close()
  1241. }
  1242. return nil, &googleapi.Error{
  1243. Code: res.StatusCode,
  1244. Header: res.Header,
  1245. }
  1246. }
  1247. if err != nil {
  1248. return nil, err
  1249. }
  1250. defer googleapi.CloseBody(res)
  1251. if err := googleapi.CheckResponse(res); err != nil {
  1252. return nil, err
  1253. }
  1254. ret := &EmptyResponse{
  1255. ServerResponse: googleapi.ServerResponse{
  1256. Header: res.Header,
  1257. HTTPStatusCode: res.StatusCode,
  1258. },
  1259. }
  1260. target := &ret
  1261. if err := gensupport.DecodeResponse(target, res); err != nil {
  1262. return nil, err
  1263. }
  1264. return ret, nil
  1265. // {
  1266. // "description": "Deletes a group.",
  1267. // "flatPath": "v2/groups",
  1268. // "httpMethod": "DELETE",
  1269. // "id": "youtubeAnalytics.groups.delete",
  1270. // "parameterOrder": [],
  1271. // "parameters": {
  1272. // "id": {
  1273. // "description": "The `id` parameter specifies the YouTube group ID of the group that is\nbeing deleted.",
  1274. // "location": "query",
  1275. // "type": "string"
  1276. // },
  1277. // "onBehalfOfContentOwner": {
  1278. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  1279. // "location": "query",
  1280. // "type": "string"
  1281. // }
  1282. // },
  1283. // "path": "v2/groups",
  1284. // "response": {
  1285. // "$ref": "EmptyResponse"
  1286. // },
  1287. // "scopes": [
  1288. // "https://www.googleapis.com/auth/youtube",
  1289. // "https://www.googleapis.com/auth/youtube.readonly",
  1290. // "https://www.googleapis.com/auth/youtubepartner",
  1291. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1292. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1293. // ]
  1294. // }
  1295. }
  1296. // method id "youtubeAnalytics.groups.insert":
  1297. type GroupsInsertCall struct {
  1298. s *Service
  1299. group *Group
  1300. urlParams_ gensupport.URLParams
  1301. ctx_ context.Context
  1302. header_ http.Header
  1303. }
  1304. // Insert: Creates a group.
  1305. func (r *GroupsService) Insert(group *Group) *GroupsInsertCall {
  1306. c := &GroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1307. c.group = group
  1308. return c
  1309. }
  1310. // OnBehalfOfContentOwner sets the optional parameter
  1311. // "onBehalfOfContentOwner": This parameter can only be used in a
  1312. // properly authorized request. **Note:**
  1313. // This parameter is intended exclusively for YouTube content partners
  1314. // that
  1315. // own and manage many different YouTube channels.
  1316. //
  1317. // The `onBehalfOfContentOwner` parameter indicates that the
  1318. // request's
  1319. // authorization credentials identify a YouTube user who is acting on
  1320. // behalf
  1321. // of the content owner specified in the parameter value. It allows
  1322. // content
  1323. // owners to authenticate once and get access to all their video and
  1324. // channel
  1325. // data, without having to provide authentication credentials for
  1326. // each
  1327. // individual channel. The account that the user authenticates with must
  1328. // be
  1329. // linked to the specified YouTube content owner.
  1330. func (c *GroupsInsertCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsInsertCall {
  1331. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1332. return c
  1333. }
  1334. // Fields allows partial responses to be retrieved. See
  1335. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1336. // for more information.
  1337. func (c *GroupsInsertCall) Fields(s ...googleapi.Field) *GroupsInsertCall {
  1338. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1339. return c
  1340. }
  1341. // Context sets the context to be used in this call's Do method. Any
  1342. // pending HTTP request will be aborted if the provided context is
  1343. // canceled.
  1344. func (c *GroupsInsertCall) Context(ctx context.Context) *GroupsInsertCall {
  1345. c.ctx_ = ctx
  1346. return c
  1347. }
  1348. // Header returns an http.Header that can be modified by the caller to
  1349. // add HTTP headers to the request.
  1350. func (c *GroupsInsertCall) Header() http.Header {
  1351. if c.header_ == nil {
  1352. c.header_ = make(http.Header)
  1353. }
  1354. return c.header_
  1355. }
  1356. func (c *GroupsInsertCall) doRequest(alt string) (*http.Response, error) {
  1357. reqHeaders := make(http.Header)
  1358. for k, v := range c.header_ {
  1359. reqHeaders[k] = v
  1360. }
  1361. reqHeaders.Set("User-Agent", c.s.userAgent())
  1362. var body io.Reader = nil
  1363. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  1364. if err != nil {
  1365. return nil, err
  1366. }
  1367. reqHeaders.Set("Content-Type", "application/json")
  1368. c.urlParams_.Set("alt", alt)
  1369. c.urlParams_.Set("prettyPrint", "false")
  1370. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groups")
  1371. urls += "?" + c.urlParams_.Encode()
  1372. req, err := http.NewRequest("POST", urls, body)
  1373. if err != nil {
  1374. return nil, err
  1375. }
  1376. req.Header = reqHeaders
  1377. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1378. }
  1379. // Do executes the "youtubeAnalytics.groups.insert" call.
  1380. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  1381. // code is an error. Response headers are in either
  1382. // *Group.ServerResponse.Header or (if a response was returned at all)
  1383. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1384. // check whether the returned error was because http.StatusNotModified
  1385. // was returned.
  1386. func (c *GroupsInsertCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  1387. gensupport.SetOptions(c.urlParams_, opts...)
  1388. res, err := c.doRequest("json")
  1389. if res != nil && res.StatusCode == http.StatusNotModified {
  1390. if res.Body != nil {
  1391. res.Body.Close()
  1392. }
  1393. return nil, &googleapi.Error{
  1394. Code: res.StatusCode,
  1395. Header: res.Header,
  1396. }
  1397. }
  1398. if err != nil {
  1399. return nil, err
  1400. }
  1401. defer googleapi.CloseBody(res)
  1402. if err := googleapi.CheckResponse(res); err != nil {
  1403. return nil, err
  1404. }
  1405. ret := &Group{
  1406. ServerResponse: googleapi.ServerResponse{
  1407. Header: res.Header,
  1408. HTTPStatusCode: res.StatusCode,
  1409. },
  1410. }
  1411. target := &ret
  1412. if err := gensupport.DecodeResponse(target, res); err != nil {
  1413. return nil, err
  1414. }
  1415. return ret, nil
  1416. // {
  1417. // "description": "Creates a group.",
  1418. // "flatPath": "v2/groups",
  1419. // "httpMethod": "POST",
  1420. // "id": "youtubeAnalytics.groups.insert",
  1421. // "parameterOrder": [],
  1422. // "parameters": {
  1423. // "onBehalfOfContentOwner": {
  1424. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  1425. // "location": "query",
  1426. // "type": "string"
  1427. // }
  1428. // },
  1429. // "path": "v2/groups",
  1430. // "request": {
  1431. // "$ref": "Group"
  1432. // },
  1433. // "response": {
  1434. // "$ref": "Group"
  1435. // },
  1436. // "scopes": [
  1437. // "https://www.googleapis.com/auth/youtube",
  1438. // "https://www.googleapis.com/auth/youtube.readonly",
  1439. // "https://www.googleapis.com/auth/youtubepartner",
  1440. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1441. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1442. // ]
  1443. // }
  1444. }
  1445. // method id "youtubeAnalytics.groups.list":
  1446. type GroupsListCall struct {
  1447. s *Service
  1448. urlParams_ gensupport.URLParams
  1449. ifNoneMatch_ string
  1450. ctx_ context.Context
  1451. header_ http.Header
  1452. }
  1453. // List: Returns a collection of groups that match the API request
  1454. // parameters. For
  1455. // example, you can retrieve all groups that the authenticated user
  1456. // owns,
  1457. // or you can retrieve one or more groups by their unique IDs.
  1458. func (r *GroupsService) List() *GroupsListCall {
  1459. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1460. return c
  1461. }
  1462. // Id sets the optional parameter "id": The `id` parameter specifies a
  1463. // comma-separated list of the YouTube group
  1464. // ID(s) for the resource(s) that are being retrieved. Each group must
  1465. // be
  1466. // owned by the authenticated user. In a `group` resource, the `id`
  1467. // property
  1468. // specifies the group's YouTube group ID.
  1469. //
  1470. // Note that if you do not specify a value for the `id` parameter, then
  1471. // you
  1472. // must set the `mine` parameter to `true`.
  1473. func (c *GroupsListCall) Id(id string) *GroupsListCall {
  1474. c.urlParams_.Set("id", id)
  1475. return c
  1476. }
  1477. // Mine sets the optional parameter "mine": This parameter can only be
  1478. // used in a properly authorized request. Set this
  1479. // parameter's value to true to retrieve all groups owned by the
  1480. // authenticated
  1481. // user.
  1482. func (c *GroupsListCall) Mine(mine bool) *GroupsListCall {
  1483. c.urlParams_.Set("mine", fmt.Sprint(mine))
  1484. return c
  1485. }
  1486. // OnBehalfOfContentOwner sets the optional parameter
  1487. // "onBehalfOfContentOwner": This parameter can only be used in a
  1488. // properly authorized request. **Note:**
  1489. // This parameter is intended exclusively for YouTube content partners
  1490. // that
  1491. // own and manage many different YouTube channels.
  1492. //
  1493. // The `onBehalfOfContentOwner` parameter indicates that the
  1494. // request's
  1495. // authorization credentials identify a YouTube user who is acting on
  1496. // behalf
  1497. // of the content owner specified in the parameter value. It allows
  1498. // content
  1499. // owners to authenticate once and get access to all their video and
  1500. // channel
  1501. // data, without having to provide authentication credentials for
  1502. // each
  1503. // individual channel. The account that the user authenticates with must
  1504. // be
  1505. // linked to the specified YouTube content owner.
  1506. func (c *GroupsListCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsListCall {
  1507. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1508. return c
  1509. }
  1510. // PageToken sets the optional parameter "pageToken": The `pageToken`
  1511. // parameter identifies a specific page in the result set that
  1512. // should be returned. In an API response, the `nextPageToken`
  1513. // property
  1514. // identifies the next page that can be retrieved.
  1515. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  1516. c.urlParams_.Set("pageToken", pageToken)
  1517. return c
  1518. }
  1519. // Fields allows partial responses to be retrieved. See
  1520. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1521. // for more information.
  1522. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  1523. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1524. return c
  1525. }
  1526. // IfNoneMatch sets the optional parameter which makes the operation
  1527. // fail if the object's ETag matches the given value. This is useful for
  1528. // getting updates only after the object has changed since the last
  1529. // request. Use googleapi.IsNotModified to check whether the response
  1530. // error from Do is the result of In-None-Match.
  1531. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  1532. c.ifNoneMatch_ = entityTag
  1533. return c
  1534. }
  1535. // Context sets the context to be used in this call's Do method. Any
  1536. // pending HTTP request will be aborted if the provided context is
  1537. // canceled.
  1538. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  1539. c.ctx_ = ctx
  1540. return c
  1541. }
  1542. // Header returns an http.Header that can be modified by the caller to
  1543. // add HTTP headers to the request.
  1544. func (c *GroupsListCall) Header() http.Header {
  1545. if c.header_ == nil {
  1546. c.header_ = make(http.Header)
  1547. }
  1548. return c.header_
  1549. }
  1550. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  1551. reqHeaders := make(http.Header)
  1552. for k, v := range c.header_ {
  1553. reqHeaders[k] = v
  1554. }
  1555. reqHeaders.Set("User-Agent", c.s.userAgent())
  1556. if c.ifNoneMatch_ != "" {
  1557. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1558. }
  1559. var body io.Reader = nil
  1560. c.urlParams_.Set("alt", alt)
  1561. c.urlParams_.Set("prettyPrint", "false")
  1562. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groups")
  1563. urls += "?" + c.urlParams_.Encode()
  1564. req, err := http.NewRequest("GET", urls, body)
  1565. if err != nil {
  1566. return nil, err
  1567. }
  1568. req.Header = reqHeaders
  1569. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1570. }
  1571. // Do executes the "youtubeAnalytics.groups.list" call.
  1572. // Exactly one of *ListGroupsResponse or error will be non-nil. Any
  1573. // non-2xx status code is an error. Response headers are in either
  1574. // *ListGroupsResponse.ServerResponse.Header or (if a response was
  1575. // returned at all) in error.(*googleapi.Error).Header. Use
  1576. // googleapi.IsNotModified to check whether the returned error was
  1577. // because http.StatusNotModified was returned.
  1578. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*ListGroupsResponse, error) {
  1579. gensupport.SetOptions(c.urlParams_, opts...)
  1580. res, err := c.doRequest("json")
  1581. if res != nil && res.StatusCode == http.StatusNotModified {
  1582. if res.Body != nil {
  1583. res.Body.Close()
  1584. }
  1585. return nil, &googleapi.Error{
  1586. Code: res.StatusCode,
  1587. Header: res.Header,
  1588. }
  1589. }
  1590. if err != nil {
  1591. return nil, err
  1592. }
  1593. defer googleapi.CloseBody(res)
  1594. if err := googleapi.CheckResponse(res); err != nil {
  1595. return nil, err
  1596. }
  1597. ret := &ListGroupsResponse{
  1598. ServerResponse: googleapi.ServerResponse{
  1599. Header: res.Header,
  1600. HTTPStatusCode: res.StatusCode,
  1601. },
  1602. }
  1603. target := &ret
  1604. if err := gensupport.DecodeResponse(target, res); err != nil {
  1605. return nil, err
  1606. }
  1607. return ret, nil
  1608. // {
  1609. // "description": "Returns a collection of groups that match the API request parameters. For\nexample, you can retrieve all groups that the authenticated user owns,\nor you can retrieve one or more groups by their unique IDs.",
  1610. // "flatPath": "v2/groups",
  1611. // "httpMethod": "GET",
  1612. // "id": "youtubeAnalytics.groups.list",
  1613. // "parameterOrder": [],
  1614. // "parameters": {
  1615. // "id": {
  1616. // "description": "The `id` parameter specifies a comma-separated list of the YouTube group\nID(s) for the resource(s) that are being retrieved. Each group must be\nowned by the authenticated user. In a `group` resource, the `id` property\nspecifies the group's YouTube group ID.\n\nNote that if you do not specify a value for the `id` parameter, then you\nmust set the `mine` parameter to `true`.",
  1617. // "location": "query",
  1618. // "type": "string"
  1619. // },
  1620. // "mine": {
  1621. // "description": "This parameter can only be used in a properly authorized request. Set this\nparameter's value to true to retrieve all groups owned by the authenticated\nuser.",
  1622. // "location": "query",
  1623. // "type": "boolean"
  1624. // },
  1625. // "onBehalfOfContentOwner": {
  1626. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  1627. // "location": "query",
  1628. // "type": "string"
  1629. // },
  1630. // "pageToken": {
  1631. // "description": "The `pageToken` parameter identifies a specific page in the result set that\nshould be returned. In an API response, the `nextPageToken` property\nidentifies the next page that can be retrieved.",
  1632. // "location": "query",
  1633. // "type": "string"
  1634. // }
  1635. // },
  1636. // "path": "v2/groups",
  1637. // "response": {
  1638. // "$ref": "ListGroupsResponse"
  1639. // },
  1640. // "scopes": [
  1641. // "https://www.googleapis.com/auth/youtube",
  1642. // "https://www.googleapis.com/auth/youtube.readonly",
  1643. // "https://www.googleapis.com/auth/youtubepartner",
  1644. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1645. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1646. // ]
  1647. // }
  1648. }
  1649. // Pages invokes f for each page of results.
  1650. // A non-nil error returned from f will halt the iteration.
  1651. // The provided context supersedes any context provided to the Context method.
  1652. func (c *GroupsListCall) Pages(ctx context.Context, f func(*ListGroupsResponse) error) error {
  1653. c.ctx_ = ctx
  1654. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1655. for {
  1656. x, err := c.Do()
  1657. if err != nil {
  1658. return err
  1659. }
  1660. if err := f(x); err != nil {
  1661. return err
  1662. }
  1663. if x.NextPageToken == "" {
  1664. return nil
  1665. }
  1666. c.PageToken(x.NextPageToken)
  1667. }
  1668. }
  1669. // method id "youtubeAnalytics.groups.update":
  1670. type GroupsUpdateCall struct {
  1671. s *Service
  1672. group *Group
  1673. urlParams_ gensupport.URLParams
  1674. ctx_ context.Context
  1675. header_ http.Header
  1676. }
  1677. // Update: Modifies a group. For example, you could change a group's
  1678. // title.
  1679. func (r *GroupsService) Update(group *Group) *GroupsUpdateCall {
  1680. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1681. c.group = group
  1682. return c
  1683. }
  1684. // OnBehalfOfContentOwner sets the optional parameter
  1685. // "onBehalfOfContentOwner": This parameter can only be used in a
  1686. // properly authorized request. **Note:**
  1687. // This parameter is intended exclusively for YouTube content partners
  1688. // that
  1689. // own and manage many different YouTube channels.
  1690. //
  1691. // The `onBehalfOfContentOwner` parameter indicates that the
  1692. // request's
  1693. // authorization credentials identify a YouTube user who is acting on
  1694. // behalf
  1695. // of the content owner specified in the parameter value. It allows
  1696. // content
  1697. // owners to authenticate once and get access to all their video and
  1698. // channel
  1699. // data, without having to provide authentication credentials for
  1700. // each
  1701. // individual channel. The account that the user authenticates with must
  1702. // be
  1703. // linked to the specified YouTube content owner.
  1704. func (c *GroupsUpdateCall) OnBehalfOfContentOwner(onBehalfOfContentOwner string) *GroupsUpdateCall {
  1705. c.urlParams_.Set("onBehalfOfContentOwner", onBehalfOfContentOwner)
  1706. return c
  1707. }
  1708. // Fields allows partial responses to be retrieved. See
  1709. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1710. // for more information.
  1711. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  1712. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1713. return c
  1714. }
  1715. // Context sets the context to be used in this call's Do method. Any
  1716. // pending HTTP request will be aborted if the provided context is
  1717. // canceled.
  1718. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  1719. c.ctx_ = ctx
  1720. return c
  1721. }
  1722. // Header returns an http.Header that can be modified by the caller to
  1723. // add HTTP headers to the request.
  1724. func (c *GroupsUpdateCall) Header() http.Header {
  1725. if c.header_ == nil {
  1726. c.header_ = make(http.Header)
  1727. }
  1728. return c.header_
  1729. }
  1730. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1731. reqHeaders := make(http.Header)
  1732. for k, v := range c.header_ {
  1733. reqHeaders[k] = v
  1734. }
  1735. reqHeaders.Set("User-Agent", c.s.userAgent())
  1736. var body io.Reader = nil
  1737. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  1738. if err != nil {
  1739. return nil, err
  1740. }
  1741. reqHeaders.Set("Content-Type", "application/json")
  1742. c.urlParams_.Set("alt", alt)
  1743. c.urlParams_.Set("prettyPrint", "false")
  1744. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/groups")
  1745. urls += "?" + c.urlParams_.Encode()
  1746. req, err := http.NewRequest("PUT", urls, body)
  1747. if err != nil {
  1748. return nil, err
  1749. }
  1750. req.Header = reqHeaders
  1751. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1752. }
  1753. // Do executes the "youtubeAnalytics.groups.update" call.
  1754. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  1755. // code is an error. Response headers are in either
  1756. // *Group.ServerResponse.Header or (if a response was returned at all)
  1757. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1758. // check whether the returned error was because http.StatusNotModified
  1759. // was returned.
  1760. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  1761. gensupport.SetOptions(c.urlParams_, opts...)
  1762. res, err := c.doRequest("json")
  1763. if res != nil && res.StatusCode == http.StatusNotModified {
  1764. if res.Body != nil {
  1765. res.Body.Close()
  1766. }
  1767. return nil, &googleapi.Error{
  1768. Code: res.StatusCode,
  1769. Header: res.Header,
  1770. }
  1771. }
  1772. if err != nil {
  1773. return nil, err
  1774. }
  1775. defer googleapi.CloseBody(res)
  1776. if err := googleapi.CheckResponse(res); err != nil {
  1777. return nil, err
  1778. }
  1779. ret := &Group{
  1780. ServerResponse: googleapi.ServerResponse{
  1781. Header: res.Header,
  1782. HTTPStatusCode: res.StatusCode,
  1783. },
  1784. }
  1785. target := &ret
  1786. if err := gensupport.DecodeResponse(target, res); err != nil {
  1787. return nil, err
  1788. }
  1789. return ret, nil
  1790. // {
  1791. // "description": "Modifies a group. For example, you could change a group's title.",
  1792. // "flatPath": "v2/groups",
  1793. // "httpMethod": "PUT",
  1794. // "id": "youtubeAnalytics.groups.update",
  1795. // "parameterOrder": [],
  1796. // "parameters": {
  1797. // "onBehalfOfContentOwner": {
  1798. // "description": "This parameter can only be used in a properly authorized request. **Note:**\nThis parameter is intended exclusively for YouTube content partners that\nown and manage many different YouTube channels.\n\nThe `onBehalfOfContentOwner` parameter indicates that the request's\nauthorization credentials identify a YouTube user who is acting on behalf\nof the content owner specified in the parameter value. It allows content\nowners to authenticate once and get access to all their video and channel\ndata, without having to provide authentication credentials for each\nindividual channel. The account that the user authenticates with must be\nlinked to the specified YouTube content owner.",
  1799. // "location": "query",
  1800. // "type": "string"
  1801. // }
  1802. // },
  1803. // "path": "v2/groups",
  1804. // "request": {
  1805. // "$ref": "Group"
  1806. // },
  1807. // "response": {
  1808. // "$ref": "Group"
  1809. // },
  1810. // "scopes": [
  1811. // "https://www.googleapis.com/auth/youtube",
  1812. // "https://www.googleapis.com/auth/youtube.readonly",
  1813. // "https://www.googleapis.com/auth/youtubepartner",
  1814. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  1815. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  1816. // ]
  1817. // }
  1818. }
  1819. // method id "youtubeAnalytics.reports.query":
  1820. type ReportsQueryCall struct {
  1821. s *Service
  1822. urlParams_ gensupport.URLParams
  1823. ifNoneMatch_ string
  1824. ctx_ context.Context
  1825. header_ http.Header
  1826. }
  1827. // Query: Retrieve your YouTube Analytics reports.
  1828. func (r *ReportsService) Query() *ReportsQueryCall {
  1829. c := &ReportsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1830. return c
  1831. }
  1832. // Currency sets the optional parameter "currency": The currency to
  1833. // which financial metrics should be converted. The default is
  1834. // US Dollar (USD). If the result contains no financial metrics, this
  1835. // flag
  1836. // will be ignored. Responds with an error if the specified currency is
  1837. // not
  1838. // recognized.",
  1839. // pattern: [A-Z]{3}
  1840. func (c *ReportsQueryCall) Currency(currency string) *ReportsQueryCall {
  1841. c.urlParams_.Set("currency", currency)
  1842. return c
  1843. }
  1844. // Dimensions sets the optional parameter "dimensions": A
  1845. // comma-separated list of YouTube Analytics dimensions, such as `views`
  1846. // or
  1847. // `ageGroup,gender`. See the
  1848. // [Available
  1849. // Reports](/youtube/analytics/v2/available_reports) document for a list
  1850. // of
  1851. // the reports that you can retrieve and the dimensions used for
  1852. // those
  1853. // reports. Also see the
  1854. // [Dimensions](/youtube/analytics/v2/dimsmets/dims)
  1855. // document for definitions of those dimensions."
  1856. // pattern: [0-9a-zA-Z,]+
  1857. func (c *ReportsQueryCall) Dimensions(dimensions string) *ReportsQueryCall {
  1858. c.urlParams_.Set("dimensions", dimensions)
  1859. return c
  1860. }
  1861. // EndDate sets the optional parameter "endDate": The end date for
  1862. // fetching YouTube Analytics data. The value should be in
  1863. // `YYYY-MM-DD` format.
  1864. // required: true, pattern: [0-9]{4}-[0-9]{2}-[0-9]{2}
  1865. func (c *ReportsQueryCall) EndDate(endDate string) *ReportsQueryCall {
  1866. c.urlParams_.Set("endDate", endDate)
  1867. return c
  1868. }
  1869. // Filters sets the optional parameter "filters": A list of filters that
  1870. // should be applied when retrieving YouTube Analytics
  1871. // data. The [Available
  1872. // Reports](/youtube/analytics/v2/available_reports)
  1873. // document identifies the dimensions that can be used to filter each
  1874. // report,
  1875. // and the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document
  1876. // defines
  1877. // those dimensions. If a request uses multiple filters, join them
  1878. // together
  1879. // with a semicolon (`;`), and the returned result table will satisfy
  1880. // both
  1881. // filters. For example, a filters parameter value
  1882. // of
  1883. // `video==dMH0bHeiRNg;country==IT` restricts the result set to include
  1884. // data
  1885. // for the given video in Italy.",
  1886. func (c *ReportsQueryCall) Filters(filters string) *ReportsQueryCall {
  1887. c.urlParams_.Set("filters", filters)
  1888. return c
  1889. }
  1890. // Ids sets the optional parameter "ids": Identifies the YouTube channel
  1891. // or content owner for which you are
  1892. // retrieving YouTube Analytics data.
  1893. //
  1894. // - To request data for a YouTube user, set the `ids` parameter value
  1895. // to
  1896. // `channel==CHANNEL_ID`, where `CHANNEL_ID` specifies the unique
  1897. // YouTube
  1898. // channel ID.
  1899. // - To request data for a YouTube CMS content owner, set the `ids`
  1900. // parameter
  1901. // value to `contentOwner==OWNER_NAME`, where `OWNER_NAME` is the CMS
  1902. // name
  1903. // of the content owner.
  1904. // required: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+
  1905. func (c *ReportsQueryCall) Ids(ids string) *ReportsQueryCall {
  1906. c.urlParams_.Set("ids", ids)
  1907. return c
  1908. }
  1909. // IncludeHistoricalChannelData sets the optional parameter
  1910. // "includeHistoricalChannelData": If set to true historical data (i.e.
  1911. // channel data from before the linking
  1912. // of the channel to the content owner) will be retrieved.",
  1913. func (c *ReportsQueryCall) IncludeHistoricalChannelData(includeHistoricalChannelData bool) *ReportsQueryCall {
  1914. c.urlParams_.Set("includeHistoricalChannelData", fmt.Sprint(includeHistoricalChannelData))
  1915. return c
  1916. }
  1917. // MaxResults sets the optional parameter "maxResults": The maximum
  1918. // number of rows to include in the response.",
  1919. // minValue: 1
  1920. func (c *ReportsQueryCall) MaxResults(maxResults int64) *ReportsQueryCall {
  1921. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1922. return c
  1923. }
  1924. // Metrics sets the optional parameter "metrics": A comma-separated list
  1925. // of YouTube Analytics metrics, such as `views` or
  1926. // `likes,dislikes`. See the
  1927. // [Available Reports](/youtube/analytics/v2/available_reports)
  1928. // document for
  1929. // a list of the reports that you can retrieve and the metrics
  1930. // available in each report, and see
  1931. // the
  1932. // [Metrics](/youtube/analytics/v2/dimsmets/mets) document for
  1933. // definitions of
  1934. // those metrics.
  1935. // required: true, pattern: [0-9a-zA-Z,]+
  1936. func (c *ReportsQueryCall) Metrics(metrics string) *ReportsQueryCall {
  1937. c.urlParams_.Set("metrics", metrics)
  1938. return c
  1939. }
  1940. // Sort sets the optional parameter "sort": A comma-separated list of
  1941. // dimensions or metrics that determine the sort
  1942. // order for YouTube Analytics data. By default the sort order is
  1943. // ascending.
  1944. // The '`-`' prefix causes descending sort order.",
  1945. // pattern: [-0-9a-zA-Z,]+
  1946. func (c *ReportsQueryCall) Sort(sort string) *ReportsQueryCall {
  1947. c.urlParams_.Set("sort", sort)
  1948. return c
  1949. }
  1950. // StartDate sets the optional parameter "startDate": The start date for
  1951. // fetching YouTube Analytics data. The value should be in
  1952. // `YYYY-MM-DD` format.
  1953. // required: true, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}
  1954. func (c *ReportsQueryCall) StartDate(startDate string) *ReportsQueryCall {
  1955. c.urlParams_.Set("startDate", startDate)
  1956. return c
  1957. }
  1958. // StartIndex sets the optional parameter "startIndex": An index of the
  1959. // first entity to retrieve. Use this parameter as a
  1960. // pagination mechanism along with the max-results parameter
  1961. // (one-based,
  1962. // inclusive).",
  1963. // minValue: 1
  1964. func (c *ReportsQueryCall) StartIndex(startIndex int64) *ReportsQueryCall {
  1965. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  1966. return c
  1967. }
  1968. // Fields allows partial responses to be retrieved. See
  1969. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1970. // for more information.
  1971. func (c *ReportsQueryCall) Fields(s ...googleapi.Field) *ReportsQueryCall {
  1972. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1973. return c
  1974. }
  1975. // IfNoneMatch sets the optional parameter which makes the operation
  1976. // fail if the object's ETag matches the given value. This is useful for
  1977. // getting updates only after the object has changed since the last
  1978. // request. Use googleapi.IsNotModified to check whether the response
  1979. // error from Do is the result of In-None-Match.
  1980. func (c *ReportsQueryCall) IfNoneMatch(entityTag string) *ReportsQueryCall {
  1981. c.ifNoneMatch_ = entityTag
  1982. return c
  1983. }
  1984. // Context sets the context to be used in this call's Do method. Any
  1985. // pending HTTP request will be aborted if the provided context is
  1986. // canceled.
  1987. func (c *ReportsQueryCall) Context(ctx context.Context) *ReportsQueryCall {
  1988. c.ctx_ = ctx
  1989. return c
  1990. }
  1991. // Header returns an http.Header that can be modified by the caller to
  1992. // add HTTP headers to the request.
  1993. func (c *ReportsQueryCall) Header() http.Header {
  1994. if c.header_ == nil {
  1995. c.header_ = make(http.Header)
  1996. }
  1997. return c.header_
  1998. }
  1999. func (c *ReportsQueryCall) doRequest(alt string) (*http.Response, error) {
  2000. reqHeaders := make(http.Header)
  2001. for k, v := range c.header_ {
  2002. reqHeaders[k] = v
  2003. }
  2004. reqHeaders.Set("User-Agent", c.s.userAgent())
  2005. if c.ifNoneMatch_ != "" {
  2006. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2007. }
  2008. var body io.Reader = nil
  2009. c.urlParams_.Set("alt", alt)
  2010. c.urlParams_.Set("prettyPrint", "false")
  2011. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/reports")
  2012. urls += "?" + c.urlParams_.Encode()
  2013. req, err := http.NewRequest("GET", urls, body)
  2014. if err != nil {
  2015. return nil, err
  2016. }
  2017. req.Header = reqHeaders
  2018. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2019. }
  2020. // Do executes the "youtubeAnalytics.reports.query" call.
  2021. // Exactly one of *QueryResponse or error will be non-nil. Any non-2xx
  2022. // status code is an error. Response headers are in either
  2023. // *QueryResponse.ServerResponse.Header or (if a response was returned
  2024. // at all) in error.(*googleapi.Error).Header. Use
  2025. // googleapi.IsNotModified to check whether the returned error was
  2026. // because http.StatusNotModified was returned.
  2027. func (c *ReportsQueryCall) Do(opts ...googleapi.CallOption) (*QueryResponse, error) {
  2028. gensupport.SetOptions(c.urlParams_, opts...)
  2029. res, err := c.doRequest("json")
  2030. if res != nil && res.StatusCode == http.StatusNotModified {
  2031. if res.Body != nil {
  2032. res.Body.Close()
  2033. }
  2034. return nil, &googleapi.Error{
  2035. Code: res.StatusCode,
  2036. Header: res.Header,
  2037. }
  2038. }
  2039. if err != nil {
  2040. return nil, err
  2041. }
  2042. defer googleapi.CloseBody(res)
  2043. if err := googleapi.CheckResponse(res); err != nil {
  2044. return nil, err
  2045. }
  2046. ret := &QueryResponse{
  2047. ServerResponse: googleapi.ServerResponse{
  2048. Header: res.Header,
  2049. HTTPStatusCode: res.StatusCode,
  2050. },
  2051. }
  2052. target := &ret
  2053. if err := gensupport.DecodeResponse(target, res); err != nil {
  2054. return nil, err
  2055. }
  2056. return ret, nil
  2057. // {
  2058. // "description": "Retrieve your YouTube Analytics reports.",
  2059. // "flatPath": "v2/reports",
  2060. // "httpMethod": "GET",
  2061. // "id": "youtubeAnalytics.reports.query",
  2062. // "parameterOrder": [],
  2063. // "parameters": {
  2064. // "currency": {
  2065. // "description": "The currency to which financial metrics should be converted. The default is\nUS Dollar (USD). If the result contains no financial metrics, this flag\nwill be ignored. Responds with an error if the specified currency is not\nrecognized.\",\npattern: [A-Z]{3}",
  2066. // "location": "query",
  2067. // "type": "string"
  2068. // },
  2069. // "dimensions": {
  2070. // "description": "A comma-separated list of YouTube Analytics dimensions, such as `views` or\n`ageGroup,gender`. See the [Available\nReports](/youtube/analytics/v2/available_reports) document for a list of\nthe reports that you can retrieve and the dimensions used for those\nreports. Also see the [Dimensions](/youtube/analytics/v2/dimsmets/dims)\ndocument for definitions of those dimensions.\"\npattern: [0-9a-zA-Z,]+",
  2071. // "location": "query",
  2072. // "type": "string"
  2073. // },
  2074. // "endDate": {
  2075. // "description": "The end date for fetching YouTube Analytics data. The value should be in\n`YYYY-MM-DD` format.\nrequired: true, pattern: [0-9]{4}-[0-9]{2}-[0-9]{2}",
  2076. // "location": "query",
  2077. // "type": "string"
  2078. // },
  2079. // "filters": {
  2080. // "description": "A list of filters that should be applied when retrieving YouTube Analytics\ndata. The [Available Reports](/youtube/analytics/v2/available_reports)\ndocument identifies the dimensions that can be used to filter each report,\nand the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document defines\nthose dimensions. If a request uses multiple filters, join them together\nwith a semicolon (`;`), and the returned result table will satisfy both\nfilters. For example, a filters parameter value of\n`video==dMH0bHeiRNg;country==IT` restricts the result set to include data\nfor the given video in Italy.\",",
  2081. // "location": "query",
  2082. // "type": "string"
  2083. // },
  2084. // "ids": {
  2085. // "description": "Identifies the YouTube channel or content owner for which you are\nretrieving YouTube Analytics data.\n\n- To request data for a YouTube user, set the `ids` parameter value to\n `channel==CHANNEL_ID`, where `CHANNEL_ID` specifies the unique YouTube\n channel ID.\n- To request data for a YouTube CMS content owner, set the `ids` parameter\n value to `contentOwner==OWNER_NAME`, where `OWNER_NAME` is the CMS name\n of the content owner.\nrequired: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+",
  2086. // "location": "query",
  2087. // "type": "string"
  2088. // },
  2089. // "includeHistoricalChannelData": {
  2090. // "description": "If set to true historical data (i.e. channel data from before the linking\nof the channel to the content owner) will be retrieved.\",",
  2091. // "location": "query",
  2092. // "type": "boolean"
  2093. // },
  2094. // "maxResults": {
  2095. // "description": "The maximum number of rows to include in the response.\",\nminValue: 1",
  2096. // "format": "int32",
  2097. // "location": "query",
  2098. // "type": "integer"
  2099. // },
  2100. // "metrics": {
  2101. // "description": "A comma-separated list of YouTube Analytics metrics, such as `views` or\n`likes,dislikes`. See the\n[Available Reports](/youtube/analytics/v2/available_reports) document for\na list of the reports that you can retrieve and the metrics\navailable in each report, and see the\n[Metrics](/youtube/analytics/v2/dimsmets/mets) document for definitions of\nthose metrics.\nrequired: true, pattern: [0-9a-zA-Z,]+",
  2102. // "location": "query",
  2103. // "type": "string"
  2104. // },
  2105. // "sort": {
  2106. // "description": "A comma-separated list of dimensions or metrics that determine the sort\norder for YouTube Analytics data. By default the sort order is ascending.\nThe '`-`' prefix causes descending sort order.\",\npattern: [-0-9a-zA-Z,]+",
  2107. // "location": "query",
  2108. // "type": "string"
  2109. // },
  2110. // "startDate": {
  2111. // "description": "The start date for fetching YouTube Analytics data. The value should be in\n`YYYY-MM-DD` format.\nrequired: true, pattern: \"[0-9]{4}-[0-9]{2}-[0-9]{2}",
  2112. // "location": "query",
  2113. // "type": "string"
  2114. // },
  2115. // "startIndex": {
  2116. // "description": "An index of the first entity to retrieve. Use this parameter as a\npagination mechanism along with the max-results parameter (one-based,\ninclusive).\",\nminValue: 1",
  2117. // "format": "int32",
  2118. // "location": "query",
  2119. // "type": "integer"
  2120. // }
  2121. // },
  2122. // "path": "v2/reports",
  2123. // "response": {
  2124. // "$ref": "QueryResponse"
  2125. // },
  2126. // "scopes": [
  2127. // "https://www.googleapis.com/auth/youtube",
  2128. // "https://www.googleapis.com/auth/youtube.readonly",
  2129. // "https://www.googleapis.com/auth/youtubepartner",
  2130. // "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
  2131. // "https://www.googleapis.com/auth/yt-analytics.readonly"
  2132. // ]
  2133. // }
  2134. }