2021-12-29 05:54:10 +00:00
|
|
|
import { Antenna, CustomEmoji, DriveFile, MeDetailed, MessagingMessage, Note, Notification, PageEvent, User, UserGroup } from './entities';
|
2021-06-19 14:07:08 +00:00
|
|
|
|
2021-06-28 09:34:20 +00:00
|
|
|
type FIXME = any;
|
|
|
|
|
2021-06-27 12:17:38 +00:00
|
|
|
export type Channels = {
|
2021-06-19 14:07:08 +00:00
|
|
|
main: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
notification: (payload: Notification) => void;
|
|
|
|
mention: (payload: Note) => void;
|
|
|
|
reply: (payload: Note) => void;
|
|
|
|
renote: (payload: Note) => void;
|
|
|
|
follow: (payload: User) => void; // 自分が他人をフォローしたとき
|
|
|
|
followed: (payload: User) => void; // 他人が自分をフォローしたとき
|
|
|
|
unfollow: (payload: User) => void; // 自分が他人をフォロー解除したとき
|
|
|
|
meUpdated: (payload: MeDetailed) => void;
|
|
|
|
pageEvent: (payload: PageEvent) => void;
|
|
|
|
urlUploadFinished: (payload: { marker: string; file: DriveFile; }) => void;
|
|
|
|
readAllNotifications: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
unreadNotification: (payload: Notification) => void;
|
|
|
|
unreadMention: (payload: Note['id']) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
readAllUnreadMentions: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
unreadSpecifiedNote: (payload: Note['id']) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
readAllUnreadSpecifiedNotes: () => void;
|
|
|
|
readAllMessagingMessages: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
messagingMessage: (payload: MessagingMessage) => void;
|
|
|
|
unreadMessagingMessage: (payload: MessagingMessage) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
readAllAntennas: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
unreadAntenna: (payload: Antenna) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
readAllAnnouncements: () => void;
|
|
|
|
readAllChannels: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
unreadChannel: (payload: Note['id']) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
myTokenRegenerated: () => void;
|
2021-12-29 05:54:10 +00:00
|
|
|
reversiNoInvites: () => void;
|
|
|
|
reversiInvited: (payload: FIXME) => void;
|
|
|
|
signin: (payload: FIXME) => void;
|
|
|
|
registryUpdated: (payload: {
|
|
|
|
scope?: string[];
|
|
|
|
key: string;
|
|
|
|
value: any | null;
|
|
|
|
}) => void;
|
|
|
|
driveFileCreated: (payload: DriveFile) => void;
|
|
|
|
readAntenna: (payload: Antenna) => void;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
homeTimeline: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
note: (payload: Note) => void;
|
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
localTimeline: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
note: (payload: Note) => void;
|
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
hybridTimeline: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
note: (payload: Note) => void;
|
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
globalTimeline: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
note: (payload: Note) => void;
|
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: null;
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
messaging: {
|
2021-06-27 12:17:38 +00:00
|
|
|
params: {
|
|
|
|
otherparty?: User['id'] | null;
|
|
|
|
group?: UserGroup['id'] | null;
|
|
|
|
};
|
2021-06-19 14:07:08 +00:00
|
|
|
events: {
|
|
|
|
message: (payload: MessagingMessage) => void;
|
|
|
|
deleted: (payload: MessagingMessage['id']) => void;
|
|
|
|
read: (payload: MessagingMessage['id'][]) => void;
|
|
|
|
typers: (payload: User[]) => void;
|
|
|
|
};
|
2021-06-28 09:34:20 +00:00
|
|
|
receives: {
|
|
|
|
read: {
|
|
|
|
id: MessagingMessage['id'];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serverStats: {
|
|
|
|
params: null;
|
|
|
|
events: {
|
|
|
|
stats: (payload: FIXME) => void;
|
|
|
|
};
|
|
|
|
receives: {
|
|
|
|
requestLog: {
|
|
|
|
id: string | number;
|
|
|
|
length: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
queueStats: {
|
|
|
|
params: null;
|
|
|
|
events: {
|
|
|
|
stats: (payload: FIXME) => void;
|
|
|
|
};
|
|
|
|
receives: {
|
|
|
|
requestLog: {
|
|
|
|
id: string | number;
|
|
|
|
length: number;
|
|
|
|
};
|
|
|
|
};
|
2021-06-19 14:07:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export type NoteUpdatedEvent = {
|
|
|
|
id: Note['id'];
|
|
|
|
type: 'reacted';
|
|
|
|
body: {
|
|
|
|
reaction: string;
|
|
|
|
userId: User['id'];
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
id: Note['id'];
|
|
|
|
type: 'deleted';
|
|
|
|
body: {
|
|
|
|
deletedAt: string;
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
id: Note['id'];
|
|
|
|
type: 'pollVoted';
|
|
|
|
body: {
|
|
|
|
choice: number;
|
|
|
|
userId: User['id'];
|
|
|
|
};
|
|
|
|
};
|
2021-06-23 04:47:51 +00:00
|
|
|
|
2021-07-10 14:20:56 +00:00
|
|
|
export type BroadcastEvents = {
|
2021-06-23 04:47:51 +00:00
|
|
|
noteUpdated: (payload: NoteUpdatedEvent) => void;
|
|
|
|
emojiAdded: (payload: {
|
|
|
|
emoji: CustomEmoji;
|
|
|
|
}) => void;
|
|
|
|
};
|