@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,18 +1,19 @@
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";
4
- import * as Redacted from "effect/Redacted";
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
5
+ import type * as Redacted from "effect/Redacted";
5
6
  import { SlackError, SlackRateLimited } from "../errors.ts";
6
7
  import { SlackProtocol, type SlackOpError, type SlackOpContext } from "../protocol.ts";
7
8
  import * as Retry from "../retry.ts";
8
9
  import * as T from "../traits.ts";
10
+ // Schema table, filled on first reach (see __S at the end).
11
+ const __s: any[] = [];
9
12
 
10
13
  export type { SlackOpError, SlackOpContext };
11
14
 
12
15
  /** The `grant_type` param as described in the OAuth spec. */
13
16
  export type ConnectTokenRequestGrantType = "authorization_code" | "refresh_token";
14
- export const ConnectTokenRequestGrantType = S.String;
15
-
16
17
  export interface ConnectTokenRequest {
17
18
  /** Issued when you created your application. */
18
19
  client_id?: string;
@@ -29,28 +30,7 @@ export interface ConnectTokenRequest {
29
30
  /** PKCE code verifier (RFC 7636). Required when the authorization request included a `code_challenge`. */
30
31
  code_verifier?: string;
31
32
  }
32
- export const ConnectTokenRequest = /*@__PURE__*/ S.suspend(() =>
33
- S.Struct({
34
- client_id: S.optional(S.String),
35
- client_secret: S.optional(S.String.pipe(T.SensitiveValue({}))),
36
- code: S.optional(S.String),
37
- redirect_uri: S.optional(S.String),
38
- grant_type: S.optional(ConnectTokenRequestGrantType),
39
- refresh_token: S.optional(S.String.pipe(T.SensitiveValue({}))),
40
- code_verifier: S.optional(S.String),
41
- }).pipe(
42
- T.Http({
43
- method: "POST",
44
- uri: "/openid.connect.token",
45
- code: 200,
46
- contentType: "form-urlencoded",
47
- }),
48
- ),
49
- ).annotate({ identifier: "ConnectTokenRequest" }) as any as S.Schema<ConnectTokenRequest>;
50
-
51
33
  export type ConnectTokenResponseTokenType = "Bearer";
52
- export const ConnectTokenResponseTokenType = S.String;
53
-
54
34
  export interface ConnectTokenResponse {
55
35
  /** Always `true` (a failed call raises a typed error instead). */
56
36
  ok: boolean;
@@ -63,23 +43,7 @@ export interface ConnectTokenResponse {
63
43
  /** Refresh token for this credential */
64
44
  refresh_token?: string | Redacted.Redacted<string>;
65
45
  }
66
- export const ConnectTokenResponse = /*@__PURE__*/ S.suspend(() =>
67
- S.Struct({
68
- ok: S.Boolean,
69
- access_token: S.String.pipe(T.SensitiveValue({})),
70
- token_type: ConnectTokenResponseTokenType,
71
- id_token: S.optional(S.String),
72
- state: S.optional(S.String),
73
- expires_in: S.optional(S.Number),
74
- refresh_token: S.optional(S.String.pipe(T.SensitiveValue({}))),
75
- }),
76
- ).annotate({ identifier: "ConnectTokenResponse" }) as any as S.Schema<ConnectTokenResponse>;
77
-
78
46
  export interface UserInfoRequest {}
79
- export const UserInfoRequest = /*@__PURE__*/ S.suspend(() =>
80
- S.Struct({}).pipe(T.Http({ method: "POST", uri: "/openid.connect.userInfo", code: 200 })),
81
- ).annotate({ identifier: "UserInfoRequest" }) as any as S.Schema<UserInfoRequest>;
82
-
83
47
  export interface UserInfoResponse {
84
48
  /** Always `true` (a failed call raises a typed error instead). */
85
49
  ok: boolean;
@@ -115,107 +79,158 @@ export interface UserInfoResponse {
115
79
  https___slack_com_team_image_230?: string;
116
80
  https___slack_com_team_image_default?: boolean;
117
81
  }
118
- export const UserInfoResponse = /*@__PURE__*/ S.suspend(() =>
119
- S.Struct({
120
- ok: S.Boolean,
121
- sub: S.String,
122
- https___slack_com_user_id: S.String.pipe(T.Body("https://slack.com/user_id")),
123
- https___slack_com_team_id: S.optional(S.String.pipe(T.Body("https://slack.com/team_id"))),
124
- https___slack_com_enterprise_id: S.optional(
125
- S.String.pipe(T.Body("https://slack.com/enterprise_id")),
126
- ),
127
- email: S.optional(S.String),
128
- email_verified: S.optional(S.Boolean),
129
- date_email_verified: S.optional(S.Number),
130
- locale: S.optional(S.String),
131
- name: S.optional(S.String),
132
- given_name: S.optional(S.String),
133
- family_name: S.optional(S.String),
134
- picture: S.optional(S.String),
135
- https___slack_com_user_image_24: S.optional(
136
- S.String.pipe(T.Body("https://slack.com/user_image_24")),
137
- ),
138
- https___slack_com_user_image_32: S.optional(
139
- S.String.pipe(T.Body("https://slack.com/user_image_32")),
140
- ),
141
- https___slack_com_user_image_48: S.optional(
142
- S.String.pipe(T.Body("https://slack.com/user_image_48")),
143
- ),
144
- https___slack_com_user_image_72: S.optional(
145
- S.String.pipe(T.Body("https://slack.com/user_image_72")),
146
- ),
147
- https___slack_com_user_image_192: S.optional(
148
- S.String.pipe(T.Body("https://slack.com/user_image_192")),
149
- ),
150
- https___slack_com_user_image_512: S.optional(
151
- S.String.pipe(T.Body("https://slack.com/user_image_512")),
152
- ),
153
- https___slack_com_user_image_1024: S.optional(
154
- S.String.pipe(T.Body("https://slack.com/user_image_1024")),
155
- ),
156
- https___slack_com_team_name: S.optional(S.String.pipe(T.Body("https://slack.com/team_name"))),
157
- https___slack_com_team_domain: S.optional(
158
- S.String.pipe(T.Body("https://slack.com/team_domain")),
159
- ),
160
- https___slack_com_enterprise_name: S.optional(
161
- S.String.pipe(T.Body("https://slack.com/enterprise_name")),
162
- ),
163
- https___slack_com_enterprise_domain: S.optional(
164
- S.String.pipe(T.Body("https://slack.com/enterprise_domain")),
165
- ),
166
- https___slack_com_team_image_34: S.optional(
167
- S.String.pipe(T.Body("https://slack.com/team_image_34")),
168
- ),
169
- https___slack_com_team_image_44: S.optional(
170
- S.String.pipe(T.Body("https://slack.com/team_image_44")),
171
- ),
172
- https___slack_com_team_image_68: S.optional(
173
- S.String.pipe(T.Body("https://slack.com/team_image_68")),
174
- ),
175
- https___slack_com_team_image_88: S.optional(
176
- S.String.pipe(T.Body("https://slack.com/team_image_88")),
177
- ),
178
- https___slack_com_team_image_102: S.optional(
179
- S.String.pipe(T.Body("https://slack.com/team_image_102")),
180
- ),
181
- https___slack_com_team_image_132: S.optional(
182
- S.String.pipe(T.Body("https://slack.com/team_image_132")),
183
- ),
184
- https___slack_com_team_image_230: S.optional(
185
- S.String.pipe(T.Body("https://slack.com/team_image_230")),
186
- ),
187
- https___slack_com_team_image_default: S.optional(
188
- S.Boolean.pipe(T.Body("https://slack.com/team_image_default")),
189
- ),
190
- }),
191
- ).annotate({ identifier: "UserInfoResponse" }) as any as S.Schema<UserInfoResponse>;
192
-
193
82
  export type ConnectTokenError = SlackOpError;
194
- /** Exchanges a temporary OAuth verifier code for an access token for Sign in with Slack. Rate limit tier: 4 Method-specific errors (the `error` slug on the SlackError): - `bad_client_secret` — The value passed for `client_secret` was invalid. - `bad_redirect_uri` — The value passed for `redirect_uri` did not match the `redirect_uri` in the original request. - `cannot_install_an_org_installed_app` — An org-installed app cannot be installed on a workspace. - `invalid_client` — Client authentication failed (unknown `client_id` or bad `client_secret`). - `invalid_client_id` — The value passed for `client_id` was invalid. - `invalid_code` — The value passed for `code` was invalid. - `invalid_grant` — The authorization code is invalid, expired, revoked, or the PKCE `code_verifier` does not match. - `invalid_grant_type` — The value passed for `grant_type` was invalid. - `invalid_refresh_token` — The given refresh token is invalid. - `invalid_request` — The request is missing a required parameter or includes an invalid parameter value. - `oauth_authorization_url_mismatch` — The OAuth flow was initiated on an incorrect version of the authorization URL. The flow must be initiated via /openid/connect/authorize . - `preview_feature_not_available` — The API method is not yet available on the team. - `unsupported_grant_type` — The `grant_type` is not supported by this endpoint. See https://docs.slack.dev/reference/methods/openid.connect.token */
83
+ /** Exchanges a temporary OAuth verifier code for an access token for Sign in with Slack. Rate limit tier: 4 Method-specific errors (the `error` slug on the SlackError): - `bad_client_secret` -- The value passed for `client_secret` was invalid. - `bad_redirect_uri` -- The value passed for `redirect_uri` did not match the `redirect_uri` in the original request. - `cannot_install_an_org_installed_app` -- An org-installed app cannot be installed on a workspace. - `invalid_client` -- Client authentication failed (unknown `client_id` or bad `client_secret`). - `invalid_client_id` -- The value passed for `client_id` was invalid. - `invalid_code` -- The value passed for `code` was invalid. - `invalid_grant` -- The authorization code is invalid, expired, revoked, or the PKCE `code_verifier` does not match. - `invalid_grant_type` -- The value passed for `grant_type` was invalid. - `invalid_refresh_token` -- The given refresh token is invalid. - `invalid_request` -- The request is missing a required parameter or includes an invalid parameter value. - `oauth_authorization_url_mismatch` -- The OAuth flow was initiated on an incorrect version of the authorization URL. The flow must be initiated via /openid/connect/authorize . - `preview_feature_not_available` -- The API method is not yet available on the team. - `unsupported_grant_type` -- The `grant_type` is not supported by this endpoint. See https://docs.slack.dev/reference/methods/openid.connect.token */
195
84
  export const connectToken: API.OperationMethod<
196
85
  ConnectTokenRequest,
197
86
  ConnectTokenResponse,
198
87
  ConnectTokenError,
199
88
  SlackOpContext
200
89
  > = /*@__PURE__*/ API.make(() => ({
201
- input: ConnectTokenRequest,
202
- output: ConnectTokenResponse,
90
+ input: __S(0, __c0, 0) as any as S.Schema<ConnectTokenRequest>,
91
+ output: __S(1, __c0, 1) as any as S.Schema<ConnectTokenResponse>,
203
92
  errors: [SlackError, SlackRateLimited],
204
93
  protocol: SlackProtocol,
205
94
  retry: Retry.Retry,
206
95
  }));
207
96
 
208
97
  export type UserInfoError = SlackOpError;
209
- /** Get the identity of a user who has authorized Sign in with Slack. Required scopes — user: `openid` Rate limit tier: 3 See https://docs.slack.dev/reference/methods/openid.connect.userInfo */
98
+ /** Get the identity of a user who has authorized Sign in with Slack. Required scopes -- user: `openid` Rate limit tier: 3 See https://docs.slack.dev/reference/methods/openid.connect.userInfo */
210
99
  export const userInfo: API.OperationMethod<
211
100
  UserInfoRequest,
212
101
  UserInfoResponse,
213
102
  UserInfoError,
214
103
  SlackOpContext
215
104
  > = /*@__PURE__*/ API.make(() => ({
216
- input: UserInfoRequest,
217
- output: UserInfoResponse,
105
+ input: __S(2, __c1, 0) as any as S.Schema<UserInfoRequest>,
106
+ output: __S(3, __c1, 1) as any as S.Schema<UserInfoResponse>,
218
107
  errors: [SlackError, SlackRateLimited],
219
108
  protocol: SlackProtocol,
220
109
  retry: Retry.Retry,
221
110
  }));
111
+
112
+ // Schema builders: each runs one schema initializer, on that schema's first use.
113
+ function __c0(j: number): any {
114
+ switch (j) {
115
+ case 0:
116
+ return S.suspend(() =>
117
+ S.Struct({
118
+ client_id: S.optional(S.String),
119
+ client_secret: S.optional(S.String.pipe(T.SensitiveValue({}))),
120
+ code: S.optional(S.String),
121
+ redirect_uri: S.optional(S.String),
122
+ grant_type: S.optional(S.String),
123
+ refresh_token: S.optional(S.String.pipe(T.SensitiveValue({}))),
124
+ code_verifier: S.optional(S.String),
125
+ }).pipe(
126
+ T.Http({
127
+ method: "POST",
128
+ uri: "/openid.connect.token",
129
+ code: 200,
130
+ contentType: "form-urlencoded",
131
+ }),
132
+ ),
133
+ ).annotate({ identifier: "ConnectTokenRequest" });
134
+ case 1:
135
+ return S.suspend(() =>
136
+ S.Struct({
137
+ ok: S.Boolean,
138
+ access_token: S.String.pipe(T.SensitiveValue({})),
139
+ token_type: S.String,
140
+ id_token: S.optional(S.String),
141
+ state: S.optional(S.String),
142
+ expires_in: S.optional(S.Number),
143
+ refresh_token: S.optional(S.String.pipe(T.SensitiveValue({}))),
144
+ }),
145
+ ).annotate({ identifier: "ConnectTokenResponse" });
146
+ }
147
+ }
148
+ function __c1(j: number): any {
149
+ switch (j) {
150
+ case 0:
151
+ return S.suspend(() =>
152
+ S.Struct({}).pipe(T.Http({ method: "POST", uri: "/openid.connect.userInfo", code: 200 })),
153
+ ).annotate({ identifier: "UserInfoRequest" });
154
+ case 1:
155
+ return S.suspend(() =>
156
+ S.Struct({
157
+ ok: S.Boolean,
158
+ sub: S.String,
159
+ https___slack_com_user_id: S.String.pipe(T.Body("https://slack.com/user_id")),
160
+ https___slack_com_team_id: S.optional(S.String.pipe(T.Body("https://slack.com/team_id"))),
161
+ https___slack_com_enterprise_id: S.optional(
162
+ S.String.pipe(T.Body("https://slack.com/enterprise_id")),
163
+ ),
164
+ email: S.optional(S.String),
165
+ email_verified: S.optional(S.Boolean),
166
+ date_email_verified: S.optional(S.Number),
167
+ locale: S.optional(S.String),
168
+ name: S.optional(S.String),
169
+ given_name: S.optional(S.String),
170
+ family_name: S.optional(S.String),
171
+ picture: S.optional(S.String),
172
+ https___slack_com_user_image_24: S.optional(
173
+ S.String.pipe(T.Body("https://slack.com/user_image_24")),
174
+ ),
175
+ https___slack_com_user_image_32: S.optional(
176
+ S.String.pipe(T.Body("https://slack.com/user_image_32")),
177
+ ),
178
+ https___slack_com_user_image_48: S.optional(
179
+ S.String.pipe(T.Body("https://slack.com/user_image_48")),
180
+ ),
181
+ https___slack_com_user_image_72: S.optional(
182
+ S.String.pipe(T.Body("https://slack.com/user_image_72")),
183
+ ),
184
+ https___slack_com_user_image_192: S.optional(
185
+ S.String.pipe(T.Body("https://slack.com/user_image_192")),
186
+ ),
187
+ https___slack_com_user_image_512: S.optional(
188
+ S.String.pipe(T.Body("https://slack.com/user_image_512")),
189
+ ),
190
+ https___slack_com_user_image_1024: S.optional(
191
+ S.String.pipe(T.Body("https://slack.com/user_image_1024")),
192
+ ),
193
+ https___slack_com_team_name: S.optional(
194
+ S.String.pipe(T.Body("https://slack.com/team_name")),
195
+ ),
196
+ https___slack_com_team_domain: S.optional(
197
+ S.String.pipe(T.Body("https://slack.com/team_domain")),
198
+ ),
199
+ https___slack_com_enterprise_name: S.optional(
200
+ S.String.pipe(T.Body("https://slack.com/enterprise_name")),
201
+ ),
202
+ https___slack_com_enterprise_domain: S.optional(
203
+ S.String.pipe(T.Body("https://slack.com/enterprise_domain")),
204
+ ),
205
+ https___slack_com_team_image_34: S.optional(
206
+ S.String.pipe(T.Body("https://slack.com/team_image_34")),
207
+ ),
208
+ https___slack_com_team_image_44: S.optional(
209
+ S.String.pipe(T.Body("https://slack.com/team_image_44")),
210
+ ),
211
+ https___slack_com_team_image_68: S.optional(
212
+ S.String.pipe(T.Body("https://slack.com/team_image_68")),
213
+ ),
214
+ https___slack_com_team_image_88: S.optional(
215
+ S.String.pipe(T.Body("https://slack.com/team_image_88")),
216
+ ),
217
+ https___slack_com_team_image_102: S.optional(
218
+ S.String.pipe(T.Body("https://slack.com/team_image_102")),
219
+ ),
220
+ https___slack_com_team_image_132: S.optional(
221
+ S.String.pipe(T.Body("https://slack.com/team_image_132")),
222
+ ),
223
+ https___slack_com_team_image_230: S.optional(
224
+ S.String.pipe(T.Body("https://slack.com/team_image_230")),
225
+ ),
226
+ https___slack_com_team_image_default: S.optional(
227
+ S.Boolean.pipe(T.Body("https://slack.com/team_image_default")),
228
+ ),
229
+ }),
230
+ ).annotate({ identifier: "UserInfoResponse" });
231
+ }
232
+ }
233
+ // Schema table: entry i is schema j of builder f, made on first reach.
234
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
235
+ return (__s[i] ??= __L.at(f, j));
236
+ }
@@ -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,36 +17,15 @@ export interface AddPinRequest {
14
17
  /** Timestamp of the message to pin. You must also include the `channel`. */
15
18
  timestamp?: string;
16
19
  }
17
- export const AddPinRequest = /*@__PURE__*/ S.suspend(() =>
18
- S.Struct({
19
- channel: S.String,
20
- timestamp: S.optional(S.String),
21
- }).pipe(T.Http({ method: "POST", uri: "/pins.add", code: 200 })),
22
- ).annotate({ identifier: "AddPinRequest" }) as any as S.Schema<AddPinRequest>;
23
-
24
20
  export interface AddPinResponse {
25
21
  /** Always `true` (a failed call raises a typed error instead). */
26
22
  ok: boolean;
27
23
  }
28
- export const AddPinResponse = /*@__PURE__*/ S.suspend(() =>
29
- S.Struct({
30
- ok: S.Boolean,
31
- }),
32
- ).annotate({ identifier: "AddPinResponse" }) as any as S.Schema<AddPinResponse>;
33
-
34
24
  export interface ListPinsRequest {
35
25
  /** Channel to get pinned items for. */
36
26
  channel: string;
37
27
  }
38
- export const ListPinsRequest = /*@__PURE__*/ S.suspend(() =>
39
- S.Struct({
40
- channel: S.String.pipe(T.Query()),
41
- }).pipe(T.Http({ method: "GET", uri: "/pins.list", code: 200 })),
42
- ).annotate({ identifier: "ListPinsRequest" }) as any as S.Schema<ListPinsRequest>;
43
-
44
28
  export type ListPinsResponseItemsItemType = "file" | "message" | "file_comment";
45
- export const ListPinsResponseItemsItemType = S.String;
46
-
47
29
  export interface ListPinsResponseItemsItem {
48
30
  type: ListPinsResponseItemsItemType;
49
31
  created: number;
@@ -53,103 +35,134 @@ export interface ListPinsResponseItemsItem {
53
35
  file?: unknown;
54
36
  comment?: string;
55
37
  }
56
- export const ListPinsResponseItemsItem = /*@__PURE__*/ S.suspend(() =>
57
- S.Struct({
58
- type: ListPinsResponseItemsItemType,
59
- created: S.Number,
60
- created_by: S.String,
61
- channel: S.optional(S.String),
62
- message: S.optional(S.Unknown),
63
- file: S.optional(S.Unknown),
64
- comment: S.optional(S.String),
65
- }),
66
- ).annotate({
67
- identifier: "ListPinsResponseItemsItem",
68
- }) as any as S.Schema<ListPinsResponseItemsItem>;
69
-
70
38
  export type ListPinsResponseItemsList = Array<ListPinsResponseItemsItem>;
71
- export const ListPinsResponseItemsList = /*@__PURE__*/ S.Array(
72
- ListPinsResponseItemsItem,
73
- ) as any as S.Schema<ListPinsResponseItemsList>;
74
-
75
39
  export interface ListPinsResponse {
76
40
  /** Always `true` (a failed call raises a typed error instead). */
77
41
  ok: boolean;
78
42
  items?: ListPinsResponseItemsList;
79
43
  count?: number;
80
44
  }
81
- export const ListPinsResponse = /*@__PURE__*/ S.suspend(() =>
82
- S.Struct({
83
- ok: S.Boolean,
84
- items: S.optional(ListPinsResponseItemsList),
85
- count: S.optional(S.Number),
86
- }),
87
- ).annotate({ identifier: "ListPinsResponse" }) as any as S.Schema<ListPinsResponse>;
88
-
89
45
  export interface RemovePinRequest {
90
46
  /** Channel where the item is pinned to. */
91
47
  channel: string;
92
48
  /** Timestamp of the message to un-pin. */
93
49
  timestamp?: string;
94
50
  }
95
- export const RemovePinRequest = /*@__PURE__*/ S.suspend(() =>
96
- S.Struct({
97
- channel: S.String,
98
- timestamp: S.optional(S.String),
99
- }).pipe(T.Http({ method: "POST", uri: "/pins.remove", code: 200 })),
100
- ).annotate({ identifier: "RemovePinRequest" }) as any as S.Schema<RemovePinRequest>;
101
-
102
51
  export interface RemovePinResponse {
103
52
  /** Always `true` (a failed call raises a typed error instead). */
104
53
  ok: boolean;
105
54
  }
106
- export const RemovePinResponse = /*@__PURE__*/ S.suspend(() =>
107
- S.Struct({
108
- ok: S.Boolean,
109
- }),
110
- ).annotate({ identifier: "RemovePinResponse" }) as any as S.Schema<RemovePinResponse>;
111
-
112
55
  export type AddPinError = SlackOpError;
113
- /** Pins an item to a channel. Required scopes — bot: `pins:write`; user: `pins:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `already_pinned` — The specified item is already pinned to the channel. - `bad_timestamp` — Value passed for `timestamp` was invalid. - `channel_not_found` — The `channel` argument was not specified or was invalid - `external_channel_migrating` — Channel is undergoing an active migration. - `file_not_found` — File not found. - `file_not_shared` — File specified by `file` is not public nor shared to the channel. - `message_not_found` — Message specified by `channel` and `timestamp` does not exist. - `no_item_specified` — One of `file`, `file_comment`, or `timestamp` was not specified. - `not_in_channel` — Item is not in channel. - `not_pinnable` — This message type is not pinnable. - `restricted_action` — The user does not have permission to add pins to the channel. - `too_many_pins` — Too many pins in channel. See https://docs.slack.dev/reference/methods/pins.add */
56
+ /** Pins an item to a channel. Required scopes -- bot: `pins:write`; user: `pins:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `already_pinned` -- The specified item is already pinned to the channel. - `bad_timestamp` -- Value passed for `timestamp` was invalid. - `channel_not_found` -- The `channel` argument was not specified or was invalid - `external_channel_migrating` -- Channel is undergoing an active migration. - `file_not_found` -- File not found. - `file_not_shared` -- File specified by `file` is not public nor shared to the channel. - `message_not_found` -- Message specified by `channel` and `timestamp` does not exist. - `no_item_specified` -- One of `file`, `file_comment`, or `timestamp` was not specified. - `not_in_channel` -- Item is not in channel. - `not_pinnable` -- This message type is not pinnable. - `restricted_action` -- The user does not have permission to add pins to the channel. - `too_many_pins` -- Too many pins in channel. See https://docs.slack.dev/reference/methods/pins.add */
114
57
  export const addPin: API.OperationMethod<
115
58
  AddPinRequest,
116
59
  AddPinResponse,
117
60
  AddPinError,
118
61
  SlackOpContext
119
62
  > = /*@__PURE__*/ API.make(() => ({
120
- input: AddPinRequest,
121
- output: AddPinResponse,
63
+ input: __S(0, __c0, 0) as any as S.Schema<AddPinRequest>,
64
+ output: __S(4, __c1, 0) as any as S.Schema<AddPinResponse>,
122
65
  errors: [SlackError, SlackRateLimited],
123
66
  protocol: SlackProtocol,
124
67
  retry: Retry.Retry,
125
68
  }));
126
69
 
127
70
  export type ListPinsError = SlackOpError;
128
- /** Lists items pinned to a channel. Required scopes — bot: `pins:read`; user: `pins:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `channel_not_found` — Value passed for `channel` was invalid. - `restricted_action` — The user does not have permission to view the channel. See https://docs.slack.dev/reference/methods/pins.list */
71
+ /** Lists items pinned to a channel. Required scopes -- bot: `pins:read`; user: `pins:read` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `channel_not_found` -- Value passed for `channel` was invalid. - `restricted_action` -- The user does not have permission to view the channel. See https://docs.slack.dev/reference/methods/pins.list */
129
72
  export const listPins: API.OperationMethod<
130
73
  ListPinsRequest,
131
74
  ListPinsResponse,
132
75
  ListPinsError,
133
76
  SlackOpContext
134
77
  > = /*@__PURE__*/ API.make(() => ({
135
- input: ListPinsRequest,
136
- output: ListPinsResponse,
78
+ input: __S(8, __c2, 0) as any as S.Schema<ListPinsRequest>,
79
+ output: __S(11, __c2, 3) as any as S.Schema<ListPinsResponse>,
137
80
  errors: [SlackError, SlackRateLimited],
138
81
  protocol: SlackProtocol,
139
82
  retry: Retry.Retry,
140
83
  }));
141
84
 
142
85
  export type RemovePinError = SlackOpError;
143
- /** Un-pins an item from a channel. Required scopes — bot: `pins:write`; user: `pins:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `bad_timestamp` — Value passed for `timestamp` was invalid. - `channel_not_found` — The `channel` argument was not specified or was invalid - `external_channel_migrating` — Channel is undergoing an active migration. - `file_comment_not_found` — File comment specified by `file_comment` does not exist. - `file_not_found` — File specified by `file` does not exist. - `message_not_found` — Message specified by `channel` and `timestamp` does not exist. - `no_item_specified` — One of `file`, `file_comment`, or `timestamp` was not specified. - `no_pin` — The pin could not be found. - `not_pinned` — The specified item is not pinned to the channel. - `restricted_action` — The user does not have permission to remove pins from the channel. See https://docs.slack.dev/reference/methods/pins.remove */
86
+ /** Un-pins an item from a channel. Required scopes -- bot: `pins:write`; user: `pins:write` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `bad_timestamp` -- Value passed for `timestamp` was invalid. - `channel_not_found` -- The `channel` argument was not specified or was invalid - `external_channel_migrating` -- Channel is undergoing an active migration. - `file_comment_not_found` -- File comment specified by `file_comment` does not exist. - `file_not_found` -- File specified by `file` does not exist. - `message_not_found` -- Message specified by `channel` and `timestamp` does not exist. - `no_item_specified` -- One of `file`, `file_comment`, or `timestamp` was not specified. - `no_pin` -- The pin could not be found. - `not_pinned` -- The specified item is not pinned to the channel. - `restricted_action` -- The user does not have permission to remove pins from the channel. See https://docs.slack.dev/reference/methods/pins.remove */
144
87
  export const removePin: API.OperationMethod<
145
88
  RemovePinRequest,
146
89
  RemovePinResponse,
147
90
  RemovePinError,
148
91
  SlackOpContext
149
92
  > = /*@__PURE__*/ API.make(() => ({
150
- input: RemovePinRequest,
151
- output: RemovePinResponse,
93
+ input: __S(12, __c3, 0) as any as S.Schema<RemovePinRequest>,
94
+ output: __S(4, __c1, 0) as any as S.Schema<RemovePinResponse>,
152
95
  errors: [SlackError, SlackRateLimited],
153
96
  protocol: SlackProtocol,
154
97
  retry: Retry.Retry,
155
98
  }));
99
+
100
+ // Schema builders: each runs one schema initializer, on that schema's first use.
101
+ function __c0(j: number): any {
102
+ switch (j) {
103
+ case 0:
104
+ return S.suspend(() =>
105
+ S.Struct({
106
+ channel: S.String,
107
+ timestamp: S.optional(S.String),
108
+ }).pipe(T.Http({ method: "POST", uri: "/pins.add", code: 200 })),
109
+ ).annotate({ identifier: "AddPinRequest" });
110
+ }
111
+ }
112
+ function __c1(j: number): any {
113
+ switch (j) {
114
+ case 0:
115
+ return S.suspend(() =>
116
+ S.Struct({
117
+ ok: S.Boolean,
118
+ }),
119
+ ).annotate({ identifier: "AddPinResponse" });
120
+ }
121
+ }
122
+ function __c2(j: number): any {
123
+ switch (j) {
124
+ case 0:
125
+ return S.suspend(() =>
126
+ S.Struct({
127
+ channel: S.String.pipe(T.Query()),
128
+ }).pipe(T.Http({ method: "GET", uri: "/pins.list", code: 200 })),
129
+ ).annotate({ identifier: "ListPinsRequest" });
130
+ case 1:
131
+ return S.suspend(() =>
132
+ S.Struct({
133
+ type: S.String,
134
+ created: S.Number,
135
+ created_by: S.String,
136
+ channel: S.optional(S.String),
137
+ message: S.optional(S.Unknown),
138
+ file: S.optional(S.Unknown),
139
+ comment: S.optional(S.String),
140
+ }),
141
+ ).annotate({ identifier: "ListPinsResponseItemsItem" });
142
+ case 2:
143
+ return S.Array(__S(9, __c2, 1));
144
+ case 3:
145
+ return S.suspend(() =>
146
+ S.Struct({
147
+ ok: S.Boolean,
148
+ items: S.optional(__S(10, __c2, 2)),
149
+ count: S.optional(S.Number),
150
+ }),
151
+ ).annotate({ identifier: "ListPinsResponse" });
152
+ }
153
+ }
154
+ function __c3(j: number): any {
155
+ switch (j) {
156
+ case 0:
157
+ return S.suspend(() =>
158
+ S.Struct({
159
+ channel: S.String,
160
+ timestamp: S.optional(S.String),
161
+ }).pipe(T.Http({ method: "POST", uri: "/pins.remove", code: 200 })),
162
+ ).annotate({ identifier: "RemovePinRequest" });
163
+ }
164
+ }
165
+ // Schema table: entry i is schema j of builder f, made on first reach.
166
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
167
+ return (__s[i] ??= __L.at(f, j));
168
+ }