@scalemule/sdk 0.0.70 → 0.0.72
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/README.md +27 -0
- package/dist/index.d.mts +380 -1
- package/dist/index.d.ts +380 -1
- package/dist/index.js +190 -12
- package/dist/index.mjs +187 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -309,6 +309,9 @@ __export(index_exports, {
|
|
|
309
309
|
CatalogService: () => CatalogService,
|
|
310
310
|
ChatService: () => ChatService,
|
|
311
311
|
CommunicationService: () => CommunicationService,
|
|
312
|
+
CommunityMapsEditorialService: () => CommunityMapsEditorialService,
|
|
313
|
+
CommunityMapsGeographyService: () => CommunityMapsGeographyService,
|
|
314
|
+
CommunityMapsService: () => CommunityMapsService,
|
|
312
315
|
ComplianceService: () => ComplianceService,
|
|
313
316
|
ConferenceService: () => ConferenceService,
|
|
314
317
|
CreatorMakerService: () => CreatorMakerService,
|
|
@@ -1182,7 +1185,7 @@ var ScaleMuleClient = class {
|
|
|
1182
1185
|
if (this.workspaceId) {
|
|
1183
1186
|
headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1184
1187
|
}
|
|
1185
|
-
if (!init.skipAuth && !this.sessionToken) {
|
|
1188
|
+
if (!init.skipAuth && !this.sessionToken && !Object.keys(headers).some((key) => key.toLowerCase() === "x-anonymous-id")) {
|
|
1186
1189
|
if (!this.anonymousId) {
|
|
1187
1190
|
try {
|
|
1188
1191
|
await this.ensureAnonymousId();
|
|
@@ -1379,14 +1382,12 @@ var ScaleMuleClient = class {
|
|
|
1379
1382
|
return { data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } };
|
|
1380
1383
|
}
|
|
1381
1384
|
if (options?.onProgress && typeof XMLHttpRequest !== "undefined") {
|
|
1382
|
-
return this.uploadWithXHR(url, buildFormData, options.onProgress, options
|
|
1385
|
+
return this.uploadWithXHR(url, buildFormData, options.onProgress, options);
|
|
1383
1386
|
}
|
|
1384
1387
|
const maxRetries = options?.retries ?? this.maxRetries;
|
|
1385
1388
|
let lastError = null;
|
|
1386
1389
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1387
|
-
const headers =
|
|
1388
|
-
if (this.sessionToken) headers["Authorization"] = `Bearer ${this.sessionToken}`;
|
|
1389
|
-
if (this.workspaceId) headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1390
|
+
const headers = await this.uploadHeaders(options);
|
|
1390
1391
|
try {
|
|
1391
1392
|
const response = await fetch(url, {
|
|
1392
1393
|
method: "POST",
|
|
@@ -1428,13 +1429,29 @@ var ScaleMuleClient = class {
|
|
|
1428
1429
|
}
|
|
1429
1430
|
return { data: null, error: lastError || { code: "upload_error", message: "Upload failed", status: 0 } };
|
|
1430
1431
|
}
|
|
1432
|
+
/** Preserve forwarded reader/auth context for both multipart transports. */
|
|
1433
|
+
async uploadHeaders(options) {
|
|
1434
|
+
const headers = { "x-api-key": this.apiKey, ...options?.headers };
|
|
1435
|
+
for (const name of Object.keys(headers)) {
|
|
1436
|
+
if (name.toLowerCase() === "content-type") delete headers[name];
|
|
1437
|
+
}
|
|
1438
|
+
if (this.sessionToken) headers["Authorization"] = `Bearer ${this.sessionToken}`;
|
|
1439
|
+
if (this.workspaceId) headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1440
|
+
if (!this.sessionToken && !Object.keys(headers).some((key) => key.toLowerCase() === "x-anonymous-id")) {
|
|
1441
|
+
headers["x-anonymous-id"] = await this.ensureAnonymousId();
|
|
1442
|
+
}
|
|
1443
|
+
return headers;
|
|
1444
|
+
}
|
|
1431
1445
|
/**
|
|
1432
1446
|
* Single upload with XMLHttpRequest for progress tracking.
|
|
1433
1447
|
* Supports abort via AbortSignal.
|
|
1434
1448
|
*/
|
|
1435
|
-
async uploadWithXHR(url, buildFormData, onProgress,
|
|
1449
|
+
async uploadWithXHR(url, buildFormData, onProgress, options) {
|
|
1450
|
+
const signal = options?.signal;
|
|
1451
|
+
const maxRetries = options?.retries ?? this.maxRetries;
|
|
1436
1452
|
let lastError = null;
|
|
1437
1453
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1454
|
+
const headers = await this.uploadHeaders(options);
|
|
1438
1455
|
const result = await new Promise((res) => {
|
|
1439
1456
|
const xhr = new XMLHttpRequest();
|
|
1440
1457
|
if (signal) {
|
|
@@ -1477,12 +1494,8 @@ var ScaleMuleClient = class {
|
|
|
1477
1494
|
res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
|
|
1478
1495
|
});
|
|
1479
1496
|
xhr.open("POST", url);
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
xhr.setRequestHeader("Authorization", `Bearer ${this.sessionToken}`);
|
|
1483
|
-
}
|
|
1484
|
-
if (this.workspaceId) {
|
|
1485
|
-
xhr.setRequestHeader("x-sm-workspace-id", this.workspaceId);
|
|
1497
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
1498
|
+
xhr.setRequestHeader(name, value);
|
|
1486
1499
|
}
|
|
1487
1500
|
xhr.send(buildFormData());
|
|
1488
1501
|
});
|
|
@@ -6914,6 +6927,167 @@ var ListingsService = class extends ServiceModule {
|
|
|
6914
6927
|
}
|
|
6915
6928
|
};
|
|
6916
6929
|
|
|
6930
|
+
// src/services/community-maps.ts
|
|
6931
|
+
var segment = (value) => encodeURIComponent(value);
|
|
6932
|
+
var CommunityMapsService = class extends ServiceModule {
|
|
6933
|
+
constructor(client) {
|
|
6934
|
+
super(client);
|
|
6935
|
+
this.basePath = "/v1/knowledge/community-maps";
|
|
6936
|
+
this.editorial = new CommunityMapsEditorialService(client);
|
|
6937
|
+
this.geography = new CommunityMapsGeographyService(client);
|
|
6938
|
+
}
|
|
6939
|
+
listCollections(query = {}, options) {
|
|
6940
|
+
return this._get(this.withQuery("/collections", { ...query }), options);
|
|
6941
|
+
}
|
|
6942
|
+
getCollection(slug, options) {
|
|
6943
|
+
return this._get("/collections/" + segment(slug), options);
|
|
6944
|
+
}
|
|
6945
|
+
listFeatures(slug, query = {}, options) {
|
|
6946
|
+
return this._get(this.withQuery("/collections/" + segment(slug) + "/features", { ...query }), options);
|
|
6947
|
+
}
|
|
6948
|
+
getFeature(slug, id, options) {
|
|
6949
|
+
return this._get("/collections/" + segment(slug) + "/features/" + segment(id), options);
|
|
6950
|
+
}
|
|
6951
|
+
createSubmission(slug, data, options) {
|
|
6952
|
+
return this.post("/collections/" + segment(slug) + "/submissions", data, options);
|
|
6953
|
+
}
|
|
6954
|
+
uploadPhoto(slug, submission, file, fields, options) {
|
|
6955
|
+
return this._upload(
|
|
6956
|
+
"/collections/" + segment(slug) + "/submissions/" + segment(submission) + "/media",
|
|
6957
|
+
file,
|
|
6958
|
+
{ caption: fields.caption, attribution: fields.attribution, rights_confirmed: String(fields.rights_confirmed) },
|
|
6959
|
+
options
|
|
6960
|
+
);
|
|
6961
|
+
}
|
|
6962
|
+
react(slug, feature, reaction, active = true, options) {
|
|
6963
|
+
return this.post(
|
|
6964
|
+
"/collections/" + segment(slug) + "/features/" + segment(feature) + "/reactions",
|
|
6965
|
+
{ reaction, active },
|
|
6966
|
+
options
|
|
6967
|
+
);
|
|
6968
|
+
}
|
|
6969
|
+
report(slug, feature, data, options) {
|
|
6970
|
+
return this.post("/collections/" + segment(slug) + "/features/" + segment(feature) + "/reports", data, options);
|
|
6971
|
+
}
|
|
6972
|
+
/** Proxy this path through your server; never append a secret API key to an image URL. */
|
|
6973
|
+
mediaPath(slug, media) {
|
|
6974
|
+
return this.basePath + "/collections/" + segment(slug) + "/media/" + segment(media);
|
|
6975
|
+
}
|
|
6976
|
+
};
|
|
6977
|
+
var CommunityMapsEditorialService = class _CommunityMapsEditorialService extends ServiceModule {
|
|
6978
|
+
constructor(client, applicationId) {
|
|
6979
|
+
super(client);
|
|
6980
|
+
this.applicationId = applicationId;
|
|
6981
|
+
this.basePath = "/v1/knowledge/community-maps/manage";
|
|
6982
|
+
}
|
|
6983
|
+
forApplication(id) {
|
|
6984
|
+
return new _CommunityMapsEditorialService(this.client, id);
|
|
6985
|
+
}
|
|
6986
|
+
path(path, query = {}) {
|
|
6987
|
+
return this.withQuery(path, { ...query, ...this.applicationId ? { application_id: this.applicationId } : {} });
|
|
6988
|
+
}
|
|
6989
|
+
listCollections(query = {}, options) {
|
|
6990
|
+
return this._get(this.path("/collections", { ...query }), options);
|
|
6991
|
+
}
|
|
6992
|
+
getCollection(id, options) {
|
|
6993
|
+
return this._get(this.path("/collections/" + segment(id)), options);
|
|
6994
|
+
}
|
|
6995
|
+
createCollection(data, options) {
|
|
6996
|
+
return this.post(this.path("/collections"), data, options);
|
|
6997
|
+
}
|
|
6998
|
+
updateCollection(id, data, options) {
|
|
6999
|
+
return this.put(this.path("/collections/" + segment(id)), data, options);
|
|
7000
|
+
}
|
|
7001
|
+
listFeatures(collection, query = {}, options) {
|
|
7002
|
+
return this._get(this.path("/collections/" + segment(collection) + "/features", { ...query }), options);
|
|
7003
|
+
}
|
|
7004
|
+
getFeature(collection, id, options) {
|
|
7005
|
+
return this._get(this.path("/collections/" + segment(collection) + "/features/" + segment(id)), options);
|
|
7006
|
+
}
|
|
7007
|
+
createFeature(collection, data, options) {
|
|
7008
|
+
return this.post(this.path("/collections/" + segment(collection) + "/features"), data, options);
|
|
7009
|
+
}
|
|
7010
|
+
updateFeature(collection, id, data, options) {
|
|
7011
|
+
return this.put(this.path("/collections/" + segment(collection) + "/features/" + segment(id)), data, options);
|
|
7012
|
+
}
|
|
7013
|
+
featureCommand(collection, id, data, options) {
|
|
7014
|
+
return this.post(
|
|
7015
|
+
this.path("/collections/" + segment(collection) + "/features/" + segment(id) + "/commands"),
|
|
7016
|
+
data,
|
|
7017
|
+
options
|
|
7018
|
+
);
|
|
7019
|
+
}
|
|
7020
|
+
listSubmissions(collection, query = {}, options) {
|
|
7021
|
+
return this._get(this.path("/collections/" + segment(collection) + "/submissions", { ...query }), options);
|
|
7022
|
+
}
|
|
7023
|
+
reviewSubmission(collection, id, data, options) {
|
|
7024
|
+
return this.post(
|
|
7025
|
+
this.path("/collections/" + segment(collection) + "/submissions/" + segment(id) + "/commands"),
|
|
7026
|
+
data,
|
|
7027
|
+
options
|
|
7028
|
+
);
|
|
7029
|
+
}
|
|
7030
|
+
duplicates(collection, submission, options) {
|
|
7031
|
+
return this._get(
|
|
7032
|
+
this.path("/collections/" + segment(collection) + "/submissions/" + segment(submission) + "/duplicates"),
|
|
7033
|
+
options
|
|
7034
|
+
);
|
|
7035
|
+
}
|
|
7036
|
+
listReports(collection, query = {}, options) {
|
|
7037
|
+
return this._get(this.path("/collections/" + segment(collection) + "/reports", { ...query }), options);
|
|
7038
|
+
}
|
|
7039
|
+
reviewReport(collection, id, data, options) {
|
|
7040
|
+
return this.post(
|
|
7041
|
+
this.path("/collections/" + segment(collection) + "/reports/" + segment(id) + "/commands"),
|
|
7042
|
+
data,
|
|
7043
|
+
options
|
|
7044
|
+
);
|
|
7045
|
+
}
|
|
7046
|
+
listMedia(collection, query = {}, options) {
|
|
7047
|
+
return this._get(this.path("/collections/" + segment(collection) + "/media", { ...query }), options);
|
|
7048
|
+
}
|
|
7049
|
+
reviewMedia(collection, id, data, options) {
|
|
7050
|
+
return this.put(this.path("/collections/" + segment(collection) + "/media/" + segment(id)), data, options);
|
|
7051
|
+
}
|
|
7052
|
+
inviteView(collection, data, options) {
|
|
7053
|
+
return this.post(this.path("/collections/" + segment(collection) + "/views"), data, options);
|
|
7054
|
+
}
|
|
7055
|
+
listViews(query = {}, options) {
|
|
7056
|
+
return this._get(this.path("/views", { ...query }), options);
|
|
7057
|
+
}
|
|
7058
|
+
acceptView(id, data, options) {
|
|
7059
|
+
return this.put(this.path("/views/" + segment(id)), data, options);
|
|
7060
|
+
}
|
|
7061
|
+
revokeView(collection, view, options) {
|
|
7062
|
+
return this.del(this.path("/collections/" + segment(collection) + "/views/" + segment(view)), options);
|
|
7063
|
+
}
|
|
7064
|
+
getCoverage(publication, options) {
|
|
7065
|
+
return this._get(this.path("/coverage/" + segment(publication)), options);
|
|
7066
|
+
}
|
|
7067
|
+
setCoverage(publication, areaIds, expectedRevision, options) {
|
|
7068
|
+
return this.put(
|
|
7069
|
+
this.path("/coverage/" + segment(publication)),
|
|
7070
|
+
{ area_ids: areaIds, expected_revision: expectedRevision },
|
|
7071
|
+
options
|
|
7072
|
+
);
|
|
7073
|
+
}
|
|
7074
|
+
};
|
|
7075
|
+
var CommunityMapsGeographyService = class extends ServiceModule {
|
|
7076
|
+
constructor() {
|
|
7077
|
+
super(...arguments);
|
|
7078
|
+
this.basePath = "/v1/knowledge/community-maps/admin/geography";
|
|
7079
|
+
}
|
|
7080
|
+
list(query = {}, options) {
|
|
7081
|
+
return this._get(this.withQuery("", { ...query }), options);
|
|
7082
|
+
}
|
|
7083
|
+
save(data, options) {
|
|
7084
|
+
return this.post("", data, options);
|
|
7085
|
+
}
|
|
7086
|
+
referencePlaces(query, options) {
|
|
7087
|
+
return this._get(this.withQuery("/reference-places", query), options);
|
|
7088
|
+
}
|
|
7089
|
+
};
|
|
7090
|
+
|
|
6917
7091
|
// src/services/polls.ts
|
|
6918
7092
|
var PollsService = class extends ServiceModule {
|
|
6919
7093
|
constructor() {
|
|
@@ -8939,6 +9113,7 @@ var ScaleMule = class {
|
|
|
8939
9113
|
this.webhooks = new WebhooksService(this._client);
|
|
8940
9114
|
this.leaderboard = new LeaderboardService(this._client);
|
|
8941
9115
|
this.listings = new ListingsService(this._client);
|
|
9116
|
+
this.communityMaps = new CommunityMapsService(this._client);
|
|
8942
9117
|
this.polls = new PollsService(this._client);
|
|
8943
9118
|
this.events = new EventsService(this._client);
|
|
8944
9119
|
this.graph = new GraphService(this._client);
|
|
@@ -9098,6 +9273,9 @@ var index_default = ScaleMule;
|
|
|
9098
9273
|
CatalogService,
|
|
9099
9274
|
ChatService,
|
|
9100
9275
|
CommunicationService,
|
|
9276
|
+
CommunityMapsEditorialService,
|
|
9277
|
+
CommunityMapsGeographyService,
|
|
9278
|
+
CommunityMapsService,
|
|
9101
9279
|
ComplianceService,
|
|
9102
9280
|
ConferenceService,
|
|
9103
9281
|
CreatorMakerService,
|
package/dist/index.mjs
CHANGED
|
@@ -1073,7 +1073,7 @@ var ScaleMuleClient = class {
|
|
|
1073
1073
|
if (this.workspaceId) {
|
|
1074
1074
|
headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1075
1075
|
}
|
|
1076
|
-
if (!init.skipAuth && !this.sessionToken) {
|
|
1076
|
+
if (!init.skipAuth && !this.sessionToken && !Object.keys(headers).some((key) => key.toLowerCase() === "x-anonymous-id")) {
|
|
1077
1077
|
if (!this.anonymousId) {
|
|
1078
1078
|
try {
|
|
1079
1079
|
await this.ensureAnonymousId();
|
|
@@ -1270,14 +1270,12 @@ var ScaleMuleClient = class {
|
|
|
1270
1270
|
return { data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } };
|
|
1271
1271
|
}
|
|
1272
1272
|
if (options?.onProgress && typeof XMLHttpRequest !== "undefined") {
|
|
1273
|
-
return this.uploadWithXHR(url, buildFormData, options.onProgress, options
|
|
1273
|
+
return this.uploadWithXHR(url, buildFormData, options.onProgress, options);
|
|
1274
1274
|
}
|
|
1275
1275
|
const maxRetries = options?.retries ?? this.maxRetries;
|
|
1276
1276
|
let lastError = null;
|
|
1277
1277
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1278
|
-
const headers =
|
|
1279
|
-
if (this.sessionToken) headers["Authorization"] = `Bearer ${this.sessionToken}`;
|
|
1280
|
-
if (this.workspaceId) headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1278
|
+
const headers = await this.uploadHeaders(options);
|
|
1281
1279
|
try {
|
|
1282
1280
|
const response = await fetch(url, {
|
|
1283
1281
|
method: "POST",
|
|
@@ -1319,13 +1317,29 @@ var ScaleMuleClient = class {
|
|
|
1319
1317
|
}
|
|
1320
1318
|
return { data: null, error: lastError || { code: "upload_error", message: "Upload failed", status: 0 } };
|
|
1321
1319
|
}
|
|
1320
|
+
/** Preserve forwarded reader/auth context for both multipart transports. */
|
|
1321
|
+
async uploadHeaders(options) {
|
|
1322
|
+
const headers = { "x-api-key": this.apiKey, ...options?.headers };
|
|
1323
|
+
for (const name of Object.keys(headers)) {
|
|
1324
|
+
if (name.toLowerCase() === "content-type") delete headers[name];
|
|
1325
|
+
}
|
|
1326
|
+
if (this.sessionToken) headers["Authorization"] = `Bearer ${this.sessionToken}`;
|
|
1327
|
+
if (this.workspaceId) headers["x-sm-workspace-id"] = this.workspaceId;
|
|
1328
|
+
if (!this.sessionToken && !Object.keys(headers).some((key) => key.toLowerCase() === "x-anonymous-id")) {
|
|
1329
|
+
headers["x-anonymous-id"] = await this.ensureAnonymousId();
|
|
1330
|
+
}
|
|
1331
|
+
return headers;
|
|
1332
|
+
}
|
|
1322
1333
|
/**
|
|
1323
1334
|
* Single upload with XMLHttpRequest for progress tracking.
|
|
1324
1335
|
* Supports abort via AbortSignal.
|
|
1325
1336
|
*/
|
|
1326
|
-
async uploadWithXHR(url, buildFormData, onProgress,
|
|
1337
|
+
async uploadWithXHR(url, buildFormData, onProgress, options) {
|
|
1338
|
+
const signal = options?.signal;
|
|
1339
|
+
const maxRetries = options?.retries ?? this.maxRetries;
|
|
1327
1340
|
let lastError = null;
|
|
1328
1341
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1342
|
+
const headers = await this.uploadHeaders(options);
|
|
1329
1343
|
const result = await new Promise((res) => {
|
|
1330
1344
|
const xhr = new XMLHttpRequest();
|
|
1331
1345
|
if (signal) {
|
|
@@ -1368,12 +1382,8 @@ var ScaleMuleClient = class {
|
|
|
1368
1382
|
res({ data: null, error: { code: "aborted", message: "Upload aborted", status: 0 } });
|
|
1369
1383
|
});
|
|
1370
1384
|
xhr.open("POST", url);
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
xhr.setRequestHeader("Authorization", `Bearer ${this.sessionToken}`);
|
|
1374
|
-
}
|
|
1375
|
-
if (this.workspaceId) {
|
|
1376
|
-
xhr.setRequestHeader("x-sm-workspace-id", this.workspaceId);
|
|
1385
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
1386
|
+
xhr.setRequestHeader(name, value);
|
|
1377
1387
|
}
|
|
1378
1388
|
xhr.send(buildFormData());
|
|
1379
1389
|
});
|
|
@@ -6805,6 +6815,167 @@ var ListingsService = class extends ServiceModule {
|
|
|
6805
6815
|
}
|
|
6806
6816
|
};
|
|
6807
6817
|
|
|
6818
|
+
// src/services/community-maps.ts
|
|
6819
|
+
var segment = (value) => encodeURIComponent(value);
|
|
6820
|
+
var CommunityMapsService = class extends ServiceModule {
|
|
6821
|
+
constructor(client) {
|
|
6822
|
+
super(client);
|
|
6823
|
+
this.basePath = "/v1/knowledge/community-maps";
|
|
6824
|
+
this.editorial = new CommunityMapsEditorialService(client);
|
|
6825
|
+
this.geography = new CommunityMapsGeographyService(client);
|
|
6826
|
+
}
|
|
6827
|
+
listCollections(query = {}, options) {
|
|
6828
|
+
return this._get(this.withQuery("/collections", { ...query }), options);
|
|
6829
|
+
}
|
|
6830
|
+
getCollection(slug, options) {
|
|
6831
|
+
return this._get("/collections/" + segment(slug), options);
|
|
6832
|
+
}
|
|
6833
|
+
listFeatures(slug, query = {}, options) {
|
|
6834
|
+
return this._get(this.withQuery("/collections/" + segment(slug) + "/features", { ...query }), options);
|
|
6835
|
+
}
|
|
6836
|
+
getFeature(slug, id, options) {
|
|
6837
|
+
return this._get("/collections/" + segment(slug) + "/features/" + segment(id), options);
|
|
6838
|
+
}
|
|
6839
|
+
createSubmission(slug, data, options) {
|
|
6840
|
+
return this.post("/collections/" + segment(slug) + "/submissions", data, options);
|
|
6841
|
+
}
|
|
6842
|
+
uploadPhoto(slug, submission, file, fields, options) {
|
|
6843
|
+
return this._upload(
|
|
6844
|
+
"/collections/" + segment(slug) + "/submissions/" + segment(submission) + "/media",
|
|
6845
|
+
file,
|
|
6846
|
+
{ caption: fields.caption, attribution: fields.attribution, rights_confirmed: String(fields.rights_confirmed) },
|
|
6847
|
+
options
|
|
6848
|
+
);
|
|
6849
|
+
}
|
|
6850
|
+
react(slug, feature, reaction, active = true, options) {
|
|
6851
|
+
return this.post(
|
|
6852
|
+
"/collections/" + segment(slug) + "/features/" + segment(feature) + "/reactions",
|
|
6853
|
+
{ reaction, active },
|
|
6854
|
+
options
|
|
6855
|
+
);
|
|
6856
|
+
}
|
|
6857
|
+
report(slug, feature, data, options) {
|
|
6858
|
+
return this.post("/collections/" + segment(slug) + "/features/" + segment(feature) + "/reports", data, options);
|
|
6859
|
+
}
|
|
6860
|
+
/** Proxy this path through your server; never append a secret API key to an image URL. */
|
|
6861
|
+
mediaPath(slug, media) {
|
|
6862
|
+
return this.basePath + "/collections/" + segment(slug) + "/media/" + segment(media);
|
|
6863
|
+
}
|
|
6864
|
+
};
|
|
6865
|
+
var CommunityMapsEditorialService = class _CommunityMapsEditorialService extends ServiceModule {
|
|
6866
|
+
constructor(client, applicationId) {
|
|
6867
|
+
super(client);
|
|
6868
|
+
this.applicationId = applicationId;
|
|
6869
|
+
this.basePath = "/v1/knowledge/community-maps/manage";
|
|
6870
|
+
}
|
|
6871
|
+
forApplication(id) {
|
|
6872
|
+
return new _CommunityMapsEditorialService(this.client, id);
|
|
6873
|
+
}
|
|
6874
|
+
path(path, query = {}) {
|
|
6875
|
+
return this.withQuery(path, { ...query, ...this.applicationId ? { application_id: this.applicationId } : {} });
|
|
6876
|
+
}
|
|
6877
|
+
listCollections(query = {}, options) {
|
|
6878
|
+
return this._get(this.path("/collections", { ...query }), options);
|
|
6879
|
+
}
|
|
6880
|
+
getCollection(id, options) {
|
|
6881
|
+
return this._get(this.path("/collections/" + segment(id)), options);
|
|
6882
|
+
}
|
|
6883
|
+
createCollection(data, options) {
|
|
6884
|
+
return this.post(this.path("/collections"), data, options);
|
|
6885
|
+
}
|
|
6886
|
+
updateCollection(id, data, options) {
|
|
6887
|
+
return this.put(this.path("/collections/" + segment(id)), data, options);
|
|
6888
|
+
}
|
|
6889
|
+
listFeatures(collection, query = {}, options) {
|
|
6890
|
+
return this._get(this.path("/collections/" + segment(collection) + "/features", { ...query }), options);
|
|
6891
|
+
}
|
|
6892
|
+
getFeature(collection, id, options) {
|
|
6893
|
+
return this._get(this.path("/collections/" + segment(collection) + "/features/" + segment(id)), options);
|
|
6894
|
+
}
|
|
6895
|
+
createFeature(collection, data, options) {
|
|
6896
|
+
return this.post(this.path("/collections/" + segment(collection) + "/features"), data, options);
|
|
6897
|
+
}
|
|
6898
|
+
updateFeature(collection, id, data, options) {
|
|
6899
|
+
return this.put(this.path("/collections/" + segment(collection) + "/features/" + segment(id)), data, options);
|
|
6900
|
+
}
|
|
6901
|
+
featureCommand(collection, id, data, options) {
|
|
6902
|
+
return this.post(
|
|
6903
|
+
this.path("/collections/" + segment(collection) + "/features/" + segment(id) + "/commands"),
|
|
6904
|
+
data,
|
|
6905
|
+
options
|
|
6906
|
+
);
|
|
6907
|
+
}
|
|
6908
|
+
listSubmissions(collection, query = {}, options) {
|
|
6909
|
+
return this._get(this.path("/collections/" + segment(collection) + "/submissions", { ...query }), options);
|
|
6910
|
+
}
|
|
6911
|
+
reviewSubmission(collection, id, data, options) {
|
|
6912
|
+
return this.post(
|
|
6913
|
+
this.path("/collections/" + segment(collection) + "/submissions/" + segment(id) + "/commands"),
|
|
6914
|
+
data,
|
|
6915
|
+
options
|
|
6916
|
+
);
|
|
6917
|
+
}
|
|
6918
|
+
duplicates(collection, submission, options) {
|
|
6919
|
+
return this._get(
|
|
6920
|
+
this.path("/collections/" + segment(collection) + "/submissions/" + segment(submission) + "/duplicates"),
|
|
6921
|
+
options
|
|
6922
|
+
);
|
|
6923
|
+
}
|
|
6924
|
+
listReports(collection, query = {}, options) {
|
|
6925
|
+
return this._get(this.path("/collections/" + segment(collection) + "/reports", { ...query }), options);
|
|
6926
|
+
}
|
|
6927
|
+
reviewReport(collection, id, data, options) {
|
|
6928
|
+
return this.post(
|
|
6929
|
+
this.path("/collections/" + segment(collection) + "/reports/" + segment(id) + "/commands"),
|
|
6930
|
+
data,
|
|
6931
|
+
options
|
|
6932
|
+
);
|
|
6933
|
+
}
|
|
6934
|
+
listMedia(collection, query = {}, options) {
|
|
6935
|
+
return this._get(this.path("/collections/" + segment(collection) + "/media", { ...query }), options);
|
|
6936
|
+
}
|
|
6937
|
+
reviewMedia(collection, id, data, options) {
|
|
6938
|
+
return this.put(this.path("/collections/" + segment(collection) + "/media/" + segment(id)), data, options);
|
|
6939
|
+
}
|
|
6940
|
+
inviteView(collection, data, options) {
|
|
6941
|
+
return this.post(this.path("/collections/" + segment(collection) + "/views"), data, options);
|
|
6942
|
+
}
|
|
6943
|
+
listViews(query = {}, options) {
|
|
6944
|
+
return this._get(this.path("/views", { ...query }), options);
|
|
6945
|
+
}
|
|
6946
|
+
acceptView(id, data, options) {
|
|
6947
|
+
return this.put(this.path("/views/" + segment(id)), data, options);
|
|
6948
|
+
}
|
|
6949
|
+
revokeView(collection, view, options) {
|
|
6950
|
+
return this.del(this.path("/collections/" + segment(collection) + "/views/" + segment(view)), options);
|
|
6951
|
+
}
|
|
6952
|
+
getCoverage(publication, options) {
|
|
6953
|
+
return this._get(this.path("/coverage/" + segment(publication)), options);
|
|
6954
|
+
}
|
|
6955
|
+
setCoverage(publication, areaIds, expectedRevision, options) {
|
|
6956
|
+
return this.put(
|
|
6957
|
+
this.path("/coverage/" + segment(publication)),
|
|
6958
|
+
{ area_ids: areaIds, expected_revision: expectedRevision },
|
|
6959
|
+
options
|
|
6960
|
+
);
|
|
6961
|
+
}
|
|
6962
|
+
};
|
|
6963
|
+
var CommunityMapsGeographyService = class extends ServiceModule {
|
|
6964
|
+
constructor() {
|
|
6965
|
+
super(...arguments);
|
|
6966
|
+
this.basePath = "/v1/knowledge/community-maps/admin/geography";
|
|
6967
|
+
}
|
|
6968
|
+
list(query = {}, options) {
|
|
6969
|
+
return this._get(this.withQuery("", { ...query }), options);
|
|
6970
|
+
}
|
|
6971
|
+
save(data, options) {
|
|
6972
|
+
return this.post("", data, options);
|
|
6973
|
+
}
|
|
6974
|
+
referencePlaces(query, options) {
|
|
6975
|
+
return this._get(this.withQuery("/reference-places", query), options);
|
|
6976
|
+
}
|
|
6977
|
+
};
|
|
6978
|
+
|
|
6808
6979
|
// src/services/polls.ts
|
|
6809
6980
|
var PollsService = class extends ServiceModule {
|
|
6810
6981
|
constructor() {
|
|
@@ -8830,6 +9001,7 @@ var ScaleMule = class {
|
|
|
8830
9001
|
this.webhooks = new WebhooksService(this._client);
|
|
8831
9002
|
this.leaderboard = new LeaderboardService(this._client);
|
|
8832
9003
|
this.listings = new ListingsService(this._client);
|
|
9004
|
+
this.communityMaps = new CommunityMapsService(this._client);
|
|
8833
9005
|
this.polls = new PollsService(this._client);
|
|
8834
9006
|
this.events = new EventsService(this._client);
|
|
8835
9007
|
this.graph = new GraphService(this._client);
|
|
@@ -8988,6 +9160,9 @@ export {
|
|
|
8988
9160
|
CatalogService,
|
|
8989
9161
|
ChatService,
|
|
8990
9162
|
CommunicationService,
|
|
9163
|
+
CommunityMapsEditorialService,
|
|
9164
|
+
CommunityMapsGeographyService,
|
|
9165
|
+
CommunityMapsService,
|
|
8991
9166
|
ComplianceService,
|
|
8992
9167
|
ConferenceService,
|
|
8993
9168
|
CreatorMakerService,
|