mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #48121 [gapi.client.analyticsreporting] automatic update by @google-api-typings-generator
Co-authored-by: Maxim Mazurok <maxim@mazurok.com>
This commit is contained in:
parent
47ae932cc5
commit
d233f6926d
@ -1,8 +1,11 @@
|
||||
/* This is stub file for gapi.client.{{=it.name}} definition tests */
|
||||
/* This is stub file for gapi.client.analyticsreporting definition tests */
|
||||
/* IMPORTANT.
|
||||
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
|
||||
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
|
||||
* This file was automatically generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
||||
* In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
||||
**/
|
||||
|
||||
// Revision: 20200922
|
||||
|
||||
gapi.load('client', () => {
|
||||
/** now we can use gapi.client */
|
||||
gapi.client.load('analyticsreporting', 'v4', () => {
|
||||
@ -17,21 +20,268 @@ gapi.load('client', () => {
|
||||
/** View your Google Analytics data */
|
||||
'https://www.googleapis.com/auth/analytics.readonly',
|
||||
];
|
||||
const immediate = true;
|
||||
const immediate = false;
|
||||
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
||||
if (authResult && !authResult.error) {
|
||||
/** handle succesfull authorization */
|
||||
/** handle successful authorization */
|
||||
run();
|
||||
} else {
|
||||
/** handle authorization error */
|
||||
}
|
||||
});
|
||||
run();
|
||||
});
|
||||
|
||||
async function run() {
|
||||
/** Returns the Analytics data. */
|
||||
await gapi.client.reports.batchGet({
|
||||
await gapi.client.analyticsreporting.reports.batchGet({
|
||||
}, {
|
||||
reportRequests: [
|
||||
{
|
||||
cohortGroup: {
|
||||
cohorts: [
|
||||
{
|
||||
dateRange: {
|
||||
endDate: "Test string",
|
||||
startDate: "Test string",
|
||||
},
|
||||
name: "Test string",
|
||||
type: "Test string",
|
||||
} ],
|
||||
lifetimeValue: true,
|
||||
},
|
||||
dateRanges: [
|
||||
{
|
||||
endDate: "Test string",
|
||||
startDate: "Test string",
|
||||
} ],
|
||||
dimensionFilterClauses: [
|
||||
{
|
||||
filters: [
|
||||
{
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
not: true,
|
||||
operator: "Test string",
|
||||
} ],
|
||||
operator: "Test string",
|
||||
} ],
|
||||
dimensions: [
|
||||
{
|
||||
histogramBuckets: [
|
||||
"Test string" ],
|
||||
name: "Test string",
|
||||
} ],
|
||||
filtersExpression: "Test string",
|
||||
hideTotals: true,
|
||||
hideValueRanges: true,
|
||||
includeEmptyRows: true,
|
||||
metricFilterClauses: [
|
||||
{
|
||||
filters: [
|
||||
{
|
||||
comparisonValue: "Test string",
|
||||
metricName: "Test string",
|
||||
not: true,
|
||||
operator: "Test string",
|
||||
} ],
|
||||
operator: "Test string",
|
||||
} ],
|
||||
metrics: [
|
||||
{
|
||||
alias: "Test string",
|
||||
expression: "Test string",
|
||||
formattingType: "Test string",
|
||||
} ],
|
||||
orderBys: [
|
||||
{
|
||||
fieldName: "Test string",
|
||||
orderType: "Test string",
|
||||
sortOrder: "Test string",
|
||||
} ],
|
||||
pageSize: 42,
|
||||
pageToken: "Test string",
|
||||
pivots: [
|
||||
{
|
||||
dimensionFilterClauses: [
|
||||
{
|
||||
filters: [
|
||||
{
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
not: true,
|
||||
operator: "Test string",
|
||||
} ],
|
||||
operator: "Test string",
|
||||
} ],
|
||||
dimensions: [
|
||||
{
|
||||
histogramBuckets: [
|
||||
"Test string" ],
|
||||
name: "Test string",
|
||||
} ],
|
||||
maxGroupCount: 42,
|
||||
metrics: [
|
||||
{
|
||||
alias: "Test string",
|
||||
expression: "Test string",
|
||||
formattingType: "Test string",
|
||||
} ],
|
||||
startGroup: 42,
|
||||
} ],
|
||||
samplingLevel: "Test string",
|
||||
segments: [
|
||||
{
|
||||
dynamicSegment: {
|
||||
name: "Test string",
|
||||
sessionSegment: {
|
||||
segmentFilters: [
|
||||
{
|
||||
not: true,
|
||||
sequenceSegment: {
|
||||
firstStepShouldMatchFirstHit: true,
|
||||
segmentSequenceSteps: [
|
||||
{
|
||||
matchType: "Test string",
|
||||
orFiltersForSegment: [
|
||||
{
|
||||
segmentFilterClauses: [
|
||||
{
|
||||
dimensionFilter: {
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
maxComparisonValue: "Test string",
|
||||
minComparisonValue: "Test string",
|
||||
operator: "Test string",
|
||||
},
|
||||
metricFilter: {
|
||||
comparisonValue: "Test string",
|
||||
maxComparisonValue: "Test string",
|
||||
metricName: "Test string",
|
||||
operator: "Test string",
|
||||
scope: "Test string",
|
||||
},
|
||||
not: true,
|
||||
} ],
|
||||
} ],
|
||||
} ],
|
||||
},
|
||||
simpleSegment: {
|
||||
orFiltersForSegment: [
|
||||
{
|
||||
segmentFilterClauses: [
|
||||
{
|
||||
dimensionFilter: {
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
maxComparisonValue: "Test string",
|
||||
minComparisonValue: "Test string",
|
||||
operator: "Test string",
|
||||
},
|
||||
metricFilter: {
|
||||
comparisonValue: "Test string",
|
||||
maxComparisonValue: "Test string",
|
||||
metricName: "Test string",
|
||||
operator: "Test string",
|
||||
scope: "Test string",
|
||||
},
|
||||
not: true,
|
||||
} ],
|
||||
} ],
|
||||
},
|
||||
} ],
|
||||
},
|
||||
userSegment: {
|
||||
segmentFilters: [
|
||||
{
|
||||
not: true,
|
||||
sequenceSegment: {
|
||||
firstStepShouldMatchFirstHit: true,
|
||||
segmentSequenceSteps: [
|
||||
{
|
||||
matchType: "Test string",
|
||||
orFiltersForSegment: [
|
||||
{
|
||||
segmentFilterClauses: [
|
||||
{
|
||||
dimensionFilter: {
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
maxComparisonValue: "Test string",
|
||||
minComparisonValue: "Test string",
|
||||
operator: "Test string",
|
||||
},
|
||||
metricFilter: {
|
||||
comparisonValue: "Test string",
|
||||
maxComparisonValue: "Test string",
|
||||
metricName: "Test string",
|
||||
operator: "Test string",
|
||||
scope: "Test string",
|
||||
},
|
||||
not: true,
|
||||
} ],
|
||||
} ],
|
||||
} ],
|
||||
},
|
||||
simpleSegment: {
|
||||
orFiltersForSegment: [
|
||||
{
|
||||
segmentFilterClauses: [
|
||||
{
|
||||
dimensionFilter: {
|
||||
caseSensitive: true,
|
||||
dimensionName: "Test string",
|
||||
expressions: [
|
||||
"Test string" ],
|
||||
maxComparisonValue: "Test string",
|
||||
minComparisonValue: "Test string",
|
||||
operator: "Test string",
|
||||
},
|
||||
metricFilter: {
|
||||
comparisonValue: "Test string",
|
||||
maxComparisonValue: "Test string",
|
||||
metricName: "Test string",
|
||||
operator: "Test string",
|
||||
scope: "Test string",
|
||||
},
|
||||
not: true,
|
||||
} ],
|
||||
} ],
|
||||
},
|
||||
} ],
|
||||
},
|
||||
},
|
||||
segmentId: "Test string",
|
||||
} ],
|
||||
viewId: "Test string",
|
||||
} ],
|
||||
useResourceQuotas: true,
|
||||
});
|
||||
/** Returns User Activity data. */
|
||||
await gapi.client.analyticsreporting.userActivity.search({
|
||||
}, {
|
||||
activityTypes: [
|
||||
"Test string" ],
|
||||
dateRange: {
|
||||
endDate: "Test string",
|
||||
startDate: "Test string",
|
||||
},
|
||||
pageSize: 42,
|
||||
pageToken: "Test string",
|
||||
user: {
|
||||
type: "Test string",
|
||||
userId: "Test string",
|
||||
},
|
||||
viewId: "Test string",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
803
types/gapi.client.analyticsreporting/index.d.ts
vendored
803
types/gapi.client.analyticsreporting/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,12 @@
|
||||
# TypeScript typings for Google Analytics Reporting API v4
|
||||
# TypeScript typings for Analytics Reporting API v4
|
||||
|
||||
Accesses Analytics report data.
|
||||
For detailed description please check [documentation](https://developers.google.com/analytics/devguides/reporting/core/v4/).
|
||||
|
||||
## Installing
|
||||
|
||||
Install typings for Google Analytics Reporting API:
|
||||
Install typings for Analytics Reporting API:
|
||||
|
||||
```
|
||||
npm install @types/gapi.client.analyticsreporting@v4 --save-dev
|
||||
```
|
||||
@ -12,51 +14,60 @@ npm install @types/gapi.client.analyticsreporting@v4 --save-dev
|
||||
## Usage
|
||||
|
||||
You need to initialize Google API client in your code:
|
||||
|
||||
```typescript
|
||||
gapi.load("client", () => {
|
||||
// now we can use gapi.client
|
||||
// ...
|
||||
gapi.load('client', () => {
|
||||
// now we can use gapi.client
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Then load api client wrapper:
|
||||
|
||||
```typescript
|
||||
gapi.client.load('analyticsreporting', 'v4', () => {
|
||||
// now we can use gapi.client.analyticsreporting
|
||||
// ...
|
||||
// now we can use gapi.client.analyticsreporting
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
Don't forget to authenticate your client before sending any request to resources:
|
||||
```typescript
|
||||
|
||||
```typescript
|
||||
// declare client_id registered in Google Developers Console
|
||||
var client_id = '',
|
||||
scope = [
|
||||
// View and manage your Google Analytics data
|
||||
'https://www.googleapis.com/auth/analytics',
|
||||
|
||||
// View your Google Analytics data
|
||||
'https://www.googleapis.com/auth/analytics.readonly',
|
||||
scope = [
|
||||
// View and manage your Google Analytics data
|
||||
'https://www.googleapis.com/auth/analytics',
|
||||
|
||||
// View your Google Analytics data
|
||||
'https://www.googleapis.com/auth/analytics.readonly',
|
||||
],
|
||||
immediate = true;
|
||||
// ...
|
||||
|
||||
gapi.auth.authorize({ client_id: client_id, scope: scope, immediate: immediate }, authResult => {
|
||||
gapi.auth.authorize(
|
||||
{ client_id: client_id, scope: scope, immediate: immediate },
|
||||
authResult => {
|
||||
if (authResult && !authResult.error) {
|
||||
/* handle succesfull authorization */
|
||||
/* handle successful authorization */
|
||||
} else {
|
||||
/* handle authorization error */
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
After that you can use Google Analytics Reporting API resources:
|
||||
After that you can use Analytics Reporting API resources:
|
||||
|
||||
```typescript
|
||||
|
||||
/*
|
||||
Returns the Analytics data.
|
||||
```typescript
|
||||
|
||||
/*
|
||||
Returns the Analytics data.
|
||||
*/
|
||||
await gapi.client.reports.batchGet({ });
|
||||
```
|
||||
await gapi.client.analyticsreporting.reports.batchGet({ });
|
||||
|
||||
/*
|
||||
Returns User Activity data.
|
||||
*/
|
||||
await gapi.client.analyticsreporting.userActivity.search({ });
|
||||
```
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@ -17,8 +14,5 @@
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gapi.client.analyticsreporting-tests.ts"
|
||||
]
|
||||
"files": ["index.d.ts", "gapi.client.analyticsreporting-tests.ts"]
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"await-promise": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user