@maxim_mazurok/gapi.client.youtube_analytics-v2 0.0.20220808

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,590 @@
1
+ /* Type definitions for non-npm package YouTube Analytics API v2 0.0 */
2
+ // Project: https://developers.google.com/youtube/analytics
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://youtubeanalytics.googleapis.com/$discovery/rest?version=v2
13
+ // Revision: 20220808
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load YouTube Analytics API v2 */
19
+ function load(urlOrObject: "https://youtubeanalytics.googleapis.com/$discovery/rest?version=v2"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "youtubeAnalytics", version: "v2"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "youtubeAnalytics", version: "v2", callback: () => any): void;
24
+
25
+ namespace youtubeAnalytics {
26
+ interface EmptyResponse {
27
+ /** Apiary error details */
28
+ errors?: Errors;
29
+ }
30
+ interface ErrorProto {
31
+ /** Error arguments, to be used when building user-friendly error messages given the error domain and code. Different error codes require different arguments. */
32
+ argument?: string[];
33
+ /** Error code in the error domain. This should correspond to a value of the enum type whose name is in domain. See the core error domain in error_domain.proto. */
34
+ code?: string;
35
+ /** Debugging information, which should not be shared externally. */
36
+ debugInfo?: string;
37
+ /** Error domain. RoSy services can define their own domain and error codes. This should normally be the name of an enum type, such as: gdata.CoreErrorDomain */
38
+ domain?: string;
39
+ /**
40
+ * A short explanation for the error, which can be shared outside Google. Please set domain, code and arguments whenever possible instead of this error message so that external APIs
41
+ * can build safe error messages themselves. External messages built in a RoSy interface will most likely refer to information and concepts that are not available externally and should
42
+ * not be exposed. It is safer if external APIs can understand the errors and decide what the error message should look like.
43
+ */
44
+ externalErrorMessage?: string;
45
+ /**
46
+ * Location of the error, as specified by the location type. If location_type is PATH, this should be a path to a field that's relative to the request, using FieldPath notation
47
+ * (net/proto2/util/public/field_path.h). Examples: authenticated_user.gaia_id resource.address[2].country
48
+ */
49
+ location?: string;
50
+ locationType?: string;
51
+ }
52
+ interface Errors {
53
+ /** Global error code. Deprecated and ignored. Set custom error codes in ErrorProto.domain and ErrorProto.code instead. */
54
+ code?: string;
55
+ /** Specific error description and codes */
56
+ error?: ErrorProto[];
57
+ /** Request identifier generated by the service, which can be used to identify the error in the logs */
58
+ requestId?: string;
59
+ }
60
+ interface Group {
61
+ /** The `contentDetails` object contains additional information about the group, such as the number and type of items that it contains. */
62
+ contentDetails?: GroupContentDetails;
63
+ /** Apiary error details */
64
+ errors?: Errors;
65
+ /** The Etag of this resource. */
66
+ etag?: string;
67
+ /** The ID that YouTube uses to uniquely identify the group. */
68
+ id?: string;
69
+ /** Identifies the API resource's type. The value will be `youtube#group`. */
70
+ kind?: string;
71
+ /** The `snippet` object contains basic information about the group, including its creation date and name. */
72
+ snippet?: GroupSnippet;
73
+ }
74
+ interface GroupContentDetails {
75
+ /** The number of items in the group. */
76
+ itemCount?: string;
77
+ /** The type of resources that the group contains. Valid values for this property are: * `youtube#channel` * `youtube#playlist` * `youtube#video` * `youtubePartner#asset` */
78
+ itemType?: string;
79
+ }
80
+ interface GroupItem {
81
+ /** Apiary error details */
82
+ errors?: Errors;
83
+ /** The Etag of this resource. */
84
+ etag?: string;
85
+ /** The ID that YouTube uses to uniquely identify the group that contains the item. */
86
+ groupId?: string;
87
+ /**
88
+ * The ID that YouTube uses to uniquely identify the `channel`, `video`, `playlist`, or `asset` resource that is included in the group. Note that this ID refers specifically to the
89
+ * inclusion of that resource in a particular group and is different than the channel ID, video ID, playlist ID, or asset ID that uniquely identifies the resource itself. The
90
+ * `resource.id` property's value specifies the unique channel, video, playlist, or asset ID.
91
+ */
92
+ id?: string;
93
+ /** Identifies the API resource's type. The value will be `youtube#groupItem`. */
94
+ kind?: string;
95
+ /** The `resource` object contains information that identifies the item being added to the group. */
96
+ resource?: GroupItemResource;
97
+ }
98
+ interface GroupItemResource {
99
+ /** The channel, video, playlist, or asset ID that YouTube uses to uniquely identify the item that is being added to the group. */
100
+ id?: string;
101
+ /** Identifies the type of resource being added to the group. Valid values for this property are: * `youtube#channel` * `youtube#playlist` * `youtube#video` * `youtubePartner#asset` */
102
+ kind?: string;
103
+ }
104
+ interface GroupSnippet {
105
+ /** The date and time that the group was created. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. */
106
+ publishedAt?: string;
107
+ /** The group name. The value must be a non-empty string. */
108
+ title?: string;
109
+ }
110
+ interface ListGroupItemsResponse {
111
+ /** Apiary error details */
112
+ errors?: Errors;
113
+ /** The Etag of this resource. */
114
+ etag?: string;
115
+ /** A list of groups that match the API request parameters. Each item in the list represents a `groupItem` resource. */
116
+ items?: GroupItem[];
117
+ /** Identifies the API resource's type. The value will be `youtube#groupItemListResponse`. */
118
+ kind?: string;
119
+ }
120
+ interface ListGroupsResponse {
121
+ /** Apiary error details */
122
+ errors?: Errors;
123
+ /** The Etag of this resource. */
124
+ etag?: string;
125
+ /** A list of groups that match the API request parameters. Each item in the list represents a `group` resource. */
126
+ items?: Group[];
127
+ /** Identifies the API resource's type. The value will be `youtube#groupListResponse`. */
128
+ kind?: string;
129
+ /** The token that can be used as the value of the `pageToken` parameter to retrieve the next page in the result set. */
130
+ nextPageToken?: string;
131
+ }
132
+ interface QueryResponse {
133
+ /**
134
+ * This value specifies information about the data returned in the `rows` fields. Each item in the `columnHeaders` list identifies a field returned in the `rows` value, which contains
135
+ * a list of comma-delimited data. The `columnHeaders` list will begin with the dimensions specified in the API request, which will be followed by the metrics specified in the API
136
+ * request. The order of both dimensions and metrics will match the ordering in the API request. For example, if the API request contains the parameters
137
+ * `dimensions=ageGroup,gender&metrics=viewerPercentage`, the API response will return columns in this order: `ageGroup`, `gender`, `viewerPercentage`.
138
+ */
139
+ columnHeaders?: ResultTableColumnHeader[];
140
+ /** When set, indicates that the operation failed. */
141
+ errors?: Errors;
142
+ /** This value specifies the type of data included in the API response. For the query method, the kind property value will be `youtubeAnalytics#resultTable`. */
143
+ kind?: string;
144
+ /**
145
+ * The list contains all rows of the result table. Each item in the list is an array that contains comma-delimited data corresponding to a single row of data. The order of the
146
+ * comma-delimited data fields will match the order of the columns listed in the `columnHeaders` field. If no data is available for the given query, the `rows` element will be omitted
147
+ * from the response. The response for a query with the `day` dimension will not contain rows for the most recent days.
148
+ */
149
+ rows?: any[][];
150
+ }
151
+ interface ResultTableColumnHeader {
152
+ /** The type of the column (`DIMENSION` or `METRIC`). */
153
+ columnType?: string;
154
+ /** The type of the data in the column (`STRING`, `INTEGER`, `FLOAT`, etc.). */
155
+ dataType?: string;
156
+ /** The name of the dimension or metric. */
157
+ name?: string;
158
+ }
159
+ interface GroupItemsResource {
160
+ /** Removes an item from a group. */
161
+ delete(request?: {
162
+ /** V1 error format. */
163
+ "$.xgafv"?: string;
164
+ /** OAuth access token. */
165
+ access_token?: string;
166
+ /** Data format for response. */
167
+ alt?: string;
168
+ /** JSONP */
169
+ callback?: string;
170
+ /** Selector specifying which fields to include in a partial response. */
171
+ fields?: string;
172
+ /** The `id` parameter specifies the YouTube group item ID of the group item that is being deleted. */
173
+ id?: string;
174
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
175
+ key?: string;
176
+ /** OAuth 2.0 token for the current user. */
177
+ oauth_token?: string;
178
+ /**
179
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
180
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
181
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
182
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
183
+ */
184
+ onBehalfOfContentOwner?: string;
185
+ /** Returns response with indentations and line breaks. */
186
+ prettyPrint?: boolean;
187
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
188
+ quotaUser?: string;
189
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
190
+ upload_protocol?: string;
191
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
192
+ uploadType?: string;
193
+ }): Request<EmptyResponse>;
194
+ /** Creates a group item. */
195
+ insert(request: {
196
+ /** V1 error format. */
197
+ "$.xgafv"?: string;
198
+ /** OAuth access token. */
199
+ access_token?: string;
200
+ /** Data format for response. */
201
+ alt?: string;
202
+ /** JSONP */
203
+ callback?: string;
204
+ /** Selector specifying which fields to include in a partial response. */
205
+ fields?: string;
206
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
207
+ key?: string;
208
+ /** OAuth 2.0 token for the current user. */
209
+ oauth_token?: string;
210
+ /**
211
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
212
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
213
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
214
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
215
+ */
216
+ onBehalfOfContentOwner?: string;
217
+ /** Returns response with indentations and line breaks. */
218
+ prettyPrint?: boolean;
219
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
220
+ quotaUser?: string;
221
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
222
+ upload_protocol?: string;
223
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
224
+ uploadType?: string;
225
+ /** Request body */
226
+ resource: GroupItem;
227
+ }): Request<GroupItem>;
228
+ insert(request: {
229
+ /** V1 error format. */
230
+ "$.xgafv"?: string;
231
+ /** OAuth access token. */
232
+ access_token?: string;
233
+ /** Data format for response. */
234
+ alt?: string;
235
+ /** JSONP */
236
+ callback?: string;
237
+ /** Selector specifying which fields to include in a partial response. */
238
+ fields?: string;
239
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
240
+ key?: string;
241
+ /** OAuth 2.0 token for the current user. */
242
+ oauth_token?: string;
243
+ /**
244
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
245
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
246
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
247
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
248
+ */
249
+ onBehalfOfContentOwner?: string;
250
+ /** Returns response with indentations and line breaks. */
251
+ prettyPrint?: boolean;
252
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
253
+ quotaUser?: string;
254
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
255
+ upload_protocol?: string;
256
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
257
+ uploadType?: string;
258
+ },
259
+ body: GroupItem): Request<GroupItem>;
260
+ /** Returns a collection of group items that match the API request parameters. */
261
+ list(request?: {
262
+ /** V1 error format. */
263
+ "$.xgafv"?: string;
264
+ /** OAuth access token. */
265
+ access_token?: string;
266
+ /** Data format for response. */
267
+ alt?: string;
268
+ /** JSONP */
269
+ callback?: string;
270
+ /** Selector specifying which fields to include in a partial response. */
271
+ fields?: string;
272
+ /** The `groupId` parameter specifies the unique ID of the group for which you want to retrieve group items. */
273
+ groupId?: string;
274
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
275
+ key?: string;
276
+ /** OAuth 2.0 token for the current user. */
277
+ oauth_token?: string;
278
+ /**
279
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
280
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
281
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
282
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
283
+ */
284
+ onBehalfOfContentOwner?: string;
285
+ /** Returns response with indentations and line breaks. */
286
+ prettyPrint?: boolean;
287
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
288
+ quotaUser?: string;
289
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
290
+ upload_protocol?: string;
291
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
292
+ uploadType?: string;
293
+ }): Request<ListGroupItemsResponse>;
294
+ }
295
+ interface GroupsResource {
296
+ /** Deletes a group. */
297
+ delete(request?: {
298
+ /** V1 error format. */
299
+ "$.xgafv"?: string;
300
+ /** OAuth access token. */
301
+ access_token?: string;
302
+ /** Data format for response. */
303
+ alt?: string;
304
+ /** JSONP */
305
+ callback?: string;
306
+ /** Selector specifying which fields to include in a partial response. */
307
+ fields?: string;
308
+ /** The `id` parameter specifies the YouTube group ID of the group that is being deleted. */
309
+ id?: string;
310
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
311
+ key?: string;
312
+ /** OAuth 2.0 token for the current user. */
313
+ oauth_token?: string;
314
+ /**
315
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
316
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
317
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
318
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
319
+ */
320
+ onBehalfOfContentOwner?: string;
321
+ /** Returns response with indentations and line breaks. */
322
+ prettyPrint?: boolean;
323
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
324
+ quotaUser?: string;
325
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
326
+ upload_protocol?: string;
327
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
328
+ uploadType?: string;
329
+ }): Request<EmptyResponse>;
330
+ /** Creates a group. */
331
+ insert(request: {
332
+ /** V1 error format. */
333
+ "$.xgafv"?: string;
334
+ /** OAuth access token. */
335
+ access_token?: string;
336
+ /** Data format for response. */
337
+ alt?: string;
338
+ /** JSONP */
339
+ callback?: string;
340
+ /** Selector specifying which fields to include in a partial response. */
341
+ fields?: string;
342
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
343
+ key?: string;
344
+ /** OAuth 2.0 token for the current user. */
345
+ oauth_token?: string;
346
+ /**
347
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
348
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
349
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
350
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
351
+ */
352
+ onBehalfOfContentOwner?: string;
353
+ /** Returns response with indentations and line breaks. */
354
+ prettyPrint?: boolean;
355
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
356
+ quotaUser?: string;
357
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
358
+ upload_protocol?: string;
359
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
360
+ uploadType?: string;
361
+ /** Request body */
362
+ resource: Group;
363
+ }): Request<Group>;
364
+ insert(request: {
365
+ /** V1 error format. */
366
+ "$.xgafv"?: string;
367
+ /** OAuth access token. */
368
+ access_token?: string;
369
+ /** Data format for response. */
370
+ alt?: string;
371
+ /** JSONP */
372
+ callback?: string;
373
+ /** Selector specifying which fields to include in a partial response. */
374
+ fields?: string;
375
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
376
+ key?: string;
377
+ /** OAuth 2.0 token for the current user. */
378
+ oauth_token?: string;
379
+ /**
380
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
381
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
382
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
383
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
384
+ */
385
+ onBehalfOfContentOwner?: string;
386
+ /** Returns response with indentations and line breaks. */
387
+ prettyPrint?: boolean;
388
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
389
+ quotaUser?: string;
390
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
391
+ upload_protocol?: string;
392
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
393
+ uploadType?: string;
394
+ },
395
+ body: Group): Request<Group>;
396
+ /**
397
+ * 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
398
+ * groups by their unique IDs.
399
+ */
400
+ list(request?: {
401
+ /** V1 error format. */
402
+ "$.xgafv"?: string;
403
+ /** OAuth access token. */
404
+ access_token?: string;
405
+ /** Data format for response. */
406
+ alt?: string;
407
+ /** JSONP */
408
+ callback?: string;
409
+ /** Selector specifying which fields to include in a partial response. */
410
+ fields?: string;
411
+ /**
412
+ * The `id` parameter specifies a comma-separated list of the YouTube group ID(s) for the resource(s) that are being retrieved. Each group must be owned by the authenticated user.
413
+ * In a `group` resource, the `id` property specifies the group's YouTube group ID. Note that if you do not specify a value for the `id` parameter, then you must set the `mine`
414
+ * parameter to `true`.
415
+ */
416
+ id?: string;
417
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
418
+ key?: string;
419
+ /** This parameter can only be used in a properly authorized request. Set this parameter's value to true to retrieve all groups owned by the authenticated user. */
420
+ mine?: boolean;
421
+ /** OAuth 2.0 token for the current user. */
422
+ oauth_token?: string;
423
+ /**
424
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
425
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
426
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
427
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
428
+ */
429
+ onBehalfOfContentOwner?: string;
430
+ /**
431
+ * 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
432
+ * can be retrieved.
433
+ */
434
+ pageToken?: string;
435
+ /** Returns response with indentations and line breaks. */
436
+ prettyPrint?: boolean;
437
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
438
+ quotaUser?: string;
439
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
440
+ upload_protocol?: string;
441
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
442
+ uploadType?: string;
443
+ }): Request<ListGroupsResponse>;
444
+ /** Modifies a group. For example, you could change a group's title. */
445
+ update(request: {
446
+ /** V1 error format. */
447
+ "$.xgafv"?: string;
448
+ /** OAuth access token. */
449
+ access_token?: string;
450
+ /** Data format for response. */
451
+ alt?: string;
452
+ /** JSONP */
453
+ callback?: string;
454
+ /** Selector specifying which fields to include in a partial response. */
455
+ fields?: string;
456
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
457
+ key?: string;
458
+ /** OAuth 2.0 token for the current user. */
459
+ oauth_token?: string;
460
+ /**
461
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
462
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
463
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
464
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
465
+ */
466
+ onBehalfOfContentOwner?: string;
467
+ /** Returns response with indentations and line breaks. */
468
+ prettyPrint?: boolean;
469
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
470
+ quotaUser?: string;
471
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
472
+ upload_protocol?: string;
473
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
474
+ uploadType?: string;
475
+ /** Request body */
476
+ resource: Group;
477
+ }): Request<Group>;
478
+ update(request: {
479
+ /** V1 error format. */
480
+ "$.xgafv"?: string;
481
+ /** OAuth access token. */
482
+ access_token?: string;
483
+ /** Data format for response. */
484
+ alt?: string;
485
+ /** JSONP */
486
+ callback?: string;
487
+ /** Selector specifying which fields to include in a partial response. */
488
+ fields?: string;
489
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
490
+ key?: string;
491
+ /** OAuth 2.0 token for the current user. */
492
+ oauth_token?: string;
493
+ /**
494
+ * This parameter can only be used in a properly authorized request. **Note:** This parameter is intended exclusively for YouTube content partners that own and manage many
495
+ * different YouTube channels. The `onBehalfOfContentOwner` parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the
496
+ * content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide
497
+ * authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
498
+ */
499
+ onBehalfOfContentOwner?: string;
500
+ /** Returns response with indentations and line breaks. */
501
+ prettyPrint?: boolean;
502
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
503
+ quotaUser?: string;
504
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
505
+ upload_protocol?: string;
506
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
507
+ uploadType?: string;
508
+ },
509
+ body: Group): Request<Group>;
510
+ }
511
+ interface ReportsResource {
512
+ /** Retrieve your YouTube Analytics reports. */
513
+ query(request?: {
514
+ /** V1 error format. */
515
+ "$.xgafv"?: string;
516
+ /** OAuth access token. */
517
+ access_token?: string;
518
+ /** Data format for response. */
519
+ alt?: string;
520
+ /** JSONP */
521
+ callback?: string;
522
+ /**
523
+ * 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
524
+ * with an error if the specified currency is not recognized.", pattern: [A-Z]{3}
525
+ */
526
+ currency?: string;
527
+ /**
528
+ * A comma-separated list of YouTube Analytics dimensions, such as `views` or `ageGroup,gender`. See the [Available Reports](/youtube/analytics/v2/available_reports) document for a
529
+ * list of the reports that you can retrieve and the dimensions used for those reports. Also see the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document for definitions of
530
+ * those dimensions." pattern: [0-9a-zA-Z,]+
531
+ */
532
+ dimensions?: string;
533
+ /** The end date for fetching YouTube Analytics data. The value should be in `YYYY-MM-DD` format. required: true, pattern: [0-9]{4}-[0-9]{2}-[0-9]{2} */
534
+ endDate?: string;
535
+ /** Selector specifying which fields to include in a partial response. */
536
+ fields?: string;
537
+ /**
538
+ * A list of filters that should be applied when retrieving YouTube Analytics data. The [Available Reports](/youtube/analytics/v2/available_reports) document identifies the
539
+ * dimensions that can be used to filter each report, and the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document defines those dimensions. If a request uses multiple
540
+ * filters, join them together with a semicolon (`;`), and the returned result table will satisfy both filters. For example, a filters parameter value of
541
+ * `video==dMH0bHeiRNg;country==IT` restricts the result set to include data for the given video in Italy.",
542
+ */
543
+ filters?: string;
544
+ /**
545
+ * Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics data. - To request data for a YouTube user, set the `ids` parameter value to
546
+ * `channel==CHANNEL_ID`, where `CHANNEL_ID` specifies the unique YouTube channel ID. - To request data for a YouTube CMS content owner, set the `ids` parameter value to
547
+ * `contentOwner==OWNER_NAME`, where `OWNER_NAME` is the CMS name of the content owner. required: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+
548
+ */
549
+ ids?: string;
550
+ /** If set to true historical data (i.e. channel data from before the linking of the channel to the content owner) will be retrieved.", */
551
+ includeHistoricalChannelData?: boolean;
552
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
553
+ key?: string;
554
+ /** The maximum number of rows to include in the response.", minValue: 1 */
555
+ maxResults?: number;
556
+ /**
557
+ * A comma-separated list of YouTube Analytics metrics, such as `views` or `likes,dislikes`. See the [Available Reports](/youtube/analytics/v2/available_reports) document for a
558
+ * list of the reports that you can retrieve and the metrics available in each report, and see the [Metrics](/youtube/analytics/v2/dimsmets/mets) document for definitions of those
559
+ * metrics. required: true, pattern: [0-9a-zA-Z,]+
560
+ */
561
+ metrics?: string;
562
+ /** OAuth 2.0 token for the current user. */
563
+ oauth_token?: string;
564
+ /** Returns response with indentations and line breaks. */
565
+ prettyPrint?: boolean;
566
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
567
+ quotaUser?: string;
568
+ /**
569
+ * 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
570
+ * descending sort order.", pattern: [-0-9a-zA-Z,]+
571
+ */
572
+ sort?: string;
573
+ /** The start date for fetching YouTube Analytics data. The value should be in `YYYY-MM-DD` format. required: true, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2} */
574
+ startDate?: string;
575
+ /** An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter (one-based, inclusive).", minValue: 1 */
576
+ startIndex?: number;
577
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
578
+ upload_protocol?: string;
579
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
580
+ uploadType?: string;
581
+ }): Request<QueryResponse>;
582
+ }
583
+
584
+ const groupItems: GroupItemsResource;
585
+
586
+ const groups: GroupsResource;
587
+
588
+ const reports: ReportsResource;
589
+ }
590
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.youtube_analytics-v2",
3
+ "version": "0.0.20220808",
4
+ "description": "TypeScript typings for YouTube Analytics API v2",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,120 @@
1
+ # TypeScript typings for YouTube Analytics API v2
2
+
3
+ Retrieves your YouTube Analytics data.
4
+ For detailed description please check [documentation](https://developers.google.com/youtube/analytics).
5
+
6
+ ## Installing
7
+
8
+ Install typings for YouTube Analytics API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.youtube_analytics-v2 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://youtubeanalytics.googleapis.com/$discovery/rest?version=v2', () => {
29
+ // now we can use:
30
+ // gapi.client.youtubeAnalytics
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('youtubeAnalytics', 'v2', () => {
37
+ // now we can use:
38
+ // gapi.client.youtubeAnalytics
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // Manage your YouTube account
49
+ 'https://www.googleapis.com/auth/youtube',
50
+
51
+ // View your YouTube account
52
+ 'https://www.googleapis.com/auth/youtube.readonly',
53
+
54
+ // View and manage your assets and associated content on YouTube
55
+ 'https://www.googleapis.com/auth/youtubepartner',
56
+
57
+ // View monetary and non-monetary YouTube Analytics reports for your YouTube content
58
+ 'https://www.googleapis.com/auth/yt-analytics-monetary.readonly',
59
+
60
+ // View YouTube Analytics reports for your YouTube content
61
+ 'https://www.googleapis.com/auth/yt-analytics.readonly',
62
+ ],
63
+ immediate = true;
64
+ // ...
65
+
66
+ gapi.auth.authorize(
67
+ { client_id: client_id, scope: scope, immediate: immediate },
68
+ authResult => {
69
+ if (authResult && !authResult.error) {
70
+ /* handle successful authorization */
71
+ } else {
72
+ /* handle authorization error */
73
+ }
74
+ });
75
+ ```
76
+
77
+ After that you can use YouTube Analytics API resources: <!-- TODO: make this work for multiple namespaces -->
78
+
79
+ ```typescript
80
+
81
+ /*
82
+ Removes an item from a group.
83
+ */
84
+ await gapi.client.youtubeAnalytics.groupItems.delete({ });
85
+
86
+ /*
87
+ Creates a group item.
88
+ */
89
+ await gapi.client.youtubeAnalytics.groupItems.insert({ });
90
+
91
+ /*
92
+ Returns a collection of group items that match the API request parameters.
93
+ */
94
+ await gapi.client.youtubeAnalytics.groupItems.list({ });
95
+
96
+ /*
97
+ Deletes a group.
98
+ */
99
+ await gapi.client.youtubeAnalytics.groups.delete({ });
100
+
101
+ /*
102
+ Creates a group.
103
+ */
104
+ await gapi.client.youtubeAnalytics.groups.insert({ });
105
+
106
+ /*
107
+ 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.
108
+ */
109
+ await gapi.client.youtubeAnalytics.groups.list({ });
110
+
111
+ /*
112
+ Modifies a group. For example, you could change a group's title.
113
+ */
114
+ await gapi.client.youtubeAnalytics.groups.update({ });
115
+
116
+ /*
117
+ Retrieve your YouTube Analytics reports.
118
+ */
119
+ await gapi.client.youtubeAnalytics.reports.query({ });
120
+ ```
package/tests.ts ADDED
@@ -0,0 +1,176 @@
1
+ /* This is stub file for gapi.client.youtube_analytics-v2 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20220808
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://youtubeanalytics.googleapis.com/$discovery/rest?version=v2');
12
+ /** now we can use gapi.client.youtubeAnalytics */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** Manage your YouTube account */
19
+ 'https://www.googleapis.com/auth/youtube',
20
+ /** View your YouTube account */
21
+ 'https://www.googleapis.com/auth/youtube.readonly',
22
+ /** View and manage your assets and associated content on YouTube */
23
+ 'https://www.googleapis.com/auth/youtubepartner',
24
+ /** View monetary and non-monetary YouTube Analytics reports for your YouTube content */
25
+ 'https://www.googleapis.com/auth/yt-analytics-monetary.readonly',
26
+ /** View YouTube Analytics reports for your YouTube content */
27
+ 'https://www.googleapis.com/auth/yt-analytics.readonly',
28
+ ];
29
+ const immediate = false;
30
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
31
+ if (authResult && !authResult.error) {
32
+ /** handle successful authorization */
33
+ run();
34
+ } else {
35
+ /** handle authorization error */
36
+ }
37
+ });
38
+
39
+ async function run() {
40
+ /** Removes an item from a group. */
41
+ await gapi.client.youtubeAnalytics.groupItems.delete({
42
+ id: "Test string",
43
+ onBehalfOfContentOwner: "Test string",
44
+ });
45
+ /** Creates a group item. */
46
+ await gapi.client.youtubeAnalytics.groupItems.insert({
47
+ onBehalfOfContentOwner: "Test string",
48
+ }, {
49
+ errors: {
50
+ code: "Test string",
51
+ error: [
52
+ {
53
+ argument: [
54
+ "Test string"
55
+ ],
56
+ code: "Test string",
57
+ debugInfo: "Test string",
58
+ domain: "Test string",
59
+ externalErrorMessage: "Test string",
60
+ location: "Test string",
61
+ locationType: "Test string",
62
+ }
63
+ ],
64
+ requestId: "Test string",
65
+ },
66
+ etag: "Test string",
67
+ groupId: "Test string",
68
+ id: "Test string",
69
+ kind: "Test string",
70
+ resource: {
71
+ id: "Test string",
72
+ kind: "Test string",
73
+ },
74
+ });
75
+ /** Returns a collection of group items that match the API request parameters. */
76
+ await gapi.client.youtubeAnalytics.groupItems.list({
77
+ groupId: "Test string",
78
+ onBehalfOfContentOwner: "Test string",
79
+ });
80
+ /** Deletes a group. */
81
+ await gapi.client.youtubeAnalytics.groups.delete({
82
+ id: "Test string",
83
+ onBehalfOfContentOwner: "Test string",
84
+ });
85
+ /** Creates a group. */
86
+ await gapi.client.youtubeAnalytics.groups.insert({
87
+ onBehalfOfContentOwner: "Test string",
88
+ }, {
89
+ contentDetails: {
90
+ itemCount: "Test string",
91
+ itemType: "Test string",
92
+ },
93
+ errors: {
94
+ code: "Test string",
95
+ error: [
96
+ {
97
+ argument: [
98
+ "Test string"
99
+ ],
100
+ code: "Test string",
101
+ debugInfo: "Test string",
102
+ domain: "Test string",
103
+ externalErrorMessage: "Test string",
104
+ location: "Test string",
105
+ locationType: "Test string",
106
+ }
107
+ ],
108
+ requestId: "Test string",
109
+ },
110
+ etag: "Test string",
111
+ id: "Test string",
112
+ kind: "Test string",
113
+ snippet: {
114
+ publishedAt: "Test string",
115
+ title: "Test string",
116
+ },
117
+ });
118
+ /**
119
+ * 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
120
+ * by their unique IDs.
121
+ */
122
+ await gapi.client.youtubeAnalytics.groups.list({
123
+ id: "Test string",
124
+ mine: true,
125
+ onBehalfOfContentOwner: "Test string",
126
+ pageToken: "Test string",
127
+ });
128
+ /** Modifies a group. For example, you could change a group's title. */
129
+ await gapi.client.youtubeAnalytics.groups.update({
130
+ onBehalfOfContentOwner: "Test string",
131
+ }, {
132
+ contentDetails: {
133
+ itemCount: "Test string",
134
+ itemType: "Test string",
135
+ },
136
+ errors: {
137
+ code: "Test string",
138
+ error: [
139
+ {
140
+ argument: [
141
+ "Test string"
142
+ ],
143
+ code: "Test string",
144
+ debugInfo: "Test string",
145
+ domain: "Test string",
146
+ externalErrorMessage: "Test string",
147
+ location: "Test string",
148
+ locationType: "Test string",
149
+ }
150
+ ],
151
+ requestId: "Test string",
152
+ },
153
+ etag: "Test string",
154
+ id: "Test string",
155
+ kind: "Test string",
156
+ snippet: {
157
+ publishedAt: "Test string",
158
+ title: "Test string",
159
+ },
160
+ });
161
+ /** Retrieve your YouTube Analytics reports. */
162
+ await gapi.client.youtubeAnalytics.reports.query({
163
+ currency: "Test string",
164
+ dimensions: "Test string",
165
+ endDate: "Test string",
166
+ filters: "Test string",
167
+ ids: "Test string",
168
+ includeHistoricalChannelData: true,
169
+ maxResults: 42,
170
+ metrics: "Test string",
171
+ sort: "Test string",
172
+ startDate: "Test string",
173
+ startIndex: 42,
174
+ });
175
+ }
176
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }