@spectrum-ts/imessage 9.0.0 → 9.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.ts +27 -0
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -327,6 +327,33 @@ declare const imessage: import("@spectrum-ts/core").Platform<import("@spectrum-t
|
|
|
327
327
|
id: string;
|
|
328
328
|
__platform: string;
|
|
329
329
|
}) => Promise<import("@spectrum-ts/core").AvatarData | undefined>;
|
|
330
|
+
getDisplayName: ({
|
|
331
|
+
client
|
|
332
|
+
}: {
|
|
333
|
+
client: IMessageClient;
|
|
334
|
+
config: {
|
|
335
|
+
local: true;
|
|
336
|
+
} | {
|
|
337
|
+
local: false;
|
|
338
|
+
clients?: {
|
|
339
|
+
address: string;
|
|
340
|
+
token: string;
|
|
341
|
+
phone: string;
|
|
342
|
+
} | {
|
|
343
|
+
address: string;
|
|
344
|
+
token: string;
|
|
345
|
+
phone: string;
|
|
346
|
+
}[] | undefined;
|
|
347
|
+
};
|
|
348
|
+
store: import("@spectrum-ts/core").Store;
|
|
349
|
+
}, space: {
|
|
350
|
+
id: string;
|
|
351
|
+
type: "dm" | "group";
|
|
352
|
+
phone: string;
|
|
353
|
+
} & {
|
|
354
|
+
id: string;
|
|
355
|
+
__platform: string;
|
|
356
|
+
}) => Promise<string | undefined>;
|
|
330
357
|
getAttachment: ({
|
|
331
358
|
client
|
|
332
359
|
}: {
|
package/dist/index.js
CHANGED
|
@@ -1248,6 +1248,15 @@ const markRead$1 = async (remote, spaceId) => {
|
|
|
1248
1248
|
const setDisplayName$1 = async (remote, spaceId, content) => {
|
|
1249
1249
|
await remote.groups.setDisplayName(toChatGuid(spaceId), content.displayName);
|
|
1250
1250
|
};
|
|
1251
|
+
/**
|
|
1252
|
+
* Read a remote iMessage group chat's title. The SDK returns an empty
|
|
1253
|
+
* `Chat.displayName` for an unnamed group; normalized to `undefined`. The
|
|
1254
|
+
* group-only guard lives at the action layer (see `remoteGroupClient`).
|
|
1255
|
+
*/
|
|
1256
|
+
const getDisplayName$1 = async (remote, spaceId) => {
|
|
1257
|
+
const { displayName } = await remote.chats.get(toChatGuid(spaceId));
|
|
1258
|
+
return displayName || void 0;
|
|
1259
|
+
};
|
|
1251
1260
|
//#endregion
|
|
1252
1261
|
//#region src/remote/markdown.ts
|
|
1253
1262
|
const markdownLexer = new Marked();
|
|
@@ -2155,6 +2164,7 @@ const messages = (clients, projectConfig) => messages$1(clients, projectConfig);
|
|
|
2155
2164
|
const setBackground = async (remote, spaceId, content) => setBackground$1(remote, spaceId, content);
|
|
2156
2165
|
const sendCustomizedMiniApp = async (remote, spaceId, content) => sendCustomizedMiniApp$1(remote, spaceId, content);
|
|
2157
2166
|
const setDisplayName = async (remote, spaceId, content) => setDisplayName$1(remote, spaceId, content);
|
|
2167
|
+
const getDisplayName = async (remote, spaceId) => getDisplayName$1(remote, spaceId);
|
|
2158
2168
|
const addParticipants = async (remote, spaceId, content) => addParticipants$1(remote, spaceId, content);
|
|
2159
2169
|
const removeParticipants = async (remote, spaceId, content) => removeParticipants$1(remote, spaceId, content);
|
|
2160
2170
|
const leaveGroup = async (remote, spaceId) => leaveGroup$1(remote, spaceId);
|
|
@@ -2530,6 +2540,12 @@ const imessage = definePlatform("iMessage", {
|
|
|
2530
2540
|
local: "fetching group avatars requires remote iMessage"
|
|
2531
2541
|
}), space.id);
|
|
2532
2542
|
},
|
|
2543
|
+
getDisplayName: async ({ client }, space) => {
|
|
2544
|
+
return await getDisplayName(remoteGroupClient(client, space, "getDisplayName", {
|
|
2545
|
+
dm: "only group chats have display names (this space is a DM)",
|
|
2546
|
+
local: "reading chat display names requires remote iMessage"
|
|
2547
|
+
}), space.id);
|
|
2548
|
+
},
|
|
2533
2549
|
getAttachment: async ({ client }, guid, phone) => {
|
|
2534
2550
|
if (isLocal(client)) throw UnsupportedError.action("getAttachment", "iMessage (local mode)", "fetching attachments by GUID requires remote iMessage");
|
|
2535
2551
|
if (client.length === 0) throw new Error("No iMessage clients configured");
|