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

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 (201) hide show
  1. package/lib/_bundle/sdk.js +1 -1
  2. package/lib/_bundle/sdk.js.map +1 -1
  3. package/lib/credentials.d.ts +2 -1
  4. package/lib/credentials.d.ts.map +1 -1
  5. package/lib/index.d.ts +3 -4
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.lazy.js.map +1 -1
  8. package/lib/protocol.d.ts +3 -2
  9. package/lib/protocol.d.ts.map +1 -1
  10. package/lib/services/admin.d.ts +594 -356
  11. package/lib/services/admin.d.ts.map +1 -1
  12. package/lib/services/admin.js +149 -139
  13. package/lib/services/admin.js.map +1 -1
  14. package/lib/services/agents.d.ts +89 -97
  15. package/lib/services/agents.d.ts.map +1 -1
  16. package/lib/services/agents.js +1 -1
  17. package/lib/services/agents.js.map +1 -1
  18. package/lib/services/api.d.ts +2 -2
  19. package/lib/services/api.d.ts.map +1 -1
  20. package/lib/services/api.js +1 -1
  21. package/lib/services/api.js.map +1 -1
  22. package/lib/services/apps.d.ts +74 -74
  23. package/lib/services/apps.d.ts.map +1 -1
  24. package/lib/services/apps.js +34 -33
  25. package/lib/services/apps.js.map +1 -1
  26. package/lib/services/assistant.d.ts +55 -46
  27. package/lib/services/assistant.d.ts.map +1 -1
  28. package/lib/services/assistant.js +1 -1
  29. package/lib/services/assistant.js.map +1 -1
  30. package/lib/services/auth.d.ts +27 -27
  31. package/lib/services/auth.d.ts.map +1 -1
  32. package/lib/services/auth.js +1 -1
  33. package/lib/services/auth.js.map +1 -1
  34. package/lib/services/blocks.d.ts +3 -3
  35. package/lib/services/blocks.d.ts.map +1 -1
  36. package/lib/services/blocks.js +1 -1
  37. package/lib/services/blocks.js.map +1 -1
  38. package/lib/services/bookmarks.d.ts +19 -19
  39. package/lib/services/bookmarks.d.ts.map +1 -1
  40. package/lib/services/bookmarks.js +1 -1
  41. package/lib/services/bookmarks.js.map +1 -1
  42. package/lib/services/bots.d.ts +23 -23
  43. package/lib/services/bots.d.ts.map +1 -1
  44. package/lib/services/bots.js +1 -1
  45. package/lib/services/bots.js.map +1 -1
  46. package/lib/services/calls.d.ts +10 -10
  47. package/lib/services/calls.d.ts.map +1 -1
  48. package/lib/services/calls.js +1 -1
  49. package/lib/services/calls.js.map +1 -1
  50. package/lib/services/canvases.d.ts +18 -18
  51. package/lib/services/canvases.d.ts.map +1 -1
  52. package/lib/services/canvases.js +1 -1
  53. package/lib/services/canvases.js.map +1 -1
  54. package/lib/services/chat.d.ts +103 -103
  55. package/lib/services/chat.d.ts.map +1 -1
  56. package/lib/services/chat.js +1 -1
  57. package/lib/services/chat.js.map +1 -1
  58. package/lib/services/conversations.d.ts +109 -103
  59. package/lib/services/conversations.d.ts.map +1 -1
  60. package/lib/services/conversations.js +39 -38
  61. package/lib/services/conversations.js.map +1 -1
  62. package/lib/services/dialog.d.ts.map +1 -1
  63. package/lib/services/dialog.js +1 -1
  64. package/lib/services/dialog.js.map +1 -1
  65. package/lib/services/dnd.d.ts +14 -14
  66. package/lib/services/dnd.d.ts.map +1 -1
  67. package/lib/services/dnd.js +1 -1
  68. package/lib/services/dnd.js.map +1 -1
  69. package/lib/services/emoji.d.ts +6 -6
  70. package/lib/services/emoji.d.ts.map +1 -1
  71. package/lib/services/emoji.js +1 -1
  72. package/lib/services/emoji.js.map +1 -1
  73. package/lib/services/entity.d.ts +14 -14
  74. package/lib/services/entity.d.ts.map +1 -1
  75. package/lib/services/entity.js +1 -1
  76. package/lib/services/entity.js.map +1 -1
  77. package/lib/services/files.d.ts +106 -106
  78. package/lib/services/files.d.ts.map +1 -1
  79. package/lib/services/files.js +30 -1
  80. package/lib/services/files.js.map +1 -1
  81. package/lib/services/functions.d.ts +37 -37
  82. package/lib/services/functions.d.ts.map +1 -1
  83. package/lib/services/functions.js +1 -1
  84. package/lib/services/functions.js.map +1 -1
  85. package/lib/services/index.d.ts +1 -0
  86. package/lib/services/index.d.ts.map +1 -1
  87. package/lib/services/index.js +1 -0
  88. package/lib/services/lists.d.ts +47 -45
  89. package/lib/services/lists.d.ts.map +1 -1
  90. package/lib/services/lists.js +1 -1
  91. package/lib/services/lists.js.map +1 -1
  92. package/lib/services/migration.d.ts +3 -3
  93. package/lib/services/migration.d.ts.map +1 -1
  94. package/lib/services/migration.js +1 -1
  95. package/lib/services/migration.js.map +1 -1
  96. package/lib/services/oauth.d.ts +102 -102
  97. package/lib/services/oauth.d.ts.map +1 -1
  98. package/lib/services/oauth.js +1 -1
  99. package/lib/services/oauth.js.map +1 -1
  100. package/lib/services/openid.d.ts +40 -40
  101. package/lib/services/openid.d.ts.map +1 -1
  102. package/lib/services/openid.js +1 -1
  103. package/lib/services/openid.js.map +1 -1
  104. package/lib/services/pins.d.ts +9 -9
  105. package/lib/services/pins.d.ts.map +1 -1
  106. package/lib/services/pins.js +1 -1
  107. package/lib/services/pins.js.map +1 -1
  108. package/lib/services/reactions.d.ts +23 -23
  109. package/lib/services/reactions.d.ts.map +1 -1
  110. package/lib/services/reactions.js +1 -1
  111. package/lib/services/reactions.js.map +1 -1
  112. package/lib/services/reminders.d.ts +8 -8
  113. package/lib/services/reminders.d.ts.map +1 -1
  114. package/lib/services/reminders.js +1 -1
  115. package/lib/services/reminders.js.map +1 -1
  116. package/lib/services/rtm.d.ts +11 -11
  117. package/lib/services/rtm.d.ts.map +1 -1
  118. package/lib/services/rtm.js +1 -1
  119. package/lib/services/rtm.js.map +1 -1
  120. package/lib/services/search.d.ts +84 -80
  121. package/lib/services/search.d.ts.map +1 -1
  122. package/lib/services/search.js +1 -1
  123. package/lib/services/search.js.map +1 -1
  124. package/lib/services/slackbot.d.ts +366 -0
  125. package/lib/services/slackbot.d.ts.map +1 -0
  126. package/lib/services/slackbot.js +2 -0
  127. package/lib/services/slackbot.js.map +1 -0
  128. package/lib/services/stars.d.ts +16 -16
  129. package/lib/services/stars.d.ts.map +1 -1
  130. package/lib/services/stars.js +1 -1
  131. package/lib/services/stars.js.map +1 -1
  132. package/lib/services/team.d.ts +39 -37
  133. package/lib/services/team.d.ts.map +1 -1
  134. package/lib/services/team.js +1 -1
  135. package/lib/services/team.js.map +1 -1
  136. package/lib/services/tooling.d.ts.map +1 -1
  137. package/lib/services/tooling.js +1 -1
  138. package/lib/services/tooling.js.map +1 -1
  139. package/lib/services/usergroups.d.ts +30 -30
  140. package/lib/services/usergroups.d.ts.map +1 -1
  141. package/lib/services/usergroups.js +1 -1
  142. package/lib/services/usergroups.js.map +1 -1
  143. package/lib/services/users.d.ts +37 -37
  144. package/lib/services/users.d.ts.map +1 -1
  145. package/lib/services/users.js +1 -1
  146. package/lib/services/users.js.map +1 -1
  147. package/lib/services/views.d.ts +9 -9
  148. package/lib/services/views.d.ts.map +1 -1
  149. package/lib/services/views.js +1 -1
  150. package/lib/services/views.js.map +1 -1
  151. package/lib/services/workflows.d.ts +16 -16
  152. package/lib/services/workflows.d.ts.map +1 -1
  153. package/lib/services/workflows.js +1 -1
  154. package/lib/services/workflows.js.map +1 -1
  155. package/lib/services.lazy/admin.js +2 -2
  156. package/lib/services.lazy/apps.js +1 -1
  157. package/lib/services.lazy/conversations.js +1 -1
  158. package/lib/services.lazy/files.js +3 -1
  159. package/lib/services.lazy/index.js +2 -2
  160. package/lib/services.lazy/slackbot.js +1 -0
  161. package/package.json +8 -7
  162. package/src/credentials.ts +3 -2
  163. package/src/index.ts +3 -4
  164. package/src/protocol.ts +23 -21
  165. package/src/services/admin.ts +1882 -1034
  166. package/src/services/agents.ts +128 -103
  167. package/src/services/api.ts +17 -2
  168. package/src/services/apps.ts +133 -74
  169. package/src/services/assistant.ts +109 -54
  170. package/src/services/auth.ts +46 -27
  171. package/src/services/blocks.ts +18 -3
  172. package/src/services/bookmarks.ts +40 -19
  173. package/src/services/bots.ts +38 -23
  174. package/src/services/calls.ts +35 -10
  175. package/src/services/canvases.ts +77 -46
  176. package/src/services/chat.ts +142 -103
  177. package/src/services/conversations.ts +195 -115
  178. package/src/services/dialog.ts +15 -0
  179. package/src/services/dnd.ts +37 -14
  180. package/src/services/emoji.ts +21 -6
  181. package/src/services/entity.ts +33 -14
  182. package/src/services/files.ts +149 -106
  183. package/src/services/functions.ts +66 -37
  184. package/src/services/index.ts +1 -0
  185. package/src/services/lists.ts +86 -46
  186. package/src/services/migration.ts +18 -3
  187. package/src/services/oauth.ts +127 -102
  188. package/src/services/openid.ts +57 -40
  189. package/src/services/pins.ts +28 -9
  190. package/src/services/reactions.ts +44 -23
  191. package/src/services/reminders.ts +31 -8
  192. package/src/services/rtm.ts +28 -11
  193. package/src/services/search.ts +142 -130
  194. package/src/services/slackbot.ts +766 -0
  195. package/src/services/stars.ts +35 -16
  196. package/src/services/team.ts +73 -37
  197. package/src/services/tooling.ts +15 -0
  198. package/src/services/usergroups.ts +57 -30
  199. package/src/services/users.ts +76 -37
  200. package/src/services/views.ts +30 -9
  201. package/src/services/workflows.ts +45 -16
@@ -11,14 +11,27 @@ const __s: any[] = [];
11
11
 
12
12
  export type { SlackOpError, SlackOpContext };
13
13
 
14
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
15
+ const TELEMETRY = {
16
+ system: "slack-api",
17
+ responseHeaders: [
18
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
19
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
20
+ { header: "x-slack-req-id", name: "http.response.header.x-slack-req-id", transform: "list" },
21
+ ],
22
+ prefix: "Slack",
23
+ service: "Migration",
24
+ propagate: "w3c",
25
+ } as const;
26
+
14
27
  export type MigrationExchangeRequestUsersList = Array<string>;
15
28
  export interface MigrationExchangeRequest {
16
29
  /** A comma-separated list of user ids, up to 400 per request */
17
30
  users: MigrationExchangeRequestUsersList;
18
31
  /** Specify team_id starts with `T` in case of Org Token */
19
- team_id?: string;
32
+ team_id?: string | undefined;
20
33
  /** Specify `true` to convert `W` global user IDs to workspace-specific `U` IDs. Defaults to `false`. */
21
- to_old?: boolean;
34
+ to_old?: boolean | undefined;
22
35
  }
23
36
  export type MigrationExchangeResponseUserIdMapMap = { [key: string]: unknown | undefined };
24
37
  export type MigrationExchangeResponseInvalidUserIdsList = Array<string>;
@@ -28,7 +41,7 @@ export interface MigrationExchangeResponse {
28
41
  team_id: string;
29
42
  enterprise_id: string;
30
43
  user_id_map: MigrationExchangeResponseUserIdMapMap;
31
- invalid_user_ids?: MigrationExchangeResponseInvalidUserIdsList;
44
+ invalid_user_ids?: MigrationExchangeResponseInvalidUserIdsList | undefined;
32
45
  }
33
46
  export type MigrationExchangeError = SlackOpError;
34
47
  /** For Enterprise organization workspaces, map local user IDs to global user IDs Required scopes -- bot: `tokens.basic`; user: `tokens.basic` Rate limit tier: 2 Method-specific errors (the `error` slug on the SlackError): - `not_enterprise_team` -- The workspace associated with the token is not part of an Enterprise organization. User IDs have not changed and there is nothing to map. - `too_many_users` -- Too many user IDs provided in `users`. Up to 400 user IDs are allowed per request. See https://docs.slack.dev/reference/methods/migration.exchange */
@@ -43,6 +56,8 @@ export const migrationExchange: API.OperationMethod<
43
56
  errors: [SlackError, SlackRateLimited],
44
57
  protocol: SlackProtocol,
45
58
  retry: Retry.Retry,
59
+ telemetry: TELEMETRY,
60
+ span: "MigrationExchange",
46
61
  }));
47
62
 
48
63
  // Schema builders: each runs one schema initializer, on that schema's first use.
@@ -12,6 +12,19 @@ const __s: any[] = [];
12
12
 
13
13
  export type { SlackOpError, SlackOpContext };
14
14
 
15
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
16
+ const TELEMETRY = {
17
+ system: "slack-api",
18
+ responseHeaders: [
19
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
20
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
21
+ { header: "x-slack-req-id", name: "http.response.header.x-slack-req-id", transform: "list" },
22
+ ],
23
+ prefix: "Slack",
24
+ service: "Oauth",
25
+ propagate: "w3c",
26
+ } as const;
27
+
15
28
  export interface BeginShortTokenRotationRequest {
16
29
  /** Issued when you created your application. Must be the app the token being rotated was issued to. */
17
30
  client_id: string;
@@ -40,19 +53,19 @@ export interface CompleteShortTokenRotationResponse {
40
53
  }
41
54
  export interface OauthAccessRequest {
42
55
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
43
- client_id?: string;
56
+ client_id?: string | undefined;
44
57
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
45
- client_secret?: string | Redacted.Redacted<string>;
58
+ client_secret?: string | Redacted.Redacted<string> | undefined;
46
59
  /** The `code` param returned via the OAuth callback. */
47
- code?: string;
60
+ code?: string | undefined;
48
61
  /** This must match the originally submitted URI (if one was sent). */
49
- redirect_uri?: string;
62
+ redirect_uri?: string | undefined;
50
63
  /** Request the user to add your app only to a single channel. Only valid with a [legacy workspace app](https://docs.slack.dev/changelog/2021-03-workspace-apps-to-retire-in-august-2021). */
51
- single_channel?: boolean;
64
+ single_channel?: boolean | undefined;
52
65
  }
53
66
  export interface OauthAccessResponseAuthorizingUser {
54
- user_id?: string;
55
- app_home?: string | null;
67
+ user_id?: string | undefined;
68
+ app_home?: string | null | undefined;
56
69
  }
57
70
  export type OauthAccessResponseInstallerUser = OauthAccessResponseAuthorizingUser;
58
71
  export type OauthAccessResponseScopesAppHomeList = Array<string>;
@@ -62,92 +75,92 @@ export type OauthAccessResponseScopesGroupList = Array<string>;
62
75
  export type OauthAccessResponseScopesMpimList = Array<string>;
63
76
  export type OauthAccessResponseScopesImList = Array<string>;
64
77
  export interface OauthAccessResponseScopes {
65
- app_home?: OauthAccessResponseScopesAppHomeList;
66
- team?: OauthAccessResponseScopesTeamList;
67
- channel?: OauthAccessResponseScopesChannelList;
68
- group?: OauthAccessResponseScopesGroupList;
69
- mpim?: OauthAccessResponseScopesMpimList;
70
- im?: OauthAccessResponseScopesImList;
78
+ app_home?: OauthAccessResponseScopesAppHomeList | undefined;
79
+ team?: OauthAccessResponseScopesTeamList | undefined;
80
+ channel?: OauthAccessResponseScopesChannelList | undefined;
81
+ group?: OauthAccessResponseScopesGroupList | undefined;
82
+ mpim?: OauthAccessResponseScopesMpimList | undefined;
83
+ im?: OauthAccessResponseScopesImList | undefined;
71
84
  }
72
85
  export interface OauthAccessResponseBot {
73
- bot_user_id?: string;
74
- bot_access_token?: string;
75
- scope?: string;
86
+ bot_user_id?: string | undefined;
87
+ bot_access_token?: string | undefined;
88
+ scope?: string | undefined;
76
89
  }
77
90
  export interface OauthAccessResponseUser {
78
- name?: string;
79
- id?: string;
80
- email?: string;
81
- image_24?: string;
82
- image_32?: string;
83
- image_48?: string;
84
- image_72?: string;
85
- image_192?: string;
86
- image_512?: string;
87
- scope?: string;
88
- access_token?: string | Redacted.Redacted<string>;
89
- token_type?: string;
91
+ name?: string | undefined;
92
+ id?: string | undefined;
93
+ email?: string | undefined;
94
+ image_24?: string | undefined;
95
+ image_32?: string | undefined;
96
+ image_48?: string | undefined;
97
+ image_72?: string | undefined;
98
+ image_192?: string | undefined;
99
+ image_512?: string | undefined;
100
+ scope?: string | undefined;
101
+ access_token?: string | Redacted.Redacted<string> | undefined;
102
+ token_type?: string | undefined;
90
103
  }
91
104
  export interface OauthAccessResponseTeam {
92
- id?: string;
93
- name?: string;
94
- domain?: string;
95
- image_34?: string;
96
- image_44?: string;
97
- image_68?: string;
98
- image_88?: string;
99
- image_102?: string;
100
- image_132?: string;
101
- image_230?: string;
102
- image_default?: boolean;
103
- image_original?: string;
105
+ id?: string | undefined;
106
+ name?: string | undefined;
107
+ domain?: string | undefined;
108
+ image_34?: string | undefined;
109
+ image_44?: string | undefined;
110
+ image_68?: string | undefined;
111
+ image_88?: string | undefined;
112
+ image_102?: string | undefined;
113
+ image_132?: string | undefined;
114
+ image_230?: string | undefined;
115
+ image_default?: boolean | undefined;
116
+ image_original?: string | undefined;
104
117
  }
105
118
  export interface OauthAccessResponseIncomingWebhook {
106
- channel?: string;
107
- channel_id?: string;
108
- configuration_url?: string;
109
- url?: string;
119
+ channel?: string | undefined;
120
+ channel_id?: string | undefined;
121
+ configuration_url?: string | undefined;
122
+ url?: string | undefined;
110
123
  }
111
124
  export interface OauthAccessResponse {
112
125
  /** Always `true` (a failed call raises a typed error instead). */
113
126
  ok: boolean;
114
- token_type?: string;
115
- app_id?: string;
116
- app_user_id?: string;
117
- team_name?: string;
127
+ token_type?: string | undefined;
128
+ app_id?: string | undefined;
129
+ app_user_id?: string | undefined;
130
+ team_name?: string | undefined;
118
131
  team_id: string;
119
132
  access_token: string | Redacted.Redacted<string>;
120
- authorizing_user?: OauthAccessResponseAuthorizingUser;
121
- installer_user?: OauthAccessResponseAuthorizingUser;
122
- scopes?: OauthAccessResponseScopes;
123
- scope?: string;
124
- user_id?: string;
125
- bot?: OauthAccessResponseBot;
126
- refresh_token?: string | Redacted.Redacted<string>;
127
- expires_in?: number;
128
- user?: OauthAccessResponseUser;
129
- team?: OauthAccessResponseTeam;
130
- enterprise_id?: string | null;
131
- incoming_webhook?: OauthAccessResponseIncomingWebhook;
132
- single_channel_id?: string;
133
+ authorizing_user?: OauthAccessResponseAuthorizingUser | undefined;
134
+ installer_user?: OauthAccessResponseAuthorizingUser | undefined;
135
+ scopes?: OauthAccessResponseScopes | undefined;
136
+ scope?: string | undefined;
137
+ user_id?: string | undefined;
138
+ bot?: OauthAccessResponseBot | undefined;
139
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
140
+ expires_in?: number | undefined;
141
+ user?: OauthAccessResponseUser | undefined;
142
+ team?: OauthAccessResponseTeam | undefined;
143
+ enterprise_id?: string | null | undefined;
144
+ incoming_webhook?: OauthAccessResponseIncomingWebhook | undefined;
145
+ single_channel_id?: string | undefined;
133
146
  }
134
147
  export interface V2AccessRequest {
135
148
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
136
- client_id?: string;
149
+ client_id?: string | undefined;
137
150
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
138
- client_secret?: string | Redacted.Redacted<string>;
151
+ client_secret?: string | Redacted.Redacted<string> | undefined;
139
152
  /** The `code` param returned via the OAuth callback. */
140
- code?: string;
153
+ code?: string | undefined;
141
154
  /** The code_verifier param used to generate the code_challenge originally. Used for PKCE. */
142
- code_verifier?: string;
155
+ code_verifier?: string | undefined;
143
156
  /** This must match the originally submitted URI (if one was sent). */
144
- redirect_uri?: string;
157
+ redirect_uri?: string | undefined;
145
158
  /** The `grant_type` param as described in the OAuth spec. */
146
- grant_type?: string;
159
+ grant_type?: string | undefined;
147
160
  /** The `refresh_token` param as described in the OAuth spec. */
148
- refresh_token?: string | Redacted.Redacted<string>;
161
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
149
162
  /** Identity assertion JWT authorization grant */
150
- assertion?: string;
163
+ assertion?: string | undefined;
151
164
  }
152
165
  /** The type of access token. Only present if a bot token was requested at the start of the auth flow. */
153
166
  export type V2AccessResponseTokenType = "granular_bot";
@@ -156,14 +169,14 @@ export interface V2AccessResponseTeam {
156
169
  /** ID of the team into which the app is being installed or re-installed. */
157
170
  id: string;
158
171
  /** Name of the team into which the app is being installed or re-installed. */
159
- name?: string;
172
+ name?: string | undefined;
160
173
  }
161
174
  /** Details about the installing team, and the user token if one was requested at the start of the auth flow. */
162
175
  export interface V2AccessResponseEnterprise {
163
176
  /** ID of the enterprise into which the app is being installed or re-installed. */
164
177
  id: string;
165
178
  /** Name of the enterprise into which the app is being installed or re-installed. */
166
- name?: string;
179
+ name?: string | undefined;
167
180
  }
168
181
  /** The type of the access token. Only present if a user token was requested at the start of the auth flow. */
169
182
  export type V2AccessResponseAuthedUserTokenType = "user";
@@ -172,15 +185,15 @@ export interface V2AccessResponseAuthedUser {
172
185
  /** ID of the installing user. If a user token was requested, this is also the ID of the user to which the user token authenticates. */
173
186
  id: string;
174
187
  /** A user token. Only presented if requested at the start of the auth flow. */
175
- access_token?: string | Redacted.Redacted<string>;
188
+ access_token?: string | Redacted.Redacted<string> | undefined;
176
189
  /** The type of the access token. Only present if a user token was requested at the start of the auth flow. */
177
- token_type?: V2AccessResponseAuthedUserTokenType;
190
+ token_type?: V2AccessResponseAuthedUserTokenType | undefined;
178
191
  /** Comma-separated list of scopes granted to the user token. Only present if a user token was requested at the start of the auth flow. */
179
- scope?: string;
192
+ scope?: string | undefined;
180
193
  /** Time until this credential expires, if it expires at all. */
181
- expires_in?: number;
194
+ expires_in?: number | undefined;
182
195
  /** Refresh token for this credential. */
183
- refresh_token?: string | Redacted.Redacted<string>;
196
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
184
197
  }
185
198
  /** Details about a newly-created incoming webhook. Only present if an incoming webhook was requested at the start of the auth flow. */
186
199
  export interface V2AccessResponseIncomingWebhook {
@@ -197,29 +210,29 @@ export interface V2AccessResponse {
197
210
  /** Always `true` (a failed call raises a typed error instead). */
198
211
  ok: boolean;
199
212
  /** A bot access token. Only present if requested at the start of the auth flow. */
200
- access_token?: string | Redacted.Redacted<string>;
213
+ access_token?: string | Redacted.Redacted<string> | undefined;
201
214
  /** The type of access token. Only present if a bot token was requested at the start of the auth flow. */
202
- token_type?: V2AccessResponseTokenType;
215
+ token_type?: V2AccessResponseTokenType | undefined;
203
216
  /** Comma-separated list of scopes granted to the token. Only present if a bot token was requested at the start of the auth flow. */
204
- scope?: string;
217
+ scope?: string | undefined;
205
218
  /** The user ID of the bot user corresponding to the token. Only present if a bot token was requested at the start of the auth flow. */
206
- bot_user_id?: string;
219
+ bot_user_id?: string | undefined;
207
220
  /** The user ID of the bot user corresponding to the token. Only present during a refresh_token grant_type for a user access token. */
208
- user_id?: string;
221
+ user_id?: string | undefined;
209
222
  /** ID of the app being installed or re-installed. */
210
223
  app_id: string;
211
224
  /** Boolean flag indicating whether the generated token is Enterprise-level token or not. */
212
- is_enterprise_install?: boolean;
225
+ is_enterprise_install?: boolean | undefined;
213
226
  /** Time until this credential expires, if it expires at all. */
214
- expires_in?: number;
227
+ expires_in?: number | undefined;
215
228
  /** Refresh token for this credential. */
216
- refresh_token?: string | Redacted.Redacted<string>;
229
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
217
230
  team: V2AccessResponseTeam | null;
218
231
  enterprise: V2AccessResponseEnterprise | null;
219
232
  /** Details about the installing user, and the user token if one was requested at the start of the auth flow. */
220
- authed_user?: V2AccessResponseAuthedUser;
233
+ authed_user?: V2AccessResponseAuthedUser | undefined;
221
234
  /** Details about a newly-created incoming webhook. Only present if an incoming webhook was requested at the start of the auth flow. */
222
- incoming_webhook?: V2AccessResponseIncomingWebhook;
235
+ incoming_webhook?: V2AccessResponseIncomingWebhook | undefined;
223
236
  }
224
237
  export interface V2ExchangeRequest {
225
238
  /** Issued when you created your application. */
@@ -238,35 +251,35 @@ export interface V2ExchangeResponse {
238
251
  /** Comma-separated list of scopes granted to the token. */
239
252
  scope: string;
240
253
  /** The user ID of the bot user corresponding to the token. Only present if a legacy bot access token is being exchanged. */
241
- bot_user_id?: string;
254
+ bot_user_id?: string | undefined;
242
255
  /** The user ID of the user corresponding to the token. Only present if a legacy user access token is being exchanged. */
243
- user_id?: string;
256
+ user_id?: string | undefined;
244
257
  /** A new xoxe.xox(b|p) expiring access token to replace the legacy token. */
245
258
  access_token: string | Redacted.Redacted<string>;
246
259
  /** Duration (in seconds) until the new access token expires. */
247
260
  expires_in: number;
248
261
  /** The xoxe refresh token to obtain a new access token after the one returned expires. */
249
262
  refresh_token: string | Redacted.Redacted<string>;
250
- team?: unknown | null;
251
- enterprise?: unknown | null;
263
+ team?: unknown | null | undefined;
264
+ enterprise?: unknown | null | undefined;
252
265
  }
253
266
  export interface V2UserAccessRequest {
254
267
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
255
- client_id?: string;
268
+ client_id?: string | undefined;
256
269
  /** Issued when you created your application. If possible, avoid sending `client_id` and `client_secret` as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. */
257
- client_secret?: string | Redacted.Redacted<string>;
270
+ client_secret?: string | Redacted.Redacted<string> | undefined;
258
271
  /** The `code` param returned via the OAuth callback. */
259
- code?: string;
272
+ code?: string | undefined;
260
273
  /** The code_verifier param used to generate the code_challenge originally. Used for PKCE. */
261
- code_verifier?: string;
274
+ code_verifier?: string | undefined;
262
275
  /** This must match the originally submitted URI (if one was sent). */
263
- redirect_uri?: string;
276
+ redirect_uri?: string | undefined;
264
277
  /** The `grant_type` param as described in the OAuth spec. */
265
- grant_type?: string;
278
+ grant_type?: string | undefined;
266
279
  /** The `refresh_token` param as described in the OAuth spec. */
267
- refresh_token?: string | Redacted.Redacted<string>;
280
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
268
281
  /** Identity assertion JWT authorization grant. */
269
- assertion?: string;
282
+ assertion?: string | undefined;
270
283
  }
271
284
  /** The type of access token. */
272
285
  export type V2UserAccessResponseTokenType = "user";
@@ -282,7 +295,7 @@ export interface V2UserAccessResponse {
282
295
  /** The type of access token. */
283
296
  token_type: V2UserAccessResponseTokenType;
284
297
  /** Comma-separated list of scopes granted to the token. */
285
- scope?: string;
298
+ scope?: string | undefined;
286
299
  /** The user ID of the user corresponding to the token. */
287
300
  user_id: string;
288
301
  /** ID of the app being installed or re-installed. */
@@ -290,9 +303,9 @@ export interface V2UserAccessResponse {
290
303
  /** Boolean flag indicating whether the generated token is enterprise level token or not */
291
304
  is_enterprise_install: boolean;
292
305
  /** Time until this credential expires, if it expires at all */
293
- expires_in?: number;
306
+ expires_in?: number | undefined;
294
307
  /** Refresh token for this credential */
295
- refresh_token?: string | Redacted.Redacted<string>;
308
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
296
309
  team: V2AccessResponseTeam | null;
297
310
  enterprise: V2AccessResponseEnterprise | null;
298
311
  }
@@ -309,6 +322,8 @@ export const beginShortTokenRotation: API.OperationMethod<
309
322
  errors: [SlackError, SlackRateLimited],
310
323
  protocol: SlackProtocol,
311
324
  retry: Retry.Retry,
325
+ telemetry: TELEMETRY,
326
+ span: "BeginShortTokenRotation",
312
327
  }));
313
328
 
314
329
  export type CompleteShortTokenRotationError = SlackOpError;
@@ -324,6 +339,8 @@ export const completeShortTokenRotation: API.OperationMethod<
324
339
  errors: [SlackError, SlackRateLimited],
325
340
  protocol: SlackProtocol,
326
341
  retry: Retry.Retry,
342
+ telemetry: TELEMETRY,
343
+ span: "CompleteShortTokenRotation",
327
344
  }));
328
345
 
329
346
  export type OauthAccessError = SlackOpError;
@@ -339,6 +356,8 @@ export const oauthAccess: API.OperationMethod<
339
356
  errors: [SlackError, SlackRateLimited],
340
357
  protocol: SlackProtocol,
341
358
  retry: Retry.Retry,
359
+ telemetry: TELEMETRY,
360
+ span: "OauthAccess",
342
361
  }));
343
362
 
344
363
  export type V2AccessError = SlackOpError;
@@ -354,6 +373,8 @@ export const v2Access: API.OperationMethod<
354
373
  errors: [SlackError, SlackRateLimited],
355
374
  protocol: SlackProtocol,
356
375
  retry: Retry.Retry,
376
+ telemetry: TELEMETRY,
377
+ span: "V2Access",
357
378
  }));
358
379
 
359
380
  export type V2ExchangeError = SlackOpError;
@@ -369,10 +390,12 @@ export const v2Exchange: API.OperationMethod<
369
390
  errors: [SlackError, SlackRateLimited],
370
391
  protocol: SlackProtocol,
371
392
  retry: Retry.Retry,
393
+ telemetry: TELEMETRY,
394
+ span: "V2Exchange",
372
395
  }));
373
396
 
374
397
  export type V2UserAccessError = SlackOpError;
375
- /** Exchanges a temporary OAuth verifier code for a user access token. Rate limit tier: 5 Method-specific errors (the `error` slug on the SlackError): - `bad_client_secret` -- Value passed for `client_secret` was invalid. - `bad_redirect_uri` -- Value passed for `redirect_uri` did not match the `redirect_uri` in the original request. - `cannot_install_an_org_installed_app` -- Returned when the the org-installed app cannot be installed on a workspace. - `invalid_client_id` -- Value passed for `client_id` was invalid. - `invalid_code` -- Value passed for `code` was invalid. - `invalid_grant_type` -- Value passed for `grant_type` was invalid. - `invalid_refresh_token` -- The given refresh token is invalid. - `invalid_resource` -- The `resource` in the assertion is malformed, or is not a resource tokens can be issued for. - `no_scopes` -- Missing `scope` in the request. - `no_user_scopes` -- Missing user `scope` in the auth request. - `not_implemented` -- Method not yet supported - `oauth_authorization_url_mismatch` -- The OAuth flow was initiated on an incorrect version of the authorization url. The flow must be initiated via /oauth/v2/authorize . - `preview_feature_not_available` -- Returned when the API method is not yet available on the team in context. - `user_email_unverified` -- The users email is unverified - `app_not_admin_approved` -- The app has not been approved by an org admin, so no tokens can be issued for this user. Ask an org admin to approve the app before requesting a token with the `urn:ietf:params:oauth:grant-type:jwt-bearer` grant. - `app_not_org_installed` -- The app is not installed at the organization level. Using the `urn:ietf:params:oauth:grant-type:jwt-bearer` grant type requires org level app installs. - `client_id_mismatch` -- Value passed for `client_id` did not match the `client_id` in the assertion. - `ema_disabled` -- Enterprise-managed auth is disabled. - `ema_issuer_mismatch` -- The issuer in the assertion did not match the issuer configured for enterprise-managed auth. - `invalid_audience` -- The audience in the assertion is not one this token endpoint supports. - `missing_scope` -- Missing `scope` in the assertion. The identity assertion JWT must carry a space-delimited `scope` claim. - `no_app_scopes_requested` -- None of the scopes requested in the identity assertion are configured on the app. Request only scopes the app already declares. - `no_approved_scopes_requested` -- The app is approved by org admins, but none of the requested scopes are approved ones. Ask an org admin to approve the requested scopes. - `no_assertion` -- Missing `assertion` in the request. - `user_not_authenticated` -- The user has never authenticated via single sign-on. See https://docs.slack.dev/reference/methods/oauth.v2.user.access */
398
+ /** Exchanges a temporary OAuth verifier code for a user access token. Rate limit tier: 5 Method-specific errors (the `error` slug on the SlackError): - `bad_client_secret` -- Value passed for `client_secret` was invalid. - `bad_redirect_uri` -- Value passed for `redirect_uri` did not match the `redirect_uri` in the original request. - `cannot_install_an_org_installed_app` -- Returned when the the org-installed app cannot be installed on a workspace. - `invalid_client_id` -- Value passed for `client_id` was invalid, or the `client_id` in the assertion is not a string. - `invalid_code` -- Value passed for `code` was invalid. - `invalid_grant_type` -- Value passed for `grant_type` was invalid. - `invalid_refresh_token` -- The given refresh token is invalid. - `invalid_resource` -- The `resource` in the assertion is malformed, or is not a resource tokens can be issued for. - `no_scopes` -- Missing `scope` in the request. - `no_user_scopes` -- Missing user `scope` in the auth request. - `not_implemented` -- Method not yet supported - `oauth_authorization_url_mismatch` -- The OAuth flow was initiated on an incorrect version of the authorization url. The flow must be initiated via /oauth/v2/authorize . - `preview_feature_not_available` -- Returned when the API method is not yet available on the team in context. - `user_email_unverified` -- The users email is unverified - `app_not_admin_approved` -- The app has not been approved by an org admin, so no tokens can be issued for this user. Ask an org admin to approve the app before requesting a token with the `urn:ietf:params:oauth:grant-type:jwt-bearer` grant. - `app_not_org_installed` -- The app is not installed at the organization level. Using the `urn:ietf:params:oauth:grant-type:jwt-bearer` grant type requires org level app installs. - `client_id_mismatch` -- Value passed for `client_id` did not match the `client_id` in the assertion. - `ema_disabled` -- Enterprise-managed auth is disabled. - `ema_issuer_mismatch` -- The issuer in the assertion did not match the issuer configured for enterprise-managed auth. - `invalid_audience` -- The audience in the assertion is not one this token endpoint supports. - `missing_scope` -- Missing `scope` in the assertion. The identity assertion JWT must carry a space-delimited `scope` claim. - `no_app_scopes_requested` -- None of the scopes requested in the identity assertion are configured on the app. Request only scopes the app already declares. - `no_approved_scopes_requested` -- The app is approved by org admins, but none of the requested scopes are approved ones. Ask an org admin to approve the requested scopes. - `no_assertion` -- Missing `assertion` in the request. - `user_not_authenticated` -- The user has never authenticated via single sign-on. - `no_idp_config_for_entity_id` -- No Enterprise-Managed Authorization (cross-app access) configuration is bound to the identity provider's SAML EntityID carried in the assertion's `sub_id`. An org admin must configure External Identity / cross-app access for that identity provider before requesting a token with the `urn:ietf:params:oauth:grant-type:jwt-bearer` grant. - `ema_tenant_mismatch` -- The `aud_tenant` in an assertion without a `sub_id` is missing, or is not the ID of the organization or workspace whose identity provider issued it. - `invalid_aud_tenant` -- The `aud_tenant` in the assertion is not a string. It must be the ID of the organization or workspace whose identity provider issued the assertion. - `invalid_email` -- The `email` in the assertion is not a string. - `invalid_issuer` -- The `iss` in the assertion is not a string. It must be the issuer URL of the identity provider that issued the assertion. - `invalid_jti` -- The `jti` in the assertion is not a string. It must be a unique identifier for the assertion. - `invalid_scope` -- The `scope` in the assertion is not a string. It must be a space-delimited list of scopes. - `invalid_sub` -- The `sub` in the assertion is not a string. - `invalid_sub_id_format` -- The `format` of the `sub_id` in the assertion is not a string. The only supported format is `saml-nameid`. - `missing_audience` -- Missing `aud` in the assertion. It must name this token endpoint as an audience. - `missing_client_id` -- Missing `client_id` in the assertion. It must match the `client_id` of the app requesting the token. See https://docs.slack.dev/reference/methods/oauth.v2.user.access */
376
399
  export const v2UserAccess: API.OperationMethod<
377
400
  V2UserAccessRequest,
378
401
  V2UserAccessResponse,
@@ -384,6 +407,8 @@ export const v2UserAccess: API.OperationMethod<
384
407
  errors: [SlackError, SlackRateLimited],
385
408
  protocol: SlackProtocol,
386
409
  retry: Retry.Retry,
410
+ telemetry: TELEMETRY,
411
+ span: "V2UserAccess",
387
412
  }));
388
413
 
389
414
  // Schema builders: each runs one schema initializer, on that schema's first use.
@@ -12,23 +12,36 @@ const __s: any[] = [];
12
12
 
13
13
  export type { SlackOpError, SlackOpContext };
14
14
 
15
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
16
+ const TELEMETRY = {
17
+ system: "slack-api",
18
+ responseHeaders: [
19
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
20
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
21
+ { header: "x-slack-req-id", name: "http.response.header.x-slack-req-id", transform: "list" },
22
+ ],
23
+ prefix: "Slack",
24
+ service: "Openid",
25
+ propagate: "w3c",
26
+ } as const;
27
+
15
28
  /** The `grant_type` param as described in the OAuth spec. */
16
29
  export type ConnectTokenRequestGrantType = "authorization_code" | "refresh_token";
17
30
  export interface ConnectTokenRequest {
18
31
  /** Issued when you created your application. */
19
- client_id?: string;
32
+ client_id?: string | undefined;
20
33
  /** Issued when you created your application. */
21
- client_secret?: string | Redacted.Redacted<string>;
34
+ client_secret?: string | Redacted.Redacted<string> | undefined;
22
35
  /** The `code` param returned via the OAuth callback. */
23
- code?: string;
36
+ code?: string | undefined;
24
37
  /** This must match the originally submitted URI (if one was sent). */
25
- redirect_uri?: string;
38
+ redirect_uri?: string | undefined;
26
39
  /** The `grant_type` param as described in the OAuth spec. */
27
- grant_type?: ConnectTokenRequestGrantType | (string & {});
40
+ grant_type?: ConnectTokenRequestGrantType | (string & {}) | undefined;
28
41
  /** The `refresh_token` param as described in the OAuth spec. */
29
- refresh_token?: string | Redacted.Redacted<string>;
42
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
30
43
  /** PKCE code verifier (RFC 7636). Required when the authorization request included a `code_challenge`. */
31
- code_verifier?: string;
44
+ code_verifier?: string | undefined;
32
45
  }
33
46
  export type ConnectTokenResponseTokenType = "Bearer";
34
47
  export interface ConnectTokenResponse {
@@ -36,12 +49,12 @@ export interface ConnectTokenResponse {
36
49
  ok: boolean;
37
50
  access_token: string | Redacted.Redacted<string>;
38
51
  token_type: ConnectTokenResponseTokenType;
39
- id_token?: string;
40
- state?: string;
52
+ id_token?: string | undefined;
53
+ state?: string | undefined;
41
54
  /** Time until this credential expires, if it expires at all */
42
- expires_in?: number;
55
+ expires_in?: number | undefined;
43
56
  /** Refresh token for this credential */
44
- refresh_token?: string | Redacted.Redacted<string>;
57
+ refresh_token?: string | Redacted.Redacted<string> | undefined;
45
58
  }
46
59
  export interface UserInfoRequest {}
47
60
  export interface UserInfoResponse {
@@ -49,35 +62,35 @@ export interface UserInfoResponse {
49
62
  ok: boolean;
50
63
  sub: string;
51
64
  https___slack_com_user_id: string;
52
- https___slack_com_team_id?: string;
53
- https___slack_com_enterprise_id?: string;
54
- email?: string;
55
- email_verified?: boolean;
56
- date_email_verified?: number;
57
- locale?: string;
58
- name?: string;
59
- given_name?: string;
60
- family_name?: string;
61
- picture?: string;
62
- https___slack_com_user_image_24?: string;
63
- https___slack_com_user_image_32?: string;
64
- https___slack_com_user_image_48?: string;
65
- https___slack_com_user_image_72?: string;
66
- https___slack_com_user_image_192?: string;
67
- https___slack_com_user_image_512?: string;
68
- https___slack_com_user_image_1024?: string;
69
- https___slack_com_team_name?: string;
70
- https___slack_com_team_domain?: string;
71
- https___slack_com_enterprise_name?: string;
72
- https___slack_com_enterprise_domain?: string;
73
- https___slack_com_team_image_34?: string;
74
- https___slack_com_team_image_44?: string;
75
- https___slack_com_team_image_68?: string;
76
- https___slack_com_team_image_88?: string;
77
- https___slack_com_team_image_102?: string;
78
- https___slack_com_team_image_132?: string;
79
- https___slack_com_team_image_230?: string;
80
- https___slack_com_team_image_default?: boolean;
65
+ https___slack_com_team_id?: string | undefined;
66
+ https___slack_com_enterprise_id?: string | undefined;
67
+ email?: string | undefined;
68
+ email_verified?: boolean | undefined;
69
+ date_email_verified?: number | undefined;
70
+ locale?: string | undefined;
71
+ name?: string | undefined;
72
+ given_name?: string | undefined;
73
+ family_name?: string | undefined;
74
+ picture?: string | undefined;
75
+ https___slack_com_user_image_24?: string | undefined;
76
+ https___slack_com_user_image_32?: string | undefined;
77
+ https___slack_com_user_image_48?: string | undefined;
78
+ https___slack_com_user_image_72?: string | undefined;
79
+ https___slack_com_user_image_192?: string | undefined;
80
+ https___slack_com_user_image_512?: string | undefined;
81
+ https___slack_com_user_image_1024?: string | undefined;
82
+ https___slack_com_team_name?: string | undefined;
83
+ https___slack_com_team_domain?: string | undefined;
84
+ https___slack_com_enterprise_name?: string | undefined;
85
+ https___slack_com_enterprise_domain?: string | undefined;
86
+ https___slack_com_team_image_34?: string | undefined;
87
+ https___slack_com_team_image_44?: string | undefined;
88
+ https___slack_com_team_image_68?: string | undefined;
89
+ https___slack_com_team_image_88?: string | undefined;
90
+ https___slack_com_team_image_102?: string | undefined;
91
+ https___slack_com_team_image_132?: string | undefined;
92
+ https___slack_com_team_image_230?: string | undefined;
93
+ https___slack_com_team_image_default?: boolean | undefined;
81
94
  }
82
95
  export type ConnectTokenError = SlackOpError;
83
96
  /** 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 */
@@ -92,6 +105,8 @@ export const connectToken: API.OperationMethod<
92
105
  errors: [SlackError, SlackRateLimited],
93
106
  protocol: SlackProtocol,
94
107
  retry: Retry.Retry,
108
+ telemetry: TELEMETRY,
109
+ span: "ConnectToken",
95
110
  }));
96
111
 
97
112
  export type UserInfoError = SlackOpError;
@@ -107,6 +122,8 @@ export const userInfo: API.OperationMethod<
107
122
  errors: [SlackError, SlackRateLimited],
108
123
  protocol: SlackProtocol,
109
124
  retry: Retry.Retry,
125
+ telemetry: TELEMETRY,
126
+ span: "UserInfo",
110
127
  }));
111
128
 
112
129
  // Schema builders: each runs one schema initializer, on that schema's first use.