@mediaviz/sdk 1.0.60 → 1.0.61
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/dist/sdk.cjs +80 -32
- package/dist/sdk.esm.js +80 -32
- package/dist/sdk.umd.js +80 -32
- package/package.json +1 -1
package/dist/sdk.cjs
CHANGED
|
@@ -481,7 +481,7 @@ class Company {
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
function stripUndef$
|
|
484
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
485
485
|
|
|
486
486
|
class CuratedAlbums {
|
|
487
487
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -489,7 +489,7 @@ class CuratedAlbums {
|
|
|
489
489
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
490
490
|
this._ctx.requireTokens();
|
|
491
491
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
492
|
-
const body = stripUndef$
|
|
492
|
+
const body = stripUndef$6({
|
|
493
493
|
name: name,
|
|
494
494
|
description: description,
|
|
495
495
|
confidence_value: confidenceValue,
|
|
@@ -543,7 +543,7 @@ class CuratedAlbums {
|
|
|
543
543
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
544
544
|
this._ctx.requireTokens();
|
|
545
545
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
546
|
-
const body = stripUndef$
|
|
546
|
+
const body = stripUndef$6({
|
|
547
547
|
name: name,
|
|
548
548
|
description: description,
|
|
549
549
|
confidence_value: confidenceValue,
|
|
@@ -567,7 +567,7 @@ class CuratedAlbums {
|
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
|
|
570
|
-
function stripUndef$
|
|
570
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
571
571
|
|
|
572
572
|
class CustomAlbums {
|
|
573
573
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -615,7 +615,7 @@ class CustomAlbums {
|
|
|
615
615
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
616
616
|
this._ctx.requireTokens();
|
|
617
617
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
618
|
-
const body = stripUndef$
|
|
618
|
+
const body = stripUndef$5({
|
|
619
619
|
name: name,
|
|
620
620
|
description: description,
|
|
621
621
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -628,7 +628,7 @@ class CustomAlbums {
|
|
|
628
628
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
629
629
|
this._ctx.requireTokens();
|
|
630
630
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
631
|
-
const body = stripUndef$
|
|
631
|
+
const body = stripUndef$5({
|
|
632
632
|
name: name,
|
|
633
633
|
description: description,
|
|
634
634
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -728,7 +728,7 @@ async function handleResponse(response) {
|
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
|
|
731
|
-
function stripUndef$
|
|
731
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
732
732
|
|
|
733
733
|
class EmailTokens {
|
|
734
734
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -759,7 +759,7 @@ class EmailTokens {
|
|
|
759
759
|
}
|
|
760
760
|
|
|
761
761
|
async validateToken(token) {
|
|
762
|
-
const body = stripUndef$
|
|
762
|
+
const body = stripUndef$4({
|
|
763
763
|
token: token,
|
|
764
764
|
});
|
|
765
765
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -771,7 +771,7 @@ class EmailTokens {
|
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
async resetPassword(token, newPassword) {
|
|
774
|
-
const body = stripUndef$
|
|
774
|
+
const body = stripUndef$4({
|
|
775
775
|
token: token,
|
|
776
776
|
new_password: newPassword,
|
|
777
777
|
});
|
|
@@ -810,7 +810,7 @@ class Health {
|
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
|
|
813
|
-
function stripUndef$
|
|
813
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
814
814
|
|
|
815
815
|
class Keywords {
|
|
816
816
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -818,7 +818,7 @@ class Keywords {
|
|
|
818
818
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
819
819
|
this._ctx.requireTokens();
|
|
820
820
|
const path = `/api/v1/keyword/`;
|
|
821
|
-
const body = stripUndef$
|
|
821
|
+
const body = stripUndef$3({
|
|
822
822
|
name: name,
|
|
823
823
|
project_list: projectList,
|
|
824
824
|
});
|
|
@@ -864,7 +864,7 @@ class Keywords {
|
|
|
864
864
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
865
865
|
this._ctx.requireTokens();
|
|
866
866
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
867
|
-
const body = stripUndef$
|
|
867
|
+
const body = stripUndef$3({
|
|
868
868
|
list_keywords_to_include: listKeywordsToInclude,
|
|
869
869
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
870
870
|
});
|
|
@@ -875,7 +875,7 @@ class Keywords {
|
|
|
875
875
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
876
876
|
this._ctx.requireTokens();
|
|
877
877
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
878
|
-
const body = stripUndef$
|
|
878
|
+
const body = stripUndef$3({
|
|
879
879
|
name: name,
|
|
880
880
|
project_list: projectList,
|
|
881
881
|
});
|
|
@@ -1093,7 +1093,7 @@ class Person {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
|
-
function stripUndef$
|
|
1096
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1097
1097
|
|
|
1098
1098
|
class Projects {
|
|
1099
1099
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1106,7 +1106,7 @@ class Projects {
|
|
|
1106
1106
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1107
1107
|
const qs = query.toString();
|
|
1108
1108
|
if (qs) path += '?' + qs;
|
|
1109
|
-
const body = stripUndef$
|
|
1109
|
+
const body = stripUndef$2({
|
|
1110
1110
|
name: name,
|
|
1111
1111
|
private: private_,
|
|
1112
1112
|
type: type,
|
|
@@ -1176,7 +1176,7 @@ class Projects {
|
|
|
1176
1176
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1177
1177
|
this._ctx.requireTokens();
|
|
1178
1178
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1179
|
-
const body = stripUndef$
|
|
1179
|
+
const body = stripUndef$2({
|
|
1180
1180
|
private: private_,
|
|
1181
1181
|
type: type,
|
|
1182
1182
|
description: description,
|
|
@@ -1255,7 +1255,7 @@ class Projects {
|
|
|
1255
1255
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1256
1256
|
this._ctx.requireTokens();
|
|
1257
1257
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1258
|
-
const body = stripUndef$
|
|
1258
|
+
const body = stripUndef$2({
|
|
1259
1259
|
event: event,
|
|
1260
1260
|
detail: detail,
|
|
1261
1261
|
});
|
|
@@ -1274,18 +1274,18 @@ class Projects {
|
|
|
1274
1274
|
class Photoupload {
|
|
1275
1275
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1276
1276
|
|
|
1277
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1277
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1278
1278
|
this._ctx.requireTokens();
|
|
1279
1279
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1280
1280
|
const headers = {
|
|
1281
1281
|
'Content-Type': 'application/json',
|
|
1282
1282
|
'Authorization': this._ctx.accessToken,
|
|
1283
|
+
'x-company-id': companyId,
|
|
1284
|
+
'x-user-id': userId,
|
|
1285
|
+
'x-project-table-name': projectTableName,
|
|
1286
|
+
'x-title': title,
|
|
1283
1287
|
};
|
|
1284
|
-
if (companyId !== undefined) headers['x-company-id'] = companyId;
|
|
1285
|
-
if (userId !== undefined) headers['x-user-id'] = userId;
|
|
1286
|
-
if (projectTableName !== undefined) headers['x-project-table-name'] = projectTableName;
|
|
1287
1288
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1288
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1289
1289
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1290
1290
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1291
1291
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1298,8 +1298,7 @@ class Photoupload {
|
|
|
1298
1298
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1299
1299
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1300
1300
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1301
|
-
if (
|
|
1302
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1301
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1303
1302
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1304
1303
|
method: 'POST',
|
|
1305
1304
|
headers,
|
|
@@ -1319,7 +1318,7 @@ class Photoupload {
|
|
|
1319
1318
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1320
1319
|
}
|
|
1321
1320
|
|
|
1322
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1321
|
+
const upload_result = await this.uploadPhotoToMediaviz(companyId, userId, projectTableName, photo.title, { fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, { clientSideId: photo.clientSideId, blur: photo.blur, colors: photo.colors, faceRecognition: photo.faceRecognition, imageDescribe: photo.imageDescribe, imageClassification: photo.imageClassification, imageComparison: photo.imageComparison, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
1323
1322
|
|
|
1324
1323
|
return upload_result;
|
|
1325
1324
|
}
|
|
@@ -1328,13 +1327,6 @@ class Photoupload {
|
|
|
1328
1327
|
class Photos {
|
|
1329
1328
|
constructor(ctx) { this._ctx = ctx; }
|
|
1330
1329
|
|
|
1331
|
-
async addPhotoToProject({ photo, tableName, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, filePath, title, clientSideId }) {
|
|
1332
|
-
this._ctx.requireTokens();
|
|
1333
|
-
const path = `/api/v1/photos/`;
|
|
1334
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, { photo, table_name: tableName, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude, file_path: filePath, title, client_side_id: clientSideId });
|
|
1335
|
-
return data;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
1330
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1339
1331
|
this._ctx.requireTokens();
|
|
1340
1332
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1432,6 +1424,8 @@ class Photos {
|
|
|
1432
1424
|
}
|
|
1433
1425
|
}
|
|
1434
1426
|
|
|
1427
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1428
|
+
|
|
1435
1429
|
class Search {
|
|
1436
1430
|
constructor(ctx) { this._ctx = ctx; }
|
|
1437
1431
|
|
|
@@ -1460,6 +1454,60 @@ class Search {
|
|
|
1460
1454
|
return data;
|
|
1461
1455
|
}
|
|
1462
1456
|
|
|
1457
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1458
|
+
this._ctx.requireTokens();
|
|
1459
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1460
|
+
const body = stripUndef$1({
|
|
1461
|
+
search_text: searchText,
|
|
1462
|
+
size: size,
|
|
1463
|
+
});
|
|
1464
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1465
|
+
return data;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1469
|
+
this._ctx.requireTokens();
|
|
1470
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1471
|
+
const body = stripUndef$1({
|
|
1472
|
+
search_text: searchText,
|
|
1473
|
+
size: size,
|
|
1474
|
+
});
|
|
1475
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1476
|
+
return data;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1480
|
+
this._ctx.requireTokens();
|
|
1481
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1482
|
+
const query = new URLSearchParams();
|
|
1483
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1484
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1485
|
+
const qs = query.toString();
|
|
1486
|
+
if (qs) path += '?' + qs;
|
|
1487
|
+
const body = stripUndef$1({
|
|
1488
|
+
search_text: searchText,
|
|
1489
|
+
size: size,
|
|
1490
|
+
});
|
|
1491
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1492
|
+
return data;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1496
|
+
this._ctx.requireTokens();
|
|
1497
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1498
|
+
const query = new URLSearchParams();
|
|
1499
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1500
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1501
|
+
const qs = query.toString();
|
|
1502
|
+
if (qs) path += '?' + qs;
|
|
1503
|
+
const body = stripUndef$1({
|
|
1504
|
+
search_text: searchText,
|
|
1505
|
+
size: size,
|
|
1506
|
+
});
|
|
1507
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1508
|
+
return data;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1463
1511
|
async getProjectSavedSearches(projectTableName) {
|
|
1464
1512
|
this._ctx.requireTokens();
|
|
1465
1513
|
const path = `/api/v1/search/saved/${encodeURIComponent(projectTableName)}/`;
|
package/dist/sdk.esm.js
CHANGED
|
@@ -479,7 +479,7 @@ class Company {
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
function stripUndef$
|
|
482
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
483
483
|
|
|
484
484
|
class CuratedAlbums {
|
|
485
485
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -487,7 +487,7 @@ class CuratedAlbums {
|
|
|
487
487
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
488
488
|
this._ctx.requireTokens();
|
|
489
489
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
490
|
-
const body = stripUndef$
|
|
490
|
+
const body = stripUndef$6({
|
|
491
491
|
name: name,
|
|
492
492
|
description: description,
|
|
493
493
|
confidence_value: confidenceValue,
|
|
@@ -541,7 +541,7 @@ class CuratedAlbums {
|
|
|
541
541
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
542
542
|
this._ctx.requireTokens();
|
|
543
543
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
544
|
-
const body = stripUndef$
|
|
544
|
+
const body = stripUndef$6({
|
|
545
545
|
name: name,
|
|
546
546
|
description: description,
|
|
547
547
|
confidence_value: confidenceValue,
|
|
@@ -565,7 +565,7 @@ class CuratedAlbums {
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
-
function stripUndef$
|
|
568
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
569
569
|
|
|
570
570
|
class CustomAlbums {
|
|
571
571
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -613,7 +613,7 @@ class CustomAlbums {
|
|
|
613
613
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
614
614
|
this._ctx.requireTokens();
|
|
615
615
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
616
|
-
const body = stripUndef$
|
|
616
|
+
const body = stripUndef$5({
|
|
617
617
|
name: name,
|
|
618
618
|
description: description,
|
|
619
619
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -626,7 +626,7 @@ class CustomAlbums {
|
|
|
626
626
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
627
627
|
this._ctx.requireTokens();
|
|
628
628
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
629
|
-
const body = stripUndef$
|
|
629
|
+
const body = stripUndef$5({
|
|
630
630
|
name: name,
|
|
631
631
|
description: description,
|
|
632
632
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -726,7 +726,7 @@ async function handleResponse(response) {
|
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
function stripUndef$
|
|
729
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
730
730
|
|
|
731
731
|
class EmailTokens {
|
|
732
732
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -757,7 +757,7 @@ class EmailTokens {
|
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
async validateToken(token) {
|
|
760
|
-
const body = stripUndef$
|
|
760
|
+
const body = stripUndef$4({
|
|
761
761
|
token: token,
|
|
762
762
|
});
|
|
763
763
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -769,7 +769,7 @@ class EmailTokens {
|
|
|
769
769
|
}
|
|
770
770
|
|
|
771
771
|
async resetPassword(token, newPassword) {
|
|
772
|
-
const body = stripUndef$
|
|
772
|
+
const body = stripUndef$4({
|
|
773
773
|
token: token,
|
|
774
774
|
new_password: newPassword,
|
|
775
775
|
});
|
|
@@ -808,7 +808,7 @@ class Health {
|
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
-
function stripUndef$
|
|
811
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
812
812
|
|
|
813
813
|
class Keywords {
|
|
814
814
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -816,7 +816,7 @@ class Keywords {
|
|
|
816
816
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
817
817
|
this._ctx.requireTokens();
|
|
818
818
|
const path = `/api/v1/keyword/`;
|
|
819
|
-
const body = stripUndef$
|
|
819
|
+
const body = stripUndef$3({
|
|
820
820
|
name: name,
|
|
821
821
|
project_list: projectList,
|
|
822
822
|
});
|
|
@@ -862,7 +862,7 @@ class Keywords {
|
|
|
862
862
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
863
863
|
this._ctx.requireTokens();
|
|
864
864
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
865
|
-
const body = stripUndef$
|
|
865
|
+
const body = stripUndef$3({
|
|
866
866
|
list_keywords_to_include: listKeywordsToInclude,
|
|
867
867
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
868
868
|
});
|
|
@@ -873,7 +873,7 @@ class Keywords {
|
|
|
873
873
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
874
874
|
this._ctx.requireTokens();
|
|
875
875
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
876
|
-
const body = stripUndef$
|
|
876
|
+
const body = stripUndef$3({
|
|
877
877
|
name: name,
|
|
878
878
|
project_list: projectList,
|
|
879
879
|
});
|
|
@@ -1091,7 +1091,7 @@ class Person {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
function stripUndef$
|
|
1094
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1095
1095
|
|
|
1096
1096
|
class Projects {
|
|
1097
1097
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1104,7 +1104,7 @@ class Projects {
|
|
|
1104
1104
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1105
1105
|
const qs = query.toString();
|
|
1106
1106
|
if (qs) path += '?' + qs;
|
|
1107
|
-
const body = stripUndef$
|
|
1107
|
+
const body = stripUndef$2({
|
|
1108
1108
|
name: name,
|
|
1109
1109
|
private: private_,
|
|
1110
1110
|
type: type,
|
|
@@ -1174,7 +1174,7 @@ class Projects {
|
|
|
1174
1174
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1175
1175
|
this._ctx.requireTokens();
|
|
1176
1176
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1177
|
-
const body = stripUndef$
|
|
1177
|
+
const body = stripUndef$2({
|
|
1178
1178
|
private: private_,
|
|
1179
1179
|
type: type,
|
|
1180
1180
|
description: description,
|
|
@@ -1253,7 +1253,7 @@ class Projects {
|
|
|
1253
1253
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1254
1254
|
this._ctx.requireTokens();
|
|
1255
1255
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1256
|
-
const body = stripUndef$
|
|
1256
|
+
const body = stripUndef$2({
|
|
1257
1257
|
event: event,
|
|
1258
1258
|
detail: detail,
|
|
1259
1259
|
});
|
|
@@ -1272,18 +1272,18 @@ class Projects {
|
|
|
1272
1272
|
class Photoupload {
|
|
1273
1273
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1274
1274
|
|
|
1275
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1275
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1276
1276
|
this._ctx.requireTokens();
|
|
1277
1277
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1278
1278
|
const headers = {
|
|
1279
1279
|
'Content-Type': 'application/json',
|
|
1280
1280
|
'Authorization': this._ctx.accessToken,
|
|
1281
|
+
'x-company-id': companyId,
|
|
1282
|
+
'x-user-id': userId,
|
|
1283
|
+
'x-project-table-name': projectTableName,
|
|
1284
|
+
'x-title': title,
|
|
1281
1285
|
};
|
|
1282
|
-
if (companyId !== undefined) headers['x-company-id'] = companyId;
|
|
1283
|
-
if (userId !== undefined) headers['x-user-id'] = userId;
|
|
1284
|
-
if (projectTableName !== undefined) headers['x-project-table-name'] = projectTableName;
|
|
1285
1286
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1286
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1287
1287
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1288
1288
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1289
1289
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1296,8 +1296,7 @@ class Photoupload {
|
|
|
1296
1296
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1297
1297
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1298
1298
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1299
|
-
if (
|
|
1300
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1299
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1301
1300
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1302
1301
|
method: 'POST',
|
|
1303
1302
|
headers,
|
|
@@ -1317,7 +1316,7 @@ class Photoupload {
|
|
|
1317
1316
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1318
1317
|
}
|
|
1319
1318
|
|
|
1320
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1319
|
+
const upload_result = await this.uploadPhotoToMediaviz(companyId, userId, projectTableName, photo.title, { fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, { clientSideId: photo.clientSideId, blur: photo.blur, colors: photo.colors, faceRecognition: photo.faceRecognition, imageDescribe: photo.imageDescribe, imageClassification: photo.imageClassification, imageComparison: photo.imageComparison, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
1321
1320
|
|
|
1322
1321
|
return upload_result;
|
|
1323
1322
|
}
|
|
@@ -1326,13 +1325,6 @@ class Photoupload {
|
|
|
1326
1325
|
class Photos {
|
|
1327
1326
|
constructor(ctx) { this._ctx = ctx; }
|
|
1328
1327
|
|
|
1329
|
-
async addPhotoToProject({ photo, tableName, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, filePath, title, clientSideId }) {
|
|
1330
|
-
this._ctx.requireTokens();
|
|
1331
|
-
const path = `/api/v1/photos/`;
|
|
1332
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, { photo, table_name: tableName, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude, file_path: filePath, title, client_side_id: clientSideId });
|
|
1333
|
-
return data;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1328
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1337
1329
|
this._ctx.requireTokens();
|
|
1338
1330
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1430,6 +1422,8 @@ class Photos {
|
|
|
1430
1422
|
}
|
|
1431
1423
|
}
|
|
1432
1424
|
|
|
1425
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1426
|
+
|
|
1433
1427
|
class Search {
|
|
1434
1428
|
constructor(ctx) { this._ctx = ctx; }
|
|
1435
1429
|
|
|
@@ -1458,6 +1452,60 @@ class Search {
|
|
|
1458
1452
|
return data;
|
|
1459
1453
|
}
|
|
1460
1454
|
|
|
1455
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1456
|
+
this._ctx.requireTokens();
|
|
1457
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1458
|
+
const body = stripUndef$1({
|
|
1459
|
+
search_text: searchText,
|
|
1460
|
+
size: size,
|
|
1461
|
+
});
|
|
1462
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1463
|
+
return data;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1467
|
+
this._ctx.requireTokens();
|
|
1468
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1469
|
+
const body = stripUndef$1({
|
|
1470
|
+
search_text: searchText,
|
|
1471
|
+
size: size,
|
|
1472
|
+
});
|
|
1473
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1474
|
+
return data;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1478
|
+
this._ctx.requireTokens();
|
|
1479
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1480
|
+
const query = new URLSearchParams();
|
|
1481
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1482
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1483
|
+
const qs = query.toString();
|
|
1484
|
+
if (qs) path += '?' + qs;
|
|
1485
|
+
const body = stripUndef$1({
|
|
1486
|
+
search_text: searchText,
|
|
1487
|
+
size: size,
|
|
1488
|
+
});
|
|
1489
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1490
|
+
return data;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1494
|
+
this._ctx.requireTokens();
|
|
1495
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1496
|
+
const query = new URLSearchParams();
|
|
1497
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1498
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1499
|
+
const qs = query.toString();
|
|
1500
|
+
if (qs) path += '?' + qs;
|
|
1501
|
+
const body = stripUndef$1({
|
|
1502
|
+
search_text: searchText,
|
|
1503
|
+
size: size,
|
|
1504
|
+
});
|
|
1505
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1506
|
+
return data;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1461
1509
|
async getProjectSavedSearches(projectTableName) {
|
|
1462
1510
|
this._ctx.requireTokens();
|
|
1463
1511
|
const path = `/api/v1/search/saved/${encodeURIComponent(projectTableName)}/`;
|
package/dist/sdk.umd.js
CHANGED
|
@@ -485,7 +485,7 @@
|
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
function stripUndef$
|
|
488
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
489
489
|
|
|
490
490
|
class CuratedAlbums {
|
|
491
491
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -493,7 +493,7 @@
|
|
|
493
493
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
494
494
|
this._ctx.requireTokens();
|
|
495
495
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
496
|
-
const body = stripUndef$
|
|
496
|
+
const body = stripUndef$6({
|
|
497
497
|
name: name,
|
|
498
498
|
description: description,
|
|
499
499
|
confidence_value: confidenceValue,
|
|
@@ -547,7 +547,7 @@
|
|
|
547
547
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
548
548
|
this._ctx.requireTokens();
|
|
549
549
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
550
|
-
const body = stripUndef$
|
|
550
|
+
const body = stripUndef$6({
|
|
551
551
|
name: name,
|
|
552
552
|
description: description,
|
|
553
553
|
confidence_value: confidenceValue,
|
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
function stripUndef$
|
|
574
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
575
575
|
|
|
576
576
|
class CustomAlbums {
|
|
577
577
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -619,7 +619,7 @@
|
|
|
619
619
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
620
620
|
this._ctx.requireTokens();
|
|
621
621
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
622
|
-
const body = stripUndef$
|
|
622
|
+
const body = stripUndef$5({
|
|
623
623
|
name: name,
|
|
624
624
|
description: description,
|
|
625
625
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -632,7 +632,7 @@
|
|
|
632
632
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
633
633
|
this._ctx.requireTokens();
|
|
634
634
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
635
|
-
const body = stripUndef$
|
|
635
|
+
const body = stripUndef$5({
|
|
636
636
|
name: name,
|
|
637
637
|
description: description,
|
|
638
638
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -732,7 +732,7 @@
|
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
|
|
735
|
-
function stripUndef$
|
|
735
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
736
736
|
|
|
737
737
|
class EmailTokens {
|
|
738
738
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -763,7 +763,7 @@
|
|
|
763
763
|
}
|
|
764
764
|
|
|
765
765
|
async validateToken(token) {
|
|
766
|
-
const body = stripUndef$
|
|
766
|
+
const body = stripUndef$4({
|
|
767
767
|
token: token,
|
|
768
768
|
});
|
|
769
769
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -775,7 +775,7 @@
|
|
|
775
775
|
}
|
|
776
776
|
|
|
777
777
|
async resetPassword(token, newPassword) {
|
|
778
|
-
const body = stripUndef$
|
|
778
|
+
const body = stripUndef$4({
|
|
779
779
|
token: token,
|
|
780
780
|
new_password: newPassword,
|
|
781
781
|
});
|
|
@@ -814,7 +814,7 @@
|
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
|
|
817
|
-
function stripUndef$
|
|
817
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
818
818
|
|
|
819
819
|
class Keywords {
|
|
820
820
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -822,7 +822,7 @@
|
|
|
822
822
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
823
823
|
this._ctx.requireTokens();
|
|
824
824
|
const path = `/api/v1/keyword/`;
|
|
825
|
-
const body = stripUndef$
|
|
825
|
+
const body = stripUndef$3({
|
|
826
826
|
name: name,
|
|
827
827
|
project_list: projectList,
|
|
828
828
|
});
|
|
@@ -868,7 +868,7 @@
|
|
|
868
868
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
869
869
|
this._ctx.requireTokens();
|
|
870
870
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
871
|
-
const body = stripUndef$
|
|
871
|
+
const body = stripUndef$3({
|
|
872
872
|
list_keywords_to_include: listKeywordsToInclude,
|
|
873
873
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
874
874
|
});
|
|
@@ -879,7 +879,7 @@
|
|
|
879
879
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
880
880
|
this._ctx.requireTokens();
|
|
881
881
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
882
|
-
const body = stripUndef$
|
|
882
|
+
const body = stripUndef$3({
|
|
883
883
|
name: name,
|
|
884
884
|
project_list: projectList,
|
|
885
885
|
});
|
|
@@ -1097,7 +1097,7 @@
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
|
-
function stripUndef$
|
|
1100
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1101
1101
|
|
|
1102
1102
|
class Projects {
|
|
1103
1103
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1110,7 +1110,7 @@
|
|
|
1110
1110
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1111
1111
|
const qs = query.toString();
|
|
1112
1112
|
if (qs) path += '?' + qs;
|
|
1113
|
-
const body = stripUndef$
|
|
1113
|
+
const body = stripUndef$2({
|
|
1114
1114
|
name: name,
|
|
1115
1115
|
private: private_,
|
|
1116
1116
|
type: type,
|
|
@@ -1180,7 +1180,7 @@
|
|
|
1180
1180
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1181
1181
|
this._ctx.requireTokens();
|
|
1182
1182
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1183
|
-
const body = stripUndef$
|
|
1183
|
+
const body = stripUndef$2({
|
|
1184
1184
|
private: private_,
|
|
1185
1185
|
type: type,
|
|
1186
1186
|
description: description,
|
|
@@ -1259,7 +1259,7 @@
|
|
|
1259
1259
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1260
1260
|
this._ctx.requireTokens();
|
|
1261
1261
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1262
|
-
const body = stripUndef$
|
|
1262
|
+
const body = stripUndef$2({
|
|
1263
1263
|
event: event,
|
|
1264
1264
|
detail: detail,
|
|
1265
1265
|
});
|
|
@@ -1278,18 +1278,18 @@
|
|
|
1278
1278
|
class Photoupload {
|
|
1279
1279
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1280
1280
|
|
|
1281
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1281
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1282
1282
|
this._ctx.requireTokens();
|
|
1283
1283
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1284
1284
|
const headers = {
|
|
1285
1285
|
'Content-Type': 'application/json',
|
|
1286
1286
|
'Authorization': this._ctx.accessToken,
|
|
1287
|
+
'x-company-id': companyId,
|
|
1288
|
+
'x-user-id': userId,
|
|
1289
|
+
'x-project-table-name': projectTableName,
|
|
1290
|
+
'x-title': title,
|
|
1287
1291
|
};
|
|
1288
|
-
if (companyId !== undefined) headers['x-company-id'] = companyId;
|
|
1289
|
-
if (userId !== undefined) headers['x-user-id'] = userId;
|
|
1290
|
-
if (projectTableName !== undefined) headers['x-project-table-name'] = projectTableName;
|
|
1291
1292
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1292
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1293
1293
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1294
1294
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1295
1295
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1302,8 +1302,7 @@
|
|
|
1302
1302
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1303
1303
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1304
1304
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1305
|
-
if (
|
|
1306
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1305
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1307
1306
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1308
1307
|
method: 'POST',
|
|
1309
1308
|
headers,
|
|
@@ -1323,7 +1322,7 @@
|
|
|
1323
1322
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1324
1323
|
}
|
|
1325
1324
|
|
|
1326
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1325
|
+
const upload_result = await this.uploadPhotoToMediaviz(companyId, userId, projectTableName, photo.title, { fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, { clientSideId: photo.clientSideId, blur: photo.blur, colors: photo.colors, faceRecognition: photo.faceRecognition, imageDescribe: photo.imageDescribe, imageClassification: photo.imageClassification, imageComparison: photo.imageComparison, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
1327
1326
|
|
|
1328
1327
|
return upload_result;
|
|
1329
1328
|
}
|
|
@@ -1332,13 +1331,6 @@
|
|
|
1332
1331
|
class Photos {
|
|
1333
1332
|
constructor(ctx) { this._ctx = ctx; }
|
|
1334
1333
|
|
|
1335
|
-
async addPhotoToProject({ photo, tableName, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, filePath, title, clientSideId }) {
|
|
1336
|
-
this._ctx.requireTokens();
|
|
1337
|
-
const path = `/api/v1/photos/`;
|
|
1338
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, { photo, table_name: tableName, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude, file_path: filePath, title, client_side_id: clientSideId });
|
|
1339
|
-
return data;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
1334
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1343
1335
|
this._ctx.requireTokens();
|
|
1344
1336
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1436,6 +1428,8 @@
|
|
|
1436
1428
|
}
|
|
1437
1429
|
}
|
|
1438
1430
|
|
|
1431
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1432
|
+
|
|
1439
1433
|
class Search {
|
|
1440
1434
|
constructor(ctx) { this._ctx = ctx; }
|
|
1441
1435
|
|
|
@@ -1464,6 +1458,60 @@
|
|
|
1464
1458
|
return data;
|
|
1465
1459
|
}
|
|
1466
1460
|
|
|
1461
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1462
|
+
this._ctx.requireTokens();
|
|
1463
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1464
|
+
const body = stripUndef$1({
|
|
1465
|
+
search_text: searchText,
|
|
1466
|
+
size: size,
|
|
1467
|
+
});
|
|
1468
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1469
|
+
return data;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1473
|
+
this._ctx.requireTokens();
|
|
1474
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1475
|
+
const body = stripUndef$1({
|
|
1476
|
+
search_text: searchText,
|
|
1477
|
+
size: size,
|
|
1478
|
+
});
|
|
1479
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1480
|
+
return data;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1484
|
+
this._ctx.requireTokens();
|
|
1485
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1486
|
+
const query = new URLSearchParams();
|
|
1487
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1488
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1489
|
+
const qs = query.toString();
|
|
1490
|
+
if (qs) path += '?' + qs;
|
|
1491
|
+
const body = stripUndef$1({
|
|
1492
|
+
search_text: searchText,
|
|
1493
|
+
size: size,
|
|
1494
|
+
});
|
|
1495
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1496
|
+
return data;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1500
|
+
this._ctx.requireTokens();
|
|
1501
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1502
|
+
const query = new URLSearchParams();
|
|
1503
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1504
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1505
|
+
const qs = query.toString();
|
|
1506
|
+
if (qs) path += '?' + qs;
|
|
1507
|
+
const body = stripUndef$1({
|
|
1508
|
+
search_text: searchText,
|
|
1509
|
+
size: size,
|
|
1510
|
+
});
|
|
1511
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1512
|
+
return data;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1467
1515
|
async getProjectSavedSearches(projectTableName) {
|
|
1468
1516
|
this._ctx.requireTokens();
|
|
1469
1517
|
const path = `/api/v1/search/saved/${encodeURIComponent(projectTableName)}/`;
|