@maxim_mazurok/gapi.client.videointelligence-v1beta2 0.0.20220303
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 +1900 -0
- package/package.json +20 -0
- package/readme.md +73 -0
- package/tests.ts +106 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.videointelligence-v1beta2",
|
|
3
|
+
"version": "0.0.20220303",
|
|
4
|
+
"description": "TypeScript typings for Cloud Video Intelligence API v1beta2",
|
|
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,73 @@
|
|
|
1
|
+
# TypeScript typings for Cloud Video Intelligence API v1beta2
|
|
2
|
+
|
|
3
|
+
Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.
|
|
4
|
+
For detailed description please check [documentation](https://cloud.google.com/video-intelligence/docs/).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Cloud Video Intelligence API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.videointelligence-v1beta2 --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://videointelligence.googleapis.com/$discovery/rest?version=v1beta2', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.videointelligence
|
|
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('videointelligence', 'v1beta2', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.videointelligence
|
|
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
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
49
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
50
|
+
],
|
|
51
|
+
immediate = true;
|
|
52
|
+
// ...
|
|
53
|
+
|
|
54
|
+
gapi.auth.authorize(
|
|
55
|
+
{ client_id: client_id, scope: scope, immediate: immediate },
|
|
56
|
+
authResult => {
|
|
57
|
+
if (authResult && !authResult.error) {
|
|
58
|
+
/* handle successful authorization */
|
|
59
|
+
} else {
|
|
60
|
+
/* handle authorization error */
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After that you can use Cloud Video Intelligence API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
Performs asynchronous video annotation. Progress and results can be retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` (results).
|
|
71
|
+
*/
|
|
72
|
+
await gapi.client.videointelligence.videos.annotate({ });
|
|
73
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.videointelligence-v1beta2 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: 20220303
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://videointelligence.googleapis.com/$discovery/rest?version=v1beta2');
|
|
12
|
+
/** now we can use gapi.client.videointelligence */
|
|
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
|
+
/** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
|
|
19
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
20
|
+
];
|
|
21
|
+
const immediate = false;
|
|
22
|
+
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
|
23
|
+
if (authResult && !authResult.error) {
|
|
24
|
+
/** handle successful authorization */
|
|
25
|
+
run();
|
|
26
|
+
} else {
|
|
27
|
+
/** handle authorization error */
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
async function run() {
|
|
32
|
+
/**
|
|
33
|
+
* Performs asynchronous video annotation. Progress and results can be retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains
|
|
34
|
+
* `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` (results).
|
|
35
|
+
*/
|
|
36
|
+
await gapi.client.videointelligence.videos.annotate({
|
|
37
|
+
}, {
|
|
38
|
+
features: [
|
|
39
|
+
"Test string"
|
|
40
|
+
],
|
|
41
|
+
inputContent: "Test string",
|
|
42
|
+
inputUri: "Test string",
|
|
43
|
+
locationId: "Test string",
|
|
44
|
+
outputUri: "Test string",
|
|
45
|
+
videoContext: {
|
|
46
|
+
explicitContentDetectionConfig: {
|
|
47
|
+
model: "Test string",
|
|
48
|
+
},
|
|
49
|
+
faceDetectionConfig: {
|
|
50
|
+
includeAttributes: true,
|
|
51
|
+
includeBoundingBoxes: true,
|
|
52
|
+
model: "Test string",
|
|
53
|
+
},
|
|
54
|
+
labelDetectionConfig: {
|
|
55
|
+
frameConfidenceThreshold: 42,
|
|
56
|
+
labelDetectionMode: "Test string",
|
|
57
|
+
model: "Test string",
|
|
58
|
+
stationaryCamera: true,
|
|
59
|
+
videoConfidenceThreshold: 42,
|
|
60
|
+
},
|
|
61
|
+
objectTrackingConfig: {
|
|
62
|
+
model: "Test string",
|
|
63
|
+
},
|
|
64
|
+
personDetectionConfig: {
|
|
65
|
+
includeAttributes: true,
|
|
66
|
+
includeBoundingBoxes: true,
|
|
67
|
+
includePoseLandmarks: true,
|
|
68
|
+
},
|
|
69
|
+
segments: [
|
|
70
|
+
{
|
|
71
|
+
endTimeOffset: "Test string",
|
|
72
|
+
startTimeOffset: "Test string",
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
shotChangeDetectionConfig: {
|
|
76
|
+
model: "Test string",
|
|
77
|
+
},
|
|
78
|
+
speechTranscriptionConfig: {
|
|
79
|
+
audioTracks: [
|
|
80
|
+
42
|
|
81
|
+
],
|
|
82
|
+
diarizationSpeakerCount: 42,
|
|
83
|
+
enableAutomaticPunctuation: true,
|
|
84
|
+
enableSpeakerDiarization: true,
|
|
85
|
+
enableWordConfidence: true,
|
|
86
|
+
filterProfanity: true,
|
|
87
|
+
languageCode: "Test string",
|
|
88
|
+
maxAlternatives: 42,
|
|
89
|
+
speechContexts: [
|
|
90
|
+
{
|
|
91
|
+
phrases: [
|
|
92
|
+
"Test string"
|
|
93
|
+
],
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
textDetectionConfig: {
|
|
98
|
+
languageHints: [
|
|
99
|
+
"Test string"
|
|
100
|
+
],
|
|
101
|
+
model: "Test string",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
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
|
+
}
|