2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-08-16 17:51:28 +09:00
|
|
|
import { MiUser } from './User.js';
|
|
|
|
import { MiNote } from './Note.js';
|
|
|
|
import { MiAccessToken } from './AccessToken.js';
|
2023-12-21 10:39:11 +09:00
|
|
|
import { MiRole } from './Role.js';
|
2024-09-26 14:15:03 +09:00
|
|
|
import { MiDriveFile } from './DriveFile.js';
|
|
|
|
import { userExportableEntities } from '@/types.js';
|
2019-04-07 21:50:36 +09:00
|
|
|
|
2023-08-16 17:51:28 +09:00
|
|
|
export type MiNotification = {
|
2023-11-02 15:57:55 +09:00
|
|
|
type: 'note';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'follow';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
} | {
|
|
|
|
type: 'mention';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'reply';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'renote';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
targetNoteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'quote';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'reaction';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
reaction: string;
|
|
|
|
} | {
|
|
|
|
type: 'pollEnded';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
} | {
|
|
|
|
type: 'receiveFollowRequest';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
} | {
|
|
|
|
type: 'followRequestAccepted';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
2024-09-28 09:55:21 +09:00
|
|
|
message: string | null;
|
2023-12-21 10:39:11 +09:00
|
|
|
} | {
|
|
|
|
type: 'roleAssigned';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
roleId: MiRole['id'];
|
2023-11-02 15:57:55 +09:00
|
|
|
} | {
|
|
|
|
type: 'achievementEarned';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
achievement: string;
|
2024-09-26 14:15:03 +09:00
|
|
|
} | {
|
|
|
|
type: 'exportCompleted';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
exportedEntity: typeof userExportableEntities[number];
|
|
|
|
fileId: MiDriveFile['id'];
|
2023-11-02 15:57:55 +09:00
|
|
|
} | {
|
|
|
|
type: 'app';
|
2023-04-04 14:06:57 +09:00
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
2023-01-21 13:14:55 +09:00
|
|
|
|
2020-03-28 18:07:41 +09:00
|
|
|
/**
|
|
|
|
* アプリ通知のbody
|
|
|
|
*/
|
2024-08-29 18:57:44 +09:00
|
|
|
customBody: string;
|
2020-03-28 18:07:41 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* アプリ通知のheader
|
|
|
|
* (省略時はアプリ名で表示されることを期待)
|
|
|
|
*/
|
2023-04-04 14:06:57 +09:00
|
|
|
customHeader: string | null;
|
2020-03-28 18:07:41 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* アプリ通知のicon(URL)
|
|
|
|
* (省略時はアプリアイコンで表示されることを期待)
|
|
|
|
*/
|
2023-04-04 14:06:57 +09:00
|
|
|
customIcon: string | null;
|
2020-03-28 18:07:41 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* アプリ通知のアプリ(のトークン)
|
|
|
|
*/
|
2023-08-16 17:51:28 +09:00
|
|
|
appAccessTokenId: MiAccessToken['id'] | null;
|
2023-11-02 15:57:55 +09:00
|
|
|
} | {
|
|
|
|
type: 'test';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
2024-02-20 15:10:41 +00:00
|
|
|
} | {
|
|
|
|
type: 'edited';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
notifierId: MiUser['id'];
|
|
|
|
noteId: MiNote['id'];
|
2024-11-03 17:59:50 +01:00
|
|
|
} | {
|
|
|
|
type: 'scheduledNoteFailed';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
reason: string;
|
2024-11-04 11:22:37 +01:00
|
|
|
} | {
|
|
|
|
type: 'scheduledNotePosted';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
noteId: MiNote['id'];
|
2023-11-02 15:57:55 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
export type MiGroupedNotification = MiNotification | {
|
|
|
|
type: 'reaction:grouped';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
reactions: {
|
|
|
|
userId: string;
|
|
|
|
reaction: string;
|
|
|
|
}[];
|
|
|
|
} | {
|
|
|
|
type: 'renote:grouped';
|
|
|
|
id: string;
|
|
|
|
createdAt: string;
|
|
|
|
noteId: MiNote['id'];
|
|
|
|
userIds: string[];
|
|
|
|
};
|