@mitumba/sdk 1.33.0 → 2.1.0
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/index.d.mts +43 -32
- package/dist/index.d.ts +43 -32
- package/dist/index.js +26 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1400,61 +1400,23 @@ var MessagesModule = class {
|
|
|
1400
1400
|
this.client = client;
|
|
1401
1401
|
}
|
|
1402
1402
|
client;
|
|
1403
|
-
/**
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
);
|
|
1403
|
+
/**
|
|
1404
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
|
|
1405
|
+
* a store blocks a buyer (`{ buyer_id }`). Idempotent.
|
|
1406
|
+
*/
|
|
1407
|
+
async createMessagingBlock(perspective, input, options) {
|
|
1408
|
+
const value = await this.client.post(`${perspectiveBase(perspective)}/blocks`, input, options);
|
|
1409
|
+
return unwrap(value, isIdentified);
|
|
1410
1410
|
}
|
|
1411
|
-
/**
|
|
1412
|
-
async
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
storeId ? { store_id: storeId } : void 0,
|
|
1416
|
-
options
|
|
1417
|
-
);
|
|
1411
|
+
/** Remove a block the current perspective created. */
|
|
1412
|
+
async removeMessagingBlock(perspective, blockId, options) {
|
|
1413
|
+
const value = await this.client.delete(`${perspectiveBase(perspective)}/blocks/${encode(blockId)}`, void 0, options);
|
|
1414
|
+
return unwrap(value, isRecord2);
|
|
1418
1415
|
}
|
|
1419
|
-
/**
|
|
1420
|
-
async
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
/** @deprecated Use advanceThreadReadCursor for precise monotonic state. */
|
|
1424
|
-
async markRead(partnerId, storeId, options) {
|
|
1425
|
-
const path = storeId ? `/notify/messages/${partnerId}/read?store_id=${storeId}` : `/notify/messages/${partnerId}/read`;
|
|
1426
|
-
return this.client.post(path, void 0, options);
|
|
1427
|
-
}
|
|
1428
|
-
/** @deprecated Use managed messaging realtime. */
|
|
1429
|
-
connectTyping(partnerId) {
|
|
1430
|
-
const token = this.client.getToken();
|
|
1431
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/${partnerId}/ws?token=${token}`;
|
|
1432
|
-
return new WebSocket(wsUrl);
|
|
1433
|
-
}
|
|
1434
|
-
/** @deprecated Use managed messaging realtime. */
|
|
1435
|
-
connectInbox() {
|
|
1436
|
-
const token = this.client.getToken();
|
|
1437
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/inbox?token=${token}`;
|
|
1438
|
-
return new WebSocket(wsUrl);
|
|
1439
|
-
}
|
|
1440
|
-
/** Create a legacy inbox socket only after hydrating/refreshing the access token. */
|
|
1441
|
-
async connectInboxFresh(options) {
|
|
1442
|
-
await this.client.ensureFreshToken(options);
|
|
1443
|
-
const token = this.client.getToken() ?? "";
|
|
1444
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/inbox?token=${encode(token)}`;
|
|
1445
|
-
return this.client.createWebSocket(wsUrl, []);
|
|
1446
|
-
}
|
|
1447
|
-
/** Create a report for a message or conversation. */
|
|
1448
|
-
async createReport(input, options) {
|
|
1449
|
-
return this.client.post("/notify/messages/reports", input, options);
|
|
1450
|
-
}
|
|
1451
|
-
/** Create an idempotent bilateral buyer/store relationship block. */
|
|
1452
|
-
async createBlock(input, options) {
|
|
1453
|
-
return this.client.post("/notify/messages/blocks", input, options);
|
|
1454
|
-
}
|
|
1455
|
-
/** Remove a block created by the current perspective. */
|
|
1456
|
-
async removeBlock(blockId, options) {
|
|
1457
|
-
return this.client.delete(`/notify/messages/blocks/${encode(blockId)}`, void 0, options);
|
|
1416
|
+
/** File a message or conversation report from a v2 inbox perspective. Idempotent on open reports. */
|
|
1417
|
+
async createMessagingReport(perspective, input, options) {
|
|
1418
|
+
const value = await this.client.post(`${perspectiveBase(perspective)}/reports`, input, options);
|
|
1419
|
+
return unwrap(value, isIdentified);
|
|
1458
1420
|
}
|
|
1459
1421
|
/** Discover server messaging capabilities. */
|
|
1460
1422
|
async getMessagingCapabilities(options) {
|
|
@@ -2340,6 +2302,17 @@ var WholesaleModule = class {
|
|
|
2340
2302
|
formData.append("index", String(index));
|
|
2341
2303
|
return this.client.post(`/listings/bales/${baleId}/images/upload`, formData, options);
|
|
2342
2304
|
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Remove a bale image from its slot (requires the owning wholesale store).
|
|
2307
|
+
*
|
|
2308
|
+
* @param baleId - The bale whose image is being removed
|
|
2309
|
+
* @param index - The slot index; slot 0 is the cover
|
|
2310
|
+
* @returns `{ ok: true }` on success
|
|
2311
|
+
* @throws {APIError} On network or server errors
|
|
2312
|
+
*/
|
|
2313
|
+
async removeBaleImage(baleId, index, options) {
|
|
2314
|
+
return this.client.delete(`/listings/bales/${baleId}/images/${index}`, void 0, options);
|
|
2315
|
+
}
|
|
2343
2316
|
// ── Feed ──
|
|
2344
2317
|
/** Browse the wholesale bale feed (public). */
|
|
2345
2318
|
async wholesaleFeed(params, options) {
|