...

Source file src/google.golang.org/api/youtubeanalytics/v1beta1/youtubeanalytics-gen.go

Documentation: google.golang.org/api/youtubeanalytics/v1beta1

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

View as plain text