@mediaviz/sdk 0.1.0 → 1.0.59
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 +33 -240
- package/dist/sdk.esm.js +34 -239
- package/dist/sdk.umd.js +33 -240
- package/package.json +14 -8
- 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,31 +477,6 @@ 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
482
|
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
@@ -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
|
|
|
@@ -1248,7 +1091,7 @@ class Person {
|
|
|
1248
1091
|
}
|
|
1249
1092
|
}
|
|
1250
1093
|
|
|
1251
|
-
function stripUndef$
|
|
1094
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1252
1095
|
|
|
1253
1096
|
class Projects {
|
|
1254
1097
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1261,7 +1104,7 @@ class Projects {
|
|
|
1261
1104
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1262
1105
|
const qs = query.toString();
|
|
1263
1106
|
if (qs) path += '?' + qs;
|
|
1264
|
-
const body = stripUndef$
|
|
1107
|
+
const body = stripUndef$2({
|
|
1265
1108
|
name: name,
|
|
1266
1109
|
private: private_,
|
|
1267
1110
|
type: type,
|
|
@@ -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)}`;
|
|
@@ -1338,7 +1174,7 @@ class Projects {
|
|
|
1338
1174
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1339
1175
|
this._ctx.requireTokens();
|
|
1340
1176
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1341
|
-
const body = stripUndef$
|
|
1177
|
+
const body = stripUndef$2({
|
|
1342
1178
|
private: private_,
|
|
1343
1179
|
type: type,
|
|
1344
1180
|
description: description,
|
|
@@ -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)}`;
|
|
@@ -1424,7 +1253,7 @@ class Projects {
|
|
|
1424
1253
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1425
1254
|
this._ctx.requireTokens();
|
|
1426
1255
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1427
|
-
const body = stripUndef$
|
|
1256
|
+
const body = stripUndef$2({
|
|
1428
1257
|
event: event,
|
|
1429
1258
|
detail: detail,
|
|
1430
1259
|
});
|
|
@@ -1496,13 +1325,6 @@ class Photoupload {
|
|
|
1496
1325
|
class Photos {
|
|
1497
1326
|
constructor(ctx) { this._ctx = ctx; }
|
|
1498
1327
|
|
|
1499
|
-
async addPhotoToProject({ photo, tableName, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, filePath, title, clientSideId }) {
|
|
1500
|
-
this._ctx.requireTokens();
|
|
1501
|
-
const path = `/api/v1/photos/`;
|
|
1502
|
-
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 });
|
|
1503
|
-
return data;
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
1328
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1507
1329
|
this._ctx.requireTokens();
|
|
1508
1330
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1600,6 +1422,8 @@ class Photos {
|
|
|
1600
1422
|
}
|
|
1601
1423
|
}
|
|
1602
1424
|
|
|
1425
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1426
|
+
|
|
1603
1427
|
class Search {
|
|
1604
1428
|
constructor(ctx) { this._ctx = ctx; }
|
|
1605
1429
|
|
|
@@ -1628,27 +1452,41 @@ class Search {
|
|
|
1628
1452
|
return data;
|
|
1629
1453
|
}
|
|
1630
1454
|
|
|
1631
|
-
async searchProjectPhotosText(projectTableName,
|
|
1455
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1632
1456
|
this._ctx.requireTokens();
|
|
1633
|
-
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
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);
|
|
1640
1474
|
return data;
|
|
1641
1475
|
}
|
|
1642
1476
|
|
|
1643
|
-
async
|
|
1477
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1644
1478
|
this._ctx.requireTokens();
|
|
1645
|
-
let path = `/api/v1/search/
|
|
1479
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1646
1480
|
const query = new URLSearchParams();
|
|
1647
|
-
if (
|
|
1648
|
-
if (
|
|
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));
|
|
1649
1483
|
const qs = query.toString();
|
|
1650
1484
|
if (qs) path += '?' + qs;
|
|
1651
|
-
const
|
|
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);
|
|
1652
1490
|
return data;
|
|
1653
1491
|
}
|
|
1654
1492
|
|
|
@@ -1776,18 +1614,6 @@ class Users {
|
|
|
1776
1614
|
return data;
|
|
1777
1615
|
}
|
|
1778
1616
|
|
|
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
1617
|
async updateUser(userId, { name, email, password, companyId, accountType, profilePicture, location, phoneNumber, birthday } = {}) {
|
|
1792
1618
|
this._ctx.requireTokens();
|
|
1793
1619
|
const path = `/api/v1/users/${encodeURIComponent(userId)}`;
|
|
@@ -1805,35 +1631,6 @@ class Users {
|
|
|
1805
1631
|
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1806
1632
|
return data;
|
|
1807
1633
|
}
|
|
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
1634
|
}
|
|
1838
1635
|
|
|
1839
1636
|
// Auto-generated — do not edit
|
|
@@ -1898,7 +1695,6 @@ class MediaViz {
|
|
|
1898
1695
|
|
|
1899
1696
|
const _ctx = new _Context(this);
|
|
1900
1697
|
this.aiModelCredits = new AiModelCredits(_ctx);
|
|
1901
|
-
this.admin = new Admin(_ctx);
|
|
1902
1698
|
this.company = new Company(_ctx);
|
|
1903
1699
|
this.curatedAlbums = new CuratedAlbums(_ctx);
|
|
1904
1700
|
this.customAlbums = new CustomAlbums(_ctx);
|
|
@@ -1906,7 +1702,6 @@ class MediaViz {
|
|
|
1906
1702
|
this.health = new Health(_ctx);
|
|
1907
1703
|
this.keywords = new Keywords(_ctx);
|
|
1908
1704
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
1909
|
-
this.oAuthClients = new OauthClients(_ctx);
|
|
1910
1705
|
this.oAuthToken = new OauthToken(_ctx);
|
|
1911
1706
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
1912
1707
|
this.person = new Person(_ctx);
|
|
@@ -1944,4 +1739,4 @@ class MediaViz {
|
|
|
1944
1739
|
get refreshToken() { return this._refreshToken; }
|
|
1945
1740
|
}
|
|
1946
1741
|
|
|
1947
|
-
export {
|
|
1742
|
+
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 };
|