@maxim_mazurok/gapi.client.analyticsadmin-v1alpha 0.0.20220810

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/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.analyticsadmin-v1alpha",
3
+ "version": "0.0.20220810",
4
+ "description": "TypeScript typings for Google Analytics Admin API v1alpha",
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,182 @@
1
+ # TypeScript typings for Google Analytics Admin API v1alpha
2
+
3
+
4
+ For detailed description please check [documentation](http://code.google.com/apis/analytics/docs/mgmt/home.html).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Analytics Admin API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.analyticsadmin-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('https://analyticsadmin.googleapis.com/$discovery/rest?version=v1alpha', () => {
29
+ // now we can use:
30
+ // gapi.client.analyticsadmin
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('analyticsadmin', 'v1alpha', () => {
37
+ // now we can use:
38
+ // gapi.client.analyticsadmin
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
+ // Edit Google Analytics management entities
49
+ 'https://www.googleapis.com/auth/analytics.edit',
50
+
51
+ // Manage Google Analytics Account users by email address
52
+ 'https://www.googleapis.com/auth/analytics.manage.users',
53
+
54
+ // View Google Analytics user permissions
55
+ 'https://www.googleapis.com/auth/analytics.manage.users.readonly',
56
+
57
+ // See and download your Google Analytics data
58
+ 'https://www.googleapis.com/auth/analytics.readonly',
59
+ ],
60
+ immediate = true;
61
+ // ...
62
+
63
+ gapi.auth.authorize(
64
+ { client_id: client_id, scope: scope, immediate: immediate },
65
+ authResult => {
66
+ if (authResult && !authResult.error) {
67
+ /* handle successful authorization */
68
+ } else {
69
+ /* handle authorization error */
70
+ }
71
+ });
72
+ ```
73
+
74
+ After that you can use Google Analytics Admin API resources: <!-- TODO: make this work for multiple namespaces -->
75
+
76
+ ```typescript
77
+
78
+ /*
79
+ Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.
80
+ */
81
+ await gapi.client.analyticsadmin.accounts.delete({ name: "name", });
82
+
83
+ /*
84
+ Lookup for a single Account.
85
+ */
86
+ await gapi.client.analyticsadmin.accounts.get({ name: "name", });
87
+
88
+ /*
89
+ Get data sharing settings on an account. Data sharing settings are singletons.
90
+ */
91
+ await gapi.client.analyticsadmin.accounts.getDataSharingSettings({ name: "name", });
92
+
93
+ /*
94
+ Returns all accounts accessible by the caller. Note that these accounts might not currently have GA4 properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.
95
+ */
96
+ await gapi.client.analyticsadmin.accounts.list({ });
97
+
98
+ /*
99
+ Updates an account.
100
+ */
101
+ await gapi.client.analyticsadmin.accounts.patch({ name: "name", });
102
+
103
+ /*
104
+ Requests a ticket for creating an account.
105
+ */
106
+ await gapi.client.analyticsadmin.accounts.provisionAccountTicket({ });
107
+
108
+ /*
109
+ Searches through all changes to an account or its children given the specified set of filters.
110
+ */
111
+ await gapi.client.analyticsadmin.accounts.searchChangeHistoryEvents({ account: "account", });
112
+
113
+ /*
114
+ Returns summaries of all accounts accessible by the caller.
115
+ */
116
+ await gapi.client.analyticsadmin.accountSummaries.list({ });
117
+
118
+ /*
119
+ Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or via this API) before MeasurementProtocolSecret resources may be created.
120
+ */
121
+ await gapi.client.analyticsadmin.properties.acknowledgeUserDataCollection({ property: "property", });
122
+
123
+ /*
124
+ Creates an "GA4" property with the specified location and attributes.
125
+ */
126
+ await gapi.client.analyticsadmin.properties.create({ });
127
+
128
+ /*
129
+ Marks target Property as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI. If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not an GA4 Property.
130
+ */
131
+ await gapi.client.analyticsadmin.properties.delete({ name: "name", });
132
+
133
+ /*
134
+ Lookup for a single "GA4" Property.
135
+ */
136
+ await gapi.client.analyticsadmin.properties.get({ name: "name", });
137
+
138
+ /*
139
+ Lookup for a AttributionSettings singleton.
140
+ */
141
+ await gapi.client.analyticsadmin.properties.getAttributionSettings({ name: "name", });
142
+
143
+ /*
144
+ Returns the singleton data retention settings for this property.
145
+ */
146
+ await gapi.client.analyticsadmin.properties.getDataRetentionSettings({ name: "name", });
147
+
148
+ /*
149
+ Lookup for Google Signals settings for a property.
150
+ */
151
+ await gapi.client.analyticsadmin.properties.getGoogleSignalsSettings({ name: "name", });
152
+
153
+ /*
154
+ Returns child Properties under the specified parent Account. Only "GA4" properties will be returned. Properties will be excluded if the caller does not have access. Soft-deleted (ie: "trashed") properties are excluded by default. Returns an empty list if no relevant properties are found.
155
+ */
156
+ await gapi.client.analyticsadmin.properties.list({ });
157
+
158
+ /*
159
+ Updates a property.
160
+ */
161
+ await gapi.client.analyticsadmin.properties.patch({ name: "name", });
162
+
163
+ /*
164
+ Returns a customized report of data access records. The report provides records of each time a user reads Google Analytics reporting data. Access records are retained for up to 2 years. Data Access Reports can be requested for a property. The property must be in Google Analytics 360. This method is only available to Administrators. These data access records include GA4 UI Reporting, GA4 UI Explorations, GA4 Data API, and other products like Firebase & Admob that can retrieve data from Google Analytics through a linkage. These records don't include property configuration changes like adding a stream or changing a property's time zone. For configuration change history, see [searchChangeHistoryEvents](https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents).
165
+ */
166
+ await gapi.client.analyticsadmin.properties.runAccessReport({ entity: "entity", });
167
+
168
+ /*
169
+ Updates attribution settings on a property.
170
+ */
171
+ await gapi.client.analyticsadmin.properties.updateAttributionSettings({ name: "name", });
172
+
173
+ /*
174
+ Updates the singleton data retention settings for this property.
175
+ */
176
+ await gapi.client.analyticsadmin.properties.updateDataRetentionSettings({ name: "name", });
177
+
178
+ /*
179
+ Updates Google Signals settings for a property.
180
+ */
181
+ await gapi.client.analyticsadmin.properties.updateGoogleSignalsSettings({ name: "name", });
182
+ ```