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

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 (209) hide show
  1. package/lib/credentials.d.ts +1 -1
  2. package/lib/credentials.d.ts.map +1 -1
  3. package/lib/credentials.js +39 -34
  4. package/lib/credentials.js.map +1 -1
  5. package/lib/errors.d.ts +31 -31
  6. package/lib/errors.d.ts.map +1 -1
  7. package/lib/errors.js +41 -41
  8. package/lib/errors.js.map +1 -1
  9. package/lib/index.d.ts +1 -1
  10. package/lib/index.js +9 -9
  11. package/lib/pagination.d.ts +2 -2
  12. package/lib/pagination.js +28 -28
  13. package/lib/protocol.d.ts.map +1 -1
  14. package/lib/protocol.js +61 -59
  15. package/lib/protocol.js.map +1 -1
  16. package/lib/retry.d.ts +2 -2
  17. package/lib/retry.d.ts.map +1 -1
  18. package/lib/retry.js +34 -33
  19. package/lib/retry.js.map +1 -1
  20. package/lib/services/admin.d.ts +123 -575
  21. package/lib/services/admin.d.ts.map +1 -1
  22. package/lib/services/admin.js +304 -2878
  23. package/lib/services/agents.d.ts +13 -55
  24. package/lib/services/agents.d.ts.map +1 -1
  25. package/lib/services/agents.js +48 -309
  26. package/lib/services/api.d.ts +0 -4
  27. package/lib/services/api.d.ts.map +1 -1
  28. package/lib/services/api.js +16 -18
  29. package/lib/services/apps.d.ts +25 -106
  30. package/lib/services/apps.d.ts.map +1 -1
  31. package/lib/services/apps.js +84 -509
  32. package/lib/services/assistant.d.ts +6 -40
  33. package/lib/services/assistant.d.ts.map +1 -1
  34. package/lib/services/assistant.js +33 -204
  35. package/lib/services/auth.d.ts +4 -15
  36. package/lib/services/auth.d.ts.map +1 -1
  37. package/lib/services/auth.js +22 -90
  38. package/lib/services/blocks.d.ts +1 -7
  39. package/lib/services/blocks.d.ts.map +1 -1
  40. package/lib/services/blocks.js +16 -21
  41. package/lib/services/bookmarks.d.ts +4 -15
  42. package/lib/services/bookmarks.d.ts.map +1 -1
  43. package/lib/services/bookmarks.js +27 -76
  44. package/lib/services/bots.d.ts +1 -9
  45. package/lib/services/bots.d.ts.map +1 -1
  46. package/lib/services/bots.js +17 -54
  47. package/lib/services/calls.d.ts +6 -22
  48. package/lib/services/calls.d.ts.map +1 -1
  49. package/lib/services/calls.js +35 -110
  50. package/lib/services/canvases.d.ts +7 -35
  51. package/lib/services/canvases.d.ts.map +1 -1
  52. package/lib/services/canvases.js +39 -135
  53. package/lib/services/chat.d.ts +14 -83
  54. package/lib/services/chat.d.ts.map +1 -1
  55. package/lib/services/chat.js +59 -381
  56. package/lib/services/conversations.d.ts +31 -116
  57. package/lib/services/conversations.d.ts.map +1 -1
  58. package/lib/services/conversations.js +94 -690
  59. package/lib/services/dialog.d.ts +1 -4
  60. package/lib/services/dialog.d.ts.map +1 -1
  61. package/lib/services/dialog.js +13 -17
  62. package/lib/services/dnd.d.ts +5 -17
  63. package/lib/services/dnd.d.ts.map +1 -1
  64. package/lib/services/dnd.js +26 -91
  65. package/lib/services/emoji.d.ts +1 -8
  66. package/lib/services/emoji.d.ts.map +1 -1
  67. package/lib/services/emoji.js +18 -29
  68. package/lib/services/entity.d.ts +4 -16
  69. package/lib/services/entity.d.ts.map +1 -1
  70. package/lib/services/entity.js +29 -71
  71. package/lib/services/files.d.ts +16 -80
  72. package/lib/services/files.d.ts.map +1 -1
  73. package/lib/services/files.js +75 -433
  74. package/lib/services/functions.d.ts +8 -49
  75. package/lib/services/functions.d.ts.map +1 -1
  76. package/lib/services/functions.js +45 -203
  77. package/lib/services/lists.d.ts +13 -55
  78. package/lib/services/lists.d.ts.map +1 -1
  79. package/lib/services/lists.js +53 -248
  80. package/lib/services/migration.d.ts +1 -7
  81. package/lib/services/migration.d.ts.map +1 -1
  82. package/lib/services/migration.js +18 -27
  83. package/lib/services/oauth.d.ts +7 -43
  84. package/lib/services/oauth.d.ts.map +1 -1
  85. package/lib/services/oauth.js +34 -289
  86. package/lib/services/openid.d.ts +3 -10
  87. package/lib/services/openid.d.ts.map +1 -1
  88. package/lib/services/openid.js +19 -79
  89. package/lib/services/pins.d.ts +3 -13
  90. package/lib/services/pins.d.ts.map +1 -1
  91. package/lib/services/pins.js +27 -61
  92. package/lib/services/reactions.d.ts +5 -17
  93. package/lib/services/reactions.d.ts.map +1 -1
  94. package/lib/services/reactions.js +30 -96
  95. package/lib/services/reminders.d.ts +5 -17
  96. package/lib/services/reminders.d.ts.map +1 -1
  97. package/lib/services/reminders.js +33 -83
  98. package/lib/services/rtm.d.ts +2 -11
  99. package/lib/services/rtm.d.ts.map +1 -1
  100. package/lib/services/rtm.js +22 -56
  101. package/lib/services/search.d.ts +4 -35
  102. package/lib/services/search.d.ts.map +1 -1
  103. package/lib/services/search.js +28 -167
  104. package/lib/services/stars.d.ts +4 -26
  105. package/lib/services/stars.d.ts.map +1 -1
  106. package/lib/services/stars.js +28 -128
  107. package/lib/services/team.d.ts +11 -63
  108. package/lib/services/team.d.ts.map +1 -1
  109. package/lib/services/team.js +45 -289
  110. package/lib/services/tooling.d.ts +2 -5
  111. package/lib/services/tooling.d.ts.map +1 -1
  112. package/lib/services/tooling.js +15 -28
  113. package/lib/services/usergroups.d.ts +7 -31
  114. package/lib/services/usergroups.d.ts.map +1 -1
  115. package/lib/services/usergroups.js +40 -146
  116. package/lib/services/users.d.ts +14 -48
  117. package/lib/services/users.d.ts.map +1 -1
  118. package/lib/services/users.js +54 -249
  119. package/lib/services/views.d.ts +4 -14
  120. package/lib/services/views.d.ts.map +1 -1
  121. package/lib/services/views.js +28 -73
  122. package/lib/services/workflows.d.ts +8 -51
  123. package/lib/services/workflows.d.ts.map +1 -1
  124. package/lib/services/workflows.js +37 -188
  125. package/lib/traits.d.ts +1 -1
  126. package/lib/traits.js +8 -8
  127. package/package.json +14 -10
  128. package/src/credentials.ts +20 -21
  129. package/src/errors.ts +31 -27
  130. package/src/index.ts +1 -1
  131. package/src/pagination.ts +2 -2
  132. package/src/protocol.ts +30 -29
  133. package/src/retry.ts +6 -6
  134. package/src/services/admin.ts +2717 -3451
  135. package/src/services/agents.ts +380 -370
  136. package/src/services/api.ts +31 -21
  137. package/src/services/apps.ts +569 -621
  138. package/src/services/assistant.ts +235 -270
  139. package/src/services/auth.ts +118 -100
  140. package/src/services/blocks.ts +33 -29
  141. package/src/services/bookmarks.ts +101 -83
  142. package/src/services/bots.ts +74 -67
  143. package/src/services/calls.ts +118 -124
  144. package/src/services/canvases.ts +171 -178
  145. package/src/services/chat.ts +428 -496
  146. package/src/services/conversations.ts +675 -761
  147. package/src/services/dialog.ts +30 -17
  148. package/src/services/dnd.ts +125 -99
  149. package/src/services/emoji.ts +46 -42
  150. package/src/services/entity.ts +94 -92
  151. package/src/services/files.ts +536 -531
  152. package/src/services/functions.ts +209 -274
  153. package/src/services/lists.ts +289 -304
  154. package/src/services/migration.ts +39 -37
  155. package/src/services/oauth.ts +345 -361
  156. package/src/services/openid.ts +137 -122
  157. package/src/services/pins.ts +83 -70
  158. package/src/services/reactions.ts +119 -103
  159. package/src/services/reminders.ts +112 -90
  160. package/src/services/rtm.ts +73 -65
  161. package/src/services/search.ts +193 -244
  162. package/src/services/stars.ts +101 -160
  163. package/src/services/team.ts +333 -369
  164. package/src/services/tooling.ts +43 -30
  165. package/src/services/usergroups.ts +175 -179
  166. package/src/services/users.ts +301 -268
  167. package/src/services/views.ts +85 -80
  168. package/src/services/workflows.ts +184 -269
  169. package/src/traits.ts +1 -1
  170. package/lib/protocol.test.d.ts +0 -2
  171. package/lib/protocol.test.d.ts.map +0 -1
  172. package/lib/protocol.test.js +0 -288
  173. package/lib/protocol.test.js.map +0 -1
  174. package/lib/services/admin.js.map +0 -1
  175. package/lib/services/agents.js.map +0 -1
  176. package/lib/services/api.js.map +0 -1
  177. package/lib/services/apps.js.map +0 -1
  178. package/lib/services/assistant.js.map +0 -1
  179. package/lib/services/auth.js.map +0 -1
  180. package/lib/services/blocks.js.map +0 -1
  181. package/lib/services/bookmarks.js.map +0 -1
  182. package/lib/services/bots.js.map +0 -1
  183. package/lib/services/calls.js.map +0 -1
  184. package/lib/services/canvases.js.map +0 -1
  185. package/lib/services/chat.js.map +0 -1
  186. package/lib/services/conversations.js.map +0 -1
  187. package/lib/services/dialog.js.map +0 -1
  188. package/lib/services/dnd.js.map +0 -1
  189. package/lib/services/emoji.js.map +0 -1
  190. package/lib/services/entity.js.map +0 -1
  191. package/lib/services/files.js.map +0 -1
  192. package/lib/services/functions.js.map +0 -1
  193. package/lib/services/lists.js.map +0 -1
  194. package/lib/services/migration.js.map +0 -1
  195. package/lib/services/oauth.js.map +0 -1
  196. package/lib/services/openid.js.map +0 -1
  197. package/lib/services/pins.js.map +0 -1
  198. package/lib/services/reactions.js.map +0 -1
  199. package/lib/services/reminders.js.map +0 -1
  200. package/lib/services/rtm.js.map +0 -1
  201. package/lib/services/search.js.map +0 -1
  202. package/lib/services/stars.js.map +0 -1
  203. package/lib/services/team.js.map +0 -1
  204. package/lib/services/tooling.js.map +0 -1
  205. package/lib/services/usergroups.js.map +0 -1
  206. package/lib/services/users.js.map +0 -1
  207. package/lib/services/views.js.map +0 -1
  208. package/lib/services/workflows.js.map +0 -1
  209. package/src/protocol.test.ts +0 -372
@@ -1,11 +1,14 @@
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 { slackPaginate } from "../pagination.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
 
@@ -17,16 +20,6 @@ export interface ListTeamsRequest {
17
20
  /** Whether to return icon paths for each workspace. An icon path represents a URI pointing to the image signifying the workspace. */
18
21
  include_icon?: boolean;
19
22
  }
20
- export const ListTeamsRequest = /*@__PURE__*/ S.suspend(() =>
21
- S.Struct({
22
- limit: S.optional(S.Number),
23
- cursor: S.optional(S.String),
24
- include_icon: S.optional(S.Boolean),
25
- }).pipe(
26
- T.Http({ method: "POST", uri: "/auth.teams.list", code: 200, contentType: "form-urlencoded" }),
27
- ),
28
- ).annotate({ identifier: "ListTeamsRequest" }) as any as S.Schema<ListTeamsRequest>;
29
-
30
23
  /** Paths to icons */
31
24
  export interface ListTeamsResponseTeamsItemIcon {
32
25
  image_34?: string;
@@ -38,21 +31,6 @@ export interface ListTeamsResponseTeamsItemIcon {
38
31
  image_230?: string;
39
32
  image_default?: boolean;
40
33
  }
41
- export const ListTeamsResponseTeamsItemIcon = /*@__PURE__*/ S.suspend(() =>
42
- S.Struct({
43
- image_34: S.optional(S.String),
44
- image_44: S.optional(S.String),
45
- image_68: S.optional(S.String),
46
- image_88: S.optional(S.String),
47
- image_102: S.optional(S.String),
48
- image_132: S.optional(S.String),
49
- image_230: S.optional(S.String),
50
- image_default: S.optional(S.Boolean),
51
- }),
52
- ).annotate({
53
- identifier: "ListTeamsResponseTeamsItemIcon",
54
- }) as any as S.Schema<ListTeamsResponseTeamsItemIcon>;
55
-
56
34
  export interface ListTeamsResponseTeamsItem {
57
35
  /** ID of the workspace */
58
36
  id?: string;
@@ -61,34 +39,12 @@ export interface ListTeamsResponseTeamsItem {
61
39
  /** Paths to icons */
62
40
  icon?: ListTeamsResponseTeamsItemIcon;
63
41
  }
64
- export const ListTeamsResponseTeamsItem = /*@__PURE__*/ S.suspend(() =>
65
- S.Struct({
66
- id: S.optional(S.String),
67
- name: S.String,
68
- icon: S.optional(ListTeamsResponseTeamsItemIcon),
69
- }),
70
- ).annotate({
71
- identifier: "ListTeamsResponseTeamsItem",
72
- }) as any as S.Schema<ListTeamsResponseTeamsItem>;
73
-
74
42
  export type ListTeamsResponseTeamsList = Array<ListTeamsResponseTeamsItem>;
75
- export const ListTeamsResponseTeamsList = /*@__PURE__*/ S.Array(
76
- ListTeamsResponseTeamsItem,
77
- ) as any as S.Schema<ListTeamsResponseTeamsList>;
78
-
79
43
  /** Pagination metadata. An empty `next_cursor` means the last page. */
80
44
  export interface ListTeamsResponseResponseMetadata {
81
- /** Cursor for the next page — pass as `cursor` on the next call. */
45
+ /** Cursor for the next page -- pass as `cursor` on the next call. */
82
46
  next_cursor?: string;
83
47
  }
84
- export const ListTeamsResponseResponseMetadata = /*@__PURE__*/ S.suspend(() =>
85
- S.Struct({
86
- next_cursor: S.optional(S.String),
87
- }),
88
- ).annotate({
89
- identifier: "ListTeamsResponseResponseMetadata",
90
- }) as any as S.Schema<ListTeamsResponseResponseMetadata>;
91
-
92
48
  export interface ListTeamsResponse {
93
49
  /** Always `true` (a failed call raises a typed error instead). */
94
50
  ok: boolean;
@@ -96,41 +52,16 @@ export interface ListTeamsResponse {
96
52
  /** Pagination metadata. An empty `next_cursor` means the last page. */
97
53
  response_metadata?: ListTeamsResponseResponseMetadata;
98
54
  }
99
- export const ListTeamsResponse = /*@__PURE__*/ S.suspend(() =>
100
- S.Struct({
101
- ok: S.Boolean,
102
- teams: ListTeamsResponseTeamsList,
103
- response_metadata: S.optional(ListTeamsResponseResponseMetadata),
104
- }),
105
- ).annotate({ identifier: "ListTeamsResponse" }) as any as S.Schema<ListTeamsResponse>;
106
-
107
55
  export interface RevokeAuthRequest {
108
56
  /** Setting this parameter to `1` triggers a _testing mode_ where the specified token will not actually be revoked. */
109
57
  test?: boolean;
110
58
  }
111
- export const RevokeAuthRequest = /*@__PURE__*/ S.suspend(() =>
112
- S.Struct({
113
- test: S.optional(S.Boolean.pipe(T.Query())),
114
- }).pipe(T.Http({ method: "GET", uri: "/auth.revoke", code: 200 })),
115
- ).annotate({ identifier: "RevokeAuthRequest" }) as any as S.Schema<RevokeAuthRequest>;
116
-
117
59
  export interface RevokeAuthResponse {
118
60
  /** Always `true` (a failed call raises a typed error instead). */
119
61
  ok: boolean;
120
62
  revoked: boolean;
121
63
  }
122
- export const RevokeAuthResponse = /*@__PURE__*/ S.suspend(() =>
123
- S.Struct({
124
- ok: S.Boolean,
125
- revoked: S.Boolean,
126
- }),
127
- ).annotate({ identifier: "RevokeAuthResponse" }) as any as S.Schema<RevokeAuthResponse>;
128
-
129
64
  export interface TestAuthRequest {}
130
- export const TestAuthRequest = /*@__PURE__*/ S.suspend(() =>
131
- S.Struct({}).pipe(T.Http({ method: "POST", uri: "/auth.test", code: 200 })),
132
- ).annotate({ identifier: "TestAuthRequest" }) as any as S.Schema<TestAuthRequest>;
133
-
134
65
  export interface TestAuthResponse {
135
66
  /** Always `true` (a failed call raises a typed error instead). */
136
67
  ok: boolean;
@@ -146,25 +77,8 @@ export interface TestAuthResponse {
146
77
  is_enterprise_install?: boolean;
147
78
  expires_in?: number | null;
148
79
  }
149
- export const TestAuthResponse = /*@__PURE__*/ S.suspend(() =>
150
- S.Struct({
151
- ok: S.Boolean,
152
- user_id: S.optional(S.String),
153
- url: S.optional(S.String),
154
- team_id: S.optional(S.String),
155
- user: S.optional(S.NullOr(S.String)),
156
- team: S.optional(S.String),
157
- app_id: S.optional(S.String),
158
- app_name: S.optional(S.String),
159
- enterprise_id: S.optional(S.String),
160
- bot_id: S.optional(S.String),
161
- is_enterprise_install: S.optional(S.Boolean),
162
- expires_in: S.optional(S.NullOr(S.Number)),
163
- }),
164
- ).annotate({ identifier: "TestAuthResponse" }) as any as S.Schema<TestAuthResponse>;
165
-
166
80
  export type ListTeamsError = SlackOpError;
167
- /** Obtain a full list of workspaces your org-wide app has been approved for. Rate limit tier: 3 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 */
81
+ /** Obtain a full list of workspaces your org-wide app has been approved for. Rate limit tier: 3 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 */
168
82
  export const listTeams: API.PaginatedOperationMethod<
169
83
  ListTeamsRequest,
170
84
  ListTeamsResponse,
@@ -173,8 +87,8 @@ export const listTeams: API.PaginatedOperationMethod<
173
87
  ListTeamsResponseTeamsItem
174
88
  > = /*@__PURE__*/ API.makePaginated(
175
89
  () => ({
176
- input: ListTeamsRequest,
177
- output: ListTeamsResponse,
90
+ input: __S(0, __c0, 0) as any as S.Schema<ListTeamsRequest>,
91
+ output: __S(5, __c0, 5) as any as S.Schema<ListTeamsResponse>,
178
92
  errors: [SlackError, SlackRateLimited],
179
93
  protocol: SlackProtocol,
180
94
  retry: Retry.Retry,
@@ -190,31 +104,135 @@ export const listTeams: API.PaginatedOperationMethod<
190
104
  ) as any;
191
105
 
192
106
  export type RevokeAuthError = SlackOpError;
193
- /** 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 */
107
+ /** 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 */
194
108
  export const revokeAuth: API.OperationMethod<
195
109
  RevokeAuthRequest,
196
110
  RevokeAuthResponse,
197
111
  RevokeAuthError,
198
112
  SlackOpContext
199
113
  > = /*@__PURE__*/ API.make(() => ({
200
- input: RevokeAuthRequest,
201
- output: RevokeAuthResponse,
114
+ input: __S(8, __c1, 0) as any as S.Schema<RevokeAuthRequest>,
115
+ output: __S(9, __c1, 1) as any as S.Schema<RevokeAuthResponse>,
202
116
  errors: [SlackError, SlackRateLimited],
203
117
  protocol: SlackProtocol,
204
118
  retry: Retry.Retry,
205
119
  }));
206
120
 
207
121
  export type TestAuthError = SlackOpError;
208
- /** 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 */
122
+ /** 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 */
209
123
  export const testAuth: API.OperationMethod<
210
124
  TestAuthRequest,
211
125
  TestAuthResponse,
212
126
  TestAuthError,
213
127
  SlackOpContext
214
128
  > = /*@__PURE__*/ API.make(() => ({
215
- input: TestAuthRequest,
216
- output: TestAuthResponse,
129
+ input: __S(16, __c2, 0) as any as S.Schema<TestAuthRequest>,
130
+ output: __S(17, __c2, 1) as any as S.Schema<TestAuthResponse>,
217
131
  errors: [SlackError, SlackRateLimited],
218
132
  protocol: SlackProtocol,
219
133
  retry: Retry.Retry,
220
134
  }));
135
+
136
+ // Schema builders: each runs one schema initializer, on that schema's first use.
137
+ function __c0(j: number): any {
138
+ switch (j) {
139
+ case 0:
140
+ return S.suspend(() =>
141
+ S.Struct({
142
+ limit: S.optional(S.Number),
143
+ cursor: S.optional(S.String),
144
+ include_icon: S.optional(S.Boolean),
145
+ }).pipe(
146
+ T.Http({
147
+ method: "POST",
148
+ uri: "/auth.teams.list",
149
+ code: 200,
150
+ contentType: "form-urlencoded",
151
+ }),
152
+ ),
153
+ ).annotate({ identifier: "ListTeamsRequest" });
154
+ case 1:
155
+ return S.suspend(() =>
156
+ S.Struct({
157
+ image_34: S.optional(S.String),
158
+ image_44: S.optional(S.String),
159
+ image_68: S.optional(S.String),
160
+ image_88: S.optional(S.String),
161
+ image_102: S.optional(S.String),
162
+ image_132: S.optional(S.String),
163
+ image_230: S.optional(S.String),
164
+ image_default: S.optional(S.Boolean),
165
+ }),
166
+ ).annotate({ identifier: "ListTeamsResponseTeamsItemIcon" });
167
+ case 2:
168
+ return S.suspend(() =>
169
+ S.Struct({
170
+ id: S.optional(S.String),
171
+ name: S.String,
172
+ icon: S.optional(__S(1, __c0, 1)),
173
+ }),
174
+ ).annotate({ identifier: "ListTeamsResponseTeamsItem" });
175
+ case 3:
176
+ return S.Array(__S(2, __c0, 2));
177
+ case 4:
178
+ return S.suspend(() =>
179
+ S.Struct({
180
+ next_cursor: S.optional(S.String),
181
+ }),
182
+ ).annotate({ identifier: "ListTeamsResponseResponseMetadata" });
183
+ case 5:
184
+ return S.suspend(() =>
185
+ S.Struct({
186
+ ok: S.Boolean,
187
+ teams: __S(3, __c0, 3),
188
+ response_metadata: S.optional(__S(4, __c0, 4)),
189
+ }),
190
+ ).annotate({ identifier: "ListTeamsResponse" });
191
+ }
192
+ }
193
+ function __c1(j: number): any {
194
+ switch (j) {
195
+ case 0:
196
+ return S.suspend(() =>
197
+ S.Struct({
198
+ test: S.optional(S.Boolean.pipe(T.Query())),
199
+ }).pipe(T.Http({ method: "GET", uri: "/auth.revoke", code: 200 })),
200
+ ).annotate({ identifier: "RevokeAuthRequest" });
201
+ case 1:
202
+ return S.suspend(() =>
203
+ S.Struct({
204
+ ok: S.Boolean,
205
+ revoked: S.Boolean,
206
+ }),
207
+ ).annotate({ identifier: "RevokeAuthResponse" });
208
+ }
209
+ }
210
+ function __c2(j: number): any {
211
+ switch (j) {
212
+ case 0:
213
+ return S.suspend(() =>
214
+ S.Struct({}).pipe(T.Http({ method: "POST", uri: "/auth.test", code: 200 })),
215
+ ).annotate({ identifier: "TestAuthRequest" });
216
+ case 1:
217
+ return S.suspend(() =>
218
+ S.Struct({
219
+ ok: S.Boolean,
220
+ user_id: S.optional(S.String),
221
+ url: S.optional(S.String),
222
+ team_id: S.optional(S.String),
223
+ user: S.optional(S.NullOr(S.String)),
224
+ team: S.optional(S.String),
225
+ app_id: S.optional(S.String),
226
+ app_name: S.optional(S.String),
227
+ enterprise_id: S.optional(S.String),
228
+ bot_id: S.optional(S.String),
229
+ is_enterprise_install: S.optional(S.Boolean),
230
+ expires_in: S.optional(S.NullOr(S.Number)),
231
+ }),
232
+ ).annotate({ identifier: "TestAuthResponse" });
233
+ }
234
+ }
235
+ // Schema table: entry i is schema j of builder f, made on first reach.
236
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
237
+ return (__s[i] ??= __L.at(f, j));
238
+ }
@@ -1,28 +1,20 @@
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
 
11
14
  export type ValidateBlockRequestBlocksCase1ItemMap = { [key: string]: unknown | undefined };
12
- export const ValidateBlockRequestBlocksCase1ItemMap = /*@__PURE__*/ S.Record(
13
- S.String,
14
- S.Unknown,
15
- ) as any as S.Schema<ValidateBlockRequestBlocksCase1ItemMap>;
16
-
17
15
  export type ValidateBlockRequestBlocksCase1List = Array<ValidateBlockRequestBlocksCase1ItemMap>;
18
- export const ValidateBlockRequestBlocksCase1List = /*@__PURE__*/ S.Array(
19
- ValidateBlockRequestBlocksCase1ItemMap,
20
- ) as any as S.Schema<ValidateBlockRequestBlocksCase1List>;
21
-
22
16
  /** A JSON-encoded array of [structured blocks](/reference/block-kit/blocks). Provide exactly one of `blocks`, `view`, or `message`. */
23
17
  export type ValidateBlockRequestBlocks = string | ValidateBlockRequestBlocksCase1List;
24
- export const ValidateBlockRequestBlocks = /*@__PURE__*/ S.Unknown.pipe(T.UnionCases([[], []]));
25
-
26
18
  export interface ValidateBlockRequest {
27
19
  /** A JSON-encoded array of [structured blocks](/reference/block-kit/blocks). Provide exactly one of `blocks`, `view`, or `message`. */
28
20
  blocks?: ValidateBlockRequestBlocks;
@@ -31,35 +23,47 @@ export interface ValidateBlockRequest {
31
23
  /** A JSON-encoded [view payload](/reference/views) to validate. Provide exactly one of `blocks`, `view`, or `message`. */
32
24
  view?: string;
33
25
  }
34
- export const ValidateBlockRequest = /*@__PURE__*/ S.suspend(() =>
35
- S.Struct({
36
- blocks: S.optional(ValidateBlockRequestBlocks),
37
- message: S.optional(S.String),
38
- view: S.optional(S.String),
39
- }).pipe(T.Http({ method: "POST", uri: "/blocks.validate", code: 200 })),
40
- ).annotate({ identifier: "ValidateBlockRequest" }) as any as S.Schema<ValidateBlockRequest>;
41
-
42
26
  export interface ValidateBlockResponse {
43
27
  /** Always `true` (a failed call raises a typed error instead). */
44
28
  ok: boolean;
45
29
  }
46
- export const ValidateBlockResponse = /*@__PURE__*/ S.suspend(() =>
47
- S.Struct({
48
- ok: S.Boolean,
49
- }),
50
- ).annotate({ identifier: "ValidateBlockResponse" }) as any as S.Schema<ValidateBlockResponse>;
51
-
52
30
  export type ValidateBlockError = SlackOpError;
53
- /** 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 */
31
+ /** 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 */
54
32
  export const validateBlock: API.OperationMethod<
55
33
  ValidateBlockRequest,
56
34
  ValidateBlockResponse,
57
35
  ValidateBlockError,
58
36
  SlackOpContext
59
37
  > = /*@__PURE__*/ API.make(() => ({
60
- input: ValidateBlockRequest,
61
- output: ValidateBlockResponse,
38
+ input: __S(1, __c0, 1) as any as S.Schema<ValidateBlockRequest>,
39
+ output: __S(2, __c0, 2) as any as S.Schema<ValidateBlockResponse>,
62
40
  errors: [SlackError, SlackRateLimited],
63
41
  protocol: SlackProtocol,
64
42
  retry: Retry.Retry,
65
43
  }));
44
+
45
+ // Schema builders: each runs one schema initializer, on that schema's first use.
46
+ function __c0(j: number): any {
47
+ switch (j) {
48
+ case 0:
49
+ return S.Unknown.pipe(/*@__PURE__*/ T.UnionCases([[], []]));
50
+ case 1:
51
+ return S.suspend(() =>
52
+ S.Struct({
53
+ blocks: S.optional(__S(0, __c0, 0)),
54
+ message: S.optional(S.String),
55
+ view: S.optional(S.String),
56
+ }).pipe(T.Http({ method: "POST", uri: "/blocks.validate", code: 200 })),
57
+ ).annotate({ identifier: "ValidateBlockRequest" });
58
+ case 2:
59
+ return S.suspend(() =>
60
+ S.Struct({
61
+ ok: S.Boolean,
62
+ }),
63
+ ).annotate({ identifier: "ValidateBlockResponse" });
64
+ }
65
+ }
66
+ // Schema table: entry i is schema j of builder f, made on first reach.
67
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
68
+ return (__s[i] ??= __L.at(f, j));
69
+ }