@mediaviz/sdk 0.1.0 → 1.0.60
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/LICENSE +21 -0
- package/dist/sdk.cjs +21 -260
- package/dist/sdk.esm.js +22 -259
- package/dist/sdk.umd.js +21 -260
- package/package.json +15 -1
- package/MediaViz.js +0 -126
- package/_oauth.js +0 -3
- package/admin.js +0 -93
- package/ai_model_credits.js +0 -22
- package/company.js +0 -54
- package/curated_albums.js +0 -85
- package/custom_albums.js +0 -78
- package/email_tokens.js +0 -64
- package/errors.js +0 -81
- package/health.js +0 -20
- package/index.js +0 -21
- package/keywords.js +0 -123
- package/oauth/.prettierrc +0 -6
- package/oauth/README.md +0 -76
- package/oauth/browser-smoke-test.html +0 -45
- package/oauth/implementation_plan.json +0 -106
- package/oauth/package-lock.json +0 -5236
- package/oauth/package.json +0 -28
- package/oauth/rollup.config.js +0 -21
- package/oauth/smoke-test.js +0 -27
- package/oauth/spec.md +0 -187
- package/oauth/src/__tests__/browser-smoke-test.test.js +0 -38
- package/oauth/src/__tests__/client.test.js +0 -556
- package/oauth/src/__tests__/errors.test.js +0 -73
- package/oauth/src/__tests__/http.test.js +0 -102
- package/oauth/src/__tests__/index.test.js +0 -53
- package/oauth/src/__tests__/package-fields.test.js +0 -29
- package/oauth/src/__tests__/pkce.test.js +0 -55
- package/oauth/src/__tests__/rollup-build.test.js +0 -58
- package/oauth/src/__tests__/smoke-test.test.js +0 -26
- package/oauth/src/__tests__/types.test.js +0 -29
- package/oauth/src/client.js +0 -180
- package/oauth/src/errors.js +0 -32
- package/oauth/src/http.js +0 -52
- package/oauth/src/index.js +0 -7
- package/oauth/src/pkce.js +0 -50
- package/oauth/src/types.js +0 -67
- package/oauth_authorization.js +0 -53
- package/oauth_clients.js +0 -18
- package/oauth_login.js +0 -24
- package/oauth_token.js +0 -30
- package/person.js +0 -54
- package/photos.js +0 -106
- package/photoupload.js +0 -55
- package/projects.js +0 -191
- package/rollup.config.js +0 -12
- package/search.js +0 -99
- package/users.js +0 -137
package/dist/sdk.esm.js
CHANGED
|
@@ -454,124 +454,11 @@ class AiModelCredits {
|
|
|
454
454
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
455
455
|
return data;
|
|
456
456
|
}
|
|
457
|
-
|
|
458
|
-
async upsertModelCreditRelationship({ modelName, newCreditValue } = {}) {
|
|
459
|
-
this._ctx.requireTokens();
|
|
460
|
-
let path = `/api/v1/model_credit/upsert`;
|
|
461
|
-
const query = new URLSearchParams();
|
|
462
|
-
if (modelName !== undefined) (Array.isArray(modelName) ? modelName : [modelName]).forEach(v => query.append('model_name', v));
|
|
463
|
-
if (newCreditValue !== undefined) (Array.isArray(newCreditValue) ? newCreditValue : [newCreditValue]).forEach(v => query.append('new_credit_value', v));
|
|
464
|
-
const qs = query.toString();
|
|
465
|
-
if (qs) path += '?' + qs;
|
|
466
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
467
|
-
return data;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
class Admin {
|
|
472
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
473
|
-
|
|
474
|
-
async insertLabelCategoryMatrix() {
|
|
475
|
-
this._ctx.requireTokens();
|
|
476
|
-
const path = `/api/v1/admin/insert_label_category_matrix`;
|
|
477
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
478
|
-
return data;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
async generateMidLevelCategoryKeywordAlignment() {
|
|
482
|
-
this._ctx.requireTokens();
|
|
483
|
-
const path = `/api/v1/admin/generate_mid_level_category_keyword_alignment`;
|
|
484
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
485
|
-
return data;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
async getCategoryLabels(category) {
|
|
489
|
-
this._ctx.requireTokens();
|
|
490
|
-
const path = `/api/v1/admin/category_labels/${encodeURIComponent(category)}`;
|
|
491
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
492
|
-
return data;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
async adminDumpCompanyNlpIndex(companyId) {
|
|
496
|
-
this._ctx.requireTokens();
|
|
497
|
-
const path = `/api/v1/admin/dump_company_nlp_index/${encodeURIComponent(companyId)}`;
|
|
498
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
499
|
-
return data;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
async getAllKeywordGroupsAndSubgroups() {
|
|
503
|
-
this._ctx.requireTokens();
|
|
504
|
-
const path = `/api/v1/admin/keyword_group`;
|
|
505
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
506
|
-
return data;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
async getKeywordGroupsLabelsByKeywordGroup(keywordGroup, { subgroup } = {}) {
|
|
510
|
-
this._ctx.requireTokens();
|
|
511
|
-
let path = `/api/v1/admin/keyword_group/${encodeURIComponent(keywordGroup)}/`;
|
|
512
|
-
const query = new URLSearchParams();
|
|
513
|
-
if (subgroup !== undefined) (Array.isArray(subgroup) ? subgroup : [subgroup]).forEach(v => query.append('subgroup', v));
|
|
514
|
-
const qs = query.toString();
|
|
515
|
-
if (qs) path += '?' + qs;
|
|
516
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
517
|
-
return data;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
async adminCreateCompanyNlpIndexes({ companyIds } = {}) {
|
|
521
|
-
this._ctx.requireTokens();
|
|
522
|
-
let path = `/api/v1/admin/create_company_nlp_indexes/`;
|
|
523
|
-
const query = new URLSearchParams();
|
|
524
|
-
if (companyIds !== undefined) (Array.isArray(companyIds) ? companyIds : [companyIds]).forEach(v => query.append('company_ids', v));
|
|
525
|
-
const qs = query.toString();
|
|
526
|
-
if (qs) path += '?' + qs;
|
|
527
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
528
|
-
return data;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
async adminDeleteCompanyNlpIndexes({ companyIds } = {}) {
|
|
532
|
-
this._ctx.requireTokens();
|
|
533
|
-
let path = `/api/v1/admin/delete_company_nlp_indexes/`;
|
|
534
|
-
const query = new URLSearchParams();
|
|
535
|
-
if (companyIds !== undefined) (Array.isArray(companyIds) ? companyIds : [companyIds]).forEach(v => query.append('company_ids', v));
|
|
536
|
-
const qs = query.toString();
|
|
537
|
-
if (qs) path += '?' + qs;
|
|
538
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
539
|
-
return data;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
async adminDeleteUserProjects({ userIds } = {}) {
|
|
543
|
-
this._ctx.requireTokens();
|
|
544
|
-
let path = `/api/v1/admin/delete_user_projects/`;
|
|
545
|
-
const query = new URLSearchParams();
|
|
546
|
-
if (userIds !== undefined) (Array.isArray(userIds) ? userIds : [userIds]).forEach(v => query.append('user_ids', v));
|
|
547
|
-
const qs = query.toString();
|
|
548
|
-
if (qs) path += '?' + qs;
|
|
549
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
550
|
-
return data;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
async adminDeleteUser({ userIds } = {}) {
|
|
554
|
-
this._ctx.requireTokens();
|
|
555
|
-
let path = `/api/v1/admin/delete_user/`;
|
|
556
|
-
const query = new URLSearchParams();
|
|
557
|
-
if (userIds !== undefined) (Array.isArray(userIds) ? userIds : [userIds]).forEach(v => query.append('user_ids', v));
|
|
558
|
-
const qs = query.toString();
|
|
559
|
-
if (qs) path += '?' + qs;
|
|
560
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
561
|
-
return data;
|
|
562
|
-
}
|
|
563
457
|
}
|
|
564
458
|
|
|
565
459
|
class Company {
|
|
566
460
|
constructor(ctx) { this._ctx = ctx; }
|
|
567
461
|
|
|
568
|
-
async getAllCompanies() {
|
|
569
|
-
this._ctx.requireTokens();
|
|
570
|
-
const path = `/api/v1/company/`;
|
|
571
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
572
|
-
return data;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
462
|
async getCompanyById(companyId) {
|
|
576
463
|
this._ctx.requireTokens();
|
|
577
464
|
const path = `/api/v1/company/${encodeURIComponent(companyId)}`;
|
|
@@ -590,34 +477,9 @@ class Company {
|
|
|
590
477
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
591
478
|
return data;
|
|
592
479
|
}
|
|
593
|
-
|
|
594
|
-
async adminListActiveCompanyTokens() {
|
|
595
|
-
this._ctx.requireTokens();
|
|
596
|
-
const path = `/api/v1/company/admin_create/`;
|
|
597
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
598
|
-
return data;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
async adminCreateCompanyToken({ email } = {}) {
|
|
602
|
-
this._ctx.requireTokens();
|
|
603
|
-
let path = `/api/v1/company/admin_create/`;
|
|
604
|
-
const query = new URLSearchParams();
|
|
605
|
-
if (email !== undefined) (Array.isArray(email) ? email : [email]).forEach(v => query.append('email', v));
|
|
606
|
-
const qs = query.toString();
|
|
607
|
-
if (qs) path += '?' + qs;
|
|
608
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
609
|
-
return data;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
async adminRevokeCompanyToken(tokenId) {
|
|
613
|
-
this._ctx.requireTokens();
|
|
614
|
-
const path = `/api/v1/company/admin_create/${encodeURIComponent(tokenId)}/revoke/`;
|
|
615
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
616
|
-
return data;
|
|
617
|
-
}
|
|
618
480
|
}
|
|
619
481
|
|
|
620
|
-
function stripUndef$
|
|
482
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
621
483
|
|
|
622
484
|
class CuratedAlbums {
|
|
623
485
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -625,7 +487,7 @@ class CuratedAlbums {
|
|
|
625
487
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
626
488
|
this._ctx.requireTokens();
|
|
627
489
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
628
|
-
const body = stripUndef$
|
|
490
|
+
const body = stripUndef$5({
|
|
629
491
|
name: name,
|
|
630
492
|
description: description,
|
|
631
493
|
confidence_value: confidenceValue,
|
|
@@ -679,7 +541,7 @@ class CuratedAlbums {
|
|
|
679
541
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
680
542
|
this._ctx.requireTokens();
|
|
681
543
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
682
|
-
const body = stripUndef$
|
|
544
|
+
const body = stripUndef$5({
|
|
683
545
|
name: name,
|
|
684
546
|
description: description,
|
|
685
547
|
confidence_value: confidenceValue,
|
|
@@ -703,7 +565,7 @@ class CuratedAlbums {
|
|
|
703
565
|
}
|
|
704
566
|
}
|
|
705
567
|
|
|
706
|
-
function stripUndef$
|
|
568
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
707
569
|
|
|
708
570
|
class CustomAlbums {
|
|
709
571
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -751,7 +613,7 @@ class CustomAlbums {
|
|
|
751
613
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
752
614
|
this._ctx.requireTokens();
|
|
753
615
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
754
|
-
const body = stripUndef$
|
|
616
|
+
const body = stripUndef$4({
|
|
755
617
|
name: name,
|
|
756
618
|
description: description,
|
|
757
619
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -764,7 +626,7 @@ class CustomAlbums {
|
|
|
764
626
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
765
627
|
this._ctx.requireTokens();
|
|
766
628
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
767
|
-
const body = stripUndef$
|
|
629
|
+
const body = stripUndef$4({
|
|
768
630
|
name: name,
|
|
769
631
|
description: description,
|
|
770
632
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -864,7 +726,7 @@ async function handleResponse(response) {
|
|
|
864
726
|
}
|
|
865
727
|
}
|
|
866
728
|
|
|
867
|
-
function stripUndef$
|
|
729
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
868
730
|
|
|
869
731
|
class EmailTokens {
|
|
870
732
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -895,7 +757,7 @@ class EmailTokens {
|
|
|
895
757
|
}
|
|
896
758
|
|
|
897
759
|
async validateToken(token) {
|
|
898
|
-
const body = stripUndef$
|
|
760
|
+
const body = stripUndef$3({
|
|
899
761
|
token: token,
|
|
900
762
|
});
|
|
901
763
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -907,7 +769,7 @@ class EmailTokens {
|
|
|
907
769
|
}
|
|
908
770
|
|
|
909
771
|
async resetPassword(token, newPassword) {
|
|
910
|
-
const body = stripUndef$
|
|
772
|
+
const body = stripUndef$3({
|
|
911
773
|
token: token,
|
|
912
774
|
new_password: newPassword,
|
|
913
775
|
});
|
|
@@ -946,7 +808,7 @@ class Health {
|
|
|
946
808
|
}
|
|
947
809
|
}
|
|
948
810
|
|
|
949
|
-
function stripUndef$
|
|
811
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
950
812
|
|
|
951
813
|
class Keywords {
|
|
952
814
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -954,7 +816,7 @@ class Keywords {
|
|
|
954
816
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
955
817
|
this._ctx.requireTokens();
|
|
956
818
|
const path = `/api/v1/keyword/`;
|
|
957
|
-
const body = stripUndef$
|
|
819
|
+
const body = stripUndef$2({
|
|
958
820
|
name: name,
|
|
959
821
|
project_list: projectList,
|
|
960
822
|
});
|
|
@@ -1000,7 +862,7 @@ class Keywords {
|
|
|
1000
862
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1001
863
|
this._ctx.requireTokens();
|
|
1002
864
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1003
|
-
const body = stripUndef$
|
|
865
|
+
const body = stripUndef$2({
|
|
1004
866
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1005
867
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1006
868
|
});
|
|
@@ -1011,7 +873,7 @@ class Keywords {
|
|
|
1011
873
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1012
874
|
this._ctx.requireTokens();
|
|
1013
875
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1014
|
-
const body = stripUndef$
|
|
876
|
+
const body = stripUndef$2({
|
|
1015
877
|
name: name,
|
|
1016
878
|
project_list: projectList,
|
|
1017
879
|
});
|
|
@@ -1122,25 +984,6 @@ class OauthAuthorization {
|
|
|
1122
984
|
}
|
|
1123
985
|
}
|
|
1124
986
|
|
|
1125
|
-
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1126
|
-
|
|
1127
|
-
class OauthClients {
|
|
1128
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
1129
|
-
|
|
1130
|
-
async createClient(clientName, clientType, redirectUris, isFirstParty) {
|
|
1131
|
-
this._ctx.requireTokens();
|
|
1132
|
-
const path = `/oauth/clients`;
|
|
1133
|
-
const body = stripUndef$2({
|
|
1134
|
-
client_name: clientName,
|
|
1135
|
-
client_type: clientType,
|
|
1136
|
-
redirect_uris: redirectUris,
|
|
1137
|
-
is_first_party: isFirstParty,
|
|
1138
|
-
});
|
|
1139
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1140
|
-
return data;
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
987
|
class OauthToken {
|
|
1145
988
|
constructor(ctx) { this._ctx = ctx; }
|
|
1146
989
|
|
|
@@ -1314,13 +1157,6 @@ class Projects {
|
|
|
1314
1157
|
return data;
|
|
1315
1158
|
}
|
|
1316
1159
|
|
|
1317
|
-
async getAllUserProjectsAdmin(userId) {
|
|
1318
|
-
this._ctx.requireTokens();
|
|
1319
|
-
const path = `/api/v1/projects/admin/user/${encodeURIComponent(userId)}`;
|
|
1320
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1321
|
-
return data;
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
1160
|
async getProjectById(projectId) {
|
|
1325
1161
|
this._ctx.requireTokens();
|
|
1326
1162
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
@@ -1407,13 +1243,6 @@ class Projects {
|
|
|
1407
1243
|
return data;
|
|
1408
1244
|
}
|
|
1409
1245
|
|
|
1410
|
-
async requestProjectAdminExport(projectTableName) {
|
|
1411
|
-
this._ctx.requireTokens();
|
|
1412
|
-
const path = `/api/v1/projects_admin_export/${encodeURIComponent(projectTableName)}`;
|
|
1413
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1414
|
-
return data;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
1246
|
async getProjectDataExportUploadStatus(projectTableName, modelName) {
|
|
1418
1247
|
this._ctx.requireTokens();
|
|
1419
1248
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/upload_status/${encodeURIComponent(modelName)}`;
|
|
@@ -1443,18 +1272,18 @@ class Projects {
|
|
|
1443
1272
|
class Photoupload {
|
|
1444
1273
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1445
1274
|
|
|
1446
|
-
async uploadPhotoToMediaviz(
|
|
1275
|
+
async uploadPhotoToMediaviz({ fileContent, mimetype, filePath }, { companyId, userId, projectTableName, clientSideId, title, blur, colors, faceRecognition, imageDescribe, imageClassification, imageComparison, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, bucketName, photoIndex } = {}) {
|
|
1447
1276
|
this._ctx.requireTokens();
|
|
1448
1277
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
1449
1278
|
const headers = {
|
|
1450
1279
|
'Content-Type': 'application/json',
|
|
1451
1280
|
'Authorization': this._ctx.accessToken,
|
|
1452
|
-
'x-company-id': companyId,
|
|
1453
|
-
'x-user-id': userId,
|
|
1454
|
-
'x-project-table-name': projectTableName,
|
|
1455
|
-
'x-title': title,
|
|
1456
1281
|
};
|
|
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;
|
|
1457
1285
|
if (clientSideId !== undefined) headers['x-client-side-id'] = clientSideId;
|
|
1286
|
+
if (title !== undefined) headers['x-title'] = title;
|
|
1458
1287
|
if (blur !== undefined) headers['x-blur'] = blur;
|
|
1459
1288
|
if (colors !== undefined) headers['x-colors'] = colors;
|
|
1460
1289
|
if (faceRecognition !== undefined) headers['x-face-recognition'] = faceRecognition;
|
|
@@ -1467,7 +1296,8 @@ class Photoupload {
|
|
|
1467
1296
|
if (dateTaken !== undefined) headers['x-date-taken'] = dateTaken;
|
|
1468
1297
|
if (latitude !== undefined) headers['x-latitude'] = latitude;
|
|
1469
1298
|
if (longitude !== undefined) headers['x-longitude'] = longitude;
|
|
1470
|
-
if (
|
|
1299
|
+
if (bucketName !== undefined) headers['x-bucket-name'] = bucketName;
|
|
1300
|
+
if (photoIndex !== undefined) headers['x-photo-index'] = photoIndex;
|
|
1471
1301
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
1472
1302
|
method: 'POST',
|
|
1473
1303
|
headers,
|
|
@@ -1487,7 +1317,7 @@ class Photoupload {
|
|
|
1487
1317
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
1488
1318
|
}
|
|
1489
1319
|
|
|
1490
|
-
const upload_result = await this.uploadPhotoToMediaviz(
|
|
1320
|
+
const upload_result = await this.uploadPhotoToMediaviz({ fileContent: photo.fileContent, mimetype: photo.mimetype, filePath: photo.filePath }, { companyId: companyId, userId: userId, projectTableName: projectTableName, clientSideId: photo.clientSideId, title: photo.title, 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, bucketName: template.bucket_name, photoIndex: photoIndex });
|
|
1491
1321
|
|
|
1492
1322
|
return upload_result;
|
|
1493
1323
|
}
|
|
@@ -1628,30 +1458,6 @@ class Search {
|
|
|
1628
1458
|
return data;
|
|
1629
1459
|
}
|
|
1630
1460
|
|
|
1631
|
-
async searchProjectPhotosText(projectTableName, { q, size } = {}) {
|
|
1632
|
-
this._ctx.requireTokens();
|
|
1633
|
-
let path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1634
|
-
const query = new URLSearchParams();
|
|
1635
|
-
if (q !== undefined) (Array.isArray(q) ? q : [q]).forEach(v => query.append('q', v));
|
|
1636
|
-
if (size !== undefined) (Array.isArray(size) ? size : [size]).forEach(v => query.append('size', v));
|
|
1637
|
-
const qs = query.toString();
|
|
1638
|
-
if (qs) path += '?' + qs;
|
|
1639
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1640
|
-
return data;
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
async searchProjectPhotosNaturalLanguage(projectTableName, { searchText, size } = {}) {
|
|
1644
|
-
this._ctx.requireTokens();
|
|
1645
|
-
let path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1646
|
-
const query = new URLSearchParams();
|
|
1647
|
-
if (searchText !== undefined) (Array.isArray(searchText) ? searchText : [searchText]).forEach(v => query.append('search_text', v));
|
|
1648
|
-
if (size !== undefined) (Array.isArray(size) ? size : [size]).forEach(v => query.append('size', v));
|
|
1649
|
-
const qs = query.toString();
|
|
1650
|
-
if (qs) path += '?' + qs;
|
|
1651
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1652
|
-
return data;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
1461
|
async getProjectSavedSearches(projectTableName) {
|
|
1656
1462
|
this._ctx.requireTokens();
|
|
1657
1463
|
const path = `/api/v1/search/saved/${encodeURIComponent(projectTableName)}/`;
|
|
@@ -1776,18 +1582,6 @@ class Users {
|
|
|
1776
1582
|
return data;
|
|
1777
1583
|
}
|
|
1778
1584
|
|
|
1779
|
-
async getAllUsers(ascOrDesc, { lastId, limit } = {}) {
|
|
1780
|
-
this._ctx.requireTokens();
|
|
1781
|
-
let path = `/api/v1/users/admin/sort/${encodeURIComponent(ascOrDesc)}/`;
|
|
1782
|
-
const query = new URLSearchParams();
|
|
1783
|
-
if (lastId !== undefined) (Array.isArray(lastId) ? lastId : [lastId]).forEach(v => query.append('last_id', v));
|
|
1784
|
-
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
1785
|
-
const qs = query.toString();
|
|
1786
|
-
if (qs) path += '?' + qs;
|
|
1787
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1788
|
-
return data;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
1585
|
async updateUser(userId, { name, email, password, companyId, accountType, profilePicture, location, phoneNumber, birthday } = {}) {
|
|
1792
1586
|
this._ctx.requireTokens();
|
|
1793
1587
|
const path = `/api/v1/users/${encodeURIComponent(userId)}`;
|
|
@@ -1805,35 +1599,6 @@ class Users {
|
|
|
1805
1599
|
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1806
1600
|
return data;
|
|
1807
1601
|
}
|
|
1808
|
-
|
|
1809
|
-
async updateUserByAdmin(userId, { name, email, password, companyId, accountType, profilePicture, location, phoneNumber, birthday } = {}) {
|
|
1810
|
-
this._ctx.requireTokens();
|
|
1811
|
-
const path = `/api/v1/users/admin/${encodeURIComponent(userId)}`;
|
|
1812
|
-
const body = stripUndef({
|
|
1813
|
-
name: name,
|
|
1814
|
-
email: email,
|
|
1815
|
-
password: password,
|
|
1816
|
-
company_id: companyId,
|
|
1817
|
-
account_type: accountType,
|
|
1818
|
-
profile_picture: profilePicture,
|
|
1819
|
-
location: location,
|
|
1820
|
-
phone_number: phoneNumber,
|
|
1821
|
-
birthday: birthday,
|
|
1822
|
-
});
|
|
1823
|
-
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1824
|
-
return data;
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
async deleteUser(userId, { newCompanyOwnerId } = {}) {
|
|
1828
|
-
this._ctx.requireTokens();
|
|
1829
|
-
let path = `/api/v1/users/delete/${encodeURIComponent(userId)}`;
|
|
1830
|
-
const query = new URLSearchParams();
|
|
1831
|
-
if (newCompanyOwnerId !== undefined) (Array.isArray(newCompanyOwnerId) ? newCompanyOwnerId : [newCompanyOwnerId]).forEach(v => query.append('new_company_owner_id', v));
|
|
1832
|
-
const qs = query.toString();
|
|
1833
|
-
if (qs) path += '?' + qs;
|
|
1834
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1835
|
-
return data;
|
|
1836
|
-
}
|
|
1837
1602
|
}
|
|
1838
1603
|
|
|
1839
1604
|
// Auto-generated — do not edit
|
|
@@ -1898,7 +1663,6 @@ class MediaViz {
|
|
|
1898
1663
|
|
|
1899
1664
|
const _ctx = new _Context(this);
|
|
1900
1665
|
this.aiModelCredits = new AiModelCredits(_ctx);
|
|
1901
|
-
this.admin = new Admin(_ctx);
|
|
1902
1666
|
this.company = new Company(_ctx);
|
|
1903
1667
|
this.curatedAlbums = new CuratedAlbums(_ctx);
|
|
1904
1668
|
this.customAlbums = new CustomAlbums(_ctx);
|
|
@@ -1906,7 +1670,6 @@ class MediaViz {
|
|
|
1906
1670
|
this.health = new Health(_ctx);
|
|
1907
1671
|
this.keywords = new Keywords(_ctx);
|
|
1908
1672
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
1909
|
-
this.oAuthClients = new OauthClients(_ctx);
|
|
1910
1673
|
this.oAuthToken = new OauthToken(_ctx);
|
|
1911
1674
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
1912
1675
|
this.person = new Person(_ctx);
|
|
@@ -1944,4 +1707,4 @@ class MediaViz {
|
|
|
1944
1707
|
get refreshToken() { return this._refreshToken; }
|
|
1945
1708
|
}
|
|
1946
1709
|
|
|
1947
|
-
export {
|
|
1710
|
+
export { AiModelCredits, ApiError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, Keywords, MediaViz, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Users, ValidationError, handleResponse };
|