Skip to content

Commit ca5d7f6

Browse files
docs: update spectrum-ts documentation for v5.2.0 (#95)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6999ae5 commit ca5d7f6

3 files changed

Lines changed: 190 additions & 98 deletions

File tree

docs-src/spectrum-ts/providers/imessage/connection-and-routing.mdx.vel

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ for await (const [space, message] of app.messages) {
9696
}
9797
```
9898

99+
## User properties
100+
101+
iMessage users carry optional platform-specific fields when resolved through narrowing. These are available when the platform has sender details for the user:
102+
103+
| Field | Type | Description |
104+
|---|---|---|
105+
| `address` | `string` (optional) | The user's phone number or email address. |
106+
| `country` | `string` (optional) | The user's country code. |
107+
| `service` | `"iMessage" \| "SMS" \| "RCS" \| "unknown"` (optional) | The messaging service the user is reachable on. |
108+
109+
```ts
110+
const im = imessage(app);
111+
const alice = await im.user("+15551111111");
112+
console.log(alice.address, alice.country, alice.service);
113+
```
114+
115+
These fields are also available on `message.sender` after narrowing:
116+
117+
```ts
118+
for await (const [space, message] of app.messages) {
119+
if (message.platform !== "iMessage") continue;
120+
const imMsg = imessage(message);
121+
console.log(imMsg.sender.service);
122+
}
123+
```
124+
99125
## Creating conversations
100126

101127
Resolve users by phone number or email, then create a space with `space.create(...)`:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"eslint-plugin-format": "^2.0.1",
2929
"husky": "^9.1.7",
3030
"oxfmt": "^0.44.0",
31-
"spectrum-ts": "4.2.0",
31+
"spectrum-ts": "5.2.0",
3232
"tsx": "^4.21.0",
3333
"typescript": "^5.9.3"
3434
}

0 commit comments

Comments
 (0)