google-apis-youtube_analytics_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module YoutubeAnalyticsV2
18
+ # Version of the google-apis-youtube_analytics_v2 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200801"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,232 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module YoutubeAnalyticsV2
24
+
25
+ class EmptyResponse
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class ErrorProto
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Errors
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class Group
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class GroupContentDetails
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class GroupItem
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class GroupItemResource
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class GroupSnippet
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class ListGroupItemsResponse
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class ListGroupsResponse
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class QueryResponse
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class ResultTableColumnHeader
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class EmptyResponse
98
+ # @private
99
+ class Representation < Google::Apis::Core::JsonRepresentation
100
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
101
+
102
+ end
103
+ end
104
+
105
+ class ErrorProto
106
+ # @private
107
+ class Representation < Google::Apis::Core::JsonRepresentation
108
+ collection :argument, as: 'argument'
109
+ property :code, as: 'code'
110
+ property :debug_info, as: 'debugInfo'
111
+ property :domain, as: 'domain'
112
+ property :external_error_message, as: 'externalErrorMessage'
113
+ property :location, as: 'location'
114
+ property :location_type, as: 'locationType'
115
+ end
116
+ end
117
+
118
+ class Errors
119
+ # @private
120
+ class Representation < Google::Apis::Core::JsonRepresentation
121
+ property :code, as: 'code'
122
+ collection :error, as: 'error', class: Google::Apis::YoutubeAnalyticsV2::ErrorProto, decorator: Google::Apis::YoutubeAnalyticsV2::ErrorProto::Representation
123
+
124
+ property :request_id, as: 'requestId'
125
+ end
126
+ end
127
+
128
+ class Group
129
+ # @private
130
+ class Representation < Google::Apis::Core::JsonRepresentation
131
+ property :content_details, as: 'contentDetails', class: Google::Apis::YoutubeAnalyticsV2::GroupContentDetails, decorator: Google::Apis::YoutubeAnalyticsV2::GroupContentDetails::Representation
132
+
133
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
134
+
135
+ property :etag, as: 'etag'
136
+ property :id, as: 'id'
137
+ property :kind, as: 'kind'
138
+ property :snippet, as: 'snippet', class: Google::Apis::YoutubeAnalyticsV2::GroupSnippet, decorator: Google::Apis::YoutubeAnalyticsV2::GroupSnippet::Representation
139
+
140
+ end
141
+ end
142
+
143
+ class GroupContentDetails
144
+ # @private
145
+ class Representation < Google::Apis::Core::JsonRepresentation
146
+ property :item_count, :numeric_string => true, as: 'itemCount'
147
+ property :item_type, as: 'itemType'
148
+ end
149
+ end
150
+
151
+ class GroupItem
152
+ # @private
153
+ class Representation < Google::Apis::Core::JsonRepresentation
154
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
155
+
156
+ property :etag, as: 'etag'
157
+ property :group_id, as: 'groupId'
158
+ property :id, as: 'id'
159
+ property :kind, as: 'kind'
160
+ property :resource, as: 'resource', class: Google::Apis::YoutubeAnalyticsV2::GroupItemResource, decorator: Google::Apis::YoutubeAnalyticsV2::GroupItemResource::Representation
161
+
162
+ end
163
+ end
164
+
165
+ class GroupItemResource
166
+ # @private
167
+ class Representation < Google::Apis::Core::JsonRepresentation
168
+ property :id, as: 'id'
169
+ property :kind, as: 'kind'
170
+ end
171
+ end
172
+
173
+ class GroupSnippet
174
+ # @private
175
+ class Representation < Google::Apis::Core::JsonRepresentation
176
+ property :published_at, as: 'publishedAt'
177
+ property :title, as: 'title'
178
+ end
179
+ end
180
+
181
+ class ListGroupItemsResponse
182
+ # @private
183
+ class Representation < Google::Apis::Core::JsonRepresentation
184
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
185
+
186
+ property :etag, as: 'etag'
187
+ collection :items, as: 'items', class: Google::Apis::YoutubeAnalyticsV2::GroupItem, decorator: Google::Apis::YoutubeAnalyticsV2::GroupItem::Representation
188
+
189
+ property :kind, as: 'kind'
190
+ end
191
+ end
192
+
193
+ class ListGroupsResponse
194
+ # @private
195
+ class Representation < Google::Apis::Core::JsonRepresentation
196
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
197
+
198
+ property :etag, as: 'etag'
199
+ collection :items, as: 'items', class: Google::Apis::YoutubeAnalyticsV2::Group, decorator: Google::Apis::YoutubeAnalyticsV2::Group::Representation
200
+
201
+ property :kind, as: 'kind'
202
+ property :next_page_token, as: 'nextPageToken'
203
+ end
204
+ end
205
+
206
+ class QueryResponse
207
+ # @private
208
+ class Representation < Google::Apis::Core::JsonRepresentation
209
+ collection :column_headers, as: 'columnHeaders', class: Google::Apis::YoutubeAnalyticsV2::ResultTableColumnHeader, decorator: Google::Apis::YoutubeAnalyticsV2::ResultTableColumnHeader::Representation
210
+
211
+ property :errors, as: 'errors', class: Google::Apis::YoutubeAnalyticsV2::Errors, decorator: Google::Apis::YoutubeAnalyticsV2::Errors::Representation
212
+
213
+ property :kind, as: 'kind'
214
+ collection :rows, as: 'rows', :class => Array do
215
+ include Representable::JSON::Collection
216
+ items
217
+ end
218
+
219
+ end
220
+ end
221
+
222
+ class ResultTableColumnHeader
223
+ # @private
224
+ class Representation < Google::Apis::Core::JsonRepresentation
225
+ property :column_type, as: 'columnType'
226
+ property :data_type, as: 'dataType'
227
+ property :name, as: 'name'
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,460 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module YoutubeAnalyticsV2
23
+ # YouTube Analytics API
24
+ #
25
+ # Retrieves your YouTube Analytics data.
26
+ #
27
+ # @example
28
+ # require 'google/apis/youtube_analytics_v2'
29
+ #
30
+ # YoutubeAnalytics = Google::Apis::YoutubeAnalyticsV2 # Alias the module
31
+ # service = YoutubeAnalytics::YouTubeAnalyticsService.new
32
+ #
33
+ # @see https://developers.google.com/youtube/analytics
34
+ class YouTubeAnalyticsService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://youtubeanalytics.googleapis.com/', '',
47
+ client_name: 'google-apis-youtube_analytics_v2',
48
+ client_version: Google::Apis::YoutubeAnalyticsV2::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Removes an item from a group.
53
+ # @param [String] id
54
+ # The `id` parameter specifies the YouTube group item ID of the group item that
55
+ # is being deleted.
56
+ # @param [String] on_behalf_of_content_owner
57
+ # This parameter can only be used in a properly authorized request. **Note:**
58
+ # This parameter is intended exclusively for YouTube content partners that own
59
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
60
+ # parameter indicates that the request's authorization credentials identify a
61
+ # YouTube user who is acting on behalf of the content owner specified in the
62
+ # parameter value. It allows content owners to authenticate once and get access
63
+ # to all their video and channel data, without having to provide authentication
64
+ # credentials for each individual channel. The account that the user
65
+ # authenticates with must be linked to the specified YouTube content owner.
66
+ # @param [String] fields
67
+ # Selector specifying which fields to include in a partial response.
68
+ # @param [String] quota_user
69
+ # Available to use for quota purposes for server-side applications. Can be any
70
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
71
+ # @param [Google::Apis::RequestOptions] options
72
+ # Request-specific options
73
+ #
74
+ # @yield [result, err] Result & error if block supplied
75
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::EmptyResponse] parsed result object
76
+ # @yieldparam err [StandardError] error object if request failed
77
+ #
78
+ # @return [Google::Apis::YoutubeAnalyticsV2::EmptyResponse]
79
+ #
80
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
81
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
82
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
83
+ def delete_group_item(id: nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
84
+ command = make_simple_command(:delete, 'v2/groupItems', options)
85
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::EmptyResponse::Representation
86
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::EmptyResponse
87
+ command.query['id'] = id unless id.nil?
88
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
89
+ command.query['fields'] = fields unless fields.nil?
90
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
91
+ execute_or_queue_command(command, &block)
92
+ end
93
+
94
+ # Creates a group item.
95
+ # @param [Google::Apis::YoutubeAnalyticsV2::GroupItem] group_item_object
96
+ # @param [String] on_behalf_of_content_owner
97
+ # This parameter can only be used in a properly authorized request. **Note:**
98
+ # This parameter is intended exclusively for YouTube content partners that own
99
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
100
+ # parameter indicates that the request's authorization credentials identify a
101
+ # YouTube user who is acting on behalf of the content owner specified in the
102
+ # parameter value. It allows content owners to authenticate once and get access
103
+ # to all their video and channel data, without having to provide authentication
104
+ # credentials for each individual channel. The account that the user
105
+ # authenticates with must be linked to the specified YouTube content owner.
106
+ # @param [String] fields
107
+ # Selector specifying which fields to include in a partial response.
108
+ # @param [String] quota_user
109
+ # Available to use for quota purposes for server-side applications. Can be any
110
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
111
+ # @param [Google::Apis::RequestOptions] options
112
+ # Request-specific options
113
+ #
114
+ # @yield [result, err] Result & error if block supplied
115
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::GroupItem] parsed result object
116
+ # @yieldparam err [StandardError] error object if request failed
117
+ #
118
+ # @return [Google::Apis::YoutubeAnalyticsV2::GroupItem]
119
+ #
120
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
121
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
122
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
123
+ def insert_group_item(group_item_object = nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
124
+ command = make_simple_command(:post, 'v2/groupItems', options)
125
+ command.request_representation = Google::Apis::YoutubeAnalyticsV2::GroupItem::Representation
126
+ command.request_object = group_item_object
127
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::GroupItem::Representation
128
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::GroupItem
129
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
130
+ command.query['fields'] = fields unless fields.nil?
131
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
132
+ execute_or_queue_command(command, &block)
133
+ end
134
+
135
+ # Returns a collection of group items that match the API request parameters.
136
+ # @param [String] group_id
137
+ # The `groupId` parameter specifies the unique ID of the group for which you
138
+ # want to retrieve group items.
139
+ # @param [String] on_behalf_of_content_owner
140
+ # This parameter can only be used in a properly authorized request. **Note:**
141
+ # This parameter is intended exclusively for YouTube content partners that own
142
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
143
+ # parameter indicates that the request's authorization credentials identify a
144
+ # YouTube user who is acting on behalf of the content owner specified in the
145
+ # parameter value. It allows content owners to authenticate once and get access
146
+ # to all their video and channel data, without having to provide authentication
147
+ # credentials for each individual channel. The account that the user
148
+ # authenticates with must be linked to the specified YouTube content owner.
149
+ # @param [String] fields
150
+ # Selector specifying which fields to include in a partial response.
151
+ # @param [String] quota_user
152
+ # Available to use for quota purposes for server-side applications. Can be any
153
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
154
+ # @param [Google::Apis::RequestOptions] options
155
+ # Request-specific options
156
+ #
157
+ # @yield [result, err] Result & error if block supplied
158
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::ListGroupItemsResponse] parsed result object
159
+ # @yieldparam err [StandardError] error object if request failed
160
+ #
161
+ # @return [Google::Apis::YoutubeAnalyticsV2::ListGroupItemsResponse]
162
+ #
163
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
164
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
165
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
166
+ def list_group_items(group_id: nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
167
+ command = make_simple_command(:get, 'v2/groupItems', options)
168
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::ListGroupItemsResponse::Representation
169
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::ListGroupItemsResponse
170
+ command.query['groupId'] = group_id unless group_id.nil?
171
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
172
+ command.query['fields'] = fields unless fields.nil?
173
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
174
+ execute_or_queue_command(command, &block)
175
+ end
176
+
177
+ # Deletes a group.
178
+ # @param [String] id
179
+ # The `id` parameter specifies the YouTube group ID of the group that is being
180
+ # deleted.
181
+ # @param [String] on_behalf_of_content_owner
182
+ # This parameter can only be used in a properly authorized request. **Note:**
183
+ # This parameter is intended exclusively for YouTube content partners that own
184
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
185
+ # parameter indicates that the request's authorization credentials identify a
186
+ # YouTube user who is acting on behalf of the content owner specified in the
187
+ # parameter value. It allows content owners to authenticate once and get access
188
+ # to all their video and channel data, without having to provide authentication
189
+ # credentials for each individual channel. The account that the user
190
+ # authenticates with must be linked to the specified YouTube content owner.
191
+ # @param [String] fields
192
+ # Selector specifying which fields to include in a partial response.
193
+ # @param [String] quota_user
194
+ # Available to use for quota purposes for server-side applications. Can be any
195
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
196
+ # @param [Google::Apis::RequestOptions] options
197
+ # Request-specific options
198
+ #
199
+ # @yield [result, err] Result & error if block supplied
200
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::EmptyResponse] parsed result object
201
+ # @yieldparam err [StandardError] error object if request failed
202
+ #
203
+ # @return [Google::Apis::YoutubeAnalyticsV2::EmptyResponse]
204
+ #
205
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
206
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
207
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
208
+ def delete_group(id: nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
209
+ command = make_simple_command(:delete, 'v2/groups', options)
210
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::EmptyResponse::Representation
211
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::EmptyResponse
212
+ command.query['id'] = id unless id.nil?
213
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
214
+ command.query['fields'] = fields unless fields.nil?
215
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
216
+ execute_or_queue_command(command, &block)
217
+ end
218
+
219
+ # Creates a group.
220
+ # @param [Google::Apis::YoutubeAnalyticsV2::Group] group_object
221
+ # @param [String] on_behalf_of_content_owner
222
+ # This parameter can only be used in a properly authorized request. **Note:**
223
+ # This parameter is intended exclusively for YouTube content partners that own
224
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
225
+ # parameter indicates that the request's authorization credentials identify a
226
+ # YouTube user who is acting on behalf of the content owner specified in the
227
+ # parameter value. It allows content owners to authenticate once and get access
228
+ # to all their video and channel data, without having to provide authentication
229
+ # credentials for each individual channel. The account that the user
230
+ # authenticates with must be linked to the specified YouTube content owner.
231
+ # @param [String] fields
232
+ # Selector specifying which fields to include in a partial response.
233
+ # @param [String] quota_user
234
+ # Available to use for quota purposes for server-side applications. Can be any
235
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
236
+ # @param [Google::Apis::RequestOptions] options
237
+ # Request-specific options
238
+ #
239
+ # @yield [result, err] Result & error if block supplied
240
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::Group] parsed result object
241
+ # @yieldparam err [StandardError] error object if request failed
242
+ #
243
+ # @return [Google::Apis::YoutubeAnalyticsV2::Group]
244
+ #
245
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
246
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
247
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
248
+ def insert_group(group_object = nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
249
+ command = make_simple_command(:post, 'v2/groups', options)
250
+ command.request_representation = Google::Apis::YoutubeAnalyticsV2::Group::Representation
251
+ command.request_object = group_object
252
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::Group::Representation
253
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::Group
254
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
255
+ command.query['fields'] = fields unless fields.nil?
256
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
257
+ execute_or_queue_command(command, &block)
258
+ end
259
+
260
+ # Returns a collection of groups that match the API request parameters. For
261
+ # example, you can retrieve all groups that the authenticated user owns, or you
262
+ # can retrieve one or more groups by their unique IDs.
263
+ # @param [String] id
264
+ # The `id` parameter specifies a comma-separated list of the YouTube group ID(s)
265
+ # for the resource(s) that are being retrieved. Each group must be owned by the
266
+ # authenticated user. In a `group` resource, the `id` property specifies the
267
+ # group's YouTube group ID. Note that if you do not specify a value for the `id`
268
+ # parameter, then you must set the `mine` parameter to `true`.
269
+ # @param [Boolean] mine
270
+ # This parameter can only be used in a properly authorized request. Set this
271
+ # parameter's value to true to retrieve all groups owned by the authenticated
272
+ # user.
273
+ # @param [String] on_behalf_of_content_owner
274
+ # This parameter can only be used in a properly authorized request. **Note:**
275
+ # This parameter is intended exclusively for YouTube content partners that own
276
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
277
+ # parameter indicates that the request's authorization credentials identify a
278
+ # YouTube user who is acting on behalf of the content owner specified in the
279
+ # parameter value. It allows content owners to authenticate once and get access
280
+ # to all their video and channel data, without having to provide authentication
281
+ # credentials for each individual channel. The account that the user
282
+ # authenticates with must be linked to the specified YouTube content owner.
283
+ # @param [String] page_token
284
+ # The `pageToken` parameter identifies a specific page in the result set that
285
+ # should be returned. In an API response, the `nextPageToken` property
286
+ # identifies the next page that can be retrieved.
287
+ # @param [String] fields
288
+ # Selector specifying which fields to include in a partial response.
289
+ # @param [String] quota_user
290
+ # Available to use for quota purposes for server-side applications. Can be any
291
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
292
+ # @param [Google::Apis::RequestOptions] options
293
+ # Request-specific options
294
+ #
295
+ # @yield [result, err] Result & error if block supplied
296
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::ListGroupsResponse] parsed result object
297
+ # @yieldparam err [StandardError] error object if request failed
298
+ #
299
+ # @return [Google::Apis::YoutubeAnalyticsV2::ListGroupsResponse]
300
+ #
301
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
302
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
303
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
304
+ def list_groups(id: nil, mine: nil, on_behalf_of_content_owner: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
305
+ command = make_simple_command(:get, 'v2/groups', options)
306
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::ListGroupsResponse::Representation
307
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::ListGroupsResponse
308
+ command.query['id'] = id unless id.nil?
309
+ command.query['mine'] = mine unless mine.nil?
310
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
311
+ command.query['pageToken'] = page_token unless page_token.nil?
312
+ command.query['fields'] = fields unless fields.nil?
313
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
314
+ execute_or_queue_command(command, &block)
315
+ end
316
+
317
+ # Modifies a group. For example, you could change a group's title.
318
+ # @param [Google::Apis::YoutubeAnalyticsV2::Group] group_object
319
+ # @param [String] on_behalf_of_content_owner
320
+ # This parameter can only be used in a properly authorized request. **Note:**
321
+ # This parameter is intended exclusively for YouTube content partners that own
322
+ # and manage many different YouTube channels. The `onBehalfOfContentOwner`
323
+ # parameter indicates that the request's authorization credentials identify a
324
+ # YouTube user who is acting on behalf of the content owner specified in the
325
+ # parameter value. It allows content owners to authenticate once and get access
326
+ # to all their video and channel data, without having to provide authentication
327
+ # credentials for each individual channel. The account that the user
328
+ # authenticates with must be linked to the specified YouTube content owner.
329
+ # @param [String] fields
330
+ # Selector specifying which fields to include in a partial response.
331
+ # @param [String] quota_user
332
+ # Available to use for quota purposes for server-side applications. Can be any
333
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
334
+ # @param [Google::Apis::RequestOptions] options
335
+ # Request-specific options
336
+ #
337
+ # @yield [result, err] Result & error if block supplied
338
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::Group] parsed result object
339
+ # @yieldparam err [StandardError] error object if request failed
340
+ #
341
+ # @return [Google::Apis::YoutubeAnalyticsV2::Group]
342
+ #
343
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
344
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
345
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
346
+ def update_group(group_object = nil, on_behalf_of_content_owner: nil, fields: nil, quota_user: nil, options: nil, &block)
347
+ command = make_simple_command(:put, 'v2/groups', options)
348
+ command.request_representation = Google::Apis::YoutubeAnalyticsV2::Group::Representation
349
+ command.request_object = group_object
350
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::Group::Representation
351
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::Group
352
+ command.query['onBehalfOfContentOwner'] = on_behalf_of_content_owner unless on_behalf_of_content_owner.nil?
353
+ command.query['fields'] = fields unless fields.nil?
354
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
355
+ execute_or_queue_command(command, &block)
356
+ end
357
+
358
+ # Retrieve your YouTube Analytics reports.
359
+ # @param [String] currency
360
+ # The currency to which financial metrics should be converted. The default is US
361
+ # Dollar (USD). If the result contains no financial metrics, this flag will be
362
+ # ignored. Responds with an error if the specified currency is not recognized.",
363
+ # pattern: [A-Z]`3`
364
+ # @param [String] dimensions
365
+ # A comma-separated list of YouTube Analytics dimensions, such as `views` or `
366
+ # ageGroup,gender`. See the [Available Reports](/youtube/analytics/v2/
367
+ # available_reports) document for a list of the reports that you can retrieve
368
+ # and the dimensions used for those reports. Also see the [Dimensions](/youtube/
369
+ # analytics/v2/dimsmets/dims) document for definitions of those dimensions."
370
+ # pattern: [0-9a-zA-Z,]+
371
+ # @param [String] end_date
372
+ # The end date for fetching YouTube Analytics data. The value should be in `YYYY-
373
+ # MM-DD` format. required: true, pattern: [0-9]`4`-[0-9]`2`-[0-9]`2`
374
+ # @param [String] filters
375
+ # A list of filters that should be applied when retrieving YouTube Analytics
376
+ # data. The [Available Reports](/youtube/analytics/v2/available_reports)
377
+ # document identifies the dimensions that can be used to filter each report, and
378
+ # the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document defines those
379
+ # dimensions. If a request uses multiple filters, join them together with a
380
+ # semicolon (`;`), and the returned result table will satisfy both filters. For
381
+ # example, a filters parameter value of `video==dMH0bHeiRNg;country==IT`
382
+ # restricts the result set to include data for the given video in Italy.",
383
+ # @param [String] ids
384
+ # Identifies the YouTube channel or content owner for which you are retrieving
385
+ # YouTube Analytics data. - To request data for a YouTube user, set the `ids`
386
+ # parameter value to `channel==CHANNEL_ID`, where `CHANNEL_ID` specifies the
387
+ # unique YouTube channel ID. - To request data for a YouTube CMS content owner,
388
+ # set the `ids` parameter value to `contentOwner==OWNER_NAME`, where `OWNER_NAME`
389
+ # is the CMS name of the content owner. required: true, pattern: [a-zA-Z]+==[a-
390
+ # zA-Z0-9_+-]+
391
+ # @param [Boolean] include_historical_channel_data
392
+ # If set to true historical data (i.e. channel data from before the linking of
393
+ # the channel to the content owner) will be retrieved.",
394
+ # @param [Fixnum] max_results
395
+ # The maximum number of rows to include in the response.", minValue: 1
396
+ # @param [String] metrics
397
+ # A comma-separated list of YouTube Analytics metrics, such as `views` or `likes,
398
+ # dislikes`. See the [Available Reports](/youtube/analytics/v2/available_reports)
399
+ # document for a list of the reports that you can retrieve and the metrics
400
+ # available in each report, and see the [Metrics](/youtube/analytics/v2/dimsmets/
401
+ # mets) document for definitions of those metrics. required: true, pattern: [0-
402
+ # 9a-zA-Z,]+
403
+ # @param [String] sort
404
+ # A comma-separated list of dimensions or metrics that determine the sort order
405
+ # for YouTube Analytics data. By default the sort order is ascending. The '`-`'
406
+ # prefix causes descending sort order.", pattern: [-0-9a-zA-Z,]+
407
+ # @param [String] start_date
408
+ # The start date for fetching YouTube Analytics data. The value should be in `
409
+ # YYYY-MM-DD` format. required: true, pattern: "[0-9]`4`-[0-9]`2`-[0-9]`2`
410
+ # @param [Fixnum] start_index
411
+ # An index of the first entity to retrieve. Use this parameter as a pagination
412
+ # mechanism along with the max-results parameter (one-based, inclusive).",
413
+ # minValue: 1
414
+ # @param [String] fields
415
+ # Selector specifying which fields to include in a partial response.
416
+ # @param [String] quota_user
417
+ # Available to use for quota purposes for server-side applications. Can be any
418
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
419
+ # @param [Google::Apis::RequestOptions] options
420
+ # Request-specific options
421
+ #
422
+ # @yield [result, err] Result & error if block supplied
423
+ # @yieldparam result [Google::Apis::YoutubeAnalyticsV2::QueryResponse] parsed result object
424
+ # @yieldparam err [StandardError] error object if request failed
425
+ #
426
+ # @return [Google::Apis::YoutubeAnalyticsV2::QueryResponse]
427
+ #
428
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
429
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
430
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
431
+ def query_report(currency: nil, dimensions: nil, end_date: nil, filters: nil, ids: nil, include_historical_channel_data: nil, max_results: nil, metrics: nil, sort: nil, start_date: nil, start_index: nil, fields: nil, quota_user: nil, options: nil, &block)
432
+ command = make_simple_command(:get, 'v2/reports', options)
433
+ command.response_representation = Google::Apis::YoutubeAnalyticsV2::QueryResponse::Representation
434
+ command.response_class = Google::Apis::YoutubeAnalyticsV2::QueryResponse
435
+ command.query['currency'] = currency unless currency.nil?
436
+ command.query['dimensions'] = dimensions unless dimensions.nil?
437
+ command.query['endDate'] = end_date unless end_date.nil?
438
+ command.query['filters'] = filters unless filters.nil?
439
+ command.query['ids'] = ids unless ids.nil?
440
+ command.query['includeHistoricalChannelData'] = include_historical_channel_data unless include_historical_channel_data.nil?
441
+ command.query['maxResults'] = max_results unless max_results.nil?
442
+ command.query['metrics'] = metrics unless metrics.nil?
443
+ command.query['sort'] = sort unless sort.nil?
444
+ command.query['startDate'] = start_date unless start_date.nil?
445
+ command.query['startIndex'] = start_index unless start_index.nil?
446
+ command.query['fields'] = fields unless fields.nil?
447
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
448
+ execute_or_queue_command(command, &block)
449
+ end
450
+
451
+ protected
452
+
453
+ def apply_command_defaults(command)
454
+ command.query['key'] = key unless key.nil?
455
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
456
+ end
457
+ end
458
+ end
459
+ end
460
+ end