@distilled.cloud/slack 1.0.0-rc.14 → 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.
- package/lib/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +39 -34
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +31 -31
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +41 -41
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +9 -9
- package/lib/pagination.d.ts +2 -2
- package/lib/pagination.js +28 -28
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +61 -59
- package/lib/protocol.js.map +1 -1
- package/lib/retry.d.ts +2 -2
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +34 -33
- package/lib/retry.js.map +1 -1
- package/lib/services/admin.d.ts +123 -575
- package/lib/services/admin.d.ts.map +1 -1
- package/lib/services/admin.js +304 -2878
- package/lib/services/agents.d.ts +13 -55
- package/lib/services/agents.d.ts.map +1 -1
- package/lib/services/agents.js +48 -309
- package/lib/services/api.d.ts +0 -4
- package/lib/services/api.d.ts.map +1 -1
- package/lib/services/api.js +16 -18
- package/lib/services/apps.d.ts +25 -106
- package/lib/services/apps.d.ts.map +1 -1
- package/lib/services/apps.js +84 -509
- package/lib/services/assistant.d.ts +6 -40
- package/lib/services/assistant.d.ts.map +1 -1
- package/lib/services/assistant.js +33 -204
- package/lib/services/auth.d.ts +4 -15
- package/lib/services/auth.d.ts.map +1 -1
- package/lib/services/auth.js +22 -90
- package/lib/services/blocks.d.ts +1 -7
- package/lib/services/blocks.d.ts.map +1 -1
- package/lib/services/blocks.js +16 -21
- package/lib/services/bookmarks.d.ts +4 -15
- package/lib/services/bookmarks.d.ts.map +1 -1
- package/lib/services/bookmarks.js +27 -76
- package/lib/services/bots.d.ts +1 -9
- package/lib/services/bots.d.ts.map +1 -1
- package/lib/services/bots.js +17 -54
- package/lib/services/calls.d.ts +6 -22
- package/lib/services/calls.d.ts.map +1 -1
- package/lib/services/calls.js +35 -110
- package/lib/services/canvases.d.ts +7 -35
- package/lib/services/canvases.d.ts.map +1 -1
- package/lib/services/canvases.js +39 -135
- package/lib/services/chat.d.ts +14 -83
- package/lib/services/chat.d.ts.map +1 -1
- package/lib/services/chat.js +59 -381
- package/lib/services/conversations.d.ts +31 -116
- package/lib/services/conversations.d.ts.map +1 -1
- package/lib/services/conversations.js +94 -690
- package/lib/services/dialog.d.ts +1 -4
- package/lib/services/dialog.d.ts.map +1 -1
- package/lib/services/dialog.js +13 -17
- package/lib/services/dnd.d.ts +5 -17
- package/lib/services/dnd.d.ts.map +1 -1
- package/lib/services/dnd.js +26 -91
- package/lib/services/emoji.d.ts +1 -8
- package/lib/services/emoji.d.ts.map +1 -1
- package/lib/services/emoji.js +18 -29
- package/lib/services/entity.d.ts +4 -16
- package/lib/services/entity.d.ts.map +1 -1
- package/lib/services/entity.js +29 -71
- package/lib/services/files.d.ts +16 -80
- package/lib/services/files.d.ts.map +1 -1
- package/lib/services/files.js +75 -433
- package/lib/services/functions.d.ts +8 -49
- package/lib/services/functions.d.ts.map +1 -1
- package/lib/services/functions.js +45 -203
- package/lib/services/lists.d.ts +13 -55
- package/lib/services/lists.d.ts.map +1 -1
- package/lib/services/lists.js +53 -248
- package/lib/services/migration.d.ts +1 -7
- package/lib/services/migration.d.ts.map +1 -1
- package/lib/services/migration.js +18 -27
- package/lib/services/oauth.d.ts +7 -43
- package/lib/services/oauth.d.ts.map +1 -1
- package/lib/services/oauth.js +34 -289
- package/lib/services/openid.d.ts +3 -10
- package/lib/services/openid.d.ts.map +1 -1
- package/lib/services/openid.js +19 -79
- package/lib/services/pins.d.ts +3 -13
- package/lib/services/pins.d.ts.map +1 -1
- package/lib/services/pins.js +27 -61
- package/lib/services/reactions.d.ts +5 -17
- package/lib/services/reactions.d.ts.map +1 -1
- package/lib/services/reactions.js +30 -96
- package/lib/services/reminders.d.ts +5 -17
- package/lib/services/reminders.d.ts.map +1 -1
- package/lib/services/reminders.js +33 -83
- package/lib/services/rtm.d.ts +2 -11
- package/lib/services/rtm.d.ts.map +1 -1
- package/lib/services/rtm.js +22 -56
- package/lib/services/search.d.ts +4 -35
- package/lib/services/search.d.ts.map +1 -1
- package/lib/services/search.js +28 -167
- package/lib/services/stars.d.ts +4 -26
- package/lib/services/stars.d.ts.map +1 -1
- package/lib/services/stars.js +28 -128
- package/lib/services/team.d.ts +11 -63
- package/lib/services/team.d.ts.map +1 -1
- package/lib/services/team.js +45 -289
- package/lib/services/tooling.d.ts +2 -5
- package/lib/services/tooling.d.ts.map +1 -1
- package/lib/services/tooling.js +15 -28
- package/lib/services/usergroups.d.ts +7 -31
- package/lib/services/usergroups.d.ts.map +1 -1
- package/lib/services/usergroups.js +40 -146
- package/lib/services/users.d.ts +14 -48
- package/lib/services/users.d.ts.map +1 -1
- package/lib/services/users.js +54 -249
- package/lib/services/views.d.ts +4 -14
- package/lib/services/views.d.ts.map +1 -1
- package/lib/services/views.js +28 -73
- package/lib/services/workflows.d.ts +8 -51
- package/lib/services/workflows.d.ts.map +1 -1
- package/lib/services/workflows.js +37 -188
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +8 -8
- package/package.json +14 -10
- package/src/credentials.ts +20 -21
- package/src/errors.ts +31 -27
- package/src/index.ts +1 -1
- package/src/pagination.ts +2 -2
- package/src/protocol.ts +30 -29
- package/src/retry.ts +6 -6
- package/src/services/admin.ts +2717 -3451
- package/src/services/agents.ts +380 -370
- package/src/services/api.ts +31 -21
- package/src/services/apps.ts +569 -621
- package/src/services/assistant.ts +235 -270
- package/src/services/auth.ts +118 -100
- package/src/services/blocks.ts +33 -29
- package/src/services/bookmarks.ts +101 -83
- package/src/services/bots.ts +74 -67
- package/src/services/calls.ts +118 -124
- package/src/services/canvases.ts +171 -178
- package/src/services/chat.ts +428 -496
- package/src/services/conversations.ts +675 -761
- package/src/services/dialog.ts +30 -17
- package/src/services/dnd.ts +125 -99
- package/src/services/emoji.ts +46 -42
- package/src/services/entity.ts +94 -92
- package/src/services/files.ts +536 -531
- package/src/services/functions.ts +209 -274
- package/src/services/lists.ts +289 -304
- package/src/services/migration.ts +39 -37
- package/src/services/oauth.ts +345 -361
- package/src/services/openid.ts +137 -122
- package/src/services/pins.ts +83 -70
- package/src/services/reactions.ts +119 -103
- package/src/services/reminders.ts +112 -90
- package/src/services/rtm.ts +73 -65
- package/src/services/search.ts +193 -244
- package/src/services/stars.ts +101 -160
- package/src/services/team.ts +333 -369
- package/src/services/tooling.ts +43 -30
- package/src/services/usergroups.ts +175 -179
- package/src/services/users.ts +301 -268
- package/src/services/views.ts +85 -80
- package/src/services/workflows.ts +184 -269
- package/src/traits.ts +1 -1
- package/lib/protocol.test.d.ts +0 -2
- package/lib/protocol.test.d.ts.map +0 -1
- package/lib/protocol.test.js +0 -288
- package/lib/protocol.test.js.map +0 -1
- package/lib/services/admin.js.map +0 -1
- package/lib/services/agents.js.map +0 -1
- package/lib/services/api.js.map +0 -1
- package/lib/services/apps.js.map +0 -1
- package/lib/services/assistant.js.map +0 -1
- package/lib/services/auth.js.map +0 -1
- package/lib/services/blocks.js.map +0 -1
- package/lib/services/bookmarks.js.map +0 -1
- package/lib/services/bots.js.map +0 -1
- package/lib/services/calls.js.map +0 -1
- package/lib/services/canvases.js.map +0 -1
- package/lib/services/chat.js.map +0 -1
- package/lib/services/conversations.js.map +0 -1
- package/lib/services/dialog.js.map +0 -1
- package/lib/services/dnd.js.map +0 -1
- package/lib/services/emoji.js.map +0 -1
- package/lib/services/entity.js.map +0 -1
- package/lib/services/files.js.map +0 -1
- package/lib/services/functions.js.map +0 -1
- package/lib/services/lists.js.map +0 -1
- package/lib/services/migration.js.map +0 -1
- package/lib/services/oauth.js.map +0 -1
- package/lib/services/openid.js.map +0 -1
- package/lib/services/pins.js.map +0 -1
- package/lib/services/reactions.js.map +0 -1
- package/lib/services/reminders.js.map +0 -1
- package/lib/services/rtm.js.map +0 -1
- package/lib/services/search.js.map +0 -1
- package/lib/services/stars.js.map +0 -1
- package/lib/services/team.js.map +0 -1
- package/lib/services/tooling.js.map +0 -1
- package/lib/services/usergroups.js.map +0 -1
- package/lib/services/users.js.map +0 -1
- package/lib/services/views.js.map +0 -1
- package/lib/services/workflows.js.map +0 -1
- package/src/protocol.test.ts +0 -372
package/src/services/dialog.ts
CHANGED
|
@@ -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`
|
|
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
|
+
}
|
package/src/services/dnd.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
+
}
|
package/src/services/emoji.ts
CHANGED
|
@@ -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
|
|
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
|
+
}
|