@mediaviz/sdk 1.0.60 → 1.0.62
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 +87 -32
- package/dist/sdk.esm.js +87 -32
- package/dist/sdk.umd.js +87 -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
|
});
|
|
@@ -833,6 +833,13 @@ class Keywords {
|
|
|
833
833
|
return data;
|
|
834
834
|
}
|
|
835
835
|
|
|
836
|
+
async getCompanyKeywordLists(companyId) {
|
|
837
|
+
this._ctx.requireTokens();
|
|
838
|
+
const path = `/api/v1/keyword/company/${encodeURIComponent(companyId)}`;
|
|
839
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
840
|
+
return data;
|
|
841
|
+
}
|
|
842
|
+
|
|
836
843
|
async getKeywordFilteringListAndProjectsById(keywordListId) {
|
|
837
844
|
this._ctx.requireTokens();
|
|
838
845
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
@@ -864,7 +871,7 @@ class Keywords {
|
|
|
864
871
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
865
872
|
this._ctx.requireTokens();
|
|
866
873
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
867
|
-
const body = stripUndef$
|
|
874
|
+
const body = stripUndef$3({
|
|
868
875
|
list_keywords_to_include: listKeywordsToInclude,
|
|
869
876
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
870
877
|
});
|
|
@@ -875,7 +882,7 @@ class Keywords {
|
|
|
875
882
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
876
883
|
this._ctx.requireTokens();
|
|
877
884
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
878
|
-
const body = stripUndef$
|
|
885
|
+
const body = stripUndef$3({
|
|
879
886
|
name: name,
|
|
880
887
|
project_list: projectList,
|
|
881
888
|
});
|
|
@@ -1093,7 +1100,7 @@ class Person {
|
|
|
1093
1100
|
}
|
|
1094
1101
|
}
|
|
1095
1102
|
|
|
1096
|
-
function stripUndef$
|
|
1103
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1097
1104
|
|
|
1098
1105
|
class Projects {
|
|
1099
1106
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1106,7 +1113,7 @@ class Projects {
|
|
|
1106
1113
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1107
1114
|
const qs = query.toString();
|
|
1108
1115
|
if (qs) path += '?' + qs;
|
|
1109
|
-
const body = stripUndef$
|
|
1116
|
+
const body = stripUndef$2({
|
|
1110
1117
|
name: name,
|
|
1111
1118
|
private: private_,
|
|
1112
1119
|
type: type,
|
|
@@ -1176,7 +1183,7 @@ class Projects {
|
|
|
1176
1183
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1177
1184
|
this._ctx.requireTokens();
|
|
1178
1185
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1179
|
-
const body = stripUndef$
|
|
1186
|
+
const body = stripUndef$2({
|
|
1180
1187
|
private: private_,
|
|
1181
1188
|
type: type,
|
|
1182
1189
|
description: description,
|
|
@@ -1255,7 +1262,7 @@ class Projects {
|
|
|
1255
1262
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1256
1263
|
this._ctx.requireTokens();
|
|
1257
1264
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1258
|
-
const body = stripUndef$
|
|
1265
|
+
const body = stripUndef$2({
|
|
1259
1266
|
event: event,
|
|
1260
1267
|
detail: detail,
|
|
1261
1268
|
});
|
|
@@ -1274,18 +1281,18 @@ class Projects {
|
|
|
1274
1281
|
class Photoupload {
|
|
1275
1282
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1276
1283
|
|
|
1277
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1284
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1278
1285
|
this._ctx.requireTokens();
|
|
1279
1286
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1280
1287
|
const headers = {
|
|
1281
1288
|
'Content-Type': 'application/json',
|
|
1282
1289
|
'Authorization': this._ctx.accessToken,
|
|
1290
|
+
'x-company-id': companyId,
|
|
1291
|
+
'x-user-id': userId,
|
|
1292
|
+
'x-project-table-name': projectTableName,
|
|
1293
|
+
'x-title': title,
|
|
1283
1294
|
};
|
|
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
1295
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1288
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1289
1296
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1290
1297
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1291
1298
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1298,8 +1305,7 @@ class Photoupload {
|
|
|
1298
1305
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1299
1306
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1300
1307
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1301
|
-
if (
|
|
1302
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1308
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1303
1309
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1304
1310
|
method: 'POST',
|
|
1305
1311
|
headers,
|
|
@@ -1319,7 +1325,7 @@ class Photoupload {
|
|
|
1319
1325
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1320
1326
|
}
|
|
1321
1327
|
|
|
1322
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1328
|
+
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
1329
|
|
|
1324
1330
|
return upload_result;
|
|
1325
1331
|
}
|
|
@@ -1328,13 +1334,6 @@ class Photoupload {
|
|
|
1328
1334
|
class Photos {
|
|
1329
1335
|
constructor(ctx) { this._ctx = ctx; }
|
|
1330
1336
|
|
|
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
1337
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1339
1338
|
this._ctx.requireTokens();
|
|
1340
1339
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1432,6 +1431,8 @@ class Photos {
|
|
|
1432
1431
|
}
|
|
1433
1432
|
}
|
|
1434
1433
|
|
|
1434
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1435
|
+
|
|
1435
1436
|
class Search {
|
|
1436
1437
|
constructor(ctx) { this._ctx = ctx; }
|
|
1437
1438
|
|
|
@@ -1460,6 +1461,60 @@ class Search {
|
|
|
1460
1461
|
return data;
|
|
1461
1462
|
}
|
|
1462
1463
|
|
|
1464
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1465
|
+
this._ctx.requireTokens();
|
|
1466
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1467
|
+
const body = stripUndef$1({
|
|
1468
|
+
search_text: searchText,
|
|
1469
|
+
size: size,
|
|
1470
|
+
});
|
|
1471
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1472
|
+
return data;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1476
|
+
this._ctx.requireTokens();
|
|
1477
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1478
|
+
const body = stripUndef$1({
|
|
1479
|
+
search_text: searchText,
|
|
1480
|
+
size: size,
|
|
1481
|
+
});
|
|
1482
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1483
|
+
return data;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1487
|
+
this._ctx.requireTokens();
|
|
1488
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1489
|
+
const query = new URLSearchParams();
|
|
1490
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1491
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1492
|
+
const qs = query.toString();
|
|
1493
|
+
if (qs) path += '?' + qs;
|
|
1494
|
+
const body = stripUndef$1({
|
|
1495
|
+
search_text: searchText,
|
|
1496
|
+
size: size,
|
|
1497
|
+
});
|
|
1498
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1499
|
+
return data;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1503
|
+
this._ctx.requireTokens();
|
|
1504
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1505
|
+
const query = new URLSearchParams();
|
|
1506
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1507
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1508
|
+
const qs = query.toString();
|
|
1509
|
+
if (qs) path += '?' + qs;
|
|
1510
|
+
const body = stripUndef$1({
|
|
1511
|
+
search_text: searchText,
|
|
1512
|
+
size: size,
|
|
1513
|
+
});
|
|
1514
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1515
|
+
return data;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1463
1518
|
async getProjectSavedSearches(projectTableName) {
|
|
1464
1519
|
this._ctx.requireTokens();
|
|
1465
1520
|
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
|
});
|
|
@@ -831,6 +831,13 @@ class Keywords {
|
|
|
831
831
|
return data;
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
+
async getCompanyKeywordLists(companyId) {
|
|
835
|
+
this._ctx.requireTokens();
|
|
836
|
+
const path = `/api/v1/keyword/company/${encodeURIComponent(companyId)}`;
|
|
837
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
838
|
+
return data;
|
|
839
|
+
}
|
|
840
|
+
|
|
834
841
|
async getKeywordFilteringListAndProjectsById(keywordListId) {
|
|
835
842
|
this._ctx.requireTokens();
|
|
836
843
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
@@ -862,7 +869,7 @@ class Keywords {
|
|
|
862
869
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
863
870
|
this._ctx.requireTokens();
|
|
864
871
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
865
|
-
const body = stripUndef$
|
|
872
|
+
const body = stripUndef$3({
|
|
866
873
|
list_keywords_to_include: listKeywordsToInclude,
|
|
867
874
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
868
875
|
});
|
|
@@ -873,7 +880,7 @@ class Keywords {
|
|
|
873
880
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
874
881
|
this._ctx.requireTokens();
|
|
875
882
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
876
|
-
const body = stripUndef$
|
|
883
|
+
const body = stripUndef$3({
|
|
877
884
|
name: name,
|
|
878
885
|
project_list: projectList,
|
|
879
886
|
});
|
|
@@ -1091,7 +1098,7 @@ class Person {
|
|
|
1091
1098
|
}
|
|
1092
1099
|
}
|
|
1093
1100
|
|
|
1094
|
-
function stripUndef$
|
|
1101
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1095
1102
|
|
|
1096
1103
|
class Projects {
|
|
1097
1104
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1104,7 +1111,7 @@ class Projects {
|
|
|
1104
1111
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1105
1112
|
const qs = query.toString();
|
|
1106
1113
|
if (qs) path += '?' + qs;
|
|
1107
|
-
const body = stripUndef$
|
|
1114
|
+
const body = stripUndef$2({
|
|
1108
1115
|
name: name,
|
|
1109
1116
|
private: private_,
|
|
1110
1117
|
type: type,
|
|
@@ -1174,7 +1181,7 @@ class Projects {
|
|
|
1174
1181
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1175
1182
|
this._ctx.requireTokens();
|
|
1176
1183
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1177
|
-
const body = stripUndef$
|
|
1184
|
+
const body = stripUndef$2({
|
|
1178
1185
|
private: private_,
|
|
1179
1186
|
type: type,
|
|
1180
1187
|
description: description,
|
|
@@ -1253,7 +1260,7 @@ class Projects {
|
|
|
1253
1260
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1254
1261
|
this._ctx.requireTokens();
|
|
1255
1262
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1256
|
-
const body = stripUndef$
|
|
1263
|
+
const body = stripUndef$2({
|
|
1257
1264
|
event: event,
|
|
1258
1265
|
detail: detail,
|
|
1259
1266
|
});
|
|
@@ -1272,18 +1279,18 @@ class Projects {
|
|
|
1272
1279
|
class Photoupload {
|
|
1273
1280
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1274
1281
|
|
|
1275
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1282
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1276
1283
|
this._ctx.requireTokens();
|
|
1277
1284
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1278
1285
|
const headers = {
|
|
1279
1286
|
'Content-Type': 'application/json',
|
|
1280
1287
|
'Authorization': this._ctx.accessToken,
|
|
1288
|
+
'x-company-id': companyId,
|
|
1289
|
+
'x-user-id': userId,
|
|
1290
|
+
'x-project-table-name': projectTableName,
|
|
1291
|
+
'x-title': title,
|
|
1281
1292
|
};
|
|
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
1293
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1286
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1287
1294
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1288
1295
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1289
1296
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1296,8 +1303,7 @@ class Photoupload {
|
|
|
1296
1303
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1297
1304
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1298
1305
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1299
|
-
if (
|
|
1300
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1306
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1301
1307
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1302
1308
|
method: 'POST',
|
|
1303
1309
|
headers,
|
|
@@ -1317,7 +1323,7 @@ class Photoupload {
|
|
|
1317
1323
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1318
1324
|
}
|
|
1319
1325
|
|
|
1320
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1326
|
+
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
1327
|
|
|
1322
1328
|
return upload_result;
|
|
1323
1329
|
}
|
|
@@ -1326,13 +1332,6 @@ class Photoupload {
|
|
|
1326
1332
|
class Photos {
|
|
1327
1333
|
constructor(ctx) { this._ctx = ctx; }
|
|
1328
1334
|
|
|
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
1335
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1337
1336
|
this._ctx.requireTokens();
|
|
1338
1337
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1430,6 +1429,8 @@ class Photos {
|
|
|
1430
1429
|
}
|
|
1431
1430
|
}
|
|
1432
1431
|
|
|
1432
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1433
|
+
|
|
1433
1434
|
class Search {
|
|
1434
1435
|
constructor(ctx) { this._ctx = ctx; }
|
|
1435
1436
|
|
|
@@ -1458,6 +1459,60 @@ class Search {
|
|
|
1458
1459
|
return data;
|
|
1459
1460
|
}
|
|
1460
1461
|
|
|
1462
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1463
|
+
this._ctx.requireTokens();
|
|
1464
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1465
|
+
const body = stripUndef$1({
|
|
1466
|
+
search_text: searchText,
|
|
1467
|
+
size: size,
|
|
1468
|
+
});
|
|
1469
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1470
|
+
return data;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1474
|
+
this._ctx.requireTokens();
|
|
1475
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1476
|
+
const body = stripUndef$1({
|
|
1477
|
+
search_text: searchText,
|
|
1478
|
+
size: size,
|
|
1479
|
+
});
|
|
1480
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1481
|
+
return data;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1485
|
+
this._ctx.requireTokens();
|
|
1486
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1487
|
+
const query = new URLSearchParams();
|
|
1488
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1489
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1490
|
+
const qs = query.toString();
|
|
1491
|
+
if (qs) path += '?' + qs;
|
|
1492
|
+
const body = stripUndef$1({
|
|
1493
|
+
search_text: searchText,
|
|
1494
|
+
size: size,
|
|
1495
|
+
});
|
|
1496
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1497
|
+
return data;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1501
|
+
this._ctx.requireTokens();
|
|
1502
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1503
|
+
const query = new URLSearchParams();
|
|
1504
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1505
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1506
|
+
const qs = query.toString();
|
|
1507
|
+
if (qs) path += '?' + qs;
|
|
1508
|
+
const body = stripUndef$1({
|
|
1509
|
+
search_text: searchText,
|
|
1510
|
+
size: size,
|
|
1511
|
+
});
|
|
1512
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1513
|
+
return data;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1461
1516
|
async getProjectSavedSearches(projectTableName) {
|
|
1462
1517
|
this._ctx.requireTokens();
|
|
1463
1518
|
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
|
});
|
|
@@ -837,6 +837,13 @@
|
|
|
837
837
|
return data;
|
|
838
838
|
}
|
|
839
839
|
|
|
840
|
+
async getCompanyKeywordLists(companyId) {
|
|
841
|
+
this._ctx.requireTokens();
|
|
842
|
+
const path = `/api/v1/keyword/company/${encodeURIComponent(companyId)}`;
|
|
843
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
844
|
+
return data;
|
|
845
|
+
}
|
|
846
|
+
|
|
840
847
|
async getKeywordFilteringListAndProjectsById(keywordListId) {
|
|
841
848
|
this._ctx.requireTokens();
|
|
842
849
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
@@ -868,7 +875,7 @@
|
|
|
868
875
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
869
876
|
this._ctx.requireTokens();
|
|
870
877
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
871
|
-
const body = stripUndef$
|
|
878
|
+
const body = stripUndef$3({
|
|
872
879
|
list_keywords_to_include: listKeywordsToInclude,
|
|
873
880
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
874
881
|
});
|
|
@@ -879,7 +886,7 @@
|
|
|
879
886
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
880
887
|
this._ctx.requireTokens();
|
|
881
888
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
882
|
-
const body = stripUndef$
|
|
889
|
+
const body = stripUndef$3({
|
|
883
890
|
name: name,
|
|
884
891
|
project_list: projectList,
|
|
885
892
|
});
|
|
@@ -1097,7 +1104,7 @@
|
|
|
1097
1104
|
}
|
|
1098
1105
|
}
|
|
1099
1106
|
|
|
1100
|
-
function stripUndef$
|
|
1107
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1101
1108
|
|
|
1102
1109
|
class Projects {
|
|
1103
1110
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1110,7 +1117,7 @@
|
|
|
1110
1117
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1111
1118
|
const qs = query.toString();
|
|
1112
1119
|
if (qs) path += '?' + qs;
|
|
1113
|
-
const body = stripUndef$
|
|
1120
|
+
const body = stripUndef$2({
|
|
1114
1121
|
name: name,
|
|
1115
1122
|
private: private_,
|
|
1116
1123
|
type: type,
|
|
@@ -1180,7 +1187,7 @@
|
|
|
1180
1187
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1181
1188
|
this._ctx.requireTokens();
|
|
1182
1189
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1183
|
-
const body = stripUndef$
|
|
1190
|
+
const body = stripUndef$2({
|
|
1184
1191
|
private: private_,
|
|
1185
1192
|
type: type,
|
|
1186
1193
|
description: description,
|
|
@@ -1259,7 +1266,7 @@
|
|
|
1259
1266
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1260
1267
|
this._ctx.requireTokens();
|
|
1261
1268
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1262
|
-
const body = stripUndef$
|
|
1269
|
+
const body = stripUndef$2({
|
|
1263
1270
|
event: event,
|
|
1264
1271
|
detail: detail,
|
|
1265
1272
|
});
|
|
@@ -1278,18 +1285,18 @@
|
|
|
1278
1285
|
class Photoupload {
|
|
1279
1286
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1280
1287
|
|
|
1281
|
-
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, {
|
|
1288
|
+
async uploadPhotoToMediaviz(companyId, userId, projectTableName, title, { fileContent, mimetype, filePath }, { clientSideId, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, ocr } = {}) {
|
|
1282
1289
|
this._ctx.requireTokens();
|
|
1283
1290
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1284
1291
|
const headers = {
|
|
1285
1292
|
'Content-Type': 'application/json',
|
|
1286
1293
|
'Authorization': this._ctx.accessToken,
|
|
1294
|
+
'x-company-id': companyId,
|
|
1295
|
+
'x-user-id': userId,
|
|
1296
|
+
'x-project-table-name': projectTableName,
|
|
1297
|
+
'x-title': title,
|
|
1287
1298
|
};
|
|
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
1299
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1292
|
-
if (title !== undefined) headers['x-title'] = title;
|
|
1293
1300
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1294
1301
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1295
1302
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1302,8 +1309,7 @@
|
|
|
1302
1309
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1303
1310
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1304
1311
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1305
|
-
if (
|
|
1306
|
-
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1312
|
+
if (ocr !== undefined) headers['x-ocr'] = ocr;
|
|
1307
1313
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1308
1314
|
method: 'POST',
|
|
1309
1315
|
headers,
|
|
@@ -1323,7 +1329,7 @@
|
|
|
1323
1329
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1324
1330
|
}
|
|
1325
1331
|
|
|
1326
|
-
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, {
|
|
1332
|
+
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
1333
|
|
|
1328
1334
|
return upload_result;
|
|
1329
1335
|
}
|
|
@@ -1332,13 +1338,6 @@
|
|
|
1332
1338
|
class Photos {
|
|
1333
1339
|
constructor(ctx) { this._ctx = ctx; }
|
|
1334
1340
|
|
|
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
1341
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1343
1342
|
this._ctx.requireTokens();
|
|
1344
1343
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1436,6 +1435,8 @@
|
|
|
1436
1435
|
}
|
|
1437
1436
|
}
|
|
1438
1437
|
|
|
1438
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1439
|
+
|
|
1439
1440
|
class Search {
|
|
1440
1441
|
constructor(ctx) { this._ctx = ctx; }
|
|
1441
1442
|
|
|
@@ -1464,6 +1465,60 @@
|
|
|
1464
1465
|
return data;
|
|
1465
1466
|
}
|
|
1466
1467
|
|
|
1468
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1469
|
+
this._ctx.requireTokens();
|
|
1470
|
+
const path = `/api/v1/search/text/${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 searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1480
|
+
this._ctx.requireTokens();
|
|
1481
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1482
|
+
const body = stripUndef$1({
|
|
1483
|
+
search_text: searchText,
|
|
1484
|
+
size: size,
|
|
1485
|
+
});
|
|
1486
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1487
|
+
return data;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1491
|
+
this._ctx.requireTokens();
|
|
1492
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1493
|
+
const query = new URLSearchParams();
|
|
1494
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1495
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1496
|
+
const qs = query.toString();
|
|
1497
|
+
if (qs) path += '?' + qs;
|
|
1498
|
+
const body = stripUndef$1({
|
|
1499
|
+
search_text: searchText,
|
|
1500
|
+
size: size,
|
|
1501
|
+
});
|
|
1502
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1503
|
+
return data;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
async searchProjectPhotosNaturalLanguageAuto(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1507
|
+
this._ctx.requireTokens();
|
|
1508
|
+
let path = `/api/v1/search/auto/${encodeURIComponent(projectTableName)}/`;
|
|
1509
|
+
const query = new URLSearchParams();
|
|
1510
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1511
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1512
|
+
const qs = query.toString();
|
|
1513
|
+
if (qs) path += '?' + qs;
|
|
1514
|
+
const body = stripUndef$1({
|
|
1515
|
+
search_text: searchText,
|
|
1516
|
+
size: size,
|
|
1517
|
+
});
|
|
1518
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1519
|
+
return data;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1467
1522
|
async getProjectSavedSearches(projectTableName) {
|
|
1468
1523
|
this._ctx.requireTokens();
|
|
1469
1524
|
const path = `/api/v1/search/saved/${encodeURIComponent(projectTableName)}/`;
|