@distilled.cloud/slack 0.0.0 → 1.0.0-rc.11

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.
Files changed (212) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts +27 -0
  3. package/lib/credentials.d.ts.map +1 -0
  4. package/lib/credentials.js +53 -0
  5. package/lib/credentials.js.map +1 -0
  6. package/lib/errors.d.ts +83 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +59 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/index.d.ts +17 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +17 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/pagination.d.ts +31 -0
  15. package/lib/pagination.d.ts.map +1 -0
  16. package/lib/pagination.js +31 -0
  17. package/lib/pagination.js.map +1 -0
  18. package/lib/protocol.d.ts +18 -0
  19. package/lib/protocol.d.ts.map +1 -0
  20. package/lib/protocol.js +230 -0
  21. package/lib/protocol.js.map +1 -0
  22. package/lib/retry.d.ts +52 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +45 -0
  25. package/lib/retry.js.map +1 -0
  26. package/lib/services/admin.d.ts +2796 -0
  27. package/lib/services/admin.d.ts.map +1 -0
  28. package/lib/services/admin.js +3217 -0
  29. package/lib/services/admin.js.map +1 -0
  30. package/lib/services/api.d.ts +23 -0
  31. package/lib/services/api.d.ts.map +1 -0
  32. package/lib/services/api.js +26 -0
  33. package/lib/services/api.js.map +1 -0
  34. package/lib/services/apps.d.ts +568 -0
  35. package/lib/services/apps.d.ts.map +1 -0
  36. package/lib/services/apps.js +584 -0
  37. package/lib/services/apps.js.map +1 -0
  38. package/lib/services/assistant.d.ts +290 -0
  39. package/lib/services/assistant.d.ts.map +1 -0
  40. package/lib/services/assistant.js +232 -0
  41. package/lib/services/assistant.js.map +1 -0
  42. package/lib/services/auth.d.ts +90 -0
  43. package/lib/services/auth.d.ts.map +1 -0
  44. package/lib/services/auth.js +114 -0
  45. package/lib/services/auth.js.map +1 -0
  46. package/lib/services/blocks.d.ts +31 -0
  47. package/lib/services/blocks.d.ts.map +1 -0
  48. package/lib/services/blocks.js +31 -0
  49. package/lib/services/blocks.js.map +1 -0
  50. package/lib/services/bookmarks.d.ts +91 -0
  51. package/lib/services/bookmarks.d.ts.map +1 -0
  52. package/lib/services/bookmarks.js +98 -0
  53. package/lib/services/bookmarks.js.map +1 -0
  54. package/lib/services/bots.d.ts +60 -0
  55. package/lib/services/bots.d.ts.map +1 -0
  56. package/lib/services/bots.js +68 -0
  57. package/lib/services/bots.js.map +1 -0
  58. package/lib/services/calls.d.ts +124 -0
  59. package/lib/services/calls.d.ts.map +1 -0
  60. package/lib/services/calls.js +136 -0
  61. package/lib/services/calls.js.map +1 -0
  62. package/lib/services/canvases.d.ts +152 -0
  63. package/lib/services/canvases.d.ts.map +1 -0
  64. package/lib/services/canvases.js +152 -0
  65. package/lib/services/canvases.js.map +1 -0
  66. package/lib/services/chat.d.ts +525 -0
  67. package/lib/services/chat.d.ts.map +1 -0
  68. package/lib/services/chat.js +436 -0
  69. package/lib/services/chat.js.map +1 -0
  70. package/lib/services/conversations.d.ts +642 -0
  71. package/lib/services/conversations.d.ts.map +1 -0
  72. package/lib/services/conversations.js +769 -0
  73. package/lib/services/conversations.js.map +1 -0
  74. package/lib/services/dialog.d.ts +20 -0
  75. package/lib/services/dialog.d.ts.map +1 -0
  76. package/lib/services/dialog.js +27 -0
  77. package/lib/services/dialog.js.map +1 -0
  78. package/lib/services/dnd.d.ts +94 -0
  79. package/lib/services/dnd.d.ts.map +1 -0
  80. package/lib/services/dnd.js +111 -0
  81. package/lib/services/dnd.js.map +1 -0
  82. package/lib/services/emoji.d.ts +35 -0
  83. package/lib/services/emoji.d.ts.map +1 -0
  84. package/lib/services/emoji.js +40 -0
  85. package/lib/services/emoji.js.map +1 -0
  86. package/lib/services/entity.d.ts +93 -0
  87. package/lib/services/entity.d.ts.map +1 -0
  88. package/lib/services/entity.js +89 -0
  89. package/lib/services/entity.js.map +1 -0
  90. package/lib/services/files.d.ts +473 -0
  91. package/lib/services/files.d.ts.map +1 -0
  92. package/lib/services/files.js +510 -0
  93. package/lib/services/files.js.map +1 -0
  94. package/lib/services/functions.d.ts +235 -0
  95. package/lib/services/functions.d.ts.map +1 -0
  96. package/lib/services/functions.js +256 -0
  97. package/lib/services/functions.js.map +1 -0
  98. package/lib/services/index.d.ts +35 -0
  99. package/lib/services/index.d.ts.map +1 -0
  100. package/lib/services/index.js +36 -0
  101. package/lib/services/index.js.map +1 -0
  102. package/lib/services/lists.d.ts +300 -0
  103. package/lib/services/lists.d.ts.map +1 -0
  104. package/lib/services/lists.js +366 -0
  105. package/lib/services/lists.js.map +1 -0
  106. package/lib/services/migration.d.ts +34 -0
  107. package/lib/services/migration.d.ts.map +1 -0
  108. package/lib/services/migration.js +36 -0
  109. package/lib/services/migration.js.map +1 -0
  110. package/lib/services/oauth.d.ts +307 -0
  111. package/lib/services/oauth.d.ts.map +1 -0
  112. package/lib/services/oauth.js +278 -0
  113. package/lib/services/oauth.js.map +1 -0
  114. package/lib/services/openid.d.ts +86 -0
  115. package/lib/services/openid.d.ts.map +1 -0
  116. package/lib/services/openid.js +93 -0
  117. package/lib/services/openid.js.map +1 -0
  118. package/lib/services/pins.d.ts +64 -0
  119. package/lib/services/pins.d.ts.map +1 -0
  120. package/lib/services/pins.js +75 -0
  121. package/lib/services/pins.js.map +1 -0
  122. package/lib/services/reactions.d.ts +108 -0
  123. package/lib/services/reactions.d.ts.map +1 -0
  124. package/lib/services/reactions.js +119 -0
  125. package/lib/services/reactions.js.map +1 -0
  126. package/lib/services/reminders.d.ts +89 -0
  127. package/lib/services/reminders.d.ts.map +1 -0
  128. package/lib/services/reminders.js +109 -0
  129. package/lib/services/reminders.js.map +1 -0
  130. package/lib/services/rtm.d.ts +68 -0
  131. package/lib/services/rtm.d.ts.map +1 -0
  132. package/lib/services/rtm.js +74 -0
  133. package/lib/services/rtm.js.map +1 -0
  134. package/lib/services/search.d.ts +239 -0
  135. package/lib/services/search.d.ts.map +1 -0
  136. package/lib/services/search.js +190 -0
  137. package/lib/services/search.js.map +1 -0
  138. package/lib/services/stars.d.ts +126 -0
  139. package/lib/services/stars.d.ts.map +1 -0
  140. package/lib/services/stars.js +145 -0
  141. package/lib/services/stars.js.map +1 -0
  142. package/lib/services/team.d.ts +309 -0
  143. package/lib/services/team.d.ts.map +1 -0
  144. package/lib/services/team.js +333 -0
  145. package/lib/services/team.js.map +1 -0
  146. package/lib/services/tooling.d.ts +31 -0
  147. package/lib/services/tooling.d.ts.map +1 -0
  148. package/lib/services/tooling.js +38 -0
  149. package/lib/services/tooling.js.map +1 -0
  150. package/lib/services/usergroups.d.ts +183 -0
  151. package/lib/services/usergroups.d.ts.map +1 -0
  152. package/lib/services/usergroups.js +180 -0
  153. package/lib/services/usergroups.js.map +1 -0
  154. package/lib/services/users.d.ts +246 -0
  155. package/lib/services/users.d.ts.map +1 -0
  156. package/lib/services/users.js +309 -0
  157. package/lib/services/users.js.map +1 -0
  158. package/lib/services/views.d.ts +84 -0
  159. package/lib/services/views.d.ts.map +1 -0
  160. package/lib/services/views.js +95 -0
  161. package/lib/services/views.js.map +1 -0
  162. package/lib/services/workflows.d.ts +231 -0
  163. package/lib/services/workflows.d.ts.map +1 -0
  164. package/lib/services/workflows.js +238 -0
  165. package/lib/services/workflows.js.map +1 -0
  166. package/lib/traits.d.ts +11 -0
  167. package/lib/traits.d.ts.map +1 -0
  168. package/lib/traits.js +12 -0
  169. package/lib/traits.js.map +1 -0
  170. package/package.json +82 -4
  171. package/src/credentials.ts +86 -0
  172. package/src/errors.ts +101 -0
  173. package/src/index.ts +20 -0
  174. package/src/pagination.ts +35 -0
  175. package/src/protocol.ts +326 -0
  176. package/src/retry.ts +76 -0
  177. package/src/services/admin.ts +7722 -0
  178. package/src/services/api.ts +58 -0
  179. package/src/services/apps.ts +1441 -0
  180. package/src/services/assistant.ts +639 -0
  181. package/src/services/auth.ts +241 -0
  182. package/src/services/blocks.ts +80 -0
  183. package/src/services/bookmarks.ts +223 -0
  184. package/src/services/bots.ts +144 -0
  185. package/src/services/calls.ts +318 -0
  186. package/src/services/canvases.ts +392 -0
  187. package/src/services/chat.ts +1191 -0
  188. package/src/services/conversations.ts +1754 -0
  189. package/src/services/dialog.ts +55 -0
  190. package/src/services/dnd.ts +246 -0
  191. package/src/services/emoji.ts +91 -0
  192. package/src/services/entity.ts +225 -0
  193. package/src/services/files.ts +1192 -0
  194. package/src/services/functions.ts +642 -0
  195. package/src/services/index.ts +35 -0
  196. package/src/services/lists.ts +832 -0
  197. package/src/services/migration.ts +85 -0
  198. package/src/services/oauth.ts +658 -0
  199. package/src/services/openid.ts +243 -0
  200. package/src/services/pins.ts +167 -0
  201. package/src/services/reactions.ts +272 -0
  202. package/src/services/reminders.ts +240 -0
  203. package/src/services/rtm.ts +162 -0
  204. package/src/services/search.ts +507 -0
  205. package/src/services/stars.ts +323 -0
  206. package/src/services/team.ts +834 -0
  207. package/src/services/tooling.ts +78 -0
  208. package/src/services/usergroups.ts +441 -0
  209. package/src/services/users.ts +685 -0
  210. package/src/services/views.ts +212 -0
  211. package/src/services/workflows.ts +605 -0
  212. package/src/traits.ts +45 -0
@@ -0,0 +1,241 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ SlackProtocol,
7
+ type SlackOpError,
8
+ type SlackOpContext,
9
+ } from "../protocol.ts";
10
+ import { slackPaginate } from "../pagination.ts";
11
+ import { SlackError, SlackRateLimited } from "../errors.ts";
12
+ import * as Retry from "../retry.ts";
13
+
14
+ export type { SlackOpError, SlackOpContext };
15
+
16
+ export interface ListTeamsRequest {
17
+ /** The maximum number of workspaces to return. Must be a positive integer no larger than 1000. */
18
+ limit?: number;
19
+ /** Set `cursor` to `next_cursor` returned by the previous call to list items in the next page. */
20
+ cursor?: string;
21
+ /** Whether to return icon paths for each workspace. An icon path represents a URI pointing to the image signifying the workspace. */
22
+ include_icon?: boolean;
23
+ }
24
+ export const ListTeamsRequest = /*@__PURE__*/ S.suspend(() =>
25
+ S.Struct({
26
+ limit: S.optional(S.Number),
27
+ cursor: S.optional(S.String),
28
+ include_icon: S.optional(S.Boolean),
29
+ }).pipe(
30
+ T.Http({
31
+ method: "POST",
32
+ uri: "/auth.teams.list",
33
+ code: 200,
34
+ contentType: "form-urlencoded",
35
+ }),
36
+ ),
37
+ ).annotate({
38
+ identifier: "ListTeamsRequest",
39
+ }) as any as S.Schema<ListTeamsRequest>;
40
+
41
+ /** Paths to icons */
42
+ export interface ListTeamsResponseTeamsItemIcon {
43
+ image_34?: string;
44
+ image_44?: string;
45
+ image_68?: string;
46
+ image_88?: string;
47
+ image_102?: string;
48
+ image_132?: string;
49
+ image_230?: string;
50
+ image_default?: boolean;
51
+ }
52
+ export const ListTeamsResponseTeamsItemIcon = /*@__PURE__*/ S.suspend(() =>
53
+ S.Struct({
54
+ image_34: S.optional(S.String),
55
+ image_44: S.optional(S.String),
56
+ image_68: S.optional(S.String),
57
+ image_88: S.optional(S.String),
58
+ image_102: S.optional(S.String),
59
+ image_132: S.optional(S.String),
60
+ image_230: S.optional(S.String),
61
+ image_default: S.optional(S.Boolean),
62
+ }),
63
+ ).annotate({
64
+ identifier: "ListTeamsResponseTeamsItemIcon",
65
+ }) as any as S.Schema<ListTeamsResponseTeamsItemIcon>;
66
+
67
+ export interface ListTeamsResponseTeamsItem {
68
+ /** ID of the workspace */
69
+ id?: string;
70
+ /** Name of the workspace */
71
+ name: string;
72
+ /** Paths to icons */
73
+ icon?: ListTeamsResponseTeamsItemIcon;
74
+ }
75
+ export const ListTeamsResponseTeamsItem = /*@__PURE__*/ S.suspend(() =>
76
+ S.Struct({
77
+ id: S.optional(S.String),
78
+ name: S.String,
79
+ icon: S.optional(ListTeamsResponseTeamsItemIcon),
80
+ }),
81
+ ).annotate({
82
+ identifier: "ListTeamsResponseTeamsItem",
83
+ }) as any as S.Schema<ListTeamsResponseTeamsItem>;
84
+
85
+ export type ListTeamsResponseTeamsList = Array<ListTeamsResponseTeamsItem>;
86
+ export const ListTeamsResponseTeamsList = /*@__PURE__*/ S.Array(
87
+ ListTeamsResponseTeamsItem,
88
+ ) as any as S.Schema<ListTeamsResponseTeamsList>;
89
+
90
+ /** Pagination metadata. An empty `next_cursor` means the last page. */
91
+ export interface ListTeamsResponseResponseMetadata {
92
+ /** Cursor for the next page — pass as `cursor` on the next call. */
93
+ next_cursor?: string;
94
+ }
95
+ export const ListTeamsResponseResponseMetadata = /*@__PURE__*/ S.suspend(() =>
96
+ S.Struct({
97
+ next_cursor: S.optional(S.String),
98
+ }),
99
+ ).annotate({
100
+ identifier: "ListTeamsResponseResponseMetadata",
101
+ }) as any as S.Schema<ListTeamsResponseResponseMetadata>;
102
+
103
+ export interface ListTeamsResponse {
104
+ /** Always `true` (a failed call raises a typed error instead). */
105
+ ok: boolean;
106
+ teams: ListTeamsResponseTeamsList;
107
+ /** Pagination metadata. An empty `next_cursor` means the last page. */
108
+ response_metadata?: ListTeamsResponseResponseMetadata;
109
+ }
110
+ export const ListTeamsResponse = /*@__PURE__*/ S.suspend(() =>
111
+ S.Struct({
112
+ ok: S.Boolean,
113
+ teams: ListTeamsResponseTeamsList,
114
+ response_metadata: S.optional(ListTeamsResponseResponseMetadata),
115
+ }),
116
+ ).annotate({
117
+ identifier: "ListTeamsResponse",
118
+ }) as any as S.Schema<ListTeamsResponse>;
119
+
120
+ export interface RevokeAuthRequest {
121
+ /** Setting this parameter to `1` triggers a _testing mode_ where the specified token will not actually be revoked. */
122
+ test?: boolean;
123
+ }
124
+ export const RevokeAuthRequest = /*@__PURE__*/ S.suspend(() =>
125
+ S.Struct({
126
+ test: S.optional(S.Boolean.pipe(T.Query())),
127
+ }).pipe(T.Http({ method: "GET", uri: "/auth.revoke", code: 200 })),
128
+ ).annotate({
129
+ identifier: "RevokeAuthRequest",
130
+ }) as any as S.Schema<RevokeAuthRequest>;
131
+
132
+ export interface RevokeAuthResponse {
133
+ /** Always `true` (a failed call raises a typed error instead). */
134
+ ok: boolean;
135
+ revoked: boolean;
136
+ }
137
+ export const RevokeAuthResponse = /*@__PURE__*/ S.suspend(() =>
138
+ S.Struct({
139
+ ok: S.Boolean,
140
+ revoked: S.Boolean,
141
+ }),
142
+ ).annotate({
143
+ identifier: "RevokeAuthResponse",
144
+ }) as any as S.Schema<RevokeAuthResponse>;
145
+
146
+ export interface TestAuthRequest {}
147
+ export const TestAuthRequest = /*@__PURE__*/ S.suspend(() =>
148
+ S.Struct({}).pipe(T.Http({ method: "POST", uri: "/auth.test", code: 200 })),
149
+ ).annotate({
150
+ identifier: "TestAuthRequest",
151
+ }) as any as S.Schema<TestAuthRequest>;
152
+
153
+ export interface TestAuthResponse {
154
+ /** Always `true` (a failed call raises a typed error instead). */
155
+ ok: boolean;
156
+ user_id?: string;
157
+ url?: string;
158
+ team_id?: string;
159
+ user?: string | null;
160
+ team?: string;
161
+ app_id?: string;
162
+ app_name?: string;
163
+ enterprise_id?: string;
164
+ bot_id?: string;
165
+ is_enterprise_install?: boolean;
166
+ expires_in?: number | null;
167
+ }
168
+ export const TestAuthResponse = /*@__PURE__*/ S.suspend(() =>
169
+ S.Struct({
170
+ ok: S.Boolean,
171
+ user_id: S.optional(S.String),
172
+ url: S.optional(S.String),
173
+ team_id: S.optional(S.String),
174
+ user: S.optional(S.NullOr(S.String)),
175
+ team: S.optional(S.String),
176
+ app_id: S.optional(S.String),
177
+ app_name: S.optional(S.String),
178
+ enterprise_id: S.optional(S.String),
179
+ bot_id: S.optional(S.String),
180
+ is_enterprise_install: S.optional(S.Boolean),
181
+ expires_in: S.optional(S.NullOr(S.Number)),
182
+ }),
183
+ ).annotate({
184
+ identifier: "TestAuthResponse",
185
+ }) as any as S.Schema<TestAuthResponse>;
186
+
187
+ export type ListTeamsError = SlackOpError;
188
+ /** Obtain a full list of workspaces your org-wide app has been approved for. Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `invalid_cursor` — Invalid cursor. - `invalid_limit` — The value passed for `limit` was not valid. - `invalid_auth` — The token doesn't have access to this endpoint. - `internal_error` — There was an internal error. See https://docs.slack.dev/reference/methods/auth.teams.list */
189
+ export const listTeams: API.PaginatedOperationMethod<
190
+ ListTeamsRequest,
191
+ ListTeamsResponse,
192
+ ListTeamsError,
193
+ SlackOpContext,
194
+ ListTeamsResponseTeamsItem
195
+ > = /*@__PURE__*/ API.makePaginated(
196
+ () => ({
197
+ input: ListTeamsRequest,
198
+ output: ListTeamsResponse,
199
+ errors: [SlackError, SlackRateLimited],
200
+ protocol: SlackProtocol,
201
+ retry: Retry.Retry,
202
+ pagination: {
203
+ mode: "cursor",
204
+ inputToken: "cursor",
205
+ outputToken: "response_metadata.next_cursor",
206
+ items: "teams",
207
+ pageSize: "limit",
208
+ } as const,
209
+ }),
210
+ slackPaginate,
211
+ ) as any;
212
+
213
+ export type RevokeAuthError = SlackOpError;
214
+ /** Revokes a token. Rate limit tier: 3 Method-specific errors (the `error` slug on the SlackError): - `internal_error` — Internal system error - `not_bearer_token` — Incompatible token type provided See https://docs.slack.dev/reference/methods/auth.revoke */
215
+ export const revokeAuth: API.OperationMethod<
216
+ RevokeAuthRequest,
217
+ RevokeAuthResponse,
218
+ RevokeAuthError,
219
+ SlackOpContext
220
+ > = /*@__PURE__*/ API.make(() => ({
221
+ input: RevokeAuthRequest,
222
+ output: RevokeAuthResponse,
223
+ errors: [SlackError, SlackRateLimited],
224
+ protocol: SlackProtocol,
225
+ retry: Retry.Retry,
226
+ }));
227
+
228
+ export type TestAuthError = SlackOpError;
229
+ /** Checks authentication & identity. Rate limit tier: 5 Method-specific errors (the `error` slug on the SlackError): - `internal_error` — An internal error has been found. - `invalid_auth` — Method was called with invalid credentials See https://docs.slack.dev/reference/methods/auth.test */
230
+ export const testAuth: API.OperationMethod<
231
+ TestAuthRequest,
232
+ TestAuthResponse,
233
+ TestAuthError,
234
+ SlackOpContext
235
+ > = /*@__PURE__*/ API.make(() => ({
236
+ input: TestAuthRequest,
237
+ output: TestAuthResponse,
238
+ errors: [SlackError, SlackRateLimited],
239
+ protocol: SlackProtocol,
240
+ retry: Retry.Retry,
241
+ }));
@@ -0,0 +1,80 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ SlackProtocol,
7
+ type SlackOpError,
8
+ type SlackOpContext,
9
+ } from "../protocol.ts";
10
+ import { SlackError, SlackRateLimited } from "../errors.ts";
11
+ import * as Retry from "../retry.ts";
12
+
13
+ export type { SlackOpError, SlackOpContext };
14
+
15
+ export type ValidateBlockRequestBlocksCase1ItemMap = {
16
+ [key: string]: unknown | undefined;
17
+ };
18
+ export const ValidateBlockRequestBlocksCase1ItemMap = /*@__PURE__*/ S.Record(
19
+ S.String,
20
+ S.Unknown,
21
+ ) as any as S.Schema<ValidateBlockRequestBlocksCase1ItemMap>;
22
+
23
+ export type ValidateBlockRequestBlocksCase1List =
24
+ Array<ValidateBlockRequestBlocksCase1ItemMap>;
25
+ export const ValidateBlockRequestBlocksCase1List = /*@__PURE__*/ S.Array(
26
+ ValidateBlockRequestBlocksCase1ItemMap,
27
+ ) as any as S.Schema<ValidateBlockRequestBlocksCase1List>;
28
+
29
+ /** A JSON-encoded array of [structured blocks](/reference/block-kit/blocks). Provide exactly one of `blocks`, `view`, or `message`. */
30
+ export type ValidateBlockRequestBlocks =
31
+ | string
32
+ | ValidateBlockRequestBlocksCase1List;
33
+ export const ValidateBlockRequestBlocks = /*@__PURE__*/ S.Unknown.pipe(
34
+ T.UnionCases([[], []]),
35
+ );
36
+
37
+ export interface ValidateBlockRequest {
38
+ /** A JSON-encoded array of [structured blocks](/reference/block-kit/blocks). Provide exactly one of `blocks`, `view`, or `message`. */
39
+ blocks?: ValidateBlockRequestBlocks;
40
+ /** A JSON-encoded [message payload](/messaging/creating-interactive-messages) to validate. Provide exactly one of `blocks`, `view`, or `message`. */
41
+ message?: string;
42
+ /** A JSON-encoded [view payload](/reference/views) to validate. Provide exactly one of `blocks`, `view`, or `message`. */
43
+ view?: string;
44
+ }
45
+ export const ValidateBlockRequest = /*@__PURE__*/ S.suspend(() =>
46
+ S.Struct({
47
+ blocks: S.optional(ValidateBlockRequestBlocks),
48
+ message: S.optional(S.String),
49
+ view: S.optional(S.String),
50
+ }).pipe(T.Http({ method: "POST", uri: "/blocks.validate", code: 200 })),
51
+ ).annotate({
52
+ identifier: "ValidateBlockRequest",
53
+ }) as any as S.Schema<ValidateBlockRequest>;
54
+
55
+ export interface ValidateBlockResponse {
56
+ /** Always `true` (a failed call raises a typed error instead). */
57
+ ok: boolean;
58
+ }
59
+ export const ValidateBlockResponse = /*@__PURE__*/ S.suspend(() =>
60
+ S.Struct({
61
+ ok: S.Boolean,
62
+ }),
63
+ ).annotate({
64
+ identifier: "ValidateBlockResponse",
65
+ }) as any as S.Schema<ValidateBlockResponse>;
66
+
67
+ export type ValidateBlockError = SlackOpError;
68
+ /** Validates blocks, messages, and views Block Kit JSON payloads. Method-specific errors (the `error` slug on the SlackError): - `invalid_arguments` — The request arguments are invalid. Ensure you provide exactly one of `blocks`, `view`, or `message`, and that the value is valid JSON. Consult `response_metadata.messages` for details. - `invalid_blocks` — The blocks array failed validation. The `errors` field contains a list of issues, each with a JSON pointer path to the invalid element, the constraint that failed, and the expected value. - `invalid_view` — The view payload failed validation. The `errors` field contains a list of issues, each with a JSON pointer path to the invalid element, the constraint that failed, and the expected value. - `invalid_message` — The message payload failed validation. The `errors` field contains a list of issues, each with a JSON pointer path to the invalid element, the constraint that failed, and the expected value. - `ratelimited` — Too many requests. Reduce your request rate and retry after a brief wait. See https://docs.slack.dev/reference/methods/blocks.validate */
69
+ export const validateBlock: API.OperationMethod<
70
+ ValidateBlockRequest,
71
+ ValidateBlockResponse,
72
+ ValidateBlockError,
73
+ SlackOpContext
74
+ > = /*@__PURE__*/ API.make(() => ({
75
+ input: ValidateBlockRequest,
76
+ output: ValidateBlockResponse,
77
+ errors: [SlackError, SlackRateLimited],
78
+ protocol: SlackProtocol,
79
+ retry: Retry.Retry,
80
+ }));
@@ -0,0 +1,223 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ SlackProtocol,
7
+ type SlackOpError,
8
+ type SlackOpContext,
9
+ } from "../protocol.ts";
10
+ import { SlackError, SlackRateLimited } from "../errors.ts";
11
+ import * as Retry from "../retry.ts";
12
+
13
+ export type { SlackOpError, SlackOpContext };
14
+
15
+ /** The level that we are setting the file's permission to (read or write) */
16
+ export type AddBookmarkRequestAccessLevel = "read" | "write";
17
+ export const AddBookmarkRequestAccessLevel = S.String;
18
+
19
+ export interface AddBookmarkRequest {
20
+ /** Channel to add bookmark in. Required for public channels. */
21
+ channel_id?: string;
22
+ /** Title for the bookmark. */
23
+ title: string;
24
+ /** Link to bookmark. */
25
+ link?: string;
26
+ /** Type of the bookmark i.e link. */
27
+ type: string;
28
+ /** Emoji tag to apply to the link. */
29
+ emoji?: string;
30
+ /** ID of the entity being bookmarked. Only applies to message and file types. */
31
+ entity_id?: string;
32
+ /** The level that we are setting the file's permission to (read or write) */
33
+ access_level?: AddBookmarkRequestAccessLevel | (string & {});
34
+ /** Id of this bookmark's parent */
35
+ parent_id?: string;
36
+ }
37
+ export const AddBookmarkRequest = /*@__PURE__*/ S.suspend(() =>
38
+ S.Struct({
39
+ channel_id: S.optional(S.String),
40
+ title: S.String,
41
+ link: S.optional(S.String),
42
+ type: S.String,
43
+ emoji: S.optional(S.String),
44
+ entity_id: S.optional(S.String),
45
+ access_level: S.optional(AddBookmarkRequestAccessLevel),
46
+ parent_id: S.optional(S.String),
47
+ }).pipe(T.Http({ method: "POST", uri: "/bookmarks.add", code: 200 })),
48
+ ).annotate({
49
+ identifier: "AddBookmarkRequest",
50
+ }) as any as S.Schema<AddBookmarkRequest>;
51
+
52
+ export interface AddBookmarkResponse {
53
+ /** Always `true` (a failed call raises a typed error instead). */
54
+ ok: boolean;
55
+ bookmark: unknown;
56
+ }
57
+ export const AddBookmarkResponse = /*@__PURE__*/ S.suspend(() =>
58
+ S.Struct({
59
+ ok: S.Boolean,
60
+ bookmark: S.Unknown,
61
+ }),
62
+ ).annotate({
63
+ identifier: "AddBookmarkResponse",
64
+ }) as any as S.Schema<AddBookmarkResponse>;
65
+
66
+ export interface EditBookmarkRequest {
67
+ /** Channel to update bookmark in. Required for public channels. */
68
+ channel_id?: string;
69
+ /** Bookmark to update. Required for public channels. */
70
+ bookmark_id?: string;
71
+ /** Title for the bookmark. */
72
+ title?: string;
73
+ /** Link to bookmark. */
74
+ link?: string;
75
+ /** Emoji tag to apply to the link. */
76
+ emoji?: string;
77
+ }
78
+ export const EditBookmarkRequest = /*@__PURE__*/ S.suspend(() =>
79
+ S.Struct({
80
+ channel_id: S.optional(S.String),
81
+ bookmark_id: S.optional(S.String),
82
+ title: S.optional(S.String),
83
+ link: S.optional(S.String),
84
+ emoji: S.optional(S.String),
85
+ }).pipe(T.Http({ method: "POST", uri: "/bookmarks.edit", code: 200 })),
86
+ ).annotate({
87
+ identifier: "EditBookmarkRequest",
88
+ }) as any as S.Schema<EditBookmarkRequest>;
89
+
90
+ export interface EditBookmarkResponse {
91
+ /** Always `true` (a failed call raises a typed error instead). */
92
+ ok: boolean;
93
+ bookmark: unknown;
94
+ }
95
+ export const EditBookmarkResponse = /*@__PURE__*/ S.suspend(() =>
96
+ S.Struct({
97
+ ok: S.Boolean,
98
+ bookmark: S.Unknown,
99
+ }),
100
+ ).annotate({
101
+ identifier: "EditBookmarkResponse",
102
+ }) as any as S.Schema<EditBookmarkResponse>;
103
+
104
+ export interface ListBookmarksRequest {
105
+ /** Channel to list bookmarks in. Required for public channels. */
106
+ channel_id?: string;
107
+ }
108
+ export const ListBookmarksRequest = /*@__PURE__*/ S.suspend(() =>
109
+ S.Struct({
110
+ channel_id: S.optional(S.String),
111
+ }).pipe(T.Http({ method: "POST", uri: "/bookmarks.list", code: 200 })),
112
+ ).annotate({
113
+ identifier: "ListBookmarksRequest",
114
+ }) as any as S.Schema<ListBookmarksRequest>;
115
+
116
+ export type ListBookmarksResponseBookmarksList = Array<unknown>;
117
+ export const ListBookmarksResponseBookmarksList = /*@__PURE__*/ S.Array(
118
+ S.Unknown,
119
+ ) as any as S.Schema<ListBookmarksResponseBookmarksList>;
120
+
121
+ export interface ListBookmarksResponse {
122
+ /** Always `true` (a failed call raises a typed error instead). */
123
+ ok: boolean;
124
+ bookmarks: ListBookmarksResponseBookmarksList;
125
+ }
126
+ export const ListBookmarksResponse = /*@__PURE__*/ S.suspend(() =>
127
+ S.Struct({
128
+ ok: S.Boolean,
129
+ bookmarks: ListBookmarksResponseBookmarksList,
130
+ }),
131
+ ).annotate({
132
+ identifier: "ListBookmarksResponse",
133
+ }) as any as S.Schema<ListBookmarksResponse>;
134
+
135
+ export interface RemoveBookmarkRequest {
136
+ /** Channel to remove bookmark. Required for public channels. */
137
+ channel_id?: string;
138
+ /** Bookmark to remove. Required for public channels. */
139
+ bookmark_id?: string;
140
+ /** Quip section ID to unbookmark */
141
+ quip_section_id?: string;
142
+ }
143
+ export const RemoveBookmarkRequest = /*@__PURE__*/ S.suspend(() =>
144
+ S.Struct({
145
+ channel_id: S.optional(S.String),
146
+ bookmark_id: S.optional(S.String),
147
+ quip_section_id: S.optional(S.String),
148
+ }).pipe(T.Http({ method: "POST", uri: "/bookmarks.remove", code: 200 })),
149
+ ).annotate({
150
+ identifier: "RemoveBookmarkRequest",
151
+ }) as any as S.Schema<RemoveBookmarkRequest>;
152
+
153
+ export interface RemoveBookmarkResponse {
154
+ /** Always `true` (a failed call raises a typed error instead). */
155
+ ok: boolean;
156
+ }
157
+ export const RemoveBookmarkResponse = /*@__PURE__*/ S.suspend(() =>
158
+ S.Struct({
159
+ ok: S.Boolean,
160
+ }),
161
+ ).annotate({
162
+ identifier: "RemoveBookmarkResponse",
163
+ }) as any as S.Schema<RemoveBookmarkResponse>;
164
+
165
+ export type AddBookmarkError = SlackOpError;
166
+ /** Add bookmark to a channel. Required scopes — bot: `bookmarks:write`; user: `bookmarks:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `access_denied` — Actor lacks access to the requested resource. - `cannot_bookmark_from_external_org` — File is an external file and cannot be bookmarked. - `cannot_bookmark_restricted_sharing_enabled` — File has restricted sharing enabled and cannot be bookmarked. - `channel_not_found` — Channel cannot be found. - `file_already_added` — The file has already been added to the folder. - `file_not_found` — File cannot be found. - `invalid_bookmark_type` — Bookmark type is not valid. - `invalid_app_action_type` — App action type is not valid. - `invalid_shortcut_type` — Shortcut type is not valid. - `invalid_child_type` — Child type is not valid. - `invalid_emoji` — Invalid emoji, does not follow the pattern of a valid emoji name. - `invalid_entity_id` — Invalid entity_id, file or message type bookmark should have original file or message ID. - `invalid_link` — Invalid link, link should begin with either http:// or https://. - `invalid_parent_type` — Parent type is not valid. - `not_implemented` — bookmarking not available for the user. - `parent_bookmark_disabled` — Parent bookmark feature flag is off. - `parent_with_link` — Parent bookmark should not have link. - `permission_denied` — No permission to perform this operation. - `slack_connect_file_upload_sharing_blocked` — Admin has disabled File uploads in all Slack Connect communications - `slack_connect_clip_sharing_blocked` — Admin has disabled Clip sharing in Slack Connect channels - `slack_connect_blocked_file_type` — Files with certain extensions are blocked from being uploaded in all Slack Connect communications - `too_many_bookmarks` — Bookmark limit reached for channel. - `too_many_tabs` — tab limit reached for channel. - `too_many_requests` — Too many concurrent requests. Please retry. See https://docs.slack.dev/reference/methods/bookmarks.add */
167
+ export const addBookmark: API.OperationMethod<
168
+ AddBookmarkRequest,
169
+ AddBookmarkResponse,
170
+ AddBookmarkError,
171
+ SlackOpContext
172
+ > = /*@__PURE__*/ API.make(() => ({
173
+ input: AddBookmarkRequest,
174
+ output: AddBookmarkResponse,
175
+ errors: [SlackError, SlackRateLimited],
176
+ protocol: SlackProtocol,
177
+ retry: Retry.Retry,
178
+ }));
179
+
180
+ export type EditBookmarkError = SlackOpError;
181
+ /** Edit bookmark. Required scopes — bot: `bookmarks:write`; user: `bookmarks:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `access_denied` — Actor lacks access to the requested resource. - `channel_not_found` — Channel cannot be found. - `invalid_bookmark_type` — Bookmark type is not valid. - `invalid_emoji` — Invalid emoji, does not follow the pattern of a valid emoji name. - `invalid_link` — Invalid link, link should begin with either http:// or https://. - `not_found` — Bookmark cannot be found. - `not_implemented` — bookmarking not available for the user. - `parent_with_link` — Parent bookmark should not have link. - `permission_denied` — No permission to perform this operation. - `slack_connect_file_upload_sharing_blocked` — Admin has disabled File uploads in all Slack Connect communications - `slack_connect_clip_sharing_blocked` — Admin has disabled Clip sharing in Slack Connect channels - `slack_connect_blocked_file_type` — Files with certain extensions are blocked from being uploaded in all Slack Connect communications See https://docs.slack.dev/reference/methods/bookmarks.edit */
182
+ export const editBookmark: API.OperationMethod<
183
+ EditBookmarkRequest,
184
+ EditBookmarkResponse,
185
+ EditBookmarkError,
186
+ SlackOpContext
187
+ > = /*@__PURE__*/ API.make(() => ({
188
+ input: EditBookmarkRequest,
189
+ output: EditBookmarkResponse,
190
+ errors: [SlackError, SlackRateLimited],
191
+ protocol: SlackProtocol,
192
+ retry: Retry.Retry,
193
+ }));
194
+
195
+ export type ListBookmarksError = SlackOpError;
196
+ /** List bookmark for the channel. Required scopes — bot: `bookmarks:read`; user: `bookmarks:read` Rate limit tier: 3 Method-specific errors (the `error` slug on the SlackError): - `access_denied` — Actor lacks access to the requested resource. - `channel_not_found` — Channel cannot be found. - `not_implemented` — bookmarking not available for the user. See https://docs.slack.dev/reference/methods/bookmarks.list */
197
+ export const listBookmarks: API.OperationMethod<
198
+ ListBookmarksRequest,
199
+ ListBookmarksResponse,
200
+ ListBookmarksError,
201
+ SlackOpContext
202
+ > = /*@__PURE__*/ API.make(() => ({
203
+ input: ListBookmarksRequest,
204
+ output: ListBookmarksResponse,
205
+ errors: [SlackError, SlackRateLimited],
206
+ protocol: SlackProtocol,
207
+ retry: Retry.Retry,
208
+ }));
209
+
210
+ export type RemoveBookmarkError = SlackOpError;
211
+ /** Remove bookmark from the channel. Required scopes — bot: `bookmarks:write`; user: `bookmarks:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `access_denied` — Actor lacks access to the requested resource. - `channel_not_found` — Channel cannot be found. - `user_not_found` — User cannot be found. - `invalid_bookmark_type` — Bookmark type is not valid. - `not_found` — Bookmark cannot be found. - `not_implemented` — bookmarking not available for the user. - `permission_denied` — No permission to perform this operation. See https://docs.slack.dev/reference/methods/bookmarks.remove */
212
+ export const removeBookmark: API.OperationMethod<
213
+ RemoveBookmarkRequest,
214
+ RemoveBookmarkResponse,
215
+ RemoveBookmarkError,
216
+ SlackOpContext
217
+ > = /*@__PURE__*/ API.make(() => ({
218
+ input: RemoveBookmarkRequest,
219
+ output: RemoveBookmarkResponse,
220
+ errors: [SlackError, SlackRateLimited],
221
+ protocol: SlackProtocol,
222
+ retry: Retry.Retry,
223
+ }));
@@ -0,0 +1,144 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ SlackProtocol,
7
+ type SlackOpError,
8
+ type SlackOpContext,
9
+ } from "../protocol.ts";
10
+ import { SlackError, SlackRateLimited } from "../errors.ts";
11
+ import * as Retry from "../retry.ts";
12
+
13
+ export type { SlackOpError, SlackOpContext };
14
+
15
+ export interface BotsInfoRequest {
16
+ /** Bot user to get info on */
17
+ bot?: string;
18
+ /** encoded team id or enterprise id where the bot exists, required if org token is used */
19
+ team_id?: string;
20
+ }
21
+ export const BotsInfoRequest = /*@__PURE__*/ S.suspend(() =>
22
+ S.Struct({
23
+ bot: S.optional(S.String.pipe(T.Query())),
24
+ team_id: S.optional(S.String.pipe(T.Query())),
25
+ }).pipe(T.Http({ method: "GET", uri: "/bots.info", code: 200 })),
26
+ ).annotate({
27
+ identifier: "BotsInfoRequest",
28
+ }) as any as S.Schema<BotsInfoRequest>;
29
+
30
+ export interface BotsInfoResponseBotsItemIcons {
31
+ emoji?: string;
32
+ image_36?: string;
33
+ image_48?: string;
34
+ image_64?: string;
35
+ image_72?: string;
36
+ }
37
+ export const BotsInfoResponseBotsItemIcons = /*@__PURE__*/ S.suspend(() =>
38
+ S.Struct({
39
+ emoji: S.optional(S.String),
40
+ image_36: S.optional(S.String),
41
+ image_48: S.optional(S.String),
42
+ image_64: S.optional(S.String),
43
+ image_72: S.optional(S.String),
44
+ }),
45
+ ).annotate({
46
+ identifier: "BotsInfoResponseBotsItemIcons",
47
+ }) as any as S.Schema<BotsInfoResponseBotsItemIcons>;
48
+
49
+ export interface BotsInfoResponseBotsItem {
50
+ updated: number;
51
+ name?: string;
52
+ icons?: BotsInfoResponseBotsItemIcons;
53
+ deleted: boolean;
54
+ app_id?: string;
55
+ id: string;
56
+ is_workflow_bot?: boolean;
57
+ is_connector_bot?: boolean;
58
+ is_legacy_workflow_bot?: boolean;
59
+ user_id?: string;
60
+ }
61
+ export const BotsInfoResponseBotsItem = /*@__PURE__*/ S.suspend(() =>
62
+ S.Struct({
63
+ updated: S.Number,
64
+ name: S.optional(S.String),
65
+ icons: S.optional(BotsInfoResponseBotsItemIcons),
66
+ deleted: S.Boolean,
67
+ app_id: S.optional(S.String),
68
+ id: S.String,
69
+ is_workflow_bot: S.optional(S.Boolean),
70
+ is_connector_bot: S.optional(S.Boolean),
71
+ is_legacy_workflow_bot: S.optional(S.Boolean),
72
+ user_id: S.optional(S.String),
73
+ }),
74
+ ).annotate({
75
+ identifier: "BotsInfoResponseBotsItem",
76
+ }) as any as S.Schema<BotsInfoResponseBotsItem>;
77
+
78
+ export type BotsInfoResponseBotsList = Array<BotsInfoResponseBotsItem>;
79
+ export const BotsInfoResponseBotsList = /*@__PURE__*/ S.Array(
80
+ BotsInfoResponseBotsItem,
81
+ ) as any as S.Schema<BotsInfoResponseBotsList>;
82
+
83
+ export type BotsInfoResponseBotIcons = BotsInfoResponseBotsItemIcons;
84
+ export const BotsInfoResponseBotIcons = BotsInfoResponseBotsItemIcons;
85
+
86
+ export interface BotsInfoResponseBot {
87
+ updated: number;
88
+ user_id?: string;
89
+ name?: string;
90
+ icons?: BotsInfoResponseBotsItemIcons;
91
+ deleted: boolean;
92
+ app_id?: string;
93
+ id: string;
94
+ is_workflow_bot?: boolean;
95
+ is_connector_bot?: boolean;
96
+ is_legacy_workflow_bot?: boolean;
97
+ }
98
+ export const BotsInfoResponseBot = /*@__PURE__*/ S.suspend(() =>
99
+ S.Struct({
100
+ updated: S.Number,
101
+ user_id: S.optional(S.String),
102
+ name: S.optional(S.String),
103
+ icons: S.optional(BotsInfoResponseBotsItemIcons),
104
+ deleted: S.Boolean,
105
+ app_id: S.optional(S.String),
106
+ id: S.String,
107
+ is_workflow_bot: S.optional(S.Boolean),
108
+ is_connector_bot: S.optional(S.Boolean),
109
+ is_legacy_workflow_bot: S.optional(S.Boolean),
110
+ }),
111
+ ).annotate({
112
+ identifier: "BotsInfoResponseBot",
113
+ }) as any as S.Schema<BotsInfoResponseBot>;
114
+
115
+ export interface BotsInfoResponse {
116
+ /** Always `true` (a failed call raises a typed error instead). */
117
+ ok: boolean;
118
+ bots?: BotsInfoResponseBotsList;
119
+ bot?: BotsInfoResponseBot;
120
+ }
121
+ export const BotsInfoResponse = /*@__PURE__*/ S.suspend(() =>
122
+ S.Struct({
123
+ ok: S.Boolean,
124
+ bots: S.optional(BotsInfoResponseBotsList),
125
+ bot: S.optional(BotsInfoResponseBot),
126
+ }),
127
+ ).annotate({
128
+ identifier: "BotsInfoResponse",
129
+ }) as any as S.Schema<BotsInfoResponse>;
130
+
131
+ export type BotsInfoError = SlackOpError;
132
+ /** Gets information about a bot user. Required scopes — bot: `users:read`; user: `users:read` Rate limit tier: 3 Method-specific errors (the `error` slug on the SlackError): - `bot_not_found` — Value passed for `bot` was invalid. - `bots_not_found` — At least one value passed for `bots` was invalid. - `missing_argument` — A required argument is missing. - `team_not_found` — Value passed for `team_id` was invalid. See https://docs.slack.dev/reference/methods/bots.info */
133
+ export const botsInfo: API.OperationMethod<
134
+ BotsInfoRequest,
135
+ BotsInfoResponse,
136
+ BotsInfoError,
137
+ SlackOpContext
138
+ > = /*@__PURE__*/ API.make(() => ({
139
+ input: BotsInfoRequest,
140
+ output: BotsInfoResponse,
141
+ errors: [SlackError, SlackRateLimited],
142
+ protocol: SlackProtocol,
143
+ retry: Retry.Retry,
144
+ }));