UNPKG

@coursebuilder/core

Version:

Core package for Course Builder

151 lines (149 loc) 4.38 kB
interface ChatPostMessageResponse { ok: boolean; channel: string; ts: string; message: { text: string; username: string; bot_id?: string; attachments?: MessageAttachment[]; type: string; subtype?: string; }; } interface MessageAttachment { fallback?: string; color?: string; pretext?: string; author_name?: string; author_link?: string; author_icon?: string; mrkdwn_in?: string[]; title?: string; title_link?: string; text?: string; fields?: { title: string; value: string; short?: boolean; }[]; image_url?: string; thumb_url?: string; footer?: string; footer_icon?: string; ts?: number; } interface PostEphemeralResponse { ok: boolean; message_ts: string; } interface PostEphemeralOptions { channel?: string; user: string; text?: string; icon_emoji?: string; username?: string; as_user?: boolean; thread_ts?: string; attachments?: MessageAttachment[]; } interface NotificationProviderConfig { id: string; name: string; type: 'notification'; options: NotificationProviderConsumerConfig; apiKey?: string; defaultChannelId?: string; sendNotification: (options: NotificationOptions) => Promise<ChatPostMessageResponse>; createChannel: (options: CreateChannelOptions) => Promise<CreateChannelResponse>; inviteToChannel: (options: InviteToChannelOptions) => Promise<InviteToChannelResponse>; postEphemeral: (options: PostEphemeralOptions) => Promise<PostEphemeralResponse>; } type NotificationProviderConsumerConfig = Omit<Partial<NotificationProviderConfig>, 'options' | 'type'> & { apiKey?: string; defaultChannelId?: string; }; type NotificationOptions = { attachments?: MessageAttachment[]; channel?: string; icon_emoji?: string; username?: string; text?: string; }; interface CreateChannelResponse { ok: boolean; channel: { id: string; name: string; is_channel: boolean; created: number; is_archived: boolean; is_general: boolean; unlinked: number; creator: string; name_normalized: string; is_shared: boolean; is_org_shared: boolean; is_member: boolean; is_private: boolean; is_mpim: boolean; last_read: string; latest: any; unread_count: number; unread_count_display: number; members: string[]; topic: { value: string; creator: string; last_set: number; }; purpose: { value: string; creator: string; last_set: number; }; }; } interface CreateChannelOptions { name: string; is_private?: boolean; } interface InviteToChannelResponse { ok: boolean; channel: { id: string; name: string; is_channel: boolean; created: number; creator: string; is_archived: boolean; is_general: boolean; name_normalized: string; is_shared: boolean; is_org_shared: boolean; is_member: boolean; is_private: boolean; is_mpim: boolean; is_read_only: boolean; is_pending_ext_shared: boolean; pending_shared: string[]; unlinked: number; }; } interface InviteToChannelOptions { /** * The ID of the public or private channel to invite users to */ channel: string; /** * A comma separated list of user IDs. Up to 1000 users may be listed. */ users: string | string[]; /** * When set to true and multiple user IDs are provided, continue inviting the valid ones while disregarding invalid IDs */ force?: boolean; } declare function SlackProvider(options: NotificationProviderConsumerConfig): NotificationProviderConfig; declare const mockSlackProvider: NotificationProviderConfig; export { type ChatPostMessageResponse, type CreateChannelOptions, type CreateChannelResponse, type InviteToChannelOptions, type InviteToChannelResponse, type MessageAttachment, type NotificationOptions, type NotificationProviderConfig, type NotificationProviderConsumerConfig, type PostEphemeralOptions, type PostEphemeralResponse, SlackProvider as default, mockSlackProvider };