@river-build/sdk
Version:
For more details, visit the following resources:
84 lines • 3.6 kB
TypeScript
import { PersistedObservable } from '../../../observable/persistedObservable';
import { Identifiable, Store } from '../../../store/store';
import { RiverConnection } from '../../river-connection/riverConnection';
import { ChannelMessage_Post_Attachment, ChannelMessage_Post_Mention, PlainMessage } from '@river-build/proto';
import { MessageTimeline } from '../../timeline/timeline';
import { ChannelDetails, SpaceDapp } from '@river-build/web3';
import { Members } from '../../members/members';
export interface ChannelModel extends Identifiable {
/** The River `channelId` of the channel. */
id: string;
/** The River `spaceId` which this channel belongs. */
spaceId: string;
/** Whether the SyncAgent has joined this channel. */
isJoined: boolean;
/** The channel metadata {@link ChannelDetails}. */
metadata?: ChannelDetails;
}
export declare class Channel extends PersistedObservable<ChannelModel> {
private riverConnection;
private spaceDapp;
timeline: MessageTimeline;
members: Members;
constructor(id: string, spaceId: string, riverConnection: RiverConnection, spaceDapp: SpaceDapp, store: Store);
protected onLoaded(): void;
/** Joins the channel. */
join(): Promise<void>;
/** Sends a message to the channel.
* @param message - The message to send.
* @param options - Additional options for the message.
* @returns The event id of the message.
*/
sendMessage(message: string, options?: {
/** If set, this message will be linked to a thread with the specified message. */
threadId?: string;
/** If set, this message will be linked as a reply to the specified message. */
replyId?: string;
/** The users that are mentioned in the message */
mentions?: PlainMessage<ChannelMessage_Post_Mention>[];
/** The attachments in the message. You can attach images, videos, links, files, or even other messages. */
attachments?: PlainMessage<ChannelMessage_Post_Attachment>[];
}): Promise<{
eventId: string;
}>;
/** Pins a message to the top of the channel.
* @param eventId - The event id of the message to pin.
* @returns The event id of the pin action.
*/
pin(eventId: string): Promise<{
eventId: string;
error?: import("@river-build/proto").AddEventResponse_Error | undefined;
}>;
/** Unpins a message from the channel.
* @param eventId - The event id of the message to unpin.
* @returns The event id of the unpin action.
*/
unpin(eventId: string): Promise<{
eventId: string;
error?: import("@river-build/proto").AddEventResponse_Error | undefined;
}>;
/** Sends a reaction to a message.
* @param refEventId - The event id of the message to react to.
* @param reaction - The reaction to send. Can be any string, including emoji, unicode characters.
*/
sendReaction(refEventId: string, reaction: string): Promise<{
eventId: string;
}>;
/** Redacts your own event.
* @param eventId - The event id of the message to redact
* @param reason - The reason for the redaction
*/
redact(eventId: string, reason?: string): Promise<{
eventId: string;
}>;
/** Redacts any message as an admin.
* @param eventId - The event id of the message to redact
*/
adminRedact(eventId: string): Promise<{
eventId: string;
}>;
private onStreamInitialized;
private onStreamUserJoined;
private onStreamUserLeft;
}
//# sourceMappingURL=channel.d.ts.map