/*
* Copyright (C) 2026 Fluxer Contributors
*
* This file is part of Fluxer.
*
* Fluxer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Fluxer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Fluxer. If not, see .
*/
import type {AttachmentID, ChannelID, EmojiID, GuildID, MessageID, UserID} from '@fluxer/api/src/BrandedTypes';
import {IChannelRepositoryAggregate} from '@fluxer/api/src/channel/repositories/IChannelRepositoryAggregate';
import type {ChannelRow} from '@fluxer/api/src/database/types/ChannelTypes';
import type {AttachmentLookupRow, MessageRow} from '@fluxer/api/src/database/types/MessageTypes';
import type {Channel} from '@fluxer/api/src/models/Channel';
import type {Message} from '@fluxer/api/src/models/Message';
import type {MessageReaction} from '@fluxer/api/src/models/MessageReaction';
export abstract class IChannelRepository extends IChannelRepositoryAggregate {
abstract findUnique(channelId: ChannelID): Promise;
abstract upsert(data: ChannelRow): Promise;
abstract updateLastMessageId(channelId: ChannelID, messageId: MessageID): Promise;
abstract delete(channelId: ChannelID, guildId?: GuildID): Promise;
abstract listGuildChannels(guildId: GuildID): Promise>;
abstract countGuildChannels(guildId: GuildID): Promise;
abstract listMessages(
channelId: ChannelID,
beforeMessageId?: MessageID,
limit?: number,
afterMessageId?: MessageID,
): Promise>;
abstract getMessage(channelId: ChannelID, messageId: MessageID): Promise;
abstract upsertMessage(data: MessageRow, oldData?: MessageRow | null): Promise;
abstract deleteMessage(
channelId: ChannelID,
messageId: MessageID,
authorId: UserID,
pinnedTimestamp?: Date,
): Promise;
abstract bulkDeleteMessages(channelId: ChannelID, messageIds: Array): Promise;
abstract listChannelPins(channelId: ChannelID, beforePinnedTimestamp: Date, limit?: number): Promise>;
abstract listMessageReactions(channelId: ChannelID, messageId: MessageID): Promise>;
abstract listReactionUsers(
channelId: ChannelID,
messageId: MessageID,
emojiName: string,
limit?: number,
after?: UserID,
emojiId?: EmojiID,
): Promise>;
abstract addReaction(
channelId: ChannelID,
messageId: MessageID,
userId: UserID,
emojiName: string,
emojiId?: EmojiID,
emojiAnimated?: boolean,
): Promise;
abstract removeReaction(
channelId: ChannelID,
messageId: MessageID,
userId: UserID,
emojiName: string,
emojiId?: EmojiID,
): Promise;
abstract removeAllReactions(channelId: ChannelID, messageId: MessageID): Promise;
abstract removeAllReactionsForEmoji(
channelId: ChannelID,
messageId: MessageID,
emojiName: string,
emojiId?: EmojiID,
): Promise;
abstract countReactionUsers(
channelId: ChannelID,
messageId: MessageID,
emojiName: string,
emojiId?: EmojiID,
): Promise;
abstract countUniqueReactions(channelId: ChannelID, messageId: MessageID): Promise;
abstract checkUserReactionExists(
channelId: ChannelID,
messageId: MessageID,
userId: UserID,
emojiName: string,
emojiId?: EmojiID,
): Promise;
abstract lookupAttachmentByChannelAndFilename(
channelId: ChannelID,
attachmentId: AttachmentID,
filename: string,
): Promise;
abstract listChannelAttachments(channelId: ChannelID): Promise>;
abstract listMessagesByAuthor(
authorId: UserID,
limit?: number,
lastMessageId?: MessageID,
): Promise>;
abstract deleteMessagesByAuthor(
authorId: UserID,
channelIds?: Array,
messageIds?: Array,
): Promise;
abstract backfillMessagesByAuthorIndex(authorId: UserID): Promise;
abstract anonymizeMessage(channelId: ChannelID, messageId: MessageID, newAuthorId: UserID): Promise;
abstract deleteAllChannelMessages(channelId: ChannelID): Promise;
abstract updateEmbeds(message: Message): Promise;
}