@mediaviz/sdk 1.10.0 → 1.11.0-dev.125
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 +89 -16
- package/dist/sdk.d.cts +213 -172
- package/dist/sdk.d.ts +213 -172
- package/dist/sdk.esm.d.ts +213 -172
- package/dist/sdk.esm.js +88 -17
- package/dist/sdk.umd.js +89 -16
- package/package.json +1 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -1113,6 +1113,8 @@ class AiModelCredits {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
+
function stripUndef$a(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1117
|
+
|
|
1116
1118
|
class Admin {
|
|
1117
1119
|
constructor(ctx) { this._ctx = ctx; }
|
|
1118
1120
|
|
|
@@ -1122,6 +1124,16 @@ class Admin {
|
|
|
1122
1124
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1123
1125
|
return data;
|
|
1124
1126
|
}
|
|
1127
|
+
|
|
1128
|
+
async adminSetCompanyCanManageApiClients(companyId, canManageApiClients) {
|
|
1129
|
+
this._ctx.requireTokens();
|
|
1130
|
+
const path = `/api/v1/admin/companies/${encodeURIComponent(companyId)}/can_manage_api_clients`;
|
|
1131
|
+
const body = stripUndef$a({
|
|
1132
|
+
can_manage_api_clients: canManageApiClients,
|
|
1133
|
+
});
|
|
1134
|
+
const { data } = await this._ctx.client.request(path, 'PATCH', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1135
|
+
return data;
|
|
1136
|
+
}
|
|
1125
1137
|
}
|
|
1126
1138
|
|
|
1127
1139
|
class Company {
|
|
@@ -1147,7 +1159,7 @@ class Company {
|
|
|
1147
1159
|
}
|
|
1148
1160
|
}
|
|
1149
1161
|
|
|
1150
|
-
function stripUndef$
|
|
1162
|
+
function stripUndef$9(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1151
1163
|
|
|
1152
1164
|
class CuratedAlbums {
|
|
1153
1165
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1155,7 +1167,7 @@ class CuratedAlbums {
|
|
|
1155
1167
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1156
1168
|
this._ctx.requireTokens();
|
|
1157
1169
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1158
|
-
const body = stripUndef$
|
|
1170
|
+
const body = stripUndef$9({
|
|
1159
1171
|
name: name,
|
|
1160
1172
|
description: description,
|
|
1161
1173
|
confidence_value: confidenceValue,
|
|
@@ -1209,7 +1221,7 @@ class CuratedAlbums {
|
|
|
1209
1221
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1210
1222
|
this._ctx.requireTokens();
|
|
1211
1223
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1212
|
-
const body = stripUndef$
|
|
1224
|
+
const body = stripUndef$9({
|
|
1213
1225
|
name: name,
|
|
1214
1226
|
description: description,
|
|
1215
1227
|
confidence_value: confidenceValue,
|
|
@@ -1233,7 +1245,7 @@ class CuratedAlbums {
|
|
|
1233
1245
|
}
|
|
1234
1246
|
}
|
|
1235
1247
|
|
|
1236
|
-
function stripUndef$
|
|
1248
|
+
function stripUndef$8(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1237
1249
|
|
|
1238
1250
|
class CustomAlbums {
|
|
1239
1251
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1281,7 +1293,7 @@ class CustomAlbums {
|
|
|
1281
1293
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1282
1294
|
this._ctx.requireTokens();
|
|
1283
1295
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1284
|
-
const body = stripUndef$
|
|
1296
|
+
const body = stripUndef$8({
|
|
1285
1297
|
name: name,
|
|
1286
1298
|
description: description,
|
|
1287
1299
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1294,7 +1306,7 @@ class CustomAlbums {
|
|
|
1294
1306
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1295
1307
|
this._ctx.requireTokens();
|
|
1296
1308
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1297
|
-
const body = stripUndef$
|
|
1309
|
+
const body = stripUndef$8({
|
|
1298
1310
|
name: name,
|
|
1299
1311
|
description: description,
|
|
1300
1312
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1394,7 +1406,7 @@ async function handleResponse(response) {
|
|
|
1394
1406
|
}
|
|
1395
1407
|
}
|
|
1396
1408
|
|
|
1397
|
-
function stripUndef$
|
|
1409
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1398
1410
|
|
|
1399
1411
|
class EmailTokens {
|
|
1400
1412
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1425,7 +1437,7 @@ class EmailTokens {
|
|
|
1425
1437
|
}
|
|
1426
1438
|
|
|
1427
1439
|
async validateToken(token) {
|
|
1428
|
-
const body = stripUndef$
|
|
1440
|
+
const body = stripUndef$7({
|
|
1429
1441
|
token: token,
|
|
1430
1442
|
});
|
|
1431
1443
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1437,7 +1449,7 @@ class EmailTokens {
|
|
|
1437
1449
|
}
|
|
1438
1450
|
|
|
1439
1451
|
async resetPassword(token, newPassword) {
|
|
1440
|
-
const body = stripUndef$
|
|
1452
|
+
const body = stripUndef$7({
|
|
1441
1453
|
token: token,
|
|
1442
1454
|
new_password: newPassword,
|
|
1443
1455
|
});
|
|
@@ -1476,7 +1488,7 @@ class Health {
|
|
|
1476
1488
|
}
|
|
1477
1489
|
}
|
|
1478
1490
|
|
|
1479
|
-
function stripUndef$
|
|
1491
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1480
1492
|
|
|
1481
1493
|
class Keywords {
|
|
1482
1494
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1484,7 +1496,7 @@ class Keywords {
|
|
|
1484
1496
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1485
1497
|
this._ctx.requireTokens();
|
|
1486
1498
|
const path = `/api/v1/keyword/`;
|
|
1487
|
-
const body = stripUndef$
|
|
1499
|
+
const body = stripUndef$6({
|
|
1488
1500
|
name: name,
|
|
1489
1501
|
project_list: projectList,
|
|
1490
1502
|
});
|
|
@@ -1537,7 +1549,7 @@ class Keywords {
|
|
|
1537
1549
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1538
1550
|
this._ctx.requireTokens();
|
|
1539
1551
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1540
|
-
const body = stripUndef$
|
|
1552
|
+
const body = stripUndef$6({
|
|
1541
1553
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1542
1554
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1543
1555
|
});
|
|
@@ -1548,7 +1560,7 @@ class Keywords {
|
|
|
1548
1560
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1549
1561
|
this._ctx.requireTokens();
|
|
1550
1562
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1551
|
-
const body = stripUndef$
|
|
1563
|
+
const body = stripUndef$6({
|
|
1552
1564
|
name: name,
|
|
1553
1565
|
project_list: projectList,
|
|
1554
1566
|
});
|
|
@@ -1681,6 +1693,36 @@ class OauthAuthorization {
|
|
|
1681
1693
|
}
|
|
1682
1694
|
}
|
|
1683
1695
|
|
|
1696
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1697
|
+
|
|
1698
|
+
class OauthClients {
|
|
1699
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
1700
|
+
|
|
1701
|
+
async createApiCredential(credentialName) {
|
|
1702
|
+
this._ctx.requireTokens();
|
|
1703
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1704
|
+
const body = stripUndef$5({
|
|
1705
|
+
credential_name: credentialName,
|
|
1706
|
+
});
|
|
1707
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1708
|
+
return data;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
async getCompanyApiCredentials() {
|
|
1712
|
+
this._ctx.requireTokens();
|
|
1713
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1714
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1715
|
+
return data;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
async revokeApiCredential(clientId) {
|
|
1719
|
+
this._ctx.requireTokens();
|
|
1720
|
+
const path = `/oauth/clients/api-credentials/${encodeURIComponent(clientId)}/revoke`;
|
|
1721
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1722
|
+
return data;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1684
1726
|
class OauthToken {
|
|
1685
1727
|
constructor(ctx) { this._ctx = ctx; }
|
|
1686
1728
|
|
|
@@ -1994,7 +2036,7 @@ class Projects {
|
|
|
1994
2036
|
class Photoupload {
|
|
1995
2037
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1996
2038
|
|
|
1997
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2039
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, judgment, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
1998
2040
|
this._ctx.requireTokens();
|
|
1999
2041
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2000
2042
|
const headers = {
|
|
@@ -2004,7 +2046,7 @@ class Photoupload {
|
|
|
2004
2046
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2005
2047
|
method: 'POST',
|
|
2006
2048
|
headers,
|
|
2007
|
-
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2049
|
+
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, judgment, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2008
2050
|
});
|
|
2009
2051
|
return handleResponse(resp);
|
|
2010
2052
|
}
|
|
@@ -2020,7 +2062,7 @@ class Photoupload {
|
|
|
2020
2062
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2021
2063
|
}
|
|
2022
2064
|
|
|
2023
|
-
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2065
|
+
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), (((template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === true || (template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2024
2066
|
|
|
2025
2067
|
return upload_result;
|
|
2026
2068
|
}
|
|
@@ -2434,6 +2476,32 @@ class Users {
|
|
|
2434
2476
|
}
|
|
2435
2477
|
}
|
|
2436
2478
|
|
|
2479
|
+
class Webhookreceiver {
|
|
2480
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
2481
|
+
|
|
2482
|
+
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2483
|
+
this._ctx.requireTokens();
|
|
2484
|
+
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2485
|
+
const headers = {
|
|
2486
|
+
'Content-Type': 'application/json',
|
|
2487
|
+
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2488
|
+
};
|
|
2489
|
+
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2490
|
+
const query = new URLSearchParams();
|
|
2491
|
+
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2492
|
+
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2493
|
+
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2494
|
+
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2495
|
+
const qs = query.toString();
|
|
2496
|
+
if (qs) path += '?' + qs;
|
|
2497
|
+
const resp = await fetch(baseUrl + path, {
|
|
2498
|
+
method: 'GET',
|
|
2499
|
+
headers,
|
|
2500
|
+
});
|
|
2501
|
+
return handleResponse(resp);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2437
2505
|
// Auto-generated — do not edit
|
|
2438
2506
|
|
|
2439
2507
|
function _env(key) {
|
|
@@ -2480,6 +2548,7 @@ class MediaViz {
|
|
|
2480
2548
|
};
|
|
2481
2549
|
this._hosts = {
|
|
2482
2550
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2551
|
+
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2483
2552
|
...(config.hosts || {}),
|
|
2484
2553
|
};
|
|
2485
2554
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2504,6 +2573,7 @@ class MediaViz {
|
|
|
2504
2573
|
this.health = new Health(_ctx);
|
|
2505
2574
|
this.keywords = new Keywords(_ctx);
|
|
2506
2575
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2576
|
+
this.oAuthClients = new OauthClients(_ctx);
|
|
2507
2577
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2508
2578
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
2509
2579
|
this.person = new Person(_ctx);
|
|
@@ -2513,6 +2583,7 @@ class MediaViz {
|
|
|
2513
2583
|
this.search = new Search(_ctx);
|
|
2514
2584
|
this.subscription = new Subscription(_ctx);
|
|
2515
2585
|
this.users = new Users(_ctx);
|
|
2586
|
+
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2516
2587
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2517
2588
|
}
|
|
2518
2589
|
|
|
@@ -2543,4 +2614,4 @@ class MediaViz {
|
|
|
2543
2614
|
get refreshToken() { return this._refreshToken; }
|
|
2544
2615
|
}
|
|
2545
2616
|
|
|
2546
|
-
export { Admin, AiModelCredits, ApiError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Subscription, Users, ValidationError, WEBHOOK_MODEL_COLUMNS, WEBHOOK_OUTCOME_MODELS, WebhookConsumer, configureCrypto, handleResponse, selectResultColumns, signWebhookPayload, verifyWebhookSignature };
|
|
2617
|
+
export { Admin, AiModelCredits, ApiError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthClients, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Subscription, Users, ValidationError, WEBHOOK_MODEL_COLUMNS, WEBHOOK_OUTCOME_MODELS, WebhookConsumer, Webhookreceiver, configureCrypto, handleResponse, selectResultColumns, signWebhookPayload, verifyWebhookSignature };
|
package/dist/sdk.umd.js
CHANGED
|
@@ -1119,6 +1119,8 @@
|
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
+
function stripUndef$a(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1123
|
+
|
|
1122
1124
|
class Admin {
|
|
1123
1125
|
constructor(ctx) { this._ctx = ctx; }
|
|
1124
1126
|
|
|
@@ -1128,6 +1130,16 @@
|
|
|
1128
1130
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1129
1131
|
return data;
|
|
1130
1132
|
}
|
|
1133
|
+
|
|
1134
|
+
async adminSetCompanyCanManageApiClients(companyId, canManageApiClients) {
|
|
1135
|
+
this._ctx.requireTokens();
|
|
1136
|
+
const path = `/api/v1/admin/companies/${encodeURIComponent(companyId)}/can_manage_api_clients`;
|
|
1137
|
+
const body = stripUndef$a({
|
|
1138
|
+
can_manage_api_clients: canManageApiClients,
|
|
1139
|
+
});
|
|
1140
|
+
const { data } = await this._ctx.client.request(path, 'PATCH', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1141
|
+
return data;
|
|
1142
|
+
}
|
|
1131
1143
|
}
|
|
1132
1144
|
|
|
1133
1145
|
class Company {
|
|
@@ -1153,7 +1165,7 @@
|
|
|
1153
1165
|
}
|
|
1154
1166
|
}
|
|
1155
1167
|
|
|
1156
|
-
function stripUndef$
|
|
1168
|
+
function stripUndef$9(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1157
1169
|
|
|
1158
1170
|
class CuratedAlbums {
|
|
1159
1171
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1161,7 +1173,7 @@
|
|
|
1161
1173
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1162
1174
|
this._ctx.requireTokens();
|
|
1163
1175
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1164
|
-
const body = stripUndef$
|
|
1176
|
+
const body = stripUndef$9({
|
|
1165
1177
|
name: name,
|
|
1166
1178
|
description: description,
|
|
1167
1179
|
confidence_value: confidenceValue,
|
|
@@ -1215,7 +1227,7 @@
|
|
|
1215
1227
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1216
1228
|
this._ctx.requireTokens();
|
|
1217
1229
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1218
|
-
const body = stripUndef$
|
|
1230
|
+
const body = stripUndef$9({
|
|
1219
1231
|
name: name,
|
|
1220
1232
|
description: description,
|
|
1221
1233
|
confidence_value: confidenceValue,
|
|
@@ -1239,7 +1251,7 @@
|
|
|
1239
1251
|
}
|
|
1240
1252
|
}
|
|
1241
1253
|
|
|
1242
|
-
function stripUndef$
|
|
1254
|
+
function stripUndef$8(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1243
1255
|
|
|
1244
1256
|
class CustomAlbums {
|
|
1245
1257
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1287,7 +1299,7 @@
|
|
|
1287
1299
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1288
1300
|
this._ctx.requireTokens();
|
|
1289
1301
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1290
|
-
const body = stripUndef$
|
|
1302
|
+
const body = stripUndef$8({
|
|
1291
1303
|
name: name,
|
|
1292
1304
|
description: description,
|
|
1293
1305
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1300,7 +1312,7 @@
|
|
|
1300
1312
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1301
1313
|
this._ctx.requireTokens();
|
|
1302
1314
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1303
|
-
const body = stripUndef$
|
|
1315
|
+
const body = stripUndef$8({
|
|
1304
1316
|
name: name,
|
|
1305
1317
|
description: description,
|
|
1306
1318
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1400,7 +1412,7 @@
|
|
|
1400
1412
|
}
|
|
1401
1413
|
}
|
|
1402
1414
|
|
|
1403
|
-
function stripUndef$
|
|
1415
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1404
1416
|
|
|
1405
1417
|
class EmailTokens {
|
|
1406
1418
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1431,7 +1443,7 @@
|
|
|
1431
1443
|
}
|
|
1432
1444
|
|
|
1433
1445
|
async validateToken(token) {
|
|
1434
|
-
const body = stripUndef$
|
|
1446
|
+
const body = stripUndef$7({
|
|
1435
1447
|
token: token,
|
|
1436
1448
|
});
|
|
1437
1449
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1443,7 +1455,7 @@
|
|
|
1443
1455
|
}
|
|
1444
1456
|
|
|
1445
1457
|
async resetPassword(token, newPassword) {
|
|
1446
|
-
const body = stripUndef$
|
|
1458
|
+
const body = stripUndef$7({
|
|
1447
1459
|
token: token,
|
|
1448
1460
|
new_password: newPassword,
|
|
1449
1461
|
});
|
|
@@ -1482,7 +1494,7 @@
|
|
|
1482
1494
|
}
|
|
1483
1495
|
}
|
|
1484
1496
|
|
|
1485
|
-
function stripUndef$
|
|
1497
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1486
1498
|
|
|
1487
1499
|
class Keywords {
|
|
1488
1500
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1490,7 +1502,7 @@
|
|
|
1490
1502
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1491
1503
|
this._ctx.requireTokens();
|
|
1492
1504
|
const path = `/api/v1/keyword/`;
|
|
1493
|
-
const body = stripUndef$
|
|
1505
|
+
const body = stripUndef$6({
|
|
1494
1506
|
name: name,
|
|
1495
1507
|
project_list: projectList,
|
|
1496
1508
|
});
|
|
@@ -1543,7 +1555,7 @@
|
|
|
1543
1555
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1544
1556
|
this._ctx.requireTokens();
|
|
1545
1557
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1546
|
-
const body = stripUndef$
|
|
1558
|
+
const body = stripUndef$6({
|
|
1547
1559
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1548
1560
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1549
1561
|
});
|
|
@@ -1554,7 +1566,7 @@
|
|
|
1554
1566
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1555
1567
|
this._ctx.requireTokens();
|
|
1556
1568
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1557
|
-
const body = stripUndef$
|
|
1569
|
+
const body = stripUndef$6({
|
|
1558
1570
|
name: name,
|
|
1559
1571
|
project_list: projectList,
|
|
1560
1572
|
});
|
|
@@ -1687,6 +1699,36 @@
|
|
|
1687
1699
|
}
|
|
1688
1700
|
}
|
|
1689
1701
|
|
|
1702
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1703
|
+
|
|
1704
|
+
class OauthClients {
|
|
1705
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
1706
|
+
|
|
1707
|
+
async createApiCredential(credentialName) {
|
|
1708
|
+
this._ctx.requireTokens();
|
|
1709
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1710
|
+
const body = stripUndef$5({
|
|
1711
|
+
credential_name: credentialName,
|
|
1712
|
+
});
|
|
1713
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1714
|
+
return data;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
async getCompanyApiCredentials() {
|
|
1718
|
+
this._ctx.requireTokens();
|
|
1719
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1720
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1721
|
+
return data;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
async revokeApiCredential(clientId) {
|
|
1725
|
+
this._ctx.requireTokens();
|
|
1726
|
+
const path = `/oauth/clients/api-credentials/${encodeURIComponent(clientId)}/revoke`;
|
|
1727
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1728
|
+
return data;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1690
1732
|
class OauthToken {
|
|
1691
1733
|
constructor(ctx) { this._ctx = ctx; }
|
|
1692
1734
|
|
|
@@ -2000,7 +2042,7 @@
|
|
|
2000
2042
|
class Photoupload {
|
|
2001
2043
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
2002
2044
|
|
|
2003
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2045
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, judgment, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2004
2046
|
this._ctx.requireTokens();
|
|
2005
2047
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2006
2048
|
const headers = {
|
|
@@ -2010,7 +2052,7 @@
|
|
|
2010
2052
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2011
2053
|
method: 'POST',
|
|
2012
2054
|
headers,
|
|
2013
|
-
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2055
|
+
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, judgment, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2014
2056
|
});
|
|
2015
2057
|
return handleResponse(resp);
|
|
2016
2058
|
}
|
|
@@ -2026,7 +2068,7 @@
|
|
|
2026
2068
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2027
2069
|
}
|
|
2028
2070
|
|
|
2029
|
-
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2071
|
+
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), (((template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === true || (template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2030
2072
|
|
|
2031
2073
|
return upload_result;
|
|
2032
2074
|
}
|
|
@@ -2440,6 +2482,32 @@
|
|
|
2440
2482
|
}
|
|
2441
2483
|
}
|
|
2442
2484
|
|
|
2485
|
+
class Webhookreceiver {
|
|
2486
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
2487
|
+
|
|
2488
|
+
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2489
|
+
this._ctx.requireTokens();
|
|
2490
|
+
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2491
|
+
const headers = {
|
|
2492
|
+
'Content-Type': 'application/json',
|
|
2493
|
+
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2494
|
+
};
|
|
2495
|
+
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2496
|
+
const query = new URLSearchParams();
|
|
2497
|
+
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2498
|
+
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2499
|
+
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2500
|
+
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2501
|
+
const qs = query.toString();
|
|
2502
|
+
if (qs) path += '?' + qs;
|
|
2503
|
+
const resp = await fetch(baseUrl + path, {
|
|
2504
|
+
method: 'GET',
|
|
2505
|
+
headers,
|
|
2506
|
+
});
|
|
2507
|
+
return handleResponse(resp);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2443
2511
|
// Auto-generated — do not edit
|
|
2444
2512
|
|
|
2445
2513
|
function _env(key) {
|
|
@@ -2486,6 +2554,7 @@
|
|
|
2486
2554
|
};
|
|
2487
2555
|
this._hosts = {
|
|
2488
2556
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2557
|
+
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2489
2558
|
...(config.hosts || {}),
|
|
2490
2559
|
};
|
|
2491
2560
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2510,6 +2579,7 @@
|
|
|
2510
2579
|
this.health = new Health(_ctx);
|
|
2511
2580
|
this.keywords = new Keywords(_ctx);
|
|
2512
2581
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2582
|
+
this.oAuthClients = new OauthClients(_ctx);
|
|
2513
2583
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2514
2584
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
2515
2585
|
this.person = new Person(_ctx);
|
|
@@ -2519,6 +2589,7 @@
|
|
|
2519
2589
|
this.search = new Search(_ctx);
|
|
2520
2590
|
this.subscription = new Subscription(_ctx);
|
|
2521
2591
|
this.users = new Users(_ctx);
|
|
2592
|
+
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2522
2593
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2523
2594
|
}
|
|
2524
2595
|
|
|
@@ -2565,6 +2636,7 @@
|
|
|
2565
2636
|
exports.OAuthError = OAuthError;
|
|
2566
2637
|
exports.OAuthErrorCode = OAuthErrorCode;
|
|
2567
2638
|
exports.OauthAuthorization = OauthAuthorization;
|
|
2639
|
+
exports.OauthClients = OauthClients;
|
|
2568
2640
|
exports.OauthLogin = OauthLogin;
|
|
2569
2641
|
exports.OauthToken = OauthToken;
|
|
2570
2642
|
exports.Person = Person;
|
|
@@ -2580,6 +2652,7 @@
|
|
|
2580
2652
|
exports.WEBHOOK_MODEL_COLUMNS = WEBHOOK_MODEL_COLUMNS;
|
|
2581
2653
|
exports.WEBHOOK_OUTCOME_MODELS = WEBHOOK_OUTCOME_MODELS;
|
|
2582
2654
|
exports.WebhookConsumer = WebhookConsumer;
|
|
2655
|
+
exports.Webhookreceiver = Webhookreceiver;
|
|
2583
2656
|
exports.configureCrypto = configureCrypto;
|
|
2584
2657
|
exports.handleResponse = handleResponse;
|
|
2585
2658
|
exports.selectResultColumns = selectResultColumns;
|