@im-more/dsh-slack 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/cordis.patch.yml +13 -0
- package/lib/index.js +2659 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +66 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +165 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +49 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +54 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +126 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +396 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +61 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +196 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +27 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +35 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +14 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/modes/mrkdwn.d.ts +17 -0
- package/lib/types/modes/mrkdwn.d.ts.map +1 -0
- package/lib/types/modes/mrkdwn.js +123 -0
- package/lib/types/modes/mrkdwn.js.map +1 -0
- package/lib/types/modes/shared.d.ts +164 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +411 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/mrkdwn.d.ts +41 -0
- package/lib/types/mrkdwn.d.ts.map +1 -0
- package/lib/types/mrkdwn.js +137 -0
- package/lib/types/mrkdwn.js.map +1 -0
- package/lib/types/request.d.ts +225 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +330 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/send.d.ts +74 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +200 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/transport/socket.d.ts +58 -0
- package/lib/types/transport/socket.d.ts.map +1 -0
- package/lib/types/transport/socket.js +297 -0
- package/lib/types/transport/socket.js.map +1 -0
- package/lib/types/transport/webhook.d.ts +48 -0
- package/lib/types/transport/webhook.d.ts.map +1 -0
- package/lib/types/transport/webhook.js +210 -0
- package/lib/types/transport/webhook.js.map +1 -0
- package/lib/types/types/admin.d.ts +682 -0
- package/lib/types/types/admin.d.ts.map +1 -0
- package/lib/types/types/admin.js +172 -0
- package/lib/types/types/admin.js.map +1 -0
- package/lib/types/types/api.d.ts +20 -0
- package/lib/types/types/api.d.ts.map +1 -0
- package/lib/types/types/api.js +7 -0
- package/lib/types/types/api.js.map +1 -0
- package/lib/types/types/apps.d.ts +138 -0
- package/lib/types/types/apps.d.ts.map +1 -0
- package/lib/types/types/apps.js +28 -0
- package/lib/types/types/apps.js.map +1 -0
- package/lib/types/types/auth.d.ts +36 -0
- package/lib/types/types/auth.d.ts.map +1 -0
- package/lib/types/types/auth.js +10 -0
- package/lib/types/types/auth.js.map +1 -0
- package/lib/types/types/bots.d.ts +32 -0
- package/lib/types/types/bots.d.ts.map +1 -0
- package/lib/types/types/bots.js +7 -0
- package/lib/types/types/bots.js.map +1 -0
- package/lib/types/types/calls.d.ts +82 -0
- package/lib/types/types/calls.d.ts.map +1 -0
- package/lib/types/types/calls.js +22 -0
- package/lib/types/types/calls.js.map +1 -0
- package/lib/types/types/chat.d.ts +208 -0
- package/lib/types/types/chat.d.ts.map +1 -0
- package/lib/types/types/chat.js +34 -0
- package/lib/types/types/chat.js.map +1 -0
- package/lib/types/types/conversations.d.ts +266 -0
- package/lib/types/types/conversations.d.ts.map +1 -0
- package/lib/types/types/conversations.js +58 -0
- package/lib/types/types/conversations.js.map +1 -0
- package/lib/types/types/definition.d.ts +505 -0
- package/lib/types/types/definition.d.ts.map +1 -0
- package/lib/types/types/definition.js +2 -0
- package/lib/types/types/definition.js.map +1 -0
- package/lib/types/types/dialog.d.ts +20 -0
- package/lib/types/types/dialog.d.ts.map +1 -0
- package/lib/types/types/dialog.js +7 -0
- package/lib/types/types/dialog.js.map +1 -0
- package/lib/types/types/dnd.d.ts +70 -0
- package/lib/types/types/dnd.d.ts.map +1 -0
- package/lib/types/types/dnd.js +19 -0
- package/lib/types/types/dnd.js.map +1 -0
- package/lib/types/types/emoji.d.ts +18 -0
- package/lib/types/types/emoji.d.ts.map +1 -0
- package/lib/types/types/emoji.js +7 -0
- package/lib/types/types/emoji.js.map +1 -0
- package/lib/types/types/events/base-events.d.ts +235 -0
- package/lib/types/types/events/base-events.d.ts.map +1 -0
- package/lib/types/types/events/base-events.js +3 -0
- package/lib/types/types/events/base-events.js.map +1 -0
- package/lib/types/types/events/index.d.ts +97 -0
- package/lib/types/types/events/index.d.ts.map +1 -0
- package/lib/types/types/events/index.js +3 -0
- package/lib/types/types/events/index.js.map +1 -0
- package/lib/types/types/events/message-events.d.ts +215 -0
- package/lib/types/types/events/message-events.d.ts.map +1 -0
- package/lib/types/types/events/message-events.js +3 -0
- package/lib/types/types/events/message-events.js.map +1 -0
- package/lib/types/types/files.d.ts +189 -0
- package/lib/types/types/files.d.ts.map +1 -0
- package/lib/types/types/files.js +43 -0
- package/lib/types/types/files.js.map +1 -0
- package/lib/types/types/index.d.ts +82 -0
- package/lib/types/types/index.d.ts.map +1 -0
- package/lib/types/types/index.js +29 -0
- package/lib/types/types/index.js.map +1 -0
- package/lib/types/types/internal.d.ts +17 -0
- package/lib/types/types/internal.d.ts.map +1 -0
- package/lib/types/types/internal.js +60 -0
- package/lib/types/types/internal.js.map +1 -0
- package/lib/types/types/migration.d.ts +25 -0
- package/lib/types/types/migration.d.ts.map +1 -0
- package/lib/types/types/migration.js +7 -0
- package/lib/types/types/migration.js.map +1 -0
- package/lib/types/types/oauth.d.ts +50 -0
- package/lib/types/types/oauth.d.ts.map +1 -0
- package/lib/types/types/oauth.js +13 -0
- package/lib/types/types/oauth.js.map +1 -0
- package/lib/types/types/pins.d.ts +39 -0
- package/lib/types/types/pins.d.ts.map +1 -0
- package/lib/types/types/pins.js +13 -0
- package/lib/types/types/pins.js.map +1 -0
- package/lib/types/types/reactions.d.ts +75 -0
- package/lib/types/types/reactions.d.ts.map +1 -0
- package/lib/types/types/reactions.js +16 -0
- package/lib/types/types/reactions.js.map +1 -0
- package/lib/types/types/reminders.d.ts +64 -0
- package/lib/types/types/reminders.d.ts.map +1 -0
- package/lib/types/types/reminders.js +19 -0
- package/lib/types/types/reminders.js.map +1 -0
- package/lib/types/types/rtm.d.ts +30 -0
- package/lib/types/types/rtm.d.ts.map +1 -0
- package/lib/types/types/rtm.js +7 -0
- package/lib/types/types/rtm.js.map +1 -0
- package/lib/types/types/search.d.ts +24 -0
- package/lib/types/types/search.d.ts.map +1 -0
- package/lib/types/types/search.js +7 -0
- package/lib/types/types/search.js.map +1 -0
- package/lib/types/types/stars.d.ts +56 -0
- package/lib/types/types/stars.d.ts.map +1 -0
- package/lib/types/types/stars.js +13 -0
- package/lib/types/types/stars.js.map +1 -0
- package/lib/types/types/team.d.ts +98 -0
- package/lib/types/types/team.d.ts.map +1 -0
- package/lib/types/types/team.js +19 -0
- package/lib/types/types/team.js.map +1 -0
- package/lib/types/types/usergroups.d.ts +103 -0
- package/lib/types/types/usergroups.d.ts.map +1 -0
- package/lib/types/types/usergroups.js +25 -0
- package/lib/types/types/usergroups.js.map +1 -0
- package/lib/types/types/users.d.ts +169 -0
- package/lib/types/types/users.d.ts.map +1 -0
- package/lib/types/types/users.js +40 -0
- package/lib/types/types/users.js.map +1 -0
- package/lib/types/types/views.d.ts +56 -0
- package/lib/types/types/views.d.ts.map +1 -0
- package/lib/types/types/views.js +16 -0
- package/lib/types/types/views.js.map +1 -0
- package/lib/types/types/workflows.d.ts +45 -0
- package/lib/types/types/workflows.d.ts.map +1 -0
- package/lib/types/types/workflows.js +13 -0
- package/lib/types/types/workflows.js.map +1 -0
- package/package.json +65 -3
- package/src/bot.ts +273 -0
- package/src/config.ts +92 -0
- package/src/decode.ts +489 -0
- package/src/errors.ts +230 -0
- package/src/identity.ts +59 -0
- package/src/index.ts +64 -0
- package/src/modes/mrkdwn.ts +159 -0
- package/src/modes/shared.ts +515 -0
- package/src/mrkdwn.ts +146 -0
- package/src/request.ts +449 -0
- package/src/send.ts +300 -0
- package/src/transport/socket.ts +393 -0
- package/src/transport/webhook.ts +269 -0
- package/src/types/admin.ts +910 -0
- package/src/types/api.ts +28 -0
- package/src/types/apps.ts +175 -0
- package/src/types/auth.ts +49 -0
- package/src/types/bots.ts +40 -0
- package/src/types/calls.ts +110 -0
- package/src/types/chat.ts +255 -0
- package/src/types/conversations.ts +342 -0
- package/src/types/definition.ts +530 -0
- package/src/types/dialog.ts +28 -0
- package/src/types/dnd.ts +94 -0
- package/src/types/emoji.ts +26 -0
- package/src/types/events/base-events.ts +281 -0
- package/src/types/events/index.ts +125 -0
- package/src/types/events/message-events.ts +253 -0
- package/src/types/files.ts +245 -0
- package/src/types/index.ts +84 -0
- package/src/types/internal.ts +60 -0
- package/src/types/migration.ts +34 -0
- package/src/types/oauth.ts +66 -0
- package/src/types/pins.ts +55 -0
- package/src/types/reactions.ts +95 -0
- package/src/types/reminders.ts +88 -0
- package/src/types/rtm.ts +38 -0
- package/src/types/search.ts +32 -0
- package/src/types/stars.ts +72 -0
- package/src/types/team.ts +122 -0
- package/src/types/usergroups.ts +135 -0
- package/src/types/users.ts +221 -0
- package/src/types/views.ts +76 -0
- package/src/types/workflows.ts +61 -0
- package/README.md +0 -3
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Internal } from './internal.ts'
|
|
2
|
+
import { Definitions } from './definition.ts'
|
|
3
|
+
Internal.define({
|
|
4
|
+
'/files.comments.delete': {
|
|
5
|
+
POST: { 'filesCommentsDelete': true },
|
|
6
|
+
},
|
|
7
|
+
'/files.delete': {
|
|
8
|
+
POST: { 'filesDelete': true },
|
|
9
|
+
},
|
|
10
|
+
'/files.info': {
|
|
11
|
+
GET: { 'filesInfo': false },
|
|
12
|
+
},
|
|
13
|
+
'/files.list': {
|
|
14
|
+
GET: { 'filesList': false },
|
|
15
|
+
},
|
|
16
|
+
'/files.remote.add': {
|
|
17
|
+
POST: { 'filesRemoteAdd': false },
|
|
18
|
+
},
|
|
19
|
+
'/files.remote.info': {
|
|
20
|
+
GET: { 'filesRemoteInfo': false },
|
|
21
|
+
},
|
|
22
|
+
'/files.remote.list': {
|
|
23
|
+
GET: { 'filesRemoteList': false },
|
|
24
|
+
},
|
|
25
|
+
'/files.remote.remove': {
|
|
26
|
+
POST: { 'filesRemoteRemove': false },
|
|
27
|
+
},
|
|
28
|
+
'/files.remote.share': {
|
|
29
|
+
GET: { 'filesRemoteShare': false },
|
|
30
|
+
},
|
|
31
|
+
'/files.remote.update': {
|
|
32
|
+
POST: { 'filesRemoteUpdate': false },
|
|
33
|
+
},
|
|
34
|
+
'/files.revokePublicURL': {
|
|
35
|
+
POST: { 'filesRevokePublicURL': true },
|
|
36
|
+
},
|
|
37
|
+
'/files.sharedPublicURL': {
|
|
38
|
+
POST: { 'filesSharedPublicURL': true },
|
|
39
|
+
},
|
|
40
|
+
'/files.upload': {
|
|
41
|
+
POST: { 'filesUpload': false },
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export namespace Files {
|
|
46
|
+
export namespace Params {
|
|
47
|
+
export interface CommentsDelete {
|
|
48
|
+
file?: string
|
|
49
|
+
id?: string
|
|
50
|
+
}
|
|
51
|
+
export interface Delete {
|
|
52
|
+
file?: string
|
|
53
|
+
}
|
|
54
|
+
export interface Info {
|
|
55
|
+
file?: string
|
|
56
|
+
count?: string
|
|
57
|
+
page?: string
|
|
58
|
+
limit?: number
|
|
59
|
+
cursor?: string
|
|
60
|
+
}
|
|
61
|
+
export interface List {
|
|
62
|
+
user?: string
|
|
63
|
+
channel?: string
|
|
64
|
+
ts_from?: number
|
|
65
|
+
ts_to?: number
|
|
66
|
+
types?: string
|
|
67
|
+
count?: string
|
|
68
|
+
page?: string
|
|
69
|
+
show_files_hidden_by_limit?: boolean
|
|
70
|
+
}
|
|
71
|
+
export interface RemoteAdd {
|
|
72
|
+
external_id?: string
|
|
73
|
+
title?: string
|
|
74
|
+
filetype?: string
|
|
75
|
+
external_url?: string
|
|
76
|
+
preview_image?: string
|
|
77
|
+
indexable_file_contents?: string
|
|
78
|
+
}
|
|
79
|
+
export interface RemoteInfo {
|
|
80
|
+
file?: string
|
|
81
|
+
external_id?: string
|
|
82
|
+
}
|
|
83
|
+
export interface RemoteList {
|
|
84
|
+
channel?: string
|
|
85
|
+
ts_from?: number
|
|
86
|
+
ts_to?: number
|
|
87
|
+
limit?: number
|
|
88
|
+
cursor?: string
|
|
89
|
+
}
|
|
90
|
+
export interface RemoteRemove {
|
|
91
|
+
file?: string
|
|
92
|
+
external_id?: string
|
|
93
|
+
}
|
|
94
|
+
export interface RemoteShare {
|
|
95
|
+
file?: string
|
|
96
|
+
external_id?: string
|
|
97
|
+
channels?: string
|
|
98
|
+
}
|
|
99
|
+
export interface RemoteUpdate {
|
|
100
|
+
file?: string
|
|
101
|
+
external_id?: string
|
|
102
|
+
title?: string
|
|
103
|
+
filetype?: string
|
|
104
|
+
external_url?: string
|
|
105
|
+
preview_image?: string
|
|
106
|
+
indexable_file_contents?: string
|
|
107
|
+
}
|
|
108
|
+
export interface RevokePublicURL {
|
|
109
|
+
file?: string
|
|
110
|
+
}
|
|
111
|
+
export interface SharedPublicURL {
|
|
112
|
+
file?: string
|
|
113
|
+
}
|
|
114
|
+
export interface Upload {
|
|
115
|
+
file?: string
|
|
116
|
+
content?: string
|
|
117
|
+
filetype?: string
|
|
118
|
+
filename?: string
|
|
119
|
+
title?: string
|
|
120
|
+
initial_comment?: string
|
|
121
|
+
channels?: string
|
|
122
|
+
thread_ts?: number
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare module './internal' {
|
|
128
|
+
interface Internal {
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Deletes an existing comment on a file.
|
|
132
|
+
* @see https://api.slack.com/methods/files.comments.delete
|
|
133
|
+
*/
|
|
134
|
+
filesCommentsDelete(token: TokenInput, params: Files.Params.CommentsDelete): Promise<{
|
|
135
|
+
ok: boolean
|
|
136
|
+
}>
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Deletes a file.
|
|
140
|
+
* @see https://api.slack.com/methods/files.delete
|
|
141
|
+
*/
|
|
142
|
+
filesDelete(token: TokenInput, params: Files.Params.Delete): Promise<{
|
|
143
|
+
ok: boolean
|
|
144
|
+
}>
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Gets information about a file.
|
|
148
|
+
* @see https://api.slack.com/methods/files.info
|
|
149
|
+
*/
|
|
150
|
+
filesInfo(token: TokenInput, params: Files.Params.Info): Promise<{
|
|
151
|
+
comments: Definitions.Comments
|
|
152
|
+
content_html?: unknown
|
|
153
|
+
editor?: string
|
|
154
|
+
file: Definitions.File
|
|
155
|
+
ok: boolean
|
|
156
|
+
paging?: Definitions.Paging
|
|
157
|
+
response_metadata?: Definitions.ResponseMetadata
|
|
158
|
+
}>
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* List for a team, in a channel, or from a user with applied filters.
|
|
162
|
+
* @see https://api.slack.com/methods/files.list
|
|
163
|
+
*/
|
|
164
|
+
filesList(token: TokenInput, params: Files.Params.List): Promise<{
|
|
165
|
+
files: Definitions.File[]
|
|
166
|
+
ok: boolean
|
|
167
|
+
paging: Definitions.Paging
|
|
168
|
+
}>
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Adds a file from a remote service
|
|
172
|
+
* @see https://api.slack.com/methods/files.remote.add
|
|
173
|
+
*/
|
|
174
|
+
filesRemoteAdd(token: TokenInput, params: Files.Params.RemoteAdd): Promise<{
|
|
175
|
+
ok: boolean
|
|
176
|
+
}>
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Retrieve information about a remote file added to Slack
|
|
180
|
+
* @see https://api.slack.com/methods/files.remote.info
|
|
181
|
+
*/
|
|
182
|
+
filesRemoteInfo(token: TokenInput, params: Files.Params.RemoteInfo): Promise<{
|
|
183
|
+
ok: boolean
|
|
184
|
+
}>
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Retrieve information about a remote file added to Slack
|
|
188
|
+
* @see https://api.slack.com/methods/files.remote.list
|
|
189
|
+
*/
|
|
190
|
+
filesRemoteList(token: TokenInput, params: Files.Params.RemoteList): Promise<{
|
|
191
|
+
ok: boolean
|
|
192
|
+
}>
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Remove a remote file.
|
|
196
|
+
* @see https://api.slack.com/methods/files.remote.remove
|
|
197
|
+
*/
|
|
198
|
+
filesRemoteRemove(token: TokenInput, params: Files.Params.RemoteRemove): Promise<{
|
|
199
|
+
ok: boolean
|
|
200
|
+
}>
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Share a remote file into a channel.
|
|
204
|
+
* @see https://api.slack.com/methods/files.remote.share
|
|
205
|
+
*/
|
|
206
|
+
filesRemoteShare(token: TokenInput, params: Files.Params.RemoteShare): Promise<{
|
|
207
|
+
ok: boolean
|
|
208
|
+
}>
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Updates an existing remote file.
|
|
212
|
+
* @see https://api.slack.com/methods/files.remote.update
|
|
213
|
+
*/
|
|
214
|
+
filesRemoteUpdate(token: TokenInput, params: Files.Params.RemoteUpdate): Promise<{
|
|
215
|
+
ok: boolean
|
|
216
|
+
}>
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Revokes public/external sharing access for a file
|
|
220
|
+
* @see https://api.slack.com/methods/files.revokePublicURL
|
|
221
|
+
*/
|
|
222
|
+
filesRevokePublicURL(token: TokenInput, params: Files.Params.RevokePublicURL): Promise<{
|
|
223
|
+
file: Definitions.File
|
|
224
|
+
ok: boolean
|
|
225
|
+
}>
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Enables a file for public/external sharing.
|
|
229
|
+
* @see https://api.slack.com/methods/files.sharedPublicURL
|
|
230
|
+
*/
|
|
231
|
+
filesSharedPublicURL(token: TokenInput, params: Files.Params.SharedPublicURL): Promise<{
|
|
232
|
+
file: Definitions.File
|
|
233
|
+
ok: boolean
|
|
234
|
+
}>
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Uploads or creates a file.
|
|
238
|
+
* @see https://api.slack.com/methods/files.upload
|
|
239
|
+
*/
|
|
240
|
+
filesUpload(token: TokenInput, params: Files.Params.Upload): Promise<{
|
|
241
|
+
file: Definitions.File
|
|
242
|
+
ok: boolean
|
|
243
|
+
}>
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface SlackChannel {
|
|
2
|
+
id: string
|
|
3
|
+
name: string
|
|
4
|
+
is_channel: boolean
|
|
5
|
+
is_group: boolean
|
|
6
|
+
is_im: boolean
|
|
7
|
+
created: number
|
|
8
|
+
creator: string
|
|
9
|
+
is_archived: boolean
|
|
10
|
+
is_general: boolean
|
|
11
|
+
unlinked: number
|
|
12
|
+
name_normalized: string
|
|
13
|
+
is_read_only: boolean
|
|
14
|
+
is_shared: boolean
|
|
15
|
+
parent_conversation: null
|
|
16
|
+
is_ext_shared: boolean
|
|
17
|
+
is_org_shared: boolean
|
|
18
|
+
pending_shared: any[]
|
|
19
|
+
is_pending_ext_shared: boolean
|
|
20
|
+
is_member: boolean
|
|
21
|
+
is_private: boolean
|
|
22
|
+
is_mpim: boolean
|
|
23
|
+
last_read: string
|
|
24
|
+
topic: {
|
|
25
|
+
value: string
|
|
26
|
+
creator: string
|
|
27
|
+
last_set: number
|
|
28
|
+
}
|
|
29
|
+
purpose: {
|
|
30
|
+
value: string
|
|
31
|
+
creator: string
|
|
32
|
+
last_set: number
|
|
33
|
+
}
|
|
34
|
+
previous_names: string[]
|
|
35
|
+
locale: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SlackTeam {
|
|
39
|
+
id: string
|
|
40
|
+
name: string
|
|
41
|
+
domain: string
|
|
42
|
+
email_domain: string
|
|
43
|
+
icon: {
|
|
44
|
+
image_34: string
|
|
45
|
+
image_44: string
|
|
46
|
+
image_68: string
|
|
47
|
+
image_88: string
|
|
48
|
+
image_102: string
|
|
49
|
+
image_132: string
|
|
50
|
+
image_default: boolean
|
|
51
|
+
}
|
|
52
|
+
enterprise_id: string
|
|
53
|
+
enterprise_name: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export * from './events/index.ts'
|
|
57
|
+
export * from './internal.ts'
|
|
58
|
+
export * from './definition.ts'
|
|
59
|
+
|
|
60
|
+
export * from './admin.ts'
|
|
61
|
+
export * from './api.ts'
|
|
62
|
+
export * from './apps.ts'
|
|
63
|
+
export * from './auth.ts'
|
|
64
|
+
export * from './bots.ts'
|
|
65
|
+
export * from './calls.ts'
|
|
66
|
+
export * from './chat.ts'
|
|
67
|
+
export * from './conversations.ts'
|
|
68
|
+
export * from './dialog.ts'
|
|
69
|
+
export * from './dnd.ts'
|
|
70
|
+
export * from './emoji.ts'
|
|
71
|
+
export * from './files.ts'
|
|
72
|
+
export * from './migration.ts'
|
|
73
|
+
export * from './oauth.ts'
|
|
74
|
+
export * from './pins.ts'
|
|
75
|
+
export * from './reactions.ts'
|
|
76
|
+
export * from './reminders.ts'
|
|
77
|
+
export * from './rtm.ts'
|
|
78
|
+
export * from './search.ts'
|
|
79
|
+
export * from './stars.ts'
|
|
80
|
+
export * from './team.ts'
|
|
81
|
+
export * from './usergroups.ts'
|
|
82
|
+
export * from './users.ts'
|
|
83
|
+
export * from './views.ts'
|
|
84
|
+
export * from './workflows.ts'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Dict } from '@deepseek-ai/cordis-plugin-im-core'
|
|
2
|
+
import type { Http as HTTP } from '@deepseek-ai/cordis-plugin-http'
|
|
3
|
+
import type { SlackBot } from '../bot.ts'
|
|
4
|
+
import { encodeForm } from '../request.ts'
|
|
5
|
+
|
|
6
|
+
// https://api.slack.com/web#methods_supporting_json
|
|
7
|
+
|
|
8
|
+
type SupportPostJSON = boolean
|
|
9
|
+
|
|
10
|
+
export enum Token {
|
|
11
|
+
BOT = 0,
|
|
12
|
+
APP = 1,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TokenInput = string | Token
|
|
16
|
+
|
|
17
|
+
// https://api.slack.com/web#basics
|
|
18
|
+
export class Internal {
|
|
19
|
+
constructor(private bot: SlackBot, private http: HTTP) { }
|
|
20
|
+
|
|
21
|
+
// route: content-type
|
|
22
|
+
static define(routes: Dict<Partial<Record<string, Record<string, SupportPostJSON>>>>) {
|
|
23
|
+
for (const path in routes) {
|
|
24
|
+
for (const key in routes[path]!) {
|
|
25
|
+
const method = key as string
|
|
26
|
+
for (const name of Object.keys(routes[path]![method]!)) {
|
|
27
|
+
Reflect.set(Internal.prototype, name, async function (this: Internal, ...args: any[]) {
|
|
28
|
+
const headers: Dict = {}
|
|
29
|
+
const config: HTTP.RequestConfig = { headers }
|
|
30
|
+
let token = ''
|
|
31
|
+
if (typeof args[0] === 'string') {
|
|
32
|
+
token = args[0]
|
|
33
|
+
} else {
|
|
34
|
+
token = args[0] === Token.BOT ? this.bot.config.botToken : this.bot.config.token
|
|
35
|
+
}
|
|
36
|
+
headers.Authorization = `Bearer ${token}`
|
|
37
|
+
const supportJson = routes[path]![method]![name]
|
|
38
|
+
if (method === 'GET') {
|
|
39
|
+
config.params = args[1]
|
|
40
|
+
} else if (supportJson && !(args[1] instanceof FormData)) {
|
|
41
|
+
headers['content-type'] = 'application/json; charset=utf-8'
|
|
42
|
+
config.data = JSON.stringify(args[1])
|
|
43
|
+
} else {
|
|
44
|
+
headers['content-type'] = 'application/x-www-form-urlencoded'
|
|
45
|
+
config.data = args[1] instanceof FormData ? args[1] : encodeForm(args[1] ?? {})
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
// The routes are absolute paths of the Slack API root, which the http service resolves as a base URL.
|
|
49
|
+
const response = await this.http(path.replace(/^\/+/, ''), { ...config, method })
|
|
50
|
+
return await response.json()
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (!this.http.isError(error) || !error.response) throw error
|
|
53
|
+
throw new Error(`[${error.response.status}] ${await error.response.text()}`)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Internal } from './internal.ts'
|
|
2
|
+
|
|
3
|
+
Internal.define({
|
|
4
|
+
'/migration.exchange': {
|
|
5
|
+
GET: { 'migrationExchange': false },
|
|
6
|
+
},
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export namespace Migration {
|
|
10
|
+
export namespace Params {
|
|
11
|
+
export interface Exchange {
|
|
12
|
+
users: string
|
|
13
|
+
team_id?: string
|
|
14
|
+
to_old?: boolean
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module './internal' {
|
|
20
|
+
interface Internal {
|
|
21
|
+
/**
|
|
22
|
+
* For Enterprise Grid workspaces, map local user IDs to global user IDs
|
|
23
|
+
* @see https://api.slack.com/methods/migration.exchange
|
|
24
|
+
*/
|
|
25
|
+
migrationExchange(token: TokenInput, params: Migration.Params.Exchange): Promise<{
|
|
26
|
+
enterprise_id: string
|
|
27
|
+
invalid_user_ids?: string[]
|
|
28
|
+
ok: boolean
|
|
29
|
+
team_id: string
|
|
30
|
+
user_id_map?: {
|
|
31
|
+
}
|
|
32
|
+
}>
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Internal } from './internal.ts'
|
|
2
|
+
|
|
3
|
+
Internal.define({
|
|
4
|
+
'/oauth.access': {
|
|
5
|
+
GET: { 'oauthAccess': false },
|
|
6
|
+
},
|
|
7
|
+
'/oauth.token': {
|
|
8
|
+
GET: { 'oauthToken': false },
|
|
9
|
+
},
|
|
10
|
+
'/oauth.v2.access': {
|
|
11
|
+
GET: { 'oauthV2Access': false },
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export namespace Oauth {
|
|
16
|
+
export namespace Params {
|
|
17
|
+
export interface Access {
|
|
18
|
+
client_id?: string
|
|
19
|
+
client_secret?: string
|
|
20
|
+
code?: string
|
|
21
|
+
redirect_uri?: string
|
|
22
|
+
single_channel?: boolean
|
|
23
|
+
}
|
|
24
|
+
export interface Token {
|
|
25
|
+
client_id?: string
|
|
26
|
+
client_secret?: string
|
|
27
|
+
code?: string
|
|
28
|
+
redirect_uri?: string
|
|
29
|
+
single_channel?: boolean
|
|
30
|
+
}
|
|
31
|
+
export interface V2Access {
|
|
32
|
+
client_id?: string
|
|
33
|
+
client_secret?: string
|
|
34
|
+
code: string
|
|
35
|
+
redirect_uri?: string
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module './internal' {
|
|
41
|
+
interface Internal {
|
|
42
|
+
/**
|
|
43
|
+
* Exchanges a temporary OAuth verifier code for an access token.
|
|
44
|
+
* @see https://api.slack.com/methods/oauth.access
|
|
45
|
+
*/
|
|
46
|
+
oauthAccess(token: TokenInput, params: Oauth.Params.Access): Promise<{
|
|
47
|
+
ok: boolean
|
|
48
|
+
}>
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Exchanges a temporary OAuth verifier code for a workspace token.
|
|
52
|
+
* @see https://api.slack.com/methods/oauth.token
|
|
53
|
+
*/
|
|
54
|
+
oauthToken(token: TokenInput, params: Oauth.Params.Token): Promise<{
|
|
55
|
+
ok: boolean
|
|
56
|
+
}>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Exchanges a temporary OAuth verifier code for an access token.
|
|
60
|
+
* @see https://api.slack.com/methods/oauth.v2.access
|
|
61
|
+
*/
|
|
62
|
+
oauthV2Access(token: TokenInput, params: Oauth.Params.V2Access): Promise<{
|
|
63
|
+
ok: boolean
|
|
64
|
+
}>
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Internal } from './internal.ts'
|
|
2
|
+
|
|
3
|
+
Internal.define({
|
|
4
|
+
'/pins.add': {
|
|
5
|
+
POST: { 'pinsAdd': true },
|
|
6
|
+
},
|
|
7
|
+
'/pins.list': {
|
|
8
|
+
GET: { 'pinsList': false },
|
|
9
|
+
},
|
|
10
|
+
'/pins.remove': {
|
|
11
|
+
POST: { 'pinsRemove': true },
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export namespace Pins {
|
|
16
|
+
export namespace Params {
|
|
17
|
+
export interface Add {
|
|
18
|
+
channel: string
|
|
19
|
+
timestamp?: string
|
|
20
|
+
}
|
|
21
|
+
export interface List {
|
|
22
|
+
channel: string
|
|
23
|
+
}
|
|
24
|
+
export interface Remove {
|
|
25
|
+
channel: string
|
|
26
|
+
timestamp?: string
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare module './internal' {
|
|
32
|
+
interface Internal {
|
|
33
|
+
/**
|
|
34
|
+
* Pins an item to a channel.
|
|
35
|
+
* @see https://api.slack.com/methods/pins.add
|
|
36
|
+
*/
|
|
37
|
+
pinsAdd(token: TokenInput, params: Pins.Params.Add): Promise<{
|
|
38
|
+
ok: boolean
|
|
39
|
+
}>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Lists items pinned to a channel.
|
|
43
|
+
* @see https://api.slack.com/methods/pins.list
|
|
44
|
+
*/
|
|
45
|
+
pinsList(token: TokenInput, params: Pins.Params.List): Promise<unknown>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Un-pins an item from a channel.
|
|
49
|
+
* @see https://api.slack.com/methods/pins.remove
|
|
50
|
+
*/
|
|
51
|
+
pinsRemove(token: TokenInput, params: Pins.Params.Remove): Promise<{
|
|
52
|
+
ok: boolean
|
|
53
|
+
}>
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Internal } from './internal.ts'
|
|
2
|
+
import { Definitions } from './definition.ts'
|
|
3
|
+
Internal.define({
|
|
4
|
+
'/reactions.add': {
|
|
5
|
+
POST: { 'reactionsAdd': true },
|
|
6
|
+
},
|
|
7
|
+
'/reactions.get': {
|
|
8
|
+
GET: { 'reactionsGet': false },
|
|
9
|
+
},
|
|
10
|
+
'/reactions.list': {
|
|
11
|
+
GET: { 'reactionsList': false },
|
|
12
|
+
},
|
|
13
|
+
'/reactions.remove': {
|
|
14
|
+
POST: { 'reactionsRemove': true },
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export namespace Reactions {
|
|
19
|
+
export namespace Params {
|
|
20
|
+
export interface Add {
|
|
21
|
+
channel: string
|
|
22
|
+
name: string
|
|
23
|
+
timestamp: string
|
|
24
|
+
}
|
|
25
|
+
export interface Get {
|
|
26
|
+
channel?: string
|
|
27
|
+
file?: string
|
|
28
|
+
file_comment?: string
|
|
29
|
+
full?: boolean
|
|
30
|
+
timestamp?: string
|
|
31
|
+
}
|
|
32
|
+
export interface List {
|
|
33
|
+
user?: string
|
|
34
|
+
full?: boolean
|
|
35
|
+
count?: number
|
|
36
|
+
page?: number
|
|
37
|
+
cursor?: string
|
|
38
|
+
limit?: number
|
|
39
|
+
}
|
|
40
|
+
export interface Remove {
|
|
41
|
+
name: string
|
|
42
|
+
file?: string
|
|
43
|
+
file_comment?: string
|
|
44
|
+
channel?: string
|
|
45
|
+
timestamp?: string
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module './internal' {
|
|
51
|
+
interface Internal {
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Adds a reaction to an item.
|
|
55
|
+
* @see https://api.slack.com/methods/reactions.add
|
|
56
|
+
*/
|
|
57
|
+
reactionsAdd(token: TokenInput, params: Reactions.Params.Add): Promise<{
|
|
58
|
+
ok: boolean
|
|
59
|
+
}>
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Gets reactions for an item.
|
|
63
|
+
* @see https://api.slack.com/methods/reactions.get
|
|
64
|
+
*/
|
|
65
|
+
reactionsGet(token: TokenInput, params: Reactions.Params.Get): Promise<{
|
|
66
|
+
channel: string
|
|
67
|
+
message: Definitions.Message
|
|
68
|
+
ok: boolean
|
|
69
|
+
type: string
|
|
70
|
+
}>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Lists reactions made by a user.
|
|
74
|
+
* @see https://api.slack.com/methods/reactions.list
|
|
75
|
+
*/
|
|
76
|
+
reactionsList(token: TokenInput, params: Reactions.Params.List): Promise<{
|
|
77
|
+
items: {
|
|
78
|
+
channel: string
|
|
79
|
+
message: Definitions.Message
|
|
80
|
+
type: string
|
|
81
|
+
}[]
|
|
82
|
+
ok: boolean
|
|
83
|
+
paging?: Definitions.Paging
|
|
84
|
+
response_metadata?: Definitions.ResponseMetadata
|
|
85
|
+
}>
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Removes a reaction from an item.
|
|
89
|
+
* @see https://api.slack.com/methods/reactions.remove
|
|
90
|
+
*/
|
|
91
|
+
reactionsRemove(token: TokenInput, params: Reactions.Params.Remove): Promise<{
|
|
92
|
+
ok: boolean
|
|
93
|
+
}>
|
|
94
|
+
}
|
|
95
|
+
}
|