@imessaging/core 0.6.0 → 0.7.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/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/types.ts +24 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -25,7 +25,24 @@ export type EmailRecipient = {
|
|
|
25
25
|
name?: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/** Чат MAX. `chatId` выдаёт API MAX; это не номер телефона пользователя. */
|
|
29
|
+
export type MaxRecipient = {
|
|
30
|
+
type: "max";
|
|
31
|
+
chatId: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Диалог (отклик) HeadHunter, в который работодатель уже может написать. */
|
|
35
|
+
export type HeadhunterRecipient = {
|
|
36
|
+
type: "headhunter";
|
|
37
|
+
negotiationId: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type MessageRecipient =
|
|
41
|
+
| UsernameRecipient
|
|
42
|
+
| TelegramIdRecipient
|
|
43
|
+
| EmailRecipient
|
|
44
|
+
| MaxRecipient
|
|
45
|
+
| HeadhunterRecipient;
|
|
29
46
|
|
|
30
47
|
/** Получатель, адресуемый в Telegram. Сужение для транспортов, которые кроме него ничего не умеют. */
|
|
31
48
|
export type TelegramRecipient = UsernameRecipient | TelegramIdRecipient;
|
|
@@ -37,7 +54,12 @@ export type TelegramRecipient = UsernameRecipient | TelegramIdRecipient;
|
|
|
37
54
|
* по местам использования `recipient.id` и в каждом будет своей.
|
|
38
55
|
*/
|
|
39
56
|
export function isTelegramRecipient(recipient: MessageRecipient): recipient is TelegramRecipient {
|
|
40
|
-
return
|
|
57
|
+
return (
|
|
58
|
+
recipient.type === "username" ||
|
|
59
|
+
recipient.type === "user" ||
|
|
60
|
+
recipient.type === "group" ||
|
|
61
|
+
recipient.type === "channel"
|
|
62
|
+
);
|
|
41
63
|
}
|
|
42
64
|
|
|
43
65
|
export type OutboundDocument = {
|