forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node-slack.d.ts
61 lines (49 loc) · 1.61 KB
/
node-slack.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Type definitions for node-slack
// Project: https://github.com/xoxco/node-slack
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../request/request.d.ts" />
declare module "node-slack" {
import request = require('request');
class Slack {
constructor(hookUrl: string, option?: Slack.Option);
send(message: Slack.Message): any; //TODO: Here comes deferred's promise as a return type
send(message: Slack.Message, callback: Slack.SendCallback): request.Request;
respond(query: Slack.Query): Slack.TextResponse;
respond(query: Slack.Query, callback: Slack.ResponseCallback): Slack.TextResponse;
}
namespace Slack {
interface Option {
proxy: string;
}
interface Message {
text: string;
channel?: string;
username?: string;
icon_emoji?: string;
attachments?: any[];
unfurl_links?: boolean;
link_names?: number;
}
interface SendCallback {
(err: any, body: any): any;
}
interface Query {
token?: string;
team_id?: string;
channel_id?: string;
channel_name?: string;
timestamp?: number;
user_id?: string;
user_name?: string;
text: string;
}
interface TextResponse {
text: string;
}
interface ResponseCallback {
(err: any, query: Query): any;
}
}
export = Slack;
}