@maxim_mazurok/gapi.client.marketingplatformadmin-v1alpha 0.0.20240229

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.
Files changed (3) hide show
  1. package/index.d.ts +240 -0
  2. package/package.json +20 -0
  3. package/readme.md +76 -0
package/index.d.ts ADDED
@@ -0,0 +1,240 @@
1
+ /* Type definitions for non-npm package Google Marketing Platform Admin API v1alpha 0.0 */
2
+ // Project: https://developers.google.com/analytics/devguides/config/gmp/v1
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
+
8
+ // IMPORTANT
9
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
10
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
11
+ // Generated from: https://marketingplatformadmin.googleapis.com/$discovery/rest?version=v1alpha
12
+ // Revision: 20240229
13
+
14
+ /// <reference types="gapi.client" />
15
+
16
+ declare namespace gapi.client {
17
+ /** Load Google Marketing Platform Admin API v1alpha */
18
+ function load(
19
+ urlOrObject: 'https://marketingplatformadmin.googleapis.com/$discovery/rest?version=v1alpha'
20
+ ): Promise<void>;
21
+ /** @deprecated Please load APIs with discovery documents. */
22
+ function load(
23
+ name: 'marketingplatformadmin',
24
+ version: 'v1alpha'
25
+ ): Promise<void>;
26
+ /** @deprecated Please load APIs with discovery documents. */
27
+ function load(
28
+ name: 'marketingplatformadmin',
29
+ version: 'v1alpha',
30
+ callback: () => any
31
+ ): void;
32
+
33
+ namespace marketingplatformadmin {
34
+ interface AnalyticsAccountLink {
35
+ /** Required. Immutable. The resource name of the AnalyticsAdmin API account. The account ID will be used as the ID of this AnalyticsAccountLink resource, which will become the final component of the resource name. Format: analyticsadmin.googleapis.com/accounts/{account_id} */
36
+ analyticsAccount?: string;
37
+ /** Output only. The human-readable name for the Analytics account. */
38
+ displayName?: string;
39
+ /** Output only. The verification state of the link between the Analytics account and the parent organization. */
40
+ linkVerificationState?: string;
41
+ /** Identifier. Resource name of this AnalyticsAccountLink. Note the resource ID is the same as the ID of the Analtyics account. Format: organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id} Example: "organizations/xyz/analyticsAccountLinks/1234" */
42
+ name?: string;
43
+ }
44
+ interface Empty {}
45
+ interface ListAnalyticsAccountLinksResponse {
46
+ /** Analytics account links in this organization. */
47
+ analyticsAccountLinks?: AnalyticsAccountLink[];
48
+ /** A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. */
49
+ nextPageToken?: string;
50
+ }
51
+ interface SetPropertyServiceLevelRequest {
52
+ /** Required. The Analytics property to change the ServiceLevel setting. This field is the name of the Google Analytics Admin API property resource. Format: analyticsadmin.googleapis.com/properties/{property_id} */
53
+ analyticsProperty?: string;
54
+ /** Required. The service level to set for this property. */
55
+ serviceLevel?: string;
56
+ }
57
+ interface SetPropertyServiceLevelResponse {}
58
+ interface AnalyticsAccountLinksResource {
59
+ /** Creates the link between the Analytics account and the Google Marketing Platform organization. User needs to be an org user, and admin on the Analytics account to create the link. If the account is already linked to an organization, user needs to unlink the account from the current organization, then try link again. */
60
+ create(request: {
61
+ /** V1 error format. */
62
+ '$.xgafv'?: string;
63
+ /** OAuth access token. */
64
+ access_token?: string;
65
+ /** Data format for response. */
66
+ alt?: string;
67
+ /** JSONP */
68
+ callback?: string;
69
+ /** Selector specifying which fields to include in a partial response. */
70
+ fields?: string;
71
+ /** 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. */
72
+ key?: string;
73
+ /** OAuth 2.0 token for the current user. */
74
+ oauth_token?: string;
75
+ /** Required. The parent resource where this Analytics account link will be created. Format: organizations/{org_id} */
76
+ parent: string;
77
+ /** Returns response with indentations and line breaks. */
78
+ prettyPrint?: boolean;
79
+ /** 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. */
80
+ quotaUser?: string;
81
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
82
+ upload_protocol?: string;
83
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
84
+ uploadType?: string;
85
+ /** Request body */
86
+ resource: AnalyticsAccountLink;
87
+ }): Request<AnalyticsAccountLink>;
88
+ create(
89
+ request: {
90
+ /** V1 error format. */
91
+ '$.xgafv'?: string;
92
+ /** OAuth access token. */
93
+ access_token?: string;
94
+ /** Data format for response. */
95
+ alt?: string;
96
+ /** JSONP */
97
+ callback?: string;
98
+ /** Selector specifying which fields to include in a partial response. */
99
+ fields?: string;
100
+ /** 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. */
101
+ key?: string;
102
+ /** OAuth 2.0 token for the current user. */
103
+ oauth_token?: string;
104
+ /** Required. The parent resource where this Analytics account link will be created. Format: organizations/{org_id} */
105
+ parent: string;
106
+ /** Returns response with indentations and line breaks. */
107
+ prettyPrint?: boolean;
108
+ /** 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. */
109
+ quotaUser?: string;
110
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
111
+ upload_protocol?: string;
112
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
113
+ uploadType?: string;
114
+ },
115
+ body: AnalyticsAccountLink
116
+ ): Request<AnalyticsAccountLink>;
117
+ /** Deletes the AnalyticsAccountLink, which detaches the Analytics account from the Google Marketing Platform organization. User needs to be an org user, and admin on the Analytics account in order to delete the link. */
118
+ delete(request?: {
119
+ /** V1 error format. */
120
+ '$.xgafv'?: string;
121
+ /** OAuth access token. */
122
+ access_token?: string;
123
+ /** Data format for response. */
124
+ alt?: string;
125
+ /** JSONP */
126
+ callback?: string;
127
+ /** Selector specifying which fields to include in a partial response. */
128
+ fields?: string;
129
+ /** 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. */
130
+ key?: string;
131
+ /** Required. The name of the Analytics account link to delete. Format: organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id} */
132
+ name: string;
133
+ /** OAuth 2.0 token for the current user. */
134
+ oauth_token?: string;
135
+ /** Returns response with indentations and line breaks. */
136
+ prettyPrint?: boolean;
137
+ /** 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. */
138
+ quotaUser?: string;
139
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
140
+ upload_protocol?: string;
141
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
142
+ uploadType?: string;
143
+ }): Request<{}>;
144
+ /** Lists the Google Analytics accounts link to the specified Google Marketing Platform organization. */
145
+ list(request?: {
146
+ /** V1 error format. */
147
+ '$.xgafv'?: string;
148
+ /** OAuth access token. */
149
+ access_token?: string;
150
+ /** Data format for response. */
151
+ alt?: string;
152
+ /** JSONP */
153
+ callback?: string;
154
+ /** Selector specifying which fields to include in a partial response. */
155
+ fields?: string;
156
+ /** 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. */
157
+ key?: string;
158
+ /** OAuth 2.0 token for the current user. */
159
+ oauth_token?: string;
160
+ /** Optional. The maximum number of Analytics account links to return in one call. The service may return fewer than this value. If unspecified, at most 50 Analytics account links will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. */
161
+ pageSize?: number;
162
+ /** Optional. A page token, received from a previous ListAnalyticsAccountLinks call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAnalyticsAccountLinks` must match the call that provided the page token. */
163
+ pageToken?: string;
164
+ /** Required. The parent organization, which owns this collection of Analytics account links. Format: organizations/{org_id} */
165
+ parent: string;
166
+ /** Returns response with indentations and line breaks. */
167
+ prettyPrint?: boolean;
168
+ /** 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. */
169
+ quotaUser?: string;
170
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
171
+ upload_protocol?: string;
172
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
173
+ uploadType?: string;
174
+ }): Request<ListAnalyticsAccountLinksResponse>;
175
+ /** Updates the service level for an Analytics property. */
176
+ setPropertyServiceLevel(request: {
177
+ /** V1 error format. */
178
+ '$.xgafv'?: string;
179
+ /** OAuth access token. */
180
+ access_token?: string;
181
+ /** Data format for response. */
182
+ alt?: string;
183
+ /** Required. The parent AnalyticsAccountLink scope where this property is in. Format: organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id} */
184
+ analyticsAccountLink: string;
185
+ /** JSONP */
186
+ callback?: string;
187
+ /** Selector specifying which fields to include in a partial response. */
188
+ fields?: string;
189
+ /** 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. */
190
+ key?: string;
191
+ /** OAuth 2.0 token for the current user. */
192
+ oauth_token?: string;
193
+ /** Returns response with indentations and line breaks. */
194
+ prettyPrint?: boolean;
195
+ /** 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. */
196
+ quotaUser?: string;
197
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
198
+ upload_protocol?: string;
199
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
200
+ uploadType?: string;
201
+ /** Request body */
202
+ resource: SetPropertyServiceLevelRequest;
203
+ }): Request<{}>;
204
+ setPropertyServiceLevel(
205
+ request: {
206
+ /** V1 error format. */
207
+ '$.xgafv'?: string;
208
+ /** OAuth access token. */
209
+ access_token?: string;
210
+ /** Data format for response. */
211
+ alt?: string;
212
+ /** Required. The parent AnalyticsAccountLink scope where this property is in. Format: organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id} */
213
+ analyticsAccountLink: string;
214
+ /** JSONP */
215
+ callback?: string;
216
+ /** Selector specifying which fields to include in a partial response. */
217
+ fields?: string;
218
+ /** 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. */
219
+ key?: string;
220
+ /** OAuth 2.0 token for the current user. */
221
+ oauth_token?: string;
222
+ /** Returns response with indentations and line breaks. */
223
+ prettyPrint?: boolean;
224
+ /** 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. */
225
+ quotaUser?: string;
226
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
227
+ upload_protocol?: string;
228
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
229
+ uploadType?: string;
230
+ },
231
+ body: SetPropertyServiceLevelRequest
232
+ ): Request<{}>;
233
+ }
234
+ interface OrganizationsResource {
235
+ analyticsAccountLinks: AnalyticsAccountLinksResource;
236
+ }
237
+
238
+ const organizations: OrganizationsResource;
239
+ }
240
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.marketingplatformadmin-v1alpha",
3
+ "version": "0.0.20240229",
4
+ "description": "TypeScript typings for Google Marketing Platform Admin API v1alpha",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
8
+ },
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Maxim Mazurok",
12
+ "email": "maxim@mazurok.com",
13
+ "url": "https://maxim.mazurok.com"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery-v1": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,76 @@
1
+ # TypeScript typings for Google Marketing Platform Admin API v1alpha
2
+
3
+ marketingplatformadmin.googleapis.com API.
4
+ For detailed description please check [documentation](https://developers.google.com/analytics/devguides/config/gmp/v1).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Marketing Platform Admin API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.marketingplatformadmin-v1alpha --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(
29
+ 'https://marketingplatformadmin.googleapis.com/$discovery/rest?version=v1alpha',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.marketingplatformadmin
33
+ }
34
+ );
35
+ ```
36
+
37
+ ```typescript
38
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
39
+ gapi.client.load('marketingplatformadmin', 'v1alpha', () => {
40
+ // now we can use:
41
+ // gapi.client.marketingplatformadmin
42
+ });
43
+ ```
44
+
45
+ Don't forget to authenticate your client before sending any request to resources:
46
+
47
+ ```typescript
48
+ // declare client_id registered in Google Developers Console
49
+ var client_id = '',
50
+ scope = [
51
+ // View your Google Analytics product account data in GMP home
52
+ 'https://www.googleapis.com/auth/marketingplatformadmin.analytics.read',
53
+
54
+ // Manage your Google Analytics product account data in GMP home
55
+ 'https://www.googleapis.com/auth/marketingplatformadmin.analytics.update',
56
+ ],
57
+ immediate = true;
58
+ // ...
59
+
60
+ gapi.auth.authorize(
61
+ {client_id: client_id, scope: scope, immediate: immediate},
62
+ authResult => {
63
+ if (authResult && !authResult.error) {
64
+ /* handle successful authorization */
65
+ } else {
66
+ /* handle authorization error */
67
+ }
68
+ }
69
+ );
70
+ ```
71
+
72
+ After that you can use Google Marketing Platform Admin API resources: <!-- TODO: make this work for multiple namespaces -->
73
+
74
+ ```typescript
75
+
76
+ ```