UNPKG

5.26 kBTypeScriptView Raw
1export declare type Channel = {
2 id: string;
3 name: string;
4 isChannel: boolean;
5 created: number;
6 creator: string;
7 isArchived: boolean;
8 isGeneral: boolean;
9 isMember: boolean;
10 members: string[];
11 topic: {
12 value: string;
13 creator: string;
14 lastSet: number;
15 };
16 purpose: {
17 value: string;
18 creator: string;
19 lastSet: number;
20 };
21 numMembers?: number;
22};
23export declare type Group = {
24 id: string;
25 name: string;
26 isGroup: boolean;
27 created: number;
28 creator: string;
29 isArchived: boolean;
30 isMpim: boolean;
31 members: string[];
32 topic: {
33 value: string;
34 creator: string;
35 lastSet: number;
36 };
37 purpose: {
38 value: string;
39 creator: string;
40 lastSet: number;
41 };
42 unreadCount?: number;
43 unreadCountDisplay?: number;
44};
45export interface IAction {
46 confirm?: {
47 title: string;
48 text: string;
49 okText: string;
50 dismissText: string;
51 };
52 label: string;
53 id: string;
54}
55export interface IButton extends IAction {
56 type?: 'default' | 'danger' | 'primary';
57 value: string;
58}
59export interface IMenu extends IAction {
60 options: 'users' | 'channels' | {
61 label: string;
62 value: string;
63 }[];
64}
65export declare type Attachment = {
66 text?: string;
67 title?: string;
68 color?: string;
69 pretext?: string;
70 titleLink?: string;
71 authorName?: string;
72 authorLink?: string;
73 authorIcon?: string;
74 callbackId?: string;
75 mrkdwnIn?: string[];
76 buttons?: IButton[];
77 menus?: IMenu[];
78 fields?: {
79 title: string;
80 value: string;
81 short?: boolean;
82 }[];
83 imageUrl?: string;
84 thumbUrl?: string;
85 footer?: string;
86 footerIcon?: string;
87};
88export declare type Message = {
89 attachments?: Attachment[];
90 text?: string;
91};
92export declare type MessageOptions = {
93 parse?: 'full' | 'none';
94 asUser?: boolean;
95 iconUrl?: string;
96 username?: string;
97 iconEmoji?: string;
98 linkNames?: 1;
99 unfurlLinks?: boolean;
100 unfurlMedia?: boolean;
101 replyBroadcast?: boolean;
102 threadTs?: string;
103};
104export declare type User = {
105 id: string;
106 title: string;
107 handle: string;
108 fullName: string;
109 teamId: string;
110 color: string;
111 deleted: boolean;
112 isAdmin: boolean;
113 isBot: boolean;
114 isOwner: boolean;
115 isPrimaryOwner: boolean;
116 isRestricted: boolean;
117 isUltraRestricted: boolean;
118 profile: {
119 avatarHash: string;
120 currentStatus: string;
121 email: string;
122 firstName: string;
123 image192: string;
124 image24: string;
125 image32: string;
126 image48: string;
127 image72: string;
128 lastName: string;
129 phone: string;
130 realName: string;
131 skype: string;
132 tz: string;
133 tzLabel: string;
134 tzOffset: number;
135 };
136};
137export declare type MiddlewareHandler = (context: MiddlewareContext) => void | Promise<void>;
138export declare type MiddlewareContext = {
139 /**
140 * Slack verification token
141 */
142 readonly token: string;
143 readonly callbackId: string;
144 readonly responseUrl: string;
145 readonly user: {
146 id: string;
147 name: string;
148 };
149 readonly team: {
150 id: string;
151 domain: string;
152 };
153 readonly channel: {
154 id: string;
155 name: string;
156 };
157 readonly action: {
158 value: string;
159 type: 'select' | 'button';
160 id: string;
161 };
162 /**
163 * Original message, all changes with this object will
164 * be passed to the Slack. Assigning null or undefined
165 * to this property will delete message in Slack
166 * @type {IMessage}
167 */
168 message: Message;
169 /**
170 * Ephemeral message that will be seen only by user
171 * @type {string}
172 */
173 ephemeral: string | Message;
174};
175export declare type FileUploadOptions = {
176 channels: string[];
177 content: string;
178 file: string;
179 filename: string;
180 filetype: string;
181 initialComment: string;
182 title: string;
183};
184export declare type File = {
185 id: string;
186 created: number;
187 timestamp: number;
188 name: string;
189 title: string;
190 mimetype: string;
191 filetype: string;
192 prettyType: string;
193 user: string;
194 mode: string;
195 editable: boolean;
196 isExternal: boolean;
197 externalType: string;
198 username: string;
199 size: number;
200 urlPrivate: string;
201 urlPrivateDownload: string;
202 thumb64: string;
203 thumb80: string;
204 thumb360: string;
205 thumb360Gif: string;
206 thumb360W: number;
207 thumb360H: number;
208 thumb480: string;
209 thumb480W: number;
210 thumb480H: number;
211 thumb160: string;
212 permalink: string;
213 permalinkPublic: string;
214 editLink: string;
215 preview: string;
216 previewHighlight: string;
217 lines: number;
218 linesMore: number;
219 isPublic: boolean;
220 publicUrlShared: boolean;
221 displayAsBot: boolean;
222 channels: string[];
223 groups: string[];
224 ims: string[];
225 initialComment: {};
226 numStars: number;
227 isStarred: boolean;
228 pinnedTo: string[];
229 reactions: {
230 name: string;
231 count: number;
232 users: string[];
233 }[];
234 commentsCount: number;
235};