google-apis-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/bin/gapi.js +138 -0
- package/dist/src/apis/ads.js +54 -0
- package/dist/src/apis/ga4-admin-v1alpha.js +280 -0
- package/dist/src/apis/ga4-admin.js +291 -0
- package/dist/src/apis/ga4-data.js +72 -0
- package/dist/src/apis/gsc.js +63 -0
- package/dist/src/apis/gtm.js +192 -0
- package/dist/src/apis/indexing.js +18 -0
- package/dist/src/auth.js +172 -0
- package/dist/src/config.js +89 -0
- package/dist/src/manifest.js +69 -0
- package/dist/src/rest.js +90 -0
- package/dist/src/types.js +13 -0
- package/package.json +52 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
const RO = ['analytics.readonly'];
|
|
2
|
+
const RW = ['analytics.edit'];
|
|
3
|
+
export default {
|
|
4
|
+
api: 'ga4-admin',
|
|
5
|
+
baseUrl: 'https://analyticsadmin.googleapis.com',
|
|
6
|
+
resources: {
|
|
7
|
+
accounts: {
|
|
8
|
+
list: {
|
|
9
|
+
httpMethod: 'GET',
|
|
10
|
+
pathTemplate: '/v1beta/accounts',
|
|
11
|
+
scopes: RO,
|
|
12
|
+
listKey: 'accounts',
|
|
13
|
+
},
|
|
14
|
+
get: { httpMethod: 'GET', pathTemplate: '/v1beta/accounts/{account}', scopes: RO },
|
|
15
|
+
patch: { httpMethod: 'PATCH', pathTemplate: '/v1beta/accounts/{account}', scopes: RW },
|
|
16
|
+
delete: { httpMethod: 'DELETE', pathTemplate: '/v1beta/accounts/{account}', scopes: RW },
|
|
17
|
+
'get-data-sharing-settings': {
|
|
18
|
+
httpMethod: 'GET',
|
|
19
|
+
pathTemplate: '/v1beta/accounts/{account}/dataSharingSettings',
|
|
20
|
+
scopes: RO,
|
|
21
|
+
},
|
|
22
|
+
'provision-account-ticket': {
|
|
23
|
+
httpMethod: 'POST',
|
|
24
|
+
pathTemplate: '/v1beta/accounts:provisionAccountTicket',
|
|
25
|
+
scopes: RW,
|
|
26
|
+
},
|
|
27
|
+
'run-access-report': {
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
pathTemplate: '/v1beta/accounts/{account}:runAccessReport',
|
|
30
|
+
scopes: RO,
|
|
31
|
+
},
|
|
32
|
+
'search-change-history-events': {
|
|
33
|
+
httpMethod: 'POST',
|
|
34
|
+
// No listKey: this POST paginates via a *body* pageToken, which the
|
|
35
|
+
// executor's listKey auto-paging (query pageToken) can't drive — the
|
|
36
|
+
// caller pages manually with --body. Returns the raw page.
|
|
37
|
+
pathTemplate: '/v1beta/accounts/{account}:searchChangeHistoryEvents',
|
|
38
|
+
scopes: RW,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
'account-summaries': {
|
|
42
|
+
list: {
|
|
43
|
+
httpMethod: 'GET',
|
|
44
|
+
pathTemplate: '/v1beta/accountSummaries',
|
|
45
|
+
scopes: RO,
|
|
46
|
+
listKey: 'accountSummaries',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
properties: {
|
|
50
|
+
list: {
|
|
51
|
+
httpMethod: 'GET',
|
|
52
|
+
pathTemplate: '/v1beta/properties',
|
|
53
|
+
scopes: RO,
|
|
54
|
+
listKey: 'properties',
|
|
55
|
+
},
|
|
56
|
+
get: { httpMethod: 'GET', pathTemplate: '/v1beta/properties/{property}', scopes: RO },
|
|
57
|
+
create: { httpMethod: 'POST', pathTemplate: '/v1beta/properties', scopes: RW },
|
|
58
|
+
patch: { httpMethod: 'PATCH', pathTemplate: '/v1beta/properties/{property}', scopes: RW },
|
|
59
|
+
delete: { httpMethod: 'DELETE', pathTemplate: '/v1beta/properties/{property}', scopes: RW },
|
|
60
|
+
'acknowledge-user-data-collection': {
|
|
61
|
+
httpMethod: 'POST',
|
|
62
|
+
pathTemplate: '/v1beta/properties/{property}:acknowledgeUserDataCollection',
|
|
63
|
+
scopes: RW,
|
|
64
|
+
},
|
|
65
|
+
'run-access-report': {
|
|
66
|
+
httpMethod: 'POST',
|
|
67
|
+
pathTemplate: '/v1beta/properties/{property}:runAccessReport',
|
|
68
|
+
scopes: RO,
|
|
69
|
+
},
|
|
70
|
+
'get-data-retention-settings': {
|
|
71
|
+
httpMethod: 'GET',
|
|
72
|
+
pathTemplate: '/v1beta/properties/{property}/dataRetentionSettings',
|
|
73
|
+
scopes: RO,
|
|
74
|
+
},
|
|
75
|
+
'update-data-retention-settings': {
|
|
76
|
+
httpMethod: 'PATCH',
|
|
77
|
+
pathTemplate: '/v1beta/properties/{property}/dataRetentionSettings',
|
|
78
|
+
scopes: RW,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
'conversion-events': {
|
|
82
|
+
list: {
|
|
83
|
+
httpMethod: 'GET',
|
|
84
|
+
pathTemplate: '/v1beta/properties/{property}/conversionEvents',
|
|
85
|
+
scopes: RO,
|
|
86
|
+
listKey: 'conversionEvents',
|
|
87
|
+
},
|
|
88
|
+
get: {
|
|
89
|
+
httpMethod: 'GET',
|
|
90
|
+
pathTemplate: '/v1beta/properties/{property}/conversionEvents/{conversionEvent}',
|
|
91
|
+
scopes: RO,
|
|
92
|
+
},
|
|
93
|
+
create: {
|
|
94
|
+
httpMethod: 'POST',
|
|
95
|
+
pathTemplate: '/v1beta/properties/{property}/conversionEvents',
|
|
96
|
+
scopes: RW,
|
|
97
|
+
},
|
|
98
|
+
patch: {
|
|
99
|
+
httpMethod: 'PATCH',
|
|
100
|
+
pathTemplate: '/v1beta/properties/{property}/conversionEvents/{conversionEvent}',
|
|
101
|
+
scopes: RW,
|
|
102
|
+
},
|
|
103
|
+
delete: {
|
|
104
|
+
httpMethod: 'DELETE',
|
|
105
|
+
pathTemplate: '/v1beta/properties/{property}/conversionEvents/{conversionEvent}',
|
|
106
|
+
scopes: RW,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
'custom-dimensions': {
|
|
110
|
+
list: {
|
|
111
|
+
httpMethod: 'GET',
|
|
112
|
+
pathTemplate: '/v1beta/properties/{property}/customDimensions',
|
|
113
|
+
scopes: RO,
|
|
114
|
+
listKey: 'customDimensions',
|
|
115
|
+
},
|
|
116
|
+
get: {
|
|
117
|
+
httpMethod: 'GET',
|
|
118
|
+
pathTemplate: '/v1beta/properties/{property}/customDimensions/{customDimension}',
|
|
119
|
+
scopes: RO,
|
|
120
|
+
},
|
|
121
|
+
create: {
|
|
122
|
+
httpMethod: 'POST',
|
|
123
|
+
pathTemplate: '/v1beta/properties/{property}/customDimensions',
|
|
124
|
+
scopes: RW,
|
|
125
|
+
},
|
|
126
|
+
patch: {
|
|
127
|
+
httpMethod: 'PATCH',
|
|
128
|
+
pathTemplate: '/v1beta/properties/{property}/customDimensions/{customDimension}',
|
|
129
|
+
scopes: RW,
|
|
130
|
+
},
|
|
131
|
+
archive: {
|
|
132
|
+
httpMethod: 'POST',
|
|
133
|
+
pathTemplate: '/v1beta/properties/{property}/customDimensions/{customDimension}:archive',
|
|
134
|
+
scopes: RW,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
'custom-metrics': {
|
|
138
|
+
list: {
|
|
139
|
+
httpMethod: 'GET',
|
|
140
|
+
pathTemplate: '/v1beta/properties/{property}/customMetrics',
|
|
141
|
+
scopes: RO,
|
|
142
|
+
listKey: 'customMetrics',
|
|
143
|
+
},
|
|
144
|
+
get: {
|
|
145
|
+
httpMethod: 'GET',
|
|
146
|
+
pathTemplate: '/v1beta/properties/{property}/customMetrics/{customMetric}',
|
|
147
|
+
scopes: RO,
|
|
148
|
+
},
|
|
149
|
+
create: {
|
|
150
|
+
httpMethod: 'POST',
|
|
151
|
+
pathTemplate: '/v1beta/properties/{property}/customMetrics',
|
|
152
|
+
scopes: RW,
|
|
153
|
+
},
|
|
154
|
+
patch: {
|
|
155
|
+
httpMethod: 'PATCH',
|
|
156
|
+
pathTemplate: '/v1beta/properties/{property}/customMetrics/{customMetric}',
|
|
157
|
+
scopes: RW,
|
|
158
|
+
},
|
|
159
|
+
archive: {
|
|
160
|
+
httpMethod: 'POST',
|
|
161
|
+
pathTemplate: '/v1beta/properties/{property}/customMetrics/{customMetric}:archive',
|
|
162
|
+
scopes: RW,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
'data-streams': {
|
|
166
|
+
list: {
|
|
167
|
+
httpMethod: 'GET',
|
|
168
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams',
|
|
169
|
+
scopes: RO,
|
|
170
|
+
listKey: 'dataStreams',
|
|
171
|
+
},
|
|
172
|
+
get: {
|
|
173
|
+
httpMethod: 'GET',
|
|
174
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}',
|
|
175
|
+
scopes: RO,
|
|
176
|
+
},
|
|
177
|
+
create: {
|
|
178
|
+
httpMethod: 'POST',
|
|
179
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams',
|
|
180
|
+
scopes: RW,
|
|
181
|
+
},
|
|
182
|
+
patch: {
|
|
183
|
+
httpMethod: 'PATCH',
|
|
184
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}',
|
|
185
|
+
scopes: RW,
|
|
186
|
+
},
|
|
187
|
+
delete: {
|
|
188
|
+
httpMethod: 'DELETE',
|
|
189
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}',
|
|
190
|
+
scopes: RW,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
'measurement-protocol-secrets': {
|
|
194
|
+
list: {
|
|
195
|
+
httpMethod: 'GET',
|
|
196
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets',
|
|
197
|
+
scopes: RO,
|
|
198
|
+
listKey: 'measurementProtocolSecrets',
|
|
199
|
+
},
|
|
200
|
+
get: {
|
|
201
|
+
httpMethod: 'GET',
|
|
202
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{secret}',
|
|
203
|
+
scopes: RO,
|
|
204
|
+
},
|
|
205
|
+
create: {
|
|
206
|
+
httpMethod: 'POST',
|
|
207
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets',
|
|
208
|
+
scopes: RW,
|
|
209
|
+
},
|
|
210
|
+
patch: {
|
|
211
|
+
httpMethod: 'PATCH',
|
|
212
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{secret}',
|
|
213
|
+
scopes: RW,
|
|
214
|
+
},
|
|
215
|
+
delete: {
|
|
216
|
+
httpMethod: 'DELETE',
|
|
217
|
+
pathTemplate: '/v1beta/properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{secret}',
|
|
218
|
+
scopes: RW,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
'firebase-links': {
|
|
222
|
+
list: {
|
|
223
|
+
httpMethod: 'GET',
|
|
224
|
+
pathTemplate: '/v1beta/properties/{property}/firebaseLinks',
|
|
225
|
+
scopes: RO,
|
|
226
|
+
listKey: 'firebaseLinks',
|
|
227
|
+
},
|
|
228
|
+
create: {
|
|
229
|
+
httpMethod: 'POST',
|
|
230
|
+
pathTemplate: '/v1beta/properties/{property}/firebaseLinks',
|
|
231
|
+
scopes: RW,
|
|
232
|
+
},
|
|
233
|
+
delete: {
|
|
234
|
+
httpMethod: 'DELETE',
|
|
235
|
+
pathTemplate: '/v1beta/properties/{property}/firebaseLinks/{firebaseLink}',
|
|
236
|
+
scopes: RW,
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
'google-ads-links': {
|
|
240
|
+
list: {
|
|
241
|
+
httpMethod: 'GET',
|
|
242
|
+
pathTemplate: '/v1beta/properties/{property}/googleAdsLinks',
|
|
243
|
+
scopes: RO,
|
|
244
|
+
listKey: 'googleAdsLinks',
|
|
245
|
+
},
|
|
246
|
+
create: {
|
|
247
|
+
httpMethod: 'POST',
|
|
248
|
+
pathTemplate: '/v1beta/properties/{property}/googleAdsLinks',
|
|
249
|
+
scopes: RW,
|
|
250
|
+
},
|
|
251
|
+
patch: {
|
|
252
|
+
httpMethod: 'PATCH',
|
|
253
|
+
pathTemplate: '/v1beta/properties/{property}/googleAdsLinks/{googleAdsLink}',
|
|
254
|
+
scopes: RW,
|
|
255
|
+
},
|
|
256
|
+
delete: {
|
|
257
|
+
httpMethod: 'DELETE',
|
|
258
|
+
pathTemplate: '/v1beta/properties/{property}/googleAdsLinks/{googleAdsLink}',
|
|
259
|
+
scopes: RW,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
'key-events': {
|
|
263
|
+
list: {
|
|
264
|
+
httpMethod: 'GET',
|
|
265
|
+
pathTemplate: '/v1beta/properties/{property}/keyEvents',
|
|
266
|
+
scopes: RO,
|
|
267
|
+
listKey: 'keyEvents',
|
|
268
|
+
},
|
|
269
|
+
get: {
|
|
270
|
+
httpMethod: 'GET',
|
|
271
|
+
pathTemplate: '/v1beta/properties/{property}/keyEvents/{keyEvent}',
|
|
272
|
+
scopes: RO,
|
|
273
|
+
},
|
|
274
|
+
create: {
|
|
275
|
+
httpMethod: 'POST',
|
|
276
|
+
pathTemplate: '/v1beta/properties/{property}/keyEvents',
|
|
277
|
+
scopes: RW,
|
|
278
|
+
},
|
|
279
|
+
patch: {
|
|
280
|
+
httpMethod: 'PATCH',
|
|
281
|
+
pathTemplate: '/v1beta/properties/{property}/keyEvents/{keyEvent}',
|
|
282
|
+
scopes: RW,
|
|
283
|
+
},
|
|
284
|
+
delete: {
|
|
285
|
+
httpMethod: 'DELETE',
|
|
286
|
+
pathTemplate: '/v1beta/properties/{property}/keyEvents/{keyEvent}',
|
|
287
|
+
scopes: RW,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const RO = ['analytics.readonly'];
|
|
2
|
+
// Reporting POSTs page via a *body* offset/limit (no nextPageToken), so no
|
|
3
|
+
// listKey: the executor returns the single raw page. audience-exports list is
|
|
4
|
+
// the one real collection (query pageToken auto-paged via listKey).
|
|
5
|
+
export default {
|
|
6
|
+
api: 'ga4-data',
|
|
7
|
+
baseUrl: 'https://analyticsdata.googleapis.com',
|
|
8
|
+
resources: {
|
|
9
|
+
reports: {
|
|
10
|
+
run: {
|
|
11
|
+
httpMethod: 'POST',
|
|
12
|
+
pathTemplate: '/v1beta/properties/{property}:runReport',
|
|
13
|
+
scopes: RO,
|
|
14
|
+
},
|
|
15
|
+
'run-realtime': {
|
|
16
|
+
httpMethod: 'POST',
|
|
17
|
+
pathTemplate: '/v1beta/properties/{property}:runRealtimeReport',
|
|
18
|
+
scopes: RO,
|
|
19
|
+
},
|
|
20
|
+
'run-pivot': {
|
|
21
|
+
httpMethod: 'POST',
|
|
22
|
+
pathTemplate: '/v1beta/properties/{property}:runPivotReport',
|
|
23
|
+
scopes: RO,
|
|
24
|
+
},
|
|
25
|
+
'batch-run': {
|
|
26
|
+
httpMethod: 'POST',
|
|
27
|
+
pathTemplate: '/v1beta/properties/{property}:batchRunReports',
|
|
28
|
+
scopes: RO,
|
|
29
|
+
},
|
|
30
|
+
'batch-run-pivot': {
|
|
31
|
+
httpMethod: 'POST',
|
|
32
|
+
pathTemplate: '/v1beta/properties/{property}:batchRunPivotReports',
|
|
33
|
+
scopes: RO,
|
|
34
|
+
},
|
|
35
|
+
'check-compatibility': {
|
|
36
|
+
httpMethod: 'POST',
|
|
37
|
+
pathTemplate: '/v1beta/properties/{property}:checkCompatibility',
|
|
38
|
+
scopes: RO,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
metadata: {
|
|
42
|
+
get: {
|
|
43
|
+
httpMethod: 'GET',
|
|
44
|
+
pathTemplate: '/v1beta/properties/{property}/metadata',
|
|
45
|
+
scopes: RO,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
'audience-exports': {
|
|
49
|
+
list: {
|
|
50
|
+
httpMethod: 'GET',
|
|
51
|
+
pathTemplate: '/v1beta/properties/{property}/audienceExports',
|
|
52
|
+
scopes: RO,
|
|
53
|
+
listKey: 'audienceExports',
|
|
54
|
+
},
|
|
55
|
+
get: {
|
|
56
|
+
httpMethod: 'GET',
|
|
57
|
+
pathTemplate: '/v1beta/properties/{property}/audienceExports/{audienceExport}',
|
|
58
|
+
scopes: RO,
|
|
59
|
+
},
|
|
60
|
+
create: {
|
|
61
|
+
httpMethod: 'POST',
|
|
62
|
+
pathTemplate: '/v1beta/properties/{property}/audienceExports',
|
|
63
|
+
scopes: RO,
|
|
64
|
+
},
|
|
65
|
+
query: {
|
|
66
|
+
httpMethod: 'POST',
|
|
67
|
+
pathTemplate: '/v1beta/properties/{property}/audienceExports/{audienceExport}:query',
|
|
68
|
+
scopes: RO,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const W = ['webmasters'];
|
|
2
|
+
export default {
|
|
3
|
+
api: 'gsc',
|
|
4
|
+
baseUrl: 'https://searchconsole.googleapis.com',
|
|
5
|
+
resources: {
|
|
6
|
+
sites: {
|
|
7
|
+
list: {
|
|
8
|
+
httpMethod: 'GET',
|
|
9
|
+
pathTemplate: '/webmasters/v3/sites',
|
|
10
|
+
scopes: W,
|
|
11
|
+
listKey: 'siteEntry',
|
|
12
|
+
},
|
|
13
|
+
get: { httpMethod: 'GET', pathTemplate: '/webmasters/v3/sites/{siteUrl}', scopes: W },
|
|
14
|
+
// PUT is idempotent add: the siteUrl is the whole resource, no body.
|
|
15
|
+
add: { httpMethod: 'PUT', pathTemplate: '/webmasters/v3/sites/{siteUrl}', scopes: W },
|
|
16
|
+
delete: { httpMethod: 'DELETE', pathTemplate: '/webmasters/v3/sites/{siteUrl}', scopes: W },
|
|
17
|
+
},
|
|
18
|
+
sitemaps: {
|
|
19
|
+
list: {
|
|
20
|
+
httpMethod: 'GET',
|
|
21
|
+
pathTemplate: '/webmasters/v3/sites/{siteUrl}/sitemaps',
|
|
22
|
+
scopes: W,
|
|
23
|
+
listKey: 'sitemap',
|
|
24
|
+
},
|
|
25
|
+
get: {
|
|
26
|
+
httpMethod: 'GET',
|
|
27
|
+
pathTemplate: '/webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
|
|
28
|
+
scopes: W,
|
|
29
|
+
},
|
|
30
|
+
submit: {
|
|
31
|
+
httpMethod: 'PUT',
|
|
32
|
+
pathTemplate: '/webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
|
|
33
|
+
scopes: W,
|
|
34
|
+
},
|
|
35
|
+
delete: {
|
|
36
|
+
httpMethod: 'DELETE',
|
|
37
|
+
pathTemplate: '/webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
|
|
38
|
+
scopes: W,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
searchanalytics: {
|
|
42
|
+
// POST with a body (dimensions, filters, date range). No listKey: searchAnalytics
|
|
43
|
+
// pages via body startRow/rowLimit, not a query pageToken — return the raw page.
|
|
44
|
+
query: {
|
|
45
|
+
httpMethod: 'POST',
|
|
46
|
+
pathTemplate: '/webmasters/v3/sites/{siteUrl}/searchAnalytics/query',
|
|
47
|
+
scopes: W,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
'url-inspection': {
|
|
51
|
+
// POST body carries inspectionUrl + siteUrl; returns a single inspectionResult.
|
|
52
|
+
inspect: { httpMethod: 'POST', pathTemplate: '/v1/urlInspection/index:inspect', scopes: W },
|
|
53
|
+
},
|
|
54
|
+
'url-testing-tools': {
|
|
55
|
+
// Public test (no OAuth scope in discovery); kept for 100% discovery coverage.
|
|
56
|
+
'mobile-friendly-test': {
|
|
57
|
+
httpMethod: 'POST',
|
|
58
|
+
pathTemplate: '/v1/urlTestingTools/mobileFriendlyTest:run',
|
|
59
|
+
scopes: [],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
const R = ['tagmanager.readonly'];
|
|
2
|
+
const E = ['tagmanager.edit.containers'];
|
|
3
|
+
const EV = ['tagmanager.edit.containerversions'];
|
|
4
|
+
const P = ['tagmanager.publish'];
|
|
5
|
+
const DC = ['tagmanager.delete.containers'];
|
|
6
|
+
const MA = ['tagmanager.manage.accounts'];
|
|
7
|
+
const MU = ['tagmanager.manage.users'];
|
|
8
|
+
// GTM nests accounts → containers → workspaces → entities.
|
|
9
|
+
const A = '/tagmanager/v2/accounts';
|
|
10
|
+
const C = `${A}/{account}/containers/{container}`;
|
|
11
|
+
const WS = `${C}/workspaces/{workspace}`;
|
|
12
|
+
// Full CRUD for a collection: list + item get/update/delete + create. `listKey`
|
|
13
|
+
// is both the response array key and the item path placeholder. `scopes` is the
|
|
14
|
+
// write scope (reads always take R).
|
|
15
|
+
const crud = (base, name, listKey, write = E) => ({
|
|
16
|
+
list: { httpMethod: 'GET', pathTemplate: `${base}/${name}`, scopes: R, listKey },
|
|
17
|
+
get: { httpMethod: 'GET', pathTemplate: `${base}/${name}/{${listKey}}`, scopes: R },
|
|
18
|
+
create: { httpMethod: 'POST', pathTemplate: `${base}/${name}`, scopes: write },
|
|
19
|
+
update: { httpMethod: 'PUT', pathTemplate: `${base}/${name}/{${listKey}}`, scopes: write },
|
|
20
|
+
delete: { httpMethod: 'DELETE', pathTemplate: `${base}/${name}/{${listKey}}`, scopes: write },
|
|
21
|
+
});
|
|
22
|
+
// Workspace entity = CRUD + a revert action on the item path.
|
|
23
|
+
const wsEntity = (name, listKey) => ({
|
|
24
|
+
...crud(WS, name, listKey),
|
|
25
|
+
revert: { httpMethod: 'POST', pathTemplate: `${WS}/${name}/{${listKey}}:revert`, scopes: E },
|
|
26
|
+
});
|
|
27
|
+
export default {
|
|
28
|
+
api: 'gtm',
|
|
29
|
+
baseUrl: 'https://tagmanager.googleapis.com',
|
|
30
|
+
resources: {
|
|
31
|
+
accounts: {
|
|
32
|
+
list: { httpMethod: 'GET', pathTemplate: A, scopes: R, listKey: 'account' },
|
|
33
|
+
get: { httpMethod: 'GET', pathTemplate: `${A}/{account}`, scopes: R },
|
|
34
|
+
update: { httpMethod: 'PUT', pathTemplate: `${A}/{account}`, scopes: MA },
|
|
35
|
+
},
|
|
36
|
+
'user-permissions': {
|
|
37
|
+
list: {
|
|
38
|
+
httpMethod: 'GET',
|
|
39
|
+
pathTemplate: `${A}/{account}/user_permissions`,
|
|
40
|
+
scopes: MU,
|
|
41
|
+
listKey: 'userPermission',
|
|
42
|
+
},
|
|
43
|
+
get: {
|
|
44
|
+
httpMethod: 'GET',
|
|
45
|
+
pathTemplate: `${A}/{account}/user_permissions/{userPermission}`,
|
|
46
|
+
scopes: MU,
|
|
47
|
+
},
|
|
48
|
+
create: { httpMethod: 'POST', pathTemplate: `${A}/{account}/user_permissions`, scopes: MU },
|
|
49
|
+
update: {
|
|
50
|
+
httpMethod: 'PUT',
|
|
51
|
+
pathTemplate: `${A}/{account}/user_permissions/{userPermission}`,
|
|
52
|
+
scopes: MU,
|
|
53
|
+
},
|
|
54
|
+
delete: {
|
|
55
|
+
httpMethod: 'DELETE',
|
|
56
|
+
pathTemplate: `${A}/{account}/user_permissions/{userPermission}`,
|
|
57
|
+
scopes: MU,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
containers: {
|
|
61
|
+
list: {
|
|
62
|
+
httpMethod: 'GET',
|
|
63
|
+
pathTemplate: `${A}/{account}/containers`,
|
|
64
|
+
scopes: R,
|
|
65
|
+
listKey: 'container',
|
|
66
|
+
},
|
|
67
|
+
get: { httpMethod: 'GET', pathTemplate: C, scopes: R },
|
|
68
|
+
create: { httpMethod: 'POST', pathTemplate: `${A}/{account}/containers`, scopes: E },
|
|
69
|
+
update: { httpMethod: 'PUT', pathTemplate: C, scopes: E },
|
|
70
|
+
delete: { httpMethod: 'DELETE', pathTemplate: C, scopes: DC },
|
|
71
|
+
// lookup is account-less: resolve a container by tagId or destinationId.
|
|
72
|
+
lookup: {
|
|
73
|
+
httpMethod: 'GET',
|
|
74
|
+
pathTemplate: `${A}/containers:lookup`,
|
|
75
|
+
scopes: R,
|
|
76
|
+
query: ['tagId', 'destinationId'],
|
|
77
|
+
},
|
|
78
|
+
snippet: { httpMethod: 'GET', pathTemplate: `${C}:snippet`, scopes: R },
|
|
79
|
+
},
|
|
80
|
+
destinations: {
|
|
81
|
+
// get + link are deprecated; only list is connected.
|
|
82
|
+
list: {
|
|
83
|
+
httpMethod: 'GET',
|
|
84
|
+
pathTemplate: `${C}/destinations`,
|
|
85
|
+
scopes: R,
|
|
86
|
+
listKey: 'destination',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
environments: {
|
|
90
|
+
...crud(C, 'environments', 'environment'),
|
|
91
|
+
reauthorize: {
|
|
92
|
+
httpMethod: 'POST',
|
|
93
|
+
pathTemplate: `${C}/environments/{environment}:reauthorize`,
|
|
94
|
+
scopes: P,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
versions: {
|
|
98
|
+
// No list/create: version_headers lists, workspaces create_version creates.
|
|
99
|
+
get: { httpMethod: 'GET', pathTemplate: `${C}/versions/{version}`, scopes: R },
|
|
100
|
+
live: { httpMethod: 'GET', pathTemplate: `${C}/versions:live`, scopes: R },
|
|
101
|
+
update: { httpMethod: 'PUT', pathTemplate: `${C}/versions/{version}`, scopes: EV },
|
|
102
|
+
delete: { httpMethod: 'DELETE', pathTemplate: `${C}/versions/{version}`, scopes: EV },
|
|
103
|
+
publish: { httpMethod: 'POST', pathTemplate: `${C}/versions/{version}:publish`, scopes: P },
|
|
104
|
+
'set-latest': {
|
|
105
|
+
httpMethod: 'POST',
|
|
106
|
+
pathTemplate: `${C}/versions/{version}:set_latest`,
|
|
107
|
+
scopes: E,
|
|
108
|
+
},
|
|
109
|
+
undelete: {
|
|
110
|
+
httpMethod: 'POST',
|
|
111
|
+
pathTemplate: `${C}/versions/{version}:undelete`,
|
|
112
|
+
scopes: EV,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
'version-headers': {
|
|
116
|
+
list: {
|
|
117
|
+
httpMethod: 'GET',
|
|
118
|
+
pathTemplate: `${C}/version_headers`,
|
|
119
|
+
scopes: R,
|
|
120
|
+
listKey: 'containerVersionHeader',
|
|
121
|
+
},
|
|
122
|
+
latest: { httpMethod: 'GET', pathTemplate: `${C}/version_headers:latest`, scopes: R },
|
|
123
|
+
},
|
|
124
|
+
workspaces: {
|
|
125
|
+
list: { httpMethod: 'GET', pathTemplate: `${C}/workspaces`, scopes: R, listKey: 'workspace' },
|
|
126
|
+
get: { httpMethod: 'GET', pathTemplate: WS, scopes: R },
|
|
127
|
+
create: { httpMethod: 'POST', pathTemplate: `${C}/workspaces`, scopes: E },
|
|
128
|
+
update: { httpMethod: 'PUT', pathTemplate: WS, scopes: E },
|
|
129
|
+
delete: { httpMethod: 'DELETE', pathTemplate: WS, scopes: DC },
|
|
130
|
+
status: { httpMethod: 'GET', pathTemplate: `${WS}/status`, scopes: R },
|
|
131
|
+
'create-version': { httpMethod: 'POST', pathTemplate: `${WS}:create_version`, scopes: EV },
|
|
132
|
+
'bulk-update': { httpMethod: 'POST', pathTemplate: `${WS}/bulk_update`, scopes: E },
|
|
133
|
+
'quick-preview': { httpMethod: 'POST', pathTemplate: `${WS}:quick_preview`, scopes: EV },
|
|
134
|
+
'resolve-conflict': { httpMethod: 'POST', pathTemplate: `${WS}:resolve_conflict`, scopes: E },
|
|
135
|
+
sync: { httpMethod: 'POST', pathTemplate: `${WS}:sync`, scopes: E },
|
|
136
|
+
},
|
|
137
|
+
'built-in-variables': {
|
|
138
|
+
// No get/update. Create/delete/revert act on the collection, keyed by
|
|
139
|
+
// ?type=. delete removes an enabled built-in by type.
|
|
140
|
+
list: {
|
|
141
|
+
httpMethod: 'GET',
|
|
142
|
+
pathTemplate: `${WS}/built_in_variables`,
|
|
143
|
+
scopes: R,
|
|
144
|
+
listKey: 'builtInVariable',
|
|
145
|
+
},
|
|
146
|
+
create: {
|
|
147
|
+
httpMethod: 'POST',
|
|
148
|
+
pathTemplate: `${WS}/built_in_variables`,
|
|
149
|
+
scopes: E,
|
|
150
|
+
query: ['type'],
|
|
151
|
+
},
|
|
152
|
+
delete: {
|
|
153
|
+
httpMethod: 'DELETE',
|
|
154
|
+
pathTemplate: `${WS}/built_in_variables`,
|
|
155
|
+
scopes: E,
|
|
156
|
+
query: ['type'],
|
|
157
|
+
},
|
|
158
|
+
revert: {
|
|
159
|
+
httpMethod: 'POST',
|
|
160
|
+
pathTemplate: `${WS}/built_in_variables:revert`,
|
|
161
|
+
scopes: E,
|
|
162
|
+
query: ['type'],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
folders: {
|
|
166
|
+
...crud(WS, 'folders', 'folder'),
|
|
167
|
+
revert: { httpMethod: 'POST', pathTemplate: `${WS}/folders/{folder}:revert`, scopes: E },
|
|
168
|
+
entities: { httpMethod: 'POST', pathTemplate: `${WS}/folders/{folder}:entities`, scopes: R },
|
|
169
|
+
'move-entities': {
|
|
170
|
+
httpMethod: 'POST',
|
|
171
|
+
pathTemplate: `${WS}/folders/{folder}:move_entities_to_folder`,
|
|
172
|
+
scopes: E,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
tags: wsEntity('tags', 'tag'),
|
|
176
|
+
triggers: wsEntity('triggers', 'trigger'),
|
|
177
|
+
variables: wsEntity('variables', 'variable'),
|
|
178
|
+
clients: wsEntity('clients', 'client'),
|
|
179
|
+
transformations: wsEntity('transformations', 'transformation'),
|
|
180
|
+
zones: wsEntity('zones', 'zone'),
|
|
181
|
+
templates: {
|
|
182
|
+
...wsEntity('templates', 'template'),
|
|
183
|
+
'import-from-gallery': {
|
|
184
|
+
httpMethod: 'POST',
|
|
185
|
+
pathTemplate: `${WS}/templates:import_from_gallery`,
|
|
186
|
+
scopes: E,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
// gtag_config has no revert action.
|
|
190
|
+
'gtag-config': crud(WS, 'gtag_config', 'gtagConfig'),
|
|
191
|
+
},
|
|
192
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const I = ['indexing'];
|
|
2
|
+
export default {
|
|
3
|
+
api: 'indexing',
|
|
4
|
+
baseUrl: 'https://indexing.googleapis.com',
|
|
5
|
+
resources: {
|
|
6
|
+
'url-notifications': {
|
|
7
|
+
// POST body: { url, type: URL_UPDATED | URL_DELETED }.
|
|
8
|
+
publish: { httpMethod: 'POST', pathTemplate: '/v3/urlNotifications:publish', scopes: I },
|
|
9
|
+
// GET ?url= ; the url is a trailing positional (query seam), not a path param.
|
|
10
|
+
'get-metadata': {
|
|
11
|
+
httpMethod: 'GET',
|
|
12
|
+
pathTemplate: '/v3/urlNotifications/metadata',
|
|
13
|
+
scopes: I,
|
|
14
|
+
query: ['url'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|