@distilled.cloud/slack 1.0.0-rc.15 → 1.0.0-rc.17

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 (255) hide show
  1. package/lib/.lazy.json +1 -0
  2. package/lib/_bundle/lazy.js +4 -0
  3. package/lib/_bundle/sdk.js +2 -0
  4. package/lib/_bundle/sdk.js.map +1 -0
  5. package/lib/credentials.d.ts +1 -1
  6. package/lib/credentials.d.ts.map +1 -1
  7. package/lib/credentials.js +1 -53
  8. package/lib/errors.d.ts +31 -31
  9. package/lib/errors.d.ts.map +1 -1
  10. package/lib/errors.js +1 -59
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.js +0 -10
  13. package/lib/index.lazy.js +7 -0
  14. package/lib/pagination.d.ts +2 -2
  15. package/lib/pagination.js +1 -31
  16. package/lib/protocol.d.ts.map +1 -1
  17. package/lib/protocol.js +1 -231
  18. package/lib/retry.d.ts +2 -2
  19. package/lib/retry.d.ts.map +1 -1
  20. package/lib/retry.js +1 -45
  21. package/lib/services/admin.d.ts +123 -575
  22. package/lib/services/admin.d.ts.map +1 -1
  23. package/lib/services/admin.js +141 -2884
  24. package/lib/services/admin.js.map +1 -1
  25. package/lib/services/agents.d.ts +13 -55
  26. package/lib/services/agents.d.ts.map +1 -1
  27. package/lib/services/agents.js +1 -314
  28. package/lib/services/agents.js.map +1 -1
  29. package/lib/services/api.d.ts +0 -4
  30. package/lib/services/api.d.ts.map +1 -1
  31. package/lib/services/api.js +1 -23
  32. package/lib/services/api.js.map +1 -1
  33. package/lib/services/apps.d.ts +25 -106
  34. package/lib/services/apps.d.ts.map +1 -1
  35. package/lib/services/apps.js +35 -515
  36. package/lib/services/apps.js.map +1 -1
  37. package/lib/services/assistant.d.ts +6 -40
  38. package/lib/services/assistant.d.ts.map +1 -1
  39. package/lib/services/assistant.js +1 -209
  40. package/lib/services/assistant.js.map +1 -1
  41. package/lib/services/auth.d.ts +4 -15
  42. package/lib/services/auth.d.ts.map +1 -1
  43. package/lib/services/auth.js +1 -96
  44. package/lib/services/auth.js.map +1 -1
  45. package/lib/services/blocks.d.ts +1 -7
  46. package/lib/services/blocks.d.ts.map +1 -1
  47. package/lib/services/blocks.js +1 -26
  48. package/lib/services/blocks.js.map +1 -1
  49. package/lib/services/bookmarks.d.ts +4 -15
  50. package/lib/services/bookmarks.d.ts.map +1 -1
  51. package/lib/services/bookmarks.js +1 -81
  52. package/lib/services/bookmarks.js.map +1 -1
  53. package/lib/services/bots.d.ts +1 -9
  54. package/lib/services/bots.d.ts.map +1 -1
  55. package/lib/services/bots.js +1 -59
  56. package/lib/services/bots.js.map +1 -1
  57. package/lib/services/calls.d.ts +6 -22
  58. package/lib/services/calls.d.ts.map +1 -1
  59. package/lib/services/calls.js +1 -115
  60. package/lib/services/calls.js.map +1 -1
  61. package/lib/services/canvases.d.ts +7 -35
  62. package/lib/services/canvases.d.ts.map +1 -1
  63. package/lib/services/canvases.js +1 -140
  64. package/lib/services/canvases.js.map +1 -1
  65. package/lib/services/chat.d.ts +14 -83
  66. package/lib/services/chat.d.ts.map +1 -1
  67. package/lib/services/chat.js +1 -387
  68. package/lib/services/chat.js.map +1 -1
  69. package/lib/services/conversations.d.ts +31 -116
  70. package/lib/services/conversations.d.ts.map +1 -1
  71. package/lib/services/conversations.js +40 -696
  72. package/lib/services/conversations.js.map +1 -1
  73. package/lib/services/dialog.d.ts +1 -4
  74. package/lib/services/dialog.d.ts.map +1 -1
  75. package/lib/services/dialog.js +1 -22
  76. package/lib/services/dialog.js.map +1 -1
  77. package/lib/services/dnd.d.ts +5 -17
  78. package/lib/services/dnd.d.ts.map +1 -1
  79. package/lib/services/dnd.js +1 -96
  80. package/lib/services/dnd.js.map +1 -1
  81. package/lib/services/emoji.d.ts +1 -8
  82. package/lib/services/emoji.d.ts.map +1 -1
  83. package/lib/services/emoji.js +1 -34
  84. package/lib/services/emoji.js.map +1 -1
  85. package/lib/services/entity.d.ts +4 -16
  86. package/lib/services/entity.d.ts.map +1 -1
  87. package/lib/services/entity.js +1 -76
  88. package/lib/services/entity.js.map +1 -1
  89. package/lib/services/files.d.ts +16 -80
  90. package/lib/services/files.d.ts.map +1 -1
  91. package/lib/services/files.js +1 -439
  92. package/lib/services/files.js.map +1 -1
  93. package/lib/services/functions.d.ts +8 -49
  94. package/lib/services/functions.d.ts.map +1 -1
  95. package/lib/services/functions.js +1 -208
  96. package/lib/services/functions.js.map +1 -1
  97. package/lib/services/index.js +0 -2
  98. package/lib/services/lists.d.ts +13 -55
  99. package/lib/services/lists.d.ts.map +1 -1
  100. package/lib/services/lists.js +1 -254
  101. package/lib/services/lists.js.map +1 -1
  102. package/lib/services/migration.d.ts +1 -7
  103. package/lib/services/migration.d.ts.map +1 -1
  104. package/lib/services/migration.js +1 -32
  105. package/lib/services/migration.js.map +1 -1
  106. package/lib/services/oauth.d.ts +7 -43
  107. package/lib/services/oauth.d.ts.map +1 -1
  108. package/lib/services/oauth.js +1 -294
  109. package/lib/services/oauth.js.map +1 -1
  110. package/lib/services/openid.d.ts +3 -10
  111. package/lib/services/openid.d.ts.map +1 -1
  112. package/lib/services/openid.js +1 -84
  113. package/lib/services/openid.js.map +1 -1
  114. package/lib/services/pins.d.ts +3 -13
  115. package/lib/services/pins.d.ts.map +1 -1
  116. package/lib/services/pins.js +1 -66
  117. package/lib/services/pins.js.map +1 -1
  118. package/lib/services/reactions.d.ts +5 -17
  119. package/lib/services/reactions.d.ts.map +1 -1
  120. package/lib/services/reactions.js +1 -102
  121. package/lib/services/reactions.js.map +1 -1
  122. package/lib/services/reminders.d.ts +5 -17
  123. package/lib/services/reminders.d.ts.map +1 -1
  124. package/lib/services/reminders.js +1 -88
  125. package/lib/services/reminders.js.map +1 -1
  126. package/lib/services/rtm.d.ts +2 -11
  127. package/lib/services/rtm.d.ts.map +1 -1
  128. package/lib/services/rtm.js +1 -61
  129. package/lib/services/rtm.js.map +1 -1
  130. package/lib/services/search.d.ts +4 -35
  131. package/lib/services/search.d.ts.map +1 -1
  132. package/lib/services/search.js +1 -172
  133. package/lib/services/search.js.map +1 -1
  134. package/lib/services/stars.d.ts +4 -26
  135. package/lib/services/stars.d.ts.map +1 -1
  136. package/lib/services/stars.js +1 -134
  137. package/lib/services/stars.js.map +1 -1
  138. package/lib/services/team.d.ts +11 -63
  139. package/lib/services/team.d.ts.map +1 -1
  140. package/lib/services/team.js +1 -295
  141. package/lib/services/team.js.map +1 -1
  142. package/lib/services/tooling.d.ts +2 -5
  143. package/lib/services/tooling.d.ts.map +1 -1
  144. package/lib/services/tooling.js +1 -33
  145. package/lib/services/tooling.js.map +1 -1
  146. package/lib/services/usergroups.d.ts +7 -31
  147. package/lib/services/usergroups.d.ts.map +1 -1
  148. package/lib/services/usergroups.js +1 -151
  149. package/lib/services/usergroups.js.map +1 -1
  150. package/lib/services/users.d.ts +14 -48
  151. package/lib/services/users.d.ts.map +1 -1
  152. package/lib/services/users.js +1 -255
  153. package/lib/services/users.js.map +1 -1
  154. package/lib/services/views.d.ts +4 -14
  155. package/lib/services/views.d.ts.map +1 -1
  156. package/lib/services/views.js +1 -78
  157. package/lib/services/views.js.map +1 -1
  158. package/lib/services/workflows.d.ts +8 -51
  159. package/lib/services/workflows.d.ts.map +1 -1
  160. package/lib/services/workflows.js +1 -193
  161. package/lib/services/workflows.js.map +1 -1
  162. package/lib/services.lazy/admin.js +3 -0
  163. package/lib/services.lazy/agents.js +1 -0
  164. package/lib/services.lazy/api.js +1 -0
  165. package/lib/services.lazy/apps.js +3 -0
  166. package/lib/services.lazy/assistant.js +1 -0
  167. package/lib/services.lazy/auth.js +1 -0
  168. package/lib/services.lazy/blocks.js +1 -0
  169. package/lib/services.lazy/bookmarks.js +1 -0
  170. package/lib/services.lazy/bots.js +1 -0
  171. package/lib/services.lazy/calls.js +1 -0
  172. package/lib/services.lazy/canvases.js +1 -0
  173. package/lib/services.lazy/chat.js +1 -0
  174. package/lib/services.lazy/conversations.js +3 -0
  175. package/lib/services.lazy/dialog.js +1 -0
  176. package/lib/services.lazy/dnd.js +1 -0
  177. package/lib/services.lazy/emoji.js +1 -0
  178. package/lib/services.lazy/entity.js +1 -0
  179. package/lib/services.lazy/files.js +1 -0
  180. package/lib/services.lazy/functions.js +1 -0
  181. package/lib/services.lazy/index.js +3 -0
  182. package/lib/services.lazy/lists.js +1 -0
  183. package/lib/services.lazy/migration.js +1 -0
  184. package/lib/services.lazy/oauth.js +1 -0
  185. package/lib/services.lazy/openid.js +1 -0
  186. package/lib/services.lazy/pins.js +1 -0
  187. package/lib/services.lazy/reactions.js +1 -0
  188. package/lib/services.lazy/reminders.js +1 -0
  189. package/lib/services.lazy/rtm.js +1 -0
  190. package/lib/services.lazy/search.js +1 -0
  191. package/lib/services.lazy/stars.js +1 -0
  192. package/lib/services.lazy/team.js +1 -0
  193. package/lib/services.lazy/tooling.js +1 -0
  194. package/lib/services.lazy/usergroups.js +1 -0
  195. package/lib/services.lazy/users.js +1 -0
  196. package/lib/services.lazy/views.js +1 -0
  197. package/lib/services.lazy/workflows.js +1 -0
  198. package/lib/traits.d.ts +1 -1
  199. package/lib/traits.js +1 -12
  200. package/package.json +10 -8
  201. package/src/credentials.ts +20 -21
  202. package/src/errors.ts +31 -27
  203. package/src/index.ts +1 -1
  204. package/src/pagination.ts +2 -2
  205. package/src/protocol.ts +30 -29
  206. package/src/retry.ts +6 -6
  207. package/src/services/admin.ts +2717 -3451
  208. package/src/services/agents.ts +380 -370
  209. package/src/services/api.ts +31 -21
  210. package/src/services/apps.ts +569 -621
  211. package/src/services/assistant.ts +235 -270
  212. package/src/services/auth.ts +118 -100
  213. package/src/services/blocks.ts +33 -29
  214. package/src/services/bookmarks.ts +101 -83
  215. package/src/services/bots.ts +74 -67
  216. package/src/services/calls.ts +118 -124
  217. package/src/services/canvases.ts +171 -178
  218. package/src/services/chat.ts +428 -496
  219. package/src/services/conversations.ts +675 -761
  220. package/src/services/dialog.ts +30 -17
  221. package/src/services/dnd.ts +125 -99
  222. package/src/services/emoji.ts +46 -42
  223. package/src/services/entity.ts +94 -92
  224. package/src/services/files.ts +536 -531
  225. package/src/services/functions.ts +209 -274
  226. package/src/services/lists.ts +289 -304
  227. package/src/services/migration.ts +39 -37
  228. package/src/services/oauth.ts +345 -361
  229. package/src/services/openid.ts +137 -122
  230. package/src/services/pins.ts +83 -70
  231. package/src/services/reactions.ts +119 -103
  232. package/src/services/reminders.ts +112 -90
  233. package/src/services/rtm.ts +73 -65
  234. package/src/services/search.ts +193 -244
  235. package/src/services/stars.ts +101 -160
  236. package/src/services/team.ts +333 -369
  237. package/src/services/tooling.ts +43 -30
  238. package/src/services/usergroups.ts +175 -179
  239. package/src/services/users.ts +301 -268
  240. package/src/services/views.ts +85 -80
  241. package/src/services/workflows.ts +184 -269
  242. package/src/traits.ts +1 -1
  243. package/lib/credentials.js.map +0 -1
  244. package/lib/errors.js.map +0 -1
  245. package/lib/pagination.js.map +0 -1
  246. package/lib/protocol.js.map +0 -1
  247. package/lib/protocol.test.d.ts +0 -2
  248. package/lib/protocol.test.d.ts.map +0 -1
  249. package/lib/protocol.test.js +0 -288
  250. package/lib/protocol.test.js.map +0 -1
  251. package/lib/retry.js.map +0 -1
  252. package/lib/services/index.js.map +0 -1
  253. package/lib/traits.js.map +0 -1
  254. package/src/protocol.test.ts +0 -372
  255. /package/lib/{index.js.map → index.lazy.js.map} +0 -0
@@ -1,10 +1,13 @@
1
1
  import * as API from "@distilled.cloud/core/api";
2
2
  // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
3
- import * as S from "@distilled.cloud/core/schema";
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
4
5
  import { SlackError, SlackRateLimited } from "../errors.ts";
5
6
  import { SlackProtocol, type SlackOpError, type SlackOpContext } from "../protocol.ts";
6
7
  import * as Retry from "../retry.ts";
7
8
  import * as T from "../traits.ts";
9
+ // Schema table, filled on first reach (see __S at the end).
10
+ const __s: any[] = [];
8
11
 
9
12
  export type { SlackOpError, SlackOpContext };
10
13
 
@@ -14,34 +17,44 @@ export interface DialogOpenRequest {
14
17
  /** Exchange a trigger to post to the user. */
15
18
  trigger_id: string;
16
19
  }
17
- export const DialogOpenRequest = /*@__PURE__*/ S.suspend(() =>
18
- S.Struct({
19
- dialog: S.String,
20
- trigger_id: S.String,
21
- }).pipe(T.Http({ method: "POST", uri: "/dialog.open", code: 200 })),
22
- ).annotate({ identifier: "DialogOpenRequest" }) as any as S.Schema<DialogOpenRequest>;
23
-
24
20
  export interface DialogOpenResponse {
25
21
  /** Always `true` (a failed call raises a typed error instead). */
26
22
  ok: boolean;
27
23
  }
28
- export const DialogOpenResponse = /*@__PURE__*/ S.suspend(() =>
29
- S.Struct({
30
- ok: S.Boolean,
31
- }),
32
- ).annotate({ identifier: "DialogOpenResponse" }) as any as S.Schema<DialogOpenResponse>;
33
-
34
24
  export type DialogOpenError = SlackOpError;
35
- /** Open a dialog with a user Rate limit tier: 4 Method-specific errors (the `error` slug on the SlackError): - `app_missing_action_url` — The app associated with the used token doesn't have a Action URL configured in its interactive components settings. - `cannot_create_dialog` — Something exceptional occurred and the dialog could not be created. - `failed_sending_dialog` — Something exceptional occurred and the dialog could not be sent. - `invalid_trigger` — The provided `trigger_id` is invalid or cannot be used by this token. - `missing_dialog` — No `dialog` argument was presented. - `missing_trigger` — No `trigger_id` argument was presented. - `trigger_exchanged` — The provided `trigger_id` has already been exchanged. - `trigger_expired` — The provided `trigger_id` was presented after the 3 second limit. - `validation_errors` — The provided `dialog` could not be validated. See https://docs.slack.dev/reference/methods/dialog.open */
25
+ /** Open a dialog with a user Rate limit tier: 4 Method-specific errors (the `error` slug on the SlackError): - `app_missing_action_url` -- The app associated with the used token doesn't have a Action URL configured in its interactive components settings. - `cannot_create_dialog` -- Something exceptional occurred and the dialog could not be created. - `failed_sending_dialog` -- Something exceptional occurred and the dialog could not be sent. - `invalid_trigger` -- The provided `trigger_id` is invalid or cannot be used by this token. - `missing_dialog` -- No `dialog` argument was presented. - `missing_trigger` -- No `trigger_id` argument was presented. - `trigger_exchanged` -- The provided `trigger_id` has already been exchanged. - `trigger_expired` -- The provided `trigger_id` was presented after the 3 second limit. - `validation_errors` -- The provided `dialog` could not be validated. See https://docs.slack.dev/reference/methods/dialog.open */
36
26
  export const dialogOpen: API.OperationMethod<
37
27
  DialogOpenRequest,
38
28
  DialogOpenResponse,
39
29
  DialogOpenError,
40
30
  SlackOpContext
41
31
  > = /*@__PURE__*/ API.make(() => ({
42
- input: DialogOpenRequest,
43
- output: DialogOpenResponse,
32
+ input: __S(0, __c0, 0) as any as S.Schema<DialogOpenRequest>,
33
+ output: __S(1, __c0, 1) as any as S.Schema<DialogOpenResponse>,
44
34
  errors: [SlackError, SlackRateLimited],
45
35
  protocol: SlackProtocol,
46
36
  retry: Retry.Retry,
47
37
  }));
38
+
39
+ // Schema builders: each runs one schema initializer, on that schema's first use.
40
+ function __c0(j: number): any {
41
+ switch (j) {
42
+ case 0:
43
+ return S.suspend(() =>
44
+ S.Struct({
45
+ dialog: S.String,
46
+ trigger_id: S.String,
47
+ }).pipe(T.Http({ method: "POST", uri: "/dialog.open", code: 200 })),
48
+ ).annotate({ identifier: "DialogOpenRequest" });
49
+ case 1:
50
+ return S.suspend(() =>
51
+ S.Struct({
52
+ ok: S.Boolean,
53
+ }),
54
+ ).annotate({ identifier: "DialogOpenResponse" });
55
+ }
56
+ }
57
+ // Schema table: entry i is schema j of builder f, made on first reach.
58
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
59
+ return (__s[i] ??= __L.at(f, j));
60
+ }
@@ -1,10 +1,13 @@
1
1
  import * as API from "@distilled.cloud/core/api";
2
2
  // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
3
- import * as S from "@distilled.cloud/core/schema";
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
4
5
  import { SlackError, SlackRateLimited } from "../errors.ts";
5
6
  import { SlackProtocol, type SlackOpError, type SlackOpContext } from "../protocol.ts";
6
7
  import * as Retry from "../retry.ts";
7
8
  import * as T from "../traits.ts";
9
+ // Schema table, filled on first reach (see __S at the end).
10
+ const __s: any[] = [];
8
11
 
9
12
  export type { SlackOpError, SlackOpContext };
10
13
 
@@ -14,13 +17,6 @@ export interface DndInfoRequest {
14
17
  /** Encoded team id where passed in user param belongs, required if org token is used. If no user param is passed, then a team which has access to the app should be passed */
15
18
  team_id?: string;
16
19
  }
17
- export const DndInfoRequest = /*@__PURE__*/ S.suspend(() =>
18
- S.Struct({
19
- user: S.optional(S.String.pipe(T.Query())),
20
- team_id: S.optional(S.String.pipe(T.Query())),
21
- }).pipe(T.Http({ method: "GET", uri: "/dnd.info", code: 200 })),
22
- ).annotate({ identifier: "DndInfoRequest" }) as any as S.Schema<DndInfoRequest>;
23
-
24
20
  export interface DndInfoResponse {
25
21
  /** Always `true` (a failed call raises a typed error instead). */
26
22
  ok: boolean;
@@ -33,40 +29,12 @@ export interface DndInfoResponse {
33
29
  snooze_is_indefinite?: boolean;
34
30
  dnd_profile_status?: unknown;
35
31
  }
36
- export const DndInfoResponse = /*@__PURE__*/ S.suspend(() =>
37
- S.Struct({
38
- ok: S.Boolean,
39
- dnd_enabled: S.Boolean,
40
- next_dnd_start_ts: S.Number,
41
- next_dnd_end_ts: S.Number,
42
- snooze_enabled: S.optional(S.Boolean),
43
- snooze_endtime: S.optional(S.Number),
44
- snooze_remaining: S.optional(S.Number),
45
- snooze_is_indefinite: S.optional(S.Boolean),
46
- dnd_profile_status: S.optional(S.Unknown),
47
- }),
48
- ).annotate({ identifier: "DndInfoResponse" }) as any as S.Schema<DndInfoResponse>;
49
-
50
32
  export interface EndDndRequest {}
51
- export const EndDndRequest = /*@__PURE__*/ S.suspend(() =>
52
- S.Struct({}).pipe(T.Http({ method: "POST", uri: "/dnd.endDnd", code: 200 })),
53
- ).annotate({ identifier: "EndDndRequest" }) as any as S.Schema<EndDndRequest>;
54
-
55
33
  export interface EndDndResponse {
56
34
  /** Always `true` (a failed call raises a typed error instead). */
57
35
  ok: boolean;
58
36
  }
59
- export const EndDndResponse = /*@__PURE__*/ S.suspend(() =>
60
- S.Struct({
61
- ok: S.Boolean,
62
- }),
63
- ).annotate({ identifier: "EndDndResponse" }) as any as S.Schema<EndDndResponse>;
64
-
65
37
  export interface EndSnoozeRequest {}
66
- export const EndSnoozeRequest = /*@__PURE__*/ S.suspend(() =>
67
- S.Struct({}).pipe(T.Http({ method: "POST", uri: "/dnd.endSnooze", code: 200 })),
68
- ).annotate({ identifier: "EndSnoozeRequest" }) as any as S.Schema<EndSnoozeRequest>;
69
-
70
38
  export interface EndSnoozeResponse {
71
39
  /** Always `true` (a failed call raises a typed error instead). */
72
40
  ok: boolean;
@@ -78,29 +46,10 @@ export interface EndSnoozeResponse {
78
46
  snooze_remaining?: number;
79
47
  dnd_profile_status?: unknown;
80
48
  }
81
- export const EndSnoozeResponse = /*@__PURE__*/ S.suspend(() =>
82
- S.Struct({
83
- ok: S.Boolean,
84
- snooze_enabled: S.Boolean,
85
- dnd_enabled: S.Boolean,
86
- next_dnd_end_ts: S.Number,
87
- next_dnd_start_ts: S.Number,
88
- snooze_endtime: S.optional(S.Number),
89
- snooze_remaining: S.optional(S.Number),
90
- dnd_profile_status: S.optional(S.Unknown),
91
- }),
92
- ).annotate({ identifier: "EndSnoozeResponse" }) as any as S.Schema<EndSnoozeResponse>;
93
-
94
49
  export interface SetSnoozeRequest {
95
50
  /** This argument is required. Number of minutes, from now, to snooze until. */
96
51
  num_minutes: string;
97
52
  }
98
- export const SetSnoozeRequest = /*@__PURE__*/ S.suspend(() =>
99
- S.Struct({
100
- num_minutes: S.String,
101
- }).pipe(T.Http({ method: "POST", uri: "/dnd.setSnooze", code: 200 })),
102
- ).annotate({ identifier: "SetSnoozeRequest" }) as any as S.Schema<SetSnoozeRequest>;
103
-
104
53
  export interface SetSnoozeResponse {
105
54
  /** Always `true` (a failed call raises a typed error instead). */
106
55
  ok: boolean;
@@ -109,118 +58,195 @@ export interface SetSnoozeResponse {
109
58
  snooze_remaining?: number;
110
59
  snooze_is_indefinite?: boolean;
111
60
  }
112
- export const SetSnoozeResponse = /*@__PURE__*/ S.suspend(() =>
113
- S.Struct({
114
- ok: S.Boolean,
115
- snooze_endtime: S.optional(S.Number),
116
- snooze_enabled: S.Boolean,
117
- snooze_remaining: S.optional(S.Number),
118
- snooze_is_indefinite: S.optional(S.Boolean),
119
- }),
120
- ).annotate({ identifier: "SetSnoozeResponse" }) as any as S.Schema<SetSnoozeResponse>;
121
-
122
61
  export interface TeamInfoRequest {
123
62
  /** Comma-separated list of users to fetch Do Not Disturb status for */
124
63
  users: string;
125
64
  /** Encoded team id where passed in users belong, required if org token is used */
126
65
  team_id?: string;
127
66
  }
128
- export const TeamInfoRequest = /*@__PURE__*/ S.suspend(() =>
129
- S.Struct({
130
- users: S.String.pipe(T.Query()),
131
- team_id: S.optional(S.String.pipe(T.Query())),
132
- }).pipe(T.Http({ method: "GET", uri: "/dnd.teamInfo", code: 200 })),
133
- ).annotate({ identifier: "TeamInfoRequest" }) as any as S.Schema<TeamInfoRequest>;
134
-
135
67
  export type TeamInfoResponseUsersMap = { [key: string]: unknown | undefined };
136
- export const TeamInfoResponseUsersMap = /*@__PURE__*/ S.Record(
137
- S.String,
138
- S.Unknown,
139
- ) as any as S.Schema<TeamInfoResponseUsersMap>;
140
-
141
68
  export interface TeamInfoResponse {
142
69
  /** Always `true` (a failed call raises a typed error instead). */
143
70
  ok: boolean;
144
71
  users: TeamInfoResponseUsersMap;
145
72
  }
146
- export const TeamInfoResponse = /*@__PURE__*/ S.suspend(() =>
147
- S.Struct({
148
- ok: S.Boolean,
149
- users: TeamInfoResponseUsersMap,
150
- }),
151
- ).annotate({ identifier: "TeamInfoResponse" }) as any as S.Schema<TeamInfoResponse>;
152
-
153
73
  export type DndInfoError = SlackOpError;
154
- /** Retrieves a user's current Do Not Disturb status. Required scopes — bot: `dnd:read`; user: `dnd:read` Rate limit tier: 3 Method-specific errors (the `error` slug on the SlackError): - `user_not_found` — Value passed for `user` was invalid. - `user_not_visible` — User is not visible for this request. See https://docs.slack.dev/reference/methods/dnd.info */
74
+ /** Retrieves a user's current Do Not Disturb status. Required scopes -- bot: `dnd:read`; user: `dnd:read` Rate limit tier: 3 Method-specific errors (the `error` slug on the SlackError): - `user_not_found` -- Value passed for `user` was invalid. - `user_not_visible` -- User is not visible for this request. See https://docs.slack.dev/reference/methods/dnd.info */
155
75
  export const dndInfo: API.OperationMethod<
156
76
  DndInfoRequest,
157
77
  DndInfoResponse,
158
78
  DndInfoError,
159
79
  SlackOpContext
160
80
  > = /*@__PURE__*/ API.make(() => ({
161
- input: DndInfoRequest,
162
- output: DndInfoResponse,
81
+ input: __S(0, __c0, 0) as any as S.Schema<DndInfoRequest>,
82
+ output: __S(1, __c0, 1) as any as S.Schema<DndInfoResponse>,
163
83
  errors: [SlackError, SlackRateLimited],
164
84
  protocol: SlackProtocol,
165
85
  retry: Retry.Retry,
166
86
  }));
167
87
 
168
88
  export type EndDndError = SlackOpError;
169
- /** Ends the current user's Do Not Disturb session immediately. Required scopes — user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `not_in_dnd` — The auth'd user isn't in DND mode. See https://docs.slack.dev/reference/methods/dnd.endDnd */
89
+ /** Ends the current user's Do Not Disturb session immediately. Required scopes -- user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `not_in_dnd` -- The auth'd user isn't in DND mode. See https://docs.slack.dev/reference/methods/dnd.endDnd */
170
90
  export const endDnd: API.OperationMethod<
171
91
  EndDndRequest,
172
92
  EndDndResponse,
173
93
  EndDndError,
174
94
  SlackOpContext
175
95
  > = /*@__PURE__*/ API.make(() => ({
176
- input: EndDndRequest,
177
- output: EndDndResponse,
96
+ input: __S(4, __c1, 0) as any as S.Schema<EndDndRequest>,
97
+ output: __S(5, __c1, 1) as any as S.Schema<EndDndResponse>,
178
98
  errors: [SlackError, SlackRateLimited],
179
99
  protocol: SlackProtocol,
180
100
  retry: Retry.Retry,
181
101
  }));
182
102
 
183
103
  export type EndSnoozeError = SlackOpError;
184
- /** Ends the current user's snooze mode immediately. Required scopes — user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `snooze_end_failed` — There was a problem setting the user's Do Not Disturb status See https://docs.slack.dev/reference/methods/dnd.endSnooze */
104
+ /** Ends the current user's snooze mode immediately. Required scopes -- user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `snooze_end_failed` -- There was a problem setting the user's Do Not Disturb status See https://docs.slack.dev/reference/methods/dnd.endSnooze */
185
105
  export const endSnooze: API.OperationMethod<
186
106
  EndSnoozeRequest,
187
107
  EndSnoozeResponse,
188
108
  EndSnoozeError,
189
109
  SlackOpContext
190
110
  > = /*@__PURE__*/ API.make(() => ({
191
- input: EndSnoozeRequest,
192
- output: EndSnoozeResponse,
111
+ input: __S(8, __c2, 0) as any as S.Schema<EndSnoozeRequest>,
112
+ output: __S(9, __c2, 1) as any as S.Schema<EndSnoozeResponse>,
193
113
  errors: [SlackError, SlackRateLimited],
194
114
  protocol: SlackProtocol,
195
115
  retry: Retry.Retry,
196
116
  }));
197
117
 
198
118
  export type SetSnoozeError = SlackOpError;
199
- /** Turns on Do Not Disturb mode for the current user, or changes its duration. Required scopes — user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `missing_duration` — No value provided for `num_minutes` - `snooze_failed` — There was a problem setting the user's Do Not Disturb status - `too_long` — The value for `num_minutes` was too large See https://docs.slack.dev/reference/methods/dnd.setSnooze */
119
+ /** Turns on Do Not Disturb mode for the current user, or changes its duration. Required scopes -- user: `dnd:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `missing_duration` -- No value provided for `num_minutes` - `snooze_failed` -- There was a problem setting the user's Do Not Disturb status - `too_long` -- The value for `num_minutes` was too large See https://docs.slack.dev/reference/methods/dnd.setSnooze */
200
120
  export const setSnooze: API.OperationMethod<
201
121
  SetSnoozeRequest,
202
122
  SetSnoozeResponse,
203
123
  SetSnoozeError,
204
124
  SlackOpContext
205
125
  > = /*@__PURE__*/ API.make(() => ({
206
- input: SetSnoozeRequest,
207
- output: SetSnoozeResponse,
126
+ input: __S(12, __c3, 0) as any as S.Schema<SetSnoozeRequest>,
127
+ output: __S(13, __c3, 1) as any as S.Schema<SetSnoozeResponse>,
208
128
  errors: [SlackError, SlackRateLimited],
209
129
  protocol: SlackProtocol,
210
130
  retry: Retry.Retry,
211
131
  }));
212
132
 
213
133
  export type TeamInfoError = SlackOpError;
214
- /** Retrieves the Do Not Disturb status for up to 50 users on a team. Required scopes — bot: `dnd:read`; user: `dnd:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `no_users_provided` — Must provide more than one user. - `user_not_visible` — User is not visible for this request. See https://docs.slack.dev/reference/methods/dnd.teamInfo */
134
+ /** Retrieves the Do Not Disturb status for up to 50 users on a team. Required scopes -- bot: `dnd:read`; user: `dnd:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `no_users_provided` -- Must provide more than one user. - `user_not_visible` -- User is not visible for this request. See https://docs.slack.dev/reference/methods/dnd.teamInfo */
215
135
  export const teamInfo: API.OperationMethod<
216
136
  TeamInfoRequest,
217
137
  TeamInfoResponse,
218
138
  TeamInfoError,
219
139
  SlackOpContext
220
140
  > = /*@__PURE__*/ API.make(() => ({
221
- input: TeamInfoRequest,
222
- output: TeamInfoResponse,
141
+ input: __S(16, __c4, 0) as any as S.Schema<TeamInfoRequest>,
142
+ output: __S(18, __c4, 2) as any as S.Schema<TeamInfoResponse>,
223
143
  errors: [SlackError, SlackRateLimited],
224
144
  protocol: SlackProtocol,
225
145
  retry: Retry.Retry,
226
146
  }));
147
+
148
+ // Schema builders: each runs one schema initializer, on that schema's first use.
149
+ function __c0(j: number): any {
150
+ switch (j) {
151
+ case 0:
152
+ return S.suspend(() =>
153
+ S.Struct({
154
+ user: S.optional(S.String.pipe(T.Query())),
155
+ team_id: S.optional(S.String.pipe(T.Query())),
156
+ }).pipe(T.Http({ method: "GET", uri: "/dnd.info", code: 200 })),
157
+ ).annotate({ identifier: "DndInfoRequest" });
158
+ case 1:
159
+ return S.suspend(() =>
160
+ S.Struct({
161
+ ok: S.Boolean,
162
+ dnd_enabled: S.Boolean,
163
+ next_dnd_start_ts: S.Number,
164
+ next_dnd_end_ts: S.Number,
165
+ snooze_enabled: S.optional(S.Boolean),
166
+ snooze_endtime: S.optional(S.Number),
167
+ snooze_remaining: S.optional(S.Number),
168
+ snooze_is_indefinite: S.optional(S.Boolean),
169
+ dnd_profile_status: S.optional(S.Unknown),
170
+ }),
171
+ ).annotate({ identifier: "DndInfoResponse" });
172
+ }
173
+ }
174
+ function __c1(j: number): any {
175
+ switch (j) {
176
+ case 0:
177
+ return S.suspend(() =>
178
+ S.Struct({}).pipe(T.Http({ method: "POST", uri: "/dnd.endDnd", code: 200 })),
179
+ ).annotate({ identifier: "EndDndRequest" });
180
+ case 1:
181
+ return S.suspend(() =>
182
+ S.Struct({
183
+ ok: S.Boolean,
184
+ }),
185
+ ).annotate({ identifier: "EndDndResponse" });
186
+ }
187
+ }
188
+ function __c2(j: number): any {
189
+ switch (j) {
190
+ case 0:
191
+ return S.suspend(() =>
192
+ S.Struct({}).pipe(T.Http({ method: "POST", uri: "/dnd.endSnooze", code: 200 })),
193
+ ).annotate({ identifier: "EndSnoozeRequest" });
194
+ case 1:
195
+ return S.suspend(() =>
196
+ S.Struct({
197
+ ok: S.Boolean,
198
+ snooze_enabled: S.Boolean,
199
+ dnd_enabled: S.Boolean,
200
+ next_dnd_end_ts: S.Number,
201
+ next_dnd_start_ts: S.Number,
202
+ snooze_endtime: S.optional(S.Number),
203
+ snooze_remaining: S.optional(S.Number),
204
+ dnd_profile_status: S.optional(S.Unknown),
205
+ }),
206
+ ).annotate({ identifier: "EndSnoozeResponse" });
207
+ }
208
+ }
209
+ function __c3(j: number): any {
210
+ switch (j) {
211
+ case 0:
212
+ return S.suspend(() =>
213
+ S.Struct({
214
+ num_minutes: S.String,
215
+ }).pipe(T.Http({ method: "POST", uri: "/dnd.setSnooze", code: 200 })),
216
+ ).annotate({ identifier: "SetSnoozeRequest" });
217
+ case 1:
218
+ return S.suspend(() =>
219
+ S.Struct({
220
+ ok: S.Boolean,
221
+ snooze_endtime: S.optional(S.Number),
222
+ snooze_enabled: S.Boolean,
223
+ snooze_remaining: S.optional(S.Number),
224
+ snooze_is_indefinite: S.optional(S.Boolean),
225
+ }),
226
+ ).annotate({ identifier: "SetSnoozeResponse" });
227
+ }
228
+ }
229
+ function __c4(j: number): any {
230
+ switch (j) {
231
+ case 0:
232
+ return S.suspend(() =>
233
+ S.Struct({
234
+ users: S.String.pipe(T.Query()),
235
+ team_id: S.optional(S.String.pipe(T.Query())),
236
+ }).pipe(T.Http({ method: "GET", uri: "/dnd.teamInfo", code: 200 })),
237
+ ).annotate({ identifier: "TeamInfoRequest" });
238
+ case 1:
239
+ return S.Record(S.String, S.Unknown);
240
+ case 2:
241
+ return S.suspend(() =>
242
+ S.Struct({
243
+ ok: S.Boolean,
244
+ users: __S(17, __c4, 1),
245
+ }),
246
+ ).annotate({ identifier: "TeamInfoResponse" });
247
+ }
248
+ }
249
+ // Schema table: entry i is schema j of builder f, made on first reach.
250
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
251
+ return (__s[i] ??= __L.at(f, j));
252
+ }
@@ -1,10 +1,13 @@
1
1
  import * as API from "@distilled.cloud/core/api";
2
2
  // AUTO-GENERATED by scripts/generate.ts from .generated-specs (docs.slack.dev JSON twins). Do not edit.
3
- import * as S from "@distilled.cloud/core/schema";
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
4
5
  import { SlackError, SlackRateLimited } from "../errors.ts";
5
6
  import { SlackProtocol, type SlackOpError, type SlackOpContext } from "../protocol.ts";
6
7
  import * as Retry from "../retry.ts";
7
8
  import * as T from "../traits.ts";
9
+ // Schema table, filled on first reach (see __S at the end).
10
+ const __s: any[] = [];
8
11
 
9
12
  export type { SlackOpError, SlackOpContext };
10
13
 
@@ -12,41 +15,13 @@ export interface ListEmojiRequest {
12
15
  /** Include a list of categories for Unicode emoji and the emoji in each category */
13
16
  include_categories?: boolean;
14
17
  }
15
- export const ListEmojiRequest = /*@__PURE__*/ S.suspend(() =>
16
- S.Struct({
17
- include_categories: S.optional(S.Boolean.pipe(T.Query())),
18
- }).pipe(T.Http({ method: "GET", uri: "/emoji.list", code: 200 })),
19
- ).annotate({ identifier: "ListEmojiRequest" }) as any as S.Schema<ListEmojiRequest>;
20
-
21
18
  export type ListEmojiResponseEmojiMap = { [key: string]: unknown | undefined };
22
- export const ListEmojiResponseEmojiMap = /*@__PURE__*/ S.Record(
23
- S.String,
24
- S.Unknown,
25
- ) as any as S.Schema<ListEmojiResponseEmojiMap>;
26
-
27
19
  export type ListEmojiResponseCategoriesItemEmojiNamesList = Array<string>;
28
- export const ListEmojiResponseCategoriesItemEmojiNamesList = /*@__PURE__*/ S.Array(
29
- S.String,
30
- ) as any as S.Schema<ListEmojiResponseCategoriesItemEmojiNamesList>;
31
-
32
20
  export interface ListEmojiResponseCategoriesItem {
33
21
  name?: string;
34
22
  emoji_names?: ListEmojiResponseCategoriesItemEmojiNamesList;
35
23
  }
36
- export const ListEmojiResponseCategoriesItem = /*@__PURE__*/ S.suspend(() =>
37
- S.Struct({
38
- name: S.optional(S.String),
39
- emoji_names: S.optional(ListEmojiResponseCategoriesItemEmojiNamesList),
40
- }),
41
- ).annotate({
42
- identifier: "ListEmojiResponseCategoriesItem",
43
- }) as any as S.Schema<ListEmojiResponseCategoriesItem>;
44
-
45
24
  export type ListEmojiResponseCategoriesList = Array<ListEmojiResponseCategoriesItem>;
46
- export const ListEmojiResponseCategoriesList = /*@__PURE__*/ S.Array(
47
- ListEmojiResponseCategoriesItem,
48
- ) as any as S.Schema<ListEmojiResponseCategoriesList>;
49
-
50
25
  export interface ListEmojiResponse {
51
26
  /** Always `true` (a failed call raises a typed error instead). */
52
27
  ok: boolean;
@@ -55,27 +30,56 @@ export interface ListEmojiResponse {
55
30
  categories_version?: string;
56
31
  categories?: ListEmojiResponseCategoriesList;
57
32
  }
58
- export const ListEmojiResponse = /*@__PURE__*/ S.suspend(() =>
59
- S.Struct({
60
- ok: S.Boolean,
61
- cache_ts: S.optional(S.String),
62
- emoji: ListEmojiResponseEmojiMap,
63
- categories_version: S.optional(S.String),
64
- categories: S.optional(ListEmojiResponseCategoriesList),
65
- }),
66
- ).annotate({ identifier: "ListEmojiResponse" }) as any as S.Schema<ListEmojiResponse>;
67
-
68
33
  export type ListEmojiError = SlackOpError;
69
- /** Lists custom emoji for a team. Required scopes — bot: `emoji:read`; user: `emoji:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `invalid_arguments` — Invalid API arguments provided - `unable_to_fetch_custom_emojis` — Unable to fetch custom emojis for team. See https://docs.slack.dev/reference/methods/emoji.list */
34
+ /** Lists custom emoji for a team. Required scopes -- bot: `emoji:read`; user: `emoji:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `invalid_arguments` -- Invalid API arguments provided - `unable_to_fetch_custom_emojis` -- Unable to fetch custom emojis for team. See https://docs.slack.dev/reference/methods/emoji.list */
70
35
  export const listEmoji: API.OperationMethod<
71
36
  ListEmojiRequest,
72
37
  ListEmojiResponse,
73
38
  ListEmojiError,
74
39
  SlackOpContext
75
40
  > = /*@__PURE__*/ API.make(() => ({
76
- input: ListEmojiRequest,
77
- output: ListEmojiResponse,
41
+ input: __S(0, __c0, 0) as any as S.Schema<ListEmojiRequest>,
42
+ output: __S(5, __c0, 5) as any as S.Schema<ListEmojiResponse>,
78
43
  errors: [SlackError, SlackRateLimited],
79
44
  protocol: SlackProtocol,
80
45
  retry: Retry.Retry,
81
46
  }));
47
+
48
+ // Schema builders: each runs one schema initializer, on that schema's first use.
49
+ function __c0(j: number): any {
50
+ switch (j) {
51
+ case 0:
52
+ return S.suspend(() =>
53
+ S.Struct({
54
+ include_categories: S.optional(S.Boolean.pipe(T.Query())),
55
+ }).pipe(T.Http({ method: "GET", uri: "/emoji.list", code: 200 })),
56
+ ).annotate({ identifier: "ListEmojiRequest" });
57
+ case 1:
58
+ return S.Record(S.String, S.Unknown);
59
+ case 2:
60
+ return S.Array(S.String);
61
+ case 3:
62
+ return S.suspend(() =>
63
+ S.Struct({
64
+ name: S.optional(S.String),
65
+ emoji_names: S.optional(__S(2, __c0, 2)),
66
+ }),
67
+ ).annotate({ identifier: "ListEmojiResponseCategoriesItem" });
68
+ case 4:
69
+ return S.Array(__S(3, __c0, 3));
70
+ case 5:
71
+ return S.suspend(() =>
72
+ S.Struct({
73
+ ok: S.Boolean,
74
+ cache_ts: S.optional(S.String),
75
+ emoji: __S(1, __c0, 1),
76
+ categories_version: S.optional(S.String),
77
+ categories: S.optional(__S(4, __c0, 4)),
78
+ }),
79
+ ).annotate({ identifier: "ListEmojiResponse" });
80
+ }
81
+ }
82
+ // Schema table: entry i is schema j of builder f, made on first reach.
83
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
84
+ return (__s[i] ??= __L.at(f, j));
85
+ }