@poolse/sdk 2.22.0 → 2.23.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.cjs CHANGED
@@ -1539,13 +1539,43 @@ var MeResource = class {
1539
1539
  this.client = client;
1540
1540
  }
1541
1541
  client;
1542
+ current = null;
1543
+ listeners = /* @__PURE__ */ new Set();
1542
1544
  /** GET /v1/me */
1543
- show(signal) {
1544
- return this.client.request({
1545
+ async show(signal) {
1546
+ const me = await this.client.request({
1545
1547
  method: "GET",
1546
1548
  path: "/v1/me",
1547
1549
  ...signal ? { signal } : {}
1548
1550
  });
1551
+ this.set(me);
1552
+ return me;
1553
+ }
1554
+ /** PATCH /v1/me — the user's own preferences. */
1555
+ async update(body, signal) {
1556
+ const me = await this.client.request({
1557
+ method: "PATCH",
1558
+ path: "/v1/me",
1559
+ body,
1560
+ ...signal ? { signal } : {}
1561
+ });
1562
+ this.set(me);
1563
+ return me;
1564
+ }
1565
+ /** The last user `show` / `update` returned, or null before the first. */
1566
+ peek() {
1567
+ return this.current;
1568
+ }
1569
+ /** Called with the user whenever `show` or `update` returns a new one. */
1570
+ onChange(fn) {
1571
+ this.listeners.add(fn);
1572
+ return () => {
1573
+ this.listeners.delete(fn);
1574
+ };
1575
+ }
1576
+ set(me) {
1577
+ this.current = me;
1578
+ for (const fn of this.listeners) fn(me);
1549
1579
  }
1550
1580
  };
1551
1581
 
@@ -2492,7 +2522,7 @@ var Poolse = class {
2492
2522
  };
2493
2523
 
2494
2524
  // src/version.ts
2495
- var version = "2.22.0";
2525
+ var version = "2.23.0";
2496
2526
 
2497
2527
  // src/call-log.ts
2498
2528
  function parseCallLogBody(body) {