@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MediaViz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/sdk.cjs
CHANGED
|
@@ -456,124 +456,11 @@ class AiModelCredits {
|
|
|
456
456
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
457
457
|
return data;
|
|
458
458
|
}
|
|
459
|
-
|
|
460
|
-
async upsertModelCreditRelationship({ modelName, newCreditValue } = {}) {
|
|
461
|
-
this._ctx.requireTokens();
|
|
462
|
-
let path = `/api/v1/model_credit/upsert`;
|
|
463
|
-
const query = new URLSearchParams();
|
|
464
|
-
if (modelName !== undefined) (Array.isArray(modelName) ? modelName : [modelName]).forEach(v => query.append('model_name', v));
|
|
465
|
-
if (newCreditValue !== undefined) (Array.isArray(newCreditValue) ? newCreditValue : [newCreditValue]).forEach(v => query.append('new_credit_value', v));
|
|
466
|
-
const qs = query.toString();
|
|
467
|
-
if (qs) path += '?' + qs;
|
|
468
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
469
|
-
return data;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
class Admin {
|
|
474
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
475
|
-
|
|
476
|
-
async insertLabelCategoryMatrix() {
|
|
477
|
-
this._ctx.requireTokens();
|
|
478
|
-
const path = `/api/v1/admin/insert_label_category_matrix`;
|
|
479
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
480
|
-
return data;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async generateMidLevelCategoryKeywordAlignment() {
|
|
484
|
-
this._ctx.requireTokens();
|
|
485
|
-
const path = `/api/v1/admin/generate_mid_level_category_keyword_alignment`;
|
|
486
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
487
|
-
return data;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
async getCategoryLabels(category) {
|
|
491
|
-
this._ctx.requireTokens();
|
|
492
|
-
const path = `/api/v1/admin/category_labels/${encodeURIComponent(category)}`;
|
|
493
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
494
|
-
return data;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
async adminDumpCompanyNlpIndex(companyId) {
|
|
498
|
-
this._ctx.requireTokens();
|
|
499
|
-
const path = `/api/v1/admin/dump_company_nlp_index/${encodeURIComponent(companyId)}`;
|
|
500
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
501
|
-
return data;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
async getAllKeywordGroupsAndSubgroups() {
|
|
505
|
-
this._ctx.requireTokens();
|
|
506
|
-
const path = `/api/v1/admin/keyword_group`;
|
|
507
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
508
|
-
return data;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
async getKeywordGroupsLabelsByKeywordGroup(keywordGroup, { subgroup } = {}) {
|
|
512
|
-
this._ctx.requireTokens();
|
|
513
|
-
let path = `/api/v1/admin/keyword_group/${encodeURIComponent(keywordGroup)}/`;
|
|
514
|
-
const query = new URLSearchParams();
|
|
515
|
-
if (subgroup !== undefined) (Array.isArray(subgroup) ? subgroup : [subgroup]).forEach(v => query.append('subgroup', v));
|
|
516
|
-
const qs = query.toString();
|
|
517
|
-
if (qs) path += '?' + qs;
|
|
518
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
519
|
-
return data;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
async adminCreateCompanyNlpIndexes({ companyIds } = {}) {
|
|
523
|
-
this._ctx.requireTokens();
|
|
524
|
-
let path = `/api/v1/admin/create_company_nlp_indexes/`;
|
|
525
|
-
const query = new URLSearchParams();
|
|
526
|
-
if (companyIds !== undefined) (Array.isArray(companyIds) ? companyIds : [companyIds]).forEach(v => query.append('company_ids', v));
|
|
527
|
-
const qs = query.toString();
|
|
528
|
-
if (qs) path += '?' + qs;
|
|
529
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
530
|
-
return data;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
async adminDeleteCompanyNlpIndexes({ companyIds } = {}) {
|
|
534
|
-
this._ctx.requireTokens();
|
|
535
|
-
let path = `/api/v1/admin/delete_company_nlp_indexes/`;
|
|
536
|
-
const query = new URLSearchParams();
|
|
537
|
-
if (companyIds !== undefined) (Array.isArray(companyIds) ? companyIds : [companyIds]).forEach(v => query.append('company_ids', v));
|
|
538
|
-
const qs = query.toString();
|
|
539
|
-
if (qs) path += '?' + qs;
|
|
540
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
541
|
-
return data;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
async adminDeleteUserProjects({ userIds } = {}) {
|
|
545
|
-
this._ctx.requireTokens();
|
|
546
|
-
let path = `/api/v1/admin/delete_user_projects/`;
|
|
547
|
-
const query = new URLSearchParams();
|
|
548
|
-
if (userIds !== undefined) (Array.isArray(userIds) ? userIds : [userIds]).forEach(v => query.append('user_ids', v));
|
|
549
|
-
const qs = query.toString();
|
|
550
|
-
if (qs) path += '?' + qs;
|
|
551
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
552
|
-
return data;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
async adminDeleteUser({ userIds } = {}) {
|
|
556
|
-
this._ctx.requireTokens();
|
|
557
|
-
let path = `/api/v1/admin/delete_user/`;
|
|
558
|
-
const query = new URLSearchParams();
|
|
559
|
-
if (userIds !== undefined) (Array.isArray(userIds) ? userIds : [userIds]).forEach(v => query.append('user_ids', v));
|
|
560
|
-
const qs = query.toString();
|
|
561
|
-
if (qs) path += '?' + qs;
|
|
562
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
563
|
-
return data;
|
|
564
|
-
}
|
|
565
459
|
}
|
|
566
460
|
|
|
567
461
|
class Company {
|
|
568
462
|
constructor(ctx) { this._ctx = ctx; }
|
|
569
463
|
|
|
570
|
-
async getAllCompanies() {
|
|
571
|
-
this._ctx.requireTokens();
|
|
572
|
-
const path = `/api/v1/company/`;
|
|
573
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
574
|
-
return data;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
464
|
async getCompanyById(companyId) {
|
|
578
465
|
this._ctx.requireTokens();
|
|
579
466
|
const path = `/api/v1/company/${encodeURIComponent(companyId)}`;
|
|
@@ -592,31 +479,6 @@ class Company {
|
|
|
592
479
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
593
480
|
return data;
|
|
594
481
|
}
|
|
595
|
-
|
|
596
|
-
async adminListActiveCompanyTokens() {
|
|
597
|
-
this._ctx.requireTokens();
|
|
598
|
-
const path = `/api/v1/company/admin_create/`;
|
|
599
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
600
|
-
return data;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
async adminCreateCompanyToken({ email } = {}) {
|
|
604
|
-
this._ctx.requireTokens();
|
|
605
|
-
let path = `/api/v1/company/admin_create/`;
|
|
606
|
-
const query = new URLSearchParams();
|
|
607
|
-
if (email !== undefined) (Array.isArray(email) ? email : [email]).forEach(v => query.append('email', v));
|
|
608
|
-
const qs = query.toString();
|
|
609
|
-
if (qs) path += '?' + qs;
|
|
610
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
611
|
-
return data;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
async adminRevokeCompanyToken(tokenId) {
|
|
615
|
-
this._ctx.requireTokens();
|
|
616
|
-
const path = `/api/v1/company/admin_create/${encodeURIComponent(tokenId)}/revoke/`;
|
|
617
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
618
|
-
return data;
|
|
619
|
-
}
|
|
620
482
|
}
|
|
621
483
|
|
|
622
484
|
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
@@ -1124,25 +986,6 @@ class OauthAuthorization {
|
|
|
1124
986
|
}
|
|
1125
987
|
}
|
|
1126
988
|
|
|
1127
|
-
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1128
|
-
|
|
1129
|
-
class OauthClients {
|
|
1130
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
1131
|
-
|
|
1132
|
-
async createClient(clientName, clientType, redirectUris, isFirstParty) {
|
|
1133
|
-
this._ctx.requireTokens();
|
|
1134
|
-
const path = `/oauth/clients`;
|
|
1135
|
-
const body = stripUndef$2({
|
|
1136
|
-
client_name: clientName,
|
|
1137
|
-
client_type: clientType,
|
|
1138
|
-
redirect_uris: redirectUris,
|
|
1139
|
-
is_first_party: isFirstParty,
|
|
1140
|
-
});
|
|
1141
|
-
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1142
|
-
return data;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
989
|
class OauthToken {
|
|
1147
990
|
constructor(ctx) { this._ctx = ctx; }
|
|
1148
991
|
|
|
@@ -1250,7 +1093,7 @@ class Person {
|
|
|
1250
1093
|
}
|
|
1251
1094
|
}
|
|
1252
1095
|
|
|
1253
|
-
function stripUndef$
|
|
1096
|
+
function stripUndef$2(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1254
1097
|
|
|
1255
1098
|
class Projects {
|
|
1256
1099
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1263,7 +1106,7 @@ class Projects {
|
|
|
1263
1106
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1264
1107
|
const qs = query.toString();
|
|
1265
1108
|
if (qs) path += '?' + qs;
|
|
1266
|
-
const body = stripUndef$
|
|
1109
|
+
const body = stripUndef$2({
|
|
1267
1110
|
name: name,
|
|
1268
1111
|
private: private_,
|
|
1269
1112
|
type: type,
|
|
@@ -1316,13 +1159,6 @@ class Projects {
|
|
|
1316
1159
|
return data;
|
|
1317
1160
|
}
|
|
1318
1161
|
|
|
1319
|
-
async getAllUserProjectsAdmin(userId) {
|
|
1320
|
-
this._ctx.requireTokens();
|
|
1321
|
-
const path = `/api/v1/projects/admin/user/${encodeURIComponent(userId)}`;
|
|
1322
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1323
|
-
return data;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
1162
|
async getProjectById(projectId) {
|
|
1327
1163
|
this._ctx.requireTokens();
|
|
1328
1164
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
@@ -1340,7 +1176,7 @@ class Projects {
|
|
|
1340
1176
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1341
1177
|
this._ctx.requireTokens();
|
|
1342
1178
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1343
|
-
const body = stripUndef$
|
|
1179
|
+
const body = stripUndef$2({
|
|
1344
1180
|
private: private_,
|
|
1345
1181
|
type: type,
|
|
1346
1182
|
description: description,
|
|
@@ -1409,13 +1245,6 @@ class Projects {
|
|
|
1409
1245
|
return data;
|
|
1410
1246
|
}
|
|
1411
1247
|
|
|
1412
|
-
async requestProjectAdminExport(projectTableName) {
|
|
1413
|
-
this._ctx.requireTokens();
|
|
1414
|
-
const path = `/api/v1/projects_admin_export/${encodeURIComponent(projectTableName)}`;
|
|
1415
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1416
|
-
return data;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
1248
|
async getProjectDataExportUploadStatus(projectTableName, modelName) {
|
|
1420
1249
|
this._ctx.requireTokens();
|
|
1421
1250
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/upload_status/${encodeURIComponent(modelName)}`;
|
|
@@ -1426,7 +1255,7 @@ class Projects {
|
|
|
1426
1255
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1427
1256
|
this._ctx.requireTokens();
|
|
1428
1257
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1429
|
-
const body = stripUndef$
|
|
1258
|
+
const body = stripUndef$2({
|
|
1430
1259
|
event: event,
|
|
1431
1260
|
detail: detail,
|
|
1432
1261
|
});
|
|
@@ -1498,13 +1327,6 @@ class Photoupload {
|
|
|
1498
1327
|
class Photos {
|
|
1499
1328
|
constructor(ctx) { this._ctx = ctx; }
|
|
1500
1329
|
|
|
1501
|
-
async addPhotoToProject({ photo, tableName, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude, filePath, title, clientSideId }) {
|
|
1502
|
-
this._ctx.requireTokens();
|
|
1503
|
-
const path = `/api/v1/photos/`;
|
|
1504
|
-
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 });
|
|
1505
|
-
return data;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
1330
|
async getPhotoFromProject(tableName, photoId, { keywordListId } = {}) {
|
|
1509
1331
|
this._ctx.requireTokens();
|
|
1510
1332
|
let path = `/api/v1/photos/${encodeURIComponent(tableName)}/${encodeURIComponent(photoId)}`;
|
|
@@ -1602,6 +1424,8 @@ class Photos {
|
|
|
1602
1424
|
}
|
|
1603
1425
|
}
|
|
1604
1426
|
|
|
1427
|
+
function stripUndef$1(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1428
|
+
|
|
1605
1429
|
class Search {
|
|
1606
1430
|
constructor(ctx) { this._ctx = ctx; }
|
|
1607
1431
|
|
|
@@ -1630,27 +1454,41 @@ class Search {
|
|
|
1630
1454
|
return data;
|
|
1631
1455
|
}
|
|
1632
1456
|
|
|
1633
|
-
async searchProjectPhotosText(projectTableName,
|
|
1457
|
+
async searchProjectPhotosText(projectTableName, searchText, size = undefined) {
|
|
1634
1458
|
this._ctx.requireTokens();
|
|
1635
|
-
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1459
|
+
const path = `/api/v1/search/text/${encodeURIComponent(projectTableName)}/`;
|
|
1460
|
+
const body = stripUndef$1({
|
|
1461
|
+
search_text: searchText,
|
|
1462
|
+
size: size,
|
|
1463
|
+
});
|
|
1464
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1465
|
+
return data;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
async searchProjectPhotosNaturalLanguage(projectTableName, searchText, size = undefined) {
|
|
1469
|
+
this._ctx.requireTokens();
|
|
1470
|
+
const path = `/api/v1/search/nl/${encodeURIComponent(projectTableName)}/`;
|
|
1471
|
+
const body = stripUndef$1({
|
|
1472
|
+
search_text: searchText,
|
|
1473
|
+
size: size,
|
|
1474
|
+
});
|
|
1475
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1642
1476
|
return data;
|
|
1643
1477
|
}
|
|
1644
1478
|
|
|
1645
|
-
async
|
|
1479
|
+
async searchProjectPhotosNaturalLanguageHybrid(projectTableName, searchText, size = undefined, { blend, minCosine } = {}) {
|
|
1646
1480
|
this._ctx.requireTokens();
|
|
1647
|
-
let path = `/api/v1/search/
|
|
1481
|
+
let path = `/api/v1/search/nl_hybrid/${encodeURIComponent(projectTableName)}/`;
|
|
1648
1482
|
const query = new URLSearchParams();
|
|
1649
|
-
if (
|
|
1650
|
-
if (
|
|
1483
|
+
if (blend !== undefined) (Array.isArray(blend) ? blend : [blend]).forEach(v => query.append('blend', v));
|
|
1484
|
+
if (minCosine !== undefined) (Array.isArray(minCosine) ? minCosine : [minCosine]).forEach(v => query.append('min_cosine', v));
|
|
1651
1485
|
const qs = query.toString();
|
|
1652
1486
|
if (qs) path += '?' + qs;
|
|
1653
|
-
const
|
|
1487
|
+
const body = stripUndef$1({
|
|
1488
|
+
search_text: searchText,
|
|
1489
|
+
size: size,
|
|
1490
|
+
});
|
|
1491
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1654
1492
|
return data;
|
|
1655
1493
|
}
|
|
1656
1494
|
|
|
@@ -1778,18 +1616,6 @@ class Users {
|
|
|
1778
1616
|
return data;
|
|
1779
1617
|
}
|
|
1780
1618
|
|
|
1781
|
-
async getAllUsers(ascOrDesc, { lastId, limit } = {}) {
|
|
1782
|
-
this._ctx.requireTokens();
|
|
1783
|
-
let path = `/api/v1/users/admin/sort/${encodeURIComponent(ascOrDesc)}/`;
|
|
1784
|
-
const query = new URLSearchParams();
|
|
1785
|
-
if (lastId !== undefined) (Array.isArray(lastId) ? lastId : [lastId]).forEach(v => query.append('last_id', v));
|
|
1786
|
-
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
1787
|
-
const qs = query.toString();
|
|
1788
|
-
if (qs) path += '?' + qs;
|
|
1789
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1790
|
-
return data;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
1619
|
async updateUser(userId, { name, email, password, companyId, accountType, profilePicture, location, phoneNumber, birthday } = {}) {
|
|
1794
1620
|
this._ctx.requireTokens();
|
|
1795
1621
|
const path = `/api/v1/users/${encodeURIComponent(userId)}`;
|
|
@@ -1807,35 +1633,6 @@ class Users {
|
|
|
1807
1633
|
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1808
1634
|
return data;
|
|
1809
1635
|
}
|
|
1810
|
-
|
|
1811
|
-
async updateUserByAdmin(userId, { name, email, password, companyId, accountType, profilePicture, location, phoneNumber, birthday } = {}) {
|
|
1812
|
-
this._ctx.requireTokens();
|
|
1813
|
-
const path = `/api/v1/users/admin/${encodeURIComponent(userId)}`;
|
|
1814
|
-
const body = stripUndef({
|
|
1815
|
-
name: name,
|
|
1816
|
-
email: email,
|
|
1817
|
-
password: password,
|
|
1818
|
-
company_id: companyId,
|
|
1819
|
-
account_type: accountType,
|
|
1820
|
-
profile_picture: profilePicture,
|
|
1821
|
-
location: location,
|
|
1822
|
-
phone_number: phoneNumber,
|
|
1823
|
-
birthday: birthday,
|
|
1824
|
-
});
|
|
1825
|
-
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1826
|
-
return data;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
async deleteUser(userId, { newCompanyOwnerId } = {}) {
|
|
1830
|
-
this._ctx.requireTokens();
|
|
1831
|
-
let path = `/api/v1/users/delete/${encodeURIComponent(userId)}`;
|
|
1832
|
-
const query = new URLSearchParams();
|
|
1833
|
-
if (newCompanyOwnerId !== undefined) (Array.isArray(newCompanyOwnerId) ? newCompanyOwnerId : [newCompanyOwnerId]).forEach(v => query.append('new_company_owner_id', v));
|
|
1834
|
-
const qs = query.toString();
|
|
1835
|
-
if (qs) path += '?' + qs;
|
|
1836
|
-
const { data } = await this._ctx.client.request(path, 'DELETE', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1837
|
-
return data;
|
|
1838
|
-
}
|
|
1839
1636
|
}
|
|
1840
1637
|
|
|
1841
1638
|
// Auto-generated — do not edit
|
|
@@ -1900,7 +1697,6 @@ class MediaViz {
|
|
|
1900
1697
|
|
|
1901
1698
|
const _ctx = new _Context(this);
|
|
1902
1699
|
this.aiModelCredits = new AiModelCredits(_ctx);
|
|
1903
|
-
this.admin = new Admin(_ctx);
|
|
1904
1700
|
this.company = new Company(_ctx);
|
|
1905
1701
|
this.curatedAlbums = new CuratedAlbums(_ctx);
|
|
1906
1702
|
this.customAlbums = new CustomAlbums(_ctx);
|
|
@@ -1908,7 +1704,6 @@ class MediaViz {
|
|
|
1908
1704
|
this.health = new Health(_ctx);
|
|
1909
1705
|
this.keywords = new Keywords(_ctx);
|
|
1910
1706
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
1911
|
-
this.oAuthClients = new OauthClients(_ctx);
|
|
1912
1707
|
this.oAuthToken = new OauthToken(_ctx);
|
|
1913
1708
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
1914
1709
|
this.person = new Person(_ctx);
|
|
@@ -1946,7 +1741,6 @@ class MediaViz {
|
|
|
1946
1741
|
get refreshToken() { return this._refreshToken; }
|
|
1947
1742
|
}
|
|
1948
1743
|
|
|
1949
|
-
exports.Admin = Admin;
|
|
1950
1744
|
exports.AiModelCredits = AiModelCredits;
|
|
1951
1745
|
exports.ApiError = ApiError;
|
|
1952
1746
|
exports.Company = Company;
|
|
@@ -1961,7 +1755,6 @@ exports.OAuthClient = OAuthClient;
|
|
|
1961
1755
|
exports.OAuthError = OAuthError;
|
|
1962
1756
|
exports.OAuthErrorCode = OAuthErrorCode;
|
|
1963
1757
|
exports.OauthAuthorization = OauthAuthorization;
|
|
1964
|
-
exports.OauthClients = OauthClients;
|
|
1965
1758
|
exports.OauthLogin = OauthLogin;
|
|
1966
1759
|
exports.OauthToken = OauthToken;
|
|
1967
1760
|
exports.Person = Person;
|