express-sweet 1.0.19 → 1.0.22
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/CHANGELOG.md +132 -1
- package/dist/build.common.js +4 -4
- package/dist/build.esm.js +5 -5
- package/docs/index.html +403 -115
- package/package.json +2 -2
- package/types/database/Model.d.ts +1 -1
- package/types/interfaces/AuthenticationOptions.d.ts +0 -1
- package/types/interfaces/BoundingBox.d.ts +1 -1
- package/types/interfaces/FaceDetailsEmotions.d.ts +40 -0
- package/types/interfaces/ViewOptions.d.ts +14 -0
- package/types/services/AWSRekognitionClient.d.ts +25 -254
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-sweet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Extend Express functionality with Express Sweet and start developing fast, minimal web applications.",
|
|
5
5
|
"main": "dist/build.common.js",
|
|
6
6
|
"module": "dist/build.esm.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://github.com/takuya-motoshima/express-sweet#readme",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"aws-sdk": "^2.
|
|
67
|
+
"aws-sdk": "^2.1142.0",
|
|
68
68
|
"body-parser": "^1.19.0",
|
|
69
69
|
"class-transformer": "^0.2.3",
|
|
70
70
|
"class-validator": "^0.12.2",
|
|
@@ -162,7 +162,7 @@ export default class Model extends sequelize.Model {
|
|
|
162
162
|
* transaction = await BookModel.begin();
|
|
163
163
|
* const book = await BookModel.create({title: 'When Im Gone'}, {transaction});
|
|
164
164
|
* await transaction.commit();
|
|
165
|
-
* } catch
|
|
165
|
+
* } catch {
|
|
166
166
|
* if (transaction)
|
|
167
167
|
* await transaction.rollback();
|
|
168
168
|
* }
|
|
@@ -70,7 +70,6 @@ export default interface {
|
|
|
70
70
|
* The returned data will be set in the req.user property and the view's session variable.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
|
-
*
|
|
74
73
|
* subscribe_user: async (id) => {
|
|
75
74
|
* const UserModel = require('../models/UserModel');
|
|
76
75
|
* return UserModel.findOne({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The emotions that appear to be expressed on the face, and the confidence level in the determination.
|
|
3
|
+
*/
|
|
4
|
+
export default interface {
|
|
5
|
+
/**
|
|
6
|
+
* Confidence level of "disgusted" predicted from the face.
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
disgusted: number;
|
|
10
|
+
/**
|
|
11
|
+
* Confidence level of "happy" predicted from the face.
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
happy: number;
|
|
15
|
+
/**
|
|
16
|
+
* Confidence level of "surprised" predicted from the face.
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
surprised: number;
|
|
20
|
+
/**
|
|
21
|
+
* Confidence level of "angry" predicted from the face.
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
angry: number;
|
|
25
|
+
/**
|
|
26
|
+
* Confidence level of "confused" predicted from the face.
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
confused: number;
|
|
30
|
+
/**
|
|
31
|
+
* Confidence level of "calm" predicted from the face.
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
calm: number;
|
|
35
|
+
/**
|
|
36
|
+
* Confidence level of "sad" predicted from the face.
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
sad: number;
|
|
40
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import express from 'express';
|
|
1
2
|
/**
|
|
2
3
|
* View's configuration interface.
|
|
3
4
|
*/
|
|
@@ -27,4 +28,17 @@ export default interface {
|
|
|
27
28
|
* @type {string}
|
|
28
29
|
*/
|
|
29
30
|
extension?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Hook function just before the view is rendered.
|
|
33
|
+
* For example, you can set your own local variables that can be used within the view.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // The message set here can be referenced in the view as {{message}}.
|
|
37
|
+
* beforeRender: res => {
|
|
38
|
+
* res.loclas.message = 'Hello World';
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* @type {(res: express.Response) => void}
|
|
42
|
+
*/
|
|
43
|
+
beforeRender?: (res: express.Response) => void;
|
|
30
44
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import RekognitionOptions from '~/interfaces/RekognitionOptions';
|
|
2
2
|
import FaceMatch from '~/interfaces/FaceMatch';
|
|
3
3
|
import BoundingBox from '~/interfaces/BoundingBox';
|
|
4
|
+
import FaceDetails from '~/interfaces/FaceDetails';
|
|
5
|
+
import IndexFaceDetails from '~/interfaces/IndexFaceDetails';
|
|
4
6
|
/**
|
|
5
7
|
* AWS Rekognition Client.
|
|
6
8
|
*/
|
|
7
9
|
export default class {
|
|
8
10
|
/**
|
|
9
|
-
* Rekognition
|
|
11
|
+
* Rekognition Client.
|
|
10
12
|
* @type {AWS.Rekognition}
|
|
11
13
|
*/
|
|
12
14
|
private client;
|
|
@@ -18,63 +20,18 @@ export default class {
|
|
|
18
20
|
* Detects faces within an image that is provided as input.
|
|
19
21
|
* For each face detected, the operation returns a bounding box of the face.
|
|
20
22
|
*
|
|
21
|
-
* @example
|
|
22
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
23
|
-
* const fs = require('fs');
|
|
24
|
-
*
|
|
25
|
-
* // Instantiate Rekognition client.
|
|
26
|
-
* const client = new AWSRekognitionClient({
|
|
27
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
28
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
29
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* // Detect faces from path.
|
|
33
|
-
* // Output: [
|
|
34
|
-
* // {
|
|
35
|
-
* // width: 0.5004957914352417,
|
|
36
|
-
* // height: 0.6926820874214172,
|
|
37
|
-
* // left: 0.2928674817085266,
|
|
38
|
-
* // top: 0.09095800668001175
|
|
39
|
-
* // }
|
|
40
|
-
* // ]
|
|
41
|
-
* await client.detectFaces('img.jpg');
|
|
42
|
-
*
|
|
43
|
-
* // Detect faces from data URL.
|
|
44
|
-
* await client.detectFaces('data:image/png;base64,/9j/4...');
|
|
45
|
-
*
|
|
46
|
-
* // Detect faces from buffer.
|
|
47
|
-
* await client.detectFaces(fs.readFileSync('img.jpg'));
|
|
48
|
-
*
|
|
49
23
|
* @param {string} img Image path or Data Url or image buffer.
|
|
50
24
|
* @param {number} minConfidence The minimum confidence of the detected face.
|
|
51
25
|
* Faces with a confidence lower than this value will not be returned as a result.
|
|
52
|
-
* @
|
|
26
|
+
* @param {boolean} withDetails If false, returns only the face bounding box.
|
|
27
|
+
* When true, returns the age group, gender, and emotion in addition to the face bounding box.
|
|
28
|
+
*
|
|
29
|
+
* @return {Promise<BoundingBox[]|FaceDetails[]>}
|
|
53
30
|
*/
|
|
54
|
-
detectFaces(img: string, minConfidence?: number): Promise<BoundingBox[]>;
|
|
31
|
+
detectFaces(img: string, minConfidence?: number, withDetails?: boolean): Promise<BoundingBox[] | FaceDetails[]>;
|
|
55
32
|
/**
|
|
56
33
|
* Compare the similarity of two faces.
|
|
57
34
|
*
|
|
58
|
-
* @example
|
|
59
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
60
|
-
* const fs = require('fs');
|
|
61
|
-
*
|
|
62
|
-
* // Instantiate Rekognition client.
|
|
63
|
-
* const client = new AWSRekognitionClient({
|
|
64
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
65
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
66
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
67
|
-
* });
|
|
68
|
-
*
|
|
69
|
-
* // Compare faces from path.
|
|
70
|
-
* await client.compareFaces('img1.jpg', 'img2.jpg');
|
|
71
|
-
*
|
|
72
|
-
* // Compare faces from data URL.
|
|
73
|
-
* await client.compareFaces('data:image/png;base64,/9j/4...', 'data:image/png;base64,/9j/4...');
|
|
74
|
-
*
|
|
75
|
-
* // Compare faces from buffer.
|
|
76
|
-
* await client.compareFaces(fs.readFileSync('img1.jpg'), fs.readFileSync('img1.jpg'));
|
|
77
|
-
*
|
|
78
35
|
* @param {string} img1 Image path or Data Url or image buffer.
|
|
79
36
|
* @param {string} img2 Image path or Data Url or image buffer.
|
|
80
37
|
* @return {Promise<number>} Level of confidence that the faces match.
|
|
@@ -87,26 +44,6 @@ export default class {
|
|
|
87
44
|
* Then, a user can search the collection for faces in the user-specific container.
|
|
88
45
|
* Note that Collection names are case-sensitive.
|
|
89
46
|
*
|
|
90
|
-
* @example
|
|
91
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
92
|
-
*
|
|
93
|
-
* // Instantiate Rekognition client.
|
|
94
|
-
* const client = new AWSRekognitionClient({
|
|
95
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
96
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
97
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
98
|
-
* });
|
|
99
|
-
*
|
|
100
|
-
* try {
|
|
101
|
-
* // Creates a collection.
|
|
102
|
-
* await client.createCollection('MyCollection');
|
|
103
|
-
* } catch(err) {
|
|
104
|
-
* // You can get the resulting HTTP status code from the exception.
|
|
105
|
-
* console.log(`name: ${err.name}`);
|
|
106
|
-
* console.log(`statusCode: ${err.statusCode}`);
|
|
107
|
-
* console.log(`message: ${err.message}`);
|
|
108
|
-
* }
|
|
109
|
-
*
|
|
110
47
|
* @param {string} collectionId ID for the collection that you are creating.
|
|
111
48
|
* The maximum length is 255, and the characters that can be used are "[a-zA-Z0-9_.\-]+".
|
|
112
49
|
*/
|
|
@@ -114,148 +51,34 @@ export default class {
|
|
|
114
51
|
/**
|
|
115
52
|
* Returns list of collection IDs.
|
|
116
53
|
*
|
|
117
|
-
* @example
|
|
118
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
119
|
-
*
|
|
120
|
-
* // Instantiate Rekognition client.
|
|
121
|
-
* const client = new AWSRekognitionClient({
|
|
122
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
123
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
124
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
125
|
-
* });
|
|
126
|
-
*
|
|
127
|
-
* // Find the collection IDs.
|
|
128
|
-
* // Output: [
|
|
129
|
-
* // 'MyCollection',
|
|
130
|
-
* // 'AnotherCollection'
|
|
131
|
-
* // ]
|
|
132
|
-
* await client.listCollections();
|
|
133
|
-
*
|
|
134
54
|
* @return {Promise<string[]>} An array of collection IDs.
|
|
135
55
|
*/
|
|
136
56
|
listCollections(): Promise<string[]>;
|
|
137
57
|
/**
|
|
138
58
|
* Detects one face in the input image and adds it to the specified collection.
|
|
139
|
-
* This method doesn't save the actual faces that are detected.
|
|
140
|
-
* Instead, the underlying detection algorithm first detects the faces in the input image.
|
|
141
|
-
* The algorithm extracts facial features into a feature vector, and stores it in the backend database.
|
|
142
|
-
*
|
|
143
59
|
* Note that this method is used to index one face.
|
|
144
60
|
* Throws an exception if no face is found in the input image or multiple faces are found.
|
|
145
61
|
*
|
|
146
|
-
* @
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* }
|
|
156
|
-
*
|
|
157
|
-
* // Add face to collection from path.
|
|
158
|
-
* // Output: df8adc94-e888-4442-a03d-42aacd4a6cee
|
|
159
|
-
* const faceId = await client.indexFace('MyCollection', 'img.jpg', 'img.jpg');
|
|
160
|
-
* console.log(faceId);
|
|
161
|
-
*
|
|
162
|
-
* // Add face to collection from data URL.
|
|
163
|
-
* // Output: df8adc94-e888-4442-a03d-42aacd4a6cee
|
|
164
|
-
* const faceId = await client.indexFace('MyCollection', 'data:image/png;base64,/9j/4...', 'img.jpg');
|
|
165
|
-
* console.log(faceId);
|
|
166
|
-
*
|
|
167
|
-
* // Add face to collection from buffer.
|
|
168
|
-
* // Output: df8adc94-e888-4442-a03d-42aacd4a6cee
|
|
169
|
-
* const faceId = await client.indexFace('MyCollection', fs.readFileSync('img.jpg'), 'img.jpg');
|
|
170
|
-
* console.log(faceId);
|
|
171
|
-
*
|
|
172
|
-
* // If the face is not found in the image, throw an error.
|
|
173
|
-
* // Output: name: IndexFaceFaceNotFound
|
|
174
|
-
* // statusCode: 400
|
|
175
|
-
* // message: No face was found in the image
|
|
176
|
-
* try {
|
|
177
|
-
* await client.indexFace('MyCollection', 'img.jpg');
|
|
178
|
-
* } catch(err) {
|
|
179
|
-
* // You can get the resulting HTTP status code from the exception.
|
|
180
|
-
* console.log(`name: ${err.name}`);
|
|
181
|
-
* console.log(`statusCode: ${err.statusCode}`);
|
|
182
|
-
* console.log(`message: ${err.message}`);
|
|
183
|
-
* }
|
|
184
|
-
*
|
|
185
|
-
* // If multiple faces are found in the image, throw an error.
|
|
186
|
-
* // Output: name: IndexFaceMultipleFacesFound
|
|
187
|
-
* // statusCode: 400
|
|
188
|
-
* // message: Multiple faces found in the image
|
|
189
|
-
* try {
|
|
190
|
-
* await client.indexFace('MyCollection', 'img.jpg');
|
|
191
|
-
* } catch(err) {
|
|
192
|
-
* // You can get the resulting HTTP status code from the exception.
|
|
193
|
-
* console.log(`name: ${err.name}`);
|
|
194
|
-
* console.log(`statusCode: ${err.statusCode}`);
|
|
195
|
-
* console.log(`message: ${err.message}`);
|
|
196
|
-
* }
|
|
197
|
-
*
|
|
198
|
-
* @param {string} collectionId The ID of an existing collection to which you want to add the faces that are detected in the input images.
|
|
199
|
-
* @param {string} img Image path or Data Url or image buffer.
|
|
200
|
-
* @param {string} externalImageId The ID you want to assign to the faces detected in the image.
|
|
201
|
-
* When you call the "listFaces" operation, the response returns the external ID.
|
|
202
|
-
* You can use this external image ID to create a client-side index to associate the faces with each image.
|
|
203
|
-
* You can then use the index to find all faces in an image.
|
|
204
|
-
* The maximum length is 255, and the characters that can be used are "[a-zA-Z0-9_.\-:]+".
|
|
205
|
-
* @return {Promise<string>} A unique identifier assigned to the face.
|
|
62
|
+
* @param {string} collectionId The ID of an existing collection to which you want to add the faces that are detected in the input images.
|
|
63
|
+
* @param {string} img Image path or Data Url or image buffer.
|
|
64
|
+
* @param {string|undefined} options.externalImageId The ID you want to assign to the faces detected in the image.
|
|
65
|
+
* When you call the "listFaces" operation, the response returns the external ID.
|
|
66
|
+
* You can use this external image ID to create a client-side index to associate the faces with each image.
|
|
67
|
+
* You can then use the index to find all faces in an image.
|
|
68
|
+
* The maximum length is 255, and the characters that can be used are "[a-zA-Z0-9_.\-:]+".
|
|
69
|
+
* @param {boolean} options.returnDetails If false, only the face ID of the created face is returned.
|
|
70
|
+
* If true, returns the face ID of the created face, plus age range, gender, and emotion.
|
|
71
|
+
* @return {Promise<string|IndexFaceDetails>} If options.returnDetails is false, the face identifier is returned.
|
|
72
|
+
* If options.returnDetails is true, returns the gender, age group, and emotion in addition to the face identifier.
|
|
206
73
|
*/
|
|
207
|
-
indexFace(collectionId: string, img: string,
|
|
74
|
+
indexFace(collectionId: string, img: string, options?: {
|
|
75
|
+
externalImageId?: string;
|
|
76
|
+
returnDetails?: boolean;
|
|
77
|
+
}): Promise<string | IndexFaceDetails>;
|
|
208
78
|
/**
|
|
209
79
|
* For a given input image, first detects the largest face in the image, and then searches the specified collection for matching faces.
|
|
210
80
|
* The operation compares the features of the input face with faces in the specified collection.
|
|
211
81
|
*
|
|
212
|
-
* @example
|
|
213
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
214
|
-
* const fs = require('fs');
|
|
215
|
-
*
|
|
216
|
-
* // Instantiate Rekognition client.
|
|
217
|
-
* const client = new AWSRekognitionClient({
|
|
218
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
219
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
220
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
221
|
-
* });
|
|
222
|
-
*
|
|
223
|
-
* // If you want to search for one face, specify 1 for the maxFaces option.
|
|
224
|
-
* // In that case, the search result will return the face data for one person.
|
|
225
|
-
* // Output: {
|
|
226
|
-
* // faceId: '2ce7f471-9c4b-4f27-b5a4-bbd02a5e134d',
|
|
227
|
-
* // boundingBox: {
|
|
228
|
-
* // width: 0.500495970249176,
|
|
229
|
-
* // height: 0.6926820278167725,
|
|
230
|
-
* // left: 0.2928670048713684,
|
|
231
|
-
* // top: 0.09095799922943115
|
|
232
|
-
* // },
|
|
233
|
-
* // externalImageId: 'img.jpg'
|
|
234
|
-
* // }
|
|
235
|
-
* const match = await client.searchFaces('MyCollection', 'img.jpg', {minConfidence: 99, maxFaces: 1});
|
|
236
|
-
* console.log(match);
|
|
237
|
-
*
|
|
238
|
-
* // If you want to search for multiple faces, specify 2 or more for the maxFaces option.
|
|
239
|
-
* // In that case, the search results will return a list of the face data of multiple people found.
|
|
240
|
-
* // Output: [
|
|
241
|
-
* // {
|
|
242
|
-
* // faceId: '2ce7f471-9c4b-4f27-b5a4-bbd02a5e134d',
|
|
243
|
-
* // boundingBox: {
|
|
244
|
-
* // width: 0.500495970249176,
|
|
245
|
-
* // height: 0.6926820278167725,
|
|
246
|
-
* // left: 0.2928670048713684,
|
|
247
|
-
* // top: 0.09095799922943115
|
|
248
|
-
* // },
|
|
249
|
-
* // externalImageId: 'img.jpg'
|
|
250
|
-
* // }
|
|
251
|
-
* // ]
|
|
252
|
-
* const matches = await client.searchFaces('MyCollection', 'img.jpg', {minConfidence: 99, maxFaces: 5});
|
|
253
|
-
* console.log(matches);
|
|
254
|
-
*
|
|
255
|
-
* // The input image can specify a buffer or DataURL in addition to the image path.
|
|
256
|
-
* await client.searchFaces('MyCollection', 'data:image/png;base64,/9j/4...');
|
|
257
|
-
* await client.searchFaces('MyCollection', fs.readFileSync('img.jpg'));
|
|
258
|
-
*
|
|
259
82
|
* @param {string} collectionId ID of the collection to search.
|
|
260
83
|
* @param {string} img Image path or Data Url or image buffer.
|
|
261
84
|
* @param {object} options option.
|
|
@@ -276,33 +99,6 @@ export default class {
|
|
|
276
99
|
* Returns metadata for faces in the specified collection.
|
|
277
100
|
* This metadata includes information such as the bounding box coordinates, and face ID.
|
|
278
101
|
*
|
|
279
|
-
* @example
|
|
280
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
281
|
-
* const fs = require('fs');
|
|
282
|
-
*
|
|
283
|
-
* // Instantiate Rekognition client.
|
|
284
|
-
* const client = new AWSRekognitionClient({
|
|
285
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
286
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
287
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
288
|
-
* });
|
|
289
|
-
*
|
|
290
|
-
* // Find all face metadata in the collection.
|
|
291
|
-
* // Output: [
|
|
292
|
-
* // {
|
|
293
|
-
* // faceId: '2ce7f471-9c4b-4f27-b5a4-bbd02a5e134d',
|
|
294
|
-
* // boundingBox: {
|
|
295
|
-
* // width: 0.500495970249176,
|
|
296
|
-
* // height: 0.6926820278167725,
|
|
297
|
-
* // left: 0.2928670048713684,
|
|
298
|
-
* // top: 0.09095799922943115
|
|
299
|
-
* // },
|
|
300
|
-
* // externalImageId: 'img.jpg'
|
|
301
|
-
* // }
|
|
302
|
-
* // ]
|
|
303
|
-
* const result = await client.listFaces('MyCollection');
|
|
304
|
-
* console.log(result);
|
|
305
|
-
*
|
|
306
102
|
* @param {string} collectionId ID of the collection from which to list the faces.
|
|
307
103
|
* @param {number} maxResults Maximum number of faces to return.
|
|
308
104
|
* The default value is 1000.
|
|
@@ -313,19 +109,6 @@ export default class {
|
|
|
313
109
|
* Deletes faces from a collection.
|
|
314
110
|
* You specify a collection ID and an array of face IDs to remove from the collection.
|
|
315
111
|
*
|
|
316
|
-
* @example
|
|
317
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
318
|
-
*
|
|
319
|
-
* // Instantiate Rekognition client.
|
|
320
|
-
* const client = new AWSRekognitionClient({
|
|
321
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
322
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
323
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
324
|
-
* });
|
|
325
|
-
*
|
|
326
|
-
* // Delete a face from the collection.
|
|
327
|
-
* await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21f-7fac4b91f51d']);
|
|
328
|
-
*
|
|
329
112
|
* @param {string} collectionId Collection from which to remove the specific faces.
|
|
330
113
|
* @param {string[]} faceIds An array of face IDs to delete.
|
|
331
114
|
*/
|
|
@@ -334,24 +117,12 @@ export default class {
|
|
|
334
117
|
* Deletes the specified collection.
|
|
335
118
|
* Note that this operation removes all faces in the collection.
|
|
336
119
|
*
|
|
337
|
-
* @example
|
|
338
|
-
* const AWSRekognitionClient = require('express-sweet').services.AWSRekognitionClient;
|
|
339
|
-
*
|
|
340
|
-
* // Instantiate Rekognition client.
|
|
341
|
-
* const client = new AWSRekognitionClient({
|
|
342
|
-
* accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
343
|
-
* secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
344
|
-
* region: process.env.AWS_REKOGNITION_REGION
|
|
345
|
-
* });
|
|
346
|
-
*
|
|
347
|
-
* // Delete collection.
|
|
348
|
-
* await client.deleteCollection('MyCollection');
|
|
349
|
-
*
|
|
350
120
|
* @param {string} collectionId ID of the collection to delete.
|
|
351
121
|
*/
|
|
352
122
|
deleteCollection(collectionId: string): Promise<void>;
|
|
353
123
|
/**
|
|
354
|
-
* Returns a buffer of images
|
|
124
|
+
* Returns a buffer of images.
|
|
125
|
+
*
|
|
355
126
|
* @param {string|Buffer} img Image path or Data Url or image buffer.
|
|
356
127
|
* @return {Buffer} Image buffer.
|
|
357
128
|
*/
|