From ec34ce64f38915a27090e18a2edc662f9a5c76cf Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 4 Oct 2023 12:52:13 -0400 Subject: [PATCH 001/122] Remove WebAPICallOptions, replace where it is used with `Record`. Remove unneeded disabling of no-trailing-space rule. Replace use of `headers: any` in private `serializeApiCallOptions` method with `Record`. --- packages/web-api/src/WebClient.ts | 74 ++-- packages/web-api/src/index.ts | 1 - packages/web-api/src/methods.ts | 553 +++++++++++++++--------------- 3 files changed, 311 insertions(+), 317 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index d768521d7..69588854a 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -64,10 +64,6 @@ export enum WebClientEvent { RATE_LIMITED = 'rate_limited', } -export interface WebAPICallOptions { - [argument: string]: unknown; -} - export interface WebAPICallResult { ok: boolean; error?: string; @@ -224,7 +220,7 @@ export class WebClient extends Methods { * @param method - the Web API method to call {@link https://api.slack.com/methods} * @param options - options */ - public async apiCall(method: string, options: WebAPICallOptions = {}): Promise { + public async apiCall(method: string, options: Record = {}): Promise { this.logger.debug(`apiCall('${method}') start`); warnDeprecations(method, this.logger); @@ -304,21 +300,21 @@ export class WebClient extends Methods { * @param shouldStop - a predicate that is called with each page, and should return true when pagination can end. * @param reduce - a callback that can be used to accumulate a value that the return promise is resolved to */ - public paginate(method: string, options?: WebAPICallOptions): AsyncIterable; + public paginate(method: string, options?: Record): AsyncIterable; public paginate( method: string, - options: WebAPICallOptions, + options: Record, shouldStop: PaginatePredicate, ): Promise; public paginate>( method: string, - options: WebAPICallOptions, + options: Record, shouldStop: PaginatePredicate, reduce?: PageReducer, ): Promise; public paginate>( method: string, - options?: WebAPICallOptions, + options?: Record, shouldStop?: PaginatePredicate, reduce?: PageReducer, ): (Promise | AsyncIterable) { @@ -394,19 +390,17 @@ export class WebClient extends Methods { })(); } - /* eslint-disable no-trailing-spaces */ /** * This wrapper method provides an easy way to upload files using the following endpoints: - * + * * **#1**: For each file submitted with this method, submit filenames * and file metadata to {@link https://api.slack.com/methods/files.getUploadURLExternal files.getUploadURLExternal} to request a URL to * which to send the file data to and an id for the file - * + * * **#2**: for each returned file `upload_url`, upload corresponding file to * URLs returned from step 1 (e.g. https://files.slack.com/upload/v1/...\") - * + * * **#3**: Complete uploads {@link https://api.slack.com/methods/files.completeUploadExternal files.completeUploadExternal} - * * @param options */ public async filesUploadV2(options: FilesUploadV2Arguments): Promise { @@ -425,7 +419,7 @@ export class WebClient extends Methods { // 3 const completion = await this.completeFileUploads(fileUploads); - + return { ok: true, files: completion }; } @@ -456,7 +450,7 @@ export class WebClient extends Methods { * @returns */ private async completeFileUploads(fileUploads: FileUploadV2Job[]): - Promise> { + Promise> { const toComplete: FilesCompleteUploadExternalArguments[] = Object.values(getAllFileUploadsToComplete(fileUploads)); return Promise.all( toComplete.map((job: FilesCompleteUploadExternalArguments) => this.files.completeUploadExternal(job)), @@ -485,10 +479,10 @@ export class WebClient extends Methods { }, headers); if (uploadRes.status !== 200) { return Promise.reject(Error(`Failed to upload file (id:${file_id}, filename: ${filename})`)); - } + } const returnData = { ok: true, body: uploadRes.data } as WebAPICallResult; return Promise.resolve(returnData); - } + } return Promise.reject(Error(`No upload url found for file (id: ${file_id}, filename: ${filename}`)); })); } @@ -504,7 +498,7 @@ export class WebClient extends Methods { if (options.file || options.content) { fileUploads.push(await getFileUploadJob(options, this.logger)); } - + // add multiple files data when file_uploads is supplied if (options.file_uploads) { fileUploads = fileUploads.concat(await getMultipleFileUploadJobs(options, this.logger)); @@ -594,8 +588,8 @@ export class WebClient extends Methods { * @param options - arguments for the Web API method * @param headers - a mutable object representing the HTTP headers for the outgoing request */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private serializeApiCallOptions(options: WebAPICallOptions, headers?: any): string | Readable { + private serializeApiCallOptions(options: Record, headers?: Record): string | + Readable { // The following operation both flattens complex objects into a JSON-encoded strings and searches the values for // binary content let containsBinaryData: boolean = false; @@ -648,18 +642,20 @@ export class WebClient extends Methods { }, new FormData(), ); - // Copying FormData-generated headers into headers param - // not reassigning to headers param since it is passed by reference and behaves as an inout param - Object.entries(form.getHeaders()).forEach(([header, value]) => { - // eslint-disable-next-line no-param-reassign - headers[header] = value; - }); + if (headers) { + // Copying FormData-generated headers into headers param + // not reassigning to headers param since it is passed by reference and behaves as an inout param + Object.entries(form.getHeaders()).forEach(([header, value]) => { + // eslint-disable-next-line no-param-reassign + headers[header] = value; + }); + } return form; } // Otherwise, a simple key-value object is returned // eslint-disable-next-line no-param-reassign - headers['Content-Type'] = 'application/x-www-form-urlencoded'; + if (headers) headers['Content-Type'] = 'application/x-www-form-urlencoded'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const initialValue: { [key: string]: any; } = {}; return qsStringify(flattened.reduce( @@ -823,16 +819,16 @@ function warnDeprecations(method: string, logger: Logger): void { * @param logger instance of we clients logger * @param options arguments for the Web API method */ -function warnIfFallbackIsMissing(method: string, logger: Logger, options?: WebAPICallOptions): void { +function warnIfFallbackIsMissing(method: string, logger: Logger, options?: Record): void { const targetMethods = ['chat.postEphemeral', 'chat.postMessage', 'chat.scheduleMessage']; const isTargetMethod = targetMethods.includes(method); - const hasAttachments = (args: WebAPICallOptions) => Array.isArray(args.attachments) && args.attachments.length; + const hasAttachments = (args: Record) => Array.isArray(args.attachments) && args.attachments.length; - const missingAttachmentFallbackDetected = (args: WebAPICallOptions) => Array.isArray(args.attachments) && + const missingAttachmentFallbackDetected = (args: Record) => Array.isArray(args.attachments) && args.attachments.some((attachment) => !attachment.fallback || attachment.fallback.trim() === ''); - const isEmptyText = (args: WebAPICallOptions) => args.text === undefined || args.text === null || args.text === ''; + const isEmptyText = (args: Record) => args.text === undefined || args.text === null || args.text === ''; const buildMissingTextWarning = () => `The top-level \`text\` argument is missing in the request payload for a ${method} call - ` + 'It\'s a best practice to always provide a `text` argument when posting a message. ' + @@ -860,23 +856,23 @@ function warnIfFallbackIsMissing(method: string, logger: Logger, options?: WebAP * @param logger instance of web clients logger * @param options arguments for the Web API method */ -function warnIfThreadTsIsNotString(method: string, logger: Logger, options?: WebAPICallOptions): void { +function warnIfThreadTsIsNotString(method: string, logger: Logger, options?: Record): void { const targetMethods = ['chat.postEphemeral', 'chat.postMessage', 'chat.scheduleMessage', 'files.upload']; const isTargetMethod = targetMethods.includes(method); - + if (isTargetMethod && options?.thread_ts !== undefined && typeof options?.thread_ts !== 'string') { logger.warn(buildThreadTsWarningMessage(method)); } } -export function buildThreadTsWarningMessage(method: string): string { +export function buildThreadTsWarningMessage(method: string): string { return `The given thread_ts value in the request payload for a ${method} call is a float value. We highly recommend using a string value instead.`; } /** * Takes an object and redacts specific items - * @param body - * @returns + * @param body + * @returns */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function redact(body: any): any { @@ -886,7 +882,7 @@ function redact(body: any): any { if (value === undefined || value === null) { return []; } - + let serializedValue = value; // redact possible tokens @@ -903,7 +899,7 @@ function redact(body: any): any { return [key, serializedValue]; }); - // return as object + // return as object // eslint-disable-next-line @typescript-eslint/no-explicit-any const initialValue: { [key: string]: any; } = {}; return flattened.reduce( diff --git a/packages/web-api/src/index.ts b/packages/web-api/src/index.ts index 2565c4952..202c930e2 100644 --- a/packages/web-api/src/index.ts +++ b/packages/web-api/src/index.ts @@ -3,7 +3,6 @@ export { WebClient, WebClientOptions, - WebAPICallOptions, WebAPICallResult, PageAccumulator, PageReducer, diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2db23c5b8..4e5f5e100 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,7 +1,7 @@ import { Stream } from 'stream'; import { Dialog, View, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; -import { WebAPICallOptions, WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; +import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; import { AdminAnalyticsGetFileResponse, AdminAppsApproveResponse, @@ -236,7 +236,7 @@ import { /** * Binds a certain `method` and its arguments and result types to the `apiCall` method in `WebClient`. */ -function bindApiCall( +function bindApiCall( self: Methods, method: string, ): Method { @@ -245,7 +245,7 @@ function bindApiCall; } -function bindFilesUploadV2( +function bindFilesUploadV2( self: Methods, ): Method { return self.filesUploadV2.bind(self) as unknown as Method; @@ -272,8 +272,8 @@ export abstract class Methods extends EventEmitter { } } - public abstract apiCall(method: string, options?: WebAPICallOptions): Promise; - public abstract filesUploadV2(options?: WebAPICallOptions): Promise; + public abstract apiCall(method: string, options?: Record): Promise; + public abstract filesUploadV2(options: Record): Promise; public readonly admin = { analytics: { @@ -927,7 +927,7 @@ export abstract class Methods extends EventEmitter { * Generic method definition */ export default interface Method< - MethodArguments extends WebAPICallOptions, + MethodArguments, MethodResult extends WebAPICallResult = WebAPICallResult, > { (options?: MethodArguments): Promise; @@ -979,52 +979,52 @@ export interface TraditionalPagingEnabled { /* * `admin.*` */ -export interface AdminAnalyticsGetFileArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAnalyticsGetFileArguments extends TokenOverridable { type: string; date?: string; metadata_only?: boolean; } -export interface AdminAppsApproveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAppsApproveArguments extends TokenOverridable { app_id?: string; request_id?: string; team_id?: string; } -export interface AdminAppsApprovedListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminAppsApprovedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id?: string; enterprise_id?: string; } -export interface AdminAppsClearResolutionArguments extends WebAPICallOptions { +export interface AdminAppsClearResolutionArguments { app_id: string; enterprise_id?: string; team_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.approved.list'); -export interface AdminAppsRequestsCancelArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAppsRequestsCancelArguments extends TokenOverridable { request_id: string; enterprise_id?: string; team_id?: string; } -export interface AdminAppsRequestsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminAppsRequestsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.requests.list'); -export interface AdminAppsRestrictArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAppsRestrictArguments extends TokenOverridable { app_id?: string; request_id?: string; team_id?: string; } -export interface AdminAppsRestrictedListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminAppsRestrictedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id?: string; enterprise_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.restricted.list'); -export interface AdminAppsUninstallArguments extends WebAPICallOptions { +export interface AdminAppsUninstallArguments { app_id: string; enterprise_id?: string; team_ids?: string[]; } -export interface AdminAppsActivitiesListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminAppsActivitiesListArguments extends TokenOverridable, CursorPaginationEnabled { app_id?: string; component_id?: string; component_type?: string; @@ -1038,10 +1038,10 @@ export interface AdminAppsActivitiesListArguments extends WebAPICallOptions, Tok trace_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.activities.list'); -export interface AdminAppsConfigLookupArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAppsConfigLookupArguments extends TokenOverridable { app_ids: string[]; } -export interface AdminAppsConfigSetArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAppsConfigSetArguments extends TokenOverridable { app_id: string; domain_restrictions?: { urls?: string[]; @@ -1049,130 +1049,130 @@ export interface AdminAppsConfigSetArguments extends WebAPICallOptions, TokenOve }; workflow_auth_strategy?: 'builder_choice' | 'end_user_strategy'; } -export interface AdminAuthPolicyAssignEntitiesArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAuthPolicyAssignEntitiesArguments extends TokenOverridable { entity_ids: string[]; entity_type: string; policy_name: string; } -export interface AdminAuthPolicyGetEntitiesArguments extends WebAPICallOptions, TokenOverridable, +export interface AdminAuthPolicyGetEntitiesArguments extends TokenOverridable, CursorPaginationEnabled { policy_name: string; entity_type?: string; } cursorPaginationEnabledMethods.add('admin.auth.policy.getEntities'); -export interface AdminAuthPolicyRemoveEntitiesArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminAuthPolicyRemoveEntitiesArguments extends TokenOverridable { entity_ids: string[]; entity_type: string; policy_name: string; } -export interface AdminBarriersCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminBarriersCreateArguments extends TokenOverridable { barriered_from_usergroup_ids: string[]; primary_usergroup_id: string; restricted_subjects: string[]; } -export interface AdminBarriersDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminBarriersDeleteArguments extends TokenOverridable { barrier_id: string; } -export interface AdminBarriersListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { } +export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.barriers.list'); -export interface AdminBarriersUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminBarriersUpdateArguments extends TokenOverridable { barrier_id: string; barriered_from_usergroup_ids: string[]; primary_usergroup_id: string; restricted_subjects: string[]; } -export interface AdminConversationsArchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsArchiveArguments extends TokenOverridable { channel_id: string; } -export interface AdminConversationsBulkArchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsBulkArchiveArguments extends TokenOverridable { channel_ids: string[]; } -export interface AdminConversationsBulkDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsBulkDeleteArguments extends TokenOverridable { channel_ids: string[]; } -export interface AdminConversationsBulkMoveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsBulkMoveArguments extends TokenOverridable { channel_ids: string[]; target_team_id: string; } -export interface AdminConversationsConvertToPrivateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsConvertToPrivateArguments extends TokenOverridable { channel_id: string; } -export interface AdminConversationsConvertToPublicArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsConvertToPublicArguments extends TokenOverridable { channel_id: string; } -export interface AdminConversationsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsCreateArguments extends TokenOverridable { is_private: boolean; name: string; description?: string; org_wide?: boolean; team_id?: string; } -export interface AdminConversationsDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsDeleteArguments extends TokenOverridable { channel_id: string; } -export interface AdminConversationsDisconnectSharedArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsDisconnectSharedArguments extends TokenOverridable { channel_id: string; leaving_team_ids?: string[]; } export interface AdminConversationsLookupArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { last_message_activity_before: number; team_ids: string[]; max_member_count?: number; } cursorPaginationEnabledMethods.add('admin.conversations.lookup'); export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { channel_ids?: string[]; team_ids?: string[]; } cursorPaginationEnabledMethods.add('admin.conversations.ekm.listOriginalConnectedChannelInfo'); -export interface AdminConversationsGetConversationPrefsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { channel_id: string; } export interface AdminConversationsGetTeamsArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { channel_id: string; } cursorPaginationEnabledMethods.add('admin.conversations.getTeams'); -export interface AdminConversationsInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsInviteArguments extends TokenOverridable { channel_id: string; user_ids: string[]; } -export interface AdminConversationsRenameArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsRenameArguments extends TokenOverridable { channel_id: string; name: string; } -export interface AdminConversationsRestrictAccessAddGroupArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsRestrictAccessAddGroupArguments extends TokenOverridable { channel_id: string; group_id: string; team_id?: string; } -export interface AdminConversationsRestrictAccessListGroupsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsRestrictAccessListGroupsArguments extends TokenOverridable { channel_id: string; team_id?: string; } -export interface AdminConversationsRestrictAccessRemoveGroupArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsRestrictAccessRemoveGroupArguments extends TokenOverridable { channel_id: string; group_id: string; team_id: string; } -export interface AdminConversationsGetCustomRetentionArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsGetCustomRetentionArguments extends TokenOverridable { channel_id: string; } -export interface AdminConversationsSetCustomRetentionArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsSetCustomRetentionArguments extends TokenOverridable { channel_id: string; duration_days: number; } -export interface AdminConversationsRemoveCustomRetentionArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsRemoveCustomRetentionArguments extends TokenOverridable { channel_id: string; } export interface AdminConversationsSearchArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { query?: string; search_channel_types?: string[]; sort?: 'relevant' | 'name' | 'member_count' | 'created'; @@ -1180,159 +1180,159 @@ export interface AdminConversationsSearchArguments team_ids?: string[]; } cursorPaginationEnabledMethods.add('admin.conversations.search'); -export interface AdminConversationsSetConversationPrefsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { channel_id: string; prefs: Record; } -export interface AdminConversationsSetTeamsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsSetTeamsArguments extends TokenOverridable { channel_id: string; team_id?: string; target_team_ids?: string[]; org_channel?: boolean; } -export interface AdminConversationsUnarchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminConversationsUnarchiveArguments extends TokenOverridable { channel_id: string; } -export interface AdminEmojiAddArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminEmojiAddArguments extends TokenOverridable { name: string; url: string; } -export interface AdminEmojiAddAliasArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminEmojiAddAliasArguments extends TokenOverridable { name: string; alias_for: string; } -export interface AdminEmojiListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { } +export interface AdminEmojiListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.emoji.list'); -export interface AdminEmojiRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminEmojiRemoveArguments extends TokenOverridable { name: string; } -export interface AdminEmojiRenameArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminEmojiRenameArguments extends TokenOverridable { name: string; new_name: string; } -export interface AdminFunctionsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminFunctionsListArguments extends TokenOverridable, CursorPaginationEnabled { app_ids: string[]; team_id?: string; } export interface AdminFunctionsPermissionsLookupArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { function_ids: string[]; } -export interface AdminFunctionsPermissionsSetArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminFunctionsPermissionsSetArguments extends TokenOverridable { function_id: string; visibility: string; user_ids?: string[]; } export interface AdminInviteRequestsApproveArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { invite_request_id: string; team_id: string; } export interface AdminInviteRequestsApprovedListArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.approved.list'); export interface AdminInviteRequestsDenyArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { invite_request_id: string; team_id: string; } export interface AdminInviteRequestsDeniedListArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.denied.list'); export interface AdminInviteRequestsListArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); export interface AdminRolesAddAssignmentsArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { role_id: string; entity_ids: string[]; user_ids: string[]; } export interface AdminRolesListAssignmentsArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { entity_ids?: string[]; role_ids?: string[]; sort_dir?: string; } cursorPaginationEnabledMethods.add('admin.roles.listAssignments'); export interface AdminRolesRemoveAssignmentsArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { role_id: string; entity_ids: string[]; user_ids: string[]; } cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); -export interface AdminTeamsAdminsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminTeamsAdminsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.teams.admins.list'); -export interface AdminTeamsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsCreateArguments extends TokenOverridable { team_domain: string; team_name: string; team_description?: string; team_discoverability?: string; } -export interface AdminTeamsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { } +export interface AdminTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.teams.list'); -export interface AdminTeamsOwnersListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminTeamsOwnersListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.teams.owners.list'); -export interface AdminTeamsSettingsInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsInfoArguments extends TokenOverridable { team_id: string; } -export interface AdminTeamsSettingsSetDefaultChannelsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsSetDefaultChannelsArguments extends TokenOverridable { team_id: string; channel_ids: string[]; } -export interface AdminTeamsSettingsSetDescriptionArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsSetDescriptionArguments extends TokenOverridable { team_id: string; description: string; } -export interface AdminTeamsSettingsSetDiscoverabilityArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsSetDiscoverabilityArguments extends TokenOverridable { team_id: string; discoverability: 'open' | 'invite_only' | 'closed' | 'unlisted'; } -export interface AdminTeamsSettingsSetIconArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsSetIconArguments extends TokenOverridable { team_id: string; image_url: string; } -export interface AdminTeamsSettingsSetNameArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminTeamsSettingsSetNameArguments extends TokenOverridable { team_id: string; name: string; } -export interface AdminUsergroupsAddChannelsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsergroupsAddChannelsArguments extends TokenOverridable { usergroup_id: string; team_id?: string; channel_ids: string | string[]; } -export interface AdminUsergroupsAddTeamsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsergroupsAddTeamsArguments extends TokenOverridable { usergroup_id: string; team_ids: string | string[]; auto_provision?: boolean; } -export interface AdminUsergroupsListChannelsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsergroupsListChannelsArguments extends TokenOverridable { usergroup_id: string; include_num_members?: boolean; team_id?: string; } -export interface AdminUsergroupsRemoveChannelsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsergroupsRemoveChannelsArguments extends TokenOverridable { usergroup_id: string; channel_ids: string | string[]; } -export interface AdminUsersAssignArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersAssignArguments extends TokenOverridable { team_id: string; user_id: string; is_restricted?: boolean; is_ultra_restricted?: boolean; } -export interface AdminUsersInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersInviteArguments extends TokenOverridable { channel_ids: string; email: string; team_id: string; @@ -1344,83 +1344,83 @@ export interface AdminUsersInviteArguments extends WebAPICallOptions, TokenOverr real_name?: string; resend?: boolean; } -export interface AdminUsersListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminUsersListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.users.list'); -export interface AdminUsersRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersRemoveArguments extends TokenOverridable { team_id: string; user_id: string; } -export interface AdminUsersSetAdminArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSetAdminArguments extends TokenOverridable { team_id: string; user_id: string; } -export interface AdminUsersSetExpirationArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSetExpirationArguments extends TokenOverridable { team_id: string; user_id: string; expiration_ts: number; } -export interface AdminUsersSetOwnerArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSetOwnerArguments extends TokenOverridable { team_id: string; user_id: string; } -export interface AdminUsersSetRegularArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSetRegularArguments extends TokenOverridable { team_id: string; user_id: string; } cursorPaginationEnabledMethods.add('admin.users.session.list'); -export interface AdminUsersSessionListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminUsersSessionListArguments extends TokenOverridable, CursorPaginationEnabled { user_id?: string; team_id?: string; } -export interface AdminUsersSessionResetArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionResetArguments extends TokenOverridable { user_id: string; mobile_only?: boolean; web_only?: boolean; } -export interface AdminUsersSessionResetBulkArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionResetBulkArguments extends TokenOverridable { user_ids: string[]; mobile_only?: boolean; web_only?: boolean; } -export interface AdminUsersSessionInvalidateArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionInvalidateArguments extends TokenOverridable { session_id: string; team_id: string; } -export interface AdminUsersSessionGetSettingsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionGetSettingsArguments extends TokenOverridable { user_ids: string[]; } -export interface AdminUsersSessionSetSettingsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionSetSettingsArguments extends TokenOverridable { user_ids: string[]; desktop_app_browser_quit?: boolean; duration?: number; } -export interface AdminUsersSessionClearSettingsArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersSessionClearSettingsArguments extends TokenOverridable { user_ids: string[]; } -export interface AdminUsersUnsupportedVersionsExportArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminUsersUnsupportedVersionsExportArguments extends TokenOverridable { date_end_of_support?: number; date_sessions_started?: number; } export interface AdminWorkflowsCollaboratorsAddArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { collaborator_ids: string[]; workflow_ids: string[]; } export interface AdminWorkflowsCollaboratorsRemoveArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { collaborator_ids: string[]; workflow_ids: string[]; } export interface AdminWorkflowsPermissionsLookupArguments - extends WebAPICallOptions, TokenOverridable { + extends TokenOverridable { workflow_ids: string[]; max_workflow_triggers?: number; } -export interface AdminWorkflowsSearchArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorPaginationEnabled { app_id?: string; collaborator_ids?: string[]; no_collaborators?: boolean; @@ -1431,30 +1431,30 @@ export interface AdminWorkflowsSearchArguments extends WebAPICallOptions, TokenO source?: string; } cursorPaginationEnabledMethods.add('admin.worfklows.search'); -export interface AdminWorkflowsUnpublishArguments extends WebAPICallOptions, TokenOverridable { +export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { workflow_ids: string[]; } /* * `api.*` */ // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface APITestArguments extends WebAPICallOptions { } +export interface APITestArguments { } /* * `apps.*` */ // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AppsConnectionsOpenArguments extends WebAPICallOptions { +export interface AppsConnectionsOpenArguments { // currently the method page lists Client id and client secret as optional arguments // circle back here to see if they stay as optional or are removed } export interface AppsEventAuthorizationsListArguments - extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { + extends TokenOverridable, CursorPaginationEnabled { event_context: string; } cursorPaginationEnabledMethods.add('apps.event.authorizations.list'); -export interface AppsUninstallArguments extends WebAPICallOptions { +export interface AppsUninstallArguments { client_id: string; client_secret: string; } @@ -1462,19 +1462,19 @@ export interface AppsUninstallArguments extends WebAPICallOptions { /* * `auth.*` */ -export interface AuthRevokeArguments extends WebAPICallOptions, TokenOverridable { +export interface AuthRevokeArguments extends TokenOverridable { test?: boolean; } -export interface AuthTeamsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { include_icon?: boolean; } cursorPaginationEnabledMethods.add('auth.teams.list'); -export interface AuthTestArguments extends WebAPICallOptions, TokenOverridable { } +export interface AuthTestArguments extends TokenOverridable { } /* * `bots.*` */ -export interface BotsInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface BotsInfoArguments extends TokenOverridable { bot?: string; team_id?: string; } @@ -1482,7 +1482,7 @@ export interface BotsInfoArguments extends WebAPICallOptions, TokenOverridable { /* * `bookmarks.*` */ -export interface BookmarksAddArguments extends WebAPICallOptions, TokenOverridable { +export interface BookmarksAddArguments extends TokenOverridable { channel_id: string; title: string; type: string; @@ -1492,7 +1492,7 @@ export interface BookmarksAddArguments extends WebAPICallOptions, TokenOverridab parent_id?: string; } -export interface BookmarksEditArguments extends WebAPICallOptions, TokenOverridable { +export interface BookmarksEditArguments extends TokenOverridable { bookmark_id: string; channel_id: string; emoji?: string; @@ -1500,11 +1500,11 @@ export interface BookmarksEditArguments extends WebAPICallOptions, TokenOverrida title?: string; } -export interface BookmarksListArguments extends WebAPICallOptions, TokenOverridable { +export interface BookmarksListArguments extends TokenOverridable { channel_id: string; } -export interface BookmarksRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface BookmarksRemoveArguments extends TokenOverridable { bookmark_id: string; channel_id: string; } @@ -1512,7 +1512,7 @@ export interface BookmarksRemoveArguments extends WebAPICallOptions, TokenOverri /* * `calls.*` */ -export interface CallsAddArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsAddArguments extends TokenOverridable { external_unique_id: string; join_url: string; created_by?: string; @@ -1523,28 +1523,28 @@ export interface CallsAddArguments extends WebAPICallOptions, TokenOverridable { users?: CallUser[]; } -export interface CallsEndArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsEndArguments extends TokenOverridable { id: string; duration?: number; } -export interface CallsInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsInfoArguments extends TokenOverridable { id: string; } -export interface CallsUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsUpdateArguments extends TokenOverridable { id: string; join_url?: string; desktop_app_join_url?: string; title?: string; } -export interface CallsParticipantsAddArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsParticipantsAddArguments extends TokenOverridable { id: string; users: CallUser[]; } -export interface CallsParticipantsRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface CallsParticipantsRemoveArguments extends TokenOverridable { id: string; users: CallUser[]; } @@ -1552,91 +1552,91 @@ export interface CallsParticipantsRemoveArguments extends WebAPICallOptions, Tok /* * `channels.*` */ -export interface ChannelsArchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsArchiveArguments extends TokenOverridable { channel: string; } -export interface ChannelsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsCreateArguments extends TokenOverridable { name: string; validate?: boolean; team_id?: string; } -export interface ChannelsHistoryArguments extends WebAPICallOptions, TokenOverridable, TimelinePaginationEnabled { +export interface ChannelsHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { channel: string; count?: number; unreads?: boolean; } -export interface ChannelsInfoArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface ChannelsInfoArguments extends TokenOverridable, LocaleAware { channel: string; } -export interface ChannelsInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsInviteArguments extends TokenOverridable { channel: string; user: string; } -export interface ChannelsJoinArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsJoinArguments extends TokenOverridable { name: string; validate?: boolean; } -export interface ChannelsKickArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsKickArguments extends TokenOverridable { channel: string; user: string; } -export interface ChannelsLeaveArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsLeaveArguments extends TokenOverridable { channel: string; } -export interface ChannelsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface ChannelsListArguments extends TokenOverridable, CursorPaginationEnabled { exclude_archived?: boolean; exclude_members?: boolean; team_id?: string; } cursorPaginationEnabledMethods.add('channels.list'); -export interface ChannelsMarkArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsMarkArguments extends TokenOverridable { channel: string; ts: string; } -export interface ChannelsRenameArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsRenameArguments extends TokenOverridable { channel: string; name: string; validate?: boolean; } -export interface ChannelsRepliesArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsRepliesArguments extends TokenOverridable { channel: string; thread_ts: string; } -export interface ChannelsSetPurposeArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsSetPurposeArguments extends TokenOverridable { channel: string; purpose: string; } -export interface ChannelsSetTopicArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsSetTopicArguments extends TokenOverridable { channel: string; topic: string; } -export interface ChannelsUnarchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface ChannelsUnarchiveArguments extends TokenOverridable { channel: string; } /* * `chat.*` */ -export interface ChatDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatDeleteArguments extends TokenOverridable { channel: string; ts: string; as_user?: boolean; } -export interface ChatDeleteScheduledMessageArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatDeleteScheduledMessageArguments extends TokenOverridable { channel: string; scheduled_message_id: string; as_user?: boolean; } -export interface ChatGetPermalinkArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatGetPermalinkArguments extends TokenOverridable { channel: string; message_ts: string; } -export interface ChatMeMessageArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatMeMessageArguments extends TokenOverridable { channel: string; text: string; } -export interface ChatPostEphemeralArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatPostEphemeralArguments extends TokenOverridable { channel: string; text?: string; user: string; @@ -1650,7 +1650,7 @@ export interface ChatPostEphemeralArguments extends WebAPICallOptions, TokenOver icon_url?: string; // if specified, as_user must be false username?: string; // if specified, as_user must be false } -export interface ChatPostMessageArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatPostMessageArguments extends TokenOverridable { channel: string; text?: string; as_user?: boolean; @@ -1668,7 +1668,7 @@ export interface ChatPostMessageArguments extends WebAPICallOptions, TokenOverri unfurl_media?: boolean; username?: string; // if specified, as_user must be false } -export interface ChatScheduleMessageArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatScheduleMessageArguments extends TokenOverridable { channel: string; text?: string; post_at: string | number; @@ -1684,7 +1684,7 @@ export interface ChatScheduleMessageArguments extends WebAPICallOptions, TokenOv unfurl_media?: boolean; team_id?: string; } -export interface ChatScheduledMessagesListArguments extends WebAPICallOptions, TokenOverridable, +export interface ChatScheduledMessagesListArguments extends TokenOverridable, CursorPaginationEnabled { channel: string; latest: number; @@ -1717,8 +1717,7 @@ interface SourceAndUnfurlIDArguments { */ unfurl_id: string; } -export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArguments) & WebAPICallOptions -& TokenOverridable +export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArguments) & TokenOverridable & { /** * @description URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl @@ -1746,7 +1745,7 @@ export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArgu */ user_auth_blocks?: (KnownBlock | Block)[]; }; -export interface ChatUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface ChatUpdateArguments extends TokenOverridable { channel: string; ts: string; as_user?: boolean; @@ -1763,7 +1762,7 @@ export interface ChatUpdateArguments extends WebAPICallOptions, TokenOverridable /* * `conversations.*` */ -export interface ConversationsAcceptSharedInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsAcceptSharedInviteArguments extends TokenOverridable { channel_name: string; channel_id?: string; free_trial_accepted?: boolean; @@ -1771,106 +1770,106 @@ export interface ConversationsAcceptSharedInviteArguments extends WebAPICallOpti is_private?: boolean; team_id?: string; } -export interface ConversationsApproveSharedInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsApproveSharedInviteArguments extends TokenOverridable { invite_id: string; target_team?: string; } -export interface ConversationsArchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsArchiveArguments extends TokenOverridable { channel: string; } -export interface ConversationsCloseArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsCloseArguments extends TokenOverridable { channel: string; } -export interface ConversationsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsCreateArguments extends TokenOverridable { name: string; is_private?: boolean; team_id?: string; } -export interface ConversationsDeclineSharedInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsDeclineSharedInviteArguments extends TokenOverridable { invite_id: string; target_team?: string; } -export interface ConversationsHistoryArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled, +export interface ConversationsHistoryArguments extends TokenOverridable, CursorPaginationEnabled, TimelinePaginationEnabled { channel: string; include_all_metadata?: boolean; } cursorPaginationEnabledMethods.add('conversations.history'); -export interface ConversationsInfoArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface ConversationsInfoArguments extends TokenOverridable, LocaleAware { channel: string; include_num_members?: boolean; } -export interface ConversationsInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsInviteArguments extends TokenOverridable { channel: string; users: string; // comma-separated list of users } -export interface ConversationsInviteSharedArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsInviteSharedArguments extends TokenOverridable { channel: string; emails?: string[]; user_ids?: string[]; } -export interface ConversationsJoinArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsJoinArguments extends TokenOverridable { channel: string; } -export interface ConversationsKickArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsKickArguments extends TokenOverridable { channel: string; user: string; } -export interface ConversationsLeaveArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsLeaveArguments extends TokenOverridable { channel: string; } -export interface ConversationsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled { exclude_archived?: boolean; types?: string; // comma-separated list of conversation types team_id?: string; } cursorPaginationEnabledMethods.add('conversations.list'); -export interface ConversationsListConnectInvitesArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsListConnectInvitesArguments extends TokenOverridable { count?: number; cursor?: string; team_id?: string; } cursorPaginationEnabledMethods.add('conversations.listConnectInvites'); -export interface ConversationsMarkArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsMarkArguments extends TokenOverridable { channel: string; ts: string; } -export interface ConversationsMembersArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface ConversationsMembersArguments extends TokenOverridable, CursorPaginationEnabled { channel: string; } cursorPaginationEnabledMethods.add('conversations.members'); -export interface ConversationsOpenArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsOpenArguments extends TokenOverridable { channel?: string; users?: string; // comma-separated list of users return_im?: boolean; } -export interface ConversationsRenameArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsRenameArguments extends TokenOverridable { channel: string; name: string; } -export interface ConversationsRepliesArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled, +export interface ConversationsRepliesArguments extends TokenOverridable, CursorPaginationEnabled, TimelinePaginationEnabled { channel: string; ts: string; include_all_metadata?: boolean; } cursorPaginationEnabledMethods.add('conversations.replies'); -export interface ConversationsSetPurposeArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsSetPurposeArguments extends TokenOverridable { channel: string; purpose: string; } -export interface ConversationsSetTopicArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsSetTopicArguments extends TokenOverridable { channel: string; topic: string; } -export interface ConversationsUnarchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface ConversationsUnarchiveArguments extends TokenOverridable { channel: string; } /* * `dialog.*` */ -export interface DialogOpenArguments extends WebAPICallOptions, TokenOverridable { +export interface DialogOpenArguments extends TokenOverridable { trigger_id: string; dialog: Dialog; } @@ -1878,38 +1877,38 @@ export interface DialogOpenArguments extends WebAPICallOptions, TokenOverridable /* * `dnd.*` */ -export interface DndEndDndArguments extends WebAPICallOptions, TokenOverridable { } -export interface DndEndSnoozeArguments extends WebAPICallOptions, TokenOverridable { } -export interface DndInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface DndEndDndArguments extends TokenOverridable { } +export interface DndEndSnoozeArguments extends TokenOverridable { } +export interface DndInfoArguments extends TokenOverridable { user: string; } -export interface DndSetSnoozeArguments extends WebAPICallOptions, TokenOverridable { +export interface DndSetSnoozeArguments extends TokenOverridable { num_minutes: number; } -export interface DndTeamInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface DndTeamInfoArguments extends TokenOverridable { users?: string; // comma-separated list of users } /* * `emoji.*` */ -export interface EmojiListArguments extends WebAPICallOptions, TokenOverridable { +export interface EmojiListArguments extends TokenOverridable { include_categories?: boolean; } /* * `files.*` */ -export interface FilesDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesDeleteArguments extends TokenOverridable { file: string; // file id } -export interface FilesInfoArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEnabled { file: string; // file id count?: number; page?: number; } cursorPaginationEnabledMethods.add('files.info'); -export interface FilesListArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled { +export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled { channel?: string; user?: string; ts_from?: string; @@ -1918,16 +1917,16 @@ export interface FilesListArguments extends WebAPICallOptions, TokenOverridable, show_files_hidden_by_limit?: boolean; team_id?: string; } -export interface FilesRevokePublicURLArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRevokePublicURLArguments extends TokenOverridable { file: string; // file id } -export interface FilesSharedPublicURLArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesSharedPublicURLArguments extends TokenOverridable { file: string; // file id } /** * Legacy files.upload API files upload arguments */ -export interface FilesUploadArguments extends FileUpload, WebAPICallOptions, TokenOverridable {} +export interface FilesUploadArguments extends FileUpload, TokenOverridable {} interface FileUpload { channels?: string; // comma-separated list of channels content?: string; // if omitted, must provide `file` @@ -1939,7 +1938,7 @@ interface FileUpload { title?: string; } -export interface FilesUploadV2Arguments extends FileUploadV2, WebAPICallOptions, TokenOverridable { +export interface FilesUploadV2Arguments extends FileUploadV2, TokenOverridable { file_uploads?: Omit[]; /** * @deprecated Since v7, this flag is no longer used. You can safely remove it from your code. @@ -1965,7 +1964,7 @@ export interface FileUploadV2Job extends FileUploadV2, * Gets a URL for an edge external file upload. Method: * {@link https://api.slack.com/methods/files.getUploadURLExternal files.getUploadURLExternal} */ -export interface FilesGetUploadURLExternalArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesGetUploadURLExternalArguments extends TokenOverridable { filename: string; length: number; alt_text?: string; @@ -1975,7 +1974,7 @@ export interface FilesGetUploadURLExternalArguments extends WebAPICallOptions, T * Finishes an upload started with files.getUploadURLExternal. Method: * {@link https://api.slack.com/methods/files.completeUploadExternal files.completeUploadExternal} */ -export interface FilesCompleteUploadExternalArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesCompleteUploadExternalArguments extends TokenOverridable { files: FileUploadComplete[]; channel_id?: string, // if omitted, file will be private initial_comment?: string, @@ -1985,23 +1984,23 @@ interface FileUploadComplete { id: string, // file id title?: string // filename } -export interface FilesCommentsDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesCommentsDeleteArguments extends TokenOverridable { file: string; // file id id: string; // comment id } // either file or external_id is required -export interface FilesRemoteInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRemoteInfoArguments extends TokenOverridable { // either one of the file or external_id arguments are required file?: string; external_id?: string; } -export interface FilesRemoteListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { ts_from?: string; ts_to?: string; channel?: string; } cursorPaginationEnabledMethods.add('files.remote.list'); -export interface FilesRemoteAddArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRemoteAddArguments extends TokenOverridable { title: string; external_url: string; external_id: string; // a unique identifier for the file in your system @@ -2009,7 +2008,7 @@ export interface FilesRemoteAddArguments extends WebAPICallOptions, TokenOverrid preview_image?: Buffer | Stream; indexable_file_contents?: Buffer | Stream; } -export interface FilesRemoteUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRemoteUpdateArguments extends TokenOverridable { title?: string; external_url?: string; filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types @@ -2020,12 +2019,12 @@ export interface FilesRemoteUpdateArguments extends WebAPICallOptions, TokenOver file?: string; external_id?: string; } -export interface FilesRemoteRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRemoteRemoveArguments extends TokenOverridable { // either one of the file or external_id arguments are required file?: string; external_id?: string; } -export interface FilesRemoteShareArguments extends WebAPICallOptions, TokenOverridable { +export interface FilesRemoteShareArguments extends TokenOverridable { channels: string; // comma-separated list of channel ids // either one of the file or external_id arguments are required @@ -2036,92 +2035,92 @@ export interface FilesRemoteShareArguments extends WebAPICallOptions, TokenOverr /* * `groups.*` */ -export interface GroupsArchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsArchiveArguments extends TokenOverridable { channel: string; } -export interface GroupsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsCreateArguments extends TokenOverridable { name: string; validate?: boolean; team_id?: string; } -export interface GroupsCreateChildArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsCreateChildArguments extends TokenOverridable { channel: string; } -export interface GroupsHistoryArguments extends WebAPICallOptions, TokenOverridable, TimelinePaginationEnabled { +export interface GroupsHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { channel: string; unreads?: boolean; count?: number; } -export interface GroupsInfoArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface GroupsInfoArguments extends TokenOverridable, LocaleAware { channel: string; } -export interface GroupsInviteArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsInviteArguments extends TokenOverridable { channel: string; user: string; } -export interface GroupsKickArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsKickArguments extends TokenOverridable { channel: string; user: string; } -export interface GroupsLeaveArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsLeaveArguments extends TokenOverridable { channel: string; } -export interface GroupsListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface GroupsListArguments extends TokenOverridable, CursorPaginationEnabled { exclude_archived?: boolean; exclude_members?: boolean; team_id?: string; } cursorPaginationEnabledMethods.add('groups.list'); -export interface GroupsMarkArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsMarkArguments extends TokenOverridable { channel: string; ts: string; } -export interface GroupsOpenArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsOpenArguments extends TokenOverridable { channel: string; } -export interface GroupsRenameArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsRenameArguments extends TokenOverridable { channel: string; name: string; validate?: boolean; } -export interface GroupsRepliesArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsRepliesArguments extends TokenOverridable { channel: string; thread_ts: boolean; } -export interface GroupsSetPurposeArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsSetPurposeArguments extends TokenOverridable { channel: string; purpose: string; } -export interface GroupsSetTopicArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsSetTopicArguments extends TokenOverridable { channel: string; topic: string; } -export interface GroupsUnarchiveArguments extends WebAPICallOptions, TokenOverridable { +export interface GroupsUnarchiveArguments extends TokenOverridable { channel: string; } /* * `im.*` */ -export interface IMCloseArguments extends WebAPICallOptions, TokenOverridable { +export interface IMCloseArguments extends TokenOverridable { channel: string; } -export interface IMHistoryArguments extends WebAPICallOptions, TokenOverridable, TimelinePaginationEnabled { +export interface IMHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { channel: string; count?: number; unreads?: boolean; } -export interface IMListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { } +export interface IMListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('im.list'); -export interface IMMarkArguments extends WebAPICallOptions, TokenOverridable { +export interface IMMarkArguments extends TokenOverridable { channel: string; ts: string; } -export interface IMOpenArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface IMOpenArguments extends TokenOverridable, LocaleAware { user: string; return_im?: boolean; } -export interface IMRepliesArguments extends WebAPICallOptions, TokenOverridable { +export interface IMRepliesArguments extends TokenOverridable { channel: string; thread_ts?: string; } @@ -2129,7 +2128,7 @@ export interface IMRepliesArguments extends WebAPICallOptions, TokenOverridable /* * `migration.*` */ -export interface MigrationExchangeArguments extends WebAPICallOptions, TokenOverridable { +export interface MigrationExchangeArguments extends TokenOverridable { users: string; // comma-separated list of users to_old?: boolean; team_id?: string; @@ -2138,24 +2137,24 @@ export interface MigrationExchangeArguments extends WebAPICallOptions, TokenOver /* * `mpim.*` */ -export interface MPIMCloseArguments extends WebAPICallOptions, TokenOverridable { +export interface MPIMCloseArguments extends TokenOverridable { channel: string; } -export interface MPIMHistoryArguments extends WebAPICallOptions, TokenOverridable, TimelinePaginationEnabled { +export interface MPIMHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { channel: string; count?: number; unreads?: boolean; } -export interface MPIMListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { } +export interface MPIMListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('mpim.list'); -export interface MPIMMarkArguments extends WebAPICallOptions, TokenOverridable { +export interface MPIMMarkArguments extends TokenOverridable { channel: string; ts: string; } -export interface MPIMOpenArguments extends WebAPICallOptions, TokenOverridable { +export interface MPIMOpenArguments extends TokenOverridable { users: string; // comma-separated list of users } -export interface MPIMRepliesArguments extends WebAPICallOptions, TokenOverridable { +export interface MPIMRepliesArguments extends TokenOverridable { channel: string; thread_ts: string; } @@ -2163,14 +2162,14 @@ export interface MPIMRepliesArguments extends WebAPICallOptions, TokenOverridabl /* * `oauth.*` */ -export interface OAuthAccessArguments extends WebAPICallOptions { +export interface OAuthAccessArguments { client_id: string; client_secret: string; code: string; redirect_uri?: string; single_channel?: string; } -export interface OAuthV2AccessArguments extends WebAPICallOptions { +export interface OAuthV2AccessArguments { client_id: string; client_secret: string; code?: string; // not required for token rotation @@ -2179,7 +2178,7 @@ export interface OAuthV2AccessArguments extends WebAPICallOptions { refresh_token?: string; } -export interface OAuthV2ExchangeArguments extends WebAPICallOptions { +export interface OAuthV2ExchangeArguments { client_id: string; client_secret: string; } @@ -2187,7 +2186,7 @@ export interface OAuthV2ExchangeArguments extends WebAPICallOptions { /* * `openid.connect.*` */ -export interface OpenIDConnectTokenArguments extends WebAPICallOptions { +export interface OpenIDConnectTokenArguments { client_id: string; client_secret: string; code?: string; @@ -2197,20 +2196,20 @@ export interface OpenIDConnectTokenArguments extends WebAPICallOptions { } // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface OpenIDConnectUserInfoArguments extends WebAPICallOptions { +export interface OpenIDConnectUserInfoArguments { } /* * `pins.*` */ -export interface PinsAddArguments extends WebAPICallOptions, TokenOverridable { +export interface PinsAddArguments extends TokenOverridable { channel: string; timestamp: string; } -export interface PinsListArguments extends WebAPICallOptions, TokenOverridable { +export interface PinsListArguments extends TokenOverridable { channel: string; } -export interface PinsRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface PinsRemoveArguments extends TokenOverridable { channel: string; timestamp: string; } @@ -2218,7 +2217,7 @@ export interface PinsRemoveArguments extends WebAPICallOptions, TokenOverridable /* * `reactions.*` */ -export interface ReactionsAddArguments extends WebAPICallOptions, TokenOverridable { +export interface ReactionsAddArguments extends TokenOverridable { name: string; // must supply one of: channel?: string; // paired with timestamp @@ -2226,7 +2225,7 @@ export interface ReactionsAddArguments extends WebAPICallOptions, TokenOverridab file?: string; // file id file_comment?: string; } -export interface ReactionsGetArguments extends WebAPICallOptions, TokenOverridable { +export interface ReactionsGetArguments extends TokenOverridable { full?: boolean; // must supply one of: channel?: string; // paired with timestamp @@ -2234,14 +2233,14 @@ export interface ReactionsGetArguments extends WebAPICallOptions, TokenOverridab file?: string; // file id file_comment?: string; } -export interface ReactionsListArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled, +export interface ReactionsListArguments extends TokenOverridable, TraditionalPagingEnabled, CursorPaginationEnabled { user?: string; full?: boolean; team_id?: string; } cursorPaginationEnabledMethods.add('reactions.list'); -export interface ReactionsRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface ReactionsRemoveArguments extends TokenOverridable { name: string; // must supply one of: channel?: string; // paired with timestamp @@ -2253,30 +2252,30 @@ export interface ReactionsRemoveArguments extends WebAPICallOptions, TokenOverri /* * `reminders.*` */ -export interface RemindersAddArguments extends WebAPICallOptions, TokenOverridable { +export interface RemindersAddArguments extends TokenOverridable { text: string; time: string | number; user?: string; } -export interface RemindersCompleteArguments extends WebAPICallOptions, TokenOverridable { +export interface RemindersCompleteArguments extends TokenOverridable { reminder: string; } -export interface RemindersDeleteArguments extends WebAPICallOptions, TokenOverridable { +export interface RemindersDeleteArguments extends TokenOverridable { reminder: string; } -export interface RemindersInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface RemindersInfoArguments extends TokenOverridable { reminder: string; } -export interface RemindersListArguments extends WebAPICallOptions, TokenOverridable { } +export interface RemindersListArguments extends TokenOverridable { } /* * `rtm.*` */ -export interface RTMConnectArguments extends WebAPICallOptions, TokenOverridable { +export interface RTMConnectArguments extends TokenOverridable { batch_presence_aware?: boolean; presence_sub?: boolean; } -export interface RTMStartArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface RTMStartArguments extends TokenOverridable, LocaleAware { batch_presence_aware?: boolean; mpim_aware?: boolean; no_latest?: '0' | '1'; @@ -2288,27 +2287,27 @@ export interface RTMStartArguments extends WebAPICallOptions, TokenOverridable, /* * `search.*` */ -export interface SearchAllArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled, +export interface SearchAllArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } -export interface SearchFilesArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled, +export interface SearchFilesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } -export interface SearchMessagesArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled, +export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } /* * `stars.*` */ -export interface StarsAddArguments extends WebAPICallOptions, TokenOverridable { +export interface StarsAddArguments extends TokenOverridable { // must supply one of: channel?: string; // paired with `timestamp` timestamp?: string; // paired with `channel` file?: string; // file id file_comment?: string; } -export interface StarsListArguments extends WebAPICallOptions, TokenOverridable, TraditionalPagingEnabled, +export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('stars.list'); -export interface StarsRemoveArguments extends WebAPICallOptions, TokenOverridable { +export interface StarsRemoveArguments extends TokenOverridable { // must supply one of: channel?: string; // paired with `timestamp` timestamp?: string; // paired with `channel` @@ -2319,7 +2318,7 @@ export interface StarsRemoveArguments extends WebAPICallOptions, TokenOverridabl /* * `team.*` */ -export interface TeamAccessLogsArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled { before?: number; count?: number; page?: number; @@ -2327,19 +2326,19 @@ export interface TeamAccessLogsArguments extends WebAPICallOptions, TokenOverrid } cursorPaginationEnabledMethods.add('team.accessLogs'); -export interface TeamBillableInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamBillableInfoArguments extends TokenOverridable { user?: string; team_id?: string; } -export interface TeamBillingInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamBillingInfoArguments extends TokenOverridable { } -export interface TeamInfoArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamInfoArguments extends TokenOverridable { // Team to get info on, if omitted, will return information about the current team. // Will only return team that the authenticated token is allowed to see through external shared channels team?: string; domain?: string; // available only for Enterprise Grid } -export interface TeamIntegrationLogsArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamIntegrationLogsArguments extends TokenOverridable { app_id?: string; change_type?: string; // TODO: list types: 'x' | 'y' | 'z' count?: number; @@ -2348,37 +2347,37 @@ export interface TeamIntegrationLogsArguments extends WebAPICallOptions, TokenOv user?: string; team_id?: string; } -export interface TeamProfileGetArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamProfileGetArguments extends TokenOverridable { visibility?: 'all' | 'visible' | 'hidden'; team_id?: string; } -export interface TeamPreferencesListArguments extends WebAPICallOptions, TokenOverridable { +export interface TeamPreferencesListArguments extends TokenOverridable { } /* * `usergroups.*` */ -export interface UsergroupsCreateArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsCreateArguments extends TokenOverridable { name: string; channels?: string; // comma-separated list of channels description?: string; handle?: string; include_count?: boolean; } -export interface UsergroupsDisableArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsDisableArguments extends TokenOverridable { usergroup: string; include_count?: boolean; } -export interface UsergroupsEnableArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsEnableArguments extends TokenOverridable { usergroup: string; include_count?: boolean; } -export interface UsergroupsListArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsListArguments extends TokenOverridable { include_count?: boolean; include_disabled?: boolean; include_users?: boolean; } -export interface UsergroupsUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsUpdateArguments extends TokenOverridable { usergroup: string; channels?: string; // comma-separated list of channels description?: string; @@ -2386,11 +2385,11 @@ export interface UsergroupsUpdateArguments extends WebAPICallOptions, TokenOverr include_count?: boolean; name?: string; } -export interface UsergroupsUsersListArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsUsersListArguments extends TokenOverridable { usergroup: string; include_disabled?: boolean; } -export interface UsergroupsUsersUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface UsergroupsUsersUpdateArguments extends TokenOverridable { usergroup: string; users: string; // comma-separated list of users include_count?: boolean; @@ -2399,66 +2398,66 @@ export interface UsergroupsUsersUpdateArguments extends WebAPICallOptions, Token /* * `users.*` */ -export interface UsersConversationsArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled { +export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled { exclude_archived?: boolean; types?: string; // comma-separated list of conversation types user?: string; team_id?: string; } cursorPaginationEnabledMethods.add('users.conversations'); -export interface UsersDeletePhotoArguments extends WebAPICallOptions, TokenOverridable { } -export interface UsersGetPresenceArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersDeletePhotoArguments extends TokenOverridable { } +export interface UsersGetPresenceArguments extends TokenOverridable { user: string; } -export interface UsersIdentityArguments extends WebAPICallOptions, TokenOverridable { } -export interface UsersInfoArguments extends WebAPICallOptions, TokenOverridable, LocaleAware { +export interface UsersIdentityArguments extends TokenOverridable { } +export interface UsersInfoArguments extends TokenOverridable, LocaleAware { user: string; } -export interface UsersListArguments extends WebAPICallOptions, TokenOverridable, CursorPaginationEnabled, LocaleAware { +export interface UsersListArguments extends TokenOverridable, CursorPaginationEnabled, LocaleAware { presence?: boolean; // deprecated, defaults to false team_id?: string; } cursorPaginationEnabledMethods.add('users.list'); -export interface UsersLookupByEmailArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersLookupByEmailArguments extends TokenOverridable { email: string; } -export interface UsersSetPhotoArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersSetPhotoArguments extends TokenOverridable { image: Buffer | Stream; crop_w?: number; crop_x?: number; crop_y?: number; } -export interface UsersSetPresenceArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersSetPresenceArguments extends TokenOverridable { presence: 'auto' | 'away'; } -export interface UsersProfileGetArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersProfileGetArguments extends TokenOverridable { include_labels?: boolean; user?: string; } -export interface UsersProfileSetArguments extends WebAPICallOptions, TokenOverridable { +export interface UsersProfileSetArguments extends TokenOverridable { profile?: string; // url-encoded json user?: string; name?: string; // usable if `profile` is not passed value?: string; // usable if `profile` is not passed } -export interface ViewsOpenArguments extends WebAPICallOptions, TokenOverridable { +export interface ViewsOpenArguments extends TokenOverridable { trigger_id: string; view: View; } -export interface ViewsPushArguments extends WebAPICallOptions, TokenOverridable { +export interface ViewsPushArguments extends TokenOverridable { trigger_id: string; view: View; } -export interface ViewsPublishArguments extends WebAPICallOptions, TokenOverridable { +export interface ViewsPublishArguments extends TokenOverridable { user_id: string; view: View; hash?: string; } -export interface ViewsUpdateArguments extends WebAPICallOptions, TokenOverridable { +export interface ViewsUpdateArguments extends TokenOverridable { view_id?: string; view: View; external_id?: string; @@ -2468,19 +2467,19 @@ export interface ViewsUpdateArguments extends WebAPICallOptions, TokenOverridabl /* * `workflows.*` */ -export interface WorkflowsStepCompletedArguments extends WebAPICallOptions, TokenOverridable { +export interface WorkflowsStepCompletedArguments extends TokenOverridable { workflow_step_execute_id: string; outputs?: Record; } -export interface WorkflowsStepFailedArguments extends WebAPICallOptions, TokenOverridable { +export interface WorkflowsStepFailedArguments extends TokenOverridable { workflow_step_execute_id: string; error: { message: string; }; } -export interface WorkflowsUpdateStepArguments extends WebAPICallOptions, TokenOverridable { +export interface WorkflowsUpdateStepArguments extends TokenOverridable { workflow_step_edit_id: string; step_image_url?: string; step_name?: string; From 79aaf6e9d33ab7275711593b6840a60d953c9801 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 4 Oct 2023 13:02:04 -0400 Subject: [PATCH 002/122] @slack/web-api: Remove inclusion of arbitrary properties from WebAPICallResult. Tweak fileUploadV2 return type as a result. --- packages/web-api/src/WebClient.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index 69588854a..ec1bf8c7b 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -78,7 +78,6 @@ export interface WebAPICallResult { // `chat.postMessage` returns an array of error messages (e.g., "messages": ["[ERROR] invalid_keys"]) messages?: string[]; }; - [key: string]: unknown; } // NOTE: should there be an async predicate? @@ -403,7 +402,9 @@ export class WebClient extends Methods { * **#3**: Complete uploads {@link https://api.slack.com/methods/files.completeUploadExternal files.completeUploadExternal} * @param options */ - public async filesUploadV2(options: FilesUploadV2Arguments): Promise { + public async filesUploadV2(options: FilesUploadV2Arguments): Promise< + WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] | WebAPICallResult[] } + > { this.logger.debug('files.uploadV2() start'); // 1 const fileUploads = await this.getAllFileUploads(options); From 62ffc7f12023aa1ec912c9d0e3b016273e8ec168 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 4 Oct 2023 16:38:06 -0400 Subject: [PATCH 003/122] Remove optionality on abstract generic Method interface options arg, lines up behaviour with WebClient. --- packages/web-api/src/methods.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 4e5f5e100..bd88e6471 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -930,7 +930,7 @@ export default interface Method< MethodArguments, MethodResult extends WebAPICallResult = WebAPICallResult, > { - (options?: MethodArguments): Promise; + (options: MethodArguments): Promise; } /* From 3cb6c62aa0f5d22de5def0bc090f5a62e63c67e9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 5 Oct 2023 12:07:31 -0400 Subject: [PATCH 004/122] adjust return type for fileuploadv2 based on recent change. --- packages/web-api/src/WebClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index ec1bf8c7b..a93b95bb8 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -403,7 +403,7 @@ export class WebClient extends Methods { * @param options */ public async filesUploadV2(options: FilesUploadV2Arguments): Promise< - WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] | WebAPICallResult[] } + WebAPICallResult & { files: FilesCompleteUploadExternalResponse[] } > { this.logger.debug('files.uploadV2() start'); // 1 From 16464e5e5a30cf33b690379414abbb4ddf882a37 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 5 Oct 2023 14:02:31 -0400 Subject: [PATCH 005/122] adding notes on future type improvements to getFile API args --- packages/web-api/src/methods.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index bd88e6471..33ee5ba69 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -979,6 +979,11 @@ export interface TraditionalPagingEnabled { /* * `admin.*` */ +// TODO: breaking change - potential type improvements: +// - date is required _except_ if metadata_only=true +// - metadata_only=true only works with type=public_channel +// - type is either `public_channel` or `member` +// https://api.slack.com/methods/admin.analytics.getFile export interface AdminAnalyticsGetFileArguments extends TokenOverridable { type: string; date?: string; From b4837a4a82bf4ad21bf52f12b8ec91692b760456 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 5 Oct 2023 16:26:52 -0400 Subject: [PATCH 006/122] Remove note about getFile response type being generated. Tweak some minor types within its response. --- .../src/response/AdminAnalyticsGetFileResponse.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts b/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts index f5a1a9d1f..79c3349ed 100644 --- a/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts +++ b/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts @@ -1,16 +1,8 @@ -/* eslint-disable */ -///////////////////////////////////////////////////////////////////////////////////////// -// // -// !!! DO NOT EDIT THIS FILE !!! // -// // -// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // -// Please refer to the script code to learn how to update the source data. // -// // -///////////////////////////////////////////////////////////////////////////////////////// - +/* eslint-disable no-multi-spaces,max-len */ import { WebAPICallResult } from '../WebClient'; + export type AdminAnalyticsGetFileResponse = WebAPICallResult & { - file_data?: Array[]; + file_data?: (AdminAnalyticsMemberDetails | AdminAnalyticsPublicChannelDetails | AdminAnalyticsPublicChannelMetadataDetails)[]; error?: string; needed?: string; ok?: boolean; @@ -24,6 +16,7 @@ export interface ResponseMetadata { export interface AdminAnalyticsMemberDetails { enterprise_id: string; + team_id: string; date: string; user_id: string; email_address: string; From e2d2faaed5a60d96d0221c2b501c3d3cdf8fe642 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 5 Oct 2023 17:04:13 -0400 Subject: [PATCH 007/122] Tweaking web-api arguments as I audit them, adding TODOs for future breaking change enhancements. --- packages/web-api/src/methods.ts | 70 +++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 33ee5ba69..8596c4978 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -979,73 +979,103 @@ export interface TraditionalPagingEnabled { /* * `admin.*` */ -// TODO: breaking change - potential type improvements: +// TODO: breaking changes - potential type improvements: // - date is required _except_ if metadata_only=true // - metadata_only=true only works with type=public_channel -// - type is either `public_channel` or `member` // https://api.slack.com/methods/admin.analytics.getFile export interface AdminAnalyticsGetFileArguments extends TokenOverridable { - type: string; + type: 'public_channel' | 'member'; date?: string; metadata_only?: boolean; } +// TODO: breaking changes - potential type improvements: +// - exactly one of `team_id` or `enterprise_id` is required - but not both +// - either `app_id` or `request_id` is required +// https://api.slack.com/methods/admin.apps.approve export interface AdminAppsApproveArguments extends TokenOverridable { app_id?: string; + enterprise_id?: string; request_id?: string; team_id?: string; } +// TODO: breaking changes - potential type improvements: +// - cannot provide both `team_id` or `enterprise_id` (but can provide neither, will infer from token) +// https://api.slack.com/methods/admin.apps.approved.list export interface AdminAppsApprovedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id?: string; enterprise_id?: string; + certified?: boolean; } +// TODO: breaking changes - potential type improvements: +// - exactly one of `team_id` or `enterprise_id` is required - but not both +// https://api.slack.com/methods/admin.apps.clearResolution export interface AdminAppsClearResolutionArguments { app_id: string; enterprise_id?: string; team_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.approved.list'); +// https://api.slack.com/methods/admin.apps.requests.cancel export interface AdminAppsRequestsCancelArguments extends TokenOverridable { request_id: string; enterprise_id?: string; team_id?: string; } +// https://api.slack.com/methods/admin.apps.requests.list export interface AdminAppsRequestsListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id?: string; + certified?: boolean; + enterprise_id?: string; + team_id?: string; // required if your enterprise grid contains more than one workspace } cursorPaginationEnabledMethods.add('admin.apps.requests.list'); +// TODO: breaking changes - potential type improvements: +// - exactly one of `team_id` or `enterprise_id` is required - but not both +// - either `app_id` or `request_id` is required +// https://api.slack.com/methods/admin.apps.restrict export interface AdminAppsRestrictArguments extends TokenOverridable { app_id?: string; request_id?: string; team_id?: string; + enterprise_id?: string; } +// TODO: breaking changes - potential type improvements: +// - cannot provide both `team_id` or `enterprise_id` (but can provide neither, will infer from token) +// https://api.slack.com/methods/admin.apps.restricted.list export interface AdminAppsRestrictedListArguments extends TokenOverridable, CursorPaginationEnabled { + certified?: boolean; team_id?: string; enterprise_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.restricted.list'); +// TODO: breaking changes - potential type improvements: +// - exactly one of `team_id` or `enterprise_id` is required - but not both +// https://api.slack.com/methods/admin.apps.uninstall export interface AdminAppsUninstallArguments { app_id: string; enterprise_id?: string; team_ids?: string[]; } +// https://api.slack.com/methods/admin.apps.activities.list export interface AdminAppsActivitiesListArguments extends TokenOverridable, CursorPaginationEnabled { app_id?: string; component_id?: string; - component_type?: string; + component_type?: 'events_api' | 'workflows' | 'functions' | 'tables'; log_event_type?: string; max_date_created?: number; min_date_created?: number; - min_log_level?: string; + min_log_level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; sort_direction?: string; - source?: string; + source?: 'slack' | 'developer'; team_id?: string; trace_id?: string; } cursorPaginationEnabledMethods.add('admin.apps.activities.list'); +// TODO: does not get used, should add method implementation, see https://github.com/slackapi/node-slack-sdk/issues/1675 export interface AdminAppsConfigLookupArguments extends TokenOverridable { app_ids: string[]; } +// TODO: does not get used, should add method implementation, see https://github.com/slackapi/node-slack-sdk/issues/1675 export interface AdminAppsConfigSetArguments extends TokenOverridable { app_id: string; domain_restrictions?: { @@ -1054,42 +1084,48 @@ export interface AdminAppsConfigSetArguments extends TokenOverridable { }; workflow_auth_strategy?: 'builder_choice' | 'end_user_strategy'; } +// https://api.slack.com/methods/admin.auth.policy.assignEntities export interface AdminAuthPolicyAssignEntitiesArguments extends TokenOverridable { entity_ids: string[]; - entity_type: string; - policy_name: string; + entity_type: 'USER'; + policy_name: 'email_password'; } +// https://api.slack.com/methods/admin.auth.policy.getEntities export interface AdminAuthPolicyGetEntitiesArguments extends TokenOverridable, CursorPaginationEnabled { - policy_name: string; - entity_type?: string; + policy_name: 'email_password'; + entity_type?: 'USER'; } cursorPaginationEnabledMethods.add('admin.auth.policy.getEntities'); +// https://api.slack.com/methods/admin.auth.policy.removeEntities export interface AdminAuthPolicyRemoveEntitiesArguments extends TokenOverridable { entity_ids: string[]; - entity_type: string; - policy_name: string; + entity_type: 'USER'; + policy_name: 'email_password'; } +// https://api.slack.com/methods/admin.barriers.create export interface AdminBarriersCreateArguments extends TokenOverridable { barriered_from_usergroup_ids: string[]; primary_usergroup_id: string; - restricted_subjects: string[]; + restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs } - +// https://api.slack.com/methods/admin.barriers.delete export interface AdminBarriersDeleteArguments extends TokenOverridable { barrier_id: string; } - +// https://api.slack.com/methods/admin.barriers.list export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.barriers.list'); +// https://api.slack.com/methods/admin.barriers.update export interface AdminBarriersUpdateArguments extends TokenOverridable { barrier_id: string; barriered_from_usergroup_ids: string[]; primary_usergroup_id: string; - restricted_subjects: string[]; + restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs } +// https://api.slack.com/methods/admin.conversations.archive export interface AdminConversationsArchiveArguments extends TokenOverridable { channel_id: string; } From bc25c1f87212c56ebc13b1ea34cdc4b522894725 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 6 Oct 2023 13:48:09 -0400 Subject: [PATCH 008/122] Audit of `admin.*` methods complete, added TODOs and updating arguments to reflect docs. --- packages/web-api/src/methods.ts | 126 ++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 23 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 8596c4978..c6a8b94df 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1053,8 +1053,8 @@ cursorPaginationEnabledMethods.add('admin.apps.restricted.list'); // https://api.slack.com/methods/admin.apps.uninstall export interface AdminAppsUninstallArguments { app_id: string; - enterprise_id?: string; - team_ids?: string[]; + enterprise_id?: string; // TODO: breaking change, enforce at least one array item? + team_ids?: string[]; // TODO: breaking change, enforce at least one array item? } // https://api.slack.com/methods/admin.apps.activities.list export interface AdminAppsActivitiesListArguments extends TokenOverridable, CursorPaginationEnabled { @@ -1065,7 +1065,7 @@ export interface AdminAppsActivitiesListArguments extends TokenOverridable, Curs max_date_created?: number; min_date_created?: number; min_log_level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; - sort_direction?: string; + sort_direction?: string; // TODO: change to 'asc' | 'desc'? source?: 'slack' | 'developer'; team_id?: string; trace_id?: string; @@ -1079,14 +1079,14 @@ export interface AdminAppsConfigLookupArguments extends TokenOverridable { export interface AdminAppsConfigSetArguments extends TokenOverridable { app_id: string; domain_restrictions?: { - urls?: string[]; - emails?: string[]; + urls?: string[]; // TODO: breaking change, enforce at least one array item? + emails?: string[]; // TODO: breaking change, enforce at least one array item? }; workflow_auth_strategy?: 'builder_choice' | 'end_user_strategy'; } // https://api.slack.com/methods/admin.auth.policy.assignEntities export interface AdminAuthPolicyAssignEntitiesArguments extends TokenOverridable { - entity_ids: string[]; + entity_ids: string[]; // TODO: breaking change, enforce at least one array item? entity_type: 'USER'; policy_name: 'email_password'; } @@ -1099,7 +1099,7 @@ export interface AdminAuthPolicyGetEntitiesArguments extends TokenOverridable, cursorPaginationEnabledMethods.add('admin.auth.policy.getEntities'); // https://api.slack.com/methods/admin.auth.policy.removeEntities export interface AdminAuthPolicyRemoveEntitiesArguments extends TokenOverridable { - entity_ids: string[]; + entity_ids: string[]; // TODO: breaking change, enforce at least one array item? entity_type: 'USER'; policy_name: 'email_password'; } @@ -1129,22 +1129,30 @@ export interface AdminBarriersUpdateArguments extends TokenOverridable { export interface AdminConversationsArchiveArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.conversations.bulkArchive export interface AdminConversationsBulkArchiveArguments extends TokenOverridable { - channel_ids: string[]; + channel_ids: string[]; // TODO: breaking change, enforce at least one array item? } +// https://api.slack.com/methods/admin.conversations.bulkDelete export interface AdminConversationsBulkDeleteArguments extends TokenOverridable { - channel_ids: string[]; + channel_ids: string[]; // TODO: breaking change, enforce at least one array item? } +// https://api.slack.com/methods/admin.conversations.bulkMove export interface AdminConversationsBulkMoveArguments extends TokenOverridable { - channel_ids: string[]; + channel_ids: string[]; // TODO: breaking change, enforce at least one array item? target_team_id: string; } +// https://api.slack.com/methods/admin.conversations.convertToPrivate export interface AdminConversationsConvertToPrivateArguments extends TokenOverridable { channel_id: string; + name?: string; } +// https://api.slack.com/methods/admin.conversations.convertToPublic export interface AdminConversationsConvertToPublicArguments extends TokenOverridable { channel_id: string; } +// TODO: breaking change; if org_wide=false then team_id is required. +// https://api.slack.com/methods/admin.conversations.create export interface AdminConversationsCreateArguments extends TokenOverridable { is_private: boolean; name: string; @@ -1152,13 +1160,16 @@ export interface AdminConversationsCreateArguments extends TokenOverridable { org_wide?: boolean; team_id?: string; } +// https://api.slack.com/methods/admin.conversations.delete export interface AdminConversationsDeleteArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.conversations.disconnectShared export interface AdminConversationsDisconnectSharedArguments extends TokenOverridable { channel_id: string; leaving_team_ids?: string[]; } +// https://api.slack.com/methods/admin.conversations.lookup export interface AdminConversationsLookupArguments extends TokenOverridable, CursorPaginationEnabled { last_message_activity_before: number; @@ -1166,142 +1177,175 @@ export interface AdminConversationsLookupArguments max_member_count?: number; } cursorPaginationEnabledMethods.add('admin.conversations.lookup'); +// https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments extends TokenOverridable, CursorPaginationEnabled { channel_ids?: string[]; team_ids?: string[]; } cursorPaginationEnabledMethods.add('admin.conversations.ekm.listOriginalConnectedChannelInfo'); +// https://api.slack.com/methods/admin.conversations.getConversationPrefs export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.conversations.getTeams export interface AdminConversationsGetTeamsArguments extends TokenOverridable, CursorPaginationEnabled { channel_id: string; } cursorPaginationEnabledMethods.add('admin.conversations.getTeams'); +// https://api.slack.com/methods/admin.conversations.invite export interface AdminConversationsInviteArguments extends TokenOverridable { channel_id: string; user_ids: string[]; } +// https://api.slack.com/methods/admin.conversations.rename export interface AdminConversationsRenameArguments extends TokenOverridable { channel_id: string; name: string; } +// https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup export interface AdminConversationsRestrictAccessAddGroupArguments extends TokenOverridable { channel_id: string; group_id: string; team_id?: string; } +// https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups export interface AdminConversationsRestrictAccessListGroupsArguments extends TokenOverridable { channel_id: string; team_id?: string; } +// https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup export interface AdminConversationsRestrictAccessRemoveGroupArguments extends TokenOverridable { channel_id: string; group_id: string; - team_id: string; + team_id?: string; } +// https://api.slack.com/methods/admin.conversations.getCustomRetention export interface AdminConversationsGetCustomRetentionArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.conversations.setCustomRetention export interface AdminConversationsSetCustomRetentionArguments extends TokenOverridable { channel_id: string; duration_days: number; } +// https://api.slack.com/methods/admin.conversations.removeCustomRetention export interface AdminConversationsRemoveCustomRetentionArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.conversations.search export interface AdminConversationsSearchArguments extends TokenOverridable, CursorPaginationEnabled { query?: string; - search_channel_types?: string[]; + search_channel_types?: string[]; // TODO: breaking change: turn into an array of string literals? See all options here: https://api.slack.com/methods/admin.conversations.search#types sort?: 'relevant' | 'name' | 'member_count' | 'created'; sort_dir?: 'asc' | 'desc'; team_ids?: string[]; + connected_team_ids?: string[]; + total_count_only?: boolean; } cursorPaginationEnabledMethods.add('admin.conversations.search'); +// https://api.slack.com/methods/admin.conversations.setConversationPrefs export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { channel_id: string; - prefs: Record; + prefs: Record; // TODO: should this be Record? See https://api.slack.com/methods/admin.conversations.setConversationPrefs#markdown } +// https://api.slack.com/methods/admin.conversations.setTeams export interface AdminConversationsSetTeamsArguments extends TokenOverridable { channel_id: string; team_id?: string; target_team_ids?: string[]; org_channel?: boolean; } +// https://api.slack.com/methods/admin.conversations.unarchive export interface AdminConversationsUnarchiveArguments extends TokenOverridable { channel_id: string; } +// https://api.slack.com/methods/admin.emoji.add export interface AdminEmojiAddArguments extends TokenOverridable { name: string; url: string; } +// https://api.slack.com/methods/admin.emoji.addAlias export interface AdminEmojiAddAliasArguments extends TokenOverridable { name: string; alias_for: string; } +// https://api.slack.com/methods/admin.emoji.list export interface AdminEmojiListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.emoji.list'); +// https://api.slack.com/methods/admin.emoji.remove export interface AdminEmojiRemoveArguments extends TokenOverridable { name: string; } +// https://api.slack.com/methods/admin.emoji.rename export interface AdminEmojiRenameArguments extends TokenOverridable { name: string; new_name: string; } +// https://api.slack.com/methods/admin.functions.list export interface AdminFunctionsListArguments extends TokenOverridable, CursorPaginationEnabled { app_ids: string[]; team_id?: string; } +// https://api.slack.com/methods/admin.functions.permissions.lookup export interface AdminFunctionsPermissionsLookupArguments extends TokenOverridable { function_ids: string[]; } +// https://api.slack.com/methods/admin.functions.permissions.set export interface AdminFunctionsPermissionsSetArguments extends TokenOverridable { function_id: string; visibility: string; user_ids?: string[]; } +// https://api.slack.com/methods/admin.inviteRequests.approve export interface AdminInviteRequestsApproveArguments extends TokenOverridable { invite_request_id: string; team_id: string; } +// https://api.slack.com/methods/admin.inviteRequests.approved.list export interface AdminInviteRequestsApprovedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.approved.list'); +// https://api.slack.com/methods/admin.inviteRequests.deny export interface AdminInviteRequestsDenyArguments extends TokenOverridable { invite_request_id: string; team_id: string; } +// https://api.slack.com/methods/admin.inviteRequests.denied.list export interface AdminInviteRequestsDeniedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.denied.list'); +// https://api.slack.com/methods/admin.inviteRequests.list export interface AdminInviteRequestsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); +// https://api.slack.com/methods/admin.roles.addAssignments export interface AdminRolesAddAssignmentsArguments extends TokenOverridable { role_id: string; entity_ids: string[]; user_ids: string[]; } +// https://api.slack.com/methods/admin.roles.listAssignments export interface AdminRolesListAssignmentsArguments extends TokenOverridable, CursorPaginationEnabled { entity_ids?: string[]; role_ids?: string[]; - sort_dir?: string; + sort_dir?: string; // TODO: breaking change - turn to `asc` | `desc`? tho docs say this should be capital letters... } cursorPaginationEnabledMethods.add('admin.roles.listAssignments'); +// https://api.slack.com/methods/admin.roles.removeAssignments export interface AdminRolesRemoveAssignmentsArguments extends TokenOverridable { role_id: string; @@ -1309,72 +1353,90 @@ export interface AdminRolesRemoveAssignmentsArguments user_ids: string[]; } cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); +// https://api.slack.com/methods/admin.teams.admins.list export interface AdminTeamsAdminsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.teams.admins.list'); +type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; +// https://api.slack.com/methods/admin.teams.create export interface AdminTeamsCreateArguments extends TokenOverridable { team_domain: string; team_name: string; team_description?: string; - team_discoverability?: string; + team_discoverability?: TeamDiscoverability; } +// https://api.slack.com/methods/admin.teams.list export interface AdminTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { } cursorPaginationEnabledMethods.add('admin.teams.list'); +// https://api.slack.com/methods/admin.teams.owners.list export interface AdminTeamsOwnersListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } cursorPaginationEnabledMethods.add('admin.teams.owners.list'); +// https://api.slack.com/methods/admin.teams.settings.info export interface AdminTeamsSettingsInfoArguments extends TokenOverridable { team_id: string; } +// https://api.slack.com/methods/admin.teams.settings.setDefaultChannels export interface AdminTeamsSettingsSetDefaultChannelsArguments extends TokenOverridable { team_id: string; channel_ids: string[]; } +// https://api.slack.com/methods/admin.teams.settings.setDescription export interface AdminTeamsSettingsSetDescriptionArguments extends TokenOverridable { team_id: string; description: string; } +// https://api.slack.com/methods/admin.teams.settings.setDiscoverability export interface AdminTeamsSettingsSetDiscoverabilityArguments extends TokenOverridable { team_id: string; - discoverability: 'open' | 'invite_only' | 'closed' | 'unlisted'; + discoverability: TeamDiscoverability; } +// https://api.slack.com/methods/admin.teams.settings.setIcon export interface AdminTeamsSettingsSetIconArguments extends TokenOverridable { team_id: string; image_url: string; } +// https://api.slack.com/methods/admin.teams.settings.setName export interface AdminTeamsSettingsSetNameArguments extends TokenOverridable { team_id: string; name: string; } +// https://api.slack.com/methods/admin.usergroups.addChannels export interface AdminUsergroupsAddChannelsArguments extends TokenOverridable { usergroup_id: string; team_id?: string; channel_ids: string | string[]; } +// https://api.slack.com/methods/admin.usergroups.addTeams export interface AdminUsergroupsAddTeamsArguments extends TokenOverridable { usergroup_id: string; team_ids: string | string[]; auto_provision?: boolean; } +// https://api.slack.com/methods/admin.usergroups.listChannels export interface AdminUsergroupsListChannelsArguments extends TokenOverridable { usergroup_id: string; include_num_members?: boolean; team_id?: string; } +// https://api.slack.com/methods/admin.usergroups.removeChannels export interface AdminUsergroupsRemoveChannelsArguments extends TokenOverridable { usergroup_id: string; channel_ids: string | string[]; } +// https://api.slack.com/methods/admin.users.assign export interface AdminUsersAssignArguments extends TokenOverridable { team_id: string; user_id: string; + channel_ids?: string | string[]; is_restricted?: boolean; is_ultra_restricted?: boolean; } +// https://api.slack.com/methods/admin.users.invite export interface AdminUsersInviteArguments extends TokenOverridable { - channel_ids: string; + channel_ids: string | string[]; email: string; team_id: string; custom_message?: string; @@ -1385,82 +1447,99 @@ export interface AdminUsersInviteArguments extends TokenOverridable { real_name?: string; resend?: boolean; } +// https://api.slack.com/methods/admin.users.list export interface AdminUsersListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id: string; + team_id?: string; // Only required if org-level token is used } cursorPaginationEnabledMethods.add('admin.users.list'); +// https://api.slack.com/methods/admin.users.remove export interface AdminUsersRemoveArguments extends TokenOverridable { team_id: string; user_id: string; } +// https://api.slack.com/methods/admin.users.setAdmin export interface AdminUsersSetAdminArguments extends TokenOverridable { team_id: string; user_id: string; } +// https://api.slack.com/methods/admin.users.setExpiration export interface AdminUsersSetExpirationArguments extends TokenOverridable { - team_id: string; + team_id?: string; user_id: string; expiration_ts: number; } +// https://api.slack.com/methods/admin.users.setOwner export interface AdminUsersSetOwnerArguments extends TokenOverridable { team_id: string; user_id: string; } +// https://api.slack.com/methods/admin.users.setRegular export interface AdminUsersSetRegularArguments extends TokenOverridable { team_id: string; user_id: string; } cursorPaginationEnabledMethods.add('admin.users.session.list'); +// TODO: breaking change: if user_id is provided, team_id must be provided, too. +// https://api.slack.com/methods/admin.users.session.list export interface AdminUsersSessionListArguments extends TokenOverridable, CursorPaginationEnabled { user_id?: string; team_id?: string; } +// https://api.slack.com/methods/admin.users.session.reset export interface AdminUsersSessionResetArguments extends TokenOverridable { user_id: string; mobile_only?: boolean; web_only?: boolean; } +// https://api.slack.com/methods/admin.users.session.resetBulk export interface AdminUsersSessionResetBulkArguments extends TokenOverridable { user_ids: string[]; mobile_only?: boolean; web_only?: boolean; } +// https://api.slack.com/methods/admin.users.session.invalidate export interface AdminUsersSessionInvalidateArguments extends TokenOverridable { session_id: string; team_id: string; } +// https://api.slack.com/methods/admin.users.session.getSettings export interface AdminUsersSessionGetSettingsArguments extends TokenOverridable { user_ids: string[]; } +// https://api.slack.com/methods/admin.users.session.setSettings export interface AdminUsersSessionSetSettingsArguments extends TokenOverridable { user_ids: string[]; desktop_app_browser_quit?: boolean; duration?: number; } +// https://api.slack.com/methods/admin.users.session.clearSettings export interface AdminUsersSessionClearSettingsArguments extends TokenOverridable { user_ids: string[]; } - +// https://api.slack.com/methods/admin.users.unsupportedVersions.export export interface AdminUsersUnsupportedVersionsExportArguments extends TokenOverridable { date_end_of_support?: number; date_sessions_started?: number; } - +// https://api.slack.com/methods/admin.workflows.collaborators.add export interface AdminWorkflowsCollaboratorsAddArguments extends TokenOverridable { collaborator_ids: string[]; workflow_ids: string[]; } +// https://api.slack.com/methods/admin.workflows.collaborators.remove export interface AdminWorkflowsCollaboratorsRemoveArguments extends TokenOverridable { collaborator_ids: string[]; workflow_ids: string[]; } +// https://api.slack.com/methods/admin.workflows.permissions.lookup export interface AdminWorkflowsPermissionsLookupArguments extends TokenOverridable { workflow_ids: string[]; max_workflow_triggers?: number; } +// https://api.slack.com/methods/admin.workflows.search export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorPaginationEnabled { app_id?: string; collaborator_ids?: string[]; @@ -1468,10 +1547,11 @@ export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorP num_trigger_ids?: number; query?: string; sort?: string; - sort_dir?: string; - source?: string; + sort_dir?: 'asc' | 'desc'; + source?: 'code' | 'workflow_builder'; } cursorPaginationEnabledMethods.add('admin.worfklows.search'); +// https://api.slack.com/methods/admin.workflows.unpublish export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { workflow_ids: string[]; } From 41a0d79bef2f0c1e05828c193b3834e7b51856b5 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 6 Oct 2023 14:25:52 -0400 Subject: [PATCH 009/122] audited api.test and apps.* method arguments. --- packages/web-api/src/methods.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index c6a8b94df..d81588fe5 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1558,23 +1558,23 @@ export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { /* * `api.*` */ +// https://api.slack.com/methods/api.test // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface APITestArguments { } /* * `apps.*` */ +// https://api.slack.com/methods/apps.connections.open // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AppsConnectionsOpenArguments { - // currently the method page lists Client id and client secret as optional arguments - // circle back here to see if they stay as optional or are removed -} - +export interface AppsConnectionsOpenArguments { } +// https://api.slack.com/methods/apps.event.authorizations.list export interface AppsEventAuthorizationsListArguments extends TokenOverridable, CursorPaginationEnabled { event_context: string; } cursorPaginationEnabledMethods.add('apps.event.authorizations.list'); +// https://api.slack.com/methods/apps.uninstall export interface AppsUninstallArguments { client_id: string; client_secret: string; From 931c06f2d7e627f3c26d18d9acf13e7bdb3eaaea Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 6 Oct 2023 14:28:07 -0400 Subject: [PATCH 010/122] bots and auth --- packages/web-api/src/methods.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index d81588fe5..19478d08c 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1583,18 +1583,22 @@ export interface AppsUninstallArguments { /* * `auth.*` */ +// https://api.slack.com/methods/auth.revoke export interface AuthRevokeArguments extends TokenOverridable { test?: boolean; } +// https://api.slack.com/methods/auth.teams.list export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { include_icon?: boolean; } +// https://api.slack.com/methods/auth.test cursorPaginationEnabledMethods.add('auth.teams.list'); export interface AuthTestArguments extends TokenOverridable { } /* * `bots.*` */ +// https://api.slack.com/methods/bots.info export interface BotsInfoArguments extends TokenOverridable { bot?: string; team_id?: string; From 2e9f9068a8ed0a04d69bdd51500b5e51aa4ecd9d Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 6 Oct 2023 15:31:02 -0400 Subject: [PATCH 011/122] audit bookmarks.* --- packages/web-api/src/methods.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 19478d08c..b18d69bb4 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1607,16 +1607,18 @@ export interface BotsInfoArguments extends TokenOverridable { /* * `bookmarks.*` */ +// https://api.slack.com/methods/bookmarks.add export interface BookmarksAddArguments extends TokenOverridable { channel_id: string; title: string; - type: string; + type: 'link'; + link: string; // TODO: Today, `link` is required. As more bookmarking options get added in the future, + // this will change. So should we update the above property, or no? emoji?: string; entity_id?: string; - link?: string; parent_id?: string; } - +// https://api.slack.com/methods/bookmarks.edit export interface BookmarksEditArguments extends TokenOverridable { bookmark_id: string; channel_id: string; @@ -1624,11 +1626,11 @@ export interface BookmarksEditArguments extends TokenOverridable { link?: string; title?: string; } - +// https://api.slack.com/methods/bookmarks.list export interface BookmarksListArguments extends TokenOverridable { channel_id: string; } - +// https://api.slack.com/methods/bookmarks.remove export interface BookmarksRemoveArguments extends TokenOverridable { bookmark_id: string; channel_id: string; From 3a4a7a253f88d3194e1947f97986d65444f900db Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 14:22:56 -0400 Subject: [PATCH 012/122] remove deprecated channels methods, audit chat.* methods. --- packages/web-api/src/methods.ts | 133 +++++++++----------------------- 1 file changed, 38 insertions(+), 95 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index b18d69bb4..abc138b59 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -867,24 +867,6 @@ export abstract class Methods extends EventEmitter { // Deprecated methods // --------------------------------- - public readonly channels = { - archive: bindApiCall(this, 'channels.archive'), - create: bindApiCall(this, 'channels.create'), - history: bindApiCall(this, 'channels.history'), - info: bindApiCall(this, 'channels.info'), - invite: bindApiCall(this, 'channels.invite'), - join: bindApiCall(this, 'channels.join'), - kick: bindApiCall(this, 'channels.kick'), - leave: bindApiCall(this, 'channels.leave'), - list: bindApiCall(this, 'channels.list'), - mark: bindApiCall(this, 'channels.mark'), - rename: bindApiCall(this, 'channels.rename'), - replies: bindApiCall(this, 'channels.replies'), - setPurpose: bindApiCall(this, 'channels.setPurpose'), - setTopic: bindApiCall(this, 'channels.setTopic'), - unarchive: bindApiCall(this, 'channels.unarchive'), - }; - public readonly groups = { archive: bindApiCall(this, 'groups.archive'), create: bindApiCall(this, 'groups.create'), @@ -1612,8 +1594,8 @@ export interface BookmarksAddArguments extends TokenOverridable { channel_id: string; title: string; type: 'link'; - link: string; // TODO: Today, `link` is required. As more bookmarking options get added in the future, - // this will change. So should we update the above property, or no? + link: string; // TODO: Today, `link` is a required field because we only support type:link. + // As more bookmarking options get added in the future, this will change. emoji?: string; entity_id?: string; parent_id?: string; @@ -1639,130 +1621,74 @@ export interface BookmarksRemoveArguments extends TokenOverridable { /* * `calls.*` */ +// https://api.slack.com/methods/calls.add export interface CallsAddArguments extends TokenOverridable { external_unique_id: string; join_url: string; - created_by?: string; + created_by?: string; // TODO: optional only if a user token is used, required otherwise date_start?: number; desktop_app_join_url?: string; external_display_id?: string; title?: string; users?: CallUser[]; } - +// https://api.slack.com/methods/calls.end export interface CallsEndArguments extends TokenOverridable { id: string; duration?: number; } - +// https://api.slack.com/methods/calls.info export interface CallsInfoArguments extends TokenOverridable { id: string; } - +// https://api.slack.com/methods/calls.update export interface CallsUpdateArguments extends TokenOverridable { id: string; join_url?: string; desktop_app_join_url?: string; title?: string; } - +// https://api.slack.com/methods/calls.participants.add export interface CallsParticipantsAddArguments extends TokenOverridable { id: string; users: CallUser[]; } - +// https://api.slack.com/methods/calls.participants.remove export interface CallsParticipantsRemoveArguments extends TokenOverridable { id: string; users: CallUser[]; } -/* - * `channels.*` - */ -export interface ChannelsArchiveArguments extends TokenOverridable { - channel: string; -} - -export interface ChannelsCreateArguments extends TokenOverridable { - name: string; - validate?: boolean; - team_id?: string; -} -export interface ChannelsHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { - channel: string; - count?: number; - unreads?: boolean; -} -export interface ChannelsInfoArguments extends TokenOverridable, LocaleAware { - channel: string; -} -export interface ChannelsInviteArguments extends TokenOverridable { - channel: string; - user: string; -} -export interface ChannelsJoinArguments extends TokenOverridable { - name: string; - validate?: boolean; -} -export interface ChannelsKickArguments extends TokenOverridable { - channel: string; - user: string; -} -export interface ChannelsLeaveArguments extends TokenOverridable { - channel: string; -} -export interface ChannelsListArguments extends TokenOverridable, CursorPaginationEnabled { - exclude_archived?: boolean; - exclude_members?: boolean; - team_id?: string; -} -cursorPaginationEnabledMethods.add('channels.list'); -export interface ChannelsMarkArguments extends TokenOverridable { - channel: string; - ts: string; -} -export interface ChannelsRenameArguments extends TokenOverridable { - channel: string; - name: string; - validate?: boolean; -} -export interface ChannelsRepliesArguments extends TokenOverridable { - channel: string; - thread_ts: string; -} -export interface ChannelsSetPurposeArguments extends TokenOverridable { - channel: string; - purpose: string; -} -export interface ChannelsSetTopicArguments extends TokenOverridable { - channel: string; - topic: string; -} -export interface ChannelsUnarchiveArguments extends TokenOverridable { - channel: string; -} - /* * `chat.*` */ +// https://api.slack.com/methods/chat.delete export interface ChatDeleteArguments extends TokenOverridable { channel: string; ts: string; as_user?: boolean; } +// https://api.slack.com/methods/chat.deleteScheduledMessage export interface ChatDeleteScheduledMessageArguments extends TokenOverridable { channel: string; scheduled_message_id: string; as_user?: boolean; } +// https://api.slack.com/methods/chat.getPermalink export interface ChatGetPermalinkArguments extends TokenOverridable { channel: string; message_ts: string; } +// https://api.slack.com/methods/chat.meMessage export interface ChatMeMessageArguments extends TokenOverridable { channel: string; text: string; } +// https://api.slack.com/methods/chat.postEphemeral +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostMessageArguments export interface ChatPostEphemeralArguments extends TokenOverridable { channel: string; text?: string; @@ -1777,6 +1703,11 @@ export interface ChatPostEphemeralArguments extends TokenOverridable { icon_url?: string; // if specified, as_user must be false username?: string; // if specified, as_user must be false } +// https://api.slack.com/methods/chat.postMessage +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostEphemeralArguments export interface ChatPostMessageArguments extends TokenOverridable { channel: string; text?: string; @@ -1795,6 +1726,11 @@ export interface ChatPostMessageArguments extends TokenOverridable { unfurl_media?: boolean; username?: string; // if specified, as_user must be false } +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostEphemeralArguments +// https://api.slack.com/methods/chat.scheduleMessage export interface ChatScheduleMessageArguments extends TokenOverridable { channel: string; text?: string; @@ -1811,11 +1747,12 @@ export interface ChatScheduleMessageArguments extends TokenOverridable { unfurl_media?: boolean; team_id?: string; } +// https://api.slack.com/methods/chat.scheduledMessages.list export interface ChatScheduledMessagesListArguments extends TokenOverridable, CursorPaginationEnabled { - channel: string; - latest: number; - oldest: number; + channel?: string; + latest?: number; + oldest?: number; team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('chat.scheduledMessages.list'); @@ -1844,6 +1781,7 @@ interface SourceAndUnfurlIDArguments { */ unfurl_id: string; } +// https://api.slack.com/methods/chat.unfurl export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArguments) & TokenOverridable & { /** @@ -1872,6 +1810,11 @@ export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArgu */ user_auth_blocks?: (KnownBlock | Block)[]; }; +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostEphemeralArguments +// https://api.slack.com/methods/chat.update export interface ChatUpdateArguments extends TokenOverridable { channel: string; ts: string; From 7e7b16c7449aa29fce50d5cd155a20441f41dc94 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:00:24 -0400 Subject: [PATCH 013/122] conversations and dialogs methods --- packages/web-api/src/methods.ts | 39 ++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index abc138b59..49d6a0c6f 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1832,91 +1832,116 @@ export interface ChatUpdateArguments extends TokenOverridable { /* * `conversations.*` */ +// TODO: breaking change: must provide either channel_id or invite_id +// https://api.slack.com/methods/conversations.acceptSharedInvite export interface ConversationsAcceptSharedInviteArguments extends TokenOverridable { channel_name: string; channel_id?: string; free_trial_accepted?: boolean; invite_id?: string; is_private?: boolean; - team_id?: string; + team_id?: string; // required if org token is used } +// https://api.slack.com/methods/conversations.approveSharedInvite export interface ConversationsApproveSharedInviteArguments extends TokenOverridable { invite_id: string; target_team?: string; } +// https://api.slack.com/methods/conversations.archive export interface ConversationsArchiveArguments extends TokenOverridable { channel: string; } +// https://api.slack.com/methods/conversations.close export interface ConversationsCloseArguments extends TokenOverridable { channel: string; } +// https://api.slack.com/methods/conversations.create export interface ConversationsCreateArguments extends TokenOverridable { name: string; is_private?: boolean; - team_id?: string; + team_id?: string; // required if org token is used } +// https://api.slack.com/methods/conversations.declineSharedInvite export interface ConversationsDeclineSharedInviteArguments extends TokenOverridable { invite_id: string; target_team?: string; } +// https://api.slack.com/methods/conversations.history export interface ConversationsHistoryArguments extends TokenOverridable, CursorPaginationEnabled, TimelinePaginationEnabled { channel: string; include_all_metadata?: boolean; } cursorPaginationEnabledMethods.add('conversations.history'); +// https://api.slack.com/methods/conversations.info export interface ConversationsInfoArguments extends TokenOverridable, LocaleAware { channel: string; include_num_members?: boolean; } +// https://api.slack.com/methods/conversations.invite export interface ConversationsInviteArguments extends TokenOverridable { channel: string; users: string; // comma-separated list of users } +// TODO: breaking change: either emails or user_ids must be provided +// https://api.slack.com/methods/conversations.inviteShared export interface ConversationsInviteSharedArguments extends TokenOverridable { channel: string; emails?: string[]; + external_limited?: boolean; user_ids?: string[]; } +// https://api.slack.com/methods/conversations.join export interface ConversationsJoinArguments extends TokenOverridable { channel: string; } +// https://api.slack.com/methods/conversations.kick export interface ConversationsKickArguments extends TokenOverridable { channel: string; user: string; } +// https://api.slack.com/methods/conversations.leave export interface ConversationsLeaveArguments extends TokenOverridable { channel: string; } +// https://api.slack.com/methods/conversations.list export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled { exclude_archived?: boolean; types?: string; // comma-separated list of conversation types - team_id?: string; + team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('conversations.list'); +// https://api.slack.com/methods/conversations.listConnectInvites export interface ConversationsListConnectInvitesArguments extends TokenOverridable { - count?: number; + count?: number; // lol we use `limit` everywhere else cursor?: string; - team_id?: string; + team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('conversations.listConnectInvites'); +// https://api.slack.com/methods/conversations.mark export interface ConversationsMarkArguments extends TokenOverridable { channel: string; ts: string; } +// https://api.slack.com/methods/conversations.members export interface ConversationsMembersArguments extends TokenOverridable, CursorPaginationEnabled { channel: string; } cursorPaginationEnabledMethods.add('conversations.members'); +// TODO: breaking change: must supply either channel or users +// https://api.slack.com/methods/conversations.open export interface ConversationsOpenArguments extends TokenOverridable { channel?: string; users?: string; // comma-separated list of users return_im?: boolean; + prevent_creation?: boolean; } +// https://api.slack.com/methods/conversations.rename export interface ConversationsRenameArguments extends TokenOverridable { channel: string; name: string; } +// https://api.slack.com/methods/conversations.replies export interface ConversationsRepliesArguments extends TokenOverridable, CursorPaginationEnabled, TimelinePaginationEnabled { channel: string; @@ -1924,14 +1949,17 @@ export interface ConversationsRepliesArguments extends TokenOverridable, CursorP include_all_metadata?: boolean; } cursorPaginationEnabledMethods.add('conversations.replies'); +// https://api.slack.com/methods/conversations.setPurpose export interface ConversationsSetPurposeArguments extends TokenOverridable { channel: string; purpose: string; } +// https://api.slack.com/methods/conversations.setTopic export interface ConversationsSetTopicArguments extends TokenOverridable { channel: string; topic: string; } +// https://api.slack.com/methods/conversations.unarchive export interface ConversationsUnarchiveArguments extends TokenOverridable { channel: string; } @@ -1939,6 +1967,7 @@ export interface ConversationsUnarchiveArguments extends TokenOverridable { /* * `dialog.*` */ +// https://api.slack.com/methods/dialog.open export interface DialogOpenArguments extends TokenOverridable { trigger_id: string; dialog: Dialog; From 4e0a73931c87798a6821f0079da188c4bf3919c6 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:04:53 -0400 Subject: [PATCH 014/122] dnd methods --- packages/web-api/src/methods.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 49d6a0c6f..ea17bf495 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1976,16 +1976,23 @@ export interface DialogOpenArguments extends TokenOverridable { /* * `dnd.*` */ +// https://api.slack.com/methods/dnd.endDnd export interface DndEndDndArguments extends TokenOverridable { } +// https://api.slack.com/methods/dnd.endSnooze export interface DndEndSnoozeArguments extends TokenOverridable { } +// https://api.slack.com/methods/dnd.info export interface DndInfoArguments extends TokenOverridable { - user: string; + user?: string; + team_id?: string; // required if org token is used } +// https://api.slack.com/methods/dnd.setSnooze export interface DndSetSnoozeArguments extends TokenOverridable { num_minutes: number; } +// https://api.slack.com/methods/dnd.teamInfo export interface DndTeamInfoArguments extends TokenOverridable { - users?: string; // comma-separated list of users + users: string; // comma-separated list of users + team_id?: string; // required if org token is used } /* From a3cfd8b47236eee85acab5424d3d0f7198d99307 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:31:38 -0400 Subject: [PATCH 015/122] files methods --- packages/web-api/src/methods.ts | 43 +++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index ea17bf495..98a29a64a 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1998,6 +1998,7 @@ export interface DndTeamInfoArguments extends TokenOverridable { /* * `emoji.*` */ +// https://api.slack.com/methods/emoji.list export interface EmojiListArguments extends TokenOverridable { include_categories?: boolean; } @@ -2005,15 +2006,16 @@ export interface EmojiListArguments extends TokenOverridable { /* * `files.*` */ +// https://api.slack.com/methods/files.delete export interface FilesDeleteArguments extends TokenOverridable { file: string; // file id } -export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEnabled { +// https://api.slack.com/methods/files.info +export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled { file: string; // file id - count?: number; - page?: number; } cursorPaginationEnabledMethods.add('files.info'); +// https://api.slack.com/methods/files.list export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled { channel?: string; user?: string; @@ -2021,17 +2023,21 @@ export interface FilesListArguments extends TokenOverridable, TraditionalPagingE ts_to?: string; types?: string; // comma-separated list of file types show_files_hidden_by_limit?: boolean; - team_id?: string; + team_id?: string; // required if org token is used } +// https://api.slack.com/methods/files.revokePublicURL export interface FilesRevokePublicURLArguments extends TokenOverridable { file: string; // file id } +// https://api.slack.com/methods/files.sharedPublicURL export interface FilesSharedPublicURLArguments extends TokenOverridable { file: string; // file id } /** * Legacy files.upload API files upload arguments */ +// TODO: breaking change: must provide content or file +// https://api.slack.com/methods/files.upload export interface FilesUploadArguments extends FileUpload, TokenOverridable {} interface FileUpload { channels?: string; // comma-separated list of channels @@ -2040,7 +2046,7 @@ interface FileUpload { filename?: string; filetype?: string; initial_comment?: string; - thread_ts?: string; // if specified, `channels` must be set + thread_ts?: string; // TODO: breaking change: if specified, `channels` must be set title?: string; } @@ -2068,7 +2074,7 @@ export interface FileUploadV2Job extends FileUploadV2, /** * Gets a URL for an edge external file upload. Method: - * {@link https://api.slack.com/methods/files.getUploadURLExternal files.getUploadURLExternal} + * @see {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal` API reference} */ export interface FilesGetUploadURLExternalArguments extends TokenOverridable { filename: string; @@ -2077,8 +2083,8 @@ export interface FilesGetUploadURLExternalArguments extends TokenOverridable { snippet_type?: string; } /** - * Finishes an upload started with files.getUploadURLExternal. Method: - * {@link https://api.slack.com/methods/files.completeUploadExternal files.completeUploadExternal} + * Finishes an upload started with {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal`}. + * @see {@link https://api.slack.com/methods/files.completeUploadExternal `files.completeUploadExternal` API reference} */ export interface FilesCompleteUploadExternalArguments extends TokenOverridable { files: FileUploadComplete[]; @@ -2090,50 +2096,55 @@ interface FileUploadComplete { id: string, // file id title?: string // filename } +// https://api.slack.com/methods/files.comments.delete export interface FilesCommentsDeleteArguments extends TokenOverridable { file: string; // file id id: string; // comment id } -// either file or external_id is required +// https://api.slack.com/methods/files.remote.info export interface FilesRemoteInfoArguments extends TokenOverridable { - // either one of the file or external_id arguments are required + // TODO: breaking change: either one of the file or external_id arguments are required + // This either/or relationship for files.remote.* APIs can be modeled once and re-used for all these methods file?: string; external_id?: string; } +// https://api.slack.com/methods/files.remote.list export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { ts_from?: string; ts_to?: string; channel?: string; } cursorPaginationEnabledMethods.add('files.remote.list'); +// https://api.slack.com/methods/files.remote.add export interface FilesRemoteAddArguments extends TokenOverridable { title: string; external_url: string; external_id: string; // a unique identifier for the file in your system - filetype: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types + filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types preview_image?: Buffer | Stream; indexable_file_contents?: Buffer | Stream; } +// https://api.slack.com/methods/files.remote.update export interface FilesRemoteUpdateArguments extends TokenOverridable { title?: string; external_url?: string; filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types preview_image?: Buffer | Stream; indexable_file_contents?: Buffer | Stream; - - // either one of the file or external_id arguments are required + // TODO: breaking change: either one of the file or external_id arguments are required file?: string; external_id?: string; } +// https://api.slack.com/methods/files.remote.remove export interface FilesRemoteRemoveArguments extends TokenOverridable { - // either one of the file or external_id arguments are required + // TODO: breaking change: either one of the file or external_id arguments are required file?: string; external_id?: string; } +// https://api.slack.com/methods/files.remote.share export interface FilesRemoteShareArguments extends TokenOverridable { channels: string; // comma-separated list of channel ids - - // either one of the file or external_id arguments are required + // TODO: breaking change: either one of the file or external_id arguments are required file?: string; external_id?: string; } From 124e5f618fb418bc0aa6ede374af570cd66d8424 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:34:32 -0400 Subject: [PATCH 016/122] remove deprecated groups.* methods. --- packages/web-api/src/methods.ts | 87 --------------------------------- 1 file changed, 87 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 98a29a64a..9f59debbb 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -866,26 +866,6 @@ export abstract class Methods extends EventEmitter { // --------------------------------- // Deprecated methods // --------------------------------- - - public readonly groups = { - archive: bindApiCall(this, 'groups.archive'), - create: bindApiCall(this, 'groups.create'), - createChild: bindApiCall(this, 'groups.createChild'), - history: bindApiCall(this, 'groups.history'), - info: bindApiCall(this, 'groups.info'), - invite: bindApiCall(this, 'groups.invite'), - kick: bindApiCall(this, 'groups.kick'), - leave: bindApiCall(this, 'groups.leave'), - list: bindApiCall(this, 'groups.list'), - mark: bindApiCall(this, 'groups.mark'), - open: bindApiCall(this, 'groups.open'), - rename: bindApiCall(this, 'groups.rename'), - replies: bindApiCall(this, 'groups.replies'), - setPurpose: bindApiCall(this, 'groups.setPurpose'), - setTopic: bindApiCall(this, 'groups.setTopic'), - unarchive: bindApiCall(this, 'groups.unarchive'), - }; - public readonly im = { close: bindApiCall(this, 'im.close'), history: bindApiCall(this, 'im.history'), @@ -2149,73 +2129,6 @@ export interface FilesRemoteShareArguments extends TokenOverridable { external_id?: string; } -/* - * `groups.*` - */ -export interface GroupsArchiveArguments extends TokenOverridable { - channel: string; -} -export interface GroupsCreateArguments extends TokenOverridable { - name: string; - validate?: boolean; - team_id?: string; -} -export interface GroupsCreateChildArguments extends TokenOverridable { - channel: string; -} -export interface GroupsHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { - channel: string; - unreads?: boolean; - count?: number; -} -export interface GroupsInfoArguments extends TokenOverridable, LocaleAware { - channel: string; -} -export interface GroupsInviteArguments extends TokenOverridable { - channel: string; - user: string; -} -export interface GroupsKickArguments extends TokenOverridable { - channel: string; - user: string; -} -export interface GroupsLeaveArguments extends TokenOverridable { - channel: string; -} -export interface GroupsListArguments extends TokenOverridable, CursorPaginationEnabled { - exclude_archived?: boolean; - exclude_members?: boolean; - team_id?: string; -} -cursorPaginationEnabledMethods.add('groups.list'); -export interface GroupsMarkArguments extends TokenOverridable { - channel: string; - ts: string; -} -export interface GroupsOpenArguments extends TokenOverridable { - channel: string; -} -export interface GroupsRenameArguments extends TokenOverridable { - channel: string; - name: string; - validate?: boolean; -} -export interface GroupsRepliesArguments extends TokenOverridable { - channel: string; - thread_ts: boolean; -} -export interface GroupsSetPurposeArguments extends TokenOverridable { - channel: string; - purpose: string; -} -export interface GroupsSetTopicArguments extends TokenOverridable { - channel: string; - topic: string; -} -export interface GroupsUnarchiveArguments extends TokenOverridable { - channel: string; -} - /* * `im.*` */ From 2bf4dc9574f907a534b6a3d2b0befcc0104ae623 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:35:37 -0400 Subject: [PATCH 017/122] remove deprecated im.* methods. --- packages/web-api/src/methods.ts | 35 --------------------------------- 1 file changed, 35 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 9f59debbb..edc1f506a 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -866,15 +866,6 @@ export abstract class Methods extends EventEmitter { // --------------------------------- // Deprecated methods // --------------------------------- - public readonly im = { - close: bindApiCall(this, 'im.close'), - history: bindApiCall(this, 'im.history'), - list: bindApiCall(this, 'im.list'), - mark: bindApiCall(this, 'im.mark'), - open: bindApiCall(this, 'im.open'), - replies: bindApiCall(this, 'im.replies'), - }; - public readonly mpim = { close: bindApiCall(this, 'mpim.close'), history: bindApiCall(this, 'mpim.history'), @@ -2129,32 +2120,6 @@ export interface FilesRemoteShareArguments extends TokenOverridable { external_id?: string; } -/* - * `im.*` - */ -export interface IMCloseArguments extends TokenOverridable { - channel: string; -} -export interface IMHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { - channel: string; - count?: number; - unreads?: boolean; -} -export interface IMListArguments extends TokenOverridable, CursorPaginationEnabled { } -cursorPaginationEnabledMethods.add('im.list'); -export interface IMMarkArguments extends TokenOverridable { - channel: string; - ts: string; -} -export interface IMOpenArguments extends TokenOverridable, LocaleAware { - user: string; - return_im?: boolean; -} -export interface IMRepliesArguments extends TokenOverridable { - channel: string; - thread_ts?: string; -} - /* * `migration.*` */ From b9c63c8710ddf51bafefdd00c65f5a501170dbf0 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:40:28 -0400 Subject: [PATCH 018/122] removed deprecated mpim.* methods. --- packages/web-api/src/methods.ts | 38 +-------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index edc1f506a..103392e9d 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -862,18 +862,6 @@ export abstract class Methods extends EventEmitter { stepFailed: bindApiCall(this, 'workflows.stepFailed'), updateStep: bindApiCall(this, 'workflows.updateStep'), }; - - // --------------------------------- - // Deprecated methods - // --------------------------------- - public readonly mpim = { - close: bindApiCall(this, 'mpim.close'), - history: bindApiCall(this, 'mpim.history'), - list: bindApiCall(this, 'mpim.list'), - mark: bindApiCall(this, 'mpim.mark'), - open: bindApiCall(this, 'mpim.open'), - replies: bindApiCall(this, 'mpim.replies'), - }; } /** @@ -2123,37 +2111,13 @@ export interface FilesRemoteShareArguments extends TokenOverridable { /* * `migration.*` */ +// https://api.slack.com/methods/migration.exchange export interface MigrationExchangeArguments extends TokenOverridable { users: string; // comma-separated list of users to_old?: boolean; team_id?: string; } -/* - * `mpim.*` - */ -export interface MPIMCloseArguments extends TokenOverridable { - channel: string; -} -export interface MPIMHistoryArguments extends TokenOverridable, TimelinePaginationEnabled { - channel: string; - count?: number; - unreads?: boolean; -} -export interface MPIMListArguments extends TokenOverridable, CursorPaginationEnabled { } -cursorPaginationEnabledMethods.add('mpim.list'); -export interface MPIMMarkArguments extends TokenOverridable { - channel: string; - ts: string; -} -export interface MPIMOpenArguments extends TokenOverridable { - users: string; // comma-separated list of users -} -export interface MPIMRepliesArguments extends TokenOverridable { - channel: string; - thread_ts: string; -} - /* * `oauth.*` */ From daed47df9553f9001e25dad2d2543f67e270b7d6 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:44:42 -0400 Subject: [PATCH 019/122] oauth methods --- packages/web-api/src/methods.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 103392e9d..f530a8097 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2121,22 +2121,25 @@ export interface MigrationExchangeArguments extends TokenOverridable { /* * `oauth.*` */ +// https://api.slack.com/methods/oauth.access +// TODO: this method is marked as a 'legacy' method; should we add it as a 'deprecated' method? export interface OAuthAccessArguments { - client_id: string; - client_secret: string; - code: string; + client_id: string; // TODO: docs state this is optional + client_secret: string; // TODO: docs state this is optional + code: string; // TODO: docs state this is optional redirect_uri?: string; - single_channel?: string; + single_channel?: string; // TODO: docs state this is a boolean, only valid for legacy apps } +// https://api.slack.com/methods/oauth.v2.access export interface OAuthV2AccessArguments { - client_id: string; - client_secret: string; + client_id: string; // TODO: docs state this is optional + client_secret: string; // TODO: docs state this is optional code?: string; // not required for token rotation redirect_uri?: string; grant_type?: string; refresh_token?: string; } - +// https://api.slack.com/methods/oauth.v2.exchange export interface OAuthV2ExchangeArguments { client_id: string; client_secret: string; From 202a321734a669e948788aaed9cf81e1e4cebf41 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:50:26 -0400 Subject: [PATCH 020/122] pin methods --- packages/web-api/src/methods.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index f530a8097..a64b8d6a8 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2148,15 +2148,16 @@ export interface OAuthV2ExchangeArguments { /* * `openid.connect.*` */ +// https://api.slack.com/methods/openid.connect.token export interface OpenIDConnectTokenArguments { - client_id: string; - client_secret: string; + client_id: string; // TODO: docs state this is optional + client_secret: string; // TODO: docs state this is optional code?: string; redirect_uri?: string; grant_type?: 'authorization_code' | 'refresh_token'; refresh_token?: string; } - +// https://api.slack.com/methods/openid.connect.userInfo // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface OpenIDConnectUserInfoArguments { } @@ -2164,13 +2165,17 @@ export interface OpenIDConnectUserInfoArguments { /* * `pins.*` */ +// TODO: there's a quip_component_id parameter documented publicly but probably we shouldnt expose just yet +// https://api.slack.com/methods/pins.add export interface PinsAddArguments extends TokenOverridable { channel: string; timestamp: string; } +// https://api.slack.com/methods/pins.list export interface PinsListArguments extends TokenOverridable { channel: string; } +// https://api.slack.com/methods/pins.remove export interface PinsRemoveArguments extends TokenOverridable { channel: string; timestamp: string; From 4fca944bebeda3b8a8f715e3f24387dcff947e61 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 15:55:11 -0400 Subject: [PATCH 021/122] reaction methods --- packages/web-api/src/methods.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index a64b8d6a8..2d1ee4fba 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2184,14 +2184,14 @@ export interface PinsRemoveArguments extends TokenOverridable { /* * `reactions.*` */ +// https://api.slack.com/methods/reactions.add export interface ReactionsAddArguments extends TokenOverridable { name: string; - // must supply one of: - channel?: string; // paired with timestamp - timestamp?: string; // paired with channel - file?: string; // file id - file_comment?: string; + channel: string; + timestamp: string; } +// TODO: must supply either channel and timestamp or a file id or file comment id +// https://api.slack.com/methods/reactions.get export interface ReactionsGetArguments extends TokenOverridable { full?: boolean; // must supply one of: @@ -2200,13 +2200,16 @@ export interface ReactionsGetArguments extends TokenOverridable { file?: string; // file id file_comment?: string; } +// https://api.slack.com/methods/reactions.list export interface ReactionsListArguments extends TokenOverridable, TraditionalPagingEnabled, CursorPaginationEnabled { user?: string; full?: boolean; - team_id?: string; + team_id?: string; // required with org token } cursorPaginationEnabledMethods.add('reactions.list'); +// TODO: must supply either channel and timestamp or a file id or file comment id +// https://api.slack.com/methods/reactions.remove export interface ReactionsRemoveArguments extends TokenOverridable { name: string; // must supply one of: From d64c44d593182cbb1fc4feaf06da0f8856082b9a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:12:25 -0400 Subject: [PATCH 022/122] audit reminders methods and factor out optional team id into own mixin. --- packages/web-api/src/methods.ts | 70 ++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2d1ee4fba..cade73143 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -875,7 +875,7 @@ export default interface Method< } /* - * Reusable 'protocols' that some MethodArguments types can conform to + * Reusable mixins or extensions that some MethodArguments types can extend from */ export interface TokenOverridable { token?: string; @@ -885,12 +885,15 @@ export interface LocaleAware { include_locale?: boolean; } -export interface Searchable { +interface OptionalTeamAssignable { + team_id?: string; // typically models the "team_id is required if org token is used" constraint +} + +export interface Searchable extends OptionalTeamAssignable { query: string; highlight?: boolean; sort: 'score' | 'timestamp'; sort_dir: 'asc' | 'desc'; - team_id?: string; } // A set of method names is initialized here and added to each time an argument type extends the CursorPaginationEnabled @@ -1540,9 +1543,8 @@ export interface AuthTestArguments extends TokenOverridable { } * `bots.*` */ // https://api.slack.com/methods/bots.info -export interface BotsInfoArguments extends TokenOverridable { +export interface BotsInfoArguments extends TokenOverridable, OptionalTeamAssignable { bot?: string; - team_id?: string; } /* @@ -1690,7 +1692,7 @@ export interface ChatPostMessageArguments extends TokenOverridable { // for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 // Many of these arguments can be shared with ChatPostEphemeralArguments // https://api.slack.com/methods/chat.scheduleMessage -export interface ChatScheduleMessageArguments extends TokenOverridable { +export interface ChatScheduleMessageArguments extends TokenOverridable, OptionalTeamAssignable { channel: string; text?: string; post_at: string | number; @@ -1704,15 +1706,13 @@ export interface ChatScheduleMessageArguments extends TokenOverridable { thread_ts?: string; unfurl_links?: boolean; unfurl_media?: boolean; - team_id?: string; } // https://api.slack.com/methods/chat.scheduledMessages.list export interface ChatScheduledMessagesListArguments extends TokenOverridable, - CursorPaginationEnabled { + CursorPaginationEnabled, OptionalTeamAssignable { channel?: string; latest?: number; oldest?: number; - team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('chat.scheduledMessages.list'); // ChannelAndTS and SourceAndUnfurlID are used as either-or mixins for ChatUnfurlArguments @@ -1793,13 +1793,12 @@ export interface ChatUpdateArguments extends TokenOverridable { */ // TODO: breaking change: must provide either channel_id or invite_id // https://api.slack.com/methods/conversations.acceptSharedInvite -export interface ConversationsAcceptSharedInviteArguments extends TokenOverridable { +export interface ConversationsAcceptSharedInviteArguments extends TokenOverridable, OptionalTeamAssignable { channel_name: string; channel_id?: string; free_trial_accepted?: boolean; invite_id?: string; is_private?: boolean; - team_id?: string; // required if org token is used } // https://api.slack.com/methods/conversations.approveSharedInvite export interface ConversationsApproveSharedInviteArguments extends TokenOverridable { @@ -1815,10 +1814,9 @@ export interface ConversationsCloseArguments extends TokenOverridable { channel: string; } // https://api.slack.com/methods/conversations.create -export interface ConversationsCreateArguments extends TokenOverridable { +export interface ConversationsCreateArguments extends TokenOverridable, OptionalTeamAssignable { name: string; is_private?: boolean; - team_id?: string; // required if org token is used } // https://api.slack.com/methods/conversations.declineSharedInvite export interface ConversationsDeclineSharedInviteArguments extends TokenOverridable { @@ -1864,17 +1862,15 @@ export interface ConversationsLeaveArguments extends TokenOverridable { channel: string; } // https://api.slack.com/methods/conversations.list -export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled { +export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { exclude_archived?: boolean; types?: string; // comma-separated list of conversation types - team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('conversations.list'); // https://api.slack.com/methods/conversations.listConnectInvites -export interface ConversationsListConnectInvitesArguments extends TokenOverridable { +export interface ConversationsListConnectInvitesArguments extends TokenOverridable, OptionalTeamAssignable { count?: number; // lol we use `limit` everywhere else cursor?: string; - team_id?: string; // required if org token is used } cursorPaginationEnabledMethods.add('conversations.listConnectInvites'); // https://api.slack.com/methods/conversations.mark @@ -1940,18 +1936,16 @@ export interface DndEndDndArguments extends TokenOverridable { } // https://api.slack.com/methods/dnd.endSnooze export interface DndEndSnoozeArguments extends TokenOverridable { } // https://api.slack.com/methods/dnd.info -export interface DndInfoArguments extends TokenOverridable { +export interface DndInfoArguments extends TokenOverridable, OptionalTeamAssignable { user?: string; - team_id?: string; // required if org token is used } // https://api.slack.com/methods/dnd.setSnooze export interface DndSetSnoozeArguments extends TokenOverridable { num_minutes: number; } // https://api.slack.com/methods/dnd.teamInfo -export interface DndTeamInfoArguments extends TokenOverridable { +export interface DndTeamInfoArguments extends TokenOverridable, OptionalTeamAssignable { users: string; // comma-separated list of users - team_id?: string; // required if org token is used } /* @@ -1975,14 +1969,13 @@ export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEn } cursorPaginationEnabledMethods.add('files.info'); // https://api.slack.com/methods/files.list -export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled { +export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled, OptionalTeamAssignable { channel?: string; user?: string; ts_from?: string; ts_to?: string; types?: string; // comma-separated list of file types show_files_hidden_by_limit?: boolean; - team_id?: string; // required if org token is used } // https://api.slack.com/methods/files.revokePublicURL export interface FilesRevokePublicURLArguments extends TokenOverridable { @@ -2112,10 +2105,9 @@ export interface FilesRemoteShareArguments extends TokenOverridable { * `migration.*` */ // https://api.slack.com/methods/migration.exchange -export interface MigrationExchangeArguments extends TokenOverridable { +export interface MigrationExchangeArguments extends TokenOverridable, OptionalTeamAssignable { users: string; // comma-separated list of users to_old?: boolean; - team_id?: string; } /* @@ -2202,10 +2194,9 @@ export interface ReactionsGetArguments extends TokenOverridable { } // https://api.slack.com/methods/reactions.list export interface ReactionsListArguments extends TokenOverridable, TraditionalPagingEnabled, - CursorPaginationEnabled { + CursorPaginationEnabled, OptionalTeamAssignable { user?: string; full?: boolean; - team_id?: string; // required with org token } cursorPaginationEnabledMethods.add('reactions.list'); // TODO: must supply either channel and timestamp or a file id or file comment id @@ -2222,21 +2213,36 @@ export interface ReactionsRemoveArguments extends TokenOverridable { /* * `reminders.*` */ -export interface RemindersAddArguments extends TokenOverridable { +interface ReminderRecurrenceDailyMonthlyYearly { + frequency: 'daily' | 'monthly' | 'yearly'; +} +type DaysOfTheWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'; +interface ReminderRecurrenceWeekly { + frequency: 'weekly'; + weekdays: [DaysOfTheWeek, ...DaysOfTheWeek[]] +} +type ReminderRecurrence = ReminderRecurrenceWeekly | ReminderRecurrenceDailyMonthlyYearly; +// https://api.slack.com/methods/reminders.add +export interface RemindersAddArguments extends TokenOverridable, OptionalTeamAssignable { text: string; time: string | number; user?: string; + recurrence?: ReminderRecurrence; } -export interface RemindersCompleteArguments extends TokenOverridable { +// https://api.slack.com/methods/reminders.complete +export interface RemindersCompleteArguments extends TokenOverridable, OptionalTeamAssignable { reminder: string; } -export interface RemindersDeleteArguments extends TokenOverridable { +// https://api.slack.com/methods/reminders.delete +export interface RemindersDeleteArguments extends TokenOverridable, OptionalTeamAssignable { reminder: string; } -export interface RemindersInfoArguments extends TokenOverridable { +// https://api.slack.com/methods/reminders.info +export interface RemindersInfoArguments extends TokenOverridable, OptionalTeamAssignable { reminder: string; } -export interface RemindersListArguments extends TokenOverridable { } +// https://api.slack.com/methods/reminders.list +export interface RemindersListArguments extends TokenOverridable, OptionalTeamAssignable { } /* * `rtm.*` From fd173144f06105356a403a1a980dbb1b7466424e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:24:45 -0400 Subject: [PATCH 023/122] rtm methods --- packages/web-api/src/methods.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index cade73143..a94ce75b9 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2247,15 +2247,17 @@ export interface RemindersListArguments extends TokenOverridable, OptionalTeamAs /* * `rtm.*` */ +// https://api.slack.com/methods/rtm.connect export interface RTMConnectArguments extends TokenOverridable { batch_presence_aware?: boolean; presence_sub?: boolean; } +// https://api.slack.com/methods/rtm.start export interface RTMStartArguments extends TokenOverridable, LocaleAware { batch_presence_aware?: boolean; mpim_aware?: boolean; no_latest?: '0' | '1'; - no_unreads?: string; + no_unreads?: string; // TODO: docs say this is a boolean presence_sub?: boolean; simple_latest?: boolean; } From 6813605023b13ea803b65045e57d0992a2e047eb Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:26:29 -0400 Subject: [PATCH 024/122] search methods --- packages/web-api/src/methods.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index a94ce75b9..a1dee944b 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2265,10 +2265,13 @@ export interface RTMStartArguments extends TokenOverridable, LocaleAware { /* * `search.*` */ +// https://api.slack.com/methods/search.all export interface SearchAllArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } +// https://api.slack.com/methods/search.files export interface SearchFilesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } +// https://api.slack.com/methods/search.messages export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } From 6d26fdae5f8bfb24958220419874d4ac75ad6f63 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:32:59 -0400 Subject: [PATCH 025/122] stars methods --- packages/web-api/src/methods.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index a1dee944b..e92b77a2d 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2275,25 +2275,31 @@ export interface SearchFilesArguments extends TokenOverridable, TraditionalPagin export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable { } +// TODO: usage info for stars.add recommends retiring use of any stars APIs +// https://api.slack.com/methods/stars.add#markdown +// should we mark these methods as deprecated? /* * `stars.*` */ +// https://api.slack.com/methods/stars.add export interface StarsAddArguments extends TokenOverridable { - // must supply one of: - channel?: string; // paired with `timestamp` + // TODO: breaking change: must supply one of: + channel?: string; // optionally paired with `timestamp` timestamp?: string; // paired with `channel` file?: string; // file id - file_comment?: string; + file_comment?: string; // file comment id } +// https://api.slack.com/methods/stars.list export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, - CursorPaginationEnabled { } + CursorPaginationEnabled, OptionalTeamAssignable { } cursorPaginationEnabledMethods.add('stars.list'); +// https://api.slack.com/methods/stars.remove export interface StarsRemoveArguments extends TokenOverridable { - // must supply one of: - channel?: string; // paired with `timestamp` + // TODO: breaking change: must supply one of: + channel?: string; // optionally paired with `timestamp` timestamp?: string; // paired with `channel` file?: string; // file id - file_comment?: string; + file_comment?: string; // file comment id } /* From a526bec727dbf137ea8748bfe471f4189f9e0cee Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:45:07 -0400 Subject: [PATCH 026/122] team methods --- packages/web-api/src/methods.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index e92b77a2d..dc42b42ab 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2305,41 +2305,42 @@ export interface StarsRemoveArguments extends TokenOverridable { /* * `team.*` */ -export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled { +// https://api.slack.com/methods/team.accessLogs +export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled, + TraditionalPagingEnabled, OptionalTeamAssignable { before?: number; - count?: number; - page?: number; - team_id?: string; } cursorPaginationEnabledMethods.add('team.accessLogs'); - -export interface TeamBillableInfoArguments extends TokenOverridable { +// https://api.slack.com/methods/team.billableInfo +export interface TeamBillableInfoArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { user?: string; - team_id?: string; } +// https://api.slack.com/methods/team.billing.info export interface TeamBillingInfoArguments extends TokenOverridable { + domain?: string; + team?: string; } +// https://api.slack.com/methods/team.info export interface TeamInfoArguments extends TokenOverridable { // Team to get info on, if omitted, will return information about the current team. // Will only return team that the authenticated token is allowed to see through external shared channels team?: string; domain?: string; // available only for Enterprise Grid } -export interface TeamIntegrationLogsArguments extends TokenOverridable { +// https://api.slack.com/methods/team.integrationLogs +export interface TeamIntegrationLogsArguments extends TokenOverridable, + OptionalTeamAssignable, TraditionalPagingEnabled { app_id?: string; - change_type?: string; // TODO: list types: 'x' | 'y' | 'z' - count?: number; - page?: number; + change_type?: 'added' | 'removed' | 'enabled' | 'disabled' | 'updated'; service_id?: string; user?: string; - team_id?: string; } +// https://api.slack.com/methods/team.profile.get export interface TeamProfileGetArguments extends TokenOverridable { visibility?: 'all' | 'visible' | 'hidden'; - team_id?: string; -} -export interface TeamPreferencesListArguments extends TokenOverridable { } +// https://api.slack.com/methods/team.preferences.list +export interface TeamPreferencesListArguments extends TokenOverridable { } /* * `usergroups.*` From 6afd88ac07c3f8a2a95a9f61a4053ba2b3d5c5ef Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 16:52:18 -0400 Subject: [PATCH 027/122] usergroups methods --- packages/web-api/src/methods.ts | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index dc42b42ab..666b23d7b 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2345,39 +2345,46 @@ export interface TeamPreferencesListArguments extends TokenOverridable { } /* * `usergroups.*` */ -export interface UsergroupsCreateArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.create +export interface UsergroupsCreateArguments extends TokenOverridable, OptionalTeamAssignable { name: string; - channels?: string; // comma-separated list of channels + channels?: string; // comma-separated list of channels, TODO: docs say this is an array description?: string; handle?: string; include_count?: boolean; } -export interface UsergroupsDisableArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.disable +export interface UsergroupsDisableArguments extends TokenOverridable, OptionalTeamAssignable { usergroup: string; include_count?: boolean; } -export interface UsergroupsEnableArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.enable +export interface UsergroupsEnableArguments extends TokenOverridable, OptionalTeamAssignable { usergroup: string; include_count?: boolean; } -export interface UsergroupsListArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.list +export interface UsergroupsListArguments extends TokenOverridable, OptionalTeamAssignable { include_count?: boolean; include_disabled?: boolean; include_users?: boolean; } -export interface UsergroupsUpdateArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.update +export interface UsergroupsUpdateArguments extends TokenOverridable, OptionalTeamAssignable { usergroup: string; - channels?: string; // comma-separated list of channels + channels?: string; // comma-separated list of channels, TODO: docs say this is an array description?: string; handle?: string; include_count?: boolean; name?: string; } -export interface UsergroupsUsersListArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.users.list +export interface UsergroupsUsersListArguments extends TokenOverridable, OptionalTeamAssignable { usergroup: string; include_disabled?: boolean; } -export interface UsergroupsUsersUpdateArguments extends TokenOverridable { +// https://api.slack.com/methods/usergroups.users.update +export interface UsergroupsUsersUpdateArguments extends TokenOverridable, OptionalTeamAssignable { usergroup: string; users: string; // comma-separated list of users include_count?: boolean; @@ -2429,6 +2436,9 @@ export interface UsersProfileSetArguments extends TokenOverridable { value?: string; // usable if `profile` is not passed } +/* + * `views.*` + */ export interface ViewsOpenArguments extends TokenOverridable { trigger_id: string; view: View; From 0a2692da01c502dfd5604da6f4e92fe98289e5ce Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 17:00:05 -0400 Subject: [PATCH 028/122] users methods --- packages/web-api/src/methods.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 666b23d7b..2f1ea09dc 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2393,45 +2393,54 @@ export interface UsergroupsUsersUpdateArguments extends TokenOverridable, Option /* * `users.*` */ -export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled { +// https://api.slack.com/methods/users.conversations +export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { exclude_archived?: boolean; types?: string; // comma-separated list of conversation types user?: string; - team_id?: string; } cursorPaginationEnabledMethods.add('users.conversations'); +// https://api.slack.com/methods/users.deletePhoto export interface UsersDeletePhotoArguments extends TokenOverridable { } +// https://api.slack.com/methods/users.getPresence export interface UsersGetPresenceArguments extends TokenOverridable { - user: string; + user?: string; } +// https://api.slack.com/methods/users.identity export interface UsersIdentityArguments extends TokenOverridable { } +// https://api.slack.com/methods/users.info export interface UsersInfoArguments extends TokenOverridable, LocaleAware { user: string; } -export interface UsersListArguments extends TokenOverridable, CursorPaginationEnabled, LocaleAware { - presence?: boolean; // deprecated, defaults to false - team_id?: string; -} +// https://api.slack.com/methods/users.list +export interface UsersListArguments extends TokenOverridable, CursorPaginationEnabled, + LocaleAware, OptionalTeamAssignable { } cursorPaginationEnabledMethods.add('users.list'); +// https://api.slack.com/methods/users.lookupByEmail export interface UsersLookupByEmailArguments extends TokenOverridable { email: string; } +// https://api.slack.com/methods/users.setPhoto export interface UsersSetPhotoArguments extends TokenOverridable { image: Buffer | Stream; crop_w?: number; crop_x?: number; crop_y?: number; } +// https://api.slack.com/methods/users.setPresence export interface UsersSetPresenceArguments extends TokenOverridable { presence: 'auto' | 'away'; } +// https://api.slack.com/methods/users.profile.get export interface UsersProfileGetArguments extends TokenOverridable { include_labels?: boolean; user?: string; } +// TODO: breaking change: either profile or name/value pair must be provided +// https://api.slack.com/methods/users.profile.set export interface UsersProfileSetArguments extends TokenOverridable { profile?: string; // url-encoded json - user?: string; + user?: string; // must be an admin user and must be on a paid plan name?: string; // usable if `profile` is not passed value?: string; // usable if `profile` is not passed } From 75ef263ce26adbd49c253a8f7edc82889ccc72c5 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 17:12:12 -0400 Subject: [PATCH 029/122] views methods --- packages/web-api/src/methods.ts | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2f1ea09dc..bc0156985 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2448,28 +2448,34 @@ export interface UsersProfileSetArguments extends TokenOverridable { /* * `views.*` */ -export interface ViewsOpenArguments extends TokenOverridable { - trigger_id: string; +interface BaseViewsArguments { view: View; } - -export interface ViewsPushArguments extends TokenOverridable { +interface ViewTriggerId { trigger_id: string; - view: View; } - -export interface ViewsPublishArguments extends TokenOverridable { +interface ViewInteractivityPointer { + interactivity_pointer: string; +} +// https://api.slack.com/methods/views.open +export type ViewsOpenArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); +// https://api.slack.com/methods/views.push +export type ViewsPushArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); +// https://api.slack.com/methods/views.publish +export interface ViewsPublishArguments extends BaseViewsArguments, TokenOverridable { user_id: string; - view: View; hash?: string; } - -export interface ViewsUpdateArguments extends TokenOverridable { - view_id?: string; - view: View; - external_id?: string; - hash?: string; +interface ViewExternalId { + external_id: string; } +interface ViewViewId { + view_id: string; +} +// https://api.slack.com/methods/views.update +export type ViewsUpdateArguments = BaseViewsArguments & TokenOverridable & (ViewExternalId | ViewViewId) & { + hash?: string; +}; /* * `workflows.*` From 9dea3ab221482030d8f043cee3c54c633a8b27b6 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 18 Oct 2023 17:14:19 -0400 Subject: [PATCH 030/122] workflows methods --- packages/web-api/src/methods.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index bc0156985..76d313f3a 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2477,21 +2477,23 @@ export type ViewsUpdateArguments = BaseViewsArguments & TokenOverridable & (View hash?: string; }; +// TODO: docs state workflows.* methods are deprecated. should we mark them as such? /* * `workflows.*` */ +// https://api.slack.com/methods/workflows.stepCompleted export interface WorkflowsStepCompletedArguments extends TokenOverridable { workflow_step_execute_id: string; outputs?: Record; } - +// https://api.slack.com/methods/workflows.stepFailed export interface WorkflowsStepFailedArguments extends TokenOverridable { workflow_step_execute_id: string; error: { message: string; }; } - +// https://api.slack.com/methods/workflows.updateStep export interface WorkflowsUpdateStepArguments extends TokenOverridable { workflow_step_edit_id: string; step_image_url?: string; From 6ce56f342bdf44c0014fc0552766ee81710b9ee4 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 19 Oct 2023 17:00:43 -0400 Subject: [PATCH 031/122] Remove unnecessary comment. --- packages/web-api/src/methods.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 76d313f3a..3210ba57f 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -997,7 +997,7 @@ cursorPaginationEnabledMethods.add('admin.apps.restricted.list'); // https://api.slack.com/methods/admin.apps.uninstall export interface AdminAppsUninstallArguments { app_id: string; - enterprise_id?: string; // TODO: breaking change, enforce at least one array item? + enterprise_id?: string; team_ids?: string[]; // TODO: breaking change, enforce at least one array item? } // https://api.slack.com/methods/admin.apps.activities.list From f17255110662deef7c6b82f56ad22f1acb8ed933 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 19 Oct 2023 17:05:25 -0400 Subject: [PATCH 032/122] Address a comment. --- packages/web-api/src/methods.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 3210ba57f..233ec6249 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2120,7 +2120,7 @@ export interface OAuthAccessArguments { client_secret: string; // TODO: docs state this is optional code: string; // TODO: docs state this is optional redirect_uri?: string; - single_channel?: string; // TODO: docs state this is a boolean, only valid for legacy apps + single_channel?: boolean; } // https://api.slack.com/methods/oauth.v2.access export interface OAuthV2AccessArguments { From 8766ead3dedfaaa840e899009a93d693306add27 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 14:13:06 -0400 Subject: [PATCH 033/122] move web-api response types to a types subdir, so we can reach into them without triggering import/no-internal-modules eslint warning. --- .../response/AdminAnalyticsGetFileResponse.ts | 2 +- .../AdminAppsActivitiesListResponse.ts | 4 +- .../response/AdminAppsApproveResponse.ts | 2 +- .../response/AdminAppsApprovedListResponse.ts | 2 +- .../AdminAppsClearResolutionResponse.ts | 2 +- .../response/AdminAppsConfigLookupResponse.ts | 2 +- .../response/AdminAppsConfigSetResponse.ts | 2 +- .../AdminAppsRequestsCancelResponse.ts | 2 +- .../response/AdminAppsRequestsListResponse.ts | 2 +- .../response/AdminAppsRestrictResponse.ts | 2 +- .../AdminAppsRestrictedListResponse.ts | 2 +- .../response/AdminAppsUninstallResponse.ts | 2 +- .../AdminAuthPolicyAssignEntitiesResponse.ts | 2 +- .../AdminAuthPolicyGetEntitiesResponse.ts | 2 +- .../AdminAuthPolicyRemoveEntitiesResponse.ts | 2 +- .../response/AdminBarriersCreateResponse.ts | 2 +- .../response/AdminBarriersDeleteResponse.ts | 2 +- .../response/AdminBarriersListResponse.ts | 2 +- .../response/AdminBarriersUpdateResponse.ts | 2 +- .../AdminConversationsArchiveResponse.ts | 2 +- .../AdminConversationsBulkArchiveResponse.ts | 2 +- .../AdminConversationsBulkDeleteResponse.ts | 2 +- .../AdminConversationsBulkMoveResponse.ts | 2 +- ...inConversationsConvertToPrivateResponse.ts | 2 +- ...minConversationsConvertToPublicResponse.ts | 2 +- .../AdminConversationsCreateResponse.ts | 2 +- .../AdminConversationsDeleteResponse.ts | 2 +- ...inConversationsDisconnectSharedResponse.ts | 2 +- ...istOriginalConnectedChannelInfoResponse.ts | 2 +- ...nversationsGetConversationPrefsResponse.ts | 2 +- ...ConversationsGetCustomRetentionResponse.ts | 2 +- .../AdminConversationsGetTeamsResponse.ts | 2 +- .../AdminConversationsInviteResponse.ts | 2 +- .../AdminConversationsLookupResponse.ts | 2 +- ...versationsRemoveCustomRetentionResponse.ts | 2 +- .../AdminConversationsRenameResponse.ts | 2 +- ...ersationsRestrictAccessAddGroupResponse.ts | 2 +- ...sationsRestrictAccessListGroupsResponse.ts | 2 +- ...ationsRestrictAccessRemoveGroupResponse.ts | 2 +- .../AdminConversationsSearchResponse.ts | 2 +- ...nversationsSetConversationPrefsResponse.ts | 2 +- ...ConversationsSetCustomRetentionResponse.ts | 2 +- .../AdminConversationsSetTeamsResponse.ts | 2 +- .../AdminConversationsUnarchiveResponse.ts | 2 +- .../AdminConversationsWhitelistAddResponse.ts | 2 +- ...telistListGroupsLinkedToChannelResponse.ts | 2 +- ...minConversationsWhitelistRemoveResponse.ts | 2 +- .../response/AdminEmojiAddAliasResponse.ts | 2 +- .../response/AdminEmojiAddResponse.ts | 2 +- .../response/AdminEmojiListResponse.ts | 2 +- .../response/AdminEmojiRemoveResponse.ts | 2 +- .../response/AdminEmojiRenameResponse.ts | 2 +- .../response/AdminFunctionsListResponse.ts | 2 +- ...AdminFunctionsPermissionsLookupResponse.ts | 2 +- .../AdminFunctionsPermissionsSetResponse.ts | 2 +- .../AdminInviteRequestsApproveResponse.ts | 2 +- ...AdminInviteRequestsApprovedListResponse.ts | 2 +- .../AdminInviteRequestsDeniedListResponse.ts | 2 +- .../AdminInviteRequestsDenyResponse.ts | 2 +- .../AdminInviteRequestsListResponse.ts | 2 +- .../AdminRolesAddAssignmentsResponse.ts | 2 +- .../AdminRolesListAssignmentsResponse.ts | 2 +- .../AdminRolesRemoveAssignmentsResponse.ts | 2 +- .../response/AdminTeamsAdminsListResponse.ts | 2 +- .../response/AdminTeamsCreateResponse.ts | 2 +- .../response/AdminTeamsListResponse.ts | 2 +- .../response/AdminTeamsOwnersListResponse.ts | 2 +- .../AdminTeamsSettingsInfoResponse.ts | 2 +- ...TeamsSettingsSetDefaultChannelsResponse.ts | 2 +- ...dminTeamsSettingsSetDescriptionResponse.ts | 2 +- ...TeamsSettingsSetDiscoverabilityResponse.ts | 2 +- .../AdminTeamsSettingsSetIconResponse.ts | 2 +- .../AdminTeamsSettingsSetNameResponse.ts | 2 +- .../AdminUsergroupsAddChannelsResponse.ts | 2 +- .../AdminUsergroupsAddTeamsResponse.ts | 2 +- .../AdminUsergroupsListChannelsResponse.ts | 2 +- .../AdminUsergroupsRemoveChannelsResponse.ts | 2 +- .../response/AdminUsersAssignResponse.ts | 2 +- .../response/AdminUsersInviteResponse.ts | 2 +- .../response/AdminUsersListResponse.ts | 2 +- .../response/AdminUsersRemoveResponse.ts | 2 +- .../AdminUsersSessionClearSettingsResponse.ts | 2 +- .../AdminUsersSessionGetSettingsResponse.ts | 2 +- .../AdminUsersSessionInvalidateResponse.ts | 2 +- .../response/AdminUsersSessionListResponse.ts | 2 +- .../AdminUsersSessionResetBulkResponse.ts | 2 +- .../AdminUsersSessionResetResponse.ts | 2 +- .../AdminUsersSessionSetSettingsResponse.ts | 2 +- .../response/AdminUsersSetAdminResponse.ts | 2 +- .../AdminUsersSetExpirationResponse.ts | 2 +- .../response/AdminUsersSetOwnerResponse.ts | 2 +- .../response/AdminUsersSetRegularResponse.ts | 2 +- ...nUsersUnsupportedVersionsExportResponse.ts | 2 +- .../AdminWorkflowsCollaboratorsAddResponse.ts | 2 +- ...minWorkflowsCollaboratorsRemoveResponse.ts | 2 +- ...AdminWorkflowsPermissionsLookupResponse.ts | 2 +- .../response/AdminWorkflowsSearchResponse.ts | 2 +- .../AdminWorkflowsUnpublishResponse.ts | 2 +- .../{ => types}/response/ApiTestResponse.ts | 2 +- .../response/AppsConnectionsOpenResponse.ts | 2 +- .../AppsEventAuthorizationsListResponse.ts | 2 +- .../response/AppsPermissionsInfoResponse.ts | 2 +- .../AppsPermissionsRequestResponse.ts | 2 +- .../AppsPermissionsResourcesListResponse.ts | 2 +- .../AppsPermissionsScopesListResponse.ts | 2 +- .../AppsPermissionsUsersListResponse.ts | 2 +- .../AppsPermissionsUsersRequestResponse.ts | 2 +- .../response/AppsUninstallResponse.ts | 2 +- .../response/AuthRevokeResponse.ts | 2 +- .../response/AuthTeamsListResponse.ts | 2 +- .../{ => types}/response/AuthTestResponse.ts | 2 +- .../response/BookmarksAddResponse.ts | 2 +- .../response/BookmarksEditResponse.ts | 2 +- .../response/BookmarksListResponse.ts | 2 +- .../response/BookmarksRemoveResponse.ts | 2 +- .../{ => types}/response/BotsInfoResponse.ts | 2 +- .../{ => types}/response/CallsAddResponse.ts | 2 +- .../{ => types}/response/CallsEndResponse.ts | 2 +- .../{ => types}/response/CallsInfoResponse.ts | 2 +- .../response/CallsParticipantsAddResponse.ts | 2 +- .../CallsParticipantsRemoveResponse.ts | 2 +- .../response/CallsUpdateResponse.ts | 2 +- .../response/ChannelsArchiveResponse.ts | 2 +- .../response/ChannelsCreateResponse.ts | 2 +- .../response/ChannelsHistoryResponse.ts | 2 +- .../response/ChannelsInfoResponse.ts | 2 +- .../response/ChannelsInviteResponse.ts | 2 +- .../response/ChannelsJoinResponse.ts | 2 +- .../response/ChannelsKickResponse.ts | 2 +- .../response/ChannelsLeaveResponse.ts | 2 +- .../response/ChannelsListResponse.ts | 2 +- .../response/ChannelsMarkResponse.ts | 2 +- .../response/ChannelsRenameResponse.ts | 2 +- .../response/ChannelsRepliesResponse.ts | 2 +- .../response/ChannelsSetPurposeResponse.ts | 2 +- .../response/ChannelsSetTopicResponse.ts | 2 +- .../response/ChannelsUnarchiveResponse.ts | 2 +- .../response/ChatDeleteResponse.ts | 2 +- .../ChatDeleteScheduledMessageResponse.ts | 2 +- .../response/ChatGetPermalinkResponse.ts | 2 +- .../response/ChatMeMessageResponse.ts | 2 +- .../response/ChatPostEphemeralResponse.ts | 2 +- .../response/ChatPostMessageResponse.ts | 19 ++++- .../response/ChatScheduleMessageResponse.ts | 9 ++- .../ChatScheduledMessagesListResponse.ts | 2 +- .../response/ChatUnfurlResponse.ts | 2 +- .../response/ChatUpdateResponse.ts | 17 ++++- ...ConversationsAcceptSharedInviteResponse.ts | 2 +- ...onversationsApproveSharedInviteResponse.ts | 2 +- .../response/ConversationsArchiveResponse.ts | 2 +- .../response/ConversationsCloseResponse.ts | 2 +- .../response/ConversationsCreateResponse.ts | 2 +- ...onversationsDeclineSharedInviteResponse.ts | 2 +- .../response/ConversationsHistoryResponse.ts | 19 ++++- .../response/ConversationsInfoResponse.ts | 2 +- .../response/ConversationsInviteResponse.ts | 2 +- .../ConversationsInviteSharedResponse.ts | 2 +- .../response/ConversationsJoinResponse.ts | 2 +- .../response/ConversationsKickResponse.ts | 2 +- .../response/ConversationsLeaveResponse.ts | 2 +- ...ConversationsListConnectInvitesResponse.ts | 2 +- .../response/ConversationsListResponse.ts | 2 +- .../response/ConversationsMarkResponse.ts | 2 +- .../response/ConversationsMembersResponse.ts | 2 +- .../response/ConversationsOpenResponse.ts | 10 ++- .../response/ConversationsRenameResponse.ts | 2 +- .../response/ConversationsRepliesResponse.ts | 19 ++++- .../ConversationsSetPurposeResponse.ts | 2 +- .../response/ConversationsSetTopicResponse.ts | 2 +- .../ConversationsUnarchiveResponse.ts | 2 +- .../response/DialogOpenResponse.ts | 2 +- .../{ => types}/response/DndEndDndResponse.ts | 2 +- .../response/DndEndSnoozeResponse.ts | 2 +- .../{ => types}/response/DndInfoResponse.ts | 2 +- .../response/DndSetSnoozeResponse.ts | 2 +- .../response/DndTeamInfoResponse.ts | 2 +- .../{ => types}/response/EmojiListResponse.ts | 2 +- .../response/FilesCommentsAddResponse.ts | 2 +- .../response/FilesCommentsDeleteResponse.ts | 2 +- .../response/FilesCommentsEditResponse.ts | 2 +- .../FilesCompleteUploadExternalResponse.ts | 2 +- .../response/FilesDeleteResponse.ts | 2 +- .../FilesGetUploadURLExternalResponse.ts | 2 +- .../{ => types}/response/FilesInfoResponse.ts | 2 +- .../{ => types}/response/FilesListResponse.ts | 2 +- .../response/FilesRemoteAddResponse.ts | 10 ++- .../response/FilesRemoteInfoResponse.ts | 10 ++- .../response/FilesRemoteListResponse.ts | 2 +- .../response/FilesRemoteRemoveResponse.ts | 2 +- .../response/FilesRemoteShareResponse.ts | 10 ++- .../response/FilesRemoteUpdateResponse.ts | 10 ++- .../response/FilesRevokePublicURLResponse.ts | 10 ++- .../response/FilesSharedPublicURLResponse.ts | 10 ++- .../response/FilesUploadResponse.ts | 10 ++- .../response/GroupsArchiveResponse.ts | 2 +- .../response/GroupsCloseResponse.ts | 2 +- .../response/GroupsCreateChildResponse.ts | 2 +- .../response/GroupsCreateResponse.ts | 2 +- .../response/GroupsHistoryResponse.ts | 2 +- .../response/GroupsInfoResponse.ts | 2 +- .../response/GroupsInviteResponse.ts | 2 +- .../response/GroupsKickResponse.ts | 2 +- .../response/GroupsLeaveResponse.ts | 2 +- .../response/GroupsListResponse.ts | 2 +- .../response/GroupsMarkResponse.ts | 2 +- .../response/GroupsOpenResponse.ts | 2 +- .../response/GroupsRenameResponse.ts | 2 +- .../response/GroupsRepliesResponse.ts | 2 +- .../response/GroupsSetPurposeResponse.ts | 2 +- .../response/GroupsSetTopicResponse.ts | 2 +- .../response/GroupsUnarchiveResponse.ts | 2 +- .../{ => types}/response/ImCloseResponse.ts | 2 +- .../{ => types}/response/ImHistoryResponse.ts | 2 +- .../{ => types}/response/ImListResponse.ts | 2 +- .../{ => types}/response/ImMarkResponse.ts | 2 +- .../{ => types}/response/ImOpenResponse.ts | 2 +- .../{ => types}/response/ImRepliesResponse.ts | 2 +- .../response/MigrationExchangeResponse.ts | 2 +- .../{ => types}/response/MpimCloseResponse.ts | 2 +- .../response/MpimHistoryResponse.ts | 2 +- .../{ => types}/response/MpimListResponse.ts | 2 +- .../{ => types}/response/MpimMarkResponse.ts | 2 +- .../{ => types}/response/MpimOpenResponse.ts | 2 +- .../response/MpimRepliesResponse.ts | 2 +- .../response/OauthAccessResponse.ts | 2 +- .../response/OauthTokenResponse.ts | 2 +- .../response/OauthV2AccessResponse.ts | 2 +- .../response/OauthV2ExchangeResponse.ts | 2 +- .../response/OpenIDConnectTokenResponse.ts | 2 +- .../response/OpenIDConnectUserInfoResponse.ts | 2 +- .../{ => types}/response/PinsAddResponse.ts | 2 +- .../{ => types}/response/PinsListResponse.ts | 10 ++- .../response/PinsRemoveResponse.ts | 2 +- .../response/ReactionsAddResponse.ts | 2 +- .../response/ReactionsGetResponse.ts | 9 ++- .../response/ReactionsListResponse.ts | 19 ++++- .../response/ReactionsRemoveResponse.ts | 2 +- .../response/RemindersAddResponse.ts | 2 +- .../response/RemindersCompleteResponse.ts | 2 +- .../response/RemindersDeleteResponse.ts | 2 +- .../response/RemindersInfoResponse.ts | 2 +- .../response/RemindersListResponse.ts | 2 +- .../response/RtmConnectResponse.ts | 2 +- .../{ => types}/response/RtmStartResponse.ts | 19 ++++- .../{ => types}/response/SearchAllResponse.ts | 74 +++++++++++-------- .../response/SearchFilesResponse.ts | 35 ++++++++- .../response/SearchMessagesResponse.ts | 19 ++++- .../{ => types}/response/StarsAddResponse.ts | 2 +- .../{ => types}/response/StarsListResponse.ts | 2 +- .../response/StarsRemoveResponse.ts | 2 +- .../response/TeamAccessLogsResponse.ts | 2 +- .../response/TeamBillableInfoResponse.ts | 2 +- .../response/TeamBillingInfoResponse.ts | 2 +- .../{ => types}/response/TeamInfoResponse.ts | 2 +- .../response/TeamIntegrationLogsResponse.ts | 2 +- .../response/TeamPreferencesListResponse.ts | 2 +- .../response/TeamProfileGetResponse.ts | 2 +- .../response/UsergroupsCreateResponse.ts | 2 +- .../response/UsergroupsDisableResponse.ts | 2 +- .../response/UsergroupsEnableResponse.ts | 2 +- .../response/UsergroupsListResponse.ts | 2 +- .../response/UsergroupsUpdateResponse.ts | 2 +- .../response/UsergroupsUsersListResponse.ts | 2 +- .../response/UsergroupsUsersUpdateResponse.ts | 2 +- .../response/UsersConversationsResponse.ts | 2 +- .../response/UsersDeletePhotoResponse.ts | 2 +- .../response/UsersGetPresenceResponse.ts | 2 +- .../response/UsersIdentityResponse.ts | 2 +- .../{ => types}/response/UsersInfoResponse.ts | 2 +- .../{ => types}/response/UsersListResponse.ts | 2 +- .../response/UsersLookupByEmailResponse.ts | 2 +- .../response/UsersProfileGetResponse.ts | 2 +- .../response/UsersProfileSetResponse.ts | 2 +- .../response/UsersSetActiveResponse.ts | 2 +- .../response/UsersSetPhotoResponse.ts | 2 +- .../response/UsersSetPresenceResponse.ts | 2 +- .../{ => types}/response/ViewsOpenResponse.ts | 2 +- .../response/ViewsPublishResponse.ts | 2 +- .../{ => types}/response/ViewsPushResponse.ts | 2 +- .../response/ViewsUpdateResponse.ts | 2 +- .../WorkflowsStepCompletedResponse.ts | 2 +- .../response/WorkflowsStepFailedResponse.ts | 2 +- .../response/WorkflowsUpdateStepResponse.ts | 2 +- .../web-api/src/{ => types}/response/index.ts | 0 scripts/code_generator.rb | 6 +- 285 files changed, 563 insertions(+), 319 deletions(-) rename packages/web-api/src/{ => types}/response/AdminAnalyticsGetFileResponse.ts (98%) rename packages/web-api/src/{ => types}/response/AdminAppsActivitiesListResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAppsApproveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAppsApprovedListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminAppsClearResolutionResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAppsConfigLookupResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminAppsConfigSetResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAppsRequestsCancelResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminAppsRequestsListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminAppsRestrictResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAppsRestrictedListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminAppsUninstallResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAuthPolicyAssignEntitiesResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminAuthPolicyGetEntitiesResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminAuthPolicyRemoveEntitiesResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminBarriersCreateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminBarriersDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminBarriersListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminBarriersUpdateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminConversationsArchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsBulkArchiveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsBulkDeleteResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsBulkMoveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsConvertToPrivateResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsConvertToPublicResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsCreateResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsDisconnectSharedResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsGetConversationPrefsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsGetCustomRetentionResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsGetTeamsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsInviteResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsLookupResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsRemoveCustomRetentionResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsRenameResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsRestrictAccessAddGroupResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsRestrictAccessListGroupsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsSearchResponse.ts (98%) rename packages/web-api/src/{ => types}/response/AdminConversationsSetConversationPrefsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsSetCustomRetentionResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsSetTeamsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsUnarchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminConversationsWhitelistAddResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminConversationsWhitelistRemoveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminEmojiAddAliasResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminEmojiAddResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminEmojiListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminEmojiRemoveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminEmojiRenameResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminFunctionsListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminFunctionsPermissionsLookupResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminFunctionsPermissionsSetResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminInviteRequestsApproveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminInviteRequestsApprovedListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminInviteRequestsDeniedListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminInviteRequestsDenyResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminInviteRequestsListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminRolesAddAssignmentsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminRolesListAssignmentsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminRolesRemoveAssignmentsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminTeamsAdminsListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminTeamsCreateResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminTeamsListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminTeamsOwnersListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsInfoResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsSetDescriptionResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsSetIconResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminTeamsSettingsSetNameResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsergroupsAddChannelsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsergroupsAddTeamsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsergroupsListChannelsResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminUsergroupsRemoveChannelsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersAssignResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersInviteResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminUsersListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminUsersRemoveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionClearSettingsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionGetSettingsResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionInvalidateResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionResetBulkResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionResetResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSessionSetSettingsResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSetAdminResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSetExpirationResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSetOwnerResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersSetRegularResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminUsersUnsupportedVersionsExportResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AdminWorkflowsCollaboratorsAddResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminWorkflowsCollaboratorsRemoveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminWorkflowsPermissionsLookupResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AdminWorkflowsSearchResponse.ts (97%) rename packages/web-api/src/{ => types}/response/AdminWorkflowsUnpublishResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ApiTestResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsConnectionsOpenResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsEventAuthorizationsListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AppsPermissionsInfoResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsPermissionsRequestResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsPermissionsResourcesListResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsPermissionsScopesListResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsPermissionsUsersListResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsPermissionsUsersRequestResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AppsUninstallResponse.ts (95%) rename packages/web-api/src/{ => types}/response/AuthRevokeResponse.ts (94%) rename packages/web-api/src/{ => types}/response/AuthTeamsListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/AuthTestResponse.ts (96%) rename packages/web-api/src/{ => types}/response/BookmarksAddResponse.ts (96%) rename packages/web-api/src/{ => types}/response/BookmarksEditResponse.ts (96%) rename packages/web-api/src/{ => types}/response/BookmarksListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/BookmarksRemoveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/BotsInfoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/CallsAddResponse.ts (96%) rename packages/web-api/src/{ => types}/response/CallsEndResponse.ts (96%) rename packages/web-api/src/{ => types}/response/CallsInfoResponse.ts (96%) rename packages/web-api/src/{ => types}/response/CallsParticipantsAddResponse.ts (96%) rename packages/web-api/src/{ => types}/response/CallsParticipantsRemoveResponse.ts (96%) rename packages/web-api/src/{ => types}/response/CallsUpdateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/ChannelsArchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsCreateResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChannelsHistoryResponse.ts (99%) rename packages/web-api/src/{ => types}/response/ChannelsInfoResponse.ts (99%) rename packages/web-api/src/{ => types}/response/ChannelsInviteResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChannelsJoinResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChannelsKickResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsLeaveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChannelsMarkResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsRenameResponse.ts (96%) rename packages/web-api/src/{ => types}/response/ChannelsRepliesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChannelsSetPurposeResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsSetTopicResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChannelsUnarchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatDeleteScheduledMessageResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatGetPermalinkResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatMeMessageResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatPostEphemeralResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatPostMessageResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChatScheduleMessageResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ChatScheduledMessagesListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/ChatUnfurlResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ChatUpdateResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsAcceptSharedInviteResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ConversationsApproveSharedInviteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsArchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsCloseResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsCreateResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsDeclineSharedInviteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsHistoryResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsInfoResponse.ts (98%) rename packages/web-api/src/{ => types}/response/ConversationsInviteResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsInviteSharedResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ConversationsJoinResponse.ts (98%) rename packages/web-api/src/{ => types}/response/ConversationsKickResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsLeaveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsListConnectInvitesResponse.ts (98%) rename packages/web-api/src/{ => types}/response/ConversationsListResponse.ts (98%) rename packages/web-api/src/{ => types}/response/ConversationsMarkResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ConversationsMembersResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ConversationsOpenResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsRenameResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsRepliesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsSetPurposeResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsSetTopicResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ConversationsUnarchiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/DialogOpenResponse.ts (95%) rename packages/web-api/src/{ => types}/response/DndEndDndResponse.ts (94%) rename packages/web-api/src/{ => types}/response/DndEndSnoozeResponse.ts (95%) rename packages/web-api/src/{ => types}/response/DndInfoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/DndSetSnoozeResponse.ts (95%) rename packages/web-api/src/{ => types}/response/DndTeamInfoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/EmojiListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/FilesCommentsAddResponse.ts (94%) rename packages/web-api/src/{ => types}/response/FilesCommentsDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/FilesCommentsEditResponse.ts (95%) rename packages/web-api/src/{ => types}/response/FilesCompleteUploadExternalResponse.ts (98%) rename packages/web-api/src/{ => types}/response/FilesDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/FilesGetUploadURLExternalResponse.ts (95%) rename packages/web-api/src/{ => types}/response/FilesInfoResponse.ts (99%) rename packages/web-api/src/{ => types}/response/FilesListResponse.ts (99%) rename packages/web-api/src/{ => types}/response/FilesRemoteAddResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesRemoteInfoResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesRemoteListResponse.ts (99%) rename packages/web-api/src/{ => types}/response/FilesRemoteRemoveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/FilesRemoteShareResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesRemoteUpdateResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesRevokePublicURLResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesSharedPublicURLResponse.ts (97%) rename packages/web-api/src/{ => types}/response/FilesUploadResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsArchiveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsCloseResponse.ts (94%) rename packages/web-api/src/{ => types}/response/GroupsCreateChildResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsCreateResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsHistoryResponse.ts (96%) rename packages/web-api/src/{ => types}/response/GroupsInfoResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsInviteResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsKickResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsLeaveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/GroupsMarkResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsOpenResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsRenameResponse.ts (96%) rename packages/web-api/src/{ => types}/response/GroupsRepliesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/GroupsSetPurposeResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsSetTopicResponse.ts (95%) rename packages/web-api/src/{ => types}/response/GroupsUnarchiveResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ImCloseResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ImHistoryResponse.ts (98%) rename packages/web-api/src/{ => types}/response/ImListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/ImMarkResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ImOpenResponse.ts (95%) rename packages/web-api/src/{ => types}/response/ImRepliesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/MigrationExchangeResponse.ts (95%) rename packages/web-api/src/{ => types}/response/MpimCloseResponse.ts (95%) rename packages/web-api/src/{ => types}/response/MpimHistoryResponse.ts (97%) rename packages/web-api/src/{ => types}/response/MpimListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/MpimMarkResponse.ts (95%) rename packages/web-api/src/{ => types}/response/MpimOpenResponse.ts (97%) rename packages/web-api/src/{ => types}/response/MpimRepliesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/OauthAccessResponse.ts (97%) rename packages/web-api/src/{ => types}/response/OauthTokenResponse.ts (94%) rename packages/web-api/src/{ => types}/response/OauthV2AccessResponse.ts (97%) rename packages/web-api/src/{ => types}/response/OauthV2ExchangeResponse.ts (97%) rename packages/web-api/src/{ => types}/response/OpenIDConnectTokenResponse.ts (95%) rename packages/web-api/src/{ => types}/response/OpenIDConnectUserInfoResponse.ts (98%) rename packages/web-api/src/{ => types}/response/PinsAddResponse.ts (94%) rename packages/web-api/src/{ => types}/response/PinsListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/PinsRemoveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ReactionsAddResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ReactionsGetResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ReactionsListResponse.ts (97%) rename packages/web-api/src/{ => types}/response/ReactionsRemoveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/RemindersAddResponse.ts (96%) rename packages/web-api/src/{ => types}/response/RemindersCompleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/RemindersDeleteResponse.ts (94%) rename packages/web-api/src/{ => types}/response/RemindersInfoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/RemindersListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/RtmConnectResponse.ts (95%) rename packages/web-api/src/{ => types}/response/RtmStartResponse.ts (99%) rename packages/web-api/src/{ => types}/response/SearchAllResponse.ts (96%) rename packages/web-api/src/{ => types}/response/SearchFilesResponse.ts (96%) rename packages/web-api/src/{ => types}/response/SearchMessagesResponse.ts (97%) rename packages/web-api/src/{ => types}/response/StarsAddResponse.ts (94%) rename packages/web-api/src/{ => types}/response/StarsListResponse.ts (99%) rename packages/web-api/src/{ => types}/response/StarsRemoveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/TeamAccessLogsResponse.ts (96%) rename packages/web-api/src/{ => types}/response/TeamBillableInfoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/TeamBillingInfoResponse.ts (94%) rename packages/web-api/src/{ => types}/response/TeamInfoResponse.ts (96%) rename packages/web-api/src/{ => types}/response/TeamIntegrationLogsResponse.ts (96%) rename packages/web-api/src/{ => types}/response/TeamPreferencesListResponse.ts (95%) rename packages/web-api/src/{ => types}/response/TeamProfileGetResponse.ts (97%) rename packages/web-api/src/{ => types}/response/UsergroupsCreateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsergroupsDisableResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsergroupsEnableResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsergroupsListResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsergroupsUpdateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsergroupsUsersListResponse.ts (94%) rename packages/web-api/src/{ => types}/response/UsergroupsUsersUpdateResponse.ts (96%) rename packages/web-api/src/{ => types}/response/UsersConversationsResponse.ts (98%) rename packages/web-api/src/{ => types}/response/UsersDeletePhotoResponse.ts (94%) rename packages/web-api/src/{ => types}/response/UsersGetPresenceResponse.ts (95%) rename packages/web-api/src/{ => types}/response/UsersIdentityResponse.ts (95%) rename packages/web-api/src/{ => types}/response/UsersInfoResponse.ts (98%) rename packages/web-api/src/{ => types}/response/UsersListResponse.ts (98%) rename packages/web-api/src/{ => types}/response/UsersLookupByEmailResponse.ts (98%) rename packages/web-api/src/{ => types}/response/UsersProfileGetResponse.ts (97%) rename packages/web-api/src/{ => types}/response/UsersProfileSetResponse.ts (97%) rename packages/web-api/src/{ => types}/response/UsersSetActiveResponse.ts (94%) rename packages/web-api/src/{ => types}/response/UsersSetPhotoResponse.ts (95%) rename packages/web-api/src/{ => types}/response/UsersSetPresenceResponse.ts (94%) rename packages/web-api/src/{ => types}/response/ViewsOpenResponse.ts (99%) rename packages/web-api/src/{ => types}/response/ViewsPublishResponse.ts (99%) rename packages/web-api/src/{ => types}/response/ViewsPushResponse.ts (99%) rename packages/web-api/src/{ => types}/response/ViewsUpdateResponse.ts (99%) rename packages/web-api/src/{ => types}/response/WorkflowsStepCompletedResponse.ts (94%) rename packages/web-api/src/{ => types}/response/WorkflowsStepFailedResponse.ts (94%) rename packages/web-api/src/{ => types}/response/WorkflowsUpdateStepResponse.ts (94%) rename packages/web-api/src/{ => types}/response/index.ts (100%) diff --git a/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts b/packages/web-api/src/types/response/AdminAnalyticsGetFileResponse.ts similarity index 98% rename from packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts rename to packages/web-api/src/types/response/AdminAnalyticsGetFileResponse.ts index 79c3349ed..45bdc77f1 100644 --- a/packages/web-api/src/response/AdminAnalyticsGetFileResponse.ts +++ b/packages/web-api/src/types/response/AdminAnalyticsGetFileResponse.ts @@ -1,5 +1,5 @@ /* eslint-disable no-multi-spaces,max-len */ -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAnalyticsGetFileResponse = WebAPICallResult & { file_data?: (AdminAnalyticsMemberDetails | AdminAnalyticsPublicChannelDetails | AdminAnalyticsPublicChannelMetadataDetails)[]; diff --git a/packages/web-api/src/response/AdminAppsActivitiesListResponse.ts b/packages/web-api/src/types/response/AdminAppsActivitiesListResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsActivitiesListResponse.ts rename to packages/web-api/src/types/response/AdminAppsActivitiesListResponse.ts index d1a671f56..35671ca64 100644 --- a/packages/web-api/src/response/AdminAppsActivitiesListResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsActivitiesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsActivitiesListResponse = WebAPICallResult & { activities?: Activity[]; error?: string; @@ -35,6 +35,8 @@ export interface Activity { export interface Payload { actor?: string; billing_reason?: string[]; + bot_user_id?: string; + channel_id?: string; current_step?: number; error?: string; exec_outcome?: string; diff --git a/packages/web-api/src/response/AdminAppsApproveResponse.ts b/packages/web-api/src/types/response/AdminAppsApproveResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsApproveResponse.ts rename to packages/web-api/src/types/response/AdminAppsApproveResponse.ts index 1dfa667cb..0cf8c7d11 100644 --- a/packages/web-api/src/response/AdminAppsApproveResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsApproveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsApproveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsApprovedListResponse.ts b/packages/web-api/src/types/response/AdminAppsApprovedListResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminAppsApprovedListResponse.ts rename to packages/web-api/src/types/response/AdminAppsApprovedListResponse.ts index eda0f2cd4..a55adddff 100644 --- a/packages/web-api/src/response/AdminAppsApprovedListResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsApprovedListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsApprovedListResponse = WebAPICallResult & { approved_apps?: ApprovedApp[]; error?: string; diff --git a/packages/web-api/src/response/AdminAppsClearResolutionResponse.ts b/packages/web-api/src/types/response/AdminAppsClearResolutionResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsClearResolutionResponse.ts rename to packages/web-api/src/types/response/AdminAppsClearResolutionResponse.ts index 3b61c2e93..8b93a3442 100644 --- a/packages/web-api/src/response/AdminAppsClearResolutionResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsClearResolutionResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsClearResolutionResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsConfigLookupResponse.ts b/packages/web-api/src/types/response/AdminAppsConfigLookupResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminAppsConfigLookupResponse.ts rename to packages/web-api/src/types/response/AdminAppsConfigLookupResponse.ts index 5598a7bc4..7f7ff871a 100644 --- a/packages/web-api/src/response/AdminAppsConfigLookupResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsConfigLookupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsConfigLookupResponse = WebAPICallResult & { configs?: Config[]; error?: string; diff --git a/packages/web-api/src/response/AdminAppsConfigSetResponse.ts b/packages/web-api/src/types/response/AdminAppsConfigSetResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsConfigSetResponse.ts rename to packages/web-api/src/types/response/AdminAppsConfigSetResponse.ts index 699d1b02b..e6644768b 100644 --- a/packages/web-api/src/response/AdminAppsConfigSetResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsConfigSetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsConfigSetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsRequestsCancelResponse.ts b/packages/web-api/src/types/response/AdminAppsRequestsCancelResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminAppsRequestsCancelResponse.ts rename to packages/web-api/src/types/response/AdminAppsRequestsCancelResponse.ts index 8a79bde52..482f4a7a5 100644 --- a/packages/web-api/src/response/AdminAppsRequestsCancelResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsRequestsCancelResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsRequestsCancelResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsRequestsListResponse.ts b/packages/web-api/src/types/response/AdminAppsRequestsListResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminAppsRequestsListResponse.ts rename to packages/web-api/src/types/response/AdminAppsRequestsListResponse.ts index a9b46e40f..a6789f520 100644 --- a/packages/web-api/src/response/AdminAppsRequestsListResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsRequestsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsRequestsListResponse = WebAPICallResult & { app_requests?: AppRequest[]; error?: string; diff --git a/packages/web-api/src/response/AdminAppsRestrictResponse.ts b/packages/web-api/src/types/response/AdminAppsRestrictResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsRestrictResponse.ts rename to packages/web-api/src/types/response/AdminAppsRestrictResponse.ts index c8641fe3e..421941cd3 100644 --- a/packages/web-api/src/response/AdminAppsRestrictResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsRestrictResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsRestrictResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsRestrictedListResponse.ts b/packages/web-api/src/types/response/AdminAppsRestrictedListResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminAppsRestrictedListResponse.ts rename to packages/web-api/src/types/response/AdminAppsRestrictedListResponse.ts index 65bb454df..da9cbe5e3 100644 --- a/packages/web-api/src/response/AdminAppsRestrictedListResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsRestrictedListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsRestrictedListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAppsUninstallResponse.ts b/packages/web-api/src/types/response/AdminAppsUninstallResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAppsUninstallResponse.ts rename to packages/web-api/src/types/response/AdminAppsUninstallResponse.ts index 9d3c17779..1d255b306 100644 --- a/packages/web-api/src/response/AdminAppsUninstallResponse.ts +++ b/packages/web-api/src/types/response/AdminAppsUninstallResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAppsUninstallResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminAuthPolicyAssignEntitiesResponse.ts b/packages/web-api/src/types/response/AdminAuthPolicyAssignEntitiesResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAuthPolicyAssignEntitiesResponse.ts rename to packages/web-api/src/types/response/AdminAuthPolicyAssignEntitiesResponse.ts index d43f9dd10..cc060ee19 100644 --- a/packages/web-api/src/response/AdminAuthPolicyAssignEntitiesResponse.ts +++ b/packages/web-api/src/types/response/AdminAuthPolicyAssignEntitiesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAuthPolicyAssignEntitiesResponse = WebAPICallResult & { entity_total_count?: number; error?: string; diff --git a/packages/web-api/src/response/AdminAuthPolicyGetEntitiesResponse.ts b/packages/web-api/src/types/response/AdminAuthPolicyGetEntitiesResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminAuthPolicyGetEntitiesResponse.ts rename to packages/web-api/src/types/response/AdminAuthPolicyGetEntitiesResponse.ts index cdbd16175..38379751b 100644 --- a/packages/web-api/src/response/AdminAuthPolicyGetEntitiesResponse.ts +++ b/packages/web-api/src/types/response/AdminAuthPolicyGetEntitiesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAuthPolicyGetEntitiesResponse = WebAPICallResult & { entities?: Entity[]; entity_total_count?: number; diff --git a/packages/web-api/src/response/AdminAuthPolicyRemoveEntitiesResponse.ts b/packages/web-api/src/types/response/AdminAuthPolicyRemoveEntitiesResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminAuthPolicyRemoveEntitiesResponse.ts rename to packages/web-api/src/types/response/AdminAuthPolicyRemoveEntitiesResponse.ts index baa60b6c1..0ffb418c1 100644 --- a/packages/web-api/src/response/AdminAuthPolicyRemoveEntitiesResponse.ts +++ b/packages/web-api/src/types/response/AdminAuthPolicyRemoveEntitiesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminAuthPolicyRemoveEntitiesResponse = WebAPICallResult & { entity_total_count?: number; error?: string; diff --git a/packages/web-api/src/response/AdminBarriersCreateResponse.ts b/packages/web-api/src/types/response/AdminBarriersCreateResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminBarriersCreateResponse.ts rename to packages/web-api/src/types/response/AdminBarriersCreateResponse.ts index 81f263492..9d89f1870 100644 --- a/packages/web-api/src/response/AdminBarriersCreateResponse.ts +++ b/packages/web-api/src/types/response/AdminBarriersCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminBarriersCreateResponse = WebAPICallResult & { barrier?: Barrier; error?: string; diff --git a/packages/web-api/src/response/AdminBarriersDeleteResponse.ts b/packages/web-api/src/types/response/AdminBarriersDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminBarriersDeleteResponse.ts rename to packages/web-api/src/types/response/AdminBarriersDeleteResponse.ts index f45d25d56..43f889e0a 100644 --- a/packages/web-api/src/response/AdminBarriersDeleteResponse.ts +++ b/packages/web-api/src/types/response/AdminBarriersDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminBarriersDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminBarriersListResponse.ts b/packages/web-api/src/types/response/AdminBarriersListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminBarriersListResponse.ts rename to packages/web-api/src/types/response/AdminBarriersListResponse.ts index ad1150d93..c6b22ef97 100644 --- a/packages/web-api/src/response/AdminBarriersListResponse.ts +++ b/packages/web-api/src/types/response/AdminBarriersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminBarriersListResponse = WebAPICallResult & { barriers?: Barrier[]; error?: string; diff --git a/packages/web-api/src/response/AdminBarriersUpdateResponse.ts b/packages/web-api/src/types/response/AdminBarriersUpdateResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminBarriersUpdateResponse.ts rename to packages/web-api/src/types/response/AdminBarriersUpdateResponse.ts index 8d0bd460c..2a78ebd1a 100644 --- a/packages/web-api/src/response/AdminBarriersUpdateResponse.ts +++ b/packages/web-api/src/types/response/AdminBarriersUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminBarriersUpdateResponse = WebAPICallResult & { barrier?: Barrier; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsArchiveResponse.ts b/packages/web-api/src/types/response/AdminConversationsArchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsArchiveResponse.ts rename to packages/web-api/src/types/response/AdminConversationsArchiveResponse.ts index 5f3245166..28894add2 100644 --- a/packages/web-api/src/response/AdminConversationsArchiveResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsArchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsArchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsBulkArchiveResponse.ts b/packages/web-api/src/types/response/AdminConversationsBulkArchiveResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsBulkArchiveResponse.ts rename to packages/web-api/src/types/response/AdminConversationsBulkArchiveResponse.ts index b9c6cc5ea..c8e892450 100644 --- a/packages/web-api/src/response/AdminConversationsBulkArchiveResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsBulkArchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsBulkArchiveResponse = WebAPICallResult & { bulk_action_id?: string; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsBulkDeleteResponse.ts b/packages/web-api/src/types/response/AdminConversationsBulkDeleteResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsBulkDeleteResponse.ts rename to packages/web-api/src/types/response/AdminConversationsBulkDeleteResponse.ts index 4b56d7d9a..4adf68ece 100644 --- a/packages/web-api/src/response/AdminConversationsBulkDeleteResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsBulkDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsBulkDeleteResponse = WebAPICallResult & { bulk_action_id?: string; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsBulkMoveResponse.ts b/packages/web-api/src/types/response/AdminConversationsBulkMoveResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsBulkMoveResponse.ts rename to packages/web-api/src/types/response/AdminConversationsBulkMoveResponse.ts index ad48728f9..2be45b703 100644 --- a/packages/web-api/src/response/AdminConversationsBulkMoveResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsBulkMoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsBulkMoveResponse = WebAPICallResult & { bulk_action_id?: string; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsConvertToPrivateResponse.ts b/packages/web-api/src/types/response/AdminConversationsConvertToPrivateResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsConvertToPrivateResponse.ts rename to packages/web-api/src/types/response/AdminConversationsConvertToPrivateResponse.ts index 0daf955f0..28085a659 100644 --- a/packages/web-api/src/response/AdminConversationsConvertToPrivateResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsConvertToPrivateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsConvertToPrivateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsConvertToPublicResponse.ts b/packages/web-api/src/types/response/AdminConversationsConvertToPublicResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsConvertToPublicResponse.ts rename to packages/web-api/src/types/response/AdminConversationsConvertToPublicResponse.ts index b3719eb1b..9a7b9523f 100644 --- a/packages/web-api/src/response/AdminConversationsConvertToPublicResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsConvertToPublicResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsConvertToPublicResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsCreateResponse.ts b/packages/web-api/src/types/response/AdminConversationsCreateResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsCreateResponse.ts rename to packages/web-api/src/types/response/AdminConversationsCreateResponse.ts index 523820f35..fdaa5141d 100644 --- a/packages/web-api/src/response/AdminConversationsCreateResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsCreateResponse = WebAPICallResult & { channel_id?: string; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsDeleteResponse.ts b/packages/web-api/src/types/response/AdminConversationsDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsDeleteResponse.ts rename to packages/web-api/src/types/response/AdminConversationsDeleteResponse.ts index 85413b007..0f5d58e67 100644 --- a/packages/web-api/src/response/AdminConversationsDeleteResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsDisconnectSharedResponse.ts b/packages/web-api/src/types/response/AdminConversationsDisconnectSharedResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsDisconnectSharedResponse.ts rename to packages/web-api/src/types/response/AdminConversationsDisconnectSharedResponse.ts index a9bca7b2c..9315d6bff 100644 --- a/packages/web-api/src/response/AdminConversationsDisconnectSharedResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsDisconnectSharedResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsDisconnectSharedResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts b/packages/web-api/src/types/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts rename to packages/web-api/src/types/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts index d2bf68c8d..0155f5cb0 100644 --- a/packages/web-api/src/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsEkmListOriginalConnectedChannelInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsGetConversationPrefsResponse.ts b/packages/web-api/src/types/response/AdminConversationsGetConversationPrefsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsGetConversationPrefsResponse.ts rename to packages/web-api/src/types/response/AdminConversationsGetConversationPrefsResponse.ts index 89596ab1c..53ccdd209 100644 --- a/packages/web-api/src/response/AdminConversationsGetConversationPrefsResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsGetConversationPrefsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsGetConversationPrefsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsGetCustomRetentionResponse.ts b/packages/web-api/src/types/response/AdminConversationsGetCustomRetentionResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsGetCustomRetentionResponse.ts rename to packages/web-api/src/types/response/AdminConversationsGetCustomRetentionResponse.ts index 658fd098e..88ca02175 100644 --- a/packages/web-api/src/response/AdminConversationsGetCustomRetentionResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsGetCustomRetentionResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsGetCustomRetentionResponse = WebAPICallResult & { duration_days?: number; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsGetTeamsResponse.ts b/packages/web-api/src/types/response/AdminConversationsGetTeamsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsGetTeamsResponse.ts rename to packages/web-api/src/types/response/AdminConversationsGetTeamsResponse.ts index 2e2c0e1d2..514a6714f 100644 --- a/packages/web-api/src/response/AdminConversationsGetTeamsResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsGetTeamsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsGetTeamsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsInviteResponse.ts b/packages/web-api/src/types/response/AdminConversationsInviteResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsInviteResponse.ts rename to packages/web-api/src/types/response/AdminConversationsInviteResponse.ts index 9120de636..b9c41cca3 100644 --- a/packages/web-api/src/response/AdminConversationsInviteResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsInviteResponse = WebAPICallResult & { error?: string; failed_user_ids?: FailedUserids; diff --git a/packages/web-api/src/response/AdminConversationsLookupResponse.ts b/packages/web-api/src/types/response/AdminConversationsLookupResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsLookupResponse.ts rename to packages/web-api/src/types/response/AdminConversationsLookupResponse.ts index 1f8f856d2..b005c8a1c 100644 --- a/packages/web-api/src/response/AdminConversationsLookupResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsLookupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsLookupResponse = WebAPICallResult & { channel_ids?: string[]; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsRemoveCustomRetentionResponse.ts b/packages/web-api/src/types/response/AdminConversationsRemoveCustomRetentionResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsRemoveCustomRetentionResponse.ts rename to packages/web-api/src/types/response/AdminConversationsRemoveCustomRetentionResponse.ts index 8ae943165..061c1982c 100644 --- a/packages/web-api/src/response/AdminConversationsRemoveCustomRetentionResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsRemoveCustomRetentionResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsRemoveCustomRetentionResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsRenameResponse.ts b/packages/web-api/src/types/response/AdminConversationsRenameResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsRenameResponse.ts rename to packages/web-api/src/types/response/AdminConversationsRenameResponse.ts index f9ea33e15..96a112652 100644 --- a/packages/web-api/src/response/AdminConversationsRenameResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsRenameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsRenameResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsRestrictAccessAddGroupResponse.ts b/packages/web-api/src/types/response/AdminConversationsRestrictAccessAddGroupResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsRestrictAccessAddGroupResponse.ts rename to packages/web-api/src/types/response/AdminConversationsRestrictAccessAddGroupResponse.ts index 50e347e5f..84ee9d5aa 100644 --- a/packages/web-api/src/response/AdminConversationsRestrictAccessAddGroupResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsRestrictAccessAddGroupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsRestrictAccessAddGroupResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsRestrictAccessListGroupsResponse.ts b/packages/web-api/src/types/response/AdminConversationsRestrictAccessListGroupsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsRestrictAccessListGroupsResponse.ts rename to packages/web-api/src/types/response/AdminConversationsRestrictAccessListGroupsResponse.ts index 19a66370e..3c329d2e6 100644 --- a/packages/web-api/src/response/AdminConversationsRestrictAccessListGroupsResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsRestrictAccessListGroupsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsRestrictAccessListGroupsResponse = WebAPICallResult & { error?: string; group_ids?: string[]; diff --git a/packages/web-api/src/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts b/packages/web-api/src/types/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts rename to packages/web-api/src/types/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts index a6af9fc0c..b4037cd20 100644 --- a/packages/web-api/src/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsRestrictAccessRemoveGroupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsRestrictAccessRemoveGroupResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsSearchResponse.ts b/packages/web-api/src/types/response/AdminConversationsSearchResponse.ts similarity index 98% rename from packages/web-api/src/response/AdminConversationsSearchResponse.ts rename to packages/web-api/src/types/response/AdminConversationsSearchResponse.ts index c3cd9d254..490485f33 100644 --- a/packages/web-api/src/response/AdminConversationsSearchResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsSearchResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsSearchResponse = WebAPICallResult & { conversations?: Conversation[]; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsSetConversationPrefsResponse.ts b/packages/web-api/src/types/response/AdminConversationsSetConversationPrefsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsSetConversationPrefsResponse.ts rename to packages/web-api/src/types/response/AdminConversationsSetConversationPrefsResponse.ts index cc0a0ccac..b766006c3 100644 --- a/packages/web-api/src/response/AdminConversationsSetConversationPrefsResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsSetConversationPrefsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsSetConversationPrefsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsSetCustomRetentionResponse.ts b/packages/web-api/src/types/response/AdminConversationsSetCustomRetentionResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsSetCustomRetentionResponse.ts rename to packages/web-api/src/types/response/AdminConversationsSetCustomRetentionResponse.ts index c1dca9823..386770bea 100644 --- a/packages/web-api/src/response/AdminConversationsSetCustomRetentionResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsSetCustomRetentionResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsSetCustomRetentionResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsSetTeamsResponse.ts b/packages/web-api/src/types/response/AdminConversationsSetTeamsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsSetTeamsResponse.ts rename to packages/web-api/src/types/response/AdminConversationsSetTeamsResponse.ts index 18ba8b188..14d142362 100644 --- a/packages/web-api/src/response/AdminConversationsSetTeamsResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsSetTeamsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsSetTeamsResponse = WebAPICallResult & { channel?: string; error?: string; diff --git a/packages/web-api/src/response/AdminConversationsUnarchiveResponse.ts b/packages/web-api/src/types/response/AdminConversationsUnarchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminConversationsUnarchiveResponse.ts rename to packages/web-api/src/types/response/AdminConversationsUnarchiveResponse.ts index d09e5822e..ec47e149c 100644 --- a/packages/web-api/src/response/AdminConversationsUnarchiveResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsUnarchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsUnarchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsWhitelistAddResponse.ts b/packages/web-api/src/types/response/AdminConversationsWhitelistAddResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsWhitelistAddResponse.ts rename to packages/web-api/src/types/response/AdminConversationsWhitelistAddResponse.ts index d61b9870d..3dd0d1f9a 100644 --- a/packages/web-api/src/response/AdminConversationsWhitelistAddResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsWhitelistAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsWhitelistAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts b/packages/web-api/src/types/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts rename to packages/web-api/src/types/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts index 5bff9ba7a..6178e38e6 100644 --- a/packages/web-api/src/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsWhitelistListGroupsLinkedToChannelResponse = WebAPICallResult & { error?: string; group_ids?: string[]; diff --git a/packages/web-api/src/response/AdminConversationsWhitelistRemoveResponse.ts b/packages/web-api/src/types/response/AdminConversationsWhitelistRemoveResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminConversationsWhitelistRemoveResponse.ts rename to packages/web-api/src/types/response/AdminConversationsWhitelistRemoveResponse.ts index 6c0a6b285..58d02add2 100644 --- a/packages/web-api/src/response/AdminConversationsWhitelistRemoveResponse.ts +++ b/packages/web-api/src/types/response/AdminConversationsWhitelistRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminConversationsWhitelistRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminEmojiAddAliasResponse.ts b/packages/web-api/src/types/response/AdminEmojiAddAliasResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminEmojiAddAliasResponse.ts rename to packages/web-api/src/types/response/AdminEmojiAddAliasResponse.ts index 860840cc6..c9c4e73d9 100644 --- a/packages/web-api/src/response/AdminEmojiAddAliasResponse.ts +++ b/packages/web-api/src/types/response/AdminEmojiAddAliasResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminEmojiAddAliasResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminEmojiAddResponse.ts b/packages/web-api/src/types/response/AdminEmojiAddResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminEmojiAddResponse.ts rename to packages/web-api/src/types/response/AdminEmojiAddResponse.ts index 9f521c3f0..b78e3118b 100644 --- a/packages/web-api/src/response/AdminEmojiAddResponse.ts +++ b/packages/web-api/src/types/response/AdminEmojiAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminEmojiAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminEmojiListResponse.ts b/packages/web-api/src/types/response/AdminEmojiListResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminEmojiListResponse.ts rename to packages/web-api/src/types/response/AdminEmojiListResponse.ts index 244603910..d6cae5fe1 100644 --- a/packages/web-api/src/response/AdminEmojiListResponse.ts +++ b/packages/web-api/src/types/response/AdminEmojiListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminEmojiListResponse = WebAPICallResult & { emoji?: { [key: string]: Emoji }; error?: string; diff --git a/packages/web-api/src/response/AdminEmojiRemoveResponse.ts b/packages/web-api/src/types/response/AdminEmojiRemoveResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminEmojiRemoveResponse.ts rename to packages/web-api/src/types/response/AdminEmojiRemoveResponse.ts index ed5ea1a26..550948e3f 100644 --- a/packages/web-api/src/response/AdminEmojiRemoveResponse.ts +++ b/packages/web-api/src/types/response/AdminEmojiRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminEmojiRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminEmojiRenameResponse.ts b/packages/web-api/src/types/response/AdminEmojiRenameResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminEmojiRenameResponse.ts rename to packages/web-api/src/types/response/AdminEmojiRenameResponse.ts index 9d389e245..a296a2577 100644 --- a/packages/web-api/src/response/AdminEmojiRenameResponse.ts +++ b/packages/web-api/src/types/response/AdminEmojiRenameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminEmojiRenameResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminFunctionsListResponse.ts b/packages/web-api/src/types/response/AdminFunctionsListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminFunctionsListResponse.ts rename to packages/web-api/src/types/response/AdminFunctionsListResponse.ts index 7f4186738..ae69d3e4a 100644 --- a/packages/web-api/src/response/AdminFunctionsListResponse.ts +++ b/packages/web-api/src/types/response/AdminFunctionsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminFunctionsListResponse = WebAPICallResult & { error?: string; functions?: Function[]; diff --git a/packages/web-api/src/response/AdminFunctionsPermissionsLookupResponse.ts b/packages/web-api/src/types/response/AdminFunctionsPermissionsLookupResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminFunctionsPermissionsLookupResponse.ts rename to packages/web-api/src/types/response/AdminFunctionsPermissionsLookupResponse.ts index 2b4a557c5..e28455e47 100644 --- a/packages/web-api/src/response/AdminFunctionsPermissionsLookupResponse.ts +++ b/packages/web-api/src/types/response/AdminFunctionsPermissionsLookupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminFunctionsPermissionsLookupResponse = WebAPICallResult & { error?: string; errors?: Errors; diff --git a/packages/web-api/src/response/AdminFunctionsPermissionsSetResponse.ts b/packages/web-api/src/types/response/AdminFunctionsPermissionsSetResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminFunctionsPermissionsSetResponse.ts rename to packages/web-api/src/types/response/AdminFunctionsPermissionsSetResponse.ts index 981bbee91..0e7ed2c80 100644 --- a/packages/web-api/src/response/AdminFunctionsPermissionsSetResponse.ts +++ b/packages/web-api/src/types/response/AdminFunctionsPermissionsSetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminFunctionsPermissionsSetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminInviteRequestsApproveResponse.ts b/packages/web-api/src/types/response/AdminInviteRequestsApproveResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminInviteRequestsApproveResponse.ts rename to packages/web-api/src/types/response/AdminInviteRequestsApproveResponse.ts index f44d12410..2052e0f0c 100644 --- a/packages/web-api/src/response/AdminInviteRequestsApproveResponse.ts +++ b/packages/web-api/src/types/response/AdminInviteRequestsApproveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminInviteRequestsApproveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminInviteRequestsApprovedListResponse.ts b/packages/web-api/src/types/response/AdminInviteRequestsApprovedListResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminInviteRequestsApprovedListResponse.ts rename to packages/web-api/src/types/response/AdminInviteRequestsApprovedListResponse.ts index 6b24c14be..888bef004 100644 --- a/packages/web-api/src/response/AdminInviteRequestsApprovedListResponse.ts +++ b/packages/web-api/src/types/response/AdminInviteRequestsApprovedListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminInviteRequestsApprovedListResponse = WebAPICallResult & { approved_requests?: ApprovedRequest[]; error?: string; diff --git a/packages/web-api/src/response/AdminInviteRequestsDeniedListResponse.ts b/packages/web-api/src/types/response/AdminInviteRequestsDeniedListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminInviteRequestsDeniedListResponse.ts rename to packages/web-api/src/types/response/AdminInviteRequestsDeniedListResponse.ts index b6c69e024..585d5bf07 100644 --- a/packages/web-api/src/response/AdminInviteRequestsDeniedListResponse.ts +++ b/packages/web-api/src/types/response/AdminInviteRequestsDeniedListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminInviteRequestsDeniedListResponse = WebAPICallResult & { denied_requests?: DeniedRequest[]; error?: string; diff --git a/packages/web-api/src/response/AdminInviteRequestsDenyResponse.ts b/packages/web-api/src/types/response/AdminInviteRequestsDenyResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminInviteRequestsDenyResponse.ts rename to packages/web-api/src/types/response/AdminInviteRequestsDenyResponse.ts index 836e8021e..5a99fdc89 100644 --- a/packages/web-api/src/response/AdminInviteRequestsDenyResponse.ts +++ b/packages/web-api/src/types/response/AdminInviteRequestsDenyResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminInviteRequestsDenyResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminInviteRequestsListResponse.ts b/packages/web-api/src/types/response/AdminInviteRequestsListResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminInviteRequestsListResponse.ts rename to packages/web-api/src/types/response/AdminInviteRequestsListResponse.ts index 5c85d6c22..065d692b4 100644 --- a/packages/web-api/src/response/AdminInviteRequestsListResponse.ts +++ b/packages/web-api/src/types/response/AdminInviteRequestsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminInviteRequestsListResponse = WebAPICallResult & { error?: string; invite_requests?: InviteRequest[]; diff --git a/packages/web-api/src/response/AdminRolesAddAssignmentsResponse.ts b/packages/web-api/src/types/response/AdminRolesAddAssignmentsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminRolesAddAssignmentsResponse.ts rename to packages/web-api/src/types/response/AdminRolesAddAssignmentsResponse.ts index a18d7382c..a4ce1d0b2 100644 --- a/packages/web-api/src/response/AdminRolesAddAssignmentsResponse.ts +++ b/packages/web-api/src/types/response/AdminRolesAddAssignmentsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminRolesAddAssignmentsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminRolesListAssignmentsResponse.ts b/packages/web-api/src/types/response/AdminRolesListAssignmentsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminRolesListAssignmentsResponse.ts rename to packages/web-api/src/types/response/AdminRolesListAssignmentsResponse.ts index 60c67a925..995cac37a 100644 --- a/packages/web-api/src/response/AdminRolesListAssignmentsResponse.ts +++ b/packages/web-api/src/types/response/AdminRolesListAssignmentsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminRolesListAssignmentsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminRolesRemoveAssignmentsResponse.ts b/packages/web-api/src/types/response/AdminRolesRemoveAssignmentsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminRolesRemoveAssignmentsResponse.ts rename to packages/web-api/src/types/response/AdminRolesRemoveAssignmentsResponse.ts index 4178988e6..34fdfe08f 100644 --- a/packages/web-api/src/response/AdminRolesRemoveAssignmentsResponse.ts +++ b/packages/web-api/src/types/response/AdminRolesRemoveAssignmentsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminRolesRemoveAssignmentsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsAdminsListResponse.ts b/packages/web-api/src/types/response/AdminTeamsAdminsListResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminTeamsAdminsListResponse.ts rename to packages/web-api/src/types/response/AdminTeamsAdminsListResponse.ts index 089b56cd3..32eb6e58c 100644 --- a/packages/web-api/src/response/AdminTeamsAdminsListResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsAdminsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsAdminsListResponse = WebAPICallResult & { admin_ids?: string[]; error?: string; diff --git a/packages/web-api/src/response/AdminTeamsCreateResponse.ts b/packages/web-api/src/types/response/AdminTeamsCreateResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminTeamsCreateResponse.ts rename to packages/web-api/src/types/response/AdminTeamsCreateResponse.ts index 1bbdc66f6..e72883553 100644 --- a/packages/web-api/src/response/AdminTeamsCreateResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsCreateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsListResponse.ts b/packages/web-api/src/types/response/AdminTeamsListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminTeamsListResponse.ts rename to packages/web-api/src/types/response/AdminTeamsListResponse.ts index 4df5ccc3f..be065d101 100644 --- a/packages/web-api/src/response/AdminTeamsListResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsOwnersListResponse.ts b/packages/web-api/src/types/response/AdminTeamsOwnersListResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminTeamsOwnersListResponse.ts rename to packages/web-api/src/types/response/AdminTeamsOwnersListResponse.ts index 1ae0ec2a2..3290fe2ea 100644 --- a/packages/web-api/src/response/AdminTeamsOwnersListResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsOwnersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsOwnersListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsInfoResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsInfoResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminTeamsSettingsInfoResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsInfoResponse.ts index 18e0fcbfb..ceca46eba 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsInfoResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts index c77e03725..2890c8709 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsSetDefaultChannelsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsSetDefaultChannelsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsSetDescriptionResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsSetDescriptionResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminTeamsSettingsSetDescriptionResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsSetDescriptionResponse.ts index 29e787c13..141c2337a 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsSetDescriptionResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsSetDescriptionResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsSetDescriptionResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts index bb0d54400..fbdb00319 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsSetDiscoverabilityResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsSetDiscoverabilityResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsSetIconResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsSetIconResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminTeamsSettingsSetIconResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsSetIconResponse.ts index 3e73ca3f6..c0f258d14 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsSetIconResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsSetIconResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsSetIconResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminTeamsSettingsSetNameResponse.ts b/packages/web-api/src/types/response/AdminTeamsSettingsSetNameResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminTeamsSettingsSetNameResponse.ts rename to packages/web-api/src/types/response/AdminTeamsSettingsSetNameResponse.ts index e3f8aaed8..9a11beda4 100644 --- a/packages/web-api/src/response/AdminTeamsSettingsSetNameResponse.ts +++ b/packages/web-api/src/types/response/AdminTeamsSettingsSetNameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminTeamsSettingsSetNameResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsergroupsAddChannelsResponse.ts b/packages/web-api/src/types/response/AdminUsergroupsAddChannelsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsergroupsAddChannelsResponse.ts rename to packages/web-api/src/types/response/AdminUsergroupsAddChannelsResponse.ts index f3dcc7600..02547b181 100644 --- a/packages/web-api/src/response/AdminUsergroupsAddChannelsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsergroupsAddChannelsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsergroupsAddChannelsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsergroupsAddTeamsResponse.ts b/packages/web-api/src/types/response/AdminUsergroupsAddTeamsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsergroupsAddTeamsResponse.ts rename to packages/web-api/src/types/response/AdminUsergroupsAddTeamsResponse.ts index d27ffa4d9..8c41a2b08 100644 --- a/packages/web-api/src/response/AdminUsergroupsAddTeamsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsergroupsAddTeamsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsergroupsAddTeamsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsergroupsListChannelsResponse.ts b/packages/web-api/src/types/response/AdminUsergroupsListChannelsResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminUsergroupsListChannelsResponse.ts rename to packages/web-api/src/types/response/AdminUsergroupsListChannelsResponse.ts index afec01399..34cdabb1e 100644 --- a/packages/web-api/src/response/AdminUsergroupsListChannelsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsergroupsListChannelsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsergroupsListChannelsResponse = WebAPICallResult & { channels?: Channel[]; error?: string; diff --git a/packages/web-api/src/response/AdminUsergroupsRemoveChannelsResponse.ts b/packages/web-api/src/types/response/AdminUsergroupsRemoveChannelsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsergroupsRemoveChannelsResponse.ts rename to packages/web-api/src/types/response/AdminUsergroupsRemoveChannelsResponse.ts index b01e4fb6b..b7f30080c 100644 --- a/packages/web-api/src/response/AdminUsergroupsRemoveChannelsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsergroupsRemoveChannelsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsergroupsRemoveChannelsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersAssignResponse.ts b/packages/web-api/src/types/response/AdminUsersAssignResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersAssignResponse.ts rename to packages/web-api/src/types/response/AdminUsersAssignResponse.ts index d9b31063d..58c1ba8ed 100644 --- a/packages/web-api/src/response/AdminUsersAssignResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersAssignResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersAssignResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersInviteResponse.ts b/packages/web-api/src/types/response/AdminUsersInviteResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminUsersInviteResponse.ts rename to packages/web-api/src/types/response/AdminUsersInviteResponse.ts index 4ffabc5e1..12390cd45 100644 --- a/packages/web-api/src/response/AdminUsersInviteResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersInviteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersListResponse.ts b/packages/web-api/src/types/response/AdminUsersListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminUsersListResponse.ts rename to packages/web-api/src/types/response/AdminUsersListResponse.ts index d4b294f60..aec84bd85 100644 --- a/packages/web-api/src/response/AdminUsersListResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersRemoveResponse.ts b/packages/web-api/src/types/response/AdminUsersRemoveResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersRemoveResponse.ts rename to packages/web-api/src/types/response/AdminUsersRemoveResponse.ts index 609343492..b7d10c31b 100644 --- a/packages/web-api/src/response/AdminUsersRemoveResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionClearSettingsResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionClearSettingsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSessionClearSettingsResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionClearSettingsResponse.ts index 0a73982d3..87e20c7d1 100644 --- a/packages/web-api/src/response/AdminUsersSessionClearSettingsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionClearSettingsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionClearSettingsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionGetSettingsResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionGetSettingsResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminUsersSessionGetSettingsResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionGetSettingsResponse.ts index 3eaffcc23..5d45bfd6f 100644 --- a/packages/web-api/src/response/AdminUsersSessionGetSettingsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionGetSettingsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionGetSettingsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionInvalidateResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionInvalidateResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminUsersSessionInvalidateResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionInvalidateResponse.ts index c5415f6cf..1f192f9c7 100644 --- a/packages/web-api/src/response/AdminUsersSessionInvalidateResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionInvalidateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionInvalidateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionListResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionListResponse.ts similarity index 96% rename from packages/web-api/src/response/AdminUsersSessionListResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionListResponse.ts index 0aef7512a..22b7c9e52 100644 --- a/packages/web-api/src/response/AdminUsersSessionListResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionListResponse = WebAPICallResult & { active_sessions?: ActiveSession[]; error?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionResetBulkResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionResetBulkResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSessionResetBulkResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionResetBulkResponse.ts index 6ee4392db..92fb5b17b 100644 --- a/packages/web-api/src/response/AdminUsersSessionResetBulkResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionResetBulkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionResetBulkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionResetResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionResetResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSessionResetResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionResetResponse.ts index b70ac590d..5226cf9ff 100644 --- a/packages/web-api/src/response/AdminUsersSessionResetResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionResetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionResetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSessionSetSettingsResponse.ts b/packages/web-api/src/types/response/AdminUsersSessionSetSettingsResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSessionSetSettingsResponse.ts rename to packages/web-api/src/types/response/AdminUsersSessionSetSettingsResponse.ts index 1439313a0..b07a8f7f7 100644 --- a/packages/web-api/src/response/AdminUsersSessionSetSettingsResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSessionSetSettingsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSessionSetSettingsResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSetAdminResponse.ts b/packages/web-api/src/types/response/AdminUsersSetAdminResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSetAdminResponse.ts rename to packages/web-api/src/types/response/AdminUsersSetAdminResponse.ts index 010ad3ca6..7ee8f342a 100644 --- a/packages/web-api/src/response/AdminUsersSetAdminResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSetAdminResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSetAdminResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSetExpirationResponse.ts b/packages/web-api/src/types/response/AdminUsersSetExpirationResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSetExpirationResponse.ts rename to packages/web-api/src/types/response/AdminUsersSetExpirationResponse.ts index 616de852c..c5ef87cf1 100644 --- a/packages/web-api/src/response/AdminUsersSetExpirationResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSetExpirationResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSetExpirationResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSetOwnerResponse.ts b/packages/web-api/src/types/response/AdminUsersSetOwnerResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSetOwnerResponse.ts rename to packages/web-api/src/types/response/AdminUsersSetOwnerResponse.ts index 0064d265b..9654efc70 100644 --- a/packages/web-api/src/response/AdminUsersSetOwnerResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSetOwnerResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSetOwnerResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersSetRegularResponse.ts b/packages/web-api/src/types/response/AdminUsersSetRegularResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersSetRegularResponse.ts rename to packages/web-api/src/types/response/AdminUsersSetRegularResponse.ts index 4f5171469..27dc5601b 100644 --- a/packages/web-api/src/response/AdminUsersSetRegularResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersSetRegularResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersSetRegularResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminUsersUnsupportedVersionsExportResponse.ts b/packages/web-api/src/types/response/AdminUsersUnsupportedVersionsExportResponse.ts similarity index 94% rename from packages/web-api/src/response/AdminUsersUnsupportedVersionsExportResponse.ts rename to packages/web-api/src/types/response/AdminUsersUnsupportedVersionsExportResponse.ts index 4f3bd0fac..ea679d0f1 100644 --- a/packages/web-api/src/response/AdminUsersUnsupportedVersionsExportResponse.ts +++ b/packages/web-api/src/types/response/AdminUsersUnsupportedVersionsExportResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminUsersUnsupportedVersionsExportResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminWorkflowsCollaboratorsAddResponse.ts b/packages/web-api/src/types/response/AdminWorkflowsCollaboratorsAddResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminWorkflowsCollaboratorsAddResponse.ts rename to packages/web-api/src/types/response/AdminWorkflowsCollaboratorsAddResponse.ts index 1a8d92d4b..a3359544e 100644 --- a/packages/web-api/src/response/AdminWorkflowsCollaboratorsAddResponse.ts +++ b/packages/web-api/src/types/response/AdminWorkflowsCollaboratorsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminWorkflowsCollaboratorsAddResponse = WebAPICallResult & { error?: string; errors?: Error[]; diff --git a/packages/web-api/src/response/AdminWorkflowsCollaboratorsRemoveResponse.ts b/packages/web-api/src/types/response/AdminWorkflowsCollaboratorsRemoveResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminWorkflowsCollaboratorsRemoveResponse.ts rename to packages/web-api/src/types/response/AdminWorkflowsCollaboratorsRemoveResponse.ts index 2cd20e618..41f9a586f 100644 --- a/packages/web-api/src/response/AdminWorkflowsCollaboratorsRemoveResponse.ts +++ b/packages/web-api/src/types/response/AdminWorkflowsCollaboratorsRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminWorkflowsCollaboratorsRemoveResponse = WebAPICallResult & { error?: string; errors?: Error[]; diff --git a/packages/web-api/src/response/AdminWorkflowsPermissionsLookupResponse.ts b/packages/web-api/src/types/response/AdminWorkflowsPermissionsLookupResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminWorkflowsPermissionsLookupResponse.ts rename to packages/web-api/src/types/response/AdminWorkflowsPermissionsLookupResponse.ts index 5a538fbf8..eea08db2a 100644 --- a/packages/web-api/src/response/AdminWorkflowsPermissionsLookupResponse.ts +++ b/packages/web-api/src/types/response/AdminWorkflowsPermissionsLookupResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminWorkflowsPermissionsLookupResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminWorkflowsSearchResponse.ts b/packages/web-api/src/types/response/AdminWorkflowsSearchResponse.ts similarity index 97% rename from packages/web-api/src/response/AdminWorkflowsSearchResponse.ts rename to packages/web-api/src/types/response/AdminWorkflowsSearchResponse.ts index b9c829ad0..6d27875be 100644 --- a/packages/web-api/src/response/AdminWorkflowsSearchResponse.ts +++ b/packages/web-api/src/types/response/AdminWorkflowsSearchResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminWorkflowsSearchResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AdminWorkflowsUnpublishResponse.ts b/packages/web-api/src/types/response/AdminWorkflowsUnpublishResponse.ts similarity index 95% rename from packages/web-api/src/response/AdminWorkflowsUnpublishResponse.ts rename to packages/web-api/src/types/response/AdminWorkflowsUnpublishResponse.ts index 38c817141..2996ff6aa 100644 --- a/packages/web-api/src/response/AdminWorkflowsUnpublishResponse.ts +++ b/packages/web-api/src/types/response/AdminWorkflowsUnpublishResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AdminWorkflowsUnpublishResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ApiTestResponse.ts b/packages/web-api/src/types/response/ApiTestResponse.ts similarity index 94% rename from packages/web-api/src/response/ApiTestResponse.ts rename to packages/web-api/src/types/response/ApiTestResponse.ts index 46c759c3a..5bbd5cc3b 100644 --- a/packages/web-api/src/response/ApiTestResponse.ts +++ b/packages/web-api/src/types/response/ApiTestResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ApiTestResponse = WebAPICallResult & { args?: Args; error?: string; diff --git a/packages/web-api/src/response/AppsConnectionsOpenResponse.ts b/packages/web-api/src/types/response/AppsConnectionsOpenResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsConnectionsOpenResponse.ts rename to packages/web-api/src/types/response/AppsConnectionsOpenResponse.ts index 72f1dfd32..e567c94f4 100644 --- a/packages/web-api/src/response/AppsConnectionsOpenResponse.ts +++ b/packages/web-api/src/types/response/AppsConnectionsOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsConnectionsOpenResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsEventAuthorizationsListResponse.ts b/packages/web-api/src/types/response/AppsEventAuthorizationsListResponse.ts similarity index 95% rename from packages/web-api/src/response/AppsEventAuthorizationsListResponse.ts rename to packages/web-api/src/types/response/AppsEventAuthorizationsListResponse.ts index 5489ad0a4..ad4c09b62 100644 --- a/packages/web-api/src/response/AppsEventAuthorizationsListResponse.ts +++ b/packages/web-api/src/types/response/AppsEventAuthorizationsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsEventAuthorizationsListResponse = WebAPICallResult & { authorizations?: Authorization[]; error?: string; diff --git a/packages/web-api/src/response/AppsPermissionsInfoResponse.ts b/packages/web-api/src/types/response/AppsPermissionsInfoResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsInfoResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsInfoResponse.ts index 20233b18e..079f3b018 100644 --- a/packages/web-api/src/response/AppsPermissionsInfoResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsPermissionsRequestResponse.ts b/packages/web-api/src/types/response/AppsPermissionsRequestResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsRequestResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsRequestResponse.ts index 5c49656f9..d64493413 100644 --- a/packages/web-api/src/response/AppsPermissionsRequestResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsRequestResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsRequestResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsPermissionsResourcesListResponse.ts b/packages/web-api/src/types/response/AppsPermissionsResourcesListResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsResourcesListResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsResourcesListResponse.ts index 23174fd15..2f4f0e8f4 100644 --- a/packages/web-api/src/response/AppsPermissionsResourcesListResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsResourcesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsResourcesListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsPermissionsScopesListResponse.ts b/packages/web-api/src/types/response/AppsPermissionsScopesListResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsScopesListResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsScopesListResponse.ts index daa9efcae..11eeffc7f 100644 --- a/packages/web-api/src/response/AppsPermissionsScopesListResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsScopesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsScopesListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsPermissionsUsersListResponse.ts b/packages/web-api/src/types/response/AppsPermissionsUsersListResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsUsersListResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsUsersListResponse.ts index f9d0c9e9b..d675351a3 100644 --- a/packages/web-api/src/response/AppsPermissionsUsersListResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsUsersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsUsersListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsPermissionsUsersRequestResponse.ts b/packages/web-api/src/types/response/AppsPermissionsUsersRequestResponse.ts similarity index 94% rename from packages/web-api/src/response/AppsPermissionsUsersRequestResponse.ts rename to packages/web-api/src/types/response/AppsPermissionsUsersRequestResponse.ts index 9ce0e5783..f231ad950 100644 --- a/packages/web-api/src/response/AppsPermissionsUsersRequestResponse.ts +++ b/packages/web-api/src/types/response/AppsPermissionsUsersRequestResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsPermissionsUsersRequestResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AppsUninstallResponse.ts b/packages/web-api/src/types/response/AppsUninstallResponse.ts similarity index 95% rename from packages/web-api/src/response/AppsUninstallResponse.ts rename to packages/web-api/src/types/response/AppsUninstallResponse.ts index 8cb22c2cc..956647391 100644 --- a/packages/web-api/src/response/AppsUninstallResponse.ts +++ b/packages/web-api/src/types/response/AppsUninstallResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsUninstallResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AuthRevokeResponse.ts b/packages/web-api/src/types/response/AuthRevokeResponse.ts similarity index 94% rename from packages/web-api/src/response/AuthRevokeResponse.ts rename to packages/web-api/src/types/response/AuthRevokeResponse.ts index 1c87610f9..110808738 100644 --- a/packages/web-api/src/response/AuthRevokeResponse.ts +++ b/packages/web-api/src/types/response/AuthRevokeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AuthRevokeResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AuthTeamsListResponse.ts b/packages/web-api/src/types/response/AuthTeamsListResponse.ts similarity index 96% rename from packages/web-api/src/response/AuthTeamsListResponse.ts rename to packages/web-api/src/types/response/AuthTeamsListResponse.ts index c957f4c60..b6a16aaed 100644 --- a/packages/web-api/src/response/AuthTeamsListResponse.ts +++ b/packages/web-api/src/types/response/AuthTeamsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AuthTeamsListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/AuthTestResponse.ts b/packages/web-api/src/types/response/AuthTestResponse.ts similarity index 96% rename from packages/web-api/src/response/AuthTestResponse.ts rename to packages/web-api/src/types/response/AuthTestResponse.ts index 0c0365bed..5381bf2bb 100644 --- a/packages/web-api/src/response/AuthTestResponse.ts +++ b/packages/web-api/src/types/response/AuthTestResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AuthTestResponse = WebAPICallResult & { app_id?: string; app_name?: string; diff --git a/packages/web-api/src/response/BookmarksAddResponse.ts b/packages/web-api/src/types/response/BookmarksAddResponse.ts similarity index 96% rename from packages/web-api/src/response/BookmarksAddResponse.ts rename to packages/web-api/src/types/response/BookmarksAddResponse.ts index e2fd9cd9e..d458b051b 100644 --- a/packages/web-api/src/response/BookmarksAddResponse.ts +++ b/packages/web-api/src/types/response/BookmarksAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type BookmarksAddResponse = WebAPICallResult & { bookmark?: Bookmark; error?: string; diff --git a/packages/web-api/src/response/BookmarksEditResponse.ts b/packages/web-api/src/types/response/BookmarksEditResponse.ts similarity index 96% rename from packages/web-api/src/response/BookmarksEditResponse.ts rename to packages/web-api/src/types/response/BookmarksEditResponse.ts index 7166da474..1cd98060c 100644 --- a/packages/web-api/src/response/BookmarksEditResponse.ts +++ b/packages/web-api/src/types/response/BookmarksEditResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type BookmarksEditResponse = WebAPICallResult & { bookmark?: Bookmark; error?: string; diff --git a/packages/web-api/src/response/BookmarksListResponse.ts b/packages/web-api/src/types/response/BookmarksListResponse.ts similarity index 96% rename from packages/web-api/src/response/BookmarksListResponse.ts rename to packages/web-api/src/types/response/BookmarksListResponse.ts index 8fd91eb6a..6fb4f5ce4 100644 --- a/packages/web-api/src/response/BookmarksListResponse.ts +++ b/packages/web-api/src/types/response/BookmarksListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type BookmarksListResponse = WebAPICallResult & { bookmarks?: Bookmark[]; error?: string; diff --git a/packages/web-api/src/response/BookmarksRemoveResponse.ts b/packages/web-api/src/types/response/BookmarksRemoveResponse.ts similarity index 95% rename from packages/web-api/src/response/BookmarksRemoveResponse.ts rename to packages/web-api/src/types/response/BookmarksRemoveResponse.ts index 2076e3be5..01236f5cb 100644 --- a/packages/web-api/src/response/BookmarksRemoveResponse.ts +++ b/packages/web-api/src/types/response/BookmarksRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type BookmarksRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/BotsInfoResponse.ts b/packages/web-api/src/types/response/BotsInfoResponse.ts similarity index 95% rename from packages/web-api/src/response/BotsInfoResponse.ts rename to packages/web-api/src/types/response/BotsInfoResponse.ts index 7d4f6e499..10665fc9c 100644 --- a/packages/web-api/src/response/BotsInfoResponse.ts +++ b/packages/web-api/src/types/response/BotsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type BotsInfoResponse = WebAPICallResult & { bot?: Bot; error?: string; diff --git a/packages/web-api/src/response/CallsAddResponse.ts b/packages/web-api/src/types/response/CallsAddResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsAddResponse.ts rename to packages/web-api/src/types/response/CallsAddResponse.ts index 3984349ae..f88470755 100644 --- a/packages/web-api/src/response/CallsAddResponse.ts +++ b/packages/web-api/src/types/response/CallsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsAddResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/CallsEndResponse.ts b/packages/web-api/src/types/response/CallsEndResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsEndResponse.ts rename to packages/web-api/src/types/response/CallsEndResponse.ts index 44004267b..a4c946dd6 100644 --- a/packages/web-api/src/response/CallsEndResponse.ts +++ b/packages/web-api/src/types/response/CallsEndResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsEndResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/CallsInfoResponse.ts b/packages/web-api/src/types/response/CallsInfoResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsInfoResponse.ts rename to packages/web-api/src/types/response/CallsInfoResponse.ts index 5c535607c..5d816165f 100644 --- a/packages/web-api/src/response/CallsInfoResponse.ts +++ b/packages/web-api/src/types/response/CallsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsInfoResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/CallsParticipantsAddResponse.ts b/packages/web-api/src/types/response/CallsParticipantsAddResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsParticipantsAddResponse.ts rename to packages/web-api/src/types/response/CallsParticipantsAddResponse.ts index c62900f4c..8ffda7357 100644 --- a/packages/web-api/src/response/CallsParticipantsAddResponse.ts +++ b/packages/web-api/src/types/response/CallsParticipantsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsParticipantsAddResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/CallsParticipantsRemoveResponse.ts b/packages/web-api/src/types/response/CallsParticipantsRemoveResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsParticipantsRemoveResponse.ts rename to packages/web-api/src/types/response/CallsParticipantsRemoveResponse.ts index 203014423..098130763 100644 --- a/packages/web-api/src/response/CallsParticipantsRemoveResponse.ts +++ b/packages/web-api/src/types/response/CallsParticipantsRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsParticipantsRemoveResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/CallsUpdateResponse.ts b/packages/web-api/src/types/response/CallsUpdateResponse.ts similarity index 96% rename from packages/web-api/src/response/CallsUpdateResponse.ts rename to packages/web-api/src/types/response/CallsUpdateResponse.ts index bd0206d65..3d09eaa61 100644 --- a/packages/web-api/src/response/CallsUpdateResponse.ts +++ b/packages/web-api/src/types/response/CallsUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type CallsUpdateResponse = WebAPICallResult & { call?: Call; error?: string; diff --git a/packages/web-api/src/response/ChannelsArchiveResponse.ts b/packages/web-api/src/types/response/ChannelsArchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsArchiveResponse.ts rename to packages/web-api/src/types/response/ChannelsArchiveResponse.ts index 9c9bb92b7..e80e0ad1e 100644 --- a/packages/web-api/src/response/ChannelsArchiveResponse.ts +++ b/packages/web-api/src/types/response/ChannelsArchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsArchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsCreateResponse.ts b/packages/web-api/src/types/response/ChannelsCreateResponse.ts similarity index 97% rename from packages/web-api/src/response/ChannelsCreateResponse.ts rename to packages/web-api/src/types/response/ChannelsCreateResponse.ts index d71f2584f..6a146cb00 100644 --- a/packages/web-api/src/response/ChannelsCreateResponse.ts +++ b/packages/web-api/src/types/response/ChannelsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsCreateResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ChannelsHistoryResponse.ts b/packages/web-api/src/types/response/ChannelsHistoryResponse.ts similarity index 99% rename from packages/web-api/src/response/ChannelsHistoryResponse.ts rename to packages/web-api/src/types/response/ChannelsHistoryResponse.ts index 47d8677ca..85b73447d 100644 --- a/packages/web-api/src/response/ChannelsHistoryResponse.ts +++ b/packages/web-api/src/types/response/ChannelsHistoryResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsHistoryResponse = WebAPICallResult & { channel_actions_count?: number; channel_actions_ts?: number; diff --git a/packages/web-api/src/response/ChannelsInfoResponse.ts b/packages/web-api/src/types/response/ChannelsInfoResponse.ts similarity index 99% rename from packages/web-api/src/response/ChannelsInfoResponse.ts rename to packages/web-api/src/types/response/ChannelsInfoResponse.ts index 133250df4..729e24720 100644 --- a/packages/web-api/src/response/ChannelsInfoResponse.ts +++ b/packages/web-api/src/types/response/ChannelsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsInfoResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ChannelsInviteResponse.ts b/packages/web-api/src/types/response/ChannelsInviteResponse.ts similarity index 97% rename from packages/web-api/src/response/ChannelsInviteResponse.ts rename to packages/web-api/src/types/response/ChannelsInviteResponse.ts index 86b54c781..8068e085b 100644 --- a/packages/web-api/src/response/ChannelsInviteResponse.ts +++ b/packages/web-api/src/types/response/ChannelsInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsInviteResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ChannelsJoinResponse.ts b/packages/web-api/src/types/response/ChannelsJoinResponse.ts similarity index 97% rename from packages/web-api/src/response/ChannelsJoinResponse.ts rename to packages/web-api/src/types/response/ChannelsJoinResponse.ts index a63617446..f9aaac9b3 100644 --- a/packages/web-api/src/response/ChannelsJoinResponse.ts +++ b/packages/web-api/src/types/response/ChannelsJoinResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsJoinResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ChannelsKickResponse.ts b/packages/web-api/src/types/response/ChannelsKickResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsKickResponse.ts rename to packages/web-api/src/types/response/ChannelsKickResponse.ts index bd70952e9..6acfb07f5 100644 --- a/packages/web-api/src/response/ChannelsKickResponse.ts +++ b/packages/web-api/src/types/response/ChannelsKickResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsKickResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsLeaveResponse.ts b/packages/web-api/src/types/response/ChannelsLeaveResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsLeaveResponse.ts rename to packages/web-api/src/types/response/ChannelsLeaveResponse.ts index 45e1611d6..905bacdae 100644 --- a/packages/web-api/src/response/ChannelsLeaveResponse.ts +++ b/packages/web-api/src/types/response/ChannelsLeaveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsLeaveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsListResponse.ts b/packages/web-api/src/types/response/ChannelsListResponse.ts similarity index 97% rename from packages/web-api/src/response/ChannelsListResponse.ts rename to packages/web-api/src/types/response/ChannelsListResponse.ts index fdd170961..a61766760 100644 --- a/packages/web-api/src/response/ChannelsListResponse.ts +++ b/packages/web-api/src/types/response/ChannelsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsListResponse = WebAPICallResult & { channels?: Channel[]; error?: string; diff --git a/packages/web-api/src/response/ChannelsMarkResponse.ts b/packages/web-api/src/types/response/ChannelsMarkResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsMarkResponse.ts rename to packages/web-api/src/types/response/ChannelsMarkResponse.ts index bbf9c8ba5..336d09521 100644 --- a/packages/web-api/src/response/ChannelsMarkResponse.ts +++ b/packages/web-api/src/types/response/ChannelsMarkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsMarkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsRenameResponse.ts b/packages/web-api/src/types/response/ChannelsRenameResponse.ts similarity index 96% rename from packages/web-api/src/response/ChannelsRenameResponse.ts rename to packages/web-api/src/types/response/ChannelsRenameResponse.ts index 1986ec9e5..dbaed13de 100644 --- a/packages/web-api/src/response/ChannelsRenameResponse.ts +++ b/packages/web-api/src/types/response/ChannelsRenameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsRenameResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ChannelsRepliesResponse.ts b/packages/web-api/src/types/response/ChannelsRepliesResponse.ts similarity index 97% rename from packages/web-api/src/response/ChannelsRepliesResponse.ts rename to packages/web-api/src/types/response/ChannelsRepliesResponse.ts index 324e61eac..722ef4482 100644 --- a/packages/web-api/src/response/ChannelsRepliesResponse.ts +++ b/packages/web-api/src/types/response/ChannelsRepliesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsRepliesResponse = WebAPICallResult & { error?: string; has_more?: boolean; diff --git a/packages/web-api/src/response/ChannelsSetPurposeResponse.ts b/packages/web-api/src/types/response/ChannelsSetPurposeResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsSetPurposeResponse.ts rename to packages/web-api/src/types/response/ChannelsSetPurposeResponse.ts index f726e6dbb..6a37e607e 100644 --- a/packages/web-api/src/response/ChannelsSetPurposeResponse.ts +++ b/packages/web-api/src/types/response/ChannelsSetPurposeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsSetPurposeResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsSetTopicResponse.ts b/packages/web-api/src/types/response/ChannelsSetTopicResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsSetTopicResponse.ts rename to packages/web-api/src/types/response/ChannelsSetTopicResponse.ts index 9c3665b3b..8507ae8ce 100644 --- a/packages/web-api/src/response/ChannelsSetTopicResponse.ts +++ b/packages/web-api/src/types/response/ChannelsSetTopicResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsSetTopicResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChannelsUnarchiveResponse.ts b/packages/web-api/src/types/response/ChannelsUnarchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/ChannelsUnarchiveResponse.ts rename to packages/web-api/src/types/response/ChannelsUnarchiveResponse.ts index 12726c6d4..78324f681 100644 --- a/packages/web-api/src/response/ChannelsUnarchiveResponse.ts +++ b/packages/web-api/src/types/response/ChannelsUnarchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChannelsUnarchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChatDeleteResponse.ts b/packages/web-api/src/types/response/ChatDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatDeleteResponse.ts rename to packages/web-api/src/types/response/ChatDeleteResponse.ts index 1b763e31d..e48ff26bd 100644 --- a/packages/web-api/src/response/ChatDeleteResponse.ts +++ b/packages/web-api/src/types/response/ChatDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatDeleteResponse = WebAPICallResult & { channel?: string; error?: string; diff --git a/packages/web-api/src/response/ChatDeleteScheduledMessageResponse.ts b/packages/web-api/src/types/response/ChatDeleteScheduledMessageResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatDeleteScheduledMessageResponse.ts rename to packages/web-api/src/types/response/ChatDeleteScheduledMessageResponse.ts index 6ed14437e..17e061de0 100644 --- a/packages/web-api/src/response/ChatDeleteScheduledMessageResponse.ts +++ b/packages/web-api/src/types/response/ChatDeleteScheduledMessageResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatDeleteScheduledMessageResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChatGetPermalinkResponse.ts b/packages/web-api/src/types/response/ChatGetPermalinkResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatGetPermalinkResponse.ts rename to packages/web-api/src/types/response/ChatGetPermalinkResponse.ts index ceed1cdfa..0a89af143 100644 --- a/packages/web-api/src/response/ChatGetPermalinkResponse.ts +++ b/packages/web-api/src/types/response/ChatGetPermalinkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatGetPermalinkResponse = WebAPICallResult & { channel?: string; error?: string; diff --git a/packages/web-api/src/response/ChatMeMessageResponse.ts b/packages/web-api/src/types/response/ChatMeMessageResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatMeMessageResponse.ts rename to packages/web-api/src/types/response/ChatMeMessageResponse.ts index c24462617..7e742b5dc 100644 --- a/packages/web-api/src/response/ChatMeMessageResponse.ts +++ b/packages/web-api/src/types/response/ChatMeMessageResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatMeMessageResponse = WebAPICallResult & { channel?: string; error?: string; diff --git a/packages/web-api/src/response/ChatPostEphemeralResponse.ts b/packages/web-api/src/types/response/ChatPostEphemeralResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatPostEphemeralResponse.ts rename to packages/web-api/src/types/response/ChatPostEphemeralResponse.ts index 93f48bcb3..03d41b14a 100644 --- a/packages/web-api/src/response/ChatPostEphemeralResponse.ts +++ b/packages/web-api/src/types/response/ChatPostEphemeralResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatPostEphemeralResponse = WebAPICallResult & { error?: string; message_ts?: string; diff --git a/packages/web-api/src/response/ChatPostMessageResponse.ts b/packages/web-api/src/types/response/ChatPostMessageResponse.ts similarity index 97% rename from packages/web-api/src/response/ChatPostMessageResponse.ts rename to packages/web-api/src/types/response/ChatPostMessageResponse.ts index c22a2328a..e2336e0c4 100644 --- a/packages/web-api/src/response/ChatPostMessageResponse.ts +++ b/packages/web-api/src/types/response/ChatPostMessageResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatPostMessageResponse = WebAPICallResult & { channel?: string; deprecated_argument?: string; @@ -66,6 +66,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -73,6 +74,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -345,6 +347,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -422,6 +425,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -471,6 +479,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -535,6 +544,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -677,6 +687,7 @@ export interface MessageFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -754,6 +765,11 @@ export interface MessageFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -803,6 +819,7 @@ export interface MessageFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ChatScheduleMessageResponse.ts b/packages/web-api/src/types/response/ChatScheduleMessageResponse.ts similarity index 97% rename from packages/web-api/src/response/ChatScheduleMessageResponse.ts rename to packages/web-api/src/types/response/ChatScheduleMessageResponse.ts index ffbd1ce59..ee2578684 100644 --- a/packages/web-api/src/response/ChatScheduleMessageResponse.ts +++ b/packages/web-api/src/types/response/ChatScheduleMessageResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatScheduleMessageResponse = WebAPICallResult & { channel?: string; error?: string; @@ -279,6 +279,7 @@ export interface File { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -356,6 +357,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -405,6 +411,7 @@ export interface File { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ChatScheduledMessagesListResponse.ts b/packages/web-api/src/types/response/ChatScheduledMessagesListResponse.ts similarity index 96% rename from packages/web-api/src/response/ChatScheduledMessagesListResponse.ts rename to packages/web-api/src/types/response/ChatScheduledMessagesListResponse.ts index f85c27247..6fe95f0a5 100644 --- a/packages/web-api/src/response/ChatScheduledMessagesListResponse.ts +++ b/packages/web-api/src/types/response/ChatScheduledMessagesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatScheduledMessagesListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChatUnfurlResponse.ts b/packages/web-api/src/types/response/ChatUnfurlResponse.ts similarity index 94% rename from packages/web-api/src/response/ChatUnfurlResponse.ts rename to packages/web-api/src/types/response/ChatUnfurlResponse.ts index 3567b6f0a..d2d21f9ed 100644 --- a/packages/web-api/src/response/ChatUnfurlResponse.ts +++ b/packages/web-api/src/types/response/ChatUnfurlResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatUnfurlResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ChatUpdateResponse.ts b/packages/web-api/src/types/response/ChatUpdateResponse.ts similarity index 97% rename from packages/web-api/src/response/ChatUpdateResponse.ts rename to packages/web-api/src/types/response/ChatUpdateResponse.ts index 8e2427d3d..4f39e6859 100644 --- a/packages/web-api/src/response/ChatUpdateResponse.ts +++ b/packages/web-api/src/types/response/ChatUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ChatUpdateResponse = WebAPICallResult & { channel?: string; error?: string; @@ -291,6 +291,7 @@ export interface BlockFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -368,6 +369,11 @@ export interface BlockFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -417,6 +423,7 @@ export interface BlockFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -492,6 +499,7 @@ export interface FileElement { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -569,6 +577,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -618,6 +631,7 @@ export interface FileElement { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -652,6 +666,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/ConversationsAcceptSharedInviteResponse.ts b/packages/web-api/src/types/response/ConversationsAcceptSharedInviteResponse.ts similarity index 95% rename from packages/web-api/src/response/ConversationsAcceptSharedInviteResponse.ts rename to packages/web-api/src/types/response/ConversationsAcceptSharedInviteResponse.ts index 9b6b1f300..64436cb53 100644 --- a/packages/web-api/src/response/ConversationsAcceptSharedInviteResponse.ts +++ b/packages/web-api/src/types/response/ConversationsAcceptSharedInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsAcceptSharedInviteResponse = WebAPICallResult & { can_open_scdm?: boolean; channel_id?: string; diff --git a/packages/web-api/src/response/ConversationsApproveSharedInviteResponse.ts b/packages/web-api/src/types/response/ConversationsApproveSharedInviteResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsApproveSharedInviteResponse.ts rename to packages/web-api/src/types/response/ConversationsApproveSharedInviteResponse.ts index 05a5cb61e..ad52f553f 100644 --- a/packages/web-api/src/response/ConversationsApproveSharedInviteResponse.ts +++ b/packages/web-api/src/types/response/ConversationsApproveSharedInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsApproveSharedInviteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsArchiveResponse.ts b/packages/web-api/src/types/response/ConversationsArchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsArchiveResponse.ts rename to packages/web-api/src/types/response/ConversationsArchiveResponse.ts index d8447886c..c2ff760c5 100644 --- a/packages/web-api/src/response/ConversationsArchiveResponse.ts +++ b/packages/web-api/src/types/response/ConversationsArchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsArchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsCloseResponse.ts b/packages/web-api/src/types/response/ConversationsCloseResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsCloseResponse.ts rename to packages/web-api/src/types/response/ConversationsCloseResponse.ts index 234bf153e..12da711b3 100644 --- a/packages/web-api/src/response/ConversationsCloseResponse.ts +++ b/packages/web-api/src/types/response/ConversationsCloseResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsCloseResponse = WebAPICallResult & { already_closed?: boolean; error?: string; diff --git a/packages/web-api/src/response/ConversationsCreateResponse.ts b/packages/web-api/src/types/response/ConversationsCreateResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsCreateResponse.ts rename to packages/web-api/src/types/response/ConversationsCreateResponse.ts index 187d95954..0141f32a6 100644 --- a/packages/web-api/src/response/ConversationsCreateResponse.ts +++ b/packages/web-api/src/types/response/ConversationsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsCreateResponse = WebAPICallResult & { channel?: Channel; detail?: string; diff --git a/packages/web-api/src/response/ConversationsDeclineSharedInviteResponse.ts b/packages/web-api/src/types/response/ConversationsDeclineSharedInviteResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsDeclineSharedInviteResponse.ts rename to packages/web-api/src/types/response/ConversationsDeclineSharedInviteResponse.ts index 9b6085d7d..424f9ce71 100644 --- a/packages/web-api/src/response/ConversationsDeclineSharedInviteResponse.ts +++ b/packages/web-api/src/types/response/ConversationsDeclineSharedInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsDeclineSharedInviteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsHistoryResponse.ts b/packages/web-api/src/types/response/ConversationsHistoryResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsHistoryResponse.ts rename to packages/web-api/src/types/response/ConversationsHistoryResponse.ts index 58424191b..8704e1209 100644 --- a/packages/web-api/src/response/ConversationsHistoryResponse.ts +++ b/packages/web-api/src/types/response/ConversationsHistoryResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsHistoryResponse = WebAPICallResult & { channel_actions_count?: number; channel_actions_ts?: number; @@ -82,6 +82,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -89,6 +90,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -361,6 +363,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -438,6 +441,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -487,6 +495,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -551,6 +560,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -693,6 +703,7 @@ export interface BlockFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -770,6 +781,11 @@ export interface BlockFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -819,6 +835,7 @@ export interface BlockFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ConversationsInfoResponse.ts b/packages/web-api/src/types/response/ConversationsInfoResponse.ts similarity index 98% rename from packages/web-api/src/response/ConversationsInfoResponse.ts rename to packages/web-api/src/types/response/ConversationsInfoResponse.ts index a621e3d58..3b8950cfa 100644 --- a/packages/web-api/src/response/ConversationsInfoResponse.ts +++ b/packages/web-api/src/types/response/ConversationsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsInfoResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsInviteResponse.ts b/packages/web-api/src/types/response/ConversationsInviteResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsInviteResponse.ts rename to packages/web-api/src/types/response/ConversationsInviteResponse.ts index d2a8865ff..e7c4325f5 100644 --- a/packages/web-api/src/response/ConversationsInviteResponse.ts +++ b/packages/web-api/src/types/response/ConversationsInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsInviteResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsInviteSharedResponse.ts b/packages/web-api/src/types/response/ConversationsInviteSharedResponse.ts similarity index 95% rename from packages/web-api/src/response/ConversationsInviteSharedResponse.ts rename to packages/web-api/src/types/response/ConversationsInviteSharedResponse.ts index 4cc39df66..1e089be05 100644 --- a/packages/web-api/src/response/ConversationsInviteSharedResponse.ts +++ b/packages/web-api/src/types/response/ConversationsInviteSharedResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsInviteSharedResponse = WebAPICallResult & { conf_code?: string; error?: string; diff --git a/packages/web-api/src/response/ConversationsJoinResponse.ts b/packages/web-api/src/types/response/ConversationsJoinResponse.ts similarity index 98% rename from packages/web-api/src/response/ConversationsJoinResponse.ts rename to packages/web-api/src/types/response/ConversationsJoinResponse.ts index 07575f2cc..bbe501f1f 100644 --- a/packages/web-api/src/response/ConversationsJoinResponse.ts +++ b/packages/web-api/src/types/response/ConversationsJoinResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsJoinResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsKickResponse.ts b/packages/web-api/src/types/response/ConversationsKickResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsKickResponse.ts rename to packages/web-api/src/types/response/ConversationsKickResponse.ts index f106dac7b..4986d8916 100644 --- a/packages/web-api/src/response/ConversationsKickResponse.ts +++ b/packages/web-api/src/types/response/ConversationsKickResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsKickResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsLeaveResponse.ts b/packages/web-api/src/types/response/ConversationsLeaveResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsLeaveResponse.ts rename to packages/web-api/src/types/response/ConversationsLeaveResponse.ts index aeea0998e..5d97618b1 100644 --- a/packages/web-api/src/response/ConversationsLeaveResponse.ts +++ b/packages/web-api/src/types/response/ConversationsLeaveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsLeaveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsListConnectInvitesResponse.ts b/packages/web-api/src/types/response/ConversationsListConnectInvitesResponse.ts similarity index 98% rename from packages/web-api/src/response/ConversationsListConnectInvitesResponse.ts rename to packages/web-api/src/types/response/ConversationsListConnectInvitesResponse.ts index c0dcdb509..f4590ae07 100644 --- a/packages/web-api/src/response/ConversationsListConnectInvitesResponse.ts +++ b/packages/web-api/src/types/response/ConversationsListConnectInvitesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsListConnectInvitesResponse = WebAPICallResult & { arg?: string; error?: string; diff --git a/packages/web-api/src/response/ConversationsListResponse.ts b/packages/web-api/src/types/response/ConversationsListResponse.ts similarity index 98% rename from packages/web-api/src/response/ConversationsListResponse.ts rename to packages/web-api/src/types/response/ConversationsListResponse.ts index 6d8922d51..d9a29af21 100644 --- a/packages/web-api/src/response/ConversationsListResponse.ts +++ b/packages/web-api/src/types/response/ConversationsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsListResponse = WebAPICallResult & { channels?: Channel[]; error?: string; diff --git a/packages/web-api/src/response/ConversationsMarkResponse.ts b/packages/web-api/src/types/response/ConversationsMarkResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsMarkResponse.ts rename to packages/web-api/src/types/response/ConversationsMarkResponse.ts index c5c6cd1cc..9fbffa74d 100644 --- a/packages/web-api/src/response/ConversationsMarkResponse.ts +++ b/packages/web-api/src/types/response/ConversationsMarkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsMarkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ConversationsMembersResponse.ts b/packages/web-api/src/types/response/ConversationsMembersResponse.ts similarity index 95% rename from packages/web-api/src/response/ConversationsMembersResponse.ts rename to packages/web-api/src/types/response/ConversationsMembersResponse.ts index 0875c232d..b39ebfdc3 100644 --- a/packages/web-api/src/response/ConversationsMembersResponse.ts +++ b/packages/web-api/src/types/response/ConversationsMembersResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsMembersResponse = WebAPICallResult & { error?: string; members?: string[]; diff --git a/packages/web-api/src/response/ConversationsOpenResponse.ts b/packages/web-api/src/types/response/ConversationsOpenResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsOpenResponse.ts rename to packages/web-api/src/types/response/ConversationsOpenResponse.ts index 1defed657..cf4164848 100644 --- a/packages/web-api/src/response/ConversationsOpenResponse.ts +++ b/packages/web-api/src/types/response/ConversationsOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsOpenResponse = WebAPICallResult & { already_open?: boolean; channel?: Channel; @@ -37,6 +37,7 @@ export interface Channel { } export interface Latest { + app_id?: string; blocks?: Block[]; bot_id?: string; bot_profile?: BotProfile; @@ -294,6 +295,7 @@ export interface File { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -371,6 +373,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -420,6 +427,7 @@ export interface File { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ConversationsRenameResponse.ts b/packages/web-api/src/types/response/ConversationsRenameResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsRenameResponse.ts rename to packages/web-api/src/types/response/ConversationsRenameResponse.ts index e9780b616..246146bce 100644 --- a/packages/web-api/src/response/ConversationsRenameResponse.ts +++ b/packages/web-api/src/types/response/ConversationsRenameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsRenameResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsRepliesResponse.ts b/packages/web-api/src/types/response/ConversationsRepliesResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsRepliesResponse.ts rename to packages/web-api/src/types/response/ConversationsRepliesResponse.ts index 754aedb0d..cbb236553 100644 --- a/packages/web-api/src/response/ConversationsRepliesResponse.ts +++ b/packages/web-api/src/types/response/ConversationsRepliesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsRepliesResponse = WebAPICallResult & { error?: string; has_more?: boolean; @@ -71,6 +71,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -78,6 +79,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -350,6 +352,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -427,6 +430,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -476,6 +484,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -540,6 +549,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -682,6 +692,7 @@ export interface BlockFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -759,6 +770,11 @@ export interface BlockFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -808,6 +824,7 @@ export interface BlockFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ConversationsSetPurposeResponse.ts b/packages/web-api/src/types/response/ConversationsSetPurposeResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsSetPurposeResponse.ts rename to packages/web-api/src/types/response/ConversationsSetPurposeResponse.ts index 9a76a8d8b..2ea93449e 100644 --- a/packages/web-api/src/response/ConversationsSetPurposeResponse.ts +++ b/packages/web-api/src/types/response/ConversationsSetPurposeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsSetPurposeResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsSetTopicResponse.ts b/packages/web-api/src/types/response/ConversationsSetTopicResponse.ts similarity index 97% rename from packages/web-api/src/response/ConversationsSetTopicResponse.ts rename to packages/web-api/src/types/response/ConversationsSetTopicResponse.ts index 2c7b7f7b8..e663b00bf 100644 --- a/packages/web-api/src/response/ConversationsSetTopicResponse.ts +++ b/packages/web-api/src/types/response/ConversationsSetTopicResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsSetTopicResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/ConversationsUnarchiveResponse.ts b/packages/web-api/src/types/response/ConversationsUnarchiveResponse.ts similarity index 94% rename from packages/web-api/src/response/ConversationsUnarchiveResponse.ts rename to packages/web-api/src/types/response/ConversationsUnarchiveResponse.ts index 71bb24aff..5b5365f29 100644 --- a/packages/web-api/src/response/ConversationsUnarchiveResponse.ts +++ b/packages/web-api/src/types/response/ConversationsUnarchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ConversationsUnarchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/DialogOpenResponse.ts b/packages/web-api/src/types/response/DialogOpenResponse.ts similarity index 95% rename from packages/web-api/src/response/DialogOpenResponse.ts rename to packages/web-api/src/types/response/DialogOpenResponse.ts index 7c2f9ac0f..9be2b79e7 100644 --- a/packages/web-api/src/response/DialogOpenResponse.ts +++ b/packages/web-api/src/types/response/DialogOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DialogOpenResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/DndEndDndResponse.ts b/packages/web-api/src/types/response/DndEndDndResponse.ts similarity index 94% rename from packages/web-api/src/response/DndEndDndResponse.ts rename to packages/web-api/src/types/response/DndEndDndResponse.ts index a3e904f6a..756d5b758 100644 --- a/packages/web-api/src/response/DndEndDndResponse.ts +++ b/packages/web-api/src/types/response/DndEndDndResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DndEndDndResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/DndEndSnoozeResponse.ts b/packages/web-api/src/types/response/DndEndSnoozeResponse.ts similarity index 95% rename from packages/web-api/src/response/DndEndSnoozeResponse.ts rename to packages/web-api/src/types/response/DndEndSnoozeResponse.ts index 7b8c97026..83e21ba98 100644 --- a/packages/web-api/src/response/DndEndSnoozeResponse.ts +++ b/packages/web-api/src/types/response/DndEndSnoozeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DndEndSnoozeResponse = WebAPICallResult & { dnd_enabled?: boolean; error?: string; diff --git a/packages/web-api/src/response/DndInfoResponse.ts b/packages/web-api/src/types/response/DndInfoResponse.ts similarity index 95% rename from packages/web-api/src/response/DndInfoResponse.ts rename to packages/web-api/src/types/response/DndInfoResponse.ts index e2deaa4fa..b2887439b 100644 --- a/packages/web-api/src/response/DndInfoResponse.ts +++ b/packages/web-api/src/types/response/DndInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DndInfoResponse = WebAPICallResult & { dnd_enabled?: boolean; error?: string; diff --git a/packages/web-api/src/response/DndSetSnoozeResponse.ts b/packages/web-api/src/types/response/DndSetSnoozeResponse.ts similarity index 95% rename from packages/web-api/src/response/DndSetSnoozeResponse.ts rename to packages/web-api/src/types/response/DndSetSnoozeResponse.ts index 5aaf2f641..9a443a16b 100644 --- a/packages/web-api/src/response/DndSetSnoozeResponse.ts +++ b/packages/web-api/src/types/response/DndSetSnoozeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DndSetSnoozeResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/DndTeamInfoResponse.ts b/packages/web-api/src/types/response/DndTeamInfoResponse.ts similarity index 95% rename from packages/web-api/src/response/DndTeamInfoResponse.ts rename to packages/web-api/src/types/response/DndTeamInfoResponse.ts index ac115a079..371e77c28 100644 --- a/packages/web-api/src/response/DndTeamInfoResponse.ts +++ b/packages/web-api/src/types/response/DndTeamInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type DndTeamInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/EmojiListResponse.ts b/packages/web-api/src/types/response/EmojiListResponse.ts similarity index 95% rename from packages/web-api/src/response/EmojiListResponse.ts rename to packages/web-api/src/types/response/EmojiListResponse.ts index 95ba5726f..ce29e4cd7 100644 --- a/packages/web-api/src/response/EmojiListResponse.ts +++ b/packages/web-api/src/types/response/EmojiListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type EmojiListResponse = WebAPICallResult & { cache_ts?: string; categories?: Category[]; diff --git a/packages/web-api/src/response/FilesCommentsAddResponse.ts b/packages/web-api/src/types/response/FilesCommentsAddResponse.ts similarity index 94% rename from packages/web-api/src/response/FilesCommentsAddResponse.ts rename to packages/web-api/src/types/response/FilesCommentsAddResponse.ts index 7080c7ad6..90e5f36e2 100644 --- a/packages/web-api/src/response/FilesCommentsAddResponse.ts +++ b/packages/web-api/src/types/response/FilesCommentsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesCommentsAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/FilesCommentsDeleteResponse.ts b/packages/web-api/src/types/response/FilesCommentsDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/FilesCommentsDeleteResponse.ts rename to packages/web-api/src/types/response/FilesCommentsDeleteResponse.ts index 2ce420585..55ae084f4 100644 --- a/packages/web-api/src/response/FilesCommentsDeleteResponse.ts +++ b/packages/web-api/src/types/response/FilesCommentsDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesCommentsDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/FilesCommentsEditResponse.ts b/packages/web-api/src/types/response/FilesCommentsEditResponse.ts similarity index 95% rename from packages/web-api/src/response/FilesCommentsEditResponse.ts rename to packages/web-api/src/types/response/FilesCommentsEditResponse.ts index 2c65ffa86..3ae49de2d 100644 --- a/packages/web-api/src/response/FilesCommentsEditResponse.ts +++ b/packages/web-api/src/types/response/FilesCommentsEditResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesCommentsEditResponse = WebAPICallResult & { comment?: Comment; error?: string; diff --git a/packages/web-api/src/response/FilesCompleteUploadExternalResponse.ts b/packages/web-api/src/types/response/FilesCompleteUploadExternalResponse.ts similarity index 98% rename from packages/web-api/src/response/FilesCompleteUploadExternalResponse.ts rename to packages/web-api/src/types/response/FilesCompleteUploadExternalResponse.ts index 497ced64b..85ccccc8c 100644 --- a/packages/web-api/src/response/FilesCompleteUploadExternalResponse.ts +++ b/packages/web-api/src/types/response/FilesCompleteUploadExternalResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesCompleteUploadExternalResponse = WebAPICallResult & { error?: string; files?: File[]; diff --git a/packages/web-api/src/response/FilesDeleteResponse.ts b/packages/web-api/src/types/response/FilesDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/FilesDeleteResponse.ts rename to packages/web-api/src/types/response/FilesDeleteResponse.ts index c6dafce66..ba164803c 100644 --- a/packages/web-api/src/response/FilesDeleteResponse.ts +++ b/packages/web-api/src/types/response/FilesDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/FilesGetUploadURLExternalResponse.ts b/packages/web-api/src/types/response/FilesGetUploadURLExternalResponse.ts similarity index 95% rename from packages/web-api/src/response/FilesGetUploadURLExternalResponse.ts rename to packages/web-api/src/types/response/FilesGetUploadURLExternalResponse.ts index 42580ed10..3fbed9a36 100644 --- a/packages/web-api/src/response/FilesGetUploadURLExternalResponse.ts +++ b/packages/web-api/src/types/response/FilesGetUploadURLExternalResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesGetUploadURLExternalResponse = WebAPICallResult & { error?: string; file_id?: string; diff --git a/packages/web-api/src/response/FilesInfoResponse.ts b/packages/web-api/src/types/response/FilesInfoResponse.ts similarity index 99% rename from packages/web-api/src/response/FilesInfoResponse.ts rename to packages/web-api/src/types/response/FilesInfoResponse.ts index 468bc5560..704d4b480 100644 --- a/packages/web-api/src/response/FilesInfoResponse.ts +++ b/packages/web-api/src/types/response/FilesInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesInfoResponse = WebAPICallResult & { comments?: Comment[]; content?: string; diff --git a/packages/web-api/src/response/FilesListResponse.ts b/packages/web-api/src/types/response/FilesListResponse.ts similarity index 99% rename from packages/web-api/src/response/FilesListResponse.ts rename to packages/web-api/src/types/response/FilesListResponse.ts index da5065346..1f6d48ead 100644 --- a/packages/web-api/src/response/FilesListResponse.ts +++ b/packages/web-api/src/types/response/FilesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesListResponse = WebAPICallResult & { error?: string; files?: FileElement[]; diff --git a/packages/web-api/src/response/FilesRemoteAddResponse.ts b/packages/web-api/src/types/response/FilesRemoteAddResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesRemoteAddResponse.ts rename to packages/web-api/src/types/response/FilesRemoteAddResponse.ts index 46b6207e7..949f245f4 100644 --- a/packages/web-api/src/response/FilesRemoteAddResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteAddResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesRemoteInfoResponse.ts b/packages/web-api/src/types/response/FilesRemoteInfoResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesRemoteInfoResponse.ts rename to packages/web-api/src/types/response/FilesRemoteInfoResponse.ts index 2044632fc..7c92cd3b3 100644 --- a/packages/web-api/src/response/FilesRemoteInfoResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteInfoResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesRemoteListResponse.ts b/packages/web-api/src/types/response/FilesRemoteListResponse.ts similarity index 99% rename from packages/web-api/src/response/FilesRemoteListResponse.ts rename to packages/web-api/src/types/response/FilesRemoteListResponse.ts index bcd48a48f..c1fb94911 100644 --- a/packages/web-api/src/response/FilesRemoteListResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteListResponse = WebAPICallResult & { error?: string; files?: FileElement[]; diff --git a/packages/web-api/src/response/FilesRemoteRemoveResponse.ts b/packages/web-api/src/types/response/FilesRemoteRemoveResponse.ts similarity index 94% rename from packages/web-api/src/response/FilesRemoteRemoveResponse.ts rename to packages/web-api/src/types/response/FilesRemoteRemoveResponse.ts index eeca52c23..aeb98392a 100644 --- a/packages/web-api/src/response/FilesRemoteRemoveResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/FilesRemoteShareResponse.ts b/packages/web-api/src/types/response/FilesRemoteShareResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesRemoteShareResponse.ts rename to packages/web-api/src/types/response/FilesRemoteShareResponse.ts index f97104807..0d0fcc6bf 100644 --- a/packages/web-api/src/response/FilesRemoteShareResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteShareResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteShareResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesRemoteUpdateResponse.ts b/packages/web-api/src/types/response/FilesRemoteUpdateResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesRemoteUpdateResponse.ts rename to packages/web-api/src/types/response/FilesRemoteUpdateResponse.ts index 5f3adb02a..fe86ea025 100644 --- a/packages/web-api/src/response/FilesRemoteUpdateResponse.ts +++ b/packages/web-api/src/types/response/FilesRemoteUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRemoteUpdateResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesRevokePublicURLResponse.ts b/packages/web-api/src/types/response/FilesRevokePublicURLResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesRevokePublicURLResponse.ts rename to packages/web-api/src/types/response/FilesRevokePublicURLResponse.ts index fa2e54cb4..ea9ee3cb4 100644 --- a/packages/web-api/src/response/FilesRevokePublicURLResponse.ts +++ b/packages/web-api/src/types/response/FilesRevokePublicURLResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesRevokePublicURLResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesSharedPublicURLResponse.ts b/packages/web-api/src/types/response/FilesSharedPublicURLResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesSharedPublicURLResponse.ts rename to packages/web-api/src/types/response/FilesSharedPublicURLResponse.ts index 62a2a619c..d55666bfe 100644 --- a/packages/web-api/src/response/FilesSharedPublicURLResponse.ts +++ b/packages/web-api/src/types/response/FilesSharedPublicURLResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesSharedPublicURLResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/FilesUploadResponse.ts b/packages/web-api/src/types/response/FilesUploadResponse.ts similarity index 97% rename from packages/web-api/src/response/FilesUploadResponse.ts rename to packages/web-api/src/types/response/FilesUploadResponse.ts index f977e06ff..0f704a5a4 100644 --- a/packages/web-api/src/response/FilesUploadResponse.ts +++ b/packages/web-api/src/types/response/FilesUploadResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FilesUploadResponse = WebAPICallResult & { error?: string; file?: File; @@ -23,6 +23,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -100,6 +101,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -149,6 +155,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -213,6 +220,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/GroupsArchiveResponse.ts b/packages/web-api/src/types/response/GroupsArchiveResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsArchiveResponse.ts rename to packages/web-api/src/types/response/GroupsArchiveResponse.ts index d121bd2a8..2f9ac2523 100644 --- a/packages/web-api/src/response/GroupsArchiveResponse.ts +++ b/packages/web-api/src/types/response/GroupsArchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsArchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsCloseResponse.ts b/packages/web-api/src/types/response/GroupsCloseResponse.ts similarity index 94% rename from packages/web-api/src/response/GroupsCloseResponse.ts rename to packages/web-api/src/types/response/GroupsCloseResponse.ts index 1a4e611e0..fd2a67783 100644 --- a/packages/web-api/src/response/GroupsCloseResponse.ts +++ b/packages/web-api/src/types/response/GroupsCloseResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsCloseResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsCreateChildResponse.ts b/packages/web-api/src/types/response/GroupsCreateChildResponse.ts similarity index 97% rename from packages/web-api/src/response/GroupsCreateChildResponse.ts rename to packages/web-api/src/types/response/GroupsCreateChildResponse.ts index f1091f280..1a5419b87 100644 --- a/packages/web-api/src/response/GroupsCreateChildResponse.ts +++ b/packages/web-api/src/types/response/GroupsCreateChildResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsCreateChildResponse = WebAPICallResult & { error?: string; group?: Group; diff --git a/packages/web-api/src/response/GroupsCreateResponse.ts b/packages/web-api/src/types/response/GroupsCreateResponse.ts similarity index 97% rename from packages/web-api/src/response/GroupsCreateResponse.ts rename to packages/web-api/src/types/response/GroupsCreateResponse.ts index 7edd86fcf..951d4e090 100644 --- a/packages/web-api/src/response/GroupsCreateResponse.ts +++ b/packages/web-api/src/types/response/GroupsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsCreateResponse = WebAPICallResult & { error?: string; group?: Group; diff --git a/packages/web-api/src/response/GroupsHistoryResponse.ts b/packages/web-api/src/types/response/GroupsHistoryResponse.ts similarity index 96% rename from packages/web-api/src/response/GroupsHistoryResponse.ts rename to packages/web-api/src/types/response/GroupsHistoryResponse.ts index 0e12a8161..b5da7cded 100644 --- a/packages/web-api/src/response/GroupsHistoryResponse.ts +++ b/packages/web-api/src/types/response/GroupsHistoryResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsHistoryResponse = WebAPICallResult & { channel_actions_count?: number; error?: string; diff --git a/packages/web-api/src/response/GroupsInfoResponse.ts b/packages/web-api/src/types/response/GroupsInfoResponse.ts similarity index 97% rename from packages/web-api/src/response/GroupsInfoResponse.ts rename to packages/web-api/src/types/response/GroupsInfoResponse.ts index 75e2828a5..d42003b94 100644 --- a/packages/web-api/src/response/GroupsInfoResponse.ts +++ b/packages/web-api/src/types/response/GroupsInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsInfoResponse = WebAPICallResult & { error?: string; group?: Group; diff --git a/packages/web-api/src/response/GroupsInviteResponse.ts b/packages/web-api/src/types/response/GroupsInviteResponse.ts similarity index 97% rename from packages/web-api/src/response/GroupsInviteResponse.ts rename to packages/web-api/src/types/response/GroupsInviteResponse.ts index e88ff9af5..e6a478ce3 100644 --- a/packages/web-api/src/response/GroupsInviteResponse.ts +++ b/packages/web-api/src/types/response/GroupsInviteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsInviteResponse = WebAPICallResult & { error?: string; group?: Group; diff --git a/packages/web-api/src/response/GroupsKickResponse.ts b/packages/web-api/src/types/response/GroupsKickResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsKickResponse.ts rename to packages/web-api/src/types/response/GroupsKickResponse.ts index 06a9e045e..59a0cfed9 100644 --- a/packages/web-api/src/response/GroupsKickResponse.ts +++ b/packages/web-api/src/types/response/GroupsKickResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsKickResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsLeaveResponse.ts b/packages/web-api/src/types/response/GroupsLeaveResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsLeaveResponse.ts rename to packages/web-api/src/types/response/GroupsLeaveResponse.ts index b006b1bfa..f1998fbb0 100644 --- a/packages/web-api/src/response/GroupsLeaveResponse.ts +++ b/packages/web-api/src/types/response/GroupsLeaveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsLeaveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsListResponse.ts b/packages/web-api/src/types/response/GroupsListResponse.ts similarity index 96% rename from packages/web-api/src/response/GroupsListResponse.ts rename to packages/web-api/src/types/response/GroupsListResponse.ts index c62442e9f..d3d214859 100644 --- a/packages/web-api/src/response/GroupsListResponse.ts +++ b/packages/web-api/src/types/response/GroupsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsListResponse = WebAPICallResult & { error?: string; groups?: Group[]; diff --git a/packages/web-api/src/response/GroupsMarkResponse.ts b/packages/web-api/src/types/response/GroupsMarkResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsMarkResponse.ts rename to packages/web-api/src/types/response/GroupsMarkResponse.ts index c3b6045bf..19f007a29 100644 --- a/packages/web-api/src/response/GroupsMarkResponse.ts +++ b/packages/web-api/src/types/response/GroupsMarkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsMarkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsOpenResponse.ts b/packages/web-api/src/types/response/GroupsOpenResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsOpenResponse.ts rename to packages/web-api/src/types/response/GroupsOpenResponse.ts index e25c4ae53..54b4da2e2 100644 --- a/packages/web-api/src/response/GroupsOpenResponse.ts +++ b/packages/web-api/src/types/response/GroupsOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsOpenResponse = WebAPICallResult & { already_open?: boolean; error?: string; diff --git a/packages/web-api/src/response/GroupsRenameResponse.ts b/packages/web-api/src/types/response/GroupsRenameResponse.ts similarity index 96% rename from packages/web-api/src/response/GroupsRenameResponse.ts rename to packages/web-api/src/types/response/GroupsRenameResponse.ts index f052a8437..d67f3caac 100644 --- a/packages/web-api/src/response/GroupsRenameResponse.ts +++ b/packages/web-api/src/types/response/GroupsRenameResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsRenameResponse = WebAPICallResult & { channel?: Channel; error?: string; diff --git a/packages/web-api/src/response/GroupsRepliesResponse.ts b/packages/web-api/src/types/response/GroupsRepliesResponse.ts similarity index 97% rename from packages/web-api/src/response/GroupsRepliesResponse.ts rename to packages/web-api/src/types/response/GroupsRepliesResponse.ts index 59c2f37cc..0fac5fe26 100644 --- a/packages/web-api/src/response/GroupsRepliesResponse.ts +++ b/packages/web-api/src/types/response/GroupsRepliesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsRepliesResponse = WebAPICallResult & { error?: string; has_more?: boolean; diff --git a/packages/web-api/src/response/GroupsSetPurposeResponse.ts b/packages/web-api/src/types/response/GroupsSetPurposeResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsSetPurposeResponse.ts rename to packages/web-api/src/types/response/GroupsSetPurposeResponse.ts index fdb13929f..38bcf314b 100644 --- a/packages/web-api/src/response/GroupsSetPurposeResponse.ts +++ b/packages/web-api/src/types/response/GroupsSetPurposeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsSetPurposeResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsSetTopicResponse.ts b/packages/web-api/src/types/response/GroupsSetTopicResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsSetTopicResponse.ts rename to packages/web-api/src/types/response/GroupsSetTopicResponse.ts index 1323602e7..140813303 100644 --- a/packages/web-api/src/response/GroupsSetTopicResponse.ts +++ b/packages/web-api/src/types/response/GroupsSetTopicResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsSetTopicResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/GroupsUnarchiveResponse.ts b/packages/web-api/src/types/response/GroupsUnarchiveResponse.ts similarity index 95% rename from packages/web-api/src/response/GroupsUnarchiveResponse.ts rename to packages/web-api/src/types/response/GroupsUnarchiveResponse.ts index 440863bb2..54e8a37bb 100644 --- a/packages/web-api/src/response/GroupsUnarchiveResponse.ts +++ b/packages/web-api/src/types/response/GroupsUnarchiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type GroupsUnarchiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ImCloseResponse.ts b/packages/web-api/src/types/response/ImCloseResponse.ts similarity index 95% rename from packages/web-api/src/response/ImCloseResponse.ts rename to packages/web-api/src/types/response/ImCloseResponse.ts index ba8719517..0bfaa6c31 100644 --- a/packages/web-api/src/response/ImCloseResponse.ts +++ b/packages/web-api/src/types/response/ImCloseResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImCloseResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ImHistoryResponse.ts b/packages/web-api/src/types/response/ImHistoryResponse.ts similarity index 98% rename from packages/web-api/src/response/ImHistoryResponse.ts rename to packages/web-api/src/types/response/ImHistoryResponse.ts index 93ff17b50..d73f3e1e9 100644 --- a/packages/web-api/src/response/ImHistoryResponse.ts +++ b/packages/web-api/src/types/response/ImHistoryResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImHistoryResponse = WebAPICallResult & { channel_actions_count?: number; error?: string; diff --git a/packages/web-api/src/response/ImListResponse.ts b/packages/web-api/src/types/response/ImListResponse.ts similarity index 96% rename from packages/web-api/src/response/ImListResponse.ts rename to packages/web-api/src/types/response/ImListResponse.ts index f6ee5cd51..c6912478c 100644 --- a/packages/web-api/src/response/ImListResponse.ts +++ b/packages/web-api/src/types/response/ImListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImListResponse = WebAPICallResult & { error?: string; ims?: Im[]; diff --git a/packages/web-api/src/response/ImMarkResponse.ts b/packages/web-api/src/types/response/ImMarkResponse.ts similarity index 95% rename from packages/web-api/src/response/ImMarkResponse.ts rename to packages/web-api/src/types/response/ImMarkResponse.ts index 8e7f8605f..b15449395 100644 --- a/packages/web-api/src/response/ImMarkResponse.ts +++ b/packages/web-api/src/types/response/ImMarkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImMarkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ImOpenResponse.ts b/packages/web-api/src/types/response/ImOpenResponse.ts similarity index 95% rename from packages/web-api/src/response/ImOpenResponse.ts rename to packages/web-api/src/types/response/ImOpenResponse.ts index 04ed62df1..44e81db63 100644 --- a/packages/web-api/src/response/ImOpenResponse.ts +++ b/packages/web-api/src/types/response/ImOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImOpenResponse = WebAPICallResult & { already_open?: boolean; channel?: Channel; diff --git a/packages/web-api/src/response/ImRepliesResponse.ts b/packages/web-api/src/types/response/ImRepliesResponse.ts similarity index 97% rename from packages/web-api/src/response/ImRepliesResponse.ts rename to packages/web-api/src/types/response/ImRepliesResponse.ts index 84b616830..6f2b6b452 100644 --- a/packages/web-api/src/response/ImRepliesResponse.ts +++ b/packages/web-api/src/types/response/ImRepliesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ImRepliesResponse = WebAPICallResult & { error?: string; has_more?: boolean; diff --git a/packages/web-api/src/response/MigrationExchangeResponse.ts b/packages/web-api/src/types/response/MigrationExchangeResponse.ts similarity index 95% rename from packages/web-api/src/response/MigrationExchangeResponse.ts rename to packages/web-api/src/types/response/MigrationExchangeResponse.ts index 46956816c..4fcf80670 100644 --- a/packages/web-api/src/response/MigrationExchangeResponse.ts +++ b/packages/web-api/src/types/response/MigrationExchangeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MigrationExchangeResponse = WebAPICallResult & { enterprise_id?: string; error?: string; diff --git a/packages/web-api/src/response/MpimCloseResponse.ts b/packages/web-api/src/types/response/MpimCloseResponse.ts similarity index 95% rename from packages/web-api/src/response/MpimCloseResponse.ts rename to packages/web-api/src/types/response/MpimCloseResponse.ts index 45816feb3..13f3fe6f7 100644 --- a/packages/web-api/src/response/MpimCloseResponse.ts +++ b/packages/web-api/src/types/response/MpimCloseResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimCloseResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/MpimHistoryResponse.ts b/packages/web-api/src/types/response/MpimHistoryResponse.ts similarity index 97% rename from packages/web-api/src/response/MpimHistoryResponse.ts rename to packages/web-api/src/types/response/MpimHistoryResponse.ts index 24805a463..fdd2939c1 100644 --- a/packages/web-api/src/response/MpimHistoryResponse.ts +++ b/packages/web-api/src/types/response/MpimHistoryResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimHistoryResponse = WebAPICallResult & { channel_actions_count?: number; error?: string; diff --git a/packages/web-api/src/response/MpimListResponse.ts b/packages/web-api/src/types/response/MpimListResponse.ts similarity index 96% rename from packages/web-api/src/response/MpimListResponse.ts rename to packages/web-api/src/types/response/MpimListResponse.ts index a46256bca..f06658cf4 100644 --- a/packages/web-api/src/response/MpimListResponse.ts +++ b/packages/web-api/src/types/response/MpimListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimListResponse = WebAPICallResult & { error?: string; groups?: Group[]; diff --git a/packages/web-api/src/response/MpimMarkResponse.ts b/packages/web-api/src/types/response/MpimMarkResponse.ts similarity index 95% rename from packages/web-api/src/response/MpimMarkResponse.ts rename to packages/web-api/src/types/response/MpimMarkResponse.ts index 8af92659b..ecf8be00d 100644 --- a/packages/web-api/src/response/MpimMarkResponse.ts +++ b/packages/web-api/src/types/response/MpimMarkResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimMarkResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/MpimOpenResponse.ts b/packages/web-api/src/types/response/MpimOpenResponse.ts similarity index 97% rename from packages/web-api/src/response/MpimOpenResponse.ts rename to packages/web-api/src/types/response/MpimOpenResponse.ts index b11f740e3..656a4e2e4 100644 --- a/packages/web-api/src/response/MpimOpenResponse.ts +++ b/packages/web-api/src/types/response/MpimOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimOpenResponse = WebAPICallResult & { error?: string; group?: Group; diff --git a/packages/web-api/src/response/MpimRepliesResponse.ts b/packages/web-api/src/types/response/MpimRepliesResponse.ts similarity index 97% rename from packages/web-api/src/response/MpimRepliesResponse.ts rename to packages/web-api/src/types/response/MpimRepliesResponse.ts index 8efb111c4..b559652ad 100644 --- a/packages/web-api/src/response/MpimRepliesResponse.ts +++ b/packages/web-api/src/types/response/MpimRepliesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type MpimRepliesResponse = WebAPICallResult & { error?: string; has_more?: boolean; diff --git a/packages/web-api/src/response/OauthAccessResponse.ts b/packages/web-api/src/types/response/OauthAccessResponse.ts similarity index 97% rename from packages/web-api/src/response/OauthAccessResponse.ts rename to packages/web-api/src/types/response/OauthAccessResponse.ts index 3cede3d77..6b3c99ef9 100644 --- a/packages/web-api/src/response/OauthAccessResponse.ts +++ b/packages/web-api/src/types/response/OauthAccessResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OauthAccessResponse = WebAPICallResult & { access_token?: string; authorizing_user?: User; diff --git a/packages/web-api/src/response/OauthTokenResponse.ts b/packages/web-api/src/types/response/OauthTokenResponse.ts similarity index 94% rename from packages/web-api/src/response/OauthTokenResponse.ts rename to packages/web-api/src/types/response/OauthTokenResponse.ts index b5f6d5f7d..a3a5008f2 100644 --- a/packages/web-api/src/response/OauthTokenResponse.ts +++ b/packages/web-api/src/types/response/OauthTokenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OauthTokenResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/OauthV2AccessResponse.ts b/packages/web-api/src/types/response/OauthV2AccessResponse.ts similarity index 97% rename from packages/web-api/src/response/OauthV2AccessResponse.ts rename to packages/web-api/src/types/response/OauthV2AccessResponse.ts index da13ee7e1..de5aa2def 100644 --- a/packages/web-api/src/response/OauthV2AccessResponse.ts +++ b/packages/web-api/src/types/response/OauthV2AccessResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OauthV2AccessResponse = WebAPICallResult & { access_token?: string; app_id?: string; diff --git a/packages/web-api/src/response/OauthV2ExchangeResponse.ts b/packages/web-api/src/types/response/OauthV2ExchangeResponse.ts similarity index 97% rename from packages/web-api/src/response/OauthV2ExchangeResponse.ts rename to packages/web-api/src/types/response/OauthV2ExchangeResponse.ts index b793ce79c..96427a037 100644 --- a/packages/web-api/src/response/OauthV2ExchangeResponse.ts +++ b/packages/web-api/src/types/response/OauthV2ExchangeResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OauthV2ExchangeResponse = WebAPICallResult & { access_token?: string; app_id?: string; diff --git a/packages/web-api/src/response/OpenIDConnectTokenResponse.ts b/packages/web-api/src/types/response/OpenIDConnectTokenResponse.ts similarity index 95% rename from packages/web-api/src/response/OpenIDConnectTokenResponse.ts rename to packages/web-api/src/types/response/OpenIDConnectTokenResponse.ts index ada974bbc..b97e54e63 100644 --- a/packages/web-api/src/response/OpenIDConnectTokenResponse.ts +++ b/packages/web-api/src/types/response/OpenIDConnectTokenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OpenIDConnectTokenResponse = WebAPICallResult & { access_token?: string; error?: string; diff --git a/packages/web-api/src/response/OpenIDConnectUserInfoResponse.ts b/packages/web-api/src/types/response/OpenIDConnectUserInfoResponse.ts similarity index 98% rename from packages/web-api/src/response/OpenIDConnectUserInfoResponse.ts rename to packages/web-api/src/types/response/OpenIDConnectUserInfoResponse.ts index 1f3a9fc37..414e785dc 100644 --- a/packages/web-api/src/response/OpenIDConnectUserInfoResponse.ts +++ b/packages/web-api/src/types/response/OpenIDConnectUserInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type OpenIDConnectUserInfoResponse = WebAPICallResult & { date_email_verified?: number; email?: string; diff --git a/packages/web-api/src/response/PinsAddResponse.ts b/packages/web-api/src/types/response/PinsAddResponse.ts similarity index 94% rename from packages/web-api/src/response/PinsAddResponse.ts rename to packages/web-api/src/types/response/PinsAddResponse.ts index 06dfbf889..6fe280939 100644 --- a/packages/web-api/src/response/PinsAddResponse.ts +++ b/packages/web-api/src/types/response/PinsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type PinsAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/PinsListResponse.ts b/packages/web-api/src/types/response/PinsListResponse.ts similarity index 97% rename from packages/web-api/src/response/PinsListResponse.ts rename to packages/web-api/src/types/response/PinsListResponse.ts index 75f1cf01c..582da3f35 100644 --- a/packages/web-api/src/response/PinsListResponse.ts +++ b/packages/web-api/src/types/response/PinsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type PinsListResponse = WebAPICallResult & { error?: string; items?: Item[]; @@ -31,6 +31,7 @@ export interface File { app_id?: string; app_name?: string; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -108,6 +109,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -157,6 +163,7 @@ export interface File { title_blocks?: TitleBlock[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -221,6 +228,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; diff --git a/packages/web-api/src/response/PinsRemoveResponse.ts b/packages/web-api/src/types/response/PinsRemoveResponse.ts similarity index 94% rename from packages/web-api/src/response/PinsRemoveResponse.ts rename to packages/web-api/src/types/response/PinsRemoveResponse.ts index 8299805f7..c589322ba 100644 --- a/packages/web-api/src/response/PinsRemoveResponse.ts +++ b/packages/web-api/src/types/response/PinsRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type PinsRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ReactionsAddResponse.ts b/packages/web-api/src/types/response/ReactionsAddResponse.ts similarity index 94% rename from packages/web-api/src/response/ReactionsAddResponse.ts rename to packages/web-api/src/types/response/ReactionsAddResponse.ts index 952146261..a7411a9a5 100644 --- a/packages/web-api/src/response/ReactionsAddResponse.ts +++ b/packages/web-api/src/types/response/ReactionsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ReactionsAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ReactionsGetResponse.ts b/packages/web-api/src/types/response/ReactionsGetResponse.ts similarity index 97% rename from packages/web-api/src/response/ReactionsGetResponse.ts rename to packages/web-api/src/types/response/ReactionsGetResponse.ts index 1d8dbb210..8323b27da 100644 --- a/packages/web-api/src/response/ReactionsGetResponse.ts +++ b/packages/web-api/src/types/response/ReactionsGetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ReactionsGetResponse = WebAPICallResult & { channel?: string; error?: string; @@ -279,6 +279,7 @@ export interface File { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -356,6 +357,11 @@ export interface File { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -405,6 +411,7 @@ export interface File { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ReactionsListResponse.ts b/packages/web-api/src/types/response/ReactionsListResponse.ts similarity index 97% rename from packages/web-api/src/response/ReactionsListResponse.ts rename to packages/web-api/src/types/response/ReactionsListResponse.ts index 55ffed46d..ff3fe8e83 100644 --- a/packages/web-api/src/response/ReactionsListResponse.ts +++ b/packages/web-api/src/types/response/ReactionsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ReactionsListResponse = WebAPICallResult & { error?: string; items?: Item[]; @@ -83,6 +83,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -90,6 +91,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -362,6 +364,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -439,6 +442,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -488,6 +496,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -552,6 +561,7 @@ export interface Shares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -694,6 +704,7 @@ export interface BlockFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -771,6 +782,11 @@ export interface BlockFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -820,6 +836,7 @@ export interface BlockFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/ReactionsRemoveResponse.ts b/packages/web-api/src/types/response/ReactionsRemoveResponse.ts similarity index 94% rename from packages/web-api/src/response/ReactionsRemoveResponse.ts rename to packages/web-api/src/types/response/ReactionsRemoveResponse.ts index 6b1730343..652bbf180 100644 --- a/packages/web-api/src/response/ReactionsRemoveResponse.ts +++ b/packages/web-api/src/types/response/ReactionsRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ReactionsRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RemindersAddResponse.ts b/packages/web-api/src/types/response/RemindersAddResponse.ts similarity index 96% rename from packages/web-api/src/response/RemindersAddResponse.ts rename to packages/web-api/src/types/response/RemindersAddResponse.ts index 9d621b79d..9586daa97 100644 --- a/packages/web-api/src/response/RemindersAddResponse.ts +++ b/packages/web-api/src/types/response/RemindersAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RemindersAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RemindersCompleteResponse.ts b/packages/web-api/src/types/response/RemindersCompleteResponse.ts similarity index 94% rename from packages/web-api/src/response/RemindersCompleteResponse.ts rename to packages/web-api/src/types/response/RemindersCompleteResponse.ts index 619c16057..db6007716 100644 --- a/packages/web-api/src/response/RemindersCompleteResponse.ts +++ b/packages/web-api/src/types/response/RemindersCompleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RemindersCompleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RemindersDeleteResponse.ts b/packages/web-api/src/types/response/RemindersDeleteResponse.ts similarity index 94% rename from packages/web-api/src/response/RemindersDeleteResponse.ts rename to packages/web-api/src/types/response/RemindersDeleteResponse.ts index b630b913c..1e729bceb 100644 --- a/packages/web-api/src/response/RemindersDeleteResponse.ts +++ b/packages/web-api/src/types/response/RemindersDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RemindersDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RemindersInfoResponse.ts b/packages/web-api/src/types/response/RemindersInfoResponse.ts similarity index 95% rename from packages/web-api/src/response/RemindersInfoResponse.ts rename to packages/web-api/src/types/response/RemindersInfoResponse.ts index 1542badb2..4ca914103 100644 --- a/packages/web-api/src/response/RemindersInfoResponse.ts +++ b/packages/web-api/src/types/response/RemindersInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RemindersInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RemindersListResponse.ts b/packages/web-api/src/types/response/RemindersListResponse.ts similarity index 96% rename from packages/web-api/src/response/RemindersListResponse.ts rename to packages/web-api/src/types/response/RemindersListResponse.ts index 3ce7ebbe3..8820c1570 100644 --- a/packages/web-api/src/response/RemindersListResponse.ts +++ b/packages/web-api/src/types/response/RemindersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RemindersListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RtmConnectResponse.ts b/packages/web-api/src/types/response/RtmConnectResponse.ts similarity index 95% rename from packages/web-api/src/response/RtmConnectResponse.ts rename to packages/web-api/src/types/response/RtmConnectResponse.ts index 9f3cdd38f..a2e037bb3 100644 --- a/packages/web-api/src/response/RtmConnectResponse.ts +++ b/packages/web-api/src/types/response/RtmConnectResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RtmConnectResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/RtmStartResponse.ts b/packages/web-api/src/types/response/RtmStartResponse.ts similarity index 99% rename from packages/web-api/src/response/RtmStartResponse.ts rename to packages/web-api/src/types/response/RtmStartResponse.ts index 0526c5652..f123f1534 100644 --- a/packages/web-api/src/response/RtmStartResponse.ts +++ b/packages/web-api/src/types/response/RtmStartResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type RtmStartResponse = WebAPICallResult & { accept_tos_url?: string; bots?: Bot[]; @@ -177,6 +177,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -184,6 +185,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -456,6 +458,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -533,6 +536,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -582,6 +590,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -646,6 +655,7 @@ export interface PurpleShares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -772,6 +782,7 @@ export interface MessageFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -849,6 +860,11 @@ export interface MessageFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -898,6 +914,7 @@ export interface MessageFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/SearchAllResponse.ts b/packages/web-api/src/types/response/SearchAllResponse.ts similarity index 96% rename from packages/web-api/src/response/SearchAllResponse.ts rename to packages/web-api/src/types/response/SearchAllResponse.ts index 07d6e54ce..b94db6069 100644 --- a/packages/web-api/src/response/SearchAllResponse.ts +++ b/packages/web-api/src/types/response/SearchAllResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type SearchAllResponse = WebAPICallResult & { error?: string; files?: Files; @@ -56,7 +56,7 @@ export interface FilesMatch { is_external?: boolean; is_public?: boolean; is_starred?: boolean; - last_editor?: LastEditor; + last_editor?: string; lines?: number; lines_more?: number; media_display_type?: string; @@ -112,8 +112,8 @@ export interface FilesMatch { updated?: number; url_private?: string; url_private_download?: string; - user?: LastEditor; - user_team?: UserTeam; + user?: string; + user_team?: string; username?: string; } @@ -140,6 +140,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -147,6 +148,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -438,6 +440,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -515,6 +518,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -564,6 +572,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -623,35 +632,21 @@ export interface Saved { } export interface PurpleShares { - private?: { [key: string]: Public[] }; - public?: { [key: string]: Public[] }; + private?: { [key: string]: Private[] }; + public?: { [key: string]: Private[] }; } -export interface Public { +export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; reply_users?: string[]; reply_users_count?: number; - share_user_id?: LastEditor; - team_id?: UserTeam; + share_user_id?: string; + team_id?: string; thread_ts?: string; - ts?: Ts; -} - -export enum LastEditor { - Empty = '', - U00000000 = 'U00000000', -} - -export enum UserTeam { - Empty = '', - T00000000 = 'T00000000', -} - -export enum Ts { - Empty = '', - The0000000000000000 = '0000000000.000000', + ts?: string; } export interface Transcription { @@ -785,6 +780,7 @@ export interface MessageFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -862,6 +858,11 @@ export interface MessageFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -911,6 +912,7 @@ export interface MessageFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -1026,6 +1028,16 @@ export interface MatchShares { public?: { [key: string]: Public[] }; } +export interface Public { + channel_name?: string; + reply_count?: number; + reply_users?: string[]; + reply_users_count?: number; + share_user_id?: string; + team_id?: string; + ts?: string; +} + export interface Pagination { first?: number; last?: number; @@ -1061,11 +1073,11 @@ export interface MessagesMatch { previous?: Previous; previous_2?: Previous; score?: number; - team?: UserTeam; + team?: string; text?: string; - ts?: Ts; + ts?: string; type?: string; - user?: LastEditor; + user?: string; username?: string; } @@ -1180,7 +1192,7 @@ export interface Channel { name?: string; name_normalized?: string; pending_shared?: string[]; - user?: LastEditor; + user?: string; } export interface Previous { @@ -1189,9 +1201,9 @@ export interface Previous { iid?: string; permalink?: string; text?: string; - ts?: Ts; + ts?: string; type?: string; - user?: LastEditor; + user?: string; username?: string; } diff --git a/packages/web-api/src/response/SearchFilesResponse.ts b/packages/web-api/src/types/response/SearchFilesResponse.ts similarity index 96% rename from packages/web-api/src/response/SearchFilesResponse.ts rename to packages/web-api/src/types/response/SearchFilesResponse.ts index 0a285e87b..c91b52acf 100644 --- a/packages/web-api/src/response/SearchFilesResponse.ts +++ b/packages/web-api/src/types/response/SearchFilesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type SearchFilesResponse = WebAPICallResult & { error?: string; files?: Files; @@ -138,6 +138,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -145,6 +146,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -417,6 +419,7 @@ export interface FileElement { attachments?: any[]; blocks?: Block[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -494,6 +497,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -543,6 +551,7 @@ export interface FileElement { title_blocks?: Block[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -602,11 +611,12 @@ export interface Saved { } export interface PurpleShares { - private?: { [key: string]: Public[] }; - public?: { [key: string]: Public[] }; + private?: { [key: string]: Private[] }; + public?: { [key: string]: Private[] }; } -export interface Public { +export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -749,6 +759,7 @@ export interface MessageFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -826,6 +837,11 @@ export interface MessageFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -875,6 +891,7 @@ export interface MessageFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -990,6 +1007,16 @@ export interface MatchShares { public?: { [key: string]: Public[] }; } +export interface Public { + channel_name?: string; + reply_count?: number; + reply_users?: string[]; + reply_users_count?: number; + share_user_id?: string; + team_id?: string; + ts?: string; +} + export interface Pagination { first?: number; last?: number; diff --git a/packages/web-api/src/response/SearchMessagesResponse.ts b/packages/web-api/src/types/response/SearchMessagesResponse.ts similarity index 97% rename from packages/web-api/src/response/SearchMessagesResponse.ts rename to packages/web-api/src/types/response/SearchMessagesResponse.ts index 2a0792f53..ff784f725 100644 --- a/packages/web-api/src/response/SearchMessagesResponse.ts +++ b/packages/web-api/src/types/response/SearchMessagesResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type SearchMessagesResponse = WebAPICallResult & { error?: string; messages?: Messages; @@ -68,6 +68,7 @@ export interface Attachment { footer?: string; footer_icon?: string; from_url?: string; + hide_color?: boolean; id?: number; image_bytes?: number; image_height?: number; @@ -75,6 +76,7 @@ export interface Attachment { image_width?: number; indent?: boolean; is_app_unfurl?: boolean; + is_file_attachment?: boolean; is_msg_unfurl?: boolean; is_reply_unfurl?: boolean; is_thread_root_unfurl?: boolean; @@ -366,6 +368,7 @@ export interface FileElement { attachments?: any[]; blocks?: TitleBlockElement[]; bot_id?: string; + canvas_template_mode?: string; cc?: Cc[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -443,6 +446,11 @@ export interface FileElement { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -492,6 +500,7 @@ export interface FileElement { title_blocks?: TitleBlockElement[]; to?: Cc[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; @@ -556,6 +565,7 @@ export interface PurpleShares { } export interface Private { + access?: string; channel_name?: string; latest_reply?: string; reply_count?: number; @@ -698,6 +708,7 @@ export interface MessageFile { attachments?: any[]; blocks?: any[]; bot_id?: string; + canvas_template_mode?: string; cc?: any[]; channel_actions_count?: number; channel_actions_ts?: string; @@ -775,6 +786,11 @@ export interface MessageFile { subject?: string; subtype?: string; teams_shared_with?: any[]; + template_conversion_ts?: number; + template_description?: string; + template_icon?: string; + template_name?: string; + template_title?: string; thumb_1024?: string; thumb_1024_gif?: string; thumb_1024_h?: string; @@ -824,6 +840,7 @@ export interface MessageFile { title_blocks?: any[]; to?: any[]; transcription?: Transcription; + update_notification?: number; updated?: number; url_private?: string; url_private_download?: string; diff --git a/packages/web-api/src/response/StarsAddResponse.ts b/packages/web-api/src/types/response/StarsAddResponse.ts similarity index 94% rename from packages/web-api/src/response/StarsAddResponse.ts rename to packages/web-api/src/types/response/StarsAddResponse.ts index f36d2071e..44712411b 100644 --- a/packages/web-api/src/response/StarsAddResponse.ts +++ b/packages/web-api/src/types/response/StarsAddResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type StarsAddResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/StarsListResponse.ts b/packages/web-api/src/types/response/StarsListResponse.ts similarity index 99% rename from packages/web-api/src/response/StarsListResponse.ts rename to packages/web-api/src/types/response/StarsListResponse.ts index 309e38828..8d466a9a0 100644 --- a/packages/web-api/src/response/StarsListResponse.ts +++ b/packages/web-api/src/types/response/StarsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type StarsListResponse = WebAPICallResult & { error?: string; items?: Item[]; diff --git a/packages/web-api/src/response/StarsRemoveResponse.ts b/packages/web-api/src/types/response/StarsRemoveResponse.ts similarity index 94% rename from packages/web-api/src/response/StarsRemoveResponse.ts rename to packages/web-api/src/types/response/StarsRemoveResponse.ts index 0d35c152b..d22d82a0d 100644 --- a/packages/web-api/src/response/StarsRemoveResponse.ts +++ b/packages/web-api/src/types/response/StarsRemoveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type StarsRemoveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/TeamAccessLogsResponse.ts b/packages/web-api/src/types/response/TeamAccessLogsResponse.ts similarity index 96% rename from packages/web-api/src/response/TeamAccessLogsResponse.ts rename to packages/web-api/src/types/response/TeamAccessLogsResponse.ts index 0422307c6..7312ef0d1 100644 --- a/packages/web-api/src/response/TeamAccessLogsResponse.ts +++ b/packages/web-api/src/types/response/TeamAccessLogsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamAccessLogsResponse = WebAPICallResult & { error?: string; logins?: Login[]; diff --git a/packages/web-api/src/response/TeamBillableInfoResponse.ts b/packages/web-api/src/types/response/TeamBillableInfoResponse.ts similarity index 95% rename from packages/web-api/src/response/TeamBillableInfoResponse.ts rename to packages/web-api/src/types/response/TeamBillableInfoResponse.ts index 4464b4d95..35142441d 100644 --- a/packages/web-api/src/response/TeamBillableInfoResponse.ts +++ b/packages/web-api/src/types/response/TeamBillableInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamBillableInfoResponse = WebAPICallResult & { billable_info?: { [key: string]: BillableInfo }; error?: string; diff --git a/packages/web-api/src/response/TeamBillingInfoResponse.ts b/packages/web-api/src/types/response/TeamBillingInfoResponse.ts similarity index 94% rename from packages/web-api/src/response/TeamBillingInfoResponse.ts rename to packages/web-api/src/types/response/TeamBillingInfoResponse.ts index 92b31019f..55262c442 100644 --- a/packages/web-api/src/response/TeamBillingInfoResponse.ts +++ b/packages/web-api/src/types/response/TeamBillingInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamBillingInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/TeamInfoResponse.ts b/packages/web-api/src/types/response/TeamInfoResponse.ts similarity index 96% rename from packages/web-api/src/response/TeamInfoResponse.ts rename to packages/web-api/src/types/response/TeamInfoResponse.ts index f3ab153bf..5712ab9a9 100644 --- a/packages/web-api/src/response/TeamInfoResponse.ts +++ b/packages/web-api/src/types/response/TeamInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/TeamIntegrationLogsResponse.ts b/packages/web-api/src/types/response/TeamIntegrationLogsResponse.ts similarity index 96% rename from packages/web-api/src/response/TeamIntegrationLogsResponse.ts rename to packages/web-api/src/types/response/TeamIntegrationLogsResponse.ts index 2ec8879a5..f5cf5ffb3 100644 --- a/packages/web-api/src/response/TeamIntegrationLogsResponse.ts +++ b/packages/web-api/src/types/response/TeamIntegrationLogsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamIntegrationLogsResponse = WebAPICallResult & { error?: string; logs?: Log[]; diff --git a/packages/web-api/src/response/TeamPreferencesListResponse.ts b/packages/web-api/src/types/response/TeamPreferencesListResponse.ts similarity index 95% rename from packages/web-api/src/response/TeamPreferencesListResponse.ts rename to packages/web-api/src/types/response/TeamPreferencesListResponse.ts index 818ccbbe4..064b55782 100644 --- a/packages/web-api/src/response/TeamPreferencesListResponse.ts +++ b/packages/web-api/src/types/response/TeamPreferencesListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamPreferencesListResponse = WebAPICallResult & { allow_message_deletion?: boolean; disable_file_uploads?: string; diff --git a/packages/web-api/src/response/TeamProfileGetResponse.ts b/packages/web-api/src/types/response/TeamProfileGetResponse.ts similarity index 97% rename from packages/web-api/src/response/TeamProfileGetResponse.ts rename to packages/web-api/src/types/response/TeamProfileGetResponse.ts index fc3e0fdca..5f0c6d09c 100644 --- a/packages/web-api/src/response/TeamProfileGetResponse.ts +++ b/packages/web-api/src/types/response/TeamProfileGetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type TeamProfileGetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsCreateResponse.ts b/packages/web-api/src/types/response/UsergroupsCreateResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsCreateResponse.ts rename to packages/web-api/src/types/response/UsergroupsCreateResponse.ts index c1ffb1952..3f77cf8a5 100644 --- a/packages/web-api/src/response/UsergroupsCreateResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsCreateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsDisableResponse.ts b/packages/web-api/src/types/response/UsergroupsDisableResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsDisableResponse.ts rename to packages/web-api/src/types/response/UsergroupsDisableResponse.ts index b9947caed..29c7a2e09 100644 --- a/packages/web-api/src/response/UsergroupsDisableResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsDisableResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsDisableResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsEnableResponse.ts b/packages/web-api/src/types/response/UsergroupsEnableResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsEnableResponse.ts rename to packages/web-api/src/types/response/UsergroupsEnableResponse.ts index 26fdf25be..9ebabcac4 100644 --- a/packages/web-api/src/response/UsergroupsEnableResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsEnableResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsEnableResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsListResponse.ts b/packages/web-api/src/types/response/UsergroupsListResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsListResponse.ts rename to packages/web-api/src/types/response/UsergroupsListResponse.ts index 93d2a4026..ed962117f 100644 --- a/packages/web-api/src/response/UsergroupsListResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsUpdateResponse.ts b/packages/web-api/src/types/response/UsergroupsUpdateResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsUpdateResponse.ts rename to packages/web-api/src/types/response/UsergroupsUpdateResponse.ts index 780c85c91..cfa03043d 100644 --- a/packages/web-api/src/response/UsergroupsUpdateResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsUpdateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsUsersListResponse.ts b/packages/web-api/src/types/response/UsergroupsUsersListResponse.ts similarity index 94% rename from packages/web-api/src/response/UsergroupsUsersListResponse.ts rename to packages/web-api/src/types/response/UsergroupsUsersListResponse.ts index 2b066dfd4..33a66d2f7 100644 --- a/packages/web-api/src/response/UsergroupsUsersListResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsUsersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsUsersListResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsergroupsUsersUpdateResponse.ts b/packages/web-api/src/types/response/UsergroupsUsersUpdateResponse.ts similarity index 96% rename from packages/web-api/src/response/UsergroupsUsersUpdateResponse.ts rename to packages/web-api/src/types/response/UsergroupsUsersUpdateResponse.ts index 18a3667fe..33899c869 100644 --- a/packages/web-api/src/response/UsergroupsUsersUpdateResponse.ts +++ b/packages/web-api/src/types/response/UsergroupsUsersUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsergroupsUsersUpdateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersConversationsResponse.ts b/packages/web-api/src/types/response/UsersConversationsResponse.ts similarity index 98% rename from packages/web-api/src/response/UsersConversationsResponse.ts rename to packages/web-api/src/types/response/UsersConversationsResponse.ts index 49789b9dd..064589885 100644 --- a/packages/web-api/src/response/UsersConversationsResponse.ts +++ b/packages/web-api/src/types/response/UsersConversationsResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersConversationsResponse = WebAPICallResult & { channels?: Channel[]; error?: string; diff --git a/packages/web-api/src/response/UsersDeletePhotoResponse.ts b/packages/web-api/src/types/response/UsersDeletePhotoResponse.ts similarity index 94% rename from packages/web-api/src/response/UsersDeletePhotoResponse.ts rename to packages/web-api/src/types/response/UsersDeletePhotoResponse.ts index df7038771..3917e1297 100644 --- a/packages/web-api/src/response/UsersDeletePhotoResponse.ts +++ b/packages/web-api/src/types/response/UsersDeletePhotoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersDeletePhotoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersGetPresenceResponse.ts b/packages/web-api/src/types/response/UsersGetPresenceResponse.ts similarity index 95% rename from packages/web-api/src/response/UsersGetPresenceResponse.ts rename to packages/web-api/src/types/response/UsersGetPresenceResponse.ts index dddb6933b..cd675caeb 100644 --- a/packages/web-api/src/response/UsersGetPresenceResponse.ts +++ b/packages/web-api/src/types/response/UsersGetPresenceResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersGetPresenceResponse = WebAPICallResult & { auto_away?: boolean; connection_count?: number; diff --git a/packages/web-api/src/response/UsersIdentityResponse.ts b/packages/web-api/src/types/response/UsersIdentityResponse.ts similarity index 95% rename from packages/web-api/src/response/UsersIdentityResponse.ts rename to packages/web-api/src/types/response/UsersIdentityResponse.ts index f8f0a1d15..d8c54e65e 100644 --- a/packages/web-api/src/response/UsersIdentityResponse.ts +++ b/packages/web-api/src/types/response/UsersIdentityResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersIdentityResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersInfoResponse.ts b/packages/web-api/src/types/response/UsersInfoResponse.ts similarity index 98% rename from packages/web-api/src/response/UsersInfoResponse.ts rename to packages/web-api/src/types/response/UsersInfoResponse.ts index 1a4db7382..6ddd53c88 100644 --- a/packages/web-api/src/response/UsersInfoResponse.ts +++ b/packages/web-api/src/types/response/UsersInfoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersInfoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersListResponse.ts b/packages/web-api/src/types/response/UsersListResponse.ts similarity index 98% rename from packages/web-api/src/response/UsersListResponse.ts rename to packages/web-api/src/types/response/UsersListResponse.ts index caa05c953..12ffc4907 100644 --- a/packages/web-api/src/response/UsersListResponse.ts +++ b/packages/web-api/src/types/response/UsersListResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersListResponse = WebAPICallResult & { arg?: string; cache_ts?: number; diff --git a/packages/web-api/src/response/UsersLookupByEmailResponse.ts b/packages/web-api/src/types/response/UsersLookupByEmailResponse.ts similarity index 98% rename from packages/web-api/src/response/UsersLookupByEmailResponse.ts rename to packages/web-api/src/types/response/UsersLookupByEmailResponse.ts index 2012a4078..9f036eb34 100644 --- a/packages/web-api/src/response/UsersLookupByEmailResponse.ts +++ b/packages/web-api/src/types/response/UsersLookupByEmailResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersLookupByEmailResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersProfileGetResponse.ts b/packages/web-api/src/types/response/UsersProfileGetResponse.ts similarity index 97% rename from packages/web-api/src/response/UsersProfileGetResponse.ts rename to packages/web-api/src/types/response/UsersProfileGetResponse.ts index 68dbf37a2..51e1f88e6 100644 --- a/packages/web-api/src/response/UsersProfileGetResponse.ts +++ b/packages/web-api/src/types/response/UsersProfileGetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersProfileGetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersProfileSetResponse.ts b/packages/web-api/src/types/response/UsersProfileSetResponse.ts similarity index 97% rename from packages/web-api/src/response/UsersProfileSetResponse.ts rename to packages/web-api/src/types/response/UsersProfileSetResponse.ts index 27b4ae481..df307449e 100644 --- a/packages/web-api/src/response/UsersProfileSetResponse.ts +++ b/packages/web-api/src/types/response/UsersProfileSetResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersProfileSetResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersSetActiveResponse.ts b/packages/web-api/src/types/response/UsersSetActiveResponse.ts similarity index 94% rename from packages/web-api/src/response/UsersSetActiveResponse.ts rename to packages/web-api/src/types/response/UsersSetActiveResponse.ts index 2ffae86dc..19d0e8a2a 100644 --- a/packages/web-api/src/response/UsersSetActiveResponse.ts +++ b/packages/web-api/src/types/response/UsersSetActiveResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersSetActiveResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersSetPhotoResponse.ts b/packages/web-api/src/types/response/UsersSetPhotoResponse.ts similarity index 95% rename from packages/web-api/src/response/UsersSetPhotoResponse.ts rename to packages/web-api/src/types/response/UsersSetPhotoResponse.ts index 1a4fb6a25..87d31637e 100644 --- a/packages/web-api/src/response/UsersSetPhotoResponse.ts +++ b/packages/web-api/src/types/response/UsersSetPhotoResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersSetPhotoResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/UsersSetPresenceResponse.ts b/packages/web-api/src/types/response/UsersSetPresenceResponse.ts similarity index 94% rename from packages/web-api/src/response/UsersSetPresenceResponse.ts rename to packages/web-api/src/types/response/UsersSetPresenceResponse.ts index cac5e5b8b..011735983 100644 --- a/packages/web-api/src/response/UsersSetPresenceResponse.ts +++ b/packages/web-api/src/types/response/UsersSetPresenceResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type UsersSetPresenceResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ViewsOpenResponse.ts b/packages/web-api/src/types/response/ViewsOpenResponse.ts similarity index 99% rename from packages/web-api/src/response/ViewsOpenResponse.ts rename to packages/web-api/src/types/response/ViewsOpenResponse.ts index 13a8a292b..112da3b50 100644 --- a/packages/web-api/src/response/ViewsOpenResponse.ts +++ b/packages/web-api/src/types/response/ViewsOpenResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ViewsOpenResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ViewsPublishResponse.ts b/packages/web-api/src/types/response/ViewsPublishResponse.ts similarity index 99% rename from packages/web-api/src/response/ViewsPublishResponse.ts rename to packages/web-api/src/types/response/ViewsPublishResponse.ts index 4dee3d3b8..19f501ed8 100644 --- a/packages/web-api/src/response/ViewsPublishResponse.ts +++ b/packages/web-api/src/types/response/ViewsPublishResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ViewsPublishResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ViewsPushResponse.ts b/packages/web-api/src/types/response/ViewsPushResponse.ts similarity index 99% rename from packages/web-api/src/response/ViewsPushResponse.ts rename to packages/web-api/src/types/response/ViewsPushResponse.ts index 282d12211..76ebaaac2 100644 --- a/packages/web-api/src/response/ViewsPushResponse.ts +++ b/packages/web-api/src/types/response/ViewsPushResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ViewsPushResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/ViewsUpdateResponse.ts b/packages/web-api/src/types/response/ViewsUpdateResponse.ts similarity index 99% rename from packages/web-api/src/response/ViewsUpdateResponse.ts rename to packages/web-api/src/types/response/ViewsUpdateResponse.ts index bd7bebc46..bf52086b1 100644 --- a/packages/web-api/src/response/ViewsUpdateResponse.ts +++ b/packages/web-api/src/types/response/ViewsUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ViewsUpdateResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/WorkflowsStepCompletedResponse.ts b/packages/web-api/src/types/response/WorkflowsStepCompletedResponse.ts similarity index 94% rename from packages/web-api/src/response/WorkflowsStepCompletedResponse.ts rename to packages/web-api/src/types/response/WorkflowsStepCompletedResponse.ts index 1ae417c9a..13e34f298 100644 --- a/packages/web-api/src/response/WorkflowsStepCompletedResponse.ts +++ b/packages/web-api/src/types/response/WorkflowsStepCompletedResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type WorkflowsStepCompletedResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/WorkflowsStepFailedResponse.ts b/packages/web-api/src/types/response/WorkflowsStepFailedResponse.ts similarity index 94% rename from packages/web-api/src/response/WorkflowsStepFailedResponse.ts rename to packages/web-api/src/types/response/WorkflowsStepFailedResponse.ts index 15483fee7..8c000ea37 100644 --- a/packages/web-api/src/response/WorkflowsStepFailedResponse.ts +++ b/packages/web-api/src/types/response/WorkflowsStepFailedResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type WorkflowsStepFailedResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/WorkflowsUpdateStepResponse.ts b/packages/web-api/src/types/response/WorkflowsUpdateStepResponse.ts similarity index 94% rename from packages/web-api/src/response/WorkflowsUpdateStepResponse.ts rename to packages/web-api/src/types/response/WorkflowsUpdateStepResponse.ts index 7ca0e335d..7f04e0980 100644 --- a/packages/web-api/src/response/WorkflowsUpdateStepResponse.ts +++ b/packages/web-api/src/types/response/WorkflowsUpdateStepResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type WorkflowsUpdateStepResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/response/index.ts b/packages/web-api/src/types/response/index.ts similarity index 100% rename from packages/web-api/src/response/index.ts rename to packages/web-api/src/types/response/index.ts diff --git a/scripts/code_generator.rb b/scripts/code_generator.rb index 5e6edb3aa..647f77de8 100644 --- a/scripts/code_generator.rb +++ b/scripts/code_generator.rb @@ -5,7 +5,7 @@ require 'open3' -index_file = __dir__ + '/../packages/web-api/src/response/index.ts' +index_file = __dir__ + '/../packages/web-api/src/types/response/index.ts' File.truncate(index_file, 0) class TsWriter @@ -29,7 +29,7 @@ def write(root_class_name, json_path, typedef_filepath, input_json) Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| stdin.write(input_json) stdin.close() - source = "/* eslint-disable */\n#{NOTICE}\nimport { WebAPICallResult } from '../WebClient';\n" + stdout.read + source = "/* eslint-disable */\n#{NOTICE}\nimport { WebAPICallResult } from '../../WebClient';\n" + stdout.read source.gsub!( "export interface #{root_class_name} {", "export type #{root_class_name} = WebAPICallResult & {" @@ -90,7 +90,7 @@ def append_multiple_classes_to_index(classes, class_file_name, index_file) end root_class_name << 'Response' - typedef_filepath = __dir__ + "/../packages/web-api/src/response/#{root_class_name}.ts" + typedef_filepath = __dir__ + "/../packages/web-api/src/types/response/#{root_class_name}.ts" input_json = json_file.read ts_writer.write(root_class_name, json_path, typedef_filepath, input_json) ts_writer.append_to_index(root_class_name, index_file) From 5864f3186f4b32e307910d922bb531df9257d1bd Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 14:15:43 -0400 Subject: [PATCH 034/122] module refs post types reorg --- packages/web-api/src/WebClient.ts | 2 +- packages/web-api/src/index.ts | 2 +- packages/web-api/src/methods.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index a93b95bb8..24df4dbca 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -18,7 +18,7 @@ import { AdminAnalyticsPublicChannelMetadataDetails, FilesCompleteUploadExternalResponse, FilesGetUploadURLExternalResponse, -} from './response'; +} from './types/response'; import { Methods, CursorPaginationEnabled, cursorPaginationEnabledMethods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; import { getUserAgent } from './instrument'; diff --git a/packages/web-api/src/index.ts b/packages/web-api/src/index.ts index 202c930e2..0ab1e18df 100644 --- a/packages/web-api/src/index.ts +++ b/packages/web-api/src/index.ts @@ -30,4 +30,4 @@ export { addAppMetadata } from './instrument'; export * from './methods'; export { default as Method } from './methods'; -export * from './response'; +export * from './types/response'; diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 233ec6249..1f9b174af 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -229,7 +229,7 @@ import { AdminWorkflowsPermissionsLookupResponse, AdminAppsConfigLookupResponse, AdminAppsConfigSetResponse, -} from './response'; +} from './types/response'; // NOTE: could create a named type alias like data types like `SlackUserID: string` From 822496f9dfc7757034cd561f0c9e929e1ae6be0a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 16:50:05 -0400 Subject: [PATCH 035/122] Update deprecation warning to remove old deprecated methods, and start adding new ones. --- packages/web-api/src/WebClient.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index 24df4dbca..ea7c0a23a 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -793,23 +793,14 @@ function parseRetryHeaders(response: AxiosResponse): number | undefined { * @param logger instance of web clients logger */ function warnDeprecations(method: string, logger: Logger): void { - const deprecatedConversationsMethods = ['channels.', 'groups.', 'im.', 'mpim.']; - - const deprecatedMethods = ['admin.conversations.whitelist.', 'stars.']; - - const isDeprecatedConversations = deprecatedConversationsMethods.some((depMethod) => { - const re = new RegExp(`^${depMethod}`); - return re.test(method); - }); + const deprecatedMethods = ['workflows.']; const isDeprecated = deprecatedMethods.some((depMethod) => { const re = new RegExp(`^${depMethod}`); return re.test(method); }); - if (isDeprecatedConversations) { - logger.warn(`${method} is deprecated. Please use the Conversations API instead. For more info, go to https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api`); - } else if (isDeprecated) { + if (isDeprecated) { logger.warn(`${method} is deprecated. Please check on https://api.slack.com/methods for an alternative.`); } } From 9f8df3c3c34422d8f3ae2e103249bbfa1d9b1364 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 16:50:50 -0400 Subject: [PATCH 036/122] update type tests after moving response/request objects around --- .../web-api/test/types/webclient-named-method-types.test-d.ts | 4 ++-- packages/web-api/test/types/webclient-no-token.test-d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web-api/test/types/webclient-named-method-types.test-d.ts b/packages/web-api/test/types/webclient-named-method-types.test-d.ts index 82ad31533..9da9ec70c 100644 --- a/packages/web-api/test/types/webclient-named-method-types.test-d.ts +++ b/packages/web-api/test/types/webclient-named-method-types.test-d.ts @@ -1,7 +1,7 @@ import { expectType, expectError } from 'tsd'; import { WebClient, WebAPICallResult } from '../../'; -import { ChatPostMessageResponse } from '../../src/response/ChatPostMessageResponse'; -import { ChatPostEphemeralResponse } from '../../src/response/ChatPostEphemeralResponse'; +import { ChatPostMessageResponse } from '../../src/types/response/ChatPostMessageResponse'; +import { ChatPostEphemeralResponse } from '../../src/types/response/ChatPostEphemeralResponse'; // import { ChatScheduleMessageResponse } from '../../src/response/ChatScheduleMessageResponse'; // import { ChatUpdateResponse } from '../../src/response/ChatUpdateResponse'; diff --git a/packages/web-api/test/types/webclient-no-token.test-d.ts b/packages/web-api/test/types/webclient-no-token.test-d.ts index e692d6684..59c12fe32 100644 --- a/packages/web-api/test/types/webclient-no-token.test-d.ts +++ b/packages/web-api/test/types/webclient-no-token.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; import { WebClient } from '../../'; -import { OauthAccessResponse } from '../../src/response/OauthAccessResponse'; +import { OauthAccessResponse } from '../../src/types/response/OauthAccessResponse'; const web = new WebClient(); From 53454568861ba0ca141a92f55b133c01f81faf02 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 16:52:06 -0400 Subject: [PATCH 037/122] Start splitting out request interfaces into src/types/request and separate files. Add common request interface mixins to src/types/request/common. JSDoc method arguments for search, views and workflows. --- packages/web-api/src/methods.ts | 170 +++--------------- packages/web-api/src/types/request/common.ts | 44 +++++ packages/web-api/src/types/request/search.ts | 25 +++ packages/web-api/src/types/request/views.ts | 59 ++++++ .../web-api/src/types/request/workflows.ts | 39 ++++ 5 files changed, 193 insertions(+), 144 deletions(-) create mode 100644 packages/web-api/src/types/request/common.ts create mode 100644 packages/web-api/src/types/request/search.ts create mode 100644 packages/web-api/src/types/request/views.ts create mode 100644 packages/web-api/src/types/request/workflows.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1f9b174af..f394dc3b8 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,7 +1,8 @@ import { Stream } from 'stream'; -import { Dialog, View, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; +import { Dialog, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; +import { TokenOverridable, LocaleAware, OptionalTeamAssignable, TraditionalPagingEnabled, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; import { AdminAnalyticsGetFileResponse, AdminAppsApproveResponse, @@ -230,9 +231,27 @@ import { AdminAppsConfigLookupResponse, AdminAppsConfigSetResponse, } from './types/response'; +import { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; +import { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; +import { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; // NOTE: could create a named type alias like data types like `SlackUserID: string` +/** + * Generic method definition + */ +export default interface Method< + MethodArguments, + MethodResult extends WebAPICallResult = WebAPICallResult, +> { + (options: MethodArguments): Promise; +} + +// A set of method names is initialized here and added to each time an argument type extends the CursorPaginationEnabled +// interface, so that methods are checked against this set when using the pagination helper. If the method name is not +// found, a warning is emitted to guide the developer to using the method correctly. +export const cursorPaginationEnabledMethods: Set = new Set(); + /** * Binds a certain `method` and its arguments and result types to the `apiCall` method in `WebClient`. */ @@ -256,13 +275,6 @@ function bindFilesUploadV2( * `apiCall` class method. */ export abstract class Methods extends EventEmitter { - // TODO: As of writing, `WebClient` already extends EventEmitter... - // and I want WebClient to extend this class... - // and multiple inheritance in JS is cursed... - // so I'm just making this class extend EventEmitter. - // - // It shouldn't be here, indeed. Nothing here uses it, indeed. But it must be here for the sake of sanity. - protected constructor() { super(); @@ -854,6 +866,12 @@ export abstract class Methods extends EventEmitter { update: bindApiCall(this, 'views.update'), }; + // ------------------ + // Deprecated methods + // TODO: breaking changes for future majors: + // - workflows.* methods, Sep 12 2024: https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back + // ------------------ + public readonly workflows = { stepCompleted: bindApiCall( this, @@ -864,58 +882,6 @@ export abstract class Methods extends EventEmitter { }; } -/** - * Generic method definition - */ -export default interface Method< - MethodArguments, - MethodResult extends WebAPICallResult = WebAPICallResult, -> { - (options: MethodArguments): Promise; -} - -/* - * Reusable mixins or extensions that some MethodArguments types can extend from - */ -export interface TokenOverridable { - token?: string; -} - -export interface LocaleAware { - include_locale?: boolean; -} - -interface OptionalTeamAssignable { - team_id?: string; // typically models the "team_id is required if org token is used" constraint -} - -export interface Searchable extends OptionalTeamAssignable { - query: string; - highlight?: boolean; - sort: 'score' | 'timestamp'; - sort_dir: 'asc' | 'desc'; -} - -// A set of method names is initialized here and added to each time an argument type extends the CursorPaginationEnabled -// interface, so that methods are checked against this set when using the pagination helper. If the method name is not -// found, a warning is emitted to guide the developer to using the method correctly. -export const cursorPaginationEnabledMethods: Set = new Set(); -export interface CursorPaginationEnabled { - limit?: number; // natural integer, max of 1000 - cursor?: string; // find this in a response's `response_metadata.next_cursor` -} - -export interface TimelinePaginationEnabled { - oldest?: string; - latest?: string; - inclusive?: boolean; -} - -export interface TraditionalPagingEnabled { - page?: number; // default: 1 - count?: number; // default: 100 -} - /* * MethodArguments types (no formal relationship other than the generic constraint in Method<>) */ @@ -2262,19 +2228,6 @@ export interface RTMStartArguments extends TokenOverridable, LocaleAware { simple_latest?: boolean; } -/* - * `search.*` - */ -// https://api.slack.com/methods/search.all -export interface SearchAllArguments extends TokenOverridable, TraditionalPagingEnabled, - Searchable { } -// https://api.slack.com/methods/search.files -export interface SearchFilesArguments extends TokenOverridable, TraditionalPagingEnabled, - Searchable { } -// https://api.slack.com/methods/search.messages -export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, - Searchable { } - // TODO: usage info for stars.add recommends retiring use of any stars APIs // https://api.slack.com/methods/stars.add#markdown // should we mark these methods as deprecated? @@ -2445,75 +2398,4 @@ export interface UsersProfileSetArguments extends TokenOverridable { value?: string; // usable if `profile` is not passed } -/* - * `views.*` - */ -interface BaseViewsArguments { - view: View; -} -interface ViewTriggerId { - trigger_id: string; -} -interface ViewInteractivityPointer { - interactivity_pointer: string; -} -// https://api.slack.com/methods/views.open -export type ViewsOpenArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); -// https://api.slack.com/methods/views.push -export type ViewsPushArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); -// https://api.slack.com/methods/views.publish -export interface ViewsPublishArguments extends BaseViewsArguments, TokenOverridable { - user_id: string; - hash?: string; -} -interface ViewExternalId { - external_id: string; -} -interface ViewViewId { - view_id: string; -} -// https://api.slack.com/methods/views.update -export type ViewsUpdateArguments = BaseViewsArguments & TokenOverridable & (ViewExternalId | ViewViewId) & { - hash?: string; -}; - -// TODO: docs state workflows.* methods are deprecated. should we mark them as such? -/* - * `workflows.*` - */ -// https://api.slack.com/methods/workflows.stepCompleted -export interface WorkflowsStepCompletedArguments extends TokenOverridable { - workflow_step_execute_id: string; - outputs?: Record; -} -// https://api.slack.com/methods/workflows.stepFailed -export interface WorkflowsStepFailedArguments extends TokenOverridable { - workflow_step_execute_id: string; - error: { - message: string; - }; -} -// https://api.slack.com/methods/workflows.updateStep -export interface WorkflowsUpdateStepArguments extends TokenOverridable { - workflow_step_edit_id: string; - step_image_url?: string; - step_name?: string; - inputs?: { - [name: string]: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - value: any; - skip_variable_replacement?: boolean; - variables?: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any; - }; - }, - }; - outputs?: { - type: string; - name: string; - label: string; - }[]; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts new file mode 100644 index 000000000..739b37ba2 --- /dev/null +++ b/packages/web-api/src/types/request/common.ts @@ -0,0 +1,44 @@ +// Reusable mixins or extensions that some Method Arguments types can extend from + +// Cursor, timeline and traditional pagination extensions. +export interface CursorPaginationEnabled { + limit?: number; // natural integer, max of 1000 + cursor?: string; // find this in a response's `response_metadata.next_cursor` +} + +export interface TimelinePaginationEnabled { + oldest?: string; + latest?: string; + inclusive?: boolean; +} + +export interface TraditionalPagingEnabled { + /** @description Number of items to return per page. Defaults to `20` */ + count?: number; + /** @description Page number of results to return. Defaults to `1`. */ + page?: number; +} + +/** + * Some API methods allow for overriding the auth token used with a method at runtime. + */ +export interface TokenOverridable { + /** @description Authentication token bearing required scopes. */ + token?: string; +} + +/** + * Some API methods allow to receive the locale of the content. + */ +export interface LocaleAware { + /** @description Set this to `true` to receive the locale with the response. */ + include_locale?: boolean; +} + +/** + * Some API methods optionally require a `team_id` if an org token is used. + */ +export interface OptionalTeamAssignable { + /** @description If using an org token, `team_id` is required. */ + team_id?: string; +} diff --git a/packages/web-api/src/types/request/search.ts b/packages/web-api/src/types/request/search.ts new file mode 100644 index 000000000..15341c8bf --- /dev/null +++ b/packages/web-api/src/types/request/search.ts @@ -0,0 +1,25 @@ +import { OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; + +interface Searchable extends OptionalTeamAssignable { + /** @description Search query. */ + query: string; + /** + * @description Set to `true` to enable query highlight markers. Defaults to `false`. + * @see {@link https://api.slack.com/methods/search.messages#markdown `search.messages` Usage info} for details. + */ + highlight?: boolean; + /** @description Return matches sorted by either `score` or `timestamp`. Defaults to `score`. */ + sort: 'score' | 'timestamp'; + /** @description Change sort direction to ascending (`asc`) or descending (`desc`). Defaults to `desc`. */ + sort_dir: 'asc' | 'desc'; +} + +// https://api.slack.com/methods/search.all +export interface SearchAllArguments extends TokenOverridable, TraditionalPagingEnabled, + Searchable { } +// https://api.slack.com/methods/search.files +export interface SearchFilesArguments extends TokenOverridable, TraditionalPagingEnabled, + Searchable { } +// https://api.slack.com/methods/search.messages +export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, + Searchable { } diff --git a/packages/web-api/src/types/request/views.ts b/packages/web-api/src/types/request/views.ts new file mode 100644 index 000000000..186533e23 --- /dev/null +++ b/packages/web-api/src/types/request/views.ts @@ -0,0 +1,59 @@ +import { View } from '@slack/types'; +import { TokenOverridable } from './common'; + +interface BaseViewsArguments { + /** @description A {@link https://api.slack.com/reference/surfaces/views view payload}. */ + view: View; +} + +interface ViewTriggerId { + /** + * @description An access token originating from a user interaction in the Slack client. + * One of `trigger_id` or `interactivity_pointer` is required to interact with views. + */ + trigger_id: string; +} +interface ViewInteractivityPointer { + /** + * @description An access token originating from a user interaction in the Slack client. + * One of `trigger_id` or `interactivity_pointer` is required to interact with views. + */ + interactivity_pointer: string; +} + +// https://api.slack.com/methods/views.open +export type ViewsOpenArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); + +// https://api.slack.com/methods/views.push +export type ViewsPushArguments = BaseViewsArguments & TokenOverridable & (ViewTriggerId | ViewInteractivityPointer); + +interface ViewHash { + /** + * @description A string that represents view state to protect against possible race conditions. + * @see {@link https://api.slack.com/surfaces/modals#handling_race_conditions Avoiding race conditions when using views}. + */ + hash?: string; +} + +// https://api.slack.com/methods/views.publish +export interface ViewsPublishArguments extends BaseViewsArguments, TokenOverridable, ViewHash { + /** @description ID of the user you want publish a view to. */ + user_id: string; +} + +interface ViewExternalId { + /** + * @description A unique identifier of the view set by the developer. Must be unique for all views on a team. + * Max length of 255 characters. Either `view_id` or `external_id` is required. + */ + external_id: string; +} +interface ViewViewId { + /** + * @description A unique identifier of the view to be updated. Either `view_id` or `external_id` is required. + */ + view_id: string; +} + +// https://api.slack.com/methods/views.update +export type ViewsUpdateArguments = BaseViewsArguments & TokenOverridable & (ViewExternalId | ViewViewId) & ViewHash; diff --git a/packages/web-api/src/types/request/workflows.ts b/packages/web-api/src/types/request/workflows.ts new file mode 100644 index 000000000..0aee2297c --- /dev/null +++ b/packages/web-api/src/types/request/workflows.ts @@ -0,0 +1,39 @@ +import { TokenOverridable } from '../../methods'; + +// TODO: breaking change: to be removed after Sep 12 2024 +// https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back + +// https://api.slack.com/methods/workflows.stepCompleted +export interface WorkflowsStepCompletedArguments extends TokenOverridable { + workflow_step_execute_id: string; + outputs?: Record; +} +// https://api.slack.com/methods/workflows.stepFailed +export interface WorkflowsStepFailedArguments extends TokenOverridable { + workflow_step_execute_id: string; + error: { + message: string; + }; +} +// https://api.slack.com/methods/workflows.updateStep +export interface WorkflowsUpdateStepArguments extends TokenOverridable { + workflow_step_edit_id: string; + step_image_url?: string; + step_name?: string; + inputs?: { + [name: string]: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value: any; + skip_variable_replacement?: boolean; + variables?: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [key: string]: any; + }; + }, + }; + outputs?: { + type: string; + name: string; + label: string; + }[]; +} From fe414b389baeba47586ac833af9d0cf091ca2c67 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 20 Oct 2023 16:57:31 -0400 Subject: [PATCH 038/122] Fix import --- packages/web-api/src/WebClient.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index ea7c0a23a..eac433e26 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -19,8 +19,8 @@ import { FilesCompleteUploadExternalResponse, FilesGetUploadURLExternalResponse, } from './types/response'; - -import { Methods, CursorPaginationEnabled, cursorPaginationEnabledMethods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; +import { CursorPaginationEnabled } from './types/request/common'; +import { Methods, cursorPaginationEnabledMethods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; import { getUserAgent } from './instrument'; import { requestErrorWithOriginal, httpErrorFromResponse, platformErrorFromResult, rateLimitedErrorWithDelay, From 68606127aa3c91ab35d7a9bc44e243e0df9f2822 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 24 Oct 2023 14:06:36 -0400 Subject: [PATCH 039/122] Move request arguments for users.* apis to own file. Removed the warning around using cursor pagination `paginate()` --- packages/web-api/src/WebClient.ts | 6 +- packages/web-api/src/methods.ts | 100 +----------------- packages/web-api/src/types/request/common.ts | 3 +- packages/web-api/src/types/request/users.ts | 52 +++++++++ .../web-api/src/types/request/workflows.ts | 2 +- 5 files changed, 59 insertions(+), 104 deletions(-) create mode 100644 packages/web-api/src/types/request/users.ts diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index eac433e26..a7c22cc78 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -20,7 +20,7 @@ import { FilesGetUploadURLExternalResponse, } from './types/response'; import { CursorPaginationEnabled } from './types/request/common'; -import { Methods, cursorPaginationEnabledMethods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; +import { Methods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; import { getUserAgent } from './instrument'; import { requestErrorWithOriginal, httpErrorFromResponse, platformErrorFromResult, rateLimitedErrorWithDelay, @@ -317,10 +317,6 @@ export class WebClient extends Methods { shouldStop?: PaginatePredicate, reduce?: PageReducer, ): (Promise | AsyncIterable) { - if (!cursorPaginationEnabledMethods.has(method)) { - this.logger.warn(`paginate() called with method ${method}, which is not known to be cursor pagination enabled.`); - } - const pageSize = (() => { if (options !== undefined && typeof options.limit === 'number') { const { limit } = options; diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index f394dc3b8..12baf47ff 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,4 +1,4 @@ -import { Stream } from 'stream'; +import { Stream } from 'node:stream'; import { Dialog, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; @@ -232,8 +232,9 @@ import { AdminAppsConfigSetResponse, } from './types/response'; import { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; -import { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; import { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; +import { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; +import { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; // NOTE: could create a named type alias like data types like `SlackUserID: string` @@ -247,11 +248,6 @@ export default interface Method< (options: MethodArguments): Promise; } -// A set of method names is initialized here and added to each time an argument type extends the CursorPaginationEnabled -// interface, so that methods are checked against this set when using the pagination helper. If the method name is not -// found, a warning is emitted to guide the developer to using the method correctly. -export const cursorPaginationEnabledMethods: Set = new Set(); - /** * Binds a certain `method` and its arguments and result types to the `apiCall` method in `WebClient`. */ @@ -924,7 +920,6 @@ export interface AdminAppsClearResolutionArguments { enterprise_id?: string; team_id?: string; } -cursorPaginationEnabledMethods.add('admin.apps.approved.list'); // https://api.slack.com/methods/admin.apps.requests.cancel export interface AdminAppsRequestsCancelArguments extends TokenOverridable { request_id: string; @@ -937,7 +932,6 @@ export interface AdminAppsRequestsListArguments extends TokenOverridable, Cursor enterprise_id?: string; team_id?: string; // required if your enterprise grid contains more than one workspace } -cursorPaginationEnabledMethods.add('admin.apps.requests.list'); // TODO: breaking changes - potential type improvements: // - exactly one of `team_id` or `enterprise_id` is required - but not both // - either `app_id` or `request_id` is required @@ -956,7 +950,6 @@ export interface AdminAppsRestrictedListArguments extends TokenOverridable, Curs team_id?: string; enterprise_id?: string; } -cursorPaginationEnabledMethods.add('admin.apps.restricted.list'); // TODO: breaking changes - potential type improvements: // - exactly one of `team_id` or `enterprise_id` is required - but not both @@ -980,7 +973,6 @@ export interface AdminAppsActivitiesListArguments extends TokenOverridable, Curs team_id?: string; trace_id?: string; } -cursorPaginationEnabledMethods.add('admin.apps.activities.list'); // TODO: does not get used, should add method implementation, see https://github.com/slackapi/node-slack-sdk/issues/1675 export interface AdminAppsConfigLookupArguments extends TokenOverridable { app_ids: string[]; @@ -1006,7 +998,6 @@ export interface AdminAuthPolicyGetEntitiesArguments extends TokenOverridable, policy_name: 'email_password'; entity_type?: 'USER'; } -cursorPaginationEnabledMethods.add('admin.auth.policy.getEntities'); // https://api.slack.com/methods/admin.auth.policy.removeEntities export interface AdminAuthPolicyRemoveEntitiesArguments extends TokenOverridable { entity_ids: string[]; // TODO: breaking change, enforce at least one array item? @@ -1025,7 +1016,6 @@ export interface AdminBarriersDeleteArguments extends TokenOverridable { } // https://api.slack.com/methods/admin.barriers.list export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } -cursorPaginationEnabledMethods.add('admin.barriers.list'); // https://api.slack.com/methods/admin.barriers.update export interface AdminBarriersUpdateArguments extends TokenOverridable { @@ -1086,14 +1076,12 @@ export interface AdminConversationsLookupArguments team_ids: string[]; max_member_count?: number; } -cursorPaginationEnabledMethods.add('admin.conversations.lookup'); // https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments extends TokenOverridable, CursorPaginationEnabled { channel_ids?: string[]; team_ids?: string[]; } -cursorPaginationEnabledMethods.add('admin.conversations.ekm.listOriginalConnectedChannelInfo'); // https://api.slack.com/methods/admin.conversations.getConversationPrefs export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { channel_id: string; @@ -1103,7 +1091,6 @@ export interface AdminConversationsGetTeamsArguments extends TokenOverridable, CursorPaginationEnabled { channel_id: string; } -cursorPaginationEnabledMethods.add('admin.conversations.getTeams'); // https://api.slack.com/methods/admin.conversations.invite export interface AdminConversationsInviteArguments extends TokenOverridable { channel_id: string; @@ -1155,7 +1142,6 @@ export interface AdminConversationsSearchArguments connected_team_ids?: string[]; total_count_only?: boolean; } -cursorPaginationEnabledMethods.add('admin.conversations.search'); // https://api.slack.com/methods/admin.conversations.setConversationPrefs export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { channel_id: string; @@ -1184,7 +1170,6 @@ export interface AdminEmojiAddAliasArguments extends TokenOverridable { } // https://api.slack.com/methods/admin.emoji.list export interface AdminEmojiListArguments extends TokenOverridable, CursorPaginationEnabled { } -cursorPaginationEnabledMethods.add('admin.emoji.list'); // https://api.slack.com/methods/admin.emoji.remove export interface AdminEmojiRemoveArguments extends TokenOverridable { name: string; @@ -1221,7 +1206,6 @@ export interface AdminInviteRequestsApprovedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } -cursorPaginationEnabledMethods.add('admin.inviteRequests.approved.list'); // https://api.slack.com/methods/admin.inviteRequests.deny export interface AdminInviteRequestsDenyArguments extends TokenOverridable { @@ -1233,13 +1217,11 @@ export interface AdminInviteRequestsDeniedListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } -cursorPaginationEnabledMethods.add('admin.inviteRequests.denied.list'); // https://api.slack.com/methods/admin.inviteRequests.list export interface AdminInviteRequestsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } -cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); // https://api.slack.com/methods/admin.roles.addAssignments export interface AdminRolesAddAssignmentsArguments extends TokenOverridable { @@ -1254,7 +1236,6 @@ export interface AdminRolesListAssignmentsArguments role_ids?: string[]; sort_dir?: string; // TODO: breaking change - turn to `asc` | `desc`? tho docs say this should be capital letters... } -cursorPaginationEnabledMethods.add('admin.roles.listAssignments'); // https://api.slack.com/methods/admin.roles.removeAssignments export interface AdminRolesRemoveAssignmentsArguments extends TokenOverridable { @@ -1262,12 +1243,10 @@ export interface AdminRolesRemoveAssignmentsArguments entity_ids: string[]; user_ids: string[]; } -cursorPaginationEnabledMethods.add('admin.inviteRequests.list'); // https://api.slack.com/methods/admin.teams.admins.list export interface AdminTeamsAdminsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } -cursorPaginationEnabledMethods.add('admin.teams.admins.list'); type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; // https://api.slack.com/methods/admin.teams.create export interface AdminTeamsCreateArguments extends TokenOverridable { @@ -1278,12 +1257,10 @@ export interface AdminTeamsCreateArguments extends TokenOverridable { } // https://api.slack.com/methods/admin.teams.list export interface AdminTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { } -cursorPaginationEnabledMethods.add('admin.teams.list'); // https://api.slack.com/methods/admin.teams.owners.list export interface AdminTeamsOwnersListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; } -cursorPaginationEnabledMethods.add('admin.teams.owners.list'); // https://api.slack.com/methods/admin.teams.settings.info export interface AdminTeamsSettingsInfoArguments extends TokenOverridable { team_id: string; @@ -1361,7 +1338,6 @@ export interface AdminUsersInviteArguments extends TokenOverridable { export interface AdminUsersListArguments extends TokenOverridable, CursorPaginationEnabled { team_id?: string; // Only required if org-level token is used } -cursorPaginationEnabledMethods.add('admin.users.list'); // https://api.slack.com/methods/admin.users.remove export interface AdminUsersRemoveArguments extends TokenOverridable { team_id: string; @@ -1388,7 +1364,6 @@ export interface AdminUsersSetRegularArguments extends TokenOverridable { team_id: string; user_id: string; } -cursorPaginationEnabledMethods.add('admin.users.session.list'); // TODO: breaking change: if user_id is provided, team_id must be provided, too. // https://api.slack.com/methods/admin.users.session.list export interface AdminUsersSessionListArguments extends TokenOverridable, CursorPaginationEnabled { @@ -1460,7 +1435,6 @@ export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorP sort_dir?: 'asc' | 'desc'; source?: 'code' | 'workflow_builder'; } -cursorPaginationEnabledMethods.add('admin.worfklows.search'); // https://api.slack.com/methods/admin.workflows.unpublish export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { workflow_ids: string[]; @@ -1483,7 +1457,6 @@ export interface AppsEventAuthorizationsListArguments extends TokenOverridable, CursorPaginationEnabled { event_context: string; } -cursorPaginationEnabledMethods.add('apps.event.authorizations.list'); // https://api.slack.com/methods/apps.uninstall export interface AppsUninstallArguments { client_id: string; @@ -1502,7 +1475,6 @@ export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginati include_icon?: boolean; } // https://api.slack.com/methods/auth.test -cursorPaginationEnabledMethods.add('auth.teams.list'); export interface AuthTestArguments extends TokenOverridable { } /* @@ -1680,7 +1652,6 @@ export interface ChatScheduledMessagesListArguments extends TokenOverridable, latest?: number; oldest?: number; } -cursorPaginationEnabledMethods.add('chat.scheduledMessages.list'); // ChannelAndTS and SourceAndUnfurlID are used as either-or mixins for ChatUnfurlArguments interface ChannelAndTSArguments { /** @@ -1795,7 +1766,6 @@ export interface ConversationsHistoryArguments extends TokenOverridable, CursorP channel: string; include_all_metadata?: boolean; } -cursorPaginationEnabledMethods.add('conversations.history'); // https://api.slack.com/methods/conversations.info export interface ConversationsInfoArguments extends TokenOverridable, LocaleAware { channel: string; @@ -1832,13 +1802,11 @@ export interface ConversationsListArguments extends TokenOverridable, CursorPagi exclude_archived?: boolean; types?: string; // comma-separated list of conversation types } -cursorPaginationEnabledMethods.add('conversations.list'); // https://api.slack.com/methods/conversations.listConnectInvites export interface ConversationsListConnectInvitesArguments extends TokenOverridable, OptionalTeamAssignable { count?: number; // lol we use `limit` everywhere else cursor?: string; } -cursorPaginationEnabledMethods.add('conversations.listConnectInvites'); // https://api.slack.com/methods/conversations.mark export interface ConversationsMarkArguments extends TokenOverridable { channel: string; @@ -1848,7 +1816,6 @@ export interface ConversationsMarkArguments extends TokenOverridable { export interface ConversationsMembersArguments extends TokenOverridable, CursorPaginationEnabled { channel: string; } -cursorPaginationEnabledMethods.add('conversations.members'); // TODO: breaking change: must supply either channel or users // https://api.slack.com/methods/conversations.open export interface ConversationsOpenArguments extends TokenOverridable { @@ -1869,7 +1836,6 @@ export interface ConversationsRepliesArguments extends TokenOverridable, CursorP ts: string; include_all_metadata?: boolean; } -cursorPaginationEnabledMethods.add('conversations.replies'); // https://api.slack.com/methods/conversations.setPurpose export interface ConversationsSetPurposeArguments extends TokenOverridable { channel: string; @@ -1933,7 +1899,6 @@ export interface FilesDeleteArguments extends TokenOverridable { export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled { file: string; // file id } -cursorPaginationEnabledMethods.add('files.info'); // https://api.slack.com/methods/files.list export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled, OptionalTeamAssignable { channel?: string; @@ -2032,7 +1997,6 @@ export interface FilesRemoteListArguments extends TokenOverridable, CursorPagina ts_to?: string; channel?: string; } -cursorPaginationEnabledMethods.add('files.remote.list'); // https://api.slack.com/methods/files.remote.add export interface FilesRemoteAddArguments extends TokenOverridable { title: string; @@ -2164,7 +2128,6 @@ export interface ReactionsListArguments extends TokenOverridable, TraditionalPag user?: string; full?: boolean; } -cursorPaginationEnabledMethods.add('reactions.list'); // TODO: must supply either channel and timestamp or a file id or file comment id // https://api.slack.com/methods/reactions.remove export interface ReactionsRemoveArguments extends TokenOverridable { @@ -2245,7 +2208,6 @@ export interface StarsAddArguments extends TokenOverridable { // https://api.slack.com/methods/stars.list export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, CursorPaginationEnabled, OptionalTeamAssignable { } -cursorPaginationEnabledMethods.add('stars.list'); // https://api.slack.com/methods/stars.remove export interface StarsRemoveArguments extends TokenOverridable { // TODO: breaking change: must supply one of: @@ -2263,7 +2225,6 @@ export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginat TraditionalPagingEnabled, OptionalTeamAssignable { before?: number; } -cursorPaginationEnabledMethods.add('team.accessLogs'); // https://api.slack.com/methods/team.billableInfo export interface TeamBillableInfoArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { user?: string; @@ -2343,59 +2304,4 @@ export interface UsergroupsUsersUpdateArguments extends TokenOverridable, Option include_count?: boolean; } -/* - * `users.*` - */ -// https://api.slack.com/methods/users.conversations -export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { - exclude_archived?: boolean; - types?: string; // comma-separated list of conversation types - user?: string; -} -cursorPaginationEnabledMethods.add('users.conversations'); -// https://api.slack.com/methods/users.deletePhoto -export interface UsersDeletePhotoArguments extends TokenOverridable { } -// https://api.slack.com/methods/users.getPresence -export interface UsersGetPresenceArguments extends TokenOverridable { - user?: string; -} -// https://api.slack.com/methods/users.identity -export interface UsersIdentityArguments extends TokenOverridable { } -// https://api.slack.com/methods/users.info -export interface UsersInfoArguments extends TokenOverridable, LocaleAware { - user: string; -} -// https://api.slack.com/methods/users.list -export interface UsersListArguments extends TokenOverridable, CursorPaginationEnabled, - LocaleAware, OptionalTeamAssignable { } -cursorPaginationEnabledMethods.add('users.list'); -// https://api.slack.com/methods/users.lookupByEmail -export interface UsersLookupByEmailArguments extends TokenOverridable { - email: string; -} -// https://api.slack.com/methods/users.setPhoto -export interface UsersSetPhotoArguments extends TokenOverridable { - image: Buffer | Stream; - crop_w?: number; - crop_x?: number; - crop_y?: number; -} -// https://api.slack.com/methods/users.setPresence -export interface UsersSetPresenceArguments extends TokenOverridable { - presence: 'auto' | 'away'; -} -// https://api.slack.com/methods/users.profile.get -export interface UsersProfileGetArguments extends TokenOverridable { - include_labels?: boolean; - user?: string; -} -// TODO: breaking change: either profile or name/value pair must be provided -// https://api.slack.com/methods/users.profile.set -export interface UsersProfileSetArguments extends TokenOverridable { - profile?: string; // url-encoded json - user?: string; // must be an admin user and must be on a paid plan - name?: string; // usable if `profile` is not passed - value?: string; // usable if `profile` is not passed -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 739b37ba2..159a15242 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -1,6 +1,7 @@ // Reusable mixins or extensions that some Method Arguments types can extend from // Cursor, timeline and traditional pagination extensions. + export interface CursorPaginationEnabled { limit?: number; // natural integer, max of 1000 cursor?: string; // find this in a response's `response_metadata.next_cursor` @@ -23,7 +24,7 @@ export interface TraditionalPagingEnabled { * Some API methods allow for overriding the auth token used with a method at runtime. */ export interface TokenOverridable { - /** @description Authentication token bearing required scopes. */ + /** @description Overridable authentication token bearing required scopes. */ token?: string; } diff --git a/packages/web-api/src/types/request/users.ts b/packages/web-api/src/types/request/users.ts new file mode 100644 index 000000000..91269f2ea --- /dev/null +++ b/packages/web-api/src/types/request/users.ts @@ -0,0 +1,52 @@ +import { Stream } from 'node:stream'; +import { TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable, LocaleAware } from './common'; + +// https://api.slack.com/methods/users.conversations +export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { + exclude_archived?: boolean; + types?: string; // comma-separated list of conversation types + user?: string; +} +// https://api.slack.com/methods/users.deletePhoto +export interface UsersDeletePhotoArguments extends TokenOverridable { } +// https://api.slack.com/methods/users.getPresence +export interface UsersGetPresenceArguments extends TokenOverridable { + user?: string; +} +// https://api.slack.com/methods/users.identity +export interface UsersIdentityArguments extends TokenOverridable { } +// https://api.slack.com/methods/users.info +export interface UsersInfoArguments extends TokenOverridable, LocaleAware { + user: string; +} +// https://api.slack.com/methods/users.list +export interface UsersListArguments extends TokenOverridable, CursorPaginationEnabled, + LocaleAware, OptionalTeamAssignable { } +// https://api.slack.com/methods/users.lookupByEmail +export interface UsersLookupByEmailArguments extends TokenOverridable { + email: string; +} +// https://api.slack.com/methods/users.setPhoto +export interface UsersSetPhotoArguments extends TokenOverridable { + image: Buffer | Stream; + crop_w?: number; + crop_x?: number; + crop_y?: number; +} +// https://api.slack.com/methods/users.setPresence +export interface UsersSetPresenceArguments extends TokenOverridable { + presence: 'auto' | 'away'; +} +// https://api.slack.com/methods/users.profile.get +export interface UsersProfileGetArguments extends TokenOverridable { + include_labels?: boolean; + user?: string; +} +// TODO: breaking change: either profile or name/value pair must be provided +// https://api.slack.com/methods/users.profile.set +export interface UsersProfileSetArguments extends TokenOverridable { + profile?: string; // url-encoded json + user?: string; // must be an admin user and must be on a paid plan + name?: string; // usable if `profile` is not passed + value?: string; // usable if `profile` is not passed +} diff --git a/packages/web-api/src/types/request/workflows.ts b/packages/web-api/src/types/request/workflows.ts index 0aee2297c..6fc387c7c 100644 --- a/packages/web-api/src/types/request/workflows.ts +++ b/packages/web-api/src/types/request/workflows.ts @@ -1,4 +1,4 @@ -import { TokenOverridable } from '../../methods'; +import { TokenOverridable } from './common'; // TODO: breaking change: to be removed after Sep 12 2024 // https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back From 206078c3125d936274696d8e739007efe7c538a4 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 24 Oct 2023 15:39:28 -0400 Subject: [PATCH 040/122] do not apply naming convention linter rules to imports; those might come from external dependencies. --- lint-configs/.eslintrc.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lint-configs/.eslintrc.js b/lint-configs/.eslintrc.js index a1ebd902c..7bcec84db 100644 --- a/lint-configs/.eslintrc.js +++ b/lint-configs/.eslintrc.js @@ -204,6 +204,10 @@ module.exports = { format: ['camelCase'], leadingUnderscore: 'allow', }, + { + selector: 'import', + format: null, // do not force conventions on imports + }, { selector: 'variable', // PascalCase for variables is added to allow exporting a singleton, function library, or bare object as in From 64950e5f6f04d438acd31cc747219174b34c4860 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 24 Oct 2023 15:40:37 -0400 Subject: [PATCH 041/122] remove tests related to cursorPagination warning, which was removed. --- packages/web-api/src/WebClient.spec.js | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/packages/web-api/src/WebClient.spec.js b/packages/web-api/src/WebClient.spec.js index 9eb148237..22719fe14 100644 --- a/packages/web-api/src/WebClient.spec.js +++ b/packages/web-api/src/WebClient.spec.js @@ -797,26 +797,6 @@ describe('WebClient', function () { this.method = 'conversations.list'; }); - describe('logging', function () { - beforeEach(function () { - this.capture = new CaptureConsole(); - this.capture.startCapture(); - }); - it('should log a warning when called with a method not known to be cursor pagination enabled', function () { - this.client.paginate('method'); - const output = this.capture.getCapturedText(); - assert.isNotEmpty(output); - }); - it('should not log a warning when called with a known cursor pagination enabled', function () { - this.client.paginate(this.method); - const output = this.capture.getCapturedText(); - assert.isEmpty(output); - }); - afterEach(function () { - this.capture.stopCapture(); - }); - }); - describe('when not given shouldStop predicate', function () { it('should return an AsyncIterator', function () { const iterator = this.client.paginate(this.method); From 82b82f65729e4df0ec8d9158e232c62465d30b05 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 15:50:44 -0400 Subject: [PATCH 042/122] Describe `users.*` API calls with JSDoc. Document cursor pagination properties. Document users.* API arguments. --- packages/web-api/src/methods.ts | 60 +++++++++++++++++--- packages/web-api/src/types/request/common.ts | 14 ++++- packages/web-api/src/types/request/users.ts | 46 +++++++++++++-- 3 files changed, 105 insertions(+), 15 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 12baf47ff..20b479e0c 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -2,8 +2,8 @@ import { Stream } from 'node:stream'; import { Dialog, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; -import { TokenOverridable, LocaleAware, OptionalTeamAssignable, TraditionalPagingEnabled, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; -import { +// Response types +import type { AdminAnalyticsGetFileResponse, AdminAppsApproveResponse, AdminAppsApprovedListResponse, @@ -231,12 +231,12 @@ import { AdminAppsConfigLookupResponse, AdminAppsConfigSetResponse, } from './types/response'; -import { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; -import { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; -import { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; -import { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; - -// NOTE: could create a named type alias like data types like `SlackUserID: string` +// Request types +import type { TokenOverridable, LocaleAware, OptionalTeamAssignable, TraditionalPagingEnabled, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; +import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; +import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; +import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; +import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; /** * Generic method definition @@ -840,17 +840,61 @@ export abstract class Methods extends EventEmitter { }; public readonly users = { + /** + * @description List conversations the calling user may access. + * @see {@link https://api.slack.com/methods/users.conversations `users.conversations` API reference}. + */ conversations: bindApiCall(this, 'users.conversations'), + /** + * @description Delete the user profile photo. + * @see {@link https://api.slack.com/methods/users.deletePhoto `users.deletePhoto` API reference}. + */ deletePhoto: bindApiCall(this, 'users.deletePhoto'), + /** + * @description Gets user presence information. + * @see {@link https://api.slack.com/methods/users.getPresence `users.getPresence` API reference}. + */ getPresence: bindApiCall(this, 'users.getPresence'), + /** + * @description Get a user's identity. + * @see {@link https://api.slack.com/methods/users.identity `users.identity` API reference}. + */ identity: bindApiCall(this, 'users.identity'), + /** + * @description Gets information about a user. + * @see {@link https://api.slack.com/methods/users.info `users.info` API reference}. + */ info: bindApiCall(this, 'users.info'), + /** + * @description Lists all users in a Slack team. + * @see {@link https://api.slack.com/methods/users.list `users.list` API reference}. + */ list: bindApiCall(this, 'users.list'), + /** + * @description Find a user with an email address. + * @see {@link https://api.slack.com/methods/users.lookupByEmail `users.lookupByEmail` API reference}. + */ lookupByEmail: bindApiCall(this, 'users.lookupByEmail'), + /** + * @description Set the user profile photo. + * @see {@link https://api.slack.com/methods/users.setPhoto `users.setPhoto` API reference}. + */ setPhoto: bindApiCall(this, 'users.setPhoto'), + /** + * @description Manually sets user presence. + * @see {@link https://api.slack.com/methods/users.setPresence `users.setPresence` API reference}. + */ setPresence: bindApiCall(this, 'users.setPresence'), profile: { + /** + * @description Retrieve a user's profile information, including their custom status. + * @see {@link https://api.slack.com/methods/users.profile.get `users.profile.get` API reference}. + */ get: bindApiCall(this, 'users.profile.get'), + /** + * @description Set a user's profile information, including custom status. + * @see {@link https://api.slack.com/methods/users.profile.set `users.profile.set` API reference}. + */ set: bindApiCall(this, 'users.profile.set'), }, }; diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 159a15242..e535d2674 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -3,8 +3,18 @@ // Cursor, timeline and traditional pagination extensions. export interface CursorPaginationEnabled { - limit?: number; // natural integer, max of 1000 - cursor?: string; // find this in a response's `response_metadata.next_cursor` + /** + * @description The maximum number of items to return. Fewer than the requested number of items may be returned, + * even if the end of the list hasn't been reached. Must be an integer with a max value of `999`. Default is `100`. + */ + limit?: number; + /** + * @description Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute + * returned by a previous request's `response_metadata`. + * Default value fetches the first "page" of the collection. + * @see {@link https://api.slack.com/docs/pagination pagination} for more detail. + */ + cursor?: string; } export interface TimelinePaginationEnabled { diff --git a/packages/web-api/src/types/request/users.ts b/packages/web-api/src/types/request/users.ts index 91269f2ea..ff7942183 100644 --- a/packages/web-api/src/types/request/users.ts +++ b/packages/web-api/src/types/request/users.ts @@ -3,20 +3,31 @@ import { TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable, Loca // https://api.slack.com/methods/users.conversations export interface UsersConversationsArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { + /** @description Set to `true` to exclude archived channels from the list. Default is `false`. */ exclude_archived?: boolean; - types?: string; // comma-separated list of conversation types + /** + * @description Mix and match channel types by providing a comma-separated list of any combination of + * `public_channel`, `private_channel`, `mpim` and `im`. Defaults to `public_channel`. + */ + types?: string; + /** + * @description Browse conversations by a specific user ID's membership. + * Non-public channels are restricted to those where the calling user shares membership. + */ user?: string; } // https://api.slack.com/methods/users.deletePhoto export interface UsersDeletePhotoArguments extends TokenOverridable { } // https://api.slack.com/methods/users.getPresence export interface UsersGetPresenceArguments extends TokenOverridable { + /** @description User to get presence info on. Defaults to the authed user. */ user?: string; } // https://api.slack.com/methods/users.identity export interface UsersIdentityArguments extends TokenOverridable { } // https://api.slack.com/methods/users.info export interface UsersInfoArguments extends TokenOverridable, LocaleAware { + /** @description User to get info on. */ user: string; } // https://api.slack.com/methods/users.list @@ -24,29 +35,54 @@ export interface UsersListArguments extends TokenOverridable, CursorPaginationEn LocaleAware, OptionalTeamAssignable { } // https://api.slack.com/methods/users.lookupByEmail export interface UsersLookupByEmailArguments extends TokenOverridable { + /** @description An email address belonging to a user in the workspace */ email: string; } // https://api.slack.com/methods/users.setPhoto export interface UsersSetPhotoArguments extends TokenOverridable { + /** @description Image file contents. */ image: Buffer | Stream; + /** @description Width/height of crop box (always square). */ crop_w?: number; + /** @description X coordinate of top-left corner of crop box. */ crop_x?: number; + /** @description Y coordinate of top-left corner of crop box. */ crop_y?: number; } // https://api.slack.com/methods/users.setPresence export interface UsersSetPresenceArguments extends TokenOverridable { + /** @description Either `auto` or `away`. */ presence: 'auto' | 'away'; } // https://api.slack.com/methods/users.profile.get export interface UsersProfileGetArguments extends TokenOverridable { + /** + * @description Include labels for each ID in custom profile fields. + * Using this parameter will heavily rate-limit your requests and is not recommended. Defaults to `false`. + */ include_labels?: boolean; + /** @description User to retrieve profile info for. */ user?: string; } -// TODO: breaking change: either profile or name/value pair must be provided // https://api.slack.com/methods/users.profile.set export interface UsersProfileSetArguments extends TokenOverridable { - profile?: string; // url-encoded json + /** + * @description Sets profile fields using a single argument. + * Collection of key:value pairs presented as a URL-encoded JSON hash. + * At most 50 fields may be set. Each field `name` is limited to 255 characters. + * @see {@link https://api.slack.com/methods/users.profile.set#profile-fields `users.profile.set` Profile fields usage info}. + */ + profile?: string; // TODO: allow for an object (eg use Record) and add code to JSON encoded properly? + /** @description ID of user to change. This argument may only be specified by admins on paid teams. */ user?: string; // must be an admin user and must be on a paid plan - name?: string; // usable if `profile` is not passed - value?: string; // usable if `profile` is not passed + /** + * @description Name of a single profile field to set. If both `name` and `profile` are set, `name` takes precedence. + * @see {@link https://api.slack.com/methods/users.profile.set#profile-fields `users.profile.set` Profile fields usage info}. + */ + name?: string; + /** + * @description Value to set for the profile field specified by `name`. Usable only if profile is not passed. + * @see {@link https://api.slack.com/methods/users.profile.set#profile-fields `users.profile.set` Profile fields usage info}. + */ + value?: string; } From 539ee1d0a6f57b5a3e26f5cd9696e7a7e4f7a821 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 15:53:58 -0400 Subject: [PATCH 043/122] Document and deprecate workflows.* API methods. --- packages/web-api/src/methods.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 20b479e0c..e6a20387b 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -913,11 +913,26 @@ export abstract class Methods extends EventEmitter { // ------------------ public readonly workflows = { + /** + * @description Indicate that an app's step in a workflow completed execution. + * @deprecated + * @see {@link https://api.slack.com/methods/workflows.stepCompleted `workflows.stepCompleted` API reference}. + */ stepCompleted: bindApiCall( this, 'workflows.stepCompleted', ), + /** + * @description Indicate that an app's step in a workflow failed to execute. + * @deprecated + * @see {@link https://api.slack.com/methods/workflows.stepFailed `workflows.stepFailed` API reference}. + */ stepFailed: bindApiCall(this, 'workflows.stepFailed'), + /** + * @description Update the configuration for a workflow step. + * @deprecated + * @see {@link https://api.slack.com/methods/workflows.updateStep `workflows.updateStep` API reference}. + */ updateStep: bindApiCall(this, 'workflows.updateStep'), }; } From e6adeb0e629263eeff8533c1a73d1aab55a525a2 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 15:56:46 -0400 Subject: [PATCH 044/122] Document views.* API methods. --- packages/web-api/src/methods.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index e6a20387b..1dc7718fa 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -900,9 +900,25 @@ export abstract class Methods extends EventEmitter { }; public readonly views = { + /** + * @description Open a view for a user. + * @see {@link https://api.slack.com/methods/views.open `views.open` API reference}. + */ open: bindApiCall(this, 'views.open'), + /** + * @description Publish a static view for a user. + * @see {@link https://api.slack.com/methods/views.publish `views.publish` API reference}. + */ publish: bindApiCall(this, 'views.publish'), + /** + * @description Push a view onto the stack of a root view. + * @see {@link https://api.slack.com/methods/views.push `views.push` API reference}. + */ push: bindApiCall(this, 'views.push'), + /** + * @description Update an existing view. + * @see {@link https://api.slack.com/methods/views.update `views.update` API reference}. + */ update: bindApiCall(this, 'views.update'), }; @@ -937,10 +953,6 @@ export abstract class Methods extends EventEmitter { }; } -/* - * MethodArguments types (no formal relationship other than the generic constraint in Method<>) - */ - /* * `admin.*` */ From 4a978413d5d1c7ca360b3f6a45df1db7c0f87fc8 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 15:59:06 -0400 Subject: [PATCH 045/122] Document search.* API methods. --- packages/web-api/src/methods.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1dc7718fa..41fdb30c8 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -793,8 +793,20 @@ export abstract class Methods extends EventEmitter { }; public readonly search = { + /** + * @description Searches for messages and files matching a query. + * @see {@link https://api.slack.com/methods/search.all search.all` API reference}. + */ all: bindApiCall(this, 'search.all'), + /** + * @description Searches for files matching a query. + * @see {@link https://api.slack.com/methods/search.files search.files` API reference}. + */ files: bindApiCall(this, 'search.files'), + /** + * @description Searches for messages matching a query. + * @see {@link https://api.slack.com/methods/search.messages search.messages` API reference}. + */ messages: bindApiCall(this, 'search.messages'), }; From 98f22c2b31c8a5762b56810a61bd3a05e2a07b3a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 16:28:22 -0400 Subject: [PATCH 046/122] Split out usergroups.* API arguments into own file. Document usergroups.* API methods. --- packages/web-api/src/methods.ts | 77 +++++++------------ .../web-api/src/types/request/usergroups.ts | 58 ++++++++++++++ 2 files changed, 87 insertions(+), 48 deletions(-) create mode 100644 packages/web-api/src/types/request/usergroups.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 41fdb30c8..47b1d8dda 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -237,6 +237,7 @@ import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, Wor import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; +import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './types/request/usergroups'; /** * Generic method definition @@ -834,16 +835,44 @@ export abstract class Methods extends EventEmitter { }; public readonly usergroups = { + /** + * @description Create a User Group. + * @see {@link https://api.slack.com/methods/usergroups.create `usergroups.create` API reference}. + */ create: bindApiCall(this, 'usergroups.create'), + /** + * @description Disable an existing User Group. + * @see {@link https://api.slack.com/methods/usergroups.disable `usergroups.disable` API reference}. + */ disable: bindApiCall(this, 'usergroups.disable'), + /** + * @description Enable an existing User Group. + * @see {@link https://api.slack.com/methods/usergroups.enable `usergroups.enable` API reference}. + */ enable: bindApiCall(this, 'usergroups.enable'), + /** + * @description List all User Groups for a team. + * @see {@link https://api.slack.com/methods/usergroups.list `usergroups.list` API reference}. + */ list: bindApiCall(this, 'usergroups.list'), + /** + * @description Update an existing User Group. + * @see {@link https://api.slack.com/methods/usergroups.update `usergroups.update` API reference}. + */ update: bindApiCall(this, 'usergroups.update'), users: { + /** + * @description List all users in a User Group. + * @see {@link https://api.slack.com/methods/usergroups.users.list `usergroups.users.list` API reference}. + */ list: bindApiCall( this, 'usergroups.users.list', ), + /** + * @description Update the list of users in a User Group. + * @see {@link https://api.slack.com/methods/usergroups.users.update `usergroups.users.update` API reference}. + */ update: bindApiCall( this, 'usergroups.users.update', @@ -2339,52 +2368,4 @@ export interface TeamProfileGetArguments extends TokenOverridable { // https://api.slack.com/methods/team.preferences.list export interface TeamPreferencesListArguments extends TokenOverridable { } -/* - * `usergroups.*` - */ -// https://api.slack.com/methods/usergroups.create -export interface UsergroupsCreateArguments extends TokenOverridable, OptionalTeamAssignable { - name: string; - channels?: string; // comma-separated list of channels, TODO: docs say this is an array - description?: string; - handle?: string; - include_count?: boolean; -} -// https://api.slack.com/methods/usergroups.disable -export interface UsergroupsDisableArguments extends TokenOverridable, OptionalTeamAssignable { - usergroup: string; - include_count?: boolean; -} -// https://api.slack.com/methods/usergroups.enable -export interface UsergroupsEnableArguments extends TokenOverridable, OptionalTeamAssignable { - usergroup: string; - include_count?: boolean; -} -// https://api.slack.com/methods/usergroups.list -export interface UsergroupsListArguments extends TokenOverridable, OptionalTeamAssignable { - include_count?: boolean; - include_disabled?: boolean; - include_users?: boolean; -} -// https://api.slack.com/methods/usergroups.update -export interface UsergroupsUpdateArguments extends TokenOverridable, OptionalTeamAssignable { - usergroup: string; - channels?: string; // comma-separated list of channels, TODO: docs say this is an array - description?: string; - handle?: string; - include_count?: boolean; - name?: string; -} -// https://api.slack.com/methods/usergroups.users.list -export interface UsergroupsUsersListArguments extends TokenOverridable, OptionalTeamAssignable { - usergroup: string; - include_disabled?: boolean; -} -// https://api.slack.com/methods/usergroups.users.update -export interface UsergroupsUsersUpdateArguments extends TokenOverridable, OptionalTeamAssignable { - usergroup: string; - users: string; // comma-separated list of users - include_count?: boolean; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/usergroups.ts b/packages/web-api/src/types/request/usergroups.ts new file mode 100644 index 000000000..793722b0e --- /dev/null +++ b/packages/web-api/src/types/request/usergroups.ts @@ -0,0 +1,58 @@ +import { OptionalTeamAssignable, TokenOverridable } from './common'; + +interface UsergroupsIncludeCount { + /** @description Include the number of users in each User Group. */ + include_count?: boolean; +} + +// https://api.slack.com/methods/usergroups.create +export interface UsergroupsCreateArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsIncludeCount { + /** @description A name for the User Group. Must be unique among User Groups. */ + name: string; + /** @description A comma separated string of encoded channel IDs for which the User Group uses as a default. */ + channels?: string; + /** @description A short description of the User Group. */ + description?: string; + /** @description A mention handle. Must be unique among channels, users and User Groups. */ + handle?: string; +} +// https://api.slack.com/methods/usergroups.disable +export interface UsergroupsDisableArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsIncludeCount { + /** @description The encoded ID of the User Group to disable. */ + usergroup: string; +} +// https://api.slack.com/methods/usergroups.enable +export interface UsergroupsEnableArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsIncludeCount { + /** @description The encoded ID of the User Group to enable. */ + usergroup: string; +} +// https://api.slack.com/methods/usergroups.list +export interface UsergroupsListArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsIncludeCount { + /** @description Include disabled User Groups. */ + include_disabled?: boolean; + /** @description Include the list of users for each User Group. */ + include_users?: boolean; +} +// https://api.slack.com/methods/usergroups.update +export interface UsergroupsUpdateArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsCreateArguments { + /** @description The encoded ID of the User Group to update. */ + usergroup: string; +} +// https://api.slack.com/methods/usergroups.users.list +export interface UsergroupsUsersListArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description The encoded ID of the User Group to list users for. */ + usergroup: string; + /** @description Allow results that involve disabled User Groups. */ + include_disabled?: boolean; +} +// https://api.slack.com/methods/usergroups.users.update +export interface UsergroupsUsersUpdateArguments extends TokenOverridable, OptionalTeamAssignable, + UsergroupsIncludeCount { + /** @description The encoded ID of the User Group to update users for. */ + usergroup: string; + /** + * @description A comma separated string of encoded user IDs that represent the entire list of users for + * the User Group. + */ + users: string; +} From ac6ca14dbba7a0dba7464c43dae92fe0dd7a3e9b Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 26 Oct 2023 17:09:28 -0400 Subject: [PATCH 047/122] Split out team.* API arguments into own file. Document team.* API methods. --- packages/web-api/src/methods.ts | 68 +++++++++------------- packages/web-api/src/types/request/team.ts | 48 +++++++++++++++ 2 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 packages/web-api/src/types/request/team.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 47b1d8dda..c2122db91 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -238,6 +238,7 @@ import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, View import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './types/request/usergroups'; +import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './types/request/team'; /** * Generic method definition @@ -818,18 +819,46 @@ export abstract class Methods extends EventEmitter { }; public readonly team = { + /** + * @description Gets the access logs for the current team. + * @see {@link https://api.slack.com/methods/team.accessLogs `team.accessLogs` API reference}. + */ accessLogs: bindApiCall(this, 'team.accessLogs'), + /** + * @description Gets billable users information for the current team. + * @see {@link https://api.slack.com/methods/team.billableInfo `team.billableInfo` API reference}. + */ billableInfo: bindApiCall(this, 'team.billableInfo'), billing: { + /** + * @description Reads a workspace's billing plan information. + * @see {@link https://api.slack.com/methods/team.billing.info `team.billing.info` API reference}. + */ info: bindApiCall(this, 'team.billing.info'), }, + /** + * @description Gets information about the current team. + * @see {@link https://api.slack.com/methods/team.info `team.info` API reference}. + */ info: bindApiCall(this, 'team.info'), + /** + * @description Gets the integration logs for the current team. + * @see {@link https://api.slack.com/methods/team.integrationLogs `team.integrationLogs` API reference}. + */ integrationLogs: bindApiCall(this, 'team.integrationLogs'), preferences: { + /** + * @description Retrieve a list of a workspace's team preferences. + * @see {@link https://api.slack.com/methods/team.preferences.list `team.preferences.list` API reference}. + */ list: bindApiCall(this, 'team.preferences.list'), }, profile: { + /** + * @description Retrieve a team's profile. + * @see {@link https://api.slack.com/methods/team.profile.get `team.profile.get` API reference}. + */ get: bindApiCall(this, 'team.profile.get'), }, }; @@ -2329,43 +2358,4 @@ export interface StarsRemoveArguments extends TokenOverridable { file_comment?: string; // file comment id } -/* - * `team.*` - */ -// https://api.slack.com/methods/team.accessLogs -export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled, - TraditionalPagingEnabled, OptionalTeamAssignable { - before?: number; -} -// https://api.slack.com/methods/team.billableInfo -export interface TeamBillableInfoArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { - user?: string; -} -// https://api.slack.com/methods/team.billing.info -export interface TeamBillingInfoArguments extends TokenOverridable { - domain?: string; - team?: string; -} -// https://api.slack.com/methods/team.info -export interface TeamInfoArguments extends TokenOverridable { - // Team to get info on, if omitted, will return information about the current team. - // Will only return team that the authenticated token is allowed to see through external shared channels - team?: string; - domain?: string; // available only for Enterprise Grid -} -// https://api.slack.com/methods/team.integrationLogs -export interface TeamIntegrationLogsArguments extends TokenOverridable, - OptionalTeamAssignable, TraditionalPagingEnabled { - app_id?: string; - change_type?: 'added' | 'removed' | 'enabled' | 'disabled' | 'updated'; - service_id?: string; - user?: string; -} -// https://api.slack.com/methods/team.profile.get -export interface TeamProfileGetArguments extends TokenOverridable { - visibility?: 'all' | 'visible' | 'hidden'; -} -// https://api.slack.com/methods/team.preferences.list -export interface TeamPreferencesListArguments extends TokenOverridable { } - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/team.ts b/packages/web-api/src/types/request/team.ts new file mode 100644 index 000000000..2869b654f --- /dev/null +++ b/packages/web-api/src/types/request/team.ts @@ -0,0 +1,48 @@ +import { OptionalTeamAssignable, TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled } from './common'; + +// https://api.slack.com/methods/team.accessLogs +export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled, + TraditionalPagingEnabled, OptionalTeamAssignable { + /** + * @description End of time range of logs to include in results (inclusive) as a UNIX timestamp in seconds. + * Default to now. + */ + before?: number; +} +// https://api.slack.com/methods/team.billableInfo +export interface TeamBillableInfoArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { + /** @description A user to retrieve the billable information for. Defaults to all users. */ + user?: string; +} +// https://api.slack.com/methods/team.billing.info +export interface TeamBillingInfoArguments extends TokenOverridable {} +// https://api.slack.com/methods/team.info +export interface TeamInfoArguments extends TokenOverridable { + /** + * @description Query by domain instead of team (only when `team` is null). This only works for domains in the same + * enterprise as the querying team token. + * This also expects the domain to belong to a team and not the enterprise itself. + */ + domain?: string; // available only for Enterprise Grid + /** @description Team to get info about; if omitted, will return information about the current team. */ + team?: string; +} +// https://api.slack.com/methods/team.integrationLogs +export interface TeamIntegrationLogsArguments extends TokenOverridable, + OptionalTeamAssignable, TraditionalPagingEnabled { + /** @description Filter logs to this Slack app. Defaults to all logs. */ + app_id?: string; + /** @description Filter logs with this change type. Defaults to all logs. */ + change_type?: 'added' | 'removed' | 'enabled' | 'disabled' | 'updated'; + /** @description Filter logs to this service. Defaults to all logs. */ + service_id?: string; + /** @description Filter logs generated by this user’s actions. Defaults to all logs. */ + user?: string; +} +// https://api.slack.com/methods/team.profile.get +export interface TeamProfileGetArguments extends TokenOverridable { + /** @description Filter by visibility. */ + visibility?: 'all' | 'visible' | 'hidden'; +} +// https://api.slack.com/methods/team.preferences.list +export interface TeamPreferencesListArguments extends TokenOverridable { } From fa547db8a6df14c7796d6465acfd6c8aba7103d4 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 30 Oct 2023 17:11:19 -0400 Subject: [PATCH 048/122] Split out stars.* API arguments into own file and refactor. Document stars.* API methods. --- packages/web-api/src/methods.ts | 57 +++++++++------------ packages/web-api/src/types/request/stars.ts | 33 ++++++++++++ 2 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 packages/web-api/src/types/request/stars.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index c2122db91..a5005a345 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -239,6 +239,7 @@ import type { UsersConversationsArguments, UsersInfoArguments, UsersListArgument import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './types/request/usergroups'; import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './types/request/team'; +import type { StarsAddRemoveArguments, StarsListArguments } from './types/request/stars'; /** * Generic method definition @@ -812,12 +813,6 @@ export abstract class Methods extends EventEmitter { messages: bindApiCall(this, 'search.messages'), }; - public readonly stars = { - add: bindApiCall(this, 'stars.add'), - list: bindApiCall(this, 'stars.list'), - remove: bindApiCall(this, 'stars.remove'), - }; - public readonly team = { /** * @description Gets the access logs for the current team. @@ -994,9 +989,31 @@ export abstract class Methods extends EventEmitter { // ------------------ // Deprecated methods + // ------------------ // TODO: breaking changes for future majors: + // - stars.* methods are marked as deprecated; once Later has APIs, these will see an official sunsetting timeline // - workflows.* methods, Sep 12 2024: https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back - // ------------------ + + public readonly stars = { + /** + * @description Save an item for later. Formerly known as adding a star. + * @deprecated + * @see {@link https://api.slack.com/methods/stars.add `stars.add` API reference}. + */ + add: bindApiCall(this, 'stars.add'), + /** + * @description List a user's saved items, formerly known as stars. + * @deprecated + * @see {@link https://api.slack.com/methods/stars.list `stars.list` API reference}. + */ + list: bindApiCall(this, 'stars.list'), + /** + * @description Remove a saved item from a user's saved items, formerly known as stars. + * @deprecated + * @see {@link https://api.slack.com/methods/stars.remove `stars.remove` API reference}. + */ + remove: bindApiCall(this, 'stars.remove'), + }; public readonly workflows = { /** @@ -2332,30 +2349,4 @@ export interface RTMStartArguments extends TokenOverridable, LocaleAware { simple_latest?: boolean; } -// TODO: usage info for stars.add recommends retiring use of any stars APIs -// https://api.slack.com/methods/stars.add#markdown -// should we mark these methods as deprecated? -/* - * `stars.*` - */ -// https://api.slack.com/methods/stars.add -export interface StarsAddArguments extends TokenOverridable { - // TODO: breaking change: must supply one of: - channel?: string; // optionally paired with `timestamp` - timestamp?: string; // paired with `channel` - file?: string; // file id - file_comment?: string; // file comment id -} -// https://api.slack.com/methods/stars.list -export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, - CursorPaginationEnabled, OptionalTeamAssignable { } -// https://api.slack.com/methods/stars.remove -export interface StarsRemoveArguments extends TokenOverridable { - // TODO: breaking change: must supply one of: - channel?: string; // optionally paired with `timestamp` - timestamp?: string; // paired with `channel` - file?: string; // file id - file_comment?: string; // file comment id -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/stars.ts b/packages/web-api/src/types/request/stars.ts new file mode 100644 index 000000000..07e1ba910 --- /dev/null +++ b/packages/web-api/src/types/request/stars.ts @@ -0,0 +1,33 @@ +import { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; + +// TODO: usage info for stars.add recommends retiring use of any stars APIs: https://api.slack.com/methods/stars.add#markdown + +/** @description When starring something, it can be starred _to_ a channel. */ +interface StarsChannelDestination { + /** @description Encoded channel ID the star belongs to. */ + channel: string; +} +/** @description Messages can be starred. */ +interface StarsMessageArgument { + /** @description Encoded channel ID housing the message. */ + channel: string; + /** @description Timestamp of the message. */ + timestamp: string; +} +/** @description Files can be starred. */ +interface StarsFileArgument { + /** @description Encoded file ID. */ + file: string; +} +/** @description File comments can be starred. */ +interface StarsFileCommentArgument { + /** @description Encoded file comment ID. */ + file_comment: string; +} + +// https://api.slack.com/methods/stars.add & https://api.slack.com/methods/stars.remove +export type StarsAddRemoveArguments = TokenOverridable & +(StarsChannelDestination | StarsMessageArgument | StarsFileArgument | StarsFileCommentArgument); +// https://api.slack.com/methods/stars.list +export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, + CursorPaginationEnabled, OptionalTeamAssignable { } From 08b4d0fb9d7d4f60608f75302b7997bc31d3337e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 30 Oct 2023 17:30:47 -0400 Subject: [PATCH 049/122] Split out rtm.* API arguments into own file and refactor. Document rtm.* API methods, mark `connect` as deprecated. --- packages/web-api/src/methods.ts | 28 ++++++++-------------- packages/web-api/src/types/request/rtm.ts | 29 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 packages/web-api/src/types/request/rtm.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index a5005a345..eba113934 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -240,6 +240,7 @@ import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './types/request/usergroups'; import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './types/request/team'; import type { StarsAddRemoveArguments, StarsListArguments } from './types/request/stars'; +import type { RTMConnectArguments, RTMStartArguments } from './types/request/rtm'; /** * Generic method definition @@ -791,7 +792,16 @@ export abstract class Methods extends EventEmitter { }; public readonly rtm = { + /** + * @description Starts a Real Time Messaging session. + * @see {@link https://api.slack.com/methods/rtm.connect `rtm.connect` API reference}. + */ connect: bindApiCall(this, 'rtm.connect'), + /** + * @description Starts a Real Time Messaging session. + * @deprecated Use `rtm.connect` instead. + * @see {@link https://api.slack.com/methods/rtm.start `rtm.start` API reference}. + */ start: bindApiCall(this, 'rtm.start'), }; @@ -2331,22 +2341,4 @@ export interface RemindersInfoArguments extends TokenOverridable, OptionalTeamAs // https://api.slack.com/methods/reminders.list export interface RemindersListArguments extends TokenOverridable, OptionalTeamAssignable { } -/* - * `rtm.*` - */ -// https://api.slack.com/methods/rtm.connect -export interface RTMConnectArguments extends TokenOverridable { - batch_presence_aware?: boolean; - presence_sub?: boolean; -} -// https://api.slack.com/methods/rtm.start -export interface RTMStartArguments extends TokenOverridable, LocaleAware { - batch_presence_aware?: boolean; - mpim_aware?: boolean; - no_latest?: '0' | '1'; - no_unreads?: string; // TODO: docs say this is a boolean - presence_sub?: boolean; - simple_latest?: boolean; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/rtm.ts b/packages/web-api/src/types/request/rtm.ts new file mode 100644 index 000000000..2cb243e7b --- /dev/null +++ b/packages/web-api/src/types/request/rtm.ts @@ -0,0 +1,29 @@ +import { LocaleAware, TokenOverridable } from './common'; + +// https://api.slack.com/methods/rtm.connect +export interface RTMConnectArguments extends TokenOverridable { + /** + * @description Batch presence deliveries via subscription. Enabling changes the shape of `presence_change` events. + * @see {@link https://api.slack.com/docs/presence-and-status#batching batch presence}. + */ + batch_presence_aware?: boolean; + /** + * @description Only deliver presence events when requested by subscription. + * @see {@link Only deliver presence events when requested by subscription. presence subscriptions}. + */ + presence_sub?: boolean; +} +// https://api.slack.com/methods/rtm.start +export interface RTMStartArguments extends RTMConnectArguments, LocaleAware { + /** @description Returns MPIMs to the client in the API response. */ + mpim_aware?: boolean; + /** + * @description Exclude latest timestamps for channels, groups, mpims, and ims. + * Automatically sets `no_unreads` to `true`. + */ + no_latest?: boolean; + /** @description Skip unread counts for each channel (improves performance). */ + no_unreads?: boolean; + /** @description Return timestamp only for latest message object of each channel (improves performance). */ + simple_latest?: boolean; +} From b7749a50d7b3210a769b4df28dab77b2c3e55caa Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 14:22:26 -0400 Subject: [PATCH 050/122] Split out reminders.* API arguments into own file. Document reminder API methods. --- packages/web-api/src/methods.ts | 55 +++++++------------ .../web-api/src/types/request/reminders.ts | 54 ++++++++++++++++++ 2 files changed, 75 insertions(+), 34 deletions(-) create mode 100644 packages/web-api/src/types/request/reminders.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index eba113934..9ea570fde 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -241,6 +241,7 @@ import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsE import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './types/request/team'; import type { StarsAddRemoveArguments, StarsListArguments } from './types/request/stars'; import type { RTMConnectArguments, RTMStartArguments } from './types/request/rtm'; +import type { RemindersAddArguments, RemindersInfoArguments, RemindersListArguments, RemindersDeleteArguments, RemindersCompleteArguments } from './types/request/reminders'; /** * Generic method definition @@ -784,10 +785,30 @@ export abstract class Methods extends EventEmitter { }; public readonly reminders = { + /** + * @description Creates a reminder. + * @see {@link https://api.slack.com/methods/reminders.add `reminders.add` API reference}. + */ add: bindApiCall(this, 'reminders.add'), + /** + * @description Marks a reminder as complete. + * @see {@link https://api.slack.com/methods/reminders.complete `reminders.complete` API reference}. + */ complete: bindApiCall(this, 'reminders.complete'), + /** + * @description Deletes a reminder. + * @see {@link https://api.slack.com/methods/reminders.delete `reminders.delete` API reference}. + */ delete: bindApiCall(this, 'reminders.delete'), + /** + * @description Gets information about a reminder. + * @see {@link https://api.slack.com/methods/reminders.info `reminders.info` API reference}. + */ info: bindApiCall(this, 'reminders.info'), + /** + * @description Lists all reminders created by or for a given user. + * @see {@link https://api.slack.com/methods/reminders.list `reminders.list` API reference}. + */ list: bindApiCall(this, 'reminders.list'), }; @@ -2307,38 +2328,4 @@ export interface ReactionsRemoveArguments extends TokenOverridable { file_comment?: string; } -/* - * `reminders.*` - */ -interface ReminderRecurrenceDailyMonthlyYearly { - frequency: 'daily' | 'monthly' | 'yearly'; -} -type DaysOfTheWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'; -interface ReminderRecurrenceWeekly { - frequency: 'weekly'; - weekdays: [DaysOfTheWeek, ...DaysOfTheWeek[]] -} -type ReminderRecurrence = ReminderRecurrenceWeekly | ReminderRecurrenceDailyMonthlyYearly; -// https://api.slack.com/methods/reminders.add -export interface RemindersAddArguments extends TokenOverridable, OptionalTeamAssignable { - text: string; - time: string | number; - user?: string; - recurrence?: ReminderRecurrence; -} -// https://api.slack.com/methods/reminders.complete -export interface RemindersCompleteArguments extends TokenOverridable, OptionalTeamAssignable { - reminder: string; -} -// https://api.slack.com/methods/reminders.delete -export interface RemindersDeleteArguments extends TokenOverridable, OptionalTeamAssignable { - reminder: string; -} -// https://api.slack.com/methods/reminders.info -export interface RemindersInfoArguments extends TokenOverridable, OptionalTeamAssignable { - reminder: string; -} -// https://api.slack.com/methods/reminders.list -export interface RemindersListArguments extends TokenOverridable, OptionalTeamAssignable { } - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/reminders.ts b/packages/web-api/src/types/request/reminders.ts new file mode 100644 index 000000000..db71a40c0 --- /dev/null +++ b/packages/web-api/src/types/request/reminders.ts @@ -0,0 +1,54 @@ +import { OptionalTeamAssignable, TokenOverridable } from './common'; + +interface ReminderRecurrenceDailyMonthlyYearly { + /** @description Specifies the repeating behavior of a reminder. */ + frequency: 'daily' | 'monthly' | 'yearly'; +} +type DaysOfTheWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'; +interface ReminderRecurrenceWeekly { + /** @description Specifies the repeating behavior of a reminder. */ + frequency: 'weekly'; + /** @description Specifies the day-of-the-week repeating behaviour when `frequency` is set to `weekly`. */ + weekdays: [DaysOfTheWeek, ...DaysOfTheWeek[]] +} +type ReminderRecurrence = ReminderRecurrenceWeekly | ReminderRecurrenceDailyMonthlyYearly; +// https://api.slack.com/methods/reminders.add +export interface RemindersAddArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description The content of the reminder. */ + text: string; + /** + * @description When this reminder should happen, one of: + * - the Unix timestamp (up to five years from now), + * - the number of seconds until the reminder (if within 24 hours), or + * - a natural language description (Ex. "in 15 minutes," or "every Thursday"). + */ + time: string | number; + /** + * @description No longer supported - reminders cannot be set for other users. + * @deprecated + * @see {@link https://api.slack.com/changelog/2023-07-its-later-already-for-stars-and-reminders#what Changes to `reminders.*` APIs announcement}. + */ + user?: string; + /** + * @description Specify the repeating behavior of a reminder. If you set the sub-property `frequency` to `weekly`, + * you must also set the `weekdays` array to specify which days of the week to recur on. + */ + recurrence?: ReminderRecurrence; +} +// https://api.slack.com/methods/reminders.complete +export interface RemindersCompleteArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description The ID of the reminder to be marked as complete. */ + reminder: string; +} +// https://api.slack.com/methods/reminders.delete +export interface RemindersDeleteArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description The ID of the reminder to delete. */ + reminder: string; +} +// https://api.slack.com/methods/reminders.info +export interface RemindersInfoArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description The ID of the reminder to retrieve information about. */ + reminder: string; +} +// https://api.slack.com/methods/reminders.list +export interface RemindersListArguments extends TokenOverridable, OptionalTeamAssignable { } From 896edd427523174f86d8602ea6bac0d7b716b748 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 14:42:41 -0400 Subject: [PATCH 051/122] Bump `@slack/types` dev dependencies to fix the build. --- packages/types/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/types/package.json b/packages/types/package.json index c3a4eeaee..184e38962 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -36,14 +36,14 @@ "ref-docs:model": "api-extractor run" }, "devDependencies": { - "@microsoft/api-extractor": "^7.3.4", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.0", - "eslint": "^7.32.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-config-airbnb-typescript": "^12.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.6.1", + "@microsoft/api-extractor": "^7.38.0", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.0", + "eslint": "^8.47.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsdoc": "^46.5.0", "eslint-plugin-node": "^11.1.0", "shx": "^0.3.2", "typescript": "^4.1.0" From 7a0724f61e81c10a0cde8e4e825e9ffeef27e0f9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 15:25:25 -0400 Subject: [PATCH 052/122] Factor message/file/file-comment arguments into common.ts for easy re-use. Document reactions.* APIs. Split out reactions.* arguments into own file. --- packages/web-api/src/methods.ts | 55 +++++++------------ packages/web-api/src/types/request/common.ts | 31 ++++++++++- .../web-api/src/types/request/reactions.ts | 25 +++++++++ packages/web-api/src/types/request/stars.ts | 24 +------- 4 files changed, 75 insertions(+), 60 deletions(-) create mode 100644 packages/web-api/src/types/request/reactions.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 9ea570fde..6caf51b30 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -242,6 +242,7 @@ import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInf import type { StarsAddRemoveArguments, StarsListArguments } from './types/request/stars'; import type { RTMConnectArguments, RTMStartArguments } from './types/request/rtm'; import type { RemindersAddArguments, RemindersInfoArguments, RemindersListArguments, RemindersDeleteArguments, RemindersCompleteArguments } from './types/request/reminders'; +import type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArguments, ReactionsRemoveArguments } from './types/request/reactions'; /** * Generic method definition @@ -778,12 +779,30 @@ export abstract class Methods extends EventEmitter { }; public readonly reactions = { + /** + * @description Adds a reaction to an item. + * @see {@link https://api.slack.com/methods/reactions.add `reactions.add` API reference}. + */ add: bindApiCall(this, 'reactions.add'), + /** + * @description Gets reactions for an item. + * @see {@link https://api.slack.com/methods/reactions.get `reactions.get` API reference}. + */ get: bindApiCall(this, 'reactions.get'), + /** + * @description List reactions made by a user. + * @see {@link https://api.slack.com/methods/reactions.list `reactions.list` API reference}. + */ list: bindApiCall(this, 'reactions.list'), + /** + * @description Removes a reaction from an item. + * @see {@link https://api.slack.com/methods/reactions.remove `reactions.remove` API reference}. + */ remove: bindApiCall(this, 'reactions.remove'), }; + // TODO: keep tabs on reminders APIs, may be deprecated once Later list APIs land + // See: https://api.slack.com/changelog/2023-07-its-later-already-for-stars-and-reminders public readonly reminders = { /** * @description Creates a reminder. @@ -2292,40 +2311,4 @@ export interface PinsRemoveArguments extends TokenOverridable { timestamp: string; } -/* - * `reactions.*` - */ -// https://api.slack.com/methods/reactions.add -export interface ReactionsAddArguments extends TokenOverridable { - name: string; - channel: string; - timestamp: string; -} -// TODO: must supply either channel and timestamp or a file id or file comment id -// https://api.slack.com/methods/reactions.get -export interface ReactionsGetArguments extends TokenOverridable { - full?: boolean; - // must supply one of: - channel?: string; // paired with timestamp - timestamp?: string; // paired with channel - file?: string; // file id - file_comment?: string; -} -// https://api.slack.com/methods/reactions.list -export interface ReactionsListArguments extends TokenOverridable, TraditionalPagingEnabled, - CursorPaginationEnabled, OptionalTeamAssignable { - user?: string; - full?: boolean; -} -// TODO: must supply either channel and timestamp or a file id or file comment id -// https://api.slack.com/methods/reactions.remove -export interface ReactionsRemoveArguments extends TokenOverridable { - name: string; - // must supply one of: - channel?: string; // paired with timestamp - timestamp?: string; // paired with channel - file?: string; // file id - file_comment?: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index e535d2674..43c121a16 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -1,7 +1,6 @@ -// Reusable mixins or extensions that some Method Arguments types can extend from +// Reusable mixins or extensions that Method Arguments types can extend from // Cursor, timeline and traditional pagination extensions. - export interface CursorPaginationEnabled { /** * @description The maximum number of items to return. Fewer than the requested number of items may be returned, @@ -18,8 +17,14 @@ export interface CursorPaginationEnabled { } export interface TimelinePaginationEnabled { + /** @description Only messages after this Unix timestamp will be included in results. */ oldest?: string; + /** @description Only messages before this Unix timestamp will be included in results. */ latest?: string; + /** + * @description Include messages with `oldest` or `latest` timestamps in results. + * Ignored unless either timestamp is specified. Defaults to `false`. + */ inclusive?: boolean; } @@ -53,3 +58,25 @@ export interface OptionalTeamAssignable { /** @description If using an org token, `team_id` is required. */ team_id?: string; } + +/** + * Some API methods use arguments for specifying a message, file or file comment. + * E.g. `stars.*` and `reactions.*` + */ + +export interface MessageArgument { + /** @description Channel where the message was posted. */ + channel: string; + /** @description Timestamp of the message. */ + timestamp: string; +} + +export interface FileArgument { + /** @description Encoded file ID reacted to. */ + file: string; +} + +export interface FileCommentArgument { + /** @description Encoded file comment ID reacted to. */ + file_comment: string; +} diff --git a/packages/web-api/src/types/request/reactions.ts b/packages/web-api/src/types/request/reactions.ts new file mode 100644 index 000000000..da2c21ea3 --- /dev/null +++ b/packages/web-api/src/types/request/reactions.ts @@ -0,0 +1,25 @@ +import { CursorPaginationEnabled, FileArgument, FileCommentArgument, MessageArgument, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; + +interface ReactionsFull { + /** @description If `true`, return the complete reaction list. */ + full?: boolean; +} +interface ReactionName { + /** @description Reaction (emoji) name. */ + name: string; +} +// https://api.slack.com/methods/reactions.add +export interface ReactionsAddArguments extends MessageArgument, TokenOverridable, ReactionName {} +// https://api.slack.com/methods/reactions.get +export type ReactionsGetArguments = ReactionsFull & TokenOverridable & +(MessageArgument | FileArgument | FileCommentArgument); + +// https://api.slack.com/methods/reactions.list +export interface ReactionsListArguments extends ReactionsFull, TokenOverridable, TraditionalPagingEnabled, + CursorPaginationEnabled, OptionalTeamAssignable { + /** @description Show reactions made by this user. Defaults to the authed user. */ + user?: string; +} +// https://api.slack.com/methods/reactions.remove +export type ReactionsRemoveArguments = TokenOverridable & ReactionName & +(MessageArgument | FileArgument | FileCommentArgument); diff --git a/packages/web-api/src/types/request/stars.ts b/packages/web-api/src/types/request/stars.ts index 07e1ba910..6138b557b 100644 --- a/packages/web-api/src/types/request/stars.ts +++ b/packages/web-api/src/types/request/stars.ts @@ -1,33 +1,13 @@ -import { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; - -// TODO: usage info for stars.add recommends retiring use of any stars APIs: https://api.slack.com/methods/stars.add#markdown +import { CursorPaginationEnabled, FileCommentArgument, FileArgument, MessageArgument, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; /** @description When starring something, it can be starred _to_ a channel. */ interface StarsChannelDestination { /** @description Encoded channel ID the star belongs to. */ channel: string; } -/** @description Messages can be starred. */ -interface StarsMessageArgument { - /** @description Encoded channel ID housing the message. */ - channel: string; - /** @description Timestamp of the message. */ - timestamp: string; -} -/** @description Files can be starred. */ -interface StarsFileArgument { - /** @description Encoded file ID. */ - file: string; -} -/** @description File comments can be starred. */ -interface StarsFileCommentArgument { - /** @description Encoded file comment ID. */ - file_comment: string; -} - // https://api.slack.com/methods/stars.add & https://api.slack.com/methods/stars.remove export type StarsAddRemoveArguments = TokenOverridable & -(StarsChannelDestination | StarsMessageArgument | StarsFileArgument | StarsFileCommentArgument); +(StarsChannelDestination | MessageArgument | FileArgument | FileCommentArgument); // https://api.slack.com/methods/stars.list export interface StarsListArguments extends TokenOverridable, TraditionalPagingEnabled, CursorPaginationEnabled, OptionalTeamAssignable { } From a52a5ce7c701b540fd169e5229ed4e1ca4d74145 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 15:36:18 -0400 Subject: [PATCH 053/122] Bump `@slack/rtm-api` dev dependencies to fix the build and fix eslint errors. --- packages/rtm-api/package.json | 16 ++++++++-------- packages/rtm-api/src/KeepAlive.ts | 1 + packages/rtm-api/src/RTMClient.ts | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/rtm-api/package.json b/packages/rtm-api/package.json index c857157e3..f401b9ae5 100644 --- a/packages/rtm-api/package.json +++ b/packages/rtm-api/package.json @@ -54,14 +54,14 @@ "ws": "^7.5.3" }, "devDependencies": { - "@microsoft/api-extractor": "^7.3.4", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.0", - "eslint": "^7.32.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-config-airbnb-typescript": "^12.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.6.1", + "@microsoft/api-extractor": "^7.38.0", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.0", + "eslint": "^8.47.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsdoc": "^46.5.0", "eslint-plugin-node": "^11.1.0", "shx": "^0.3.2", "typescript": "^4.1.0" diff --git a/packages/rtm-api/src/KeepAlive.ts b/packages/rtm-api/src/KeepAlive.ts index 079ce46fa..6c043e0e6 100644 --- a/packages/rtm-api/src/KeepAlive.ts +++ b/packages/rtm-api/src/KeepAlive.ts @@ -219,6 +219,7 @@ export class KeepAlive extends EventEmitter { .catch((error) => { this.logger.error(`Unhandled error: ${error.message}. Please report to @slack/rtm-api package maintainers.`); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { this.logger.error(`Unhandled error: ${error.message}. Please report to @slack/rtm-api package maintainers.`); } diff --git a/packages/rtm-api/src/RTMClient.ts b/packages/rtm-api/src/RTMClient.ts index 8e901c9b6..0a52a05b7 100644 --- a/packages/rtm-api/src/RTMClient.ts +++ b/packages/rtm-api/src/RTMClient.ts @@ -483,7 +483,6 @@ export class RTMClient extends EventEmitter { * * If the awaitReply parameter is set to false, then the returned Promise is resolved as soon as the message is sent * from the websocket. - * * @param awaitReply - whether to wait for an acknowledgement response from the platform before resolving the returned * Promise. * @param type - the message type @@ -628,6 +627,7 @@ export class RTMClient extends EventEmitter { let event; try { event = JSON.parse(data); + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (parseError: any) { // prevent application from crashing on a bad message, but log an error to bring attention this.logger.error( From 753d15dca351ac03f242173807e55263d0248fbb Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 15:42:54 -0400 Subject: [PATCH 054/122] Bump `@slack/socket-mode` dev dependencies to fix the build and fix eslint errors. --- packages/socket-mode/package.json | 30 ++++++++++---------- packages/socket-mode/src/SocketModeClient.ts | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/socket-mode/package.json b/packages/socket-mode/package.json index 2858823b0..b8dab2b1f 100644 --- a/packages/socket-mode/package.json +++ b/packages/socket-mode/package.json @@ -56,23 +56,23 @@ "ws": "^7.5.3" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.0", - "@types/chai": "^4.1.7", - "@types/mocha": "^5.2.6", - "chai": "^4.2.0", - "eslint": "^7.32.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-config-airbnb-typescript": "^12.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.6.1", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "chai": "^4.3.8", + "eslint": "^8.47.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsdoc": "^46.5.0", "eslint-plugin-node": "^11.1.0", - "mocha": "^9.1.0", - "nyc": "^14.1.1", + "mocha": "^10.2.0", + "nyc": "^15.1.0", "shx": "^0.3.2", - "ts-node": "^8.2.0", - "sinon": "^7.3.2", - "source-map-support": "^0.5.12", + "sinon": "^15.2.0", + "source-map-support": "^0.5.21", + "ts-node": "^10.8.1", "typescript": "^4.1.0" } } diff --git a/packages/socket-mode/src/SocketModeClient.ts b/packages/socket-mode/src/SocketModeClient.ts index ede1d6d24..b3af15a11 100644 --- a/packages/socket-mode/src/SocketModeClient.ts +++ b/packages/socket-mode/src/SocketModeClient.ts @@ -189,8 +189,8 @@ export class SocketModeClient extends EventEmitter { private numOfConsecutiveReconnectionFailures: number = 0; /* eslint-disable @typescript-eslint/indent, newline-per-chained-call */ - private connectingStateMachineConfig: Configuration - = Finity.configure() + private connectingStateMachineConfig: Configuration = Finity + .configure() .global() .onStateEnter((state) => { this.logger.debug(`Transitioning to state: ${State.Connecting}:${state}`); From 53c00342ec7f4043caa8c4914632b0aa17709036 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 16:07:36 -0400 Subject: [PATCH 055/122] Bump `@slack/oauth` dev dependencies to fix the build and fix eslint errors. --- packages/oauth/package.json | 34 ++++++++++++-------------- packages/oauth/src/callback-options.ts | 2 ++ packages/oauth/src/install-provider.ts | 4 +-- packages/web-api/package.json | 1 + 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/packages/oauth/package.json b/packages/oauth/package.json index 607ed1721..261b8de87 100644 --- a/packages/oauth/package.json +++ b/packages/oauth/package.json @@ -34,7 +34,6 @@ "lint": "eslint --fix --ext .ts src", "test": "npm run lint && npm run test:mocha", "test:mocha": "nyc mocha --config .mocharc.json src/*.spec.js src/**/*.spec.js src/*.spec.ts src/**/*.spec.ts", - "coverage": "codecov -F oauthhelper --root=$PWD", "ref-docs:model": "api-extractor run", "watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build" }, @@ -47,29 +46,28 @@ "lodash.isstring": "^4.0.1" }, "devDependencies": { - "@microsoft/api-extractor": "^7.19.4", - "@types/chai": "^4.2.11", - "@types/mocha": "^9.1.0", - "@types/sinon": "^10.0.11", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.0", - "chai": "^4.2.0", - "codecov": "^3.0.4", - "eslint": "^7.32.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-config-airbnb-typescript": "^12.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.6.1", + "@microsoft/api-extractor": "^7.38.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.20", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.0", + "chai": "^4.3.8", + "eslint": "^8.47.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsdoc": "^46.5.0", "eslint-plugin-node": "^11.1.0", - "mocha": "^9.2.1", + "mocha": "^10.2.0", "nop": "^1.0.0", "nyc": "^15.1.0", "rewiremock": "^3.13.9", "shx": "^0.3.2", - "sinon": "^9.0.2", - "source-map-support": "^0.5.12", + "sinon": "^15.2.0", + "source-map-support": "^0.5.21", "superagent": "^3.3.1", - "ts-node": "^8.2.0", + "ts-node": "^10.8.1", "typescript": "^4.1", "uncaughtException": "^1.0.0" } diff --git a/packages/oauth/src/callback-options.ts b/packages/oauth/src/callback-options.ts index a061edc9b..a37968bf0 100644 --- a/packages/oauth/src/callback-options.ts +++ b/packages/oauth/src/callback-options.ts @@ -118,6 +118,7 @@ export function defaultCallbackSuccess(

Redirecting to the Slack App... click here. If you use the browser version of Slack, click this link instead.

`; + // eslint-disable-next-line @typescript-eslint/naming-convention res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.end(htmlResponse); } @@ -139,6 +140,7 @@ export function defaultCallbackFailure( default: httpStatus = 500; } + // eslint-disable-next-line @typescript-eslint/naming-convention res.writeHead(httpStatus, { 'Content-Type': 'text/html; charset=utf-8' }); const html = ` diff --git a/packages/oauth/src/install-provider.ts b/packages/oauth/src/install-provider.ts index 206a7f37c..7975508f3 100644 --- a/packages/oauth/src/install-provider.ts +++ b/packages/oauth/src/install-provider.ts @@ -677,9 +677,7 @@ export class InstallProvider { // End: Build the installation object if (options?.afterInstallation !== undefined) { - shouldProceed = await options.afterInstallation( - installation, installOptions, req, res, - ); + shouldProceed = await options.afterInstallation(installation, installOptions, req, res); } if (!shouldProceed) { // When options.beforeInstallation returns false, diff --git a/packages/web-api/package.json b/packages/web-api/package.json index fc92bf02c..e584d17d6 100644 --- a/packages/web-api/package.json +++ b/packages/web-api/package.json @@ -62,6 +62,7 @@ "@microsoft/api-extractor": "^7.38.0", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.20", "@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/parser": "^6.4.0", "busboy": "^1.6.0", From 5a5cdb1f5f3a6f0e216966b4f18e62450f9cba83 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 16:26:15 -0400 Subject: [PATCH 056/122] Split out pins.* API arguments into own file. Document pin API methods. --- packages/web-api/src/methods.ts | 32 +++++++++------------- packages/web-api/src/types/request/pins.ts | 11 ++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 packages/web-api/src/types/request/pins.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 6caf51b30..5883de13b 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -243,6 +243,7 @@ import type { StarsAddRemoveArguments, StarsListArguments } from './types/reques import type { RTMConnectArguments, RTMStartArguments } from './types/request/rtm'; import type { RemindersAddArguments, RemindersInfoArguments, RemindersListArguments, RemindersDeleteArguments, RemindersCompleteArguments } from './types/request/reminders'; import type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArguments, ReactionsRemoveArguments } from './types/request/reactions'; +import type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from './types/request/pins'; /** * Generic method definition @@ -773,8 +774,20 @@ export abstract class Methods extends EventEmitter { }; public readonly pins = { + /** + * @description Pins an item to a channel. + * @see {@link https://api.slack.com/methods/pins.add `pins.add` API reference}. + */ add: bindApiCall(this, 'pins.add'), + /** + * @description Lists items pinned to a channel. + * @see {@link https://api.slack.com/methods/pins.list `pins.list` API reference}. + */ list: bindApiCall(this, 'pins.list'), + /** + * @description Un-pins an item from a channel. + * @see {@link https://api.slack.com/methods/pins.remove `pins.remove` API reference}. + */ remove: bindApiCall(this, 'pins.remove'), }; @@ -2292,23 +2305,4 @@ export interface OpenIDConnectTokenArguments { export interface OpenIDConnectUserInfoArguments { } -/* - * `pins.*` - */ -// TODO: there's a quip_component_id parameter documented publicly but probably we shouldnt expose just yet -// https://api.slack.com/methods/pins.add -export interface PinsAddArguments extends TokenOverridable { - channel: string; - timestamp: string; -} -// https://api.slack.com/methods/pins.list -export interface PinsListArguments extends TokenOverridable { - channel: string; -} -// https://api.slack.com/methods/pins.remove -export interface PinsRemoveArguments extends TokenOverridable { - channel: string; - timestamp: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/pins.ts b/packages/web-api/src/types/request/pins.ts new file mode 100644 index 000000000..721667141 --- /dev/null +++ b/packages/web-api/src/types/request/pins.ts @@ -0,0 +1,11 @@ +import { MessageArgument, TokenOverridable } from './common'; + +// https://api.slack.com/methods/pins.add +export interface PinsAddArguments extends MessageArgument, TokenOverridable {} +// https://api.slack.com/methods/pins.list +export interface PinsListArguments extends TokenOverridable { + /** @description Channel to get pinned items for. */ + channel: string; +} +// https://api.slack.com/methods/pins.remove +export interface PinsRemoveArguments extends MessageArgument, TokenOverridable {} From 11c69d253e210c9b283eb03a9865411df8102dee Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 16:44:34 -0400 Subject: [PATCH 057/122] Split out openid.* API arguments into own file. Document openid API methods. --- packages/web-api/src/methods.ts | 26 +++++++------------- packages/web-api/src/types/request/openid.ts | 21 ++++++++++++++++ 2 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 packages/web-api/src/types/request/openid.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 5883de13b..33cb10002 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -244,6 +244,7 @@ import type { RTMConnectArguments, RTMStartArguments } from './types/request/rtm import type { RemindersAddArguments, RemindersInfoArguments, RemindersListArguments, RemindersDeleteArguments, RemindersCompleteArguments } from './types/request/reminders'; import type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArguments, ReactionsRemoveArguments } from './types/request/reactions'; import type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from './types/request/pins'; +import type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from './types/request/openid'; /** * Generic method definition @@ -768,7 +769,15 @@ export abstract class Methods extends EventEmitter { public readonly openid = { connect: { + /** + * @description Exchanges a temporary OAuth verifier code for an access token for {@link https://api.slack.com/authentication/sign-in-with-slack Sign in with Slack}. + * @see {@link https://api.slack.com/methods/openid.connect.token `openid.connect.token` API reference}. + */ token: bindApiCall(this, 'openid.connect.token'), + /** + * @description Get the identity of a user who has authorized {@link https://api.slack.com/authentication/sign-in-with-slack Sign in with Slack}. + * @see {@link https://api.slack.com/methods/openid.connect.userInfo `openid.connect.userInfo` API reference}. + */ userInfo: bindApiCall(this, 'openid.connect.userInfo'), }, }; @@ -2288,21 +2297,4 @@ export interface OAuthV2ExchangeArguments { client_secret: string; } -/* - * `openid.connect.*` - */ -// https://api.slack.com/methods/openid.connect.token -export interface OpenIDConnectTokenArguments { - client_id: string; // TODO: docs state this is optional - client_secret: string; // TODO: docs state this is optional - code?: string; - redirect_uri?: string; - grant_type?: 'authorization_code' | 'refresh_token'; - refresh_token?: string; -} -// https://api.slack.com/methods/openid.connect.userInfo -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface OpenIDConnectUserInfoArguments { -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/openid.ts b/packages/web-api/src/types/request/openid.ts new file mode 100644 index 000000000..a0eff957f --- /dev/null +++ b/packages/web-api/src/types/request/openid.ts @@ -0,0 +1,21 @@ +// https://api.slack.com/methods/openid.connect.token +export interface OpenIDConnectTokenArguments { + /** @description Issued when you created your application. */ + client_id: string; + /** @description Issued when you created your application. */ + client_secret: string; + /** @description The `code` parameter returned via the OAuth callback. */ + code?: string; + /** + * @description If you set a redirect URI when you created your application, + * this property is NOT optional and must match the originally submitted URI. + */ + redirect_uri?: string; + /** @description The `grant_type` param as described in the OAuth spec. */ + grant_type?: 'authorization_code' | 'refresh_token'; + /** @description The `refresh_token` param as described in the OAuth spec. */ + refresh_token?: string; +} +// https://api.slack.com/methods/openid.connect.userInfo +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface OpenIDConnectUserInfoArguments {} From 0e24e848d7988fb2467f9071317cd66a29ad2f3e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 17:30:38 -0400 Subject: [PATCH 058/122] Factor out common OAuth/OpenID arguments into common.ts. Add descriptions to `@deprecated` JSdoc tags for additional context. Document oauth.* methods and split out their arguments into own file. --- packages/web-api/src/methods.ts | 64 +++++++++----------- packages/web-api/src/types/request/common.ts | 26 ++++++++ packages/web-api/src/types/request/oauth.ts | 11 ++++ packages/web-api/src/types/request/openid.ts | 20 +----- 4 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 packages/web-api/src/types/request/oauth.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 33cb10002..1a31c04bf 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -245,6 +245,7 @@ import type { RemindersAddArguments, RemindersInfoArguments, RemindersListArgume import type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArguments, ReactionsRemoveArguments } from './types/request/reactions'; import type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from './types/request/pins'; import type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from './types/request/openid'; +import type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArguments } from './types/request/oauth'; /** * Generic method definition @@ -760,9 +761,22 @@ export abstract class Methods extends EventEmitter { }; public readonly oauth = { + /** + * @description Exchanges a temporary OAuth verifier code for an access token. + * @deprecated This is a legacy method only used by classic Slack apps. Use `oauth.v2.access` for new Slack apps. + * @see {@link https://api.slack.com/methods/oauth.access `oauth.access` API reference}. + */ access: bindApiCall(this, 'oauth.access'), v2: { + /** + * @description Exchanges a temporary OAuth verifier code for an access token. + * @see {@link https://api.slack.com/methods/oauth.v2.access `oauth.v2.access` API reference}. + */ access: bindApiCall(this, 'oauth.v2.access'), + /** + * @description Exchanges a legacy access token for a new expiring access token and refresh token. + * @see {@link https://api.slack.com/methods/oauth.v2.exchange `oauth.v2.exchange` API reference}. + */ exchange: bindApiCall(this, 'oauth.v2.exchange'), }, }; @@ -861,7 +875,7 @@ export abstract class Methods extends EventEmitter { connect: bindApiCall(this, 'rtm.connect'), /** * @description Starts a Real Time Messaging session. - * @deprecated Use `rtm.connect` instead. + * @deprecated Use `rtm.connect` instead. See {@link https://api.slack.com/changelog/2021-10-rtm-start-to-stop our post on retiring `rtm.start`}. * @see {@link https://api.slack.com/methods/rtm.start `rtm.start` API reference}. */ start: bindApiCall(this, 'rtm.start'), @@ -1069,19 +1083,22 @@ export abstract class Methods extends EventEmitter { public readonly stars = { /** * @description Save an item for later. Formerly known as adding a star. - * @deprecated + * @deprecated Stars can still be added but they can no longer be viewed or interacted with by end-users. + * See {@link https://api.slack.com/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}. * @see {@link https://api.slack.com/methods/stars.add `stars.add` API reference}. */ add: bindApiCall(this, 'stars.add'), /** * @description List a user's saved items, formerly known as stars. - * @deprecated + * @deprecated Stars can still be listed but they can no longer be viewed or interacted with by end-users. + * See {@link https://api.slack.com/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}. * @see {@link https://api.slack.com/methods/stars.list `stars.list` API reference}. */ list: bindApiCall(this, 'stars.list'), /** * @description Remove a saved item from a user's saved items, formerly known as stars. - * @deprecated + * @deprecated Stars can still be removed but they can no longer be viewed or interacted with by end-users. + * See {@link https://api.slack.com/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}. * @see {@link https://api.slack.com/methods/stars.remove `stars.remove` API reference}. */ remove: bindApiCall(this, 'stars.remove'), @@ -1090,7 +1107,9 @@ export abstract class Methods extends EventEmitter { public readonly workflows = { /** * @description Indicate that an app's step in a workflow completed execution. - * @deprecated + * @deprecated Steps from Apps is deprecated. + * We're retiring all Slack app functionality around Steps from Apps in September 2024. + * See {@link https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}. * @see {@link https://api.slack.com/methods/workflows.stepCompleted `workflows.stepCompleted` API reference}. */ stepCompleted: bindApiCall( @@ -1099,13 +1118,17 @@ export abstract class Methods extends EventEmitter { ), /** * @description Indicate that an app's step in a workflow failed to execute. - * @deprecated + * @deprecated Steps from Apps is deprecated. + * We're retiring all Slack app functionality around Steps from Apps in September 2024. + * See {@link https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}. * @see {@link https://api.slack.com/methods/workflows.stepFailed `workflows.stepFailed` API reference}. */ stepFailed: bindApiCall(this, 'workflows.stepFailed'), /** * @description Update the configuration for a workflow step. - * @deprecated + * @deprecated Steps from Apps is deprecated. + * We're retiring all Slack app functionality around Steps from Apps in September 2024. + * See {@link https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}. * @see {@link https://api.slack.com/methods/workflows.updateStep `workflows.updateStep` API reference}. */ updateStep: bindApiCall(this, 'workflows.updateStep'), @@ -2270,31 +2293,4 @@ export interface MigrationExchangeArguments extends TokenOverridable, OptionalTe to_old?: boolean; } -/* - * `oauth.*` - */ -// https://api.slack.com/methods/oauth.access -// TODO: this method is marked as a 'legacy' method; should we add it as a 'deprecated' method? -export interface OAuthAccessArguments { - client_id: string; // TODO: docs state this is optional - client_secret: string; // TODO: docs state this is optional - code: string; // TODO: docs state this is optional - redirect_uri?: string; - single_channel?: boolean; -} -// https://api.slack.com/methods/oauth.v2.access -export interface OAuthV2AccessArguments { - client_id: string; // TODO: docs state this is optional - client_secret: string; // TODO: docs state this is optional - code?: string; // not required for token rotation - redirect_uri?: string; - grant_type?: string; - refresh_token?: string; -} -// https://api.slack.com/methods/oauth.v2.exchange -export interface OAuthV2ExchangeArguments { - client_id: string; - client_secret: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 43c121a16..98428dbdf 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -80,3 +80,29 @@ export interface FileCommentArgument { /** @description Encoded file comment ID reacted to. */ file_comment: string; } + +/** + * Some API methods use arguments related to OAuth flows. + * E.g. `openid.*` and `oauth.*` + */ + +export interface OAuthCredentials { + /** @description Issued when you created your application. */ + client_id: string; + /** @description Issued when you created your application. */ + client_secret: string; + /** @description The `code` parameter returned via the OAuth callback. */ + code?: string; + /** + * @description While optional, it is _required_ if your app passed it as a parameter to the OpenID/OAuth flow's + * first step and must match the originally submitted URI. + */ + redirect_uri?: string; +} + +export interface OAuthGrantRefresh { + /** @description The `grant_type` param as described in the OAuth spec. */ + grant_type?: 'authorization_code' | 'refresh_token'; + /** @description The `refresh_token` param as described in the OAuth spec. */ + refresh_token?: string; +} diff --git a/packages/web-api/src/types/request/oauth.ts b/packages/web-api/src/types/request/oauth.ts new file mode 100644 index 000000000..d5af94784 --- /dev/null +++ b/packages/web-api/src/types/request/oauth.ts @@ -0,0 +1,11 @@ +import type { OAuthCredentials, OAuthGrantRefresh } from './common'; + +// https://api.slack.com/methods/oauth.access +export interface OAuthAccessArguments extends OAuthCredentials { + /** @description Request the user to add your app only to a single channel. Only valid with a {@link https://api.slack.com/legacy-workspace-apps legacy workspace app}. Defaults to `false`. */ + single_channel?: boolean; +} +// https://api.slack.com/methods/oauth.v2.access +export interface OAuthV2AccessArguments extends OAuthCredentials, OAuthGrantRefresh {} +// https://api.slack.com/methods/oauth.v2.exchange +export interface OAuthV2ExchangeArguments extends Pick {} diff --git a/packages/web-api/src/types/request/openid.ts b/packages/web-api/src/types/request/openid.ts index a0eff957f..9415ffa7e 100644 --- a/packages/web-api/src/types/request/openid.ts +++ b/packages/web-api/src/types/request/openid.ts @@ -1,21 +1,7 @@ +import type { OAuthCredentials, OAuthGrantRefresh } from './common'; + // https://api.slack.com/methods/openid.connect.token -export interface OpenIDConnectTokenArguments { - /** @description Issued when you created your application. */ - client_id: string; - /** @description Issued when you created your application. */ - client_secret: string; - /** @description The `code` parameter returned via the OAuth callback. */ - code?: string; - /** - * @description If you set a redirect URI when you created your application, - * this property is NOT optional and must match the originally submitted URI. - */ - redirect_uri?: string; - /** @description The `grant_type` param as described in the OAuth spec. */ - grant_type?: 'authorization_code' | 'refresh_token'; - /** @description The `refresh_token` param as described in the OAuth spec. */ - refresh_token?: string; -} +export interface OpenIDConnectTokenArguments extends OAuthCredentials, OAuthGrantRefresh {} // https://api.slack.com/methods/openid.connect.userInfo // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface OpenIDConnectUserInfoArguments {} From 352f98595688248622275252a0044cd4a38971ac Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 31 Oct 2023 17:36:49 -0400 Subject: [PATCH 059/122] Document migration.* methods and split out their arguments into own file. --- packages/web-api/src/methods.ts | 14 +++++--------- packages/web-api/src/types/request/migration.ts | 9 +++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 packages/web-api/src/types/request/migration.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1a31c04bf..c6675925d 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -246,6 +246,7 @@ import type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArgumen import type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from './types/request/pins'; import type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from './types/request/openid'; import type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArguments } from './types/request/oauth'; +import type { MigrationExchangeArguments } from './types/request/migration'; /** * Generic method definition @@ -757,6 +758,10 @@ export abstract class Methods extends EventEmitter { }; public readonly migration = { + /** + * @description For Enterprise Grid workspaces, map local user IDs to global user IDs. + * @see {@link https://api.slack.com/methods/migration.exchange `migration.exchange` API reference}. + */ exchange: bindApiCall(this, 'migration.exchange'), }; @@ -2284,13 +2289,4 @@ export interface FilesRemoteShareArguments extends TokenOverridable { external_id?: string; } -/* - * `migration.*` - */ -// https://api.slack.com/methods/migration.exchange -export interface MigrationExchangeArguments extends TokenOverridable, OptionalTeamAssignable { - users: string; // comma-separated list of users - to_old?: boolean; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/migration.ts b/packages/web-api/src/types/request/migration.ts new file mode 100644 index 000000000..eafd40f42 --- /dev/null +++ b/packages/web-api/src/types/request/migration.ts @@ -0,0 +1,9 @@ +import type { OptionalTeamAssignable, TokenOverridable } from './common'; + +// https://api.slack.com/methods/migration.exchange +export interface MigrationExchangeArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description A comma-separated list of user IDs, up to 400 per request. */ + users: string; + /** @description Specify `true` to convert `W` global user IDs to workspace-specific `U` IDs. Defaults to `false`. */ + to_old?: boolean; +} From 336c62d9d04cf5be66d9f2b7282b1933e1d92efc Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 2 Nov 2023 09:36:49 -0400 Subject: [PATCH 060/122] halfway through file uploads refactor --- packages/web-api/src/WebClient.ts | 3 +- packages/web-api/src/file-upload.ts | 27 ++- packages/web-api/src/methods.ts | 190 ++++------------ packages/web-api/src/types/request/files.ts | 205 ++++++++++++++++++ .../chat.test-d.ts} | 6 +- .../test/types/methods/files.test-d.ts | 2 + 6 files changed, 270 insertions(+), 163 deletions(-) create mode 100644 packages/web-api/src/types/request/files.ts rename packages/web-api/test/types/{webclient-named-method-types.test-d.ts => methods/chat.test-d.ts} (91%) create mode 100644 packages/web-api/test/types/methods/files.test-d.ts diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index a7c22cc78..d4a7a80ca 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -20,7 +20,8 @@ import { FilesGetUploadURLExternalResponse, } from './types/response'; import { CursorPaginationEnabled } from './types/request/common'; -import { Methods, FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './methods'; +import { Methods } from './methods'; +import type { FilesUploadV2Arguments, FileUploadV2Job, FilesGetUploadURLExternalArguments, FilesCompleteUploadExternalArguments } from './types/request/files'; import { getUserAgent } from './instrument'; import { requestErrorWithOriginal, httpErrorFromResponse, platformErrorFromResult, rateLimitedErrorWithDelay, diff --git a/packages/web-api/src/file-upload.ts b/packages/web-api/src/file-upload.ts index 560c81017..4256d40de 100644 --- a/packages/web-api/src/file-upload.ts +++ b/packages/web-api/src/file-upload.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'fs'; import { Readable } from 'stream'; import { Logger } from '@slack/logger'; import { errorWithCode, ErrorCode } from './errors'; -import { FilesCompleteUploadExternalArguments, FilesUploadV2Arguments, FileUploadV2, FileUploadV2Job } from './methods'; +import { FilesCompleteUploadExternalArguments, FilesUploadV2Arguments, FileUploadV2, FileUploadV2Job } from './types/request/files'; /** * Returns a fileUploadJob used to represent the of the file upload job and @@ -23,22 +23,31 @@ export async function getFileUploadJob( const fileData = await getFileData(options); const fileDataBytesLength = getFileDataLength(fileData); - const fileUploadJob = { + const fileUploadJob: Record = { // supplied by user alt_text: options.alt_text, channel_id: options.channels ?? options.channel_id, - content: options.content, - file: options.file, filename: options.filename ?? fileName, initial_comment: options.initial_comment, snippet_type: options.snippet_type, - thread_ts: options.thread_ts, title: options.title ?? (options.filename ?? fileName), // default title to filename unless otherwise specified // calculated data: fileData, length: fileDataBytesLength, }; - return fileUploadJob; + if ('thread_ts' in options) { + fileUploadJob.thread_ts = options.thread_ts; + } + if ('content' in options) { + return { + content: options.content, + ...fileUploadJob, + }; + } + return { + file: options.file, + ...fileUploadJob, + }; } /** @@ -108,8 +117,8 @@ export async function getMultipleFileUploadJobs( export async function getFileData(options: FilesUploadV2Arguments | FileUploadV2): Promise { errorIfInvalidOrMissingFileData(options); - const { file, content } = options; - if (file) { + if ('file' in options) { + const { file } = options; // try to handle as buffer if (Buffer.isBuffer(file)) return file; @@ -131,7 +140,7 @@ export async function getFileData(options: FilesUploadV2Arguments | FileUploadV2 const data = await getFileDataAsStream(file as Readable); if (data) return data; } - if (content) return Buffer.from(content); + if ('content' in options) return Buffer.from(options.content); // general catch-all error throw errorWithCode( diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index c6675925d..b3b38418f 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,4 +1,3 @@ -import { Stream } from 'node:stream'; import { Dialog, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; @@ -232,7 +231,7 @@ import type { AdminAppsConfigSetResponse, } from './types/response'; // Request types -import type { TokenOverridable, LocaleAware, OptionalTeamAssignable, TraditionalPagingEnabled, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; +import type { TokenOverridable, LocaleAware, OptionalTeamAssignable, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; @@ -247,6 +246,7 @@ import type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from '. import type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from './types/request/openid'; import type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArguments } from './types/request/oauth'; import type { MigrationExchangeArguments } from './types/request/migration'; +import type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, FilesRevokePublicURLArguments, FilesSharedPublicURLArguments, FilesUploadArguments, FilesUploadV2Arguments, FilesCompleteUploadExternalArguments, FilesGetUploadURLExternalArguments, FilesCommentsDeleteArguments, FilesRemoteUpdateArguments, FilesRemoteRemoveArguments, FilesRemoteShareArguments, FilesRemoteListArguments, FilesRemoteInfoArguments, FilesRemoteAddArguments } from './types/request/files'; /** * Generic method definition @@ -719,16 +719,52 @@ export abstract class Methods extends EventEmitter { }; public readonly files = { + /** + * @description Finishes an upload started with {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal`}. + * @see {@link https://api.slack.com/methods/files.completeUploadExternal `files.completeUploadExternal` API reference}. + */ + completeUploadExternal: + bindApiCall(this, 'files.completeUploadExternal'), + /** + * @description Deletes a file. + * @see {@link https://api.slack.com/methods/files.delete `files.delete` API reference}. + */ delete: bindApiCall(this, 'files.delete'), + /** + * @description Gets a URL for an edge external file upload. + * @see {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal` API reference}. + */ + getUploadURLExternal: + bindApiCall(this, 'files.getUploadURLExternal'), + /** + * @description Gets information about a file. + * @see {@link https://api.slack.com/methods/files.info `files.info` API reference}. + */ info: bindApiCall(this, 'files.info'), + /** + * @description List files for a team, in a channel, or from a user with applied filters. + * @see {@link https://api.slack.com/methods/files.list `files.list` API reference}. + */ list: bindApiCall(this, 'files.list'), + /** + * @description Revokes public/external sharing access for a file. + * @see {@link https://api.slack.com/methods/files.revokePublicURL `files.revokePublicURL` API reference}. + */ revokePublicURL: bindApiCall(this, 'files.revokePublicURL'), + /** + * @description Enables a file for public/external sharing. + * @see {@link https://api.slack.com/methods/files.revokePublicURL `files.revokePublicURL` API reference}. + */ sharedPublicURL: bindApiCall(this, 'files.sharedPublicURL'), + /** + * @description Uploads or creates a file. + * @see {@link https://api.slack.com/methods/files.upload `files.upload` API reference}. + */ upload: bindApiCall(this, 'files.upload'), /** - * Custom method to support files upload v2 way of uploading files to Slack + * @description Custom method to support a new way of uploading files to Slack. * Supports a single file upload * Supply: * - (required) single file or content @@ -738,12 +774,9 @@ export abstract class Methods extends EventEmitter { * - multiple upload_files * Will try to honor both single file or content data supplied as well * as multiple file uploads property. + * @see {@link https://slack.dev/node-slack-sdk/web-api#upload-a-file `@slack/web-api` Upload a file documentation}. */ uploadV2: bindFilesUploadV2(this), - getUploadURLExternal: - bindApiCall(this, 'files.getUploadURLExternal'), - completeUploadExternal: - bindApiCall(this, 'files.completeUploadExternal'), comments: { delete: bindApiCall(this, 'files.comments.delete'), }, @@ -2146,147 +2179,4 @@ export interface EmojiListArguments extends TokenOverridable { include_categories?: boolean; } -/* - * `files.*` - */ -// https://api.slack.com/methods/files.delete -export interface FilesDeleteArguments extends TokenOverridable { - file: string; // file id -} -// https://api.slack.com/methods/files.info -export interface FilesInfoArguments extends TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled { - file: string; // file id -} -// https://api.slack.com/methods/files.list -export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled, OptionalTeamAssignable { - channel?: string; - user?: string; - ts_from?: string; - ts_to?: string; - types?: string; // comma-separated list of file types - show_files_hidden_by_limit?: boolean; -} -// https://api.slack.com/methods/files.revokePublicURL -export interface FilesRevokePublicURLArguments extends TokenOverridable { - file: string; // file id -} -// https://api.slack.com/methods/files.sharedPublicURL -export interface FilesSharedPublicURLArguments extends TokenOverridable { - file: string; // file id -} -/** - * Legacy files.upload API files upload arguments - */ -// TODO: breaking change: must provide content or file -// https://api.slack.com/methods/files.upload -export interface FilesUploadArguments extends FileUpload, TokenOverridable {} -interface FileUpload { - channels?: string; // comma-separated list of channels - content?: string; // if omitted, must provide `file` - file?: Buffer | Stream | string; // if omitted, must provide `content` - filename?: string; - filetype?: string; - initial_comment?: string; - thread_ts?: string; // TODO: breaking change: if specified, `channels` must be set - title?: string; -} - -export interface FilesUploadV2Arguments extends FileUploadV2, TokenOverridable { - file_uploads?: Omit[]; - /** - * @deprecated Since v7, this flag is no longer used. You can safely remove it from your code. - */ - request_file_info?: boolean; -} - -export type FileUploadV2 = FileUpload & { - alt_text?: string; // for image uploads - channel_id?: string; - snippet_type?: string; // for code snippets -}; - -// Helper type intended for internal use in filesUploadV2 client method -// Includes additional metadata required to complete a single file upload job -export interface FileUploadV2Job extends FileUploadV2, - Pick { - length?: number; - data?: Buffer; -} - -/** - * Gets a URL for an edge external file upload. Method: - * @see {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal` API reference} -*/ -export interface FilesGetUploadURLExternalArguments extends TokenOverridable { - filename: string; - length: number; - alt_text?: string; - snippet_type?: string; -} -/** - * Finishes an upload started with {@link https://api.slack.com/methods/files.getUploadURLExternal `files.getUploadURLExternal`}. - * @see {@link https://api.slack.com/methods/files.completeUploadExternal `files.completeUploadExternal` API reference} - */ -export interface FilesCompleteUploadExternalArguments extends TokenOverridable { - files: FileUploadComplete[]; - channel_id?: string, // if omitted, file will be private - initial_comment?: string, - thread_ts?: string -} -interface FileUploadComplete { - id: string, // file id - title?: string // filename -} -// https://api.slack.com/methods/files.comments.delete -export interface FilesCommentsDeleteArguments extends TokenOverridable { - file: string; // file id - id: string; // comment id -} -// https://api.slack.com/methods/files.remote.info -export interface FilesRemoteInfoArguments extends TokenOverridable { - // TODO: breaking change: either one of the file or external_id arguments are required - // This either/or relationship for files.remote.* APIs can be modeled once and re-used for all these methods - file?: string; - external_id?: string; -} -// https://api.slack.com/methods/files.remote.list -export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { - ts_from?: string; - ts_to?: string; - channel?: string; -} -// https://api.slack.com/methods/files.remote.add -export interface FilesRemoteAddArguments extends TokenOverridable { - title: string; - external_url: string; - external_id: string; // a unique identifier for the file in your system - filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types - preview_image?: Buffer | Stream; - indexable_file_contents?: Buffer | Stream; -} -// https://api.slack.com/methods/files.remote.update -export interface FilesRemoteUpdateArguments extends TokenOverridable { - title?: string; - external_url?: string; - filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types - preview_image?: Buffer | Stream; - indexable_file_contents?: Buffer | Stream; - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; -} -// https://api.slack.com/methods/files.remote.remove -export interface FilesRemoteRemoveArguments extends TokenOverridable { - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; -} -// https://api.slack.com/methods/files.remote.share -export interface FilesRemoteShareArguments extends TokenOverridable { - channels: string; // comma-separated list of channel ids - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts new file mode 100644 index 000000000..f5fc361b1 --- /dev/null +++ b/packages/web-api/src/types/request/files.ts @@ -0,0 +1,205 @@ +import type { Stream } from 'node:stream'; +import { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; +import type { FilesGetUploadURLExternalResponse } from '../response'; + +interface FileArgument { + /** @description Encoded file ID. */ + file: string; +} +interface FileUploadComplete { + /** @description Encoded file ID. */ + id: string; + /** @description File title. */ + title?: string; +} + +interface FileChannelDestinationArgument { + /** @description Channel ID where the file will be shared. If not specified the file will be private. */ + channel_id?: string; + thread_ts?: never; +} +interface FileThreadDestinationArgument { + /** @description Channel ID where the file will be shared as a thread reply. */ + channel_id: string; + /** @description Provide another message's `ts` value to upload this file as a reply. */ + thread_ts: string; +} +// Some file APIs allow you to upload a file to a channel as its own message, or to a thread as a reply. +type FileDestinationArgument = FileChannelDestinationArgument | FileThreadDestinationArgument; +// Exact same as the above `FileDestinationArgument`, but with a `channels` property instead of `channel_id`. +interface FileChannelDestinationArgumentChannels { + /** + * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will + * be private. + */ + channels?: string; + thread_ts?: never; +} +interface FileThreadDestinationArgumentChannels { + /** + * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will + * be private. + */ + channels?: string; + /** @description Provide another message's `ts` value to upload this file as a reply. */ + thread_ts: string; +} +// Some file APIs allow you to upload a file to a channel as its own message, or to a thread as a reply. +type FileDestinationArgumentChannels = FileChannelDestinationArgumentChannels | FileThreadDestinationArgumentChannels; + +// https://api.slack.com/methods/files.completeUploadExternal +export type FilesCompleteUploadExternalArguments = FileDestinationArgument & TokenOverridable & { + /** @description Array of file IDs and their corresponding (optional) titles. */ + files: [FileUploadComplete, ...FileUploadComplete[]]; + /** @description The message text introducing the file in the specified channel. */ + initial_comment?: string; +}; + +// https://api.slack.com/methods/files.delete +export interface FilesDeleteArguments extends FileArgument, TokenOverridable {} + +// https://api.slack.com/methods/files.getUploadURLExternal +export interface FilesGetUploadURLExternalArguments extends TokenOverridable { + /** @description Name of the file being uploaded. */ + filename: string; + /** @description Size in bytes of the file being uploaded. */ + length: number; + /** @description Description of image for screen-reader. */ + alt_text?: string; + /** @description Syntax type of the snippet being uploaded. E.g. `python`. */ + snippet_type?: string; +} +// https://api.slack.com/methods/files.info +export interface FilesInfoArguments extends FileArgument, TokenOverridable, CursorPaginationEnabled, + TraditionalPagingEnabled {} +// https://api.slack.com/methods/files.list +export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled, OptionalTeamAssignable { + /** @description Filter files appearing in a specific channel, indicated by its ID. */ + channel?: string; + /** + * @description Show truncated file info for files hidden due to being too old, and the team who owns the file + * being over the file limit. + */ + show_files_hidden_by_limit?: boolean; + /** @description Filter files created after this timestamp (inclusive). */ + ts_from?: string; + /** @description Filter files created before this timestamp (inclusive). */ + ts_to?: string; + /** + * @description Filter files by type. Pass multiple values for `types` argument by comma-seperating the values. + * The default value is `all`, which does not filter the list. + * Available types are `all`, `spaces`, `snippets`, `images`, `gdocs`, `zips` and `pdfs`. + */ + types?: string; + /** @description Filter files created by a single user. */ + user?: string; +} +// https://api.slack.com/methods/files.revokePublicURL +export interface FilesRevokePublicURLArguments extends FileArgument, TokenOverridable {} +// https://api.slack.com/methods/files.sharedPublicURL +export interface FilesSharedPublicURLArguments extends FileArgument, TokenOverridable {} + +interface FileUploadStringContents { + /** @description File contents. If omitted, you must provide the `file` argument. */ + content: string; +} +interface FileUploadBinaryContents { + /** + * @description File contents as a `Buffer` or `Stream`. + * If providing a `string`, this parameter will be interpreted as a _path_ to a file, which will be read from disk + * before uploading. If omitted, you must provide the `content` argument. + */ + file: Buffer | Stream | string; +} +// File upload contents can be provided using either `content` or `file` arguments - and one of these is required. +type FileUploadContents = FileUploadStringContents | FileUploadBinaryContents; + +type FileUpload = FileUploadContents & FileDestinationArgumentChannels & { + /** @description Name of the file. */ + filename?: string; + /** + * @description A file type identifier. + * @see {@link https://api.slack.com/types/file#file_types File types} for a complete list of supported file types. + */ + filetype?: string; + /** @description The message text introducing the file in specified channel(s). */ + initial_comment?: string; + /** @description File title. */ + title?: string; +}; +// https://api.slack.com/methods/files.upload +export type FilesUploadArguments = FileUpload & TokenOverridable; + +export type FileUploadV2 = FileUpload & { + /** @description Description of image for screen-reader. */ + alt_text?: string; + /** @description Channel ID where the file will be shared. If not specified the file will be private. */ + channel_id?: string; + /** @description Syntax type of the snippet being uploaded. E.g. `python`. */ + snippet_type?: string; +}; + +// https://slack.dev/node-slack-sdk/web-api#upload-a-file +export type FilesUploadV2Arguments = FileUploadV2 & TokenOverridable & { + file_uploads?: Omit[]; +}; + +// Helper type intended for internal use in filesUploadV2 client method +// Includes additional metadata required to complete a single file upload job +export type FileUploadV2Job = FileUploadV2 & +Pick & { + length?: number; + data?: Buffer; +}; + +// https://api.slack.com/methods/files.comments.delete +export interface FilesCommentsDeleteArguments extends TokenOverridable { + file: string; // file id + id: string; // comment id +} +// https://api.slack.com/methods/files.remote.info +export interface FilesRemoteInfoArguments extends TokenOverridable { + // TODO: breaking change: either one of the file or external_id arguments are required + // This either/or relationship for files.remote.* APIs can be modeled once and re-used for all these methods + file?: string; + external_id?: string; +} +// https://api.slack.com/methods/files.remote.list +export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { + ts_from?: string; + ts_to?: string; + channel?: string; +} +// https://api.slack.com/methods/files.remote.add +export interface FilesRemoteAddArguments extends TokenOverridable { + title: string; + external_url: string; + external_id: string; // a unique identifier for the file in your system + filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types + preview_image?: Buffer | Stream; + indexable_file_contents?: Buffer | Stream; +} +// https://api.slack.com/methods/files.remote.update +export interface FilesRemoteUpdateArguments extends TokenOverridable { + title?: string; + external_url?: string; + filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types + preview_image?: Buffer | Stream; + indexable_file_contents?: Buffer | Stream; + // TODO: breaking change: either one of the file or external_id arguments are required + file?: string; + external_id?: string; +} +// https://api.slack.com/methods/files.remote.remove +export interface FilesRemoteRemoveArguments extends TokenOverridable { + // TODO: breaking change: either one of the file or external_id arguments are required + file?: string; + external_id?: string; +} +// https://api.slack.com/methods/files.remote.share +export interface FilesRemoteShareArguments extends TokenOverridable { + channels: string; // comma-separated list of channel ids + // TODO: breaking change: either one of the file or external_id arguments are required + file?: string; + external_id?: string; +} diff --git a/packages/web-api/test/types/webclient-named-method-types.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts similarity index 91% rename from packages/web-api/test/types/webclient-named-method-types.test-d.ts rename to packages/web-api/test/types/methods/chat.test-d.ts index 9da9ec70c..044934f8c 100644 --- a/packages/web-api/test/types/webclient-named-method-types.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -1,7 +1,7 @@ import { expectType, expectError } from 'tsd'; -import { WebClient, WebAPICallResult } from '../../'; -import { ChatPostMessageResponse } from '../../src/types/response/ChatPostMessageResponse'; -import { ChatPostEphemeralResponse } from '../../src/types/response/ChatPostEphemeralResponse'; +import { WebClient, WebAPICallResult } from '../../../'; +import { ChatPostMessageResponse } from '../../../src/types/response/ChatPostMessageResponse'; +import { ChatPostEphemeralResponse } from '../../../src/types/response/ChatPostEphemeralResponse'; // import { ChatScheduleMessageResponse } from '../../src/response/ChatScheduleMessageResponse'; // import { ChatUpdateResponse } from '../../src/response/ChatUpdateResponse'; diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts new file mode 100644 index 000000000..5a129cc40 --- /dev/null +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -0,0 +1,2 @@ +import { expectType, expectError } from 'tsd'; +import { WebClient, WebAPICallResult } from '../../../'; From 3c8d14abe7e85c03a8efb6573ed8f0bfa1346e43 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 2 Nov 2023 15:53:25 -0400 Subject: [PATCH 061/122] Fix up the build related to reworked file upload arguments. --- packages/web-api/src/WebClient.ts | 4 +- packages/web-api/src/file-upload.ts | 43 ++++++++++++++------- packages/web-api/src/methods.ts | 2 +- packages/web-api/src/types/request/files.ts | 4 +- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index d4a7a80ca..7ca4e7094 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -232,6 +232,8 @@ export class WebClient extends Methods { } warnIfNotUsingFilesUploadV2(method, this.logger); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore if (method === 'files.uploadV2') return this.filesUploadV2(options); const headers: Record = {}; @@ -493,7 +495,7 @@ export class WebClient extends Methods { let fileUploads: FileUploadV2Job[] = []; // add single file data to uploads if file or content exists at the top level - if (options.file || options.content) { + if ('file' in options || 'content' in options) { fileUploads.push(await getFileUploadJob(options, this.logger)); } diff --git a/packages/web-api/src/file-upload.ts b/packages/web-api/src/file-upload.ts index 4256d40de..baeaab01c 100644 --- a/packages/web-api/src/file-upload.ts +++ b/packages/web-api/src/file-upload.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'fs'; import { Readable } from 'stream'; import { Logger } from '@slack/logger'; import { errorWithCode, ErrorCode } from './errors'; -import { FilesCompleteUploadExternalArguments, FilesUploadV2Arguments, FileUploadV2, FileUploadV2Job } from './types/request/files'; +import { FilesCompleteUploadExternalArguments, FilesUploadV2Arguments, FileUploadBinaryContents, FileUploadStringContents, FileUploadV2, FileUploadV2Job } from './types/request/files'; /** * Returns a fileUploadJob used to represent the of the file upload job and @@ -92,15 +92,26 @@ export async function getMultipleFileUploadJobs( ErrorCode.FileUploadInvalidArgumentsError, ); } - // takes any channel_id, initial_comment and thread_ts // supplied at the top level. - return getFileUploadJob({ + const uploadJobArgs: Record = { ...upload, channels: options.channels, channel_id: options.channel_id, initial_comment: options.initial_comment, - thread_ts: options.thread_ts, + }; + if ('thread_ts' in options) { + uploadJobArgs.thread_ts = options.thread_ts; + } + if ('content' in upload) { + return getFileUploadJob({ + content: (upload as FileUploadStringContents).content, + ...uploadJobArgs, + }, logger); + } + return getFileUploadJob({ + file: (upload as FileUploadBinaryContents).file, + ...uploadJobArgs, }, logger); })); } @@ -202,8 +213,10 @@ Record { files: [{ id: file_id, title }], channel_id, initial_comment, - thread_ts, }; + if (thread_ts) { + toComplete[compareString].thread_ts = upload.thread_ts; + } } else { toComplete[compareString].files.push({ id: file_id, @@ -262,22 +275,26 @@ export function errorIfChannelsCsv(options: FilesUploadV2Arguments | FileUploadV * @param options */ export function errorIfInvalidOrMissingFileData(options: FilesUploadV2Arguments | FileUploadV2): void { - const { file, content } = options; + const hasFile = 'file' in options; + const hasContent = 'content' in options; - if (!(file || content) || (file && content)) { + if (!(hasFile || hasContent) || (hasFile && hasContent)) { throw errorWithCode( new Error('Either a file or content field is required for valid file upload. You cannot supply both'), ErrorCode.FileUploadInvalidArgumentsError, ); } /* eslint-disable @typescript-eslint/no-explicit-any */ - if (file && !(typeof file === 'string' || Buffer.isBuffer(file) || (file as any) instanceof Readable)) { - throw errorWithCode( - new Error('file must be a valid string path, buffer or Readable'), - ErrorCode.FileUploadInvalidArgumentsError, - ); + if ('file' in options) { + const { file } = options; + if (file && !(typeof file === 'string' || Buffer.isBuffer(file) || (file as any) instanceof Readable)) { + throw errorWithCode( + new Error('file must be a valid string path, buffer or Readable'), + ErrorCode.FileUploadInvalidArgumentsError, + ); + } } - if (content && typeof content !== 'string') { + if ('content' in options && options.content && typeof options.content !== 'string') { throw errorWithCode( new Error('content must be a string'), ErrorCode.FileUploadInvalidArgumentsError, diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index b3b38418f..91a62b8d6 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -291,7 +291,7 @@ export abstract class Methods extends EventEmitter { } public abstract apiCall(method: string, options?: Record): Promise; - public abstract filesUploadV2(options: Record): Promise; + public abstract filesUploadV2(options: FilesUploadV2Arguments): Promise; public readonly admin = { analytics: { diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index f5fc361b1..d553d4ff5 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -99,11 +99,11 @@ export interface FilesRevokePublicURLArguments extends FileArgument, TokenOverri // https://api.slack.com/methods/files.sharedPublicURL export interface FilesSharedPublicURLArguments extends FileArgument, TokenOverridable {} -interface FileUploadStringContents { +export interface FileUploadStringContents { /** @description File contents. If omitted, you must provide the `file` argument. */ content: string; } -interface FileUploadBinaryContents { +export interface FileUploadBinaryContents { /** * @description File contents as a `Buffer` or `Stream`. * If providing a `string`, this parameter will be interpreted as a _path_ to a file, which will be read from disk From 9446539b4e6271c7d639e0ace2b6da6357beac39 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 2 Nov 2023 16:55:10 -0400 Subject: [PATCH 062/122] Document files.* APIs and finish rework of files API argument shapes. --- packages/web-api/src/methods.ts | 32 +++++- packages/web-api/src/types/request/files.ts | 106 +++++++++----------- 2 files changed, 78 insertions(+), 60 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 91a62b8d6..ebf0a44fe 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -778,15 +778,43 @@ export abstract class Methods extends EventEmitter { */ uploadV2: bindFilesUploadV2(this), comments: { + /** + * @description Deletes an existing comment on a file. + * @see {@link https://api.slack.com/methods/files.comments.delete `files.comments.delete` API reference}. + */ delete: bindApiCall(this, 'files.comments.delete'), }, remote: { + /** + * @description Adds a file from a remote service. + * @see {@link https://api.slack.com/methods/files.remote.add `files.remote.add` API reference}. + */ + add: bindApiCall(this, 'files.remote.add'), + /** + * @description Retrieve information about a remote file added to Slack. + * @see {@link https://api.slack.com/methods/files.remote.info `files.remote.info` API reference}. + */ info: bindApiCall(this, 'files.remote.info'), + /** + * @description List remote files added to Slack. + * @see {@link https://api.slack.com/methods/files.remote.list `files.remote.list` API reference}. + */ list: bindApiCall(this, 'files.remote.list'), - add: bindApiCall(this, 'files.remote.add'), - update: bindApiCall(this, 'files.remote.update'), + /** + * @description Remove a remote file. + * @see {@link https://api.slack.com/methods/files.remote.remove `files.remote.remove` API reference}. + */ remove: bindApiCall(this, 'files.remote.remove'), + /** + * @description Share a remote file into a channel. + * @see {@link https://api.slack.com/methods/files.remote.share `files.remote.share` API reference}. + */ share: bindApiCall(this, 'files.remote.share'), + /** + * @description Updates an existing remote file. + * @see {@link https://api.slack.com/methods/files.remote.update `files.remote.update` API reference}. + */ + update: bindApiCall(this, 'files.remote.update'), }, }; diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index d553d4ff5..89e24b459 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -6,6 +6,24 @@ interface FileArgument { /** @description Encoded file ID. */ file: string; } +interface ExternalIDArgument { + /** @description Creator defined GUID for the file. */ + external_id: string; +} +interface ChannelsArgument { + /** + * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will + * be private. + */ + channels?: string; +} +interface FileType { + /** + * @description A file type identifier. + * @see {@link https://api.slack.com/types/file#file_types File types} for a complete list of supported file types. + */ + filetype?: string; +} interface FileUploadComplete { /** @description Encoded file ID. */ id: string; @@ -27,20 +45,10 @@ interface FileThreadDestinationArgument { // Some file APIs allow you to upload a file to a channel as its own message, or to a thread as a reply. type FileDestinationArgument = FileChannelDestinationArgument | FileThreadDestinationArgument; // Exact same as the above `FileDestinationArgument`, but with a `channels` property instead of `channel_id`. -interface FileChannelDestinationArgumentChannels { - /** - * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will - * be private. - */ - channels?: string; +interface FileChannelDestinationArgumentChannels extends ChannelsArgument { thread_ts?: never; } -interface FileThreadDestinationArgumentChannels { - /** - * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will - * be private. - */ - channels?: string; +interface FileThreadDestinationArgumentChannels extends ChannelsArgument { /** @description Provide another message's `ts` value to upload this file as a reply. */ thread_ts: string; } @@ -114,14 +122,9 @@ export interface FileUploadBinaryContents { // File upload contents can be provided using either `content` or `file` arguments - and one of these is required. type FileUploadContents = FileUploadStringContents | FileUploadBinaryContents; -type FileUpload = FileUploadContents & FileDestinationArgumentChannels & { +type FileUpload = FileUploadContents & FileDestinationArgumentChannels & FileType & { /** @description Name of the file. */ filename?: string; - /** - * @description A file type identifier. - * @see {@link https://api.slack.com/types/file#file_types File types} for a complete list of supported file types. - */ - filetype?: string; /** @description The message text introducing the file in specified channel(s). */ initial_comment?: string; /** @description File title. */ @@ -153,53 +156,40 @@ Pick & { }; // https://api.slack.com/methods/files.comments.delete -export interface FilesCommentsDeleteArguments extends TokenOverridable { - file: string; // file id - id: string; // comment id -} -// https://api.slack.com/methods/files.remote.info -export interface FilesRemoteInfoArguments extends TokenOverridable { - // TODO: breaking change: either one of the file or external_id arguments are required - // This either/or relationship for files.remote.* APIs can be modeled once and re-used for all these methods - file?: string; - external_id?: string; -} -// https://api.slack.com/methods/files.remote.list -export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { - ts_from?: string; - ts_to?: string; - channel?: string; +export interface FilesCommentsDeleteArguments extends FileArgument, TokenOverridable { + /** @description The ID of the comment to delete. */ + id: string; } // https://api.slack.com/methods/files.remote.add -export interface FilesRemoteAddArguments extends TokenOverridable { +export interface FilesRemoteAddArguments extends FileType, ExternalIDArgument, TokenOverridable { + /** @description Title of the file being shared. */ title: string; + /** @description URL of the remote file. */ external_url: string; - external_id: string; // a unique identifier for the file in your system - filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types + /** @description Preview of the document. */ preview_image?: Buffer | Stream; + /** + * @description A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery + * of the remote file. + */ indexable_file_contents?: Buffer | Stream; } -// https://api.slack.com/methods/files.remote.update -export interface FilesRemoteUpdateArguments extends TokenOverridable { - title?: string; - external_url?: string; - filetype?: string; // possible values (except for 'auto'): https://api.slack.com/types/file#file_types - preview_image?: Buffer | Stream; - indexable_file_contents?: Buffer | Stream; - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; +// Either the encoded file ID or the external ID must be used as an argument. +type FileOrExternalID = FileArgument | ExternalIDArgument; +// https://api.slack.com/methods/files.remote.info +export type FilesRemoteInfoArguments = FileOrExternalID & TokenOverridable; +// https://api.slack.com/methods/files.remote.list +export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled { + /** @description Filter files appearing in a specific channel, indicated by its ID. */ + channel?: string; + /** @description Filter files created after this timestamp (inclusive). */ + ts_from?: string; + /** @description Filter files created before this timestamp (inclusive). */ + ts_to?: string; } // https://api.slack.com/methods/files.remote.remove -export interface FilesRemoteRemoveArguments extends TokenOverridable { - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; -} +export type FilesRemoteRemoveArguments = FileOrExternalID & TokenOverridable; // https://api.slack.com/methods/files.remote.share -export interface FilesRemoteShareArguments extends TokenOverridable { - channels: string; // comma-separated list of channel ids - // TODO: breaking change: either one of the file or external_id arguments are required - file?: string; - external_id?: string; -} +export type FilesRemoteShareArguments = Required & FileOrExternalID & TokenOverridable; +// https://api.slack.com/methods/files.remote.update +export type FilesRemoteUpdateArguments = FileOrExternalID & TokenOverridable & FileType & Pick; From f35fb4572782d40babf0058d01422228ab0e3443 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 2 Nov 2023 17:45:21 -0400 Subject: [PATCH 063/122] Playing around with the type tests for files. --- .../test/types/methods/files.test-d.ts | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index 5a129cc40..06d6dbafb 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -1,2 +1,34 @@ -import { expectType, expectError } from 'tsd'; -import { WebClient, WebAPICallResult } from '../../../'; +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../'; + +const web = new WebClient('TOKEN'); + +// Reusable files.* API partial argument objects for these tests +const file = { id: 'F1234', title: 'Choose Boring Technology' }; +// -- File upload target/destination types: channels, threads or private files +// ---- correct destinations +const destinationChannel = { channel_id: 'C1234' }; +const destinationThread = { ...destinationChannel, thread_ts: '1234.456' }; +// ---- invalid destinations +const destinationMissingChannel = { thread_ts: '1234.567' }; + +// files.completeUploadExternal +// -- sad path +expectError(web.files.completeUploadExternal()); // lacking argument +expectError(web.files.completeUploadExternal({})); // empty argument +expectError(web.files.completeUploadExternal({ + files: [file], + ...destinationMissingChannel // has thread_ts but no channel +})); +// -- happy path +expectAssignable>([{ + files: [file] // bare minimum: specify at least one file +}]); +expectAssignable>([{ + files: [file], + ...destinationChannel // share to a channel +}]); +expectAssignable>([{ + files: [file], + ...destinationThread // share to a thread +}]); From 59026cacbc820a899934ba724dcdaf53c2d4c66a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 3 Nov 2023 12:34:17 -0400 Subject: [PATCH 064/122] lint tweaks for type tests, first stab at type tests. --- lint-configs/.eslintignore | 2 +- lint-configs/.eslintrc.js | 4 + packages/web-api/src/types/request/files.ts | 2 +- .../test/types/methods/files.test-d.ts | 111 +++++++++++++++++- 4 files changed, 111 insertions(+), 8 deletions(-) diff --git a/lint-configs/.eslintignore b/lint-configs/.eslintignore index b512c09d4..3c3629e64 100644 --- a/lint-configs/.eslintignore +++ b/lint-configs/.eslintignore @@ -1 +1 @@ -node_modules \ No newline at end of file +node_modules diff --git a/lint-configs/.eslintrc.js b/lint-configs/.eslintrc.js index 7bcec84db..ce7405377 100644 --- a/lint-configs/.eslintrc.js +++ b/lint-configs/.eslintrc.js @@ -300,6 +300,10 @@ module.exports = { 'symbol-description': 'off', }, }, + { + files: ['test/types/**/*.test-d.ts'], + extends: ['plugin:@typescript-eslint/disable-type-checked'], + }, ], }; diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index 89e24b459..cf665c4ce 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -48,7 +48,7 @@ type FileDestinationArgument = FileChannelDestinationArgument | FileThreadDestin interface FileChannelDestinationArgumentChannels extends ChannelsArgument { thread_ts?: never; } -interface FileThreadDestinationArgumentChannels extends ChannelsArgument { +interface FileThreadDestinationArgumentChannels extends Required { /** @description Provide another message's `ts` value to upload this file as a reply. */ thread_ts: string; } diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index 06d6dbafb..505997482 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -1,16 +1,19 @@ import { expectAssignable, expectError } from 'tsd'; -import { WebClient } from '../../../'; +import { WebClient } from '../../..'; const web = new WebClient('TOKEN'); // Reusable files.* API partial argument objects for these tests const file = { id: 'F1234', title: 'Choose Boring Technology' }; // -- File upload target/destination types: channels, threads or private files +// Some of these use a `channel_id` prop vs. a `channels` prop :/ // ---- correct destinations const destinationChannel = { channel_id: 'C1234' }; const destinationThread = { ...destinationChannel, thread_ts: '1234.456' }; +const destinationChannels = { channels: 'C1234' }; +const destinationThreadChannels = { ...destinationChannels, thread_ts: '1234.456' }; // ---- invalid destinations -const destinationMissingChannel = { thread_ts: '1234.567' }; +const destinationThreadWithMissingChannel = { thread_ts: '1234.567' }; // files.completeUploadExternal // -- sad path @@ -18,17 +21,113 @@ expectError(web.files.completeUploadExternal()); // lacking argument expectError(web.files.completeUploadExternal({})); // empty argument expectError(web.files.completeUploadExternal({ files: [file], - ...destinationMissingChannel // has thread_ts but no channel + ...destinationThreadWithMissingChannel, // has thread_ts but no channel +})); +expectError(web.files.completeUploadExternal({ + files: [], // must specify at least one file })); // -- happy path expectAssignable>([{ - files: [file] // bare minimum: specify at least one file + files: [file], // must specify at least one file + // not shared to any destination, so it is a 'private' file }]); expectAssignable>([{ files: [file], - ...destinationChannel // share to a channel + ...destinationChannel, // share to a channel }]); expectAssignable>([{ files: [file], - ...destinationThread // share to a thread + ...destinationThread, // share to a thread +}]); + +// files.delete +// -- sad path +expectError(web.files.delete()); // lacking argument +expectError(web.files.delete({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'F123', // must specify a file +}]); + +// files.getUploadURLExternal +// -- sad path +expectError(web.files.getUploadURLExternal()); // lacking argument +expectError(web.files.getUploadURLExternal({})); // empty argument +expectError(web.files.getUploadURLExternal({ filename: 'hi' })); // missing `length` +expectError(web.files.getUploadURLExternal({ length: 42 })); // missing `filename` +// -- happy path +expectAssignable>([{ + filename: 'batman', + length: 420, +}]); + +// files.info +// -- sad path +expectError(web.files.info()); // lacking argument +expectError(web.files.info({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'F123', // must specify a file +}]); + +// files.list +// -- sad path +expectError(web.files.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // able to call it with empty argument + +// files.revokePublicURL +// -- sad path +expectError(web.files.revokePublicURL()); // lacking argument +expectError(web.files.revokePublicURL({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'F123', // must specify a file +}]); + +// files.sharedPublicURL +// -- sad path +expectError(web.files.sharedPublicURL()); // lacking argument +expectError(web.files.sharedPublicURL({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'F123', // must specify a file +}]); + +// files.upload +// -- sad path +expectError(web.files.upload()); // lacking argument +expectError(web.files.upload({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'test.png', // must specify either a file... +}]); +expectAssignable>([{ + content: 'text', // or file contents... +}]); + +// files.uploadV2 +// -- sad path +expectError(web.files.uploadV2()); // lacking argument +expectError(web.files.uploadV2({})); // empty argument +// -- happy path +expectAssignable>([{ + file: 'test.png', // must specify either a file... +}]); +expectAssignable>([{ + content: 'text', // or file contents... +}]); + +// files.comments.delete +// -- sad path +expectError(web.files.comments.delete()); // lacking argument +expectError(web.files.comments.delete({})); // empty argument +expectError(web.files.comments.delete({ file: 'F123' })); // missing comment ID +expectError(web.files.comments.delete({ id: 'Fc123' })); // missing file ID +// -- happy path +expectAssignable>([{ + file: 'test.png', // must specify either a file... +}]); +expectAssignable>([{ + content: 'text', // or file contents... }]); From 2996db82b78967e29e77ec4e16ae39092b2479c1 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 3 Nov 2023 14:14:23 -0400 Subject: [PATCH 065/122] Add special import rules for type tests: allow reaching into src/ dirs when importing. files.remote.* APIs should use either/or the `file` or the `external_id` argument. A few more files.* API type tests. --- lint-configs/.eslintrc.js | 12 +++++- packages/web-api/src/types/request/files.ts | 2 +- .../test/types/methods/files.test-d.ts | 38 ++++++++++++++++--- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/lint-configs/.eslintrc.js b/lint-configs/.eslintrc.js index ce7405377..ea7ac3ea4 100644 --- a/lint-configs/.eslintrc.js +++ b/lint-configs/.eslintrc.js @@ -250,8 +250,7 @@ module.exports = { allow: [ '**/middleware/*', // the src/middleware directory doesn't export a module, it's just a namespace. '**/receivers/*', // the src/receivers directory doesn't export a module, it's just a namespace. - '**/types/**/*', - '**/types/*', // type heirarchies should be used however one wants + '**/types/**/*', // type heirarchies should be used however one wants ], }], @@ -303,6 +302,15 @@ module.exports = { { files: ['test/types/**/*.test-d.ts'], extends: ['plugin:@typescript-eslint/disable-type-checked'], + rules: { + 'import/no-internal-modules': ['error', { + // Use the following option to set a list of allowable globs in this project. + allow: [ + '**/src/**/*', // allow type tests to reach into src/ + '**/types/**/*', // type heirarchies should be used however one wants + ], + }], + } }, ], }; diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index cf665c4ce..10837b78b 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -175,7 +175,7 @@ export interface FilesRemoteAddArguments extends FileType, ExternalIDArgument, T indexable_file_contents?: Buffer | Stream; } // Either the encoded file ID or the external ID must be used as an argument. -type FileOrExternalID = FileArgument | ExternalIDArgument; +type FileOrExternalID = (FileArgument & { external_id?: never; }) | (ExternalIDArgument & { file?: never; }); // https://api.slack.com/methods/files.remote.info export type FilesRemoteInfoArguments = FileOrExternalID & TokenOverridable; // https://api.slack.com/methods/files.remote.list diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index 505997482..d9fa6e68f 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -1,5 +1,5 @@ import { expectAssignable, expectError } from 'tsd'; -import { WebClient } from '../../..'; +import { WebClient } from '../../../src/WebClient'; const web = new WebClient('TOKEN'); @@ -10,8 +10,6 @@ const file = { id: 'F1234', title: 'Choose Boring Technology' }; // ---- correct destinations const destinationChannel = { channel_id: 'C1234' }; const destinationThread = { ...destinationChannel, thread_ts: '1234.456' }; -const destinationChannels = { channels: 'C1234' }; -const destinationThreadChannels = { ...destinationChannels, thread_ts: '1234.456' }; // ---- invalid destinations const destinationThreadWithMissingChannel = { thread_ts: '1234.567' }; @@ -126,8 +124,36 @@ expectError(web.files.comments.delete({ file: 'F123' })); // missing comment ID expectError(web.files.comments.delete({ id: 'Fc123' })); // missing file ID // -- happy path expectAssignable>([{ - file: 'test.png', // must specify either a file... + file: 'F1234', + id: 'Fc1234', }]); -expectAssignable>([{ - content: 'text', // or file contents... + +// files.remote.add +// -- sad path +expectError(web.files.remote.add()); // lacking argument +expectError(web.files.remote.add({})); // empty argument +expectError(web.files.remote.add({ external_id: '1234' })); // missing url and title +expectError(web.files.remote.add({ external_url: 'https://example.com' })); // missing id and title +expectError(web.files.remote.add({ title: 'my document' })); // missing id and url +expectError(web.files.remote.add({ external_id: '1234', external_url: 'https://example.com' })); // missing title +expectError(web.files.remote.add({ external_id: '1234', title: 'this is a test' })); // missing url +expectError(web.files.remote.add({ external_url: '1234', title: 'this is a test' })); // missing id +// -- happy path +expectAssignable>([{ + external_id: '1234', + external_url: 'https://example.com', + title: 'my document', +}]); + +// files.remote.info +// -- sad path +expectError(web.files.remote.info()); // lacking argument +expectError(web.files.remote.info({})); // empty argument +expectError(web.files.remote.info({ external_id: '1234', file: 'F1234' })); // either external ID, or file ID, but not both +// -- happy path +expectAssignable>([{ + external_id: '1234', +}]); +expectAssignable>([{ + file: 'F1234', }]); From e9ac27a810e3fabf7a2010e84bae086ddfe31c3d Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 14 Nov 2023 15:11:47 -0500 Subject: [PATCH 066/122] tweaking some files.* API type tests. --- .../test/types/methods/files.test-d.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index d9fa6e68f..e0d78cb8e 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -10,6 +10,8 @@ const file = { id: 'F1234', title: 'Choose Boring Technology' }; // ---- correct destinations const destinationChannel = { channel_id: 'C1234' }; const destinationThread = { ...destinationChannel, thread_ts: '1234.456' }; +const destinationChannels = { channels: 'C1234' }; // same as above but different property name +const destinationThreadChannels = { ...destinationChannels, thread_ts: '1234.456' }; // ---- invalid destinations const destinationThreadWithMissingChannel = { thread_ts: '1234.567' }; @@ -96,18 +98,29 @@ expectAssignable>([{ // -- sad path expectError(web.files.upload()); // lacking argument expectError(web.files.upload({})); // empty argument +expectError(web.files.upload({ file: 'test.png', thread_ts: '123.456' })); // if providing thread_ts, must provide channels // -- happy path expectAssignable>([{ file: 'test.png', // must specify either a file... }]); expectAssignable>([{ - content: 'text', // or file contents... + content: 'text', // or file contents +}]); +expectAssignable>([{ + content: 'text', + channels: 'C1234', // optionally share to a channel +}]); +expectAssignable>([{ + content: 'text', + channels: 'C1234', + thread_ts: '12345.678', // or even to a specific thread }]); // files.uploadV2 // -- sad path expectError(web.files.uploadV2()); // lacking argument expectError(web.files.uploadV2({})); // empty argument +expectError(web.files.uploadV2({ file: 'test.png', thread_ts: '123.456' })); // if providing thread_ts, must provide channels // -- happy path expectAssignable>([{ file: 'test.png', // must specify either a file... @@ -115,6 +128,15 @@ expectAssignable>([{ expectAssignable>([{ content: 'text', // or file contents... }]); +expectAssignable>([{ + content: 'text', + channels: 'C1234', // optionally share to a channel +}]); +expectAssignable>([{ + content: 'text', + channels: 'C1234', + thread_ts: '12345.678', // or even to a specific thread +}]); // files.comments.delete // -- sad path From 7efacf764b3bc67e04a642f060f41c4129d8e315 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 15 Nov 2023 14:59:36 -0500 Subject: [PATCH 067/122] fixes post-merge --- .../src/types/response/AppsManifestCreateResponse.ts | 2 +- .../src/types/response/AppsManifestDeleteResponse.ts | 2 +- .../src/types/response/AppsManifestExportResponse.ts | 2 +- .../src/types/response/AppsManifestUpdateResponse.ts | 2 +- .../src/types/response/AppsManifestValidateResponse.ts | 2 +- .../src/types/response/ToolingTokensRotateResponse.ts | 2 +- packages/web-api/test/types/methods/files.test-d.ts | 10 ++++------ 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/web-api/src/types/response/AppsManifestCreateResponse.ts b/packages/web-api/src/types/response/AppsManifestCreateResponse.ts index 98f60070f..d5e681ce6 100644 --- a/packages/web-api/src/types/response/AppsManifestCreateResponse.ts +++ b/packages/web-api/src/types/response/AppsManifestCreateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsManifestCreateResponse = WebAPICallResult & { app_id?: string; credentials?: Credentials; diff --git a/packages/web-api/src/types/response/AppsManifestDeleteResponse.ts b/packages/web-api/src/types/response/AppsManifestDeleteResponse.ts index 36aa5c73d..d6cd553d2 100644 --- a/packages/web-api/src/types/response/AppsManifestDeleteResponse.ts +++ b/packages/web-api/src/types/response/AppsManifestDeleteResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsManifestDeleteResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/types/response/AppsManifestExportResponse.ts b/packages/web-api/src/types/response/AppsManifestExportResponse.ts index b7b005eda..5693a0026 100644 --- a/packages/web-api/src/types/response/AppsManifestExportResponse.ts +++ b/packages/web-api/src/types/response/AppsManifestExportResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsManifestExportResponse = WebAPICallResult & { error?: string; manifest?: Manifest; diff --git a/packages/web-api/src/types/response/AppsManifestUpdateResponse.ts b/packages/web-api/src/types/response/AppsManifestUpdateResponse.ts index 7b0498454..14134a688 100644 --- a/packages/web-api/src/types/response/AppsManifestUpdateResponse.ts +++ b/packages/web-api/src/types/response/AppsManifestUpdateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsManifestUpdateResponse = WebAPICallResult & { app_id?: string; error?: string; diff --git a/packages/web-api/src/types/response/AppsManifestValidateResponse.ts b/packages/web-api/src/types/response/AppsManifestValidateResponse.ts index fb955dc86..0360c9cc4 100644 --- a/packages/web-api/src/types/response/AppsManifestValidateResponse.ts +++ b/packages/web-api/src/types/response/AppsManifestValidateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type AppsManifestValidateResponse = WebAPICallResult & { error?: string; errors?: Error[]; diff --git a/packages/web-api/src/types/response/ToolingTokensRotateResponse.ts b/packages/web-api/src/types/response/ToolingTokensRotateResponse.ts index 093f088d5..94e5b79a1 100644 --- a/packages/web-api/src/types/response/ToolingTokensRotateResponse.ts +++ b/packages/web-api/src/types/response/ToolingTokensRotateResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type ToolingTokensRotateResponse = WebAPICallResult & { error?: string; exp?: number; diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index e0d78cb8e..a24baafb9 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -107,13 +107,12 @@ expectAssignable>([{ content: 'text', // or file contents }]); expectAssignable>([{ + ...destinationChannels, // optionally share to one or more channels content: 'text', - channels: 'C1234', // optionally share to a channel }]); expectAssignable>([{ + ...destinationThreadChannels, // or even to a specific thread content: 'text', - channels: 'C1234', - thread_ts: '12345.678', // or even to a specific thread }]); // files.uploadV2 @@ -129,13 +128,12 @@ expectAssignable>([{ content: 'text', // or file contents... }]); expectAssignable>([{ + ...destinationChannels, // optionally share to one or more channels content: 'text', - channels: 'C1234', // optionally share to a channel }]); expectAssignable>([{ + ...destinationThreadChannels, // or even to a specific thread content: 'text', - channels: 'C1234', - thread_ts: '12345.678', // or even to a specific thread }]); // files.comments.delete From d2a788225542d39a41eba4896cbacbb9321d8276 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 15 Nov 2023 17:28:04 -0500 Subject: [PATCH 068/122] small refactor of files.* API arguments and finished types tests for these APIs. --- packages/web-api/src/types/request/files.ts | 8 +- .../test/types/methods/files.test-d.ts | 76 +++++++++++++++---- 2 files changed, 65 insertions(+), 19 deletions(-) diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index 10837b78b..ccaa26049 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -160,8 +160,7 @@ export interface FilesCommentsDeleteArguments extends FileArgument, TokenOverrid /** @description The ID of the comment to delete. */ id: string; } -// https://api.slack.com/methods/files.remote.add -export interface FilesRemoteAddArguments extends FileType, ExternalIDArgument, TokenOverridable { +interface SharedFile { /** @description Title of the file being shared. */ title: string; /** @description URL of the remote file. */ @@ -174,6 +173,9 @@ export interface FilesRemoteAddArguments extends FileType, ExternalIDArgument, T */ indexable_file_contents?: Buffer | Stream; } + +// https://api.slack.com/methods/files.remote.add +export interface FilesRemoteAddArguments extends SharedFile, FileType, ExternalIDArgument, TokenOverridable {} // Either the encoded file ID or the external ID must be used as an argument. type FileOrExternalID = (FileArgument & { external_id?: never; }) | (ExternalIDArgument & { file?: never; }); // https://api.slack.com/methods/files.remote.info @@ -192,4 +194,4 @@ export type FilesRemoteRemoveArguments = FileOrExternalID & TokenOverridable; // https://api.slack.com/methods/files.remote.share export type FilesRemoteShareArguments = Required & FileOrExternalID & TokenOverridable; // https://api.slack.com/methods/files.remote.update -export type FilesRemoteUpdateArguments = FileOrExternalID & TokenOverridable & FileType & Pick; +export type FilesRemoteUpdateArguments = Partial & FileOrExternalID & FileType & TokenOverridable; diff --git a/packages/web-api/test/types/methods/files.test-d.ts b/packages/web-api/test/types/methods/files.test-d.ts index a24baafb9..1e6675663 100644 --- a/packages/web-api/test/types/methods/files.test-d.ts +++ b/packages/web-api/test/types/methods/files.test-d.ts @@ -5,15 +5,6 @@ const web = new WebClient('TOKEN'); // Reusable files.* API partial argument objects for these tests const file = { id: 'F1234', title: 'Choose Boring Technology' }; -// -- File upload target/destination types: channels, threads or private files -// Some of these use a `channel_id` prop vs. a `channels` prop :/ -// ---- correct destinations -const destinationChannel = { channel_id: 'C1234' }; -const destinationThread = { ...destinationChannel, thread_ts: '1234.456' }; -const destinationChannels = { channels: 'C1234' }; // same as above but different property name -const destinationThreadChannels = { ...destinationChannels, thread_ts: '1234.456' }; -// ---- invalid destinations -const destinationThreadWithMissingChannel = { thread_ts: '1234.567' }; // files.completeUploadExternal // -- sad path @@ -21,7 +12,7 @@ expectError(web.files.completeUploadExternal()); // lacking argument expectError(web.files.completeUploadExternal({})); // empty argument expectError(web.files.completeUploadExternal({ files: [file], - ...destinationThreadWithMissingChannel, // has thread_ts but no channel + thread_ts: '1234.567', // has thread_ts but no channel })); expectError(web.files.completeUploadExternal({ files: [], // must specify at least one file @@ -33,11 +24,12 @@ expectAssignable>([{ }]); expectAssignable>([{ files: [file], - ...destinationChannel, // share to a channel + channel_id: 'C1234', // share to a channel }]); expectAssignable>([{ files: [file], - ...destinationThread, // share to a thread + channel_id: 'C1234', + thread_ts: '1234.567', // share to a thread }]); // files.delete @@ -107,11 +99,11 @@ expectAssignable>([{ content: 'text', // or file contents }]); expectAssignable>([{ - ...destinationChannels, // optionally share to one or more channels + channels: 'C1234', // optionally share to one or more channels content: 'text', }]); expectAssignable>([{ - ...destinationThreadChannels, // or even to a specific thread + channels: 'C1234', // or even to a specific thread content: 'text', }]); @@ -128,11 +120,12 @@ expectAssignable>([{ content: 'text', // or file contents... }]); expectAssignable>([{ - ...destinationChannels, // optionally share to one or more channels + channels: 'C1234', // optionally share to one or more channels content: 'text', }]); expectAssignable>([{ - ...destinationThreadChannels, // or even to a specific thread + channels: 'C1234', + thread_ts: '12345.67', // or even to a specific thread content: 'text', }]); @@ -177,3 +170,54 @@ expectAssignable>([{ expectAssignable>([{ file: 'F1234', }]); + +// files.remote.list +// -- sad path +expectError(web.files.remote.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // able to call it with empty argument + +// files.remote.remove +// -- sad path +expectError(web.files.remote.remove()); // lacking argument +expectError(web.files.remote.remove({})); // empty argument +expectError(web.files.remote.remove({ external_id: '1234', file: 'F1234' })); // either external ID, or file ID, but not both +// -- happy path +expectAssignable>([{ + external_id: '1234', +}]); +expectAssignable>([{ + file: 'F1234', +}]); + +// files.remote.share +// -- sad path +expectError(web.files.remote.share()); // lacking argument +expectError(web.files.remote.share({})); // empty argument +expectError(web.files.remote.share({ external_id: '1234', file: 'F1234' })); // either external ID, or file ID, but not both +expectError(web.files.remote.share({ channels: 'C1234' })); // missing one of external ID or file ID +// -- happy path +expectAssignable>([{ + channels: 'C123', + external_id: '1234', +}]); +expectAssignable>([{ + channels: 'C123', + file: 'F1234', +}]); + +// files.remote.update +// -- sad path +expectError(web.files.remote.update()); // lacking argument +expectError(web.files.remote.update({})); // empty argument +expectError(web.files.remote.update({ external_id: '1234', file: 'F1234' })); // either external ID, or file ID, but not both +expectError(web.files.remote.update({ title: 'Fear and Loathing in Las Vegas' })); // missing one of external ID or file ID +// -- happy path +expectAssignable>([{ + external_id: '1234', + title: 'Moby Dick', +}]); +expectAssignable>([{ + file: 'F1234', + external_url: 'https://someurl.com', +}]); From bb042dcc99838e00e4bcb6c56782c4314899f8a2 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 14:14:54 -0500 Subject: [PATCH 069/122] add type tests for views.* API arguments --- .../test/types/methods/views.test-d.ts | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 packages/web-api/test/types/methods/views.test-d.ts diff --git a/packages/web-api/test/types/methods/views.test-d.ts b/packages/web-api/test/types/methods/views.test-d.ts new file mode 100644 index 000000000..a0411ba30 --- /dev/null +++ b/packages/web-api/test/types/methods/views.test-d.ts @@ -0,0 +1,122 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// views.open +// -- sad path +expectError(web.views.open()); // lacking argument +expectError(web.views.open({})); // empty argument +expectError(web.views.open({ // missing interactivity_pointer or trigger_id + view: { + type: 'home', + blocks: [], + }, +})); +expectError(web.views.open({ // missing view + interactivity_pointer: '1234', +})); +expectError(web.views.open({ // missing view + trigger_id: '1234', +})); +// -- happy path +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + interactivity_pointer: '1234', // provide a view and interactivity pointer, or.. +}]); +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + trigger_id: '1234', // .. a trigger_id +}]); + +// views.push +// -- sad path +expectError(web.views.push()); // lacking argument +expectError(web.views.push({})); // empty argument +expectError(web.views.push({ // missing interactivity_pointer or trigger_id + view: { + type: 'home', + blocks: [], + }, +})); +expectError(web.views.push({ // missing view + interactivity_pointer: '1234', +})); +expectError(web.views.push({ // missing view + trigger_id: '1234', +})); +// -- happy path +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + interactivity_pointer: '1234', // provide a view and interactivity pointer, or.. +}]); +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + trigger_id: '1234', // .. a trigger_id +}]); + +// views.publish +// -- sad path +expectError(web.views.publish()); // lacking argument +expectError(web.views.publish({})); // empty argument +expectError(web.views.publish({ // missing user_id + view: { + type: 'home', + blocks: [], + }, +})); +expectError(web.views.publish({ // missing view + user_id: 'U1234', +})); +// -- happy path +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + user_id: 'U1234', // provide a view and user_id +}]); + +// views.update +// -- sad path +expectError(web.views.update()); // lacking argument +expectError(web.views.update({})); // empty argument +expectError(web.views.update({ // missing external_id or view_id + view: { + type: 'home', + blocks: [], + }, +})); +expectError(web.views.update({ // missing view + external_id: '1234', +})); +expectError(web.views.update({ // missing view + view_id: '1234', +})); +// -- happy path +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + external_id: '1234', // provide a view and view_id, or.. +}]); +expectAssignable>([{ + view: { + type: 'home', + blocks: [], + }, + view_id: '1234', // .. a view_id +}]); From 13f0b0efe3f2d3b9ca6a2996bf7f755c3746dcf6 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:01:57 -0500 Subject: [PATCH 070/122] add type tests for users.* methods --- .../test/types/methods/users.test-d.ts | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 packages/web-api/test/types/methods/users.test-d.ts diff --git a/packages/web-api/test/types/methods/users.test-d.ts b/packages/web-api/test/types/methods/users.test-d.ts new file mode 100644 index 000000000..9a1b9a26d --- /dev/null +++ b/packages/web-api/test/types/methods/users.test-d.ts @@ -0,0 +1,82 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// users.conversations +// -- sad path +expectError(web.users.conversations()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.deletePhoto +// -- sad path +expectError(web.users.deletePhoto()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.getPresence +// -- sad path +expectError(web.users.getPresence()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.identity +// -- sad path +expectError(web.users.identity()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.info +// -- sad path +expectError(web.users.info()); // lacking argument +expectError(web.users.info({})); // empty argument +// -- happy path +expectAssignable>([{ + user: 'U1234', // must specify a user +}]); + +// users.list +// -- sad path +expectError(web.users.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.lookupByEmail +// -- sad path +expectError(web.users.lookupByEmail()); // lacking argument +expectError(web.users.lookupByEmail({})); // empty argument +// -- happy path +expectAssignable>([{ + email: 'ceo@slack.com', // must specify an email +}]); + +// users.setPhoto +// -- sad path +expectError(web.users.setPhoto()); // lacking argument +expectError(web.users.setPhoto({})); // empty argument +// -- happy path +expectAssignable>([{ + image: Buffer.from([1]), // must specify an image +}]); + +// users.setPresence +// -- sad path +expectError(web.users.setPresence()); // lacking argument +expectError(web.users.setPresence({})); // empty argument +// -- happy path +expectAssignable>([{ + presence: 'auto', // must specify presence +}]); + +// users.profile.get +// -- sad path +expectError(web.users.profile.get()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional + +// users.profile.set +// -- sad path +expectError(web.users.profile.set()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all args are optional From a8c8dc537cb00d44d758044caed7f1cdff47e057 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:27:19 -0500 Subject: [PATCH 071/122] usergroups.update only requires `usergroup` parameter, all other are optional. added usergroups.* API type tests. --- .../web-api/src/types/request/usergroups.ts | 3 +- .../test/types/methods/usergroups.test-d.ts | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 packages/web-api/test/types/methods/usergroups.test-d.ts diff --git a/packages/web-api/src/types/request/usergroups.ts b/packages/web-api/src/types/request/usergroups.ts index 793722b0e..3cbdb1234 100644 --- a/packages/web-api/src/types/request/usergroups.ts +++ b/packages/web-api/src/types/request/usergroups.ts @@ -34,7 +34,8 @@ export interface UsergroupsListArguments extends TokenOverridable, OptionalTeamA include_users?: boolean; } // https://api.slack.com/methods/usergroups.update -export interface UsergroupsUpdateArguments extends TokenOverridable, OptionalTeamAssignable, UsergroupsCreateArguments { +export interface UsergroupsUpdateArguments extends TokenOverridable, OptionalTeamAssignable, + Partial { /** @description The encoded ID of the User Group to update. */ usergroup: string; } diff --git a/packages/web-api/test/types/methods/usergroups.test-d.ts b/packages/web-api/test/types/methods/usergroups.test-d.ts new file mode 100644 index 000000000..fd1746873 --- /dev/null +++ b/packages/web-api/test/types/methods/usergroups.test-d.ts @@ -0,0 +1,67 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// usergroups.create +// -- sad path +expectError(web.usergroups.create()); // lacking argument +expectError(web.usergroups.create({})); // empty argument +// -- happy path +expectAssignable>([{ + name: 'knights who say ni', // must specify name +}]); + +// usergroups.disable +// -- sad path +expectError(web.usergroups.disable()); // lacking argument +expectError(web.usergroups.disable({})); // empty argument +// -- happy path +expectAssignable>([{ + usergroup: 'Sg1234', // must specify usergroup +}]); + +// usergroups.enable +// -- sad path +expectError(web.usergroups.enable()); // lacking argument +expectError(web.usergroups.enable({})); // empty argument +// -- happy path +expectAssignable>([{ + usergroup: 'Sg1234', // must specify usergroup +}]); + +// usergroups.list +// -- sad path +expectError(web.usergroups.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional properties + +// usergroups.update +// -- sad path +expectError(web.usergroups.update()); // lacking argument +expectError(web.usergroups.update({})); // empty argument +// -- happy path +expectAssignable>([{ + usergroup: 'Sg1234', // must specify usergroup +}]); + +// usergroups.users.list +// -- sad path +expectError(web.usergroups.users.list()); // lacking argument +expectError(web.usergroups.users.list({})); // empty argument +// -- happy path +expectAssignable>([{ + usergroup: 'Sg1234', // must specify usergroup +}]); + +// usergroups.users.update +// -- sad path +expectError(web.usergroups.users.update()); // lacking argument +expectError(web.usergroups.users.update({})); // empty argument +expectError(web.usergroups.users.update({ usergroup: 'Sg1234' })); // missing users +expectError(web.usergroups.users.update({ users: 'U1,U2,U3' })); // missing usergroups +// -- happy path +expectAssignable>([{ + usergroup: 'Sg1234', + users: 'U1,U2,U3', // must specify usergroup and users +}]); From 524493dc564e7057e34b1a9861af72747e38ab1a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:33:19 -0500 Subject: [PATCH 072/122] new file for tooling.* API argument types, test types for it too. JSDoced the API method. --- packages/web-api/src/methods.ts | 12 +++++------- packages/web-api/src/types/request/tooling.ts | 5 +++++ .../web-api/test/types/methods/tooling.test-d.ts | 13 +++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 packages/web-api/src/types/request/tooling.ts create mode 100644 packages/web-api/test/types/methods/tooling.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 56fdf8445..0e384aa7a 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -241,6 +241,7 @@ import type { TokenOverridable, LocaleAware, OptionalTeamAssignable, CursorPagin import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; +import type { ToolingTokensRotateArguments } from './types/request/tooling'; import type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './types/request/search'; import type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './types/request/usergroups'; import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './types/request/team'; @@ -1025,6 +1026,10 @@ export abstract class Methods extends EventEmitter { public readonly tooling = { tokens: { + /** + * @description Exchanges a refresh token for a new app configuration token. + * @see {@link https://api.slack.com/methods/tooling.tokens.rotate `tooling.tokens.rotate` API reference}. + */ rotate: bindApiCall(this, 'tooling.tokens.rotate'), }, }; @@ -2250,11 +2255,4 @@ export interface EmojiListArguments extends TokenOverridable { include_categories?: boolean; } -/* - * `tooling.*` - */ -export interface ToolingTokensRotateArguments extends TokenOverridable { - refresh_token: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/tooling.ts b/packages/web-api/src/types/request/tooling.ts new file mode 100644 index 000000000..5b53e452e --- /dev/null +++ b/packages/web-api/src/types/request/tooling.ts @@ -0,0 +1,5 @@ +// https://api.slack.com/methods/tooling.tokens.rotate +export interface ToolingTokensRotateArguments { + /** @description The `xoxe` refresh token that was issued along with the old app configuration token. */ + refresh_token: string; +} diff --git a/packages/web-api/test/types/methods/tooling.test-d.ts b/packages/web-api/test/types/methods/tooling.test-d.ts new file mode 100644 index 000000000..3eb7b9770 --- /dev/null +++ b/packages/web-api/test/types/methods/tooling.test-d.ts @@ -0,0 +1,13 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// tooling.tokens.rotate +// -- sad path +expectError(web.tooling.tokens.rotate()); // lacking argument +expectError(web.tooling.tokens.rotate({})); // empty argument +// -- happy path +expectAssignable>([{ + refresh_token: '1234', // must specify refresh_token +}]); From 3f5a661c8da8c0122678e28ca8bfbb63067999f3 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:38:20 -0500 Subject: [PATCH 073/122] team.* API argument type tests. --- .../web-api/test/types/methods/team.test-d.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 packages/web-api/test/types/methods/team.test-d.ts diff --git a/packages/web-api/test/types/methods/team.test-d.ts b/packages/web-api/test/types/methods/team.test-d.ts new file mode 100644 index 000000000..d332fb684 --- /dev/null +++ b/packages/web-api/test/types/methods/team.test-d.ts @@ -0,0 +1,40 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// team.accessLogs +// -- sad path +expectError(web.team.accessLogs()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// team.billableInfo +// -- sad path +expectError(web.team.billableInfo()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// team.billing.info +// -- sad path +expectError(web.team.billing.info()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// team.integrationLogs +// -- sad path +expectError(web.team.integrationLogs()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// team.profile.get +// -- sad path +expectError(web.team.profile.get()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// team.preferences.list +// -- sad path +expectError(web.team.preferences.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments From 0bdd2af21ddeef4e7446d20067ab421541f0c1b9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:42:01 -0500 Subject: [PATCH 074/122] search sort and sort dir args are optional, actually (thank you, tests). added type tests for search.* APIs --- packages/web-api/src/types/request/search.ts | 4 +-- .../test/types/methods/search.test-d.ts | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 packages/web-api/test/types/methods/search.test-d.ts diff --git a/packages/web-api/src/types/request/search.ts b/packages/web-api/src/types/request/search.ts index 15341c8bf..62127c50a 100644 --- a/packages/web-api/src/types/request/search.ts +++ b/packages/web-api/src/types/request/search.ts @@ -9,9 +9,9 @@ interface Searchable extends OptionalTeamAssignable { */ highlight?: boolean; /** @description Return matches sorted by either `score` or `timestamp`. Defaults to `score`. */ - sort: 'score' | 'timestamp'; + sort?: 'score' | 'timestamp'; /** @description Change sort direction to ascending (`asc`) or descending (`desc`). Defaults to `desc`. */ - sort_dir: 'asc' | 'desc'; + sort_dir?: 'asc' | 'desc'; } // https://api.slack.com/methods/search.all diff --git a/packages/web-api/test/types/methods/search.test-d.ts b/packages/web-api/test/types/methods/search.test-d.ts new file mode 100644 index 000000000..c675690b1 --- /dev/null +++ b/packages/web-api/test/types/methods/search.test-d.ts @@ -0,0 +1,31 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// search.all +// -- sad path +expectError(web.search.all()); // lacking argument +expectError(web.search.all({})); // empty argument +// -- happy path +expectAssignable>([{ + query: '1234', // must specify query +}]); + +// search.files +// -- sad path +expectError(web.search.files()); // lacking argument +expectError(web.search.files({})); // empty argument +// -- happy path +expectAssignable>([{ + query: '1234', // must specify query +}]); + +// search.messages +// -- sad path +expectError(web.search.messages()); // lacking argument +expectError(web.search.messages({})); // empty argument +// -- happy path +expectAssignable>([{ + query: '1234', // must specify query +}]); From 75a1e956600e35763960cd51c8df7facdd1cd0b3 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Nov 2023 16:45:58 -0500 Subject: [PATCH 075/122] type tests for rtm.* APIs --- .../web-api/test/types/methods/rtm.test-d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/web-api/test/types/methods/rtm.test-d.ts diff --git a/packages/web-api/test/types/methods/rtm.test-d.ts b/packages/web-api/test/types/methods/rtm.test-d.ts new file mode 100644 index 000000000..1aa91a7ce --- /dev/null +++ b/packages/web-api/test/types/methods/rtm.test-d.ts @@ -0,0 +1,16 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// rtm.connect +// -- sad path +expectError(web.rtm.connect()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments + +// rtm.start +// -- sad path +expectError(web.rtm.start()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional arguments From 1db4e03e4344b1a99632fdd89845f1942aa463ca Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 14:55:14 -0500 Subject: [PATCH 076/122] added reminders.* API type tests. --- .../test/types/methods/reminders.test-d.ts | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 packages/web-api/test/types/methods/reminders.test-d.ts diff --git a/packages/web-api/test/types/methods/reminders.test-d.ts b/packages/web-api/test/types/methods/reminders.test-d.ts new file mode 100644 index 000000000..a193a4e4e --- /dev/null +++ b/packages/web-api/test/types/methods/reminders.test-d.ts @@ -0,0 +1,79 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// reminders.add +// -- sad path +expectError(web.reminders.add()); // lacking argument +expectError(web.reminders.add({})); // empty argument +expectError(web.reminders.add({ text: 'take out the garbage' })); // missing time +expectError(web.reminders.add({ time: 'mondays at 6pm' })); // missing text +expectError(web.reminders.add({ + time: '6pm', + text: 'take out the garbage', + recurrence: { + frequency: 'weekly', // missing weekdays property + }, +})); +expectError(web.reminders.add({ + time: '6pm', + text: 'take out the garbage', + recurrence: { + frequency: 'weekly', // missing weekdays property + weekdays: [], // must provide at least one weekday if frequency=weekly + }, +})); +// -- happy path +expectAssignable>([{ + text: 'floss your teeth', + time: 'every damn day', +}]); // must provide at a minimum time and text +expectAssignable>([{ + text: 'take out the garbage', + time: '6pm', // must provide at a minimum time and text + recurrence: { + frequency: 'weekly', + weekdays: ['monday'], // and weekly recurrence needs at least one weekday + }, +}]); +expectAssignable>([{ + text: 'call mom for her birthday', + time: 'April 8th', // must provide at a minimum time and text + recurrence: { + frequency: 'yearly', + }, +}]); + +// reminders.complete +// -- sad path +expectError(web.reminders.complete()); // lacking argument +expectError(web.reminders.complete({})); // empty argument +// -- happy path +expectAssignable>([{ + reminder: 'R1234', // needs the reminder ID +}]); + +// reminders.delete +// -- sad path +expectError(web.reminders.delete()); // lacking argument +expectError(web.reminders.delete({})); // empty argument +// -- happy path +expectAssignable>([{ + reminder: 'R1234', // needs the reminder ID +}]); + +// reminders.info +// -- sad path +expectError(web.reminders.info()); // lacking argument +expectError(web.reminders.info({})); // empty argument +// -- happy path +expectAssignable>([{ + reminder: 'R1234', // needs the reminder ID +}]); + +// reminders.list +// -- sad path +expectError(web.reminders.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args From 4bea00680e2811ec2912cecd4af70109b0a297fd Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 15:15:36 -0500 Subject: [PATCH 077/122] added reactions.* API type tests. --- .../test/types/methods/reactions.test-d.ts | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 packages/web-api/test/types/methods/reactions.test-d.ts diff --git a/packages/web-api/test/types/methods/reactions.test-d.ts b/packages/web-api/test/types/methods/reactions.test-d.ts new file mode 100644 index 000000000..1251d3540 --- /dev/null +++ b/packages/web-api/test/types/methods/reactions.test-d.ts @@ -0,0 +1,96 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// Reusable reactions.* API partial argument objects for these tests +const message = { channel: 'C1234', timestamp: '1234.567' }; + +// reactions.add +// -- sad path +expectError(web.reactions.add()); // lacking argument +expectError(web.reactions.add({})); // empty argument +expectError(web.reactions.add({ + ...message, // missing `name` +})); +expectError(web.reactions.add({ + name: 'smile', // missing `channel` and `timestamp` +})); +expectError(web.reactions.add({ + name: 'smile', // missing `timestamp` + channel: 'C1234', +})); +expectError(web.reactions.add({ + name: 'smile', // missing `channel` + timestamp: '1234.567', +})); +// -- happy path +expectAssignable>([{ + ...message, + name: 'smile', +}]); + +// reactions.get +// -- sad path +expectError(web.reactions.get()); // lacking argument +expectError(web.reactions.get({})); // empty argument +expectError(web.reactions.get({ + channel: 'C1234', // missing timestamp +})); +expectError(web.reactions.get({ + timestamp: '1234.567', // missing channel +})); +// -- happy path +expectAssignable>([{ + ...message, // get reactions for a message +}]); +expectAssignable>([{ + file: 'F1234', // or a file +}]); +expectAssignable>([{ + file_comment: 'Fc1234', // or a file comment +}]); + +// reactions.list +// -- sad path +expectError(web.reactions.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// reactions.remove +// -- sad path +expectError(web.reactions.remove()); // lacking argument +expectError(web.reactions.remove({})); // empty argument +expectError(web.reactions.remove({ + ...message, // missing `name` +})); +expectError(web.reactions.remove({ + name: 'smile', // missing `channel` and `timestamp`, or `file`, or `file_comment` +})); +expectError(web.reactions.remove({ + name: 'smile', // missing `timestamp` + channel: 'C1234', +})); +expectError(web.reactions.remove({ + name: 'smile', // missing `channel` + timestamp: '1234.567', +})); +expectError(web.reactions.remove({ + file: 'F1234', // missing name +})); +expectError(web.reactions.remove({ + file_comment: 'Fc1234', // missing name +})); +// -- happy path +expectAssignable>([{ + ...message, + name: 'smile', // remove a reaction from a message +}]); +expectAssignable>([{ + file: 'F1234', + name: 'smile', // remove a reaction from a file +}]); +expectAssignable>([{ + file_comment: 'Fc1234', + name: 'smile', // remove a reaction from a file comment +}]); From c3af002e42f929949d8fb605b239be9e5e47f58b Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 15:21:45 -0500 Subject: [PATCH 078/122] added pins.* API type tests. --- .../web-api/test/types/methods/pins.test-d.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 packages/web-api/test/types/methods/pins.test-d.ts diff --git a/packages/web-api/test/types/methods/pins.test-d.ts b/packages/web-api/test/types/methods/pins.test-d.ts new file mode 100644 index 000000000..49d928765 --- /dev/null +++ b/packages/web-api/test/types/methods/pins.test-d.ts @@ -0,0 +1,46 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// Reusable reactions.* API partial argument objects for these tests +const message = { channel: 'C1234', timestamp: '1234.567' }; + +// pins.add +// -- sad path +expectError(web.pins.add()); // lacking argument +expectError(web.pins.add({})); // empty argument +expectError(web.pins.add({ + channel: 'C1234', // missing timestamp +})); +expectError(web.pins.add({ + timestamp: '1234.567', // missing `channel` +})); +// -- happy path +expectAssignable>([{ + ...message, +}]); + +// pins.list +// -- sad path +expectError(web.pins.list()); // lacking argument +expectError(web.pins.list({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: message.channel, +}]); + +// pins.remove +// -- sad path +expectError(web.pins.remove()); // lacking argument +expectError(web.pins.remove({})); // empty argument +expectError(web.pins.remove({ + channel: 'C1234', // missing timestamp +})); +expectError(web.pins.remove({ + timestamp: '1234.567', // missing `channel` +})); +// -- happy path +expectAssignable>([{ + ...message, +}]); From 5a1a3548f75a26e397f3d6634f3826d6aaa780f3 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 15:25:25 -0500 Subject: [PATCH 079/122] added openid.* API type tests. --- .../test/types/methods/openid.test-d.ts | 28 +++++++++++++++++++ .../web-api/test/types/methods/pins.test-d.ts | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 packages/web-api/test/types/methods/openid.test-d.ts diff --git a/packages/web-api/test/types/methods/openid.test-d.ts b/packages/web-api/test/types/methods/openid.test-d.ts new file mode 100644 index 000000000..2e1f748aa --- /dev/null +++ b/packages/web-api/test/types/methods/openid.test-d.ts @@ -0,0 +1,28 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// Reusable openid.* API partial argument objects for these tests +const creds = { client_id: 'C1234', client_secret: '1234.567' }; + +// openid.connect.token +// -- sad path +expectError(web.openid.connect.token()); // lacking argument +expectError(web.openid.connect.token({})); // empty argument +expectError(web.openid.connect.token({ + client_id: 'C1234', // missing client_secret +})); +expectError(web.openid.connect.token({ + client_secret: '1234.567', // missing `client_id` +})); +// -- happy path +expectAssignable>([{ + ...creds, +}]); + +// openid.connect.userInfo +// -- sad path +expectError(web.openid.connect.userInfo()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args diff --git a/packages/web-api/test/types/methods/pins.test-d.ts b/packages/web-api/test/types/methods/pins.test-d.ts index 49d928765..3173134b1 100644 --- a/packages/web-api/test/types/methods/pins.test-d.ts +++ b/packages/web-api/test/types/methods/pins.test-d.ts @@ -3,7 +3,7 @@ import { WebClient } from '../../../src/WebClient'; const web = new WebClient('TOKEN'); -// Reusable reactions.* API partial argument objects for these tests +// Reusable pins.* API partial argument objects for these tests const message = { channel: 'C1234', timestamp: '1234.567' }; // pins.add From cd81272d605c276f8c8a933ca8493c1a1b43c5bd Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 15:27:35 -0500 Subject: [PATCH 080/122] added oauth.* API type tests. --- .../test/types/methods/oauth.test-d.ts | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 packages/web-api/test/types/methods/oauth.test-d.ts diff --git a/packages/web-api/test/types/methods/oauth.test-d.ts b/packages/web-api/test/types/methods/oauth.test-d.ts new file mode 100644 index 000000000..1e1ec23b8 --- /dev/null +++ b/packages/web-api/test/types/methods/oauth.test-d.ts @@ -0,0 +1,52 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// Reusable openid.* API partial argument objects for these tests +const creds = { client_id: 'C1234', client_secret: '1234.567' }; + +// oauth.access +// -- sad path +expectError(web.oauth.access()); // lacking argument +expectError(web.oauth.access({})); // empty argument +expectError(web.oauth.access({ + client_id: 'C1234', // missing client_secret +})); +expectError(web.oauth.access({ + client_secret: '1234.567', // missing `client_id` +})); +// -- happy path +expectAssignable>([{ + ...creds, +}]); + +// oauth.v2.access +// -- sad path +expectError(web.oauth.v2.access()); // lacking argument +expectError(web.oauth.v2.access({})); // empty argument +expectError(web.oauth.v2.access({ + client_id: 'C1234', // missing client_secret +})); +expectError(web.oauth.v2.access({ + client_secret: '1234.567', // missing `client_id` +})); +// -- happy path +expectAssignable>([{ + ...creds, +}]); + +// oauth.v2.exchange +// -- sad path +expectError(web.oauth.v2.exchange()); // lacking argument +expectError(web.oauth.v2.exchange({})); // empty argument +expectError(web.oauth.v2.exchange({ + client_id: 'C1234', // missing client_secret +})); +expectError(web.oauth.v2.exchange({ + client_secret: '1234.567', // missing `client_id` +})); +// -- happy path +expectAssignable>([{ + ...creds, +}]); From 2ae40330d03e71a37cec0a7816b53059f4390d76 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 17 Nov 2023 15:29:24 -0500 Subject: [PATCH 081/122] added migration.* API type tests. --- .../web-api/test/types/methods/migration.test-d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/web-api/test/types/methods/migration.test-d.ts diff --git a/packages/web-api/test/types/methods/migration.test-d.ts b/packages/web-api/test/types/methods/migration.test-d.ts new file mode 100644 index 000000000..420eaba04 --- /dev/null +++ b/packages/web-api/test/types/methods/migration.test-d.ts @@ -0,0 +1,13 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// migration.exchange +// -- sad path +expectError(web.migration.exchange()); // lacking argument +expectError(web.migration.exchange({})); // empty argument +// -- happy path +expectAssignable>([{ + users: 'U1234', +}]); From a50ae8ed2931f7c16aacfd9f13dea3e005816391 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 20 Nov 2023 12:37:10 -0500 Subject: [PATCH 082/122] JSdoc, test types and separate request argument type file for emoji.list API --- packages/web-api/src/methods.ts | 13 +++++-------- packages/web-api/src/types/request/emoji.ts | 6 ++++++ packages/web-api/test/types/methods/emoji.test-d.ts | 10 ++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 packages/web-api/src/types/request/emoji.ts create mode 100644 packages/web-api/test/types/methods/emoji.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 0e384aa7a..42f7c6aba 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -254,6 +254,7 @@ import type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from import type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArguments } from './types/request/oauth'; import type { MigrationExchangeArguments } from './types/request/migration'; import type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, FilesRevokePublicURLArguments, FilesSharedPublicURLArguments, FilesUploadArguments, FilesUploadV2Arguments, FilesCompleteUploadExternalArguments, FilesGetUploadURLExternalArguments, FilesCommentsDeleteArguments, FilesRemoteUpdateArguments, FilesRemoteRemoveArguments, FilesRemoteShareArguments, FilesRemoteListArguments, FilesRemoteInfoArguments, FilesRemoteAddArguments } from './types/request/files'; +import type { EmojiListArguments } from './types/request/emoji'; /** * Generic method definition @@ -729,6 +730,10 @@ export abstract class Methods extends EventEmitter { }; public readonly emoji = { + /** + * @description Lists custom emoji for a team. + * @see {@link https://api.slack.com/methods/emoji.list `emoji.list` API reference}. + */ list: bindApiCall(this, 'emoji.list'), }; @@ -2247,12 +2252,4 @@ export interface DndTeamInfoArguments extends TokenOverridable, OptionalTeamAssi users: string; // comma-separated list of users } -/* - * `emoji.*` - */ -// https://api.slack.com/methods/emoji.list -export interface EmojiListArguments extends TokenOverridable { - include_categories?: boolean; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/emoji.ts b/packages/web-api/src/types/request/emoji.ts new file mode 100644 index 000000000..3f59549bd --- /dev/null +++ b/packages/web-api/src/types/request/emoji.ts @@ -0,0 +1,6 @@ +import { TokenOverridable } from './common'; +// https://api.slack.com/methods/emoji.list +export interface EmojiListArguments extends TokenOverridable { + /** @description Include a list of categories for Unicode emoji and the emoji in each category. */ + include_categories?: boolean; +} diff --git a/packages/web-api/test/types/methods/emoji.test-d.ts b/packages/web-api/test/types/methods/emoji.test-d.ts new file mode 100644 index 000000000..11b603657 --- /dev/null +++ b/packages/web-api/test/types/methods/emoji.test-d.ts @@ -0,0 +1,10 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// emoji.list +// -- sad path +expectError(web.emoji.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args From d887ef13df79b5ca639630df5128f8a57c35d109 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 20 Nov 2023 13:06:39 -0500 Subject: [PATCH 083/122] JSdoc, test types and separate request argument type file for dnd.* APIs --- packages/web-api/src/methods.ts | 41 ++++++++++--------- packages/web-api/src/types/request/dnd.ts | 21 ++++++++++ .../web-api/test/types/methods/dnd.test-d.ts | 40 ++++++++++++++++++ 3 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 packages/web-api/src/types/request/dnd.ts create mode 100644 packages/web-api/test/types/methods/dnd.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 42f7c6aba..2b65f42f6 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -255,6 +255,7 @@ import type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArgum import type { MigrationExchangeArguments } from './types/request/migration'; import type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, FilesRevokePublicURLArguments, FilesSharedPublicURLArguments, FilesUploadArguments, FilesUploadV2Arguments, FilesCompleteUploadExternalArguments, FilesGetUploadURLExternalArguments, FilesCommentsDeleteArguments, FilesRemoteUpdateArguments, FilesRemoteRemoveArguments, FilesRemoteShareArguments, FilesRemoteListArguments, FilesRemoteInfoArguments, FilesRemoteAddArguments } from './types/request/files'; import type { EmojiListArguments } from './types/request/emoji'; +import type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSetSnoozeArguments, DndTeamInfoArguments } from './types/request/dnd'; /** * Generic method definition @@ -722,10 +723,30 @@ export abstract class Methods extends EventEmitter { }; public readonly dnd = { + /** + * @description Ends the current user's Do Not Disturb session immediately. + * @see {@link https://api.slack.com/methods/dnd.endDnd `dnd.endDnd` API reference}. + */ endDnd: bindApiCall(this, 'dnd.endDnd'), + /** + * @description Ends the current user's snooze mode immediately. + * @see {@link https://api.slack.com/methods/dnd.endSnooze `dnd.endSnooze` API reference}. + */ endSnooze: bindApiCall(this, 'dnd.endSnooze'), + /** + * @description Retrieves a user's current Do Not Disturb status. + * @see {@link https://api.slack.com/methods/dnd.info `dnd.info` API reference}. + */ info: bindApiCall(this, 'dnd.info'), + /** + * @description Turns on Do Not Disturb mode for the current user, or changes its duration. + * @see {@link https://api.slack.com/methods/dnd.setSnooze `dnd.setSnooze` API reference}. + */ setSnooze: bindApiCall(this, 'dnd.setSnooze'), + /** + * @description Retrieves the Do Not Disturb status for up to 50 users on a team. + * @see {@link https://api.slack.com/methods/dnd.teamInfo `dnd.teamInfo` API reference}. + */ teamInfo: bindApiCall(this, 'dnd.teamInfo'), }; @@ -2232,24 +2253,4 @@ export interface DialogOpenArguments extends TokenOverridable { dialog: Dialog; } -/* - * `dnd.*` - */ -// https://api.slack.com/methods/dnd.endDnd -export interface DndEndDndArguments extends TokenOverridable { } -// https://api.slack.com/methods/dnd.endSnooze -export interface DndEndSnoozeArguments extends TokenOverridable { } -// https://api.slack.com/methods/dnd.info -export interface DndInfoArguments extends TokenOverridable, OptionalTeamAssignable { - user?: string; -} -// https://api.slack.com/methods/dnd.setSnooze -export interface DndSetSnoozeArguments extends TokenOverridable { - num_minutes: number; -} -// https://api.slack.com/methods/dnd.teamInfo -export interface DndTeamInfoArguments extends TokenOverridable, OptionalTeamAssignable { - users: string; // comma-separated list of users -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/dnd.ts b/packages/web-api/src/types/request/dnd.ts new file mode 100644 index 000000000..81f66ebc9 --- /dev/null +++ b/packages/web-api/src/types/request/dnd.ts @@ -0,0 +1,21 @@ +import { OptionalTeamAssignable, TokenOverridable } from './common'; + +// https://api.slack.com/methods/dnd.endDnd +export interface DndEndDndArguments extends TokenOverridable { } +// https://api.slack.com/methods/dnd.endSnooze +export interface DndEndSnoozeArguments extends TokenOverridable { } +// https://api.slack.com/methods/dnd.info +export interface DndInfoArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description User to fetch status for (defaults to authed user). */ + user?: string; +} +// https://api.slack.com/methods/dnd.setSnooze +export interface DndSetSnoozeArguments extends TokenOverridable { + /** @description Number of minutes, from now, to snooze until. */ + num_minutes: number; +} +// https://api.slack.com/methods/dnd.teamInfo +export interface DndTeamInfoArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description Comma-separated list of users to fetch Do Not Disturb status for. */ + users: string; +} diff --git a/packages/web-api/test/types/methods/dnd.test-d.ts b/packages/web-api/test/types/methods/dnd.test-d.ts new file mode 100644 index 000000000..a7244d258 --- /dev/null +++ b/packages/web-api/test/types/methods/dnd.test-d.ts @@ -0,0 +1,40 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// dnd.endDnd +// -- sad path +expectError(web.dnd.endDnd()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// dnd.endSnooze +// -- sad path +expectError(web.dnd.endSnooze()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// dnd.info +// -- sad path +expectError(web.dnd.info()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// dnd.setSnooze +// -- sad path +expectError(web.dnd.setSnooze()); // lacking argument +expectError(web.dnd.setSnooze({})); // empty argument +// -- happy path +expectAssignable>([{ + num_minutes: 1, +}]); + +// dnd.teamInfo +// -- sad path +expectError(web.dnd.teamInfo()); // lacking argument +expectError(web.dnd.teamInfo({})); // empty argument +// -- happy path +expectAssignable>([{ + users: 'U1234', +}]); From 4d8329306a0427f25bfcfc3423f840645cca94c3 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 20 Nov 2023 14:47:36 -0500 Subject: [PATCH 084/122] JSdoc, test types and separate request argument type file for dialog.* APIs --- packages/web-api/src/methods.ts | 16 +++++------- packages/web-api/src/types/request/dialog.ts | 10 +++++++ .../test/types/methods/dialog.test-d.ts | 26 +++++++++++++++++++ 3 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 packages/web-api/src/types/request/dialog.ts create mode 100644 packages/web-api/test/types/methods/dialog.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2b65f42f6..1f5e61f3f 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,4 +1,4 @@ -import { Dialog, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; +import type { KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; // Response types @@ -256,6 +256,7 @@ import type { MigrationExchangeArguments } from './types/request/migration'; import type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, FilesRevokePublicURLArguments, FilesSharedPublicURLArguments, FilesUploadArguments, FilesUploadV2Arguments, FilesCompleteUploadExternalArguments, FilesGetUploadURLExternalArguments, FilesCommentsDeleteArguments, FilesRemoteUpdateArguments, FilesRemoteRemoveArguments, FilesRemoteShareArguments, FilesRemoteListArguments, FilesRemoteInfoArguments, FilesRemoteAddArguments } from './types/request/files'; import type { EmojiListArguments } from './types/request/emoji'; import type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSetSnoozeArguments, DndTeamInfoArguments } from './types/request/dnd'; +import type { DialogOpenArguments } from './types/request/dialog'; /** * Generic method definition @@ -719,6 +720,10 @@ export abstract class Methods extends EventEmitter { }; public readonly dialog = { + /** + * @description Open a dialog with a user. + * @see {@link https://api.slack.com/methods/dialog.open `dialog.open` API reference}. + */ open: bindApiCall(this, 'dialog.open'), }; @@ -2244,13 +2249,4 @@ export interface ConversationsUnarchiveArguments extends TokenOverridable { channel: string; } -/* - * `dialog.*` - */ -// https://api.slack.com/methods/dialog.open -export interface DialogOpenArguments extends TokenOverridable { - trigger_id: string; - dialog: Dialog; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/dialog.ts b/packages/web-api/src/types/request/dialog.ts new file mode 100644 index 000000000..ec9e33f26 --- /dev/null +++ b/packages/web-api/src/types/request/dialog.ts @@ -0,0 +1,10 @@ +import type { Dialog } from '@slack/types'; +import type { TokenOverridable } from './common'; + +// https://api.slack.com/methods/dialog.open +export interface DialogOpenArguments extends TokenOverridable { + /** @description Exchange a trigger to post to the user. */ + trigger_id: string; + /** @description The dialog definition. */ + dialog: Dialog; +} diff --git a/packages/web-api/test/types/methods/dialog.test-d.ts b/packages/web-api/test/types/methods/dialog.test-d.ts new file mode 100644 index 000000000..2c9aaf457 --- /dev/null +++ b/packages/web-api/test/types/methods/dialog.test-d.ts @@ -0,0 +1,26 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +const dialog = { + title: 'Test', + callback_id: 'test', + elements: [], +}; + +// dialog.open +// -- sad path +expectError(web.dialog.open()); // lacking argument +expectError(web.dialog.open({})); // empty argument +expectError(web.dialog.open({ + trigger_id: '1234.566', // missing `dialog` +})); +expectError(web.dialog.open({ + dialog, // missing `trigger_id` +})); +// -- happy path +expectAssignable>([{ + trigger_id: '1234.56', + dialog, +}]); From 2ffa1bdf731d0c2c8cf9d901627276e1be3eb968 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 20 Nov 2023 16:41:53 -0500 Subject: [PATCH 085/122] JSdoc, test types and separate request argument type file for conversation.* APIs --- packages/web-api/src/methods.ts | 218 ++++++------- .../src/types/request/conversations.ts | 164 ++++++++++ .../types/methods/conversations.test-d.ts | 290 ++++++++++++++++++ 3 files changed, 545 insertions(+), 127 deletions(-) create mode 100644 packages/web-api/src/types/request/conversations.ts create mode 100644 packages/web-api/test/types/methods/conversations.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1f5e61f3f..7f89af558 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -237,7 +237,7 @@ import type { AdminAppsConfigSetResponse, } from './types/response'; // Request types -import type { TokenOverridable, LocaleAware, OptionalTeamAssignable, CursorPaginationEnabled, TimelinePaginationEnabled } from './types/request/common'; +import type { TokenOverridable, OptionalTeamAssignable, CursorPaginationEnabled } from './types/request/common'; import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; @@ -257,6 +257,7 @@ import type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, File import type { EmojiListArguments } from './types/request/emoji'; import type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSetSnoozeArguments, DndTeamInfoArguments } from './types/request/dnd'; import type { DialogOpenArguments } from './types/request/dialog'; +import type { ConversationsAcceptSharedInviteArguments, ConversationsApproveSharedInviteArguments, ConversationsArchiveArguments, ConversationsCloseArguments, ConversationsCreateArguments, ConversationsDeclineSharedInviteArguments, ConversationsHistoryArguments, ConversationsInfoArguments, ConversationsInviteArguments, ConversationsInviteSharedArguments, ConversationsJoinArguments, ConversationsKickArguments, ConversationsLeaveArguments, ConversationsListArguments, ConversationsListConnectInvitesArguments, ConversationsMarkArguments, ConversationsMembersArguments, ConversationsOpenArguments, ConversationsRenameArguments, ConversationsRepliesArguments, ConversationsSetPurposeArguments, ConversationsSetTopicArguments, ConversationsUnarchiveArguments } from './types/request/conversations'; /** * Generic method definition @@ -669,46 +670,135 @@ export abstract class Methods extends EventEmitter { }; public readonly conversations = { + /** + * @description Accepts an invitation to a Slack Connect channel. + * @see {@link https://api.slack.com/methods/conversations.acceptSharedInvite `conversations.acceptSharedInvite` API reference}. + */ acceptSharedInvite: bindApiCall( this, 'conversations.acceptSharedInvite', ), + /** + * @description Approves an invitation to a Slack Connect channel. + * @see {@link https://api.slack.com/methods/conversations.approveSharedInvite `conversations.approveSharedInvite` API reference}. + */ approveSharedInvite: bindApiCall( this, 'conversations.approveSharedInvite', ), + /** + * @description Archives a conversation. + * @see {@link https://api.slack.com/methods/conversations.archive `conversations.archive` API reference}. + */ archive: bindApiCall(this, 'conversations.archive'), + /** + * @description Closes a direct message or multi-person direct message. + * @see {@link https://api.slack.com/methods/conversations.close `conversations.close` API reference}. + */ close: bindApiCall(this, 'conversations.close'), + /** + * @description Initiates a public or private channel-based conversation. + * @see {@link https://api.slack.com/methods/conversations.create `conversations.create` API reference}. + */ create: bindApiCall(this, 'conversations.create'), + /** + * @description Declines an invitation to a Slack Connect channel. + * @see {@link https://api.slack.com/methods/conversations.declineSharedInvite `conversations.declineSharedInvite` API reference}. + */ declineSharedInvite: bindApiCall( this, 'conversations.declineSharedInvite', ), + /** + * @description Fetches a conversation's history of messages and events. + * @see {@link https://api.slack.com/methods/conversations.history `conversations.history` API reference}. + */ history: bindApiCall(this, 'conversations.history'), + /** + * @description Retrieve information about a conversation. + * @see {@link https://api.slack.com/methods/conversations.info `conversations.info` API reference}. + */ info: bindApiCall(this, 'conversations.info'), + /** + * @description Invites users to a channel. + * @see {@link https://api.slack.com/methods/conversations.invite `conversations.invite` API reference}. + */ invite: bindApiCall(this, 'conversations.invite'), + /** + * @description Sends an invitation to a Slack Connect channel. + * @see {@link https://api.slack.com/methods/conversations.inviteShared `conversations.inviteShared` API reference}. + */ inviteShared: bindApiCall( this, 'conversations.inviteShared', ), + /** + * @description Joins an existing conversation. + * @see {@link https://api.slack.com/methods/conversations.join `conversations.join` API reference}. + */ join: bindApiCall(this, 'conversations.join'), + /** + * @description Removes a user from a conversation. + * @see {@link https://api.slack.com/methods/conversations.kick `conversations.kick` API reference}. + */ kick: bindApiCall(this, 'conversations.kick'), + /** + * @description Leaves a conversation. + * @see {@link https://api.slack.com/methods/conversations.leave `conversations.leave` API reference}. + */ leave: bindApiCall(this, 'conversations.leave'), + /** + * @description List all channels in a Slack team. + * @see {@link https://api.slack.com/methods/conversations.list `conversations.list` API reference}. + */ list: bindApiCall(this, 'conversations.list'), + /** + * @description Lists shared channel invites that have been generated or received but have not been approved by + * all parties. + * @see {@link https://api.slack.com/methods/conversations.listConnectInvites `conversations.listConnectInvites` API reference}. + */ listConnectInvites: bindApiCall( this, 'conversations.listConnectInvites', ), + /** + * @description Sets the read cursor in a channel. + * @see {@link https://api.slack.com/methods/conversations.mark `conversations.mark` API reference}. + */ mark: bindApiCall(this, 'conversations.mark'), + /** + * @description Retrieve members of a conversation. + * @see {@link https://api.slack.com/methods/conversations.members `conversations.members` API reference}. + */ members: bindApiCall(this, 'conversations.members'), + /** + * @description Opens or resumes a direct message or multi-person direct message. + * @see {@link https://api.slack.com/methods/conversations.open `conversations.open` API reference}. + */ open: bindApiCall(this, 'conversations.open'), + /** + * @description Renames a conversation. + * @see {@link https://api.slack.com/methods/conversations.rename `conversations.rename` API reference}. + */ rename: bindApiCall(this, 'conversations.rename'), + /** + * @description Retrieve a thread of messages posted to a conversation. + * @see {@link https://api.slack.com/methods/conversations.replies `conversations.replies` API reference}. + */ replies: bindApiCall(this, 'conversations.replies'), + /** + * @description Sets the purpose for a conversation. + * @see {@link https://api.slack.com/methods/conversations.setPurpose `conversations.setPurpose` API reference}. + */ setPurpose: bindApiCall(this, 'conversations.setPurpose'), + /** + * @description Sets the topic for a conversation. + * @see {@link https://api.slack.com/methods/conversations.setTopic `conversations.setTopic` API reference}. + */ setTopic: bindApiCall( this, 'conversations.setTopic', @@ -2123,130 +2213,4 @@ export interface ChatUpdateArguments extends TokenOverridable { text?: string; } -/* - * `conversations.*` - */ -// TODO: breaking change: must provide either channel_id or invite_id -// https://api.slack.com/methods/conversations.acceptSharedInvite -export interface ConversationsAcceptSharedInviteArguments extends TokenOverridable, OptionalTeamAssignable { - channel_name: string; - channel_id?: string; - free_trial_accepted?: boolean; - invite_id?: string; - is_private?: boolean; -} -// https://api.slack.com/methods/conversations.approveSharedInvite -export interface ConversationsApproveSharedInviteArguments extends TokenOverridable { - invite_id: string; - target_team?: string; -} -// https://api.slack.com/methods/conversations.archive -export interface ConversationsArchiveArguments extends TokenOverridable { - channel: string; -} -// https://api.slack.com/methods/conversations.close -export interface ConversationsCloseArguments extends TokenOverridable { - channel: string; -} -// https://api.slack.com/methods/conversations.create -export interface ConversationsCreateArguments extends TokenOverridable, OptionalTeamAssignable { - name: string; - is_private?: boolean; -} -// https://api.slack.com/methods/conversations.declineSharedInvite -export interface ConversationsDeclineSharedInviteArguments extends TokenOverridable { - invite_id: string; - target_team?: string; -} -// https://api.slack.com/methods/conversations.history -export interface ConversationsHistoryArguments extends TokenOverridable, CursorPaginationEnabled, - TimelinePaginationEnabled { - channel: string; - include_all_metadata?: boolean; -} -// https://api.slack.com/methods/conversations.info -export interface ConversationsInfoArguments extends TokenOverridable, LocaleAware { - channel: string; - include_num_members?: boolean; -} -// https://api.slack.com/methods/conversations.invite -export interface ConversationsInviteArguments extends TokenOverridable { - channel: string; - users: string; // comma-separated list of users -} -// TODO: breaking change: either emails or user_ids must be provided -// https://api.slack.com/methods/conversations.inviteShared -export interface ConversationsInviteSharedArguments extends TokenOverridable { - channel: string; - emails?: string[]; - external_limited?: boolean; - user_ids?: string[]; -} -// https://api.slack.com/methods/conversations.join -export interface ConversationsJoinArguments extends TokenOverridable { - channel: string; -} -// https://api.slack.com/methods/conversations.kick -export interface ConversationsKickArguments extends TokenOverridable { - channel: string; - user: string; -} -// https://api.slack.com/methods/conversations.leave -export interface ConversationsLeaveArguments extends TokenOverridable { - channel: string; -} -// https://api.slack.com/methods/conversations.list -export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { - exclude_archived?: boolean; - types?: string; // comma-separated list of conversation types -} -// https://api.slack.com/methods/conversations.listConnectInvites -export interface ConversationsListConnectInvitesArguments extends TokenOverridable, OptionalTeamAssignable { - count?: number; // lol we use `limit` everywhere else - cursor?: string; -} -// https://api.slack.com/methods/conversations.mark -export interface ConversationsMarkArguments extends TokenOverridable { - channel: string; - ts: string; -} -// https://api.slack.com/methods/conversations.members -export interface ConversationsMembersArguments extends TokenOverridable, CursorPaginationEnabled { - channel: string; -} -// TODO: breaking change: must supply either channel or users -// https://api.slack.com/methods/conversations.open -export interface ConversationsOpenArguments extends TokenOverridable { - channel?: string; - users?: string; // comma-separated list of users - return_im?: boolean; - prevent_creation?: boolean; -} -// https://api.slack.com/methods/conversations.rename -export interface ConversationsRenameArguments extends TokenOverridable { - channel: string; - name: string; -} -// https://api.slack.com/methods/conversations.replies -export interface ConversationsRepliesArguments extends TokenOverridable, CursorPaginationEnabled, - TimelinePaginationEnabled { - channel: string; - ts: string; - include_all_metadata?: boolean; -} -// https://api.slack.com/methods/conversations.setPurpose -export interface ConversationsSetPurposeArguments extends TokenOverridable { - channel: string; - purpose: string; -} -// https://api.slack.com/methods/conversations.setTopic -export interface ConversationsSetTopicArguments extends TokenOverridable { - channel: string; - topic: string; -} -// https://api.slack.com/methods/conversations.unarchive -export interface ConversationsUnarchiveArguments extends TokenOverridable { - channel: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/conversations.ts b/packages/web-api/src/types/request/conversations.ts new file mode 100644 index 000000000..ba380b5ae --- /dev/null +++ b/packages/web-api/src/types/request/conversations.ts @@ -0,0 +1,164 @@ +import type { CursorPaginationEnabled, LocaleAware, OptionalTeamAssignable, TimelinePaginationEnabled, TokenOverridable } from './common'; + +interface Channel { + /** @description ID of conversation. */ + channel: string; +} +interface ChannelID { + /** @description ID of the channel that you'd like to accept. Must provide either `invite_id` or `channel_id`. */ + channel_id: string; +} +interface Emails { + /** @description List of emails to receive this invite. Either `emails` or `user_ids` must be provided. */ + emails: string[]; + user_ids?: never; +} +interface IncludeAllMetadata { + /** @description Return all metadata associated with messages. Defaults to `false`. */ + include_all_metadata?: boolean; +} +interface InviteID { + /** @description ID of the invite. */ + invite_id: string; +} +interface IsPrivate { + /** @description Whether the channel should be private. */ + is_private?: boolean; +} +interface Message extends Channel { + /** @description Unique identifier of message. */ + ts: string; +} +interface TargetTeam { + /** @description The team or enterprise id of the other party involved in the invitation. */ + target_team?: string; +} +interface UserIDs { + /** List of user IDs to receive this invite. Either `emails` or `user_ids` must be provided. */ + user_ids: string[]; + emails?: never; +} +interface Users { + /** @description A comma separated list of user IDs. Up to 1000 users may be listed. */ + users: string; +} +// https://api.slack.com/methods/conversations.acceptSharedInvite +export type ConversationsAcceptSharedInviteArguments = TokenOverridable & OptionalTeamAssignable +& (ChannelID | InviteID) & IsPrivate & { + /** + * @description Name of the channel. If the channel does not exist already in your workspace, + * this name is the one that the channel will take. + */ + channel_name: string; + /** @description Whether you'd like to use your workspace's free trial to begin using Slack Connect. */ + free_trial_accepted?: boolean; +}; + +// https://api.slack.com/methods/conversations.approveSharedInvite +export interface ConversationsApproveSharedInviteArguments extends InviteID, TargetTeam, TokenOverridable {} + +// https://api.slack.com/methods/conversations.archive +export interface ConversationsArchiveArguments extends Channel, TokenOverridable {} + +// https://api.slack.com/methods/conversations.close +export interface ConversationsCloseArguments extends Channel, TokenOverridable {} + +// https://api.slack.com/methods/conversations.create +export interface ConversationsCreateArguments extends IsPrivate, TokenOverridable, OptionalTeamAssignable { + /** @description Name of the public or private channel to create. */ + name: string; +} + +// https://api.slack.com/methods/conversations.declineSharedInvite +export interface ConversationsDeclineSharedInviteArguments extends InviteID, TargetTeam, TokenOverridable {} + +// https://api.slack.com/methods/conversations.history +export interface ConversationsHistoryArguments extends Channel, IncludeAllMetadata, TokenOverridable, + CursorPaginationEnabled, TimelinePaginationEnabled {} + +// https://api.slack.com/methods/conversations.info +export interface ConversationsInfoArguments extends Channel, TokenOverridable, LocaleAware { + /** @description Set to `true` to include the member count for the specified conversation. Defaults to `false`. */ + include_num_members?: boolean; +} + +// https://api.slack.com/methods/conversations.invite +export interface ConversationsInviteArguments extends Channel, Users, TokenOverridable { } + +// https://api.slack.com/methods/conversations.inviteShared +export type ConversationsInviteSharedArguments = Channel & TokenOverridable & (Emails | UserIDs) & { + /** @description Whether invite is to an external limited member. Defaults to `true`. */ + external_limited?: boolean; +}; + +// https://api.slack.com/methods/conversations.join +export interface ConversationsJoinArguments extends Channel, TokenOverridable {} + +// https://api.slack.com/methods/conversations.kick +export interface ConversationsKickArguments extends Channel, TokenOverridable { + user: string; +} + +// https://api.slack.com/methods/conversations.leave +export interface ConversationsLeaveArguments extends Channel, TokenOverridable {} + +// https://api.slack.com/methods/conversations.list +export interface ConversationsListArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { + /** @description Set to `true` to exclude archived channels from the list. Defaults to `false`. */ + exclude_archived?: boolean; + /** + * @description Mix and match channel types by providing a comma-separated list of any combination of: + * `public_channel`, `private_channel`, `mpim` or `im`. Defaults to `public_channel`. + */ + types?: string; +} + +// https://api.slack.com/methods/conversations.listConnectInvites +export interface ConversationsListConnectInvitesArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description Maximum number of invites to return. Defaults to `100`. */ + count?: number; + /** @description Set to `next_cursor` returned by previous call to list items in subsequent page. */ + cursor?: string; +} + +// https://api.slack.com/methods/conversations.mark +export interface ConversationsMarkArguments extends Message, TokenOverridable { } + +// https://api.slack.com/methods/conversations.members +export interface ConversationsMembersArguments extends Channel, TokenOverridable, CursorPaginationEnabled {} + +// https://api.slack.com/methods/conversations.open +export type ConversationsOpenArguments = (Channel | Users) & TokenOverridable & { + /** + * @description Do not create a direct message or multi-person direct message. + * This is used to see if there is an existing dm or mpdm. + */ + prevent_creation?: boolean; + /** @description Indicates you want the full IM channel definition in the response. */ + return_im?: boolean; +}; + +// https://api.slack.com/methods/conversations.rename +export interface ConversationsRenameArguments extends Channel, TokenOverridable { + /** @description New name for conversation. */ + name: string; +} + +// https://api.slack.com/methods/conversations.replies +export interface ConversationsRepliesArguments extends Message, IncludeAllMetadata, TokenOverridable, + CursorPaginationEnabled, TimelinePaginationEnabled {} + +// https://api.slack.com/methods/conversations.setPurpose +export interface ConversationsSetPurposeArguments extends Channel, TokenOverridable { + /** @description A new, specialer purpose. */ + purpose: string; +} + +// https://api.slack.com/methods/conversations.setTopic +export interface ConversationsSetTopicArguments extends Channel, TokenOverridable { + /** @description The new topic string. Does not support formatting or linkification. */ + topic: string; +} + +// https://api.slack.com/methods/conversations.unarchive +export interface ConversationsUnarchiveArguments extends Channel, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/conversations.test-d.ts b/packages/web-api/test/types/methods/conversations.test-d.ts new file mode 100644 index 000000000..e2d142530 --- /dev/null +++ b/packages/web-api/test/types/methods/conversations.test-d.ts @@ -0,0 +1,290 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// conversations.acceptSharedInvite +// -- sad path +expectError(web.conversations.acceptSharedInvite()); // lacking argument +expectError(web.conversations.acceptSharedInvite({})); // empty argument +expectError(web.conversations.acceptSharedInvite({ + channel_name: 'puppies-r-us', // missing invite_id or channel_id +})); +expectError(web.conversations.acceptSharedInvite({ + channel_id: 'C1234', // missing channel_name +})); +expectError(web.conversations.acceptSharedInvite({ + invite_id: 'I1234', // missing channel_name +})); +// -- happy path +expectAssignable>([{ + channel_name: 'puppies-r-us', + invite_id: 'I1234', +}]); +expectAssignable>([{ + channel_name: 'puppies-r-us', + channel_id: 'C1234', +}]); + +// conversations.approveSharedInvite +// -- sad path +expectError(web.conversations.approveSharedInvite()); // lacking argument +expectError(web.conversations.approveSharedInvite({})); // empty argument +// -- happy path +expectAssignable>([{ + invite_id: 'I1234', +}]); + +// conversations.archive +// -- sad path +expectError(web.conversations.archive()); // lacking argument +expectError(web.conversations.archive({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.close +// -- sad path +expectError(web.conversations.close()); // lacking argument +expectError(web.conversations.close({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.create +// -- sad path +expectError(web.conversations.create()); // lacking argument +expectError(web.conversations.create({})); // empty argument +// -- happy path +expectAssignable>([{ + name: 'grunge-fans', +}]); + +// conversations.declineSharedInvite +// -- sad path +expectError(web.conversations.declineSharedInvite()); // lacking argument +expectError(web.conversations.declineSharedInvite({})); // empty argument +// -- happy path +expectAssignable>([{ + invite_id: 'I1234', +}]); + +// conversations.history +// -- sad path +expectError(web.conversations.history()); // lacking argument +expectError(web.conversations.history({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.info +// -- sad path +expectError(web.conversations.info()); // lacking argument +expectError(web.conversations.info({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.invite +// -- sad path +expectError(web.conversations.invite()); // lacking argument +expectError(web.conversations.invite({})); // empty argument +expectError(web.conversations.invite({ + channel: 'C1234', // missing users +})); +expectError(web.conversations.invite({ + users: 'U1234', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + users: 'U1234', +}]); + +// conversations.inviteShared +// -- sad path +expectError(web.conversations.inviteShared()); // lacking argument +expectError(web.conversations.inviteShared({})); // empty argument +expectError(web.conversations.inviteShared({ + channel: 'C1234', // missing emails or user_ids +})); +expectError(web.conversations.inviteShared({ + user_ids: ['U1234'], // missing channel +})); +expectError(web.conversations.inviteShared({ + emails: ['ceo@salesforce.com'], // missing channel +})); +expectError(web.conversations.inviteShared({ + channel: 'C1234', + emails: ['ceo@salesforce.com'], + user_ids: ['U1234'], // either emails or user_ids, but not both +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + user_ids: ['U1234'], +}]); +expectAssignable>([{ + channel: 'C1234', + emails: ['ceo@salesforce.com'], +}]); + +// conversations.join +// -- sad path +expectError(web.conversations.join()); // lacking argument +expectError(web.conversations.join({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.kick +// -- sad path +expectError(web.conversations.kick()); // lacking argument +expectError(web.conversations.kick({})); // empty argument +expectError(web.conversations.kick({ + channel: 'C1234', // missing user +})); +expectError(web.conversations.kick({ + user: 'U1234', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', +}]); + +// conversations.leave +// -- sad path +expectError(web.conversations.leave()); // lacking argument +expectError(web.conversations.leave({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.list +// -- sad path +expectError(web.conversations.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// conversations.listConnectInvites +// -- sad path +expectError(web.conversations.listConnectInvites()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// conversations.mark +// -- sad path +expectError(web.conversations.mark()); // lacking argument +expectError(web.conversations.mark({})); // empty argument +expectError(web.conversations.mark({ + channel: 'C1234', // missing ts +})); +expectError(web.conversations.mark({ + ts: '12345.67', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + ts: '12345.67', +}]); + +// conversations.members +// -- sad path +expectError(web.conversations.members()); // lacking argument +expectError(web.conversations.members({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); + +// conversations.open +// -- sad path +expectError(web.conversations.open()); // lacking argument +expectError(web.conversations.open({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); +expectAssignable>([{ + users: 'U1234,U2345', +}]); + +// conversations.rename +// -- sad path +expectError(web.conversations.rename()); // lacking argument +expectError(web.conversations.rename({})); // empty argument +expectError(web.conversations.rename({ + channel: 'C1234', // missing name +})); +expectError(web.conversations.rename({ + name: 'batman-fans', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + name: 'batman-fans', +}]); + +// conversations.replies +// -- sad path +expectError(web.conversations.replies()); // lacking argument +expectError(web.conversations.replies({})); // empty argument +expectError(web.conversations.replies({ + channel: 'C1234', // missing ts +})); +expectError(web.conversations.replies({ + ts: '12345.67', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + ts: '12345.67', +}]); + +// conversations.setPurpose +// -- sad path +expectError(web.conversations.setPurpose()); // lacking argument +expectError(web.conversations.setPurpose({})); // empty argument +expectError(web.conversations.setPurpose({ + channel: 'C1234', // missing purpose +})); +expectError(web.conversations.setPurpose({ + purpose: 'Feed the world', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + purpose: 'Feed the world', +}]); + +// conversations.setTopic +// -- sad path +expectError(web.conversations.setTopic()); // lacking argument +expectError(web.conversations.setTopic({})); // empty argument +expectError(web.conversations.setTopic({ + channel: 'C1234', // missing topic +})); +expectError(web.conversations.setTopic({ + topic: 'Eat and be merry', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + topic: 'Eat and be merry', +}]); + +// conversations.unarchive +// -- sad path +expectError(web.conversations.unarchive()); // lacking argument +expectError(web.conversations.unarchive({})); // empty argument +// -- happy path +expectAssignable>([{ + channel: 'C1234', +}]); From 587b71cf56d22660b8d1ec631fb0a00a958a6ee6 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 20 Nov 2023 16:42:31 -0500 Subject: [PATCH 086/122] forgot one jsdoc --- packages/web-api/src/methods.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 7f89af558..593692092 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -803,6 +803,10 @@ export abstract class Methods extends EventEmitter { this, 'conversations.setTopic', ), + /** + * @description Reverses conversation archival. + * @see {@link https://api.slack.com/methods/conversations.unarchive `conversations.unarchive` API reference}. + */ unarchive: bindApiCall( this, 'conversations.unarchive', From 658cf4576c66a5984b5abe20facdaca5f759b3ce Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 22 Nov 2023 15:11:34 -0500 Subject: [PATCH 087/122] JSdoc chat.* API methods --- packages/web-api/src/methods.ts | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 593692092..08bd7fdc2 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -647,25 +647,65 @@ export abstract class Methods extends EventEmitter { }; public readonly chat = { + /** + * @description Deletes a message. + * @see {@link https://api.slack.com/methods/chat.delete `chat.delete` API reference}. + */ delete: bindApiCall(this, 'chat.delete'), + /** + * @description Deletes a pending scheduled message from the queue. + * @see {@link https://api.slack.com/methods/chat.deleteScheduledMessage `chat.deleteScheduledMessage` API reference}. + */ deleteScheduledMessage: bindApiCall(this, 'chat.deleteScheduledMessage'), + /** + * @description Retrieve a permalink URL for a specific extant message. + * @see {@link https://api.slack.com/methods/chat.getPermalink `chat.getPermalink` API reference}. + */ getPermalink: bindApiCall(this, 'chat.getPermalink'), + /** + * @description Share a me message into a channel. + * @see {@link https://api.slack.com/methods/chat.meMessage `chat.meMessage` API reference}. + */ meMessage: bindApiCall(this, 'chat.meMessage'), + /** + * @description Sends an ephemeral message to a user in a channel. + * @see {@link https://api.slack.com/methods/chat.postEphemeral `chat.postEphemeral` API reference}. + */ postEphemeral: bindApiCall(this, 'chat.postEphemeral'), + /** + * @description Sends a message to a channel. + * @see {@link https://api.slack.com/methods/chat.postMessage `chat.postMessage` API reference}. + */ postMessage: bindApiCall(this, 'chat.postMessage'), + /** + * @description Schedules a message to be sent to a channel. + * @see {@link https://api.slack.com/methods/chat.scheduleMessage `chat.scheduleMessage` API reference}. + */ scheduleMessage: bindApiCall( this, 'chat.scheduleMessage', ), scheduledMessages: { + /** + * @description Returns a list of scheduled messages. + * @see {@link https://api.slack.com/methods/chat.scheduledMessages.list `chat.scheduledMessages.list` API reference}. + */ list: bindApiCall( this, 'chat.scheduledMessages.list', ), }, + /** + * @description Provide custom unfurl behavior for user-posted URLs. + * @see {@link https://api.slack.com/methods/chat.unfurl `chat.unfurl` API reference}. + */ unfurl: bindApiCall(this, 'chat.unfurl'), + /** + * @description Updates a message. + * @see {@link https://api.slack.com/methods/chat.update `chat.update` API reference}. + */ update: bindApiCall(this, 'chat.update'), }; From a29e77ac15a3b6f159efda7dfbea1c2b272c12dd Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 22 Nov 2023 15:19:46 -0500 Subject: [PATCH 088/122] first pass at chat.* API method arg refactor and initial type tests. --- packages/web-api/src/types/request/chat.ts | 234 ++++++++++++++++++ .../web-api/test/types/methods/chat.test-d.ts | 115 +++------ .../test/types/webclient-no-token.test-d.ts | 2 +- 3 files changed, 265 insertions(+), 86 deletions(-) create mode 100644 packages/web-api/src/types/request/chat.ts diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts new file mode 100644 index 000000000..c4038a42b --- /dev/null +++ b/packages/web-api/src/types/request/chat.ts @@ -0,0 +1,234 @@ +import type { KnownBlock, Block, MessageAttachment, LinkUnfurls, MessageMetadata } from '@slack/types'; +import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable } from './common'; + +interface Channel { + /** @description Channel ID for the message. */ + channel: string; +} +interface ChannelAndTS extends Channel { + /** @description Timestamp of the message. */ + ts: string; +} +interface ChannelAndMessageTS extends Channel { + /** @description Timestamp of the message. */ + message_ts: string; +} +interface AsUser { + /** + * @description Pass `true` to act as the authed user with {@link https://api.slack.com/scopes/chat:write:user `chat:write:user` scope}. + * Bot users in this context are considered authed users. If unused or `false`, the message will be acted upon with + * {@link https://api.slack.com/scopes/chat:write:bot `chat:write:bot` scope}. + */ + as_user?: boolean; +} +interface LinkNames { + /** @description Find and link channel names and usernames. */ + link_names?: boolean; +} +interface Parse { + /** + * @description Change how messages are treated. Defaults to `none`. + * @see {@link https://api.slack.com/reference/surfaces/formatting#automatic-parsing Formatting: Automatic parsing}. + */ + parse?: 'full' | 'none'; +} +interface Text { + /** @description Text of the message. */ + text: string; +} +interface ChannelAndText extends Channel, Text {} +interface ChannelAndBlocks extends Channel { + /** + * @description An array of structured Blocks. + * @see {@link https://api.slack.com/reference/block-kit/blocks Blocks reference}. + */ + blocks: (KnownBlock | Block)[]; +} +interface ChannelAndAttachments extends Channel { + /** + * @description An array of structured attachments. + * @see {@link https://api.slack.com/messaging/composing/layouts#attachments Adding secondary attachments}. + */ + attachments: MessageAttachment[]; +} +// Models message-creation arguments, user must provide one of the following combinations: +// 1. channel and text +// 2. channel and blocks +// 3. channel and attachments +type MessageContents = ChannelAndText | ChannelAndBlocks | ChannelAndAttachments; +interface ThreadTS { + /** + * @description Provide another message's `ts` value to post this message in a thread. Avoid using a reply's `ts` + * value; use its parent's value instead. + */ + thread_ts: string; +} +interface WithinThreadReply extends Partial { + /** + * @description Used in conjunction with `thread_ts`, when set to `false` will make the reply only visibile within + * a thread. + */ + reply_broadcast?: false; +} +interface BroadcastedThreadReply extends ThreadTS { + /** @description Used in conjunction with `thread_ts`, when set to `true` will broadcast the reply to the channel. */ + reply_broadcast: true; +} +// For APIs supporting `reply_broadcast`, there are two options: either a broadcasted threaded reply, +// or not broadcasted. Broadcasted replies are necessarily threaded, so `thread_ts` becomes required. +type ReplyInThread = WithinThreadReply | BroadcastedThreadReply; + +interface Metadata { + /** @description Object representing message metadata, which will be made accessible to any user or app. */ + metadata?: MessageMetadata; +} +interface IconEmoji { + as_user?: false; + icon_url?: never; + /** + * @description Emoji to use as the icon for this message. Overrides `icon_url`. + * Can only be used with `as_user` set to `false`. + */ + icon_emoji?: string; +} +interface IconURL { + as_user?: false; + icon_emoji?: never; + /** + * @description URL to an image to use as the icon for this message. `icon_emoji` takes precendence over this field. + * Can only be used with `as_user` set to `false`. + */ + icon_url?: string; +} +// Can only specify message icon via predefined authorship using one of emoji or URL, but not both. +type Icon = IconEmoji | IconURL; +interface Username { + as_user?: false; + /** @description Set your bot's username. Can only be used with `as_user` set to `false`. */ + username?: string; +} +type Authorship = (Icon & Username) | AsUser; + +// https://api.slack.com/methods/chat.delete +export interface ChatDeleteArguments extends ChannelAndTS, AsUser, TokenOverridable {} + +// https://api.slack.com/methods/chat.deleteScheduledMessage +export interface ChatDeleteScheduledMessageArguments extends Channel, AsUser, TokenOverridable { + /** @description The `scheduled_message_id` returned from call to {@link https://api.slack.com/methods/chat.scheduleMessage `chat.scheduleMessage`}. */ + scheduled_message_id: string; +} + +// https://api.slack.com/methods/chat.getPermalink +export interface ChatGetPermalinkArguments extends ChannelAndMessageTS, TokenOverridable {} + +// https://api.slack.com/methods/chat.meMessage +export interface ChatMeMessageArguments extends ChannelAndText, TokenOverridable {} + +// https://api.slack.com/methods/chat.postEphemeral +export type ChatPostEphemeralArguments = TokenOverridable & MessageContents & Parse & LinkNames & Authorship +& Partial & { + /** + * @description `id` of the user who will receive the ephemeral message. + * The user should be in the channel specified by the `channel` argument. + */ + user: string; +}; + +// https://api.slack.com/methods/chat.postMessage +export type ChatPostMessageArguments = TokenOverridable & MessageContents & AsUser & Parse & LinkNames & Icon +& Username & Metadata & ReplyInThread & { + /** @description Disable Slack markup parsing by setting to `false`. Enabled by default. */ + mrkdwn?: boolean; + /** @description Pass `true` to enable unfurling of primarily text-based content. */ + unfurl_links?: boolean; + /** @description Pass `false` to disable unfurling of media content. */ + unfurl_media?: boolean; +}; + +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostEphemeralArguments +// https://api.slack.com/methods/chat.scheduleMessage +export interface ChatScheduleMessageArguments extends TokenOverridable, OptionalTeamAssignable { + channel: string; + text?: string; + post_at: string | number; + as_user?: boolean; + attachments?: MessageAttachment[]; + blocks?: (KnownBlock | Block)[]; + metadata?: MessageMetadata; + link_names?: boolean; + parse?: 'full' | 'none'; + reply_broadcast?: boolean; // if specified, thread_ts must be set + thread_ts?: string; + unfurl_links?: boolean; + unfurl_media?: boolean; +} +// https://api.slack.com/methods/chat.scheduledMessages.list +export interface ChatScheduledMessagesListArguments extends TokenOverridable, + CursorPaginationEnabled, OptionalTeamAssignable { + channel?: string; + latest?: number; + oldest?: number; +} + +interface SourceAndUnfurlID { + /** + * @description The source of the link to unfurl. The source may either be `composer`, when the link is inside the + * message composer, or `conversations_history`, when the link has been posted to a conversation. + */ + source: 'composer' | 'conversations_history'; + /** + * @description The ID of the link to unfurl. Both `unfurl_id` and `source` must be provided together, or `channel` + * and `ts` must be provided together. + */ + unfurl_id: string; +} +// https://api.slack.com/methods/chat.unfurl +export type ChatUnfurlArguments = (ChannelAndTS | SourceAndUnfurlID) & TokenOverridable +& { + /** + * @description URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl + * blocks or message attachments. + */ + unfurls: LinkUnfurls; + /** + * @description Provide a simply-formatted string to send as an ephemeral message to the user as invitation to + * authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again. + */ + user_auth_message?: string; + /** + * @description Set to `true` to indicate the user must install your Slack app to trigger unfurls for this domain. + * Defaults to `false`. + */ + user_auth_required?: boolean; + /** + * @description Send users to this custom URL where they will complete authentication in your app to fully trigger + * unfurling. Value should be properly URL-encoded. + */ + user_auth_url?: string; + /** + * @description Provide a JSON based array of structured blocks presented as URL-encoded string to send as an + * ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. + */ + user_auth_blocks?: (KnownBlock | Block)[]; +}; +// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text +// is required OR channel and blocks OR channel and attachments) +// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 +// Many of these arguments can be shared with ChatPostEphemeralArguments +// https://api.slack.com/methods/chat.update +export interface ChatUpdateArguments extends TokenOverridable { + channel: string; + ts: string; + as_user?: boolean; + attachments?: MessageAttachment[]; + blocks?: (KnownBlock | Block)[]; + link_names?: boolean; + metadata?: MessageMetadata; + parse?: 'full' | 'none'; + file_ids?: string[]; + reply_broadcast?: boolean; + text?: string; +} diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 044934f8c..3834f2151 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -1,91 +1,36 @@ -import { expectType, expectError } from 'tsd'; -import { WebClient, WebAPICallResult } from '../../../'; -import { ChatPostMessageResponse } from '../../../src/types/response/ChatPostMessageResponse'; -import { ChatPostEphemeralResponse } from '../../../src/types/response/ChatPostEphemeralResponse'; -// import { ChatScheduleMessageResponse } from '../../src/response/ChatScheduleMessageResponse'; -// import { ChatUpdateResponse } from '../../src/response/ChatUpdateResponse'; +import { expectError, expectAssignable } from 'tsd'; +import { WebClient } from '../../..'; const web = new WebClient('TOKEN'); -const chatPostMesssageResult: ChatPostMessageResponse = { ok: true }; -const result: WebAPICallResult = chatPostMesssageResult; -expectType(result); - -// TODO: Parameter type Promise is not identical to argument type Promise -// // calling a method directly with arbitrary arguments should work -// expectType>(web.chat.postMessage({ -// channel: 'CHANNEL', -// text: 'TEXT', -// key: 'VALUE', -// })); -// expectType>(web.chat.postMessage({ -// channel: 'CHANNEL', -// blocks: [ -// { -// type: 'section', -// text: { -// type: 'mrkdwn', -// text: -// 'text', -// }, -// }, -// ], -// key: 'VALUE', -// })); - -// calling a method directly with under-specified arguments should not work -expectError(web.chat.postMessage({ - text: 'TEXT', +// chat.delete +// -- sad path +expectError(web.chat.delete()); // lacking argument +expectError(web.chat.delete({})); // empty argument +expectError(web.chat.delete({ + channel: 'C1234', // missing ts })); - -// assigning an object with a specific type that includes arbitrary arguments should not work -// TODO: can typescript even reliably do that? ^ -// expectError(web.chat.postMessage({ -// text: 'TEXT', -// channel: 'CHANNEL', -// key: 'VALUE', -// })); - -// expectType>(web.chat.postMessage({ -// channel: 'C111', -// blocks: [], -// // no text should be accepted -// })); -// expectType>(web.chat.update({ -// channel: 'C111', -// ts: '111.222', -// blocks: [], -// // no text should be accepted -// })); - -// expectType>(web.chat.scheduleMessage({ -// channel: 'C111', -// post_at: '11111', -// blocks: [], -// // no text should be accepted -// })); -// expectType>(web.chat.scheduleMessage({ -// channel: 'C111', -// post_at: '1621497568', -// text: 'Hi there!', -// blocks: [], -// })); -// expectType>(web.chat.scheduleMessage({ -// channel: 'C111', -// post_at: 1621497568, -// text: 'Hi there!', -// blocks: [], -// })); - -expectType>(web.chat.postEphemeral({ - channel: 'C111', - user: 'U111', - blocks: [], - // no text should be accepted +expectError(web.chat.delete({ + ts: '1234.56', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', +}]); + +// chat.deleteScheduledMessage +// -- sad path +expectError(web.chat.deleteScheduledMessage()); // lacking argument +expectError(web.chat.deleteScheduledMessage({})); // empty argument +expectError(web.chat.deleteScheduledMessage({ + channel: 'C1234', // missing scheduled_message_id })); -expectType>(web.chat.postEphemeral({ - channel: 'C111', - user: 'U111', - text: 'Hi there!', - blocks: [], +expectError(web.chat.deleteScheduledMessage({ + scheduled_message_id: 'Q1234', // missing channel })); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + scheduled_message_id: 'Q1234', +}]); diff --git a/packages/web-api/test/types/webclient-no-token.test-d.ts b/packages/web-api/test/types/webclient-no-token.test-d.ts index 59c12fe32..fc96355e9 100644 --- a/packages/web-api/test/types/webclient-no-token.test-d.ts +++ b/packages/web-api/test/types/webclient-no-token.test-d.ts @@ -1,5 +1,5 @@ import { expectType } from 'tsd'; -import { WebClient } from '../../'; +import { WebClient } from '../..'; import { OauthAccessResponse } from '../../src/types/response/OauthAccessResponse'; const web = new WebClient(); From 6cc5f84201100a06920835835549c889f4dea7a5 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 22 Nov 2023 15:54:33 -0500 Subject: [PATCH 089/122] OK back in action: extensive postEphemeral type tests and tweaks to types to make them pass --- packages/web-api/src/methods.ts | 170 +----------------- packages/web-api/src/types/request/chat.ts | 13 +- .../web-api/test/types/methods/chat.test-d.ts | 139 +++++++++++++- 3 files changed, 152 insertions(+), 170 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 08bd7fdc2..7f100d1f7 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,4 +1,4 @@ -import type { KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types'; +import type { CallUser } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; // Response types @@ -258,6 +258,7 @@ import type { EmojiListArguments } from './types/request/emoji'; import type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSetSnoozeArguments, DndTeamInfoArguments } from './types/request/dnd'; import type { DialogOpenArguments } from './types/request/dialog'; import type { ConversationsAcceptSharedInviteArguments, ConversationsApproveSharedInviteArguments, ConversationsArchiveArguments, ConversationsCloseArguments, ConversationsCreateArguments, ConversationsDeclineSharedInviteArguments, ConversationsHistoryArguments, ConversationsInfoArguments, ConversationsInviteArguments, ConversationsInviteSharedArguments, ConversationsJoinArguments, ConversationsKickArguments, ConversationsLeaveArguments, ConversationsListArguments, ConversationsListConnectInvitesArguments, ConversationsMarkArguments, ConversationsMembersArguments, ConversationsOpenArguments, ConversationsRenameArguments, ConversationsRepliesArguments, ConversationsSetPurposeArguments, ConversationsSetTopicArguments, ConversationsUnarchiveArguments } from './types/request/conversations'; +import type { ChatDeleteArguments, ChatDeleteScheduledMessageArguments, ChatGetPermalinkArguments, ChatMeMessageArguments, ChatPostEphemeralArguments, ChatPostMessageArguments, ChatScheduleMessageArguments, ChatScheduledMessagesListArguments, ChatUnfurlArguments, ChatUpdateArguments } from './types/request/chat'; /** * Generic method definition @@ -2090,171 +2091,4 @@ export interface CallsParticipantsRemoveArguments extends TokenOverridable { users: CallUser[]; } -/* - * `chat.*` - */ -// https://api.slack.com/methods/chat.delete -export interface ChatDeleteArguments extends TokenOverridable { - channel: string; - ts: string; - as_user?: boolean; -} -// https://api.slack.com/methods/chat.deleteScheduledMessage -export interface ChatDeleteScheduledMessageArguments extends TokenOverridable { - channel: string; - scheduled_message_id: string; - as_user?: boolean; -} -// https://api.slack.com/methods/chat.getPermalink -export interface ChatGetPermalinkArguments extends TokenOverridable { - channel: string; - message_ts: string; -} -// https://api.slack.com/methods/chat.meMessage -export interface ChatMeMessageArguments extends TokenOverridable { - channel: string; - text: string; -} -// https://api.slack.com/methods/chat.postEphemeral -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostMessageArguments -export interface ChatPostEphemeralArguments extends TokenOverridable { - channel: string; - text?: string; - user: string; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - link_names?: boolean; - parse?: 'full' | 'none'; - thread_ts?: string; - icon_emoji?: string; // if specified, as_user must be false - icon_url?: string; // if specified, as_user must be false - username?: string; // if specified, as_user must be false -} -// https://api.slack.com/methods/chat.postMessage -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostEphemeralArguments -export interface ChatPostMessageArguments extends TokenOverridable { - channel: string; - text?: string; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - icon_emoji?: string; // if specified, as_user must be false - icon_url?: string; // if specified, as_user must be false - metadata?: MessageMetadata; - link_names?: boolean; - mrkdwn?: boolean; - parse?: 'full' | 'none'; - reply_broadcast?: boolean; // if specified, thread_ts must be set - thread_ts?: string; - unfurl_links?: boolean; - unfurl_media?: boolean; - username?: string; // if specified, as_user must be false -} -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostEphemeralArguments -// https://api.slack.com/methods/chat.scheduleMessage -export interface ChatScheduleMessageArguments extends TokenOverridable, OptionalTeamAssignable { - channel: string; - text?: string; - post_at: string | number; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - metadata?: MessageMetadata; - link_names?: boolean; - parse?: 'full' | 'none'; - reply_broadcast?: boolean; // if specified, thread_ts must be set - thread_ts?: string; - unfurl_links?: boolean; - unfurl_media?: boolean; -} -// https://api.slack.com/methods/chat.scheduledMessages.list -export interface ChatScheduledMessagesListArguments extends TokenOverridable, - CursorPaginationEnabled, OptionalTeamAssignable { - channel?: string; - latest?: number; - oldest?: number; -} -// ChannelAndTS and SourceAndUnfurlID are used as either-or mixins for ChatUnfurlArguments -interface ChannelAndTSArguments { - /** - * @description Channel ID of the message. Both `channel` and `ts` must be provided together, or `unfurl_id` and - * `source` must be provided together. - */ - channel: string; - /** - * @description Timestamp of the message to add unfurl behavior to. - */ - ts: string; -} - -interface SourceAndUnfurlIDArguments { - /** - * @description The source of the link to unfurl. The source may either be `composer`, when the link is inside the - * message composer, or `conversations_history`, when the link has been posted to a conversation. - */ - source: 'composer' | 'conversations_history'; - /** - * @description The ID of the link to unfurl. Both `unfurl_id` and `source` must be provided together, or `channel` - * and `ts` must be provided together. - */ - unfurl_id: string; -} -// https://api.slack.com/methods/chat.unfurl -export type ChatUnfurlArguments = (ChannelAndTSArguments | SourceAndUnfurlIDArguments) & TokenOverridable -& { - /** - * @description URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl - * blocks or message attachments. - */ - unfurls: LinkUnfurls; - /** - * @description Provide a simply-formatted string to send as an ephemeral message to the user as invitation to - * authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again. - */ - user_auth_message?: string; - /** - * @description Set to `true` to indicate the user must install your Slack app to trigger unfurls for this domain. - * Defaults to `false`. - */ - user_auth_required?: boolean; - /** - * @description Send users to this custom URL where they will complete authentication in your app to fully trigger - * unfurling. Value should be properly URL-encoded. - */ - user_auth_url?: string; - /** - * @description Provide a JSON based array of structured blocks presented as URL-encoded string to send as an - * ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. - */ - user_auth_blocks?: (KnownBlock | Block)[]; -}; -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostEphemeralArguments -// https://api.slack.com/methods/chat.update -export interface ChatUpdateArguments extends TokenOverridable { - channel: string; - ts: string; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - link_names?: boolean; - metadata?: MessageMetadata; - parse?: 'full' | 'none'; - file_ids?: string[]; - reply_broadcast?: boolean; - text?: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index c4038a42b..5fa7c9ea0 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -107,7 +107,18 @@ interface Username { /** @description Set your bot's username. Can only be used with `as_user` set to `false`. */ username?: string; } -type Authorship = (Icon & Username) | AsUser; +// This union keys on as_user: if it is undefined or false, then the Icon and Username types should be available +// and adhered to. Otherwise if true, then no icon or username fields should be available. +type Authorship = (Icon & Username) | { + /** + * @description Pass `true` to act as the authed user with {@link https://api.slack.com/scopes/chat:write:user `chat:write:user` scope}. + * Bot users in this context are considered authed users. If unused or `false`, the message will be acted upon with + * {@link https://api.slack.com/scopes/chat:write:bot `chat:write:bot` scope}. + */ + as_user: true; + icon_emoji?: never; + icon_url?: never; +}; // https://api.slack.com/methods/chat.delete export interface ChatDeleteArguments extends ChannelAndTS, AsUser, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 3834f2151..d2513a44b 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -1,5 +1,5 @@ import { expectError, expectAssignable } from 'tsd'; -import { WebClient } from '../../..'; +import { WebClient } from '../../../src/WebClient'; const web = new WebClient('TOKEN'); @@ -34,3 +34,140 @@ expectAssignable>([{ channel: 'C1234', scheduled_message_id: 'Q1234', }]); + +// chat.getPermalink +// -- sad path +expectError(web.chat.getPermalink()); // lacking argument +expectError(web.chat.getPermalink({})); // empty argument +expectError(web.chat.getPermalink({ + channel: 'C1234', // missing message_ts +})); +expectError(web.chat.getPermalink({ + message_ts: '1234.56', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + message_ts: '1234.56', +}]); + +// chat.meMessage +// -- sad path +expectError(web.chat.meMessage()); // lacking argument +expectError(web.chat.meMessage({})); // empty argument +expectError(web.chat.meMessage({ + channel: 'C1234', // missing text +})); +expectError(web.chat.meMessage({ + text: '1234.56', // missing channel +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + text: '1234.56', +}]); + +// chat.postEphemeral +// -- sad path +expectError(web.chat.postEphemeral()); // lacking argument +expectError(web.chat.postEphemeral({})); // empty argument +expectError(web.chat.postEphemeral({ + channel: 'C1234', // missing text/attachments/blocks and user +})); +expectError(web.chat.postEphemeral({ + channel: 'C1234', // missing text/attachments/blocks + user: 'U1234', +})); +expectError(web.chat.postEphemeral({ + channel: 'C1234', // missing user + text: 'U1234', +})); +expectError(web.chat.postEphemeral({ + user: 'U1234', // missing channel + text: 'U1234', +})); +expectError(web.chat.postEphemeral({ + channel: 'C1234', // missing user + blocks: [], +})); +expectError(web.chat.postEphemeral({ + user: 'U1234', // missing channel + blocks: [], +})); +expectError(web.chat.postEphemeral({ + channel: 'C1234', // missing user + attachments: [], +})); +expectError(web.chat.postEphemeral({ + user: 'U1234', // missing channel + attachments: [], +})); +expectError(web.chat.postEphemeral({ + channel: 'C123', + user: 'U1234', + attachments: [], + icon_url: 'someurl.png', + icon_emoji: 'smile', // cannot use both icon_url and icon_emoji +})); +expectError(web.chat.postEphemeral({ + channel: 'C123', + user: 'U1234', + attachments: [], + icon_url: 'someurl.png', + as_user: true, // cannot set both as_user=true and icon_url +})); +expectError(web.chat.postEphemeral({ + channel: 'C123', + user: 'U1234', + attachments: [], + icon_emoji: 'smile', + as_user: true, // cannot set both as_user=true and icon_url +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + text: '1234.56', +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + blocks: [], +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], + as_user: true, // can pass as_user=true if no icon or username fields set +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], + icon_emoji: 'smile', // icon can be set on its own... +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], + icon_emoji: 'smile', + as_user: false, // ... or with as_user=false +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], + icon_url: 'someurl.png', // icon can be set on its own... +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], + icon_emoji: 'someurl.png', + as_user: false, // ... or with as_user=false +}]); From 4956cc8d0876e9a5378a29a4fe5759a2189db879 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 22 Nov 2023 16:15:24 -0500 Subject: [PATCH 090/122] extensive postMessage type tests and tweaks to types to make them pass --- packages/web-api/src/types/request/chat.ts | 4 +- .../web-api/test/types/methods/chat.test-d.ts | 93 ++++++++++++++++++- 2 files changed, 94 insertions(+), 3 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index 5fa7c9ea0..274711add 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -146,8 +146,8 @@ export type ChatPostEphemeralArguments = TokenOverridable & MessageContents & Pa }; // https://api.slack.com/methods/chat.postMessage -export type ChatPostMessageArguments = TokenOverridable & MessageContents & AsUser & Parse & LinkNames & Icon -& Username & Metadata & ReplyInThread & { +export type ChatPostMessageArguments = TokenOverridable & MessageContents & Parse & LinkNames & Authorship & Metadata +& ReplyInThread & { /** @description Disable Slack markup parsing by setting to `false`. Enabled by default. */ mrkdwn?: boolean; /** @description Pass `true` to enable unfurling of primarily text-based content. */ diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index d2513a44b..066d8435d 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -121,7 +121,7 @@ expectError(web.chat.postEphemeral({ user: 'U1234', attachments: [], icon_emoji: 'smile', - as_user: true, // cannot set both as_user=true and icon_url + as_user: true, // cannot set both as_user=true and icon_emoji })); // -- happy path expectAssignable>([{ @@ -171,3 +171,94 @@ expectAssignable>([{ icon_emoji: 'someurl.png', as_user: false, // ... or with as_user=false }]); + +// chat.postMessage +// -- sad path +expectError(web.chat.postMessage()); // lacking argument +expectError(web.chat.postMessage({})); // empty argument +expectError(web.chat.postMessage({ + channel: 'C1234', // missing text/attachments/blocks +})); +expectError(web.chat.postMessage({ + text: 'U1234', // missing channel +})); +expectError(web.chat.postMessage({ + blocks: [], // missing channel +})); +expectError(web.chat.postMessage({ + attachments: [], // missing channel +})); +expectError(web.chat.postMessage({ + channel: 'C123', + attachments: [], + icon_url: 'someurl.png', + icon_emoji: 'smile', // cannot use both icon_url and icon_emoji +})); +expectError(web.chat.postMessage({ + channel: 'C123', + attachments: [], + icon_url: 'someurl.png', + as_user: true, // cannot set both as_user=true and icon_url +})); +expectError(web.chat.postMessage({ + channel: 'C123', + attachments: [], + icon_emoji: 'smile', + as_user: true, // cannot set both as_user=true and icon_emoji +})); +expectError(web.chat.postMessage({ + channel: 'C123', + attachments: [], + reply_broadcast: true, // cannot reply_broadcast=true without setting thread_ts +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + text: '1234.56', +}]); +expectAssignable>([{ + channel: 'C1234', + blocks: [], +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + as_user: true, // can pass as_user=true if no icon or username fields set +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + icon_emoji: 'smile', // icon can be set on its own... +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + icon_emoji: 'smile', + as_user: false, // ... or with as_user=false +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + icon_url: 'someurl.png', // icon can be set on its own... +}]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + icon_emoji: 'someurl.png', + as_user: false, // ... or with as_user=false +}]); +expectAssignable>([{ + channel: 'C1234', + text: 'hello', + thread_ts: '1234.56', // can send a threaded message +}]); +expectAssignable>([{ + channel: 'C1234', + text: 'hello', + thread_ts: '1234.56', + reply_broadcast: true, // can send a threaded message and broadcast it, too +}]); From efec9ea61c868d423b5e9e82e86273d93465342f Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 22 Nov 2023 17:08:55 -0500 Subject: [PATCH 091/122] Factor out unfurl_* props into Unfurls interface for chat.* method args. Redoing the chat.scheduleMessage args. --- packages/web-api/src/types/request/chat.ts | 33 +++++++--------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index 274711add..8dcfb1b41 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -119,6 +119,12 @@ type Authorship = (Icon & Username) | { icon_emoji?: never; icon_url?: never; }; +interface Unfurls { + /** @description Pass `true` to enable unfurling of primarily text-based content. */ + unfurl_links?: boolean; + /** @description Pass `false` to disable unfurling of media content. */ + unfurl_media?: boolean; +} // https://api.slack.com/methods/chat.delete export interface ChatDeleteArguments extends ChannelAndTS, AsUser, TokenOverridable {} @@ -147,35 +153,16 @@ export type ChatPostEphemeralArguments = TokenOverridable & MessageContents & Pa // https://api.slack.com/methods/chat.postMessage export type ChatPostMessageArguments = TokenOverridable & MessageContents & Parse & LinkNames & Authorship & Metadata -& ReplyInThread & { +& ReplyInThread & Unfurls & { /** @description Disable Slack markup parsing by setting to `false`. Enabled by default. */ mrkdwn?: boolean; - /** @description Pass `true` to enable unfurling of primarily text-based content. */ - unfurl_links?: boolean; - /** @description Pass `false` to disable unfurling of media content. */ - unfurl_media?: boolean; }; -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostEphemeralArguments // https://api.slack.com/methods/chat.scheduleMessage -export interface ChatScheduleMessageArguments extends TokenOverridable, OptionalTeamAssignable { - channel: string; - text?: string; +export type ChatScheduleMessageArguments = TokenOverridable & MessageContents & Parse & LinkNames & AsUser & Metadata +& ReplyInThread & Unfurls & { post_at: string | number; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - metadata?: MessageMetadata; - link_names?: boolean; - parse?: 'full' | 'none'; - reply_broadcast?: boolean; // if specified, thread_ts must be set - thread_ts?: string; - unfurl_links?: boolean; - unfurl_media?: boolean; -} +}; // https://api.slack.com/methods/chat.scheduledMessages.list export interface ChatScheduledMessagesListArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { From 71fd621ff991bdb9ed067fae53a0dba79bea9486 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 13:07:10 -0500 Subject: [PATCH 092/122] When assembling composite types, re-order them so that required properties are first. Seems like that impacts the way TS reports type mismatches, and this way it optimizes on reporting on mismatches in required properties first. Type tests for chat.scheduleMessage --- packages/web-api/src/types/request/chat.ts | 16 ++--- .../web-api/test/types/methods/chat.test-d.ts | 71 +++++++++++++++++++ 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index 8dcfb1b41..969187921 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -142,27 +142,27 @@ export interface ChatGetPermalinkArguments extends ChannelAndMessageTS, TokenOve export interface ChatMeMessageArguments extends ChannelAndText, TokenOverridable {} // https://api.slack.com/methods/chat.postEphemeral -export type ChatPostEphemeralArguments = TokenOverridable & MessageContents & Parse & LinkNames & Authorship -& Partial & { +export type ChatPostEphemeralArguments = TokenOverridable & MessageContents & { /** * @description `id` of the user who will receive the ephemeral message. * The user should be in the channel specified by the `channel` argument. */ user: string; -}; +} & Authorship & Parse & LinkNames & Partial; // https://api.slack.com/methods/chat.postMessage -export type ChatPostMessageArguments = TokenOverridable & MessageContents & Parse & LinkNames & Authorship & Metadata -& ReplyInThread & Unfurls & { +export type ChatPostMessageArguments = TokenOverridable & MessageContents & ReplyInThread & Authorship & Parse +& LinkNames & Metadata & Unfurls & { /** @description Disable Slack markup parsing by setting to `false`. Enabled by default. */ mrkdwn?: boolean; }; // https://api.slack.com/methods/chat.scheduleMessage -export type ChatScheduleMessageArguments = TokenOverridable & MessageContents & Parse & LinkNames & AsUser & Metadata -& ReplyInThread & Unfurls & { +export type ChatScheduleMessageArguments = TokenOverridable & MessageContents & { + /** @description Unix EPOCH timestamp of time in future to send the message. */ post_at: string | number; -}; +} & ReplyInThread & Parse & LinkNames & AsUser & Metadata & Unfurls; + // https://api.slack.com/methods/chat.scheduledMessages.list export interface ChatScheduledMessagesListArguments extends TokenOverridable, CursorPaginationEnabled, OptionalTeamAssignable { diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 066d8435d..97c882bc7 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -262,3 +262,74 @@ expectAssignable>([{ thread_ts: '1234.56', reply_broadcast: true, // can send a threaded message and broadcast it, too }]); + +// chat.scheduleMessage +// -- sad path +expectError(web.chat.scheduleMessage()); // lacking argument +expectError(web.chat.scheduleMessage({})); // empty argument +expectError(web.chat.scheduleMessage({ + channel: 'C1234', // missing text/attachments/blocks and post_at +})); +expectError(web.chat.scheduleMessage({ + channel: 'C1234', // missing text/attachments/blocks + post_at: 'U1234', +})); +expectError(web.chat.scheduleMessage({ + channel: 'C1234', // missing post_at + text: 'U1234', +})); +expectError(web.chat.scheduleMessage({ + post_at: 'U1234', // missing channel + text: 'U1234', +})); +expectError(web.chat.scheduleMessage({ + channel: 'C1234', // missing post_at + blocks: [], +})); +expectError(web.chat.scheduleMessage({ + post_at: 'U1234', // missing channel + blocks: [], +})); +expectError(web.chat.scheduleMessage({ + channel: 'C1234', // missing post_at + attachments: [], +})); +expectError(web.chat.scheduleMessage({ + post_at: 'U1234', // missing channel + attachments: [], +})); +expectError(web.chat.scheduleMessage({ + post_at: 17000000000, + channel: 'C123', + attachments: [], + reply_broadcast: true, // cannot reply_broadcast=true without setting thread_ts +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + post_at: 'U1234', + text: '1234.56', +}]); +expectAssignable>([{ + channel: 'C1234', + post_at: 'U1234', + blocks: [], +}]); +expectAssignable>([{ + channel: 'C1234', + post_at: 'U1234', + attachments: [], +}]); +expectAssignable>([{ + channel: 'C1234', + text: 'hello', + post_at: 180000000, + thread_ts: '1234.56', // can send a threaded message +}]); +expectAssignable>([{ + channel: 'C1234', + text: 'hello', + thread_ts: '1234.56', + post_at: 19000000, + reply_broadcast: true, // can send a threaded message and broadcast it, too +}]); From 38b1a4e0554c1b3f535f032a991356f2e0b1b767 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 13:52:13 -0500 Subject: [PATCH 093/122] rejigging types around to get type tests passing - TS is weird. --- packages/web-api/src/types/request/chat.ts | 17 +++--- .../web-api/test/types/methods/chat.test-d.ts | 52 +++++++++++++++++++ 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index 969187921..e44e455ce 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -1,5 +1,5 @@ import type { KnownBlock, Block, MessageAttachment, LinkUnfurls, MessageMetadata } from '@slack/types'; -import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable } from './common'; +import type { CursorPaginationEnabled, OptionalTeamAssignable, TimelinePaginationEnabled, TokenOverridable } from './common'; interface Channel { /** @description Channel ID for the message. */ @@ -164,12 +164,8 @@ export type ChatScheduleMessageArguments = TokenOverridable & MessageContents & } & ReplyInThread & Parse & LinkNames & AsUser & Metadata & Unfurls; // https://api.slack.com/methods/chat.scheduledMessages.list -export interface ChatScheduledMessagesListArguments extends TokenOverridable, - CursorPaginationEnabled, OptionalTeamAssignable { - channel?: string; - latest?: number; - oldest?: number; -} +export interface ChatScheduledMessagesListArguments extends TokenOverridable, CursorPaginationEnabled, + OptionalTeamAssignable, Pick, Partial {} interface SourceAndUnfurlID { /** @@ -183,14 +179,17 @@ interface SourceAndUnfurlID { */ unfurl_id: string; } +type UnfurlTarget = ChannelAndTS | SourceAndUnfurlID; + // https://api.slack.com/methods/chat.unfurl -export type ChatUnfurlArguments = (ChannelAndTS | SourceAndUnfurlID) & TokenOverridable -& { +export type ChatUnfurlArguments = { /** * @description URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl * blocks or message attachments. */ unfurls: LinkUnfurls; +} & UnfurlTarget & TokenOverridable +& { /** * @description Provide a simply-formatted string to send as an ephemeral message to the user as invitation to * authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again. diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 97c882bc7..947dad2e1 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -333,3 +333,55 @@ expectAssignable>([{ post_at: 19000000, reply_broadcast: true, // can send a threaded message and broadcast it, too }]); + +// chat.scheduledMessages.list +// -- sad path +expectError(web.chat.scheduledMessages.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// chat.unfurl +// -- sad path +expectError(web.chat.unfurl()); // lacking argument +expectError(web.chat.unfurl({})); // empty argument +expectError(web.chat.unfurl({ + channel: 'C1234', // missing ts and unfurls +})); +expectError(web.chat.unfurl({ + channel: 'C1234', // missing unfurls + ts: '1234.56', +})); +expectError(web.chat.unfurl({ + ts: '1234.56', + unfurls: {}, +})); +expectError(web.chat.unfurl({ + channel: 'C1234', + unfurls: {}, +})); +expectError(web.chat.unfurl({ + source: 'composer', // missing unfurl_id and unfurls +})); +expectError(web.chat.unfurl({ + source: 'composer', // missing unfurls + unfurl_id: '1234', +})); +expectError(web.chat.unfurl({ + unfurl_id: '1234.56', + unfurls: {}, +})); +expectError(web.chat.unfurl({ + source: 'conversations_history', + unfurls: {}, +})); +// -- happy path +expectAssignable>([{ + unfurls: {}, + source: 'conversations_history', + unfurl_id: '12345', +}]); +expectAssignable>([{ + unfurls: {}, + channel: 'C1234', + ts: '1234.56', +}]); From 40f706c4b62c8d95f41c265ac672f2a4a1d3835a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 14:49:31 -0500 Subject: [PATCH 094/122] finished arg refactor and type tests for chat.* APIs. --- packages/web-api/src/types/request/chat.ts | 21 ++---- .../web-api/test/types/methods/chat.test-d.ts | 67 +++++++++++++++++++ 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index e44e455ce..cd78b7d56 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -211,21 +211,14 @@ export type ChatUnfurlArguments = { */ user_auth_blocks?: (KnownBlock | Block)[]; }; -// TODO: breaking change: could use unions of types to better model either/or arguments (e.g. either channel and text -// is required OR channel and blocks OR channel and attachments) -// for an in-code example for chat.postMessage: https://github.com/slackapi/node-slack-sdk/pull/1670/files#r1346453396 -// Many of these arguments can be shared with ChatPostEphemeralArguments + // https://api.slack.com/methods/chat.update -export interface ChatUpdateArguments extends TokenOverridable { - channel: string; +export type ChatUpdateArguments = MessageContents & { + /** @description Timestamp of the message to be updated. */ ts: string; - as_user?: boolean; - attachments?: MessageAttachment[]; - blocks?: (KnownBlock | Block)[]; - link_names?: boolean; - metadata?: MessageMetadata; - parse?: 'full' | 'none'; +} & TokenOverridable & AsUser & LinkNames & Metadata & Parse & { + /** @description Array of new file ids that will be sent with this message. */ file_ids?: string[]; + /** @description Broadcast an existing thread reply to make it visible to everyone in the channel or conversation. */ reply_broadcast?: boolean; - text?: string; -} +}; diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 947dad2e1..369698a6c 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -385,3 +385,70 @@ expectAssignable>([{ channel: 'C1234', ts: '1234.56', }]); + +// chat.update +// -- sad path +expectError(web.chat.update()); // lacking argument +expectError(web.chat.update({})); // empty argument +expectError(web.chat.update({ + channel: 'C1234', // missing text/attachments/blocks and ts +})); +expectError(web.chat.update({ + channel: 'C1234', // missing text/attachments/blocks + ts: '1234.56', +})); +expectError(web.chat.update({ + text: 'U1234', // missing channel and ts +})); +expectError(web.chat.update({ + text: 'U1234', // missing channel + ts: '1234.56', +})); +expectError(web.chat.update({ + text: 'U1234', // missing ts + channel: 'C1234', +})); +expectError(web.chat.update({ + blocks: [], // missing channel and ts +})); +expectError(web.chat.update({ + blocks: [], // missing channel + ts: '1234.56', +})); +expectError(web.chat.update({ + blocks: [], // missing ts + channel: 'C1234', +})); +expectError(web.chat.update({ + attachments: [], // missing channel and ts +})); +expectError(web.chat.update({ + attachments: [], // missing channel + ts: '1234.56', +})); +expectError(web.chat.update({ + attachments: [], // missing ts + channel: 'C1234', +})); +// -- happy path +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + text: '1234.56', +}]); +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + blocks: [], +}]); +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + attachments: [], +}]); +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + text: 'hello', + reply_broadcast: true, // can broadcast a threaded msg +}]); From c3aaac44367580c0cff97d0504b9d109901d78f9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 15:30:54 -0500 Subject: [PATCH 095/122] Refactor arguments and type tests for calls.* APIs. --- packages/web-api/src/methods.ts | 63 +++++---------- packages/web-api/src/types/request/calls.ts | 63 +++++++++++++++ .../test/types/methods/calls.test-d.ts | 79 +++++++++++++++++++ 3 files changed, 163 insertions(+), 42 deletions(-) create mode 100644 packages/web-api/src/types/request/calls.ts create mode 100644 packages/web-api/test/types/methods/calls.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 7f100d1f7..ab962c3ee 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,4 +1,3 @@ -import type { CallUser } from '@slack/types'; import { EventEmitter } from 'eventemitter3'; import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; // Response types @@ -259,6 +258,7 @@ import type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSe import type { DialogOpenArguments } from './types/request/dialog'; import type { ConversationsAcceptSharedInviteArguments, ConversationsApproveSharedInviteArguments, ConversationsArchiveArguments, ConversationsCloseArguments, ConversationsCreateArguments, ConversationsDeclineSharedInviteArguments, ConversationsHistoryArguments, ConversationsInfoArguments, ConversationsInviteArguments, ConversationsInviteSharedArguments, ConversationsJoinArguments, ConversationsKickArguments, ConversationsLeaveArguments, ConversationsListArguments, ConversationsListConnectInvitesArguments, ConversationsMarkArguments, ConversationsMembersArguments, ConversationsOpenArguments, ConversationsRenameArguments, ConversationsRepliesArguments, ConversationsSetPurposeArguments, ConversationsSetTopicArguments, ConversationsUnarchiveArguments } from './types/request/conversations'; import type { ChatDeleteArguments, ChatDeleteScheduledMessageArguments, ChatGetPermalinkArguments, ChatMeMessageArguments, ChatPostEphemeralArguments, ChatPostMessageArguments, ChatScheduleMessageArguments, ChatScheduledMessagesListArguments, ChatUnfurlArguments, ChatUpdateArguments } from './types/request/chat'; +import type { CallsAddArguments, CallsEndArguments, CallsInfoArguments, CallsUpdateArguments, CallsParticipantsAddArguments, CallsParticipantsRemoveArguments } from './types/request/calls'; /** * Generic method definition @@ -637,11 +637,31 @@ export abstract class Methods extends EventEmitter { }; public readonly calls = { + /** + * @description Registers a new Call. + * @see {@link https://api.slack.com/methods/calls.add `calls.add` API reference}. + */ add: bindApiCall(this, 'calls.add'), + /** + * @description Ends a Call. + * @see {@link https://api.slack.com/methods/calls.end `calls.end` API reference}. + */ end: bindApiCall(this, 'calls.end'), + /** + * @description Returns information about a Call. + * @see {@link https://api.slack.com/methods/calls.info `calls.info` API reference}. + */ info: bindApiCall(this, 'calls.info'), + /** + * @description Updates information about a Call. + * @see {@link https://api.slack.com/methods/calls.info `calls.info` API reference}. + */ update: bindApiCall(this, 'calls.update'), participants: { + /** + * @description Registers new participants added to a Call. + * @see {@link https://api.slack.com/methods/calls.participants.add `calls.participants.add` API reference}. + */ add: bindApiCall(this, 'calls.participants.add'), remove: bindApiCall(this, 'calls.participants.remove'), }, @@ -2050,45 +2070,4 @@ export interface BookmarksRemoveArguments extends TokenOverridable { channel_id: string; } -/* -* `calls.*` -*/ -// https://api.slack.com/methods/calls.add -export interface CallsAddArguments extends TokenOverridable { - external_unique_id: string; - join_url: string; - created_by?: string; // TODO: optional only if a user token is used, required otherwise - date_start?: number; - desktop_app_join_url?: string; - external_display_id?: string; - title?: string; - users?: CallUser[]; -} -// https://api.slack.com/methods/calls.end -export interface CallsEndArguments extends TokenOverridable { - id: string; - duration?: number; -} -// https://api.slack.com/methods/calls.info -export interface CallsInfoArguments extends TokenOverridable { - id: string; -} -// https://api.slack.com/methods/calls.update -export interface CallsUpdateArguments extends TokenOverridable { - id: string; - join_url?: string; - desktop_app_join_url?: string; - title?: string; -} -// https://api.slack.com/methods/calls.participants.add -export interface CallsParticipantsAddArguments extends TokenOverridable { - id: string; - users: CallUser[]; -} -// https://api.slack.com/methods/calls.participants.remove -export interface CallsParticipantsRemoveArguments extends TokenOverridable { - id: string; - users: CallUser[]; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/calls.ts b/packages/web-api/src/types/request/calls.ts new file mode 100644 index 000000000..d388a8420 --- /dev/null +++ b/packages/web-api/src/types/request/calls.ts @@ -0,0 +1,63 @@ +import type { CallUser } from '@slack/types'; +import type { TokenOverridable } from './common'; + +interface ID { + /** @description `id` returned when registering the call using the `calls.add` method. */ + id: string; +} +interface Users { + /** + * @description The list of users to add/remove to/from the Call. + * @see {@link https://api.slack.com/apis/calls#users Using the Calls API: a note on Users}. + */ + users: CallUser[]; +} +interface CallDetails { + /** @description The URL required for a client to join the Call. */ + join_url: string; + /** + * @description When supplied, available Slack clients will attempt to directly launch the 3rd-party Call + * with this URL. + */ + desktop_app_join_url?: string; + /** @description The name of the Call. */ + title?: string; +} + +// https://api.slack.com/methods/calls.add +export interface CallsAddArguments extends Partial, CallDetails, TokenOverridable { + /** + * @description An ID supplied by the 3rd-party Call provider. It must be unique across all Calls from that service. + */ + external_unique_id: string; + /** + * @description ID of the user who created this Call. When this method is called with a user token, + * this field is optional and defaults to the authed user of the token. Otherwise, the field is required. + */ + created_by?: string; + /** @description Unix timestamp of the call start time. */ + date_start?: number; + /** + * @description An optional, human-readable ID supplied by the 3rd-party Call provider. + * If supplied, this ID will be displayed in the Call object. + */ + external_display_id?: string; +} + +// https://api.slack.com/methods/calls.end +export interface CallsEndArguments extends ID, TokenOverridable { + /** @description Call duration in seconds. */ + duration?: number; +} + +// https://api.slack.com/methods/calls.info +export interface CallsInfoArguments extends ID, TokenOverridable {} + +// https://api.slack.com/methods/calls.update +export interface CallsUpdateArguments extends ID, Partial, TokenOverridable {} + +// https://api.slack.com/methods/calls.participants.add +export interface CallsParticipantsAddArguments extends ID, Users, TokenOverridable {} + +// https://api.slack.com/methods/calls.participants.remove +export interface CallsParticipantsRemoveArguments extends ID, Users, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/calls.test-d.ts b/packages/web-api/test/types/methods/calls.test-d.ts new file mode 100644 index 000000000..438ba293d --- /dev/null +++ b/packages/web-api/test/types/methods/calls.test-d.ts @@ -0,0 +1,79 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// calls.add +// -- sad path +expectError(web.calls.add()); // lacking argument +expectError(web.calls.add({})); // empty argument +expectError(web.calls.add({ + external_unique_id: '1234.566', // missing join_url +})); +expectError(web.calls.add({ + join_url: '1234.566', // missing external_unique_id +})); +// -- happy path +expectAssignable>([{ + external_unique_id: '1234.566', + join_url: '1234.566', +}]); + +// calls.end +// -- sad path +expectError(web.calls.end()); // lacking argument +expectError(web.calls.end({})); // empty argument +// -- happy path +expectAssignable>([{ + id: 'R1234', +}]); + +// calls.info +// -- sad path +expectError(web.calls.info()); // lacking argument +expectError(web.calls.info({})); // empty argument +// -- happy path +expectAssignable>([{ + id: 'R1234', +}]); + +// calls.update +// -- sad path +expectError(web.calls.update()); // lacking argument +expectError(web.calls.update({})); // empty argument +// -- happy path +expectAssignable>([{ + id: 'R1234', +}]); + +// calls.participants.add +// -- sad path +expectError(web.calls.participants.add()); // lacking argument +expectError(web.calls.participants.add({})); // empty argument +expectError(web.calls.participants.add({ + id: 'R1234', // missing users +})); +expectError(web.calls.participants.add({ + users: [], // missing id +})); +// -- happy path +expectAssignable>([{ + id: 'R1234', + users: [], +}]); + +// calls.participants.remove +// -- sad path +expectError(web.calls.participants.remove()); // lacking argument +expectError(web.calls.participants.remove({})); // empty argument +expectError(web.calls.participants.remove({ + id: 'R1234', // missing users +})); +expectError(web.calls.participants.remove({ + users: [], // missing id +})); +// -- happy path +expectAssignable>([{ + id: 'R1234', + users: [], +}]); From 73e1a9e56593a89e7e279a4070f795ca963ecb74 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 16:18:27 -0500 Subject: [PATCH 096/122] Refactor arguments and type tests for bots.* and bookmarks.* APIs. --- packages/web-api/src/methods.ts | 72 ++++------ .../web-api/src/types/request/bookmarks.ts | 35 +++++ packages/web-api/src/types/request/bots.ts | 7 + .../test/types/methods/bookmarks.test-d.ts | 123 ++++++++++++++++++ .../web-api/test/types/methods/bots.test-d.ts | 10 ++ 5 files changed, 202 insertions(+), 45 deletions(-) create mode 100644 packages/web-api/src/types/request/bookmarks.ts create mode 100644 packages/web-api/src/types/request/bots.ts create mode 100644 packages/web-api/test/types/methods/bookmarks.test-d.ts create mode 100644 packages/web-api/test/types/methods/bots.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index ab962c3ee..9144f01cd 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -236,7 +236,7 @@ import type { AdminAppsConfigSetResponse, } from './types/response'; // Request types -import type { TokenOverridable, OptionalTeamAssignable, CursorPaginationEnabled } from './types/request/common'; +import type { TokenOverridable, CursorPaginationEnabled } from './types/request/common'; import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; @@ -259,6 +259,8 @@ import type { DialogOpenArguments } from './types/request/dialog'; import type { ConversationsAcceptSharedInviteArguments, ConversationsApproveSharedInviteArguments, ConversationsArchiveArguments, ConversationsCloseArguments, ConversationsCreateArguments, ConversationsDeclineSharedInviteArguments, ConversationsHistoryArguments, ConversationsInfoArguments, ConversationsInviteArguments, ConversationsInviteSharedArguments, ConversationsJoinArguments, ConversationsKickArguments, ConversationsLeaveArguments, ConversationsListArguments, ConversationsListConnectInvitesArguments, ConversationsMarkArguments, ConversationsMembersArguments, ConversationsOpenArguments, ConversationsRenameArguments, ConversationsRepliesArguments, ConversationsSetPurposeArguments, ConversationsSetTopicArguments, ConversationsUnarchiveArguments } from './types/request/conversations'; import type { ChatDeleteArguments, ChatDeleteScheduledMessageArguments, ChatGetPermalinkArguments, ChatMeMessageArguments, ChatPostEphemeralArguments, ChatPostMessageArguments, ChatScheduleMessageArguments, ChatScheduledMessagesListArguments, ChatUnfurlArguments, ChatUpdateArguments } from './types/request/chat'; import type { CallsAddArguments, CallsEndArguments, CallsInfoArguments, CallsUpdateArguments, CallsParticipantsAddArguments, CallsParticipantsRemoveArguments } from './types/request/calls'; +import type { BotsInfoArguments } from './types/request/bots'; +import type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArguments, BookmarksRemoveArguments } from './types/request/bookmarks'; /** * Generic method definition @@ -625,17 +627,37 @@ export abstract class Methods extends EventEmitter { test: bindApiCall(this, 'auth.test'), }; - public readonly bots = { - info: bindApiCall(this, 'bots.info'), - }; - public readonly bookmarks = { + /** + * @description Add bookmark to a channel. + * @see {@link https://api.slack.com/methods/bookmarks.add `bookmarks.add` API reference}. + */ add: bindApiCall(this, 'bookmarks.add'), + /** + * @description Edit bookmark. + * @see {@link https://api.slack.com/methods/bookmarks.edit `bookmarks.edit` API reference}. + */ edit: bindApiCall(this, 'bookmarks.edit'), + /** + * @description List bookmarks for a channel. + * @see {@link https://api.slack.com/methods/bookmarks.list `bookmarks.list` API reference}. + */ list: bindApiCall(this, 'bookmarks.list'), + /** + * @description Remove bookmark from a channel. + * @see {@link https://api.slack.com/methods/bookmarks.remove `bookmarks.remove` API reference}. + */ remove: bindApiCall(this, 'bookmarks.remove'), }; + public readonly bots = { + /** + * @description Gets information about a bot user. + * @see {@link https://api.slack.com/methods/bots.info `bots.info` API reference}. + */ + info: bindApiCall(this, 'bots.info'), + }; + public readonly calls = { /** * @description Registers a new Call. @@ -2030,44 +2052,4 @@ export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginati // https://api.slack.com/methods/auth.test export interface AuthTestArguments extends TokenOverridable { } -/* - * `bots.*` - */ -// https://api.slack.com/methods/bots.info -export interface BotsInfoArguments extends TokenOverridable, OptionalTeamAssignable { - bot?: string; -} - -/* - * `bookmarks.*` - */ -// https://api.slack.com/methods/bookmarks.add -export interface BookmarksAddArguments extends TokenOverridable { - channel_id: string; - title: string; - type: 'link'; - link: string; // TODO: Today, `link` is a required field because we only support type:link. - // As more bookmarking options get added in the future, this will change. - emoji?: string; - entity_id?: string; - parent_id?: string; -} -// https://api.slack.com/methods/bookmarks.edit -export interface BookmarksEditArguments extends TokenOverridable { - bookmark_id: string; - channel_id: string; - emoji?: string; - link?: string; - title?: string; -} -// https://api.slack.com/methods/bookmarks.list -export interface BookmarksListArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/bookmarks.remove -export interface BookmarksRemoveArguments extends TokenOverridable { - bookmark_id: string; - channel_id: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/bookmarks.ts b/packages/web-api/src/types/request/bookmarks.ts new file mode 100644 index 000000000..d3a0ef984 --- /dev/null +++ b/packages/web-api/src/types/request/bookmarks.ts @@ -0,0 +1,35 @@ +import type { TokenOverridable } from './common'; + +interface Channel { + /** @description Channel containing bookmark. */ + channel_id: string; +} +interface ID { + bookmark_id: string; +} +interface BookmarkFields { + /** @description Title for the bookmark. */ + title: string; + /** @description Link to bookmark. */ + link: string; + /** @description Emoji tag to apply to the bookmark. */ + emoji?: string; +} + +// https://api.slack.com/methods/bookmarks.add +export interface BookmarksAddArguments extends Channel, BookmarkFields, TokenOverridable { + /** @description Type of the bookmark. Only `link` is supported at the moment. */ + type: 'link'; + /** @description ID of the entity being bookmarked. Only applies to message and file types. */ + entity_id?: string; + /** @description ID of this bookmark's parent. */ + parent_id?: string; +} +// https://api.slack.com/methods/bookmarks.edit +export interface BookmarksEditArguments extends Channel, ID, Partial, TokenOverridable {} + +// https://api.slack.com/methods/bookmarks.list +export interface BookmarksListArguments extends Channel, TokenOverridable {} + +// https://api.slack.com/methods/bookmarks.remove +export interface BookmarksRemoveArguments extends Channel, ID, TokenOverridable {} diff --git a/packages/web-api/src/types/request/bots.ts b/packages/web-api/src/types/request/bots.ts new file mode 100644 index 000000000..c448f7f24 --- /dev/null +++ b/packages/web-api/src/types/request/bots.ts @@ -0,0 +1,7 @@ +import type { OptionalTeamAssignable, TokenOverridable } from './common'; + +// https://api.slack.com/methods/bots.info +export interface BotsInfoArguments extends TokenOverridable, OptionalTeamAssignable { + /** @description Bot user ID to retrieve information about. */ + bot?: string; +} diff --git a/packages/web-api/test/types/methods/bookmarks.test-d.ts b/packages/web-api/test/types/methods/bookmarks.test-d.ts new file mode 100644 index 000000000..86474f108 --- /dev/null +++ b/packages/web-api/test/types/methods/bookmarks.test-d.ts @@ -0,0 +1,123 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// bookmarks.add +// -- sad path +expectError(web.bookmarks.add()); // lacking argument +expectError(web.bookmarks.add({})); // empty argument +expectError(web.bookmarks.add({ + channel_id: 'C1234', // missing title, link, type +})); +expectError(web.bookmarks.add({ + type: 'link', + channel_id: 'C1234', // missing title, link +})); +expectError(web.bookmarks.add({ + title: 'link', + channel_id: 'C1234', // missing type, link +})); +expectError(web.bookmarks.add({ + link: 'url.com', + channel_id: 'C1234', // missing type, channel_id +})); +expectError(web.bookmarks.add({ + type: 'link', + channel_id: 'C1234', // missing link + title: 'test', +})); +expectError(web.bookmarks.add({ + link: 'link', + channel_id: 'C1234', // missing type + title: 'test', +})); +expectError(web.bookmarks.add({ + link: 'link', + channel_id: 'C1234', // missing title + type: 'link', +})); +expectError(web.bookmarks.add({ + type: 'link', // missing channel_id, link, title +})); +expectError(web.bookmarks.add({ + type: 'link', // missing channel_id, link + title: 'test', +})); +expectError(web.bookmarks.add({ + type: 'link', // missing channel_id, title + link: 'url', +})); +expectError(web.bookmarks.add({ + link: 'link', + title: 'test', // missing channel_id + type: 'link', +})); +expectError(web.bookmarks.add({ + title: 'test', // missing channel_id, link, type +})); +expectError(web.bookmarks.add({ + title: 'test', // missing channel_id, type + link: 'test.com', +})); +expectError(web.bookmarks.add({ + channel_id: 'C1234', + title: 'test', // missing link + type: 'link', +})); +expectError(web.bookmarks.add({ + link: 'test', // missing channel_id, title, type +})); +expectError(web.bookmarks.add({ + link: 'link', + title: 'test', // missing channel + type: 'link', +})); +// -- happy path +expectAssignable>([{ + type: 'link', + title: 'test', + channel_id: 'C1234', + link: 'example.com', +}]); + +// bookmarks.edit +// -- sad path +expectError(web.bookmarks.edit()); // lacking argument +expectError(web.bookmarks.edit({})); // empty argument +expectError(web.bookmarks.edit({ + channel_id: 'C1234', // missing bookmark_id +})); +expectError(web.bookmarks.edit({ + bookmark_id: 'B1234', // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + bookmark_id: 'B1234', +}]); + +// bookmarks.list +// -- sad path +expectError(web.bookmarks.list()); // lacking argument +expectError(web.bookmarks.list({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// bookmarks.remove +// -- sad path +expectError(web.bookmarks.remove()); // lacking argument +expectError(web.bookmarks.remove({})); // empty argument +expectError(web.bookmarks.remove({ + channel_id: 'C1234', // missing bookmark_id +})); +expectError(web.bookmarks.remove({ + bookmark_id: 'B1234', // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + bookmark_id: 'B1234', +}]); diff --git a/packages/web-api/test/types/methods/bots.test-d.ts b/packages/web-api/test/types/methods/bots.test-d.ts new file mode 100644 index 000000000..99ab5f04f --- /dev/null +++ b/packages/web-api/test/types/methods/bots.test-d.ts @@ -0,0 +1,10 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// bots.info +// -- sad path +expectError(web.bots.info()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args From 64529a05c7ffa4095112a787a62ae0c992258d6e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 23 Nov 2023 16:25:44 -0500 Subject: [PATCH 097/122] Refactor arguments and type tests for auth.* APIs. --- packages/web-api/src/methods.ts | 23 ++++++++----------- packages/web-api/src/types/request/auth.ts | 23 +++++++++++++++++++ .../web-api/test/types/methods/auth.test-d.ts | 22 ++++++++++++++++++ 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 packages/web-api/src/types/request/auth.ts create mode 100644 packages/web-api/test/types/methods/auth.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 9144f01cd..a4d892d86 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -261,6 +261,7 @@ import type { ChatDeleteArguments, ChatDeleteScheduledMessageArguments, ChatGetP import type { CallsAddArguments, CallsEndArguments, CallsInfoArguments, CallsUpdateArguments, CallsParticipantsAddArguments, CallsParticipantsRemoveArguments } from './types/request/calls'; import type { BotsInfoArguments } from './types/request/bots'; import type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArguments, BookmarksRemoveArguments } from './types/request/bookmarks'; +import type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } from './types/request/auth'; /** * Generic method definition @@ -620,8 +621,16 @@ export abstract class Methods extends EventEmitter { }; public readonly auth = { + /** + * @description Revokes a token. + * @see {@link https://api.slack.com/methods/auth.revoke `auth.revoke` API reference}. + */ revoke: bindApiCall(this, 'auth.revoke'), teams: { + /** + * @description Obtain a full list of workspaces your org-wide app has been approved for. + * @see {@link https://api.slack.com/methods/auth.teams.list `auth.teams.list` API reference}. + */ list: bindApiCall(this, 'auth.teams.list'), }, test: bindApiCall(this, 'auth.test'), @@ -2038,18 +2047,4 @@ export interface AppsUninstallArguments { client_secret: string; } -/* - * `auth.*` - */ -// https://api.slack.com/methods/auth.revoke -export interface AuthRevokeArguments extends TokenOverridable { - test?: boolean; -} -// https://api.slack.com/methods/auth.teams.list -export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { - include_icon?: boolean; -} -// https://api.slack.com/methods/auth.test -export interface AuthTestArguments extends TokenOverridable { } - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/auth.ts b/packages/web-api/src/types/request/auth.ts new file mode 100644 index 000000000..3da060665 --- /dev/null +++ b/packages/web-api/src/types/request/auth.ts @@ -0,0 +1,23 @@ +import type { CursorPaginationEnabled, TokenOverridable } from './common'; + +// https://api.slack.com/methods/auth.revoke +export interface AuthRevokeArguments extends TokenOverridable { + /** + * @description Setting this parameter to `true` triggers a testing mode where the specified token + * will not actually be revoked. + */ + test?: boolean; +} + +// https://api.slack.com/methods/auth.teams.list +export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { + /** + * @description Whether to return icon paths for each workspace. + * An icon path represents a URI pointing to the image signifying the workspace. + * Defaults to `false`. + */ + include_icon?: boolean; +} + +// https://api.slack.com/methods/auth.test +export interface AuthTestArguments extends TokenOverridable { } diff --git a/packages/web-api/test/types/methods/auth.test-d.ts b/packages/web-api/test/types/methods/auth.test-d.ts new file mode 100644 index 000000000..68d817a92 --- /dev/null +++ b/packages/web-api/test/types/methods/auth.test-d.ts @@ -0,0 +1,22 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// auth.revoke +// -- sad path +expectError(web.auth.revoke()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// auth.teams.list +// -- sad path +expectError(web.auth.teams.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// auth.test +// -- sad path +expectError(web.auth.test()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args From 6323f6ec6d5000f11bffb357c7eef311c2708d1c Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 24 Nov 2023 12:16:09 -0500 Subject: [PATCH 098/122] jsdoc and some type tests for apps.* API, but manifest APIs needs some thinking. do we want to type them fully? --- packages/web-api/src/methods.ts | 74 +++++++++---------- packages/web-api/src/types/request/apps.ts | 46 ++++++++++++ .../web-api/test/types/methods/apps.test-d.ts | 35 +++++++++ 3 files changed, 116 insertions(+), 39 deletions(-) create mode 100644 packages/web-api/src/types/request/apps.ts create mode 100644 packages/web-api/test/types/methods/apps.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index a4d892d86..dfab05a0e 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -262,6 +262,7 @@ import type { CallsAddArguments, CallsEndArguments, CallsInfoArguments, CallsUpd import type { BotsInfoArguments } from './types/request/bots'; import type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArguments, BookmarksRemoveArguments } from './types/request/bookmarks'; import type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } from './types/request/auth'; +import type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, AppsManifestCreateArguments, AppsManifestDeleteArguments, AppsManifestExportArguments, AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments } from './types/request/apps'; /** * Generic method definition @@ -600,10 +601,20 @@ export abstract class Methods extends EventEmitter { public readonly apps = { connections: { + /** + * @description Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive + * events and interactive payloads over. + * @see {@link https://api.slack.com/methods/apps.connections.open `apps.connections.open` API reference}. + */ open: bindApiCall(this, 'apps.connections.open'), }, event: { authorizations: { + /** + * @description Get a list of authorizations for the given event context. + * Each authorization represents an app installation that the event is visible to. + * @see {@link https://api.slack.com/methods/apps.event.authorizations.list `apps.event.authorizations.list` API reference}. + */ list: bindApiCall( this, 'apps.event.authorizations.list', @@ -611,12 +622,36 @@ export abstract class Methods extends EventEmitter { }, }, manifest: { + /** + * @description Create an app from an app manifest. + * @see {@link https://api.slack.com/methods/apps.manifest.create `apps.manifest.create` API reference}. + */ create: bindApiCall(this, 'apps.manifest.create'), + /** + * @description Permanently deletes an app created through app manifests. + * @see {@link https://api.slack.com/methods/apps.manifest.delete `apps.manifest.delete` API reference}. + */ delete: bindApiCall(this, 'apps.manifest.delete'), + /** + * @description Export an app manifest from an existing app. + * @see {@link https://api.slack.com/methods/apps.manifest.export `apps.manifest.export` API reference}. + */ export: bindApiCall(this, 'apps.manifest.export'), + /** + * @description Update an app from an app manifest. + * @see {@link https://api.slack.com/methods/apps.manifest.update `apps.manifest.update` API reference}. + */ update: bindApiCall(this, 'apps.manifest.update'), + /** + * @description Validate an app manifest. + * @see {@link https://api.slack.com/methods/apps.manifest.validate `apps.manifest.validate` API reference}. + */ validate: bindApiCall(this, 'apps.manifest.validate'), }, + /** + * @description Uninstalls your app from a workspace. + * @see {@link https://api.slack.com/methods/apps.uninstall `apps.uninstall` API reference}. + */ uninstall: bindApiCall(this, 'apps.uninstall'), }; @@ -2008,43 +2043,4 @@ export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface APITestArguments { } -/* - * `apps.*` - */ -// https://api.slack.com/methods/apps.connections.open -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AppsConnectionsOpenArguments { } -// https://api.slack.com/methods/apps.event.authorizations.list -export interface AppsEventAuthorizationsListArguments - extends TokenOverridable, CursorPaginationEnabled { - event_context: string; -} - -export interface AppsManifestCreateArguments extends TokenOverridable { - manifest: string; -} - -export interface AppsManifestDeleteArguments extends TokenOverridable { - app_id: string; -} - -export interface AppsManifestExportArguments extends TokenOverridable { - app_id: string; -} - -export interface AppsManifestUpdateArguments extends TokenOverridable { - app_id: string; - manifest: string; -} - -export interface AppsManifestValidateArguments extends TokenOverridable { - app_id?: string; - manifest: string; -} -// https://api.slack.com/methods/apps.uninstall -export interface AppsUninstallArguments { - client_id: string; - client_secret: string; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/apps.ts b/packages/web-api/src/types/request/apps.ts new file mode 100644 index 000000000..6d2370c3e --- /dev/null +++ b/packages/web-api/src/types/request/apps.ts @@ -0,0 +1,46 @@ +import type { CursorPaginationEnabled, TokenOverridable, OAuthCredentials } from './common'; + +// https://api.slack.com/methods/apps.connections.open +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface AppsConnectionsOpenArguments { } + +// https://api.slack.com/methods/apps.event.authorizations.list +export interface AppsEventAuthorizationsListArguments + extends TokenOverridable, CursorPaginationEnabled { + event_context: string; +} + +// TODO:determine how to type the `manifest` field: string? actual interface? +// some prior art we can borrow/steal from: +// - https://github.com/seratch/slack-web-api-client/blob/main/src/manifest/manifest-params.ts +// - https://github.com/slackapi/deno-slack-sdk/blob/main/src/manifest/manifest_schema.ts#L14 +// TODO:should also link to https://api.slack.com/reference/manifests#fields throughout +// https://api.slack.com/methods/apps.manifest.create +export interface AppsManifestCreateArguments extends TokenOverridable { + manifest: string; +} + +// https://api.slack.com/methods/apps.manifest.delete +export interface AppsManifestDeleteArguments extends TokenOverridable { + app_id: string; +} + +// https://api.slack.com/methods/apps.manifest.export +export interface AppsManifestExportArguments extends TokenOverridable { + app_id: string; +} + +// https://api.slack.com/methods/apps.manifest.update +export interface AppsManifestUpdateArguments extends TokenOverridable { + app_id: string; + manifest: string; +} + +// https://api.slack.com/methods/apps.manifest.validate +export interface AppsManifestValidateArguments extends TokenOverridable { + app_id?: string; + manifest: string; +} + +// https://api.slack.com/methods/apps.uninstall +export interface AppsUninstallArguments extends Pick {} diff --git a/packages/web-api/test/types/methods/apps.test-d.ts b/packages/web-api/test/types/methods/apps.test-d.ts new file mode 100644 index 000000000..ce2b08ae7 --- /dev/null +++ b/packages/web-api/test/types/methods/apps.test-d.ts @@ -0,0 +1,35 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// apps.connections.open +// -- sad path +expectError(web.apps.connections.open()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// apps.event.authorizations.list +// -- sad path +expectError(web.apps.event.authorizations.list()); // lacking argument +expectError(web.apps.event.authorizations.list({})); // empty argument +// -- happy path +expectAssignable>([{ + event_context: '12345', +}]); + +// apps.uninstall +// -- sad path +expectError(web.apps.uninstall()); // lacking argument +expectError(web.apps.uninstall({})); // empty argument +expectError(web.apps.uninstall({ + client_id: '1234.56', // missing client_secret +})); +expectError(web.apps.uninstall({ + client_secret: '1234.56', // missing client_id +})); +// -- happy path +expectAssignable>([{ + client_id: '1234.56', + client_secret: 'ABC123', +}]); From f453f2ef3ed55e7dc72f32591041eec0f1f68993 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 24 Nov 2023 12:39:59 -0500 Subject: [PATCH 099/122] Refactor arguments and type tests for api.test API. --- packages/web-api/src/methods.ts | 11 +++++------ packages/web-api/src/types/request/api.ts | 5 +++++ packages/web-api/test/types/methods/api.test-d.ts | 10 ++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 packages/web-api/src/types/request/api.ts create mode 100644 packages/web-api/test/types/methods/api.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index dfab05a0e..2ad7f5d03 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -263,6 +263,7 @@ import type { BotsInfoArguments } from './types/request/bots'; import type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArguments, BookmarksRemoveArguments } from './types/request/bookmarks'; import type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } from './types/request/auth'; import type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, AppsManifestCreateArguments, AppsManifestDeleteArguments, AppsManifestExportArguments, AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments } from './types/request/apps'; +import type { APITestArguments } from './types/request/api'; /** * Generic method definition @@ -596,6 +597,10 @@ export abstract class Methods extends EventEmitter { }; public readonly api = { + /** + * @description Checks API calling code. + * @see {@link https://api.slack.com/methods/api.test `api.test` API reference}. + */ test: bindApiCall(this, 'api.test'), }; @@ -2036,11 +2041,5 @@ export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorP export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { workflow_ids: string[]; } -/* - * `api.*` - */ -// https://api.slack.com/methods/api.test -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface APITestArguments { } export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/api.ts b/packages/web-api/src/types/request/api.ts new file mode 100644 index 000000000..709e2f211 --- /dev/null +++ b/packages/web-api/src/types/request/api.ts @@ -0,0 +1,5 @@ +// https://api.slack.com/methods/api.test +export interface APITestArguments { + /** @description Error response to return. */ + error?: string; +} diff --git a/packages/web-api/test/types/methods/api.test-d.ts b/packages/web-api/test/types/methods/api.test-d.ts new file mode 100644 index 000000000..87aa8a0ac --- /dev/null +++ b/packages/web-api/test/types/methods/api.test-d.ts @@ -0,0 +1,10 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// api.test +// -- sad path +expectError(web.api.test()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args From a3db51767dcbe602a85c144d788259bff4dee36a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 24 Nov 2023 13:17:27 -0500 Subject: [PATCH 100/122] stubbing out bits for admin.analytics.getFile API but need access to an enterprise org with specific settings set up properly - TODO on Monday --- packages/web-api/src/methods.ts | 17 +++++------------ .../src/types/request/admin/analytics.ts | 11 +++++++++++ 2 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/analytics.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2ad7f5d03..5d28c1c3d 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -264,6 +264,7 @@ import type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArgume import type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } from './types/request/auth'; import type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, AppsManifestCreateArguments, AppsManifestDeleteArguments, AppsManifestExportArguments, AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments } from './types/request/apps'; import type { APITestArguments } from './types/request/api'; +import type { AdminAnalyticsGetFileArguments } from './types/request/admin/analytics'; /** * Generic method definition @@ -312,6 +313,10 @@ export abstract class Methods extends EventEmitter { public readonly admin = { analytics: { + /** + * @description Retrieve analytics data for a given date, presented as a compressed JSON file. + * @see {@link https://api.slack.com/methods/api.test `api.test` API reference}. + */ getFile: bindApiCall(this, 'admin.analytics.getFile'), }, apps: { @@ -1482,18 +1487,6 @@ export abstract class Methods extends EventEmitter { }; } -/* -* `admin.*` -*/ -// TODO: breaking changes - potential type improvements: -// - date is required _except_ if metadata_only=true -// - metadata_only=true only works with type=public_channel -// https://api.slack.com/methods/admin.analytics.getFile -export interface AdminAnalyticsGetFileArguments extends TokenOverridable { - type: 'public_channel' | 'member'; - date?: string; - metadata_only?: boolean; -} // TODO: breaking changes - potential type improvements: // - exactly one of `team_id` or `enterprise_id` is required - but not both // - either `app_id` or `request_id` is required diff --git a/packages/web-api/src/types/request/admin/analytics.ts b/packages/web-api/src/types/request/admin/analytics.ts new file mode 100644 index 000000000..091eee681 --- /dev/null +++ b/packages/web-api/src/types/request/admin/analytics.ts @@ -0,0 +1,11 @@ +import type { TokenOverridable } from '../common'; + +// TODO: breaking changes - potential type improvements: +// - date is required _except_ if metadata_only=true. metadata=true, then we are to omit it (according to docs) +// - metadata_only=true only works with type=public_channel +// https://api.slack.com/methods/admin.analytics.getFile +export interface AdminAnalyticsGetFileArguments extends TokenOverridable { + type: 'public_channel' | 'member'; + date?: string; + metadata_only?: boolean; +} From 80c3d5ef4b742a5014e987bc6a289f5551b4afd0 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 24 Nov 2023 16:15:55 -0500 Subject: [PATCH 101/122] Refactor arguments and type tests for admin.apps.* APIs. --- packages/web-api/src/methods.ts | 151 ++++------- .../web-api/src/types/request/admin/apps.ts | 100 +++++++ .../test/types/methods/admin.apps.test-d.ts | 244 ++++++++++++++++++ 3 files changed, 396 insertions(+), 99 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/apps.ts create mode 100644 packages/web-api/test/types/methods/admin.apps.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 5d28c1c3d..6e3dfdbfe 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -265,6 +265,7 @@ import type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } f import type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, AppsManifestCreateArguments, AppsManifestDeleteArguments, AppsManifestExportArguments, AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments } from './types/request/apps'; import type { APITestArguments } from './types/request/api'; import type { AdminAnalyticsGetFileArguments } from './types/request/admin/analytics'; +import type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, AdminAppsApprovedListArguments, AdminAppsClearResolutionArguments, AdminAppsConfigLookupArguments, AdminAppsConfigSetArguments, AdminAppsRequestsCancelArguments, AdminAppsRequestsListArguments, AdminAppsRestrictArguments, AdminAppsRestrictedListArguments, AdminAppsUninstallArguments } from './types/request/admin/apps'; /** * Generic method definition @@ -320,28 +321,72 @@ export abstract class Methods extends EventEmitter { getFile: bindApiCall(this, 'admin.analytics.getFile'), }, apps: { + activities: { + /** + * @description Get logs for a specified team/org. + * @see {@link https://api.slack.com/methods/admin.apps.activities.list `admin.apps.activities.list` API reference}. + */ + list: bindApiCall(this, 'admin.apps.activities.list'), + }, + /** + * @description Approve an app for installation on a workspace. + * @see {@link https://api.slack.com/methods/admin.apps.approve `admin.apps.approve` API reference}. + */ approve: bindApiCall(this, 'admin.apps.approve'), approved: { + /** + * @description List approved apps for an org or workspace. + * @see {@link https://api.slack.com/methods/admin.apps.approved.list `admin.apps.approved.list` API reference}. + */ list: bindApiCall(this, 'admin.apps.approved.list'), }, + /** + * @description Clear an app resolution. + * @see {@link https://api.slack.com/methods/admin.apps.clearResolution `admin.apps.clearResolution` API reference}. + */ clearResolution: bindApiCall(this, 'admin.apps.clearResolution'), + config: { + /** + * @description Look up the app config for connectors by their IDs. + * @see {@link https://api.slack.com/methods/admin.apps.config.lookup `admin.apps.config.lookup` API reference}. + */ + lookup: bindApiCall(this, 'admin.apps.config.lookup'), + /** + * @description Set the app config for a connector. + * @see {@link https://api.slack.com/methods/admin.apps.config.set `admin.apps.config.set` API reference}. + */ + set: bindApiCall(this, 'admin.apps.config.set'), + }, requests: { + /** + * @description Cancel app request for team. + * @see {@link https://api.slack.com/methods/admin.apps.requests.cancel `admin.apps.requests.cancel` API reference}. + */ cancel: bindApiCall(this, 'admin.apps.requests.cancel'), + /** + * @description List app requests for a team/workspace. + * @see {@link https://api.slack.com/methods/admin.apps.requests.list `admin.apps.requests.list` API reference}. + */ list: bindApiCall(this, 'admin.apps.requests.list'), }, + /** + * @description Restrict an app for installation on a workspace. + * @see {@link https://api.slack.com/methods/admin.apps.restrict `admin.apps.restrict` API reference}. + */ restrict: bindApiCall(this, 'admin.apps.restrict'), restricted: { + /** + * @description List restricted apps for an org or workspace. + * @see {@link https://api.slack.com/methods/admin.apps.restricted.list `admin.apps.restricted.list` API reference}. + */ list: bindApiCall(this, 'admin.apps.restricted.list'), }, + /** + * @description Uninstall an app from one or many workspaces, or an entire enterprise organization. + * @see {@link https://api.slack.com/methods/admin.apps.uninstall `admin.apps.uninstall` API reference}. + */ uninstall: bindApiCall(this, 'admin.apps.uninstall'), - activities: { - list: bindApiCall(this, 'admin.apps.activities.list'), - }, - config: { - lookup: bindApiCall(this, 'admin.apps.config.lookup'), - set: bindApiCall(this, 'admin.apps.config.set'), - }, }, auth: { policy: { @@ -1487,98 +1532,6 @@ export abstract class Methods extends EventEmitter { }; } -// TODO: breaking changes - potential type improvements: -// - exactly one of `team_id` or `enterprise_id` is required - but not both -// - either `app_id` or `request_id` is required -// https://api.slack.com/methods/admin.apps.approve -export interface AdminAppsApproveArguments extends TokenOverridable { - app_id?: string; - enterprise_id?: string; - request_id?: string; - team_id?: string; -} -// TODO: breaking changes - potential type improvements: -// - cannot provide both `team_id` or `enterprise_id` (but can provide neither, will infer from token) -// https://api.slack.com/methods/admin.apps.approved.list -export interface AdminAppsApprovedListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id?: string; - enterprise_id?: string; - certified?: boolean; -} -// TODO: breaking changes - potential type improvements: -// - exactly one of `team_id` or `enterprise_id` is required - but not both -// https://api.slack.com/methods/admin.apps.clearResolution -export interface AdminAppsClearResolutionArguments { - app_id: string; - enterprise_id?: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.apps.requests.cancel -export interface AdminAppsRequestsCancelArguments extends TokenOverridable { - request_id: string; - enterprise_id?: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.apps.requests.list -export interface AdminAppsRequestsListArguments extends TokenOverridable, CursorPaginationEnabled { - certified?: boolean; - enterprise_id?: string; - team_id?: string; // required if your enterprise grid contains more than one workspace -} -// TODO: breaking changes - potential type improvements: -// - exactly one of `team_id` or `enterprise_id` is required - but not both -// - either `app_id` or `request_id` is required -// https://api.slack.com/methods/admin.apps.restrict -export interface AdminAppsRestrictArguments extends TokenOverridable { - app_id?: string; - request_id?: string; - team_id?: string; - enterprise_id?: string; -} -// TODO: breaking changes - potential type improvements: -// - cannot provide both `team_id` or `enterprise_id` (but can provide neither, will infer from token) -// https://api.slack.com/methods/admin.apps.restricted.list -export interface AdminAppsRestrictedListArguments extends TokenOverridable, CursorPaginationEnabled { - certified?: boolean; - team_id?: string; - enterprise_id?: string; -} - -// TODO: breaking changes - potential type improvements: -// - exactly one of `team_id` or `enterprise_id` is required - but not both -// https://api.slack.com/methods/admin.apps.uninstall -export interface AdminAppsUninstallArguments { - app_id: string; - enterprise_id?: string; - team_ids?: string[]; // TODO: breaking change, enforce at least one array item? -} -// https://api.slack.com/methods/admin.apps.activities.list -export interface AdminAppsActivitiesListArguments extends TokenOverridable, CursorPaginationEnabled { - app_id?: string; - component_id?: string; - component_type?: 'events_api' | 'workflows' | 'functions' | 'tables'; - log_event_type?: string; - max_date_created?: number; - min_date_created?: number; - min_log_level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; - sort_direction?: string; // TODO: change to 'asc' | 'desc'? - source?: 'slack' | 'developer'; - team_id?: string; - trace_id?: string; -} -// TODO: does not get used, should add method implementation, see https://github.com/slackapi/node-slack-sdk/issues/1675 -export interface AdminAppsConfigLookupArguments extends TokenOverridable { - app_ids: string[]; -} -// TODO: does not get used, should add method implementation, see https://github.com/slackapi/node-slack-sdk/issues/1675 -export interface AdminAppsConfigSetArguments extends TokenOverridable { - app_id: string; - domain_restrictions?: { - urls?: string[]; // TODO: breaking change, enforce at least one array item? - emails?: string[]; // TODO: breaking change, enforce at least one array item? - }; - workflow_auth_strategy?: 'builder_choice' | 'end_user_strategy'; -} // https://api.slack.com/methods/admin.auth.policy.assignEntities export interface AdminAuthPolicyAssignEntitiesArguments extends TokenOverridable { entity_ids: string[]; // TODO: breaking change, enforce at least one array item? diff --git a/packages/web-api/src/types/request/admin/apps.ts b/packages/web-api/src/types/request/admin/apps.ts new file mode 100644 index 000000000..1795e3987 --- /dev/null +++ b/packages/web-api/src/types/request/admin/apps.ts @@ -0,0 +1,100 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +interface AppID { + /** @description The ID of the app. */ + app_id: string; +} +interface RequestID { + /** @description The id of the request. */ + request_id: string; +} +// Models either app_id or request_id - but not both. +type AppOrRequestID = (AppID & { request_id?: never; }) | (RequestID & { app_id?: never; }); +interface EnterpriseID { + /** @description The ID of the enterprise. */ + enterprise_id: string; +} +interface TeamID { + /** @description The ID of the workspace. */ + team_id: string; +} +// Models either enterprise_id or team_id - but not both. +type TeamOrEnterpriseID = (EnterpriseID & { team_id?: never; }) | (TeamID & { enterprise_id?: never }); +interface Certified { + /** + * @description Include certified apps. Defaults to `false`. + */ + certified?: boolean; +} + +// https://api.slack.com/methods/admin.apps.activities.list +export interface AdminAppsActivitiesListArguments extends Partial, Partial, TokenOverridable, + CursorPaginationEnabled { + /** + * @description The component ID of log events to be returned. Will be `FnXXXXXX` for functions, + * and `WfXXXXXX` for worflows. + */ + component_id?: string; + /** @description The component type of log events to be returned. */ + component_type?: 'events_api' | 'workflows' | 'functions' | 'tables'; + /** @description The event type of log events to be returned. */ + log_event_type?: string; + /** @description The latest timestamp of the log to retrieve (epoch microseconds). */ + max_date_created?: number; + /** @description The earliest timestamp of the log to retrieve (epoch microseconds). */ + min_date_created?: number; + /** @description The minimum log level of the log events to be returned. Defaults to `info`. */ + min_log_level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; + /** @description The direction you want the data sorted by (always by timestamp). */ + sort_direction?: 'asc' | 'desc'; + /** @description The source of log events to be returned. */ + source?: 'slack' | 'developer'; + /** @description The trace ID of log events to be returned. */ + trace_id?: string; +} + +// https://api.slack.com/methods/admin.apps.approve +export type AdminAppsApproveArguments = AppOrRequestID & TeamOrEnterpriseID & TokenOverridable; + +// https://api.slack.com/methods/admin.apps.approved.list +export type AdminAppsApprovedListArguments = Partial & TokenOverridable & CursorPaginationEnabled +& Certified; + +// https://api.slack.com/methods/admin.apps.clearResolution +export type AdminAppsClearResolutionArguments = AppID & TeamOrEnterpriseID; + +// https://api.slack.com/methods/admin.apps.config.lookup +export interface AdminAppsConfigLookupArguments extends TokenOverridable { + /** @description An array of app IDs to get app configs for. */ + app_ids: string[]; +} + +// https://api.slack.com/methods/admin.apps.config.set +export interface AdminAppsConfigSetArguments extends AppID, TokenOverridable { + /** @description Domain restrictions for the app. */ + domain_restrictions?: { + /** @description Sets allowed URLs for the app. */ + urls?: string[]; + /** @description Sets emails for connector authorization. */ + emails?: string[]; + }; + /** @description The workflow auth permission. */ + workflow_auth_strategy?: 'builder_choice' | 'end_user_only'; +} + +// https://api.slack.com/methods/admin.apps.requests.cancel +export type AdminAppsRequestsCancelArguments = RequestID & TeamOrEnterpriseID & TokenOverridable; + +// https://api.slack.com/methods/admin.apps.requests.list +export type AdminAppsRequestsListArguments = TeamOrEnterpriseID & Certified & TokenOverridable +& CursorPaginationEnabled; + +// https://api.slack.com/methods/admin.apps.restrict +export type AdminAppsRestrictArguments = AppOrRequestID & TeamOrEnterpriseID & TokenOverridable; + +// https://api.slack.com/methods/admin.apps.restricted.list +export type AdminAppsRestrictedListArguments = TeamOrEnterpriseID & Certified & TokenOverridable +& CursorPaginationEnabled; + +// https://api.slack.com/methods/admin.apps.uninstall +export type AdminAppsUninstallArguments = AppID & TeamOrEnterpriseID; diff --git a/packages/web-api/test/types/methods/admin.apps.test-d.ts b/packages/web-api/test/types/methods/admin.apps.test-d.ts new file mode 100644 index 000000000..989834cab --- /dev/null +++ b/packages/web-api/test/types/methods/admin.apps.test-d.ts @@ -0,0 +1,244 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.apps.activities.list +// -- sad path +expectError(web.admin.apps.activities.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// admin.apps.approve +// -- sad path +expectError(web.admin.apps.approve()); // lacking argument +expectError(web.admin.apps.approve({})); // empty argument +expectError(web.admin.apps.approve({ + app_id: 'A1234', // missing team or enterprise id +})); +expectError(web.admin.apps.approve({ + request_id: 'R1234', // missing team or enterprise id +})); +expectError(web.admin.apps.approve({ + team_id: 'T1234', // missing request or app id +})); +expectError(web.admin.apps.approve({ + enterprise_id: 'E1234', // missing request or app id +})); +expectError(web.admin.apps.approve({ + app_id: 'A1234', + request_id: 'R1234', // missing team or enterprise id, and cant specify both app and request id +})); +expectError(web.admin.apps.approve({ + enterprise_id: 'E1234', + team_id: 'T1234', // missing request or app id, and canot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + app_id: 'A1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + app_id: 'A1234', + enterprise_id: 'T1234', +}]); +expectAssignable>([{ + request_id: 'R1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + request_id: 'R1234', + enterprise_id: 'T1234', +}]); + +// admin.apps.approved.list +// -- sad path +expectError(web.admin.apps.approved.list()); // lacking argument +expectError(web.admin.apps.approved.list({ + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{}]); // all args optional +expectAssignable>([{ + team_id: 'T1234', // can optionally specify team id +}]); +expectAssignable>([{ + enterprise_id: 'T1234', // can optionally specify enterprise id +}]); + +// admin.apps.clearResolution +// -- sad path +expectError(web.admin.apps.clearResolution()); // lacking argument +expectError(web.admin.apps.clearResolution({})); // empty argument +expectError(web.admin.apps.clearResolution({ + app_id: 'A1234', // missing team or enterprise id +})); +expectError(web.admin.apps.clearResolution({ + enterprise_id: 'E1234', // missing app_id +})); +expectError(web.admin.apps.clearResolution({ + team_id: 'T1234', // missing app_id +})); +expectError(web.admin.apps.clearResolution({ + app_id: 'A1234', + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + app_id: 'A1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + app_id: 'A1234', + enterprise_id: 'E1234', +}]); + +// admin.apps.config.lookup +// -- sad path +expectError(web.admin.apps.config.lookup()); // lacking argument +expectError(web.admin.apps.config.lookup({})); // empty argument +// -- happy path +expectAssignable>([{ + app_ids: ['A1234'], +}]); + +// admin.apps.config.set +// -- sad path +expectError(web.admin.apps.config.set()); // lacking argument +expectError(web.admin.apps.config.set({})); // empty argument +// -- happy path +expectAssignable>([{ + app_id: 'A1234', +}]); + +// admin.apps.requests.cancel +// -- sad path +expectError(web.admin.apps.requests.cancel()); // lacking argument +expectError(web.admin.apps.requests.cancel({})); // empty argument +expectError(web.admin.apps.requests.cancel({ + request_id: 'A1234', // missing team or enterprise id +})); +expectError(web.admin.apps.requests.cancel({ + enterprise_id: 'E1234', // missing request_id +})); +expectError(web.admin.apps.requests.cancel({ + team_id: 'T1234', // missing request_id +})); +expectError(web.admin.apps.requests.cancel({ + request_id: 'A1234', + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + request_id: 'A1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + request_id: 'A1234', + enterprise_id: 'E1234', +}]); + +// admin.apps.requests.list +// -- sad path +expectError(web.admin.apps.requests.list()); // lacking argument +expectError(web.admin.apps.requests.list({})); // empty argument +expectError(web.admin.apps.requests.list({ + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); +expectAssignable>([{ + enterprise_id: 'E1234', +}]); + +// admin.apps.restrict +// -- sad path +expectError(web.admin.apps.restrict()); // lacking argument +expectError(web.admin.apps.restrict({})); // empty argument +expectError(web.admin.apps.restrict({ + app_id: 'A1234', // missing team or enterprise id +})); +expectError(web.admin.apps.restrict({ + request_id: 'R1234', // missing team or enterprise id +})); +expectError(web.admin.apps.restrict({ + team_id: 'T1234', // missing request or app id +})); +expectError(web.admin.apps.restrict({ + enterprise_id: 'E1234', // missing request or app id +})); +expectError(web.admin.apps.restrict({ + app_id: 'A1234', + request_id: 'R1234', // missing team or enterprise id, and cant specify both app and request id +})); +expectError(web.admin.apps.restrict({ + enterprise_id: 'E1234', + team_id: 'T1234', // missing request or app id, and canot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + app_id: 'A1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + app_id: 'A1234', + enterprise_id: 'T1234', +}]); +expectAssignable>([{ + request_id: 'R1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + request_id: 'R1234', + enterprise_id: 'T1234', +}]); + +// admin.apps.restricted.list +// -- sad path +expectError(web.admin.apps.restricted.list()); // lacking argument +expectError(web.admin.apps.restricted.list({})); // empty argument +expectError(web.admin.apps.restricted.list({ + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); +expectAssignable>([{ + enterprise_id: 'E1234', +}]); + +// admin.apps.uninstall +// -- sad path +expectError(web.admin.apps.uninstall()); // lacking argument +expectError(web.admin.apps.uninstall({})); // empty argument +expectError(web.admin.apps.uninstall({ + app_id: 'A1234', // missing team or enterprise id +})); +expectError(web.admin.apps.uninstall({ + enterprise_id: 'E1234', // missing app_id +})); +expectError(web.admin.apps.uninstall({ + team_id: 'T1234', // missing app_id +})); +expectError(web.admin.apps.uninstall({ + app_id: 'A1234', + enterprise_id: 'E1234', + team_id: 'T1234', // cannot specify both enterprise and team id +})); +// -- happy path +expectAssignable>([{ + app_id: 'A1234', + team_id: 'T1234', +}]); +expectAssignable>([{ + app_id: 'A1234', + enterprise_id: 'E1234', +}]); From d548bffeff1256f46d15eb3166449f3893d4b20a Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 24 Nov 2023 16:33:25 -0500 Subject: [PATCH 102/122] Refactor arguments and type tests for admin.auth.* APIs. --- packages/web-api/src/methods.ts | 31 ++++---- .../web-api/src/types/request/admin/auth.ts | 24 ++++++ .../test/types/methods/admin.auth.test-d.ts | 77 +++++++++++++++++++ 3 files changed, 114 insertions(+), 18 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/auth.ts create mode 100644 packages/web-api/test/types/methods/admin.auth.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 6e3dfdbfe..93570f4c2 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -266,6 +266,7 @@ import type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments import type { APITestArguments } from './types/request/api'; import type { AdminAnalyticsGetFileArguments } from './types/request/admin/analytics'; import type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, AdminAppsApprovedListArguments, AdminAppsClearResolutionArguments, AdminAppsConfigLookupArguments, AdminAppsConfigSetArguments, AdminAppsRequestsCancelArguments, AdminAppsRequestsListArguments, AdminAppsRestrictArguments, AdminAppsRestrictedListArguments, AdminAppsUninstallArguments } from './types/request/admin/apps'; +import type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntitiesArguments, AdminAuthPolicyRemoveEntitiesArguments } from './types/request/admin/auth'; /** * Generic method definition @@ -390,8 +391,20 @@ export abstract class Methods extends EventEmitter { }, auth: { policy: { + /** + * @description Assign entities to a particular authentication policy. + * @see {@link https://api.slack.com/methods/admin.auth.policy.assignEntities `admin.auth.policy.assignEntities` API reference}. + */ assignEntities: bindApiCall(this, 'admin.auth.policy.assignEntities'), + /** + * @description Fetch all the entities assigned to a particular authentication policy by name. + * @see {@link https://api.slack.com/methods/admin.auth.policy.getEntities `admin.auth.policy.getEntities` API reference}. + */ getEntities: bindApiCall(this, 'admin.auth.policy.getEntities'), + /** + * @description Remove specified entities from a specified authentication policy. + * @see {@link https://api.slack.com/methods/admin.auth.policy.removeEntities `admin.auth.policy.removeEntities` API reference}. + */ removeEntities: bindApiCall(this, 'admin.auth.policy.removeEntities'), }, }, @@ -1532,24 +1545,6 @@ export abstract class Methods extends EventEmitter { }; } -// https://api.slack.com/methods/admin.auth.policy.assignEntities -export interface AdminAuthPolicyAssignEntitiesArguments extends TokenOverridable { - entity_ids: string[]; // TODO: breaking change, enforce at least one array item? - entity_type: 'USER'; - policy_name: 'email_password'; -} -// https://api.slack.com/methods/admin.auth.policy.getEntities -export interface AdminAuthPolicyGetEntitiesArguments extends TokenOverridable, - CursorPaginationEnabled { - policy_name: 'email_password'; - entity_type?: 'USER'; -} -// https://api.slack.com/methods/admin.auth.policy.removeEntities -export interface AdminAuthPolicyRemoveEntitiesArguments extends TokenOverridable { - entity_ids: string[]; // TODO: breaking change, enforce at least one array item? - entity_type: 'USER'; - policy_name: 'email_password'; -} // https://api.slack.com/methods/admin.barriers.create export interface AdminBarriersCreateArguments extends TokenOverridable { barriered_from_usergroup_ids: string[]; diff --git a/packages/web-api/src/types/request/admin/auth.ts b/packages/web-api/src/types/request/admin/auth.ts new file mode 100644 index 000000000..6291c1e44 --- /dev/null +++ b/packages/web-api/src/types/request/admin/auth.ts @@ -0,0 +1,24 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +interface EntityIDs { + /** @description Encoded IDs of the entities interacting with. */ + entity_ids: string[]; +} +interface EntityType { + /** @description The type of entity interacting with the policy. */ + entity_type: 'USER'; +} +interface PolicyName { + /** @description The name of the policy. */ + policy_name: 'email_password'; +} + +// https://api.slack.com/methods/admin.auth.policy.assignEntities +export interface AdminAuthPolicyAssignEntitiesArguments extends EntityIDs, EntityType, PolicyName, TokenOverridable {} + +// https://api.slack.com/methods/admin.auth.policy.getEntities +export interface AdminAuthPolicyGetEntitiesArguments extends Partial, PolicyName, TokenOverridable, + CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.auth.policy.removeEntities +export interface AdminAuthPolicyRemoveEntitiesArguments extends EntityIDs, EntityType, PolicyName, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/admin.auth.test-d.ts b/packages/web-api/test/types/methods/admin.auth.test-d.ts new file mode 100644 index 000000000..a85075965 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.auth.test-d.ts @@ -0,0 +1,77 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.auth.policy.assignEntities +// -- sad path +expectError(web.admin.auth.policy.assignEntities()); // lacking argument +expectError(web.admin.auth.policy.assignEntities({})); // empty argument +expectError(web.admin.auth.policy.assignEntities({ + entity_ids: ['U1234'], // missing entity_type and policy_name +})); +expectError(web.admin.auth.policy.assignEntities({ + entity_type: 'USER', // missing entity_ids and policy_name +})); +expectError(web.admin.auth.policy.assignEntities({ + policy_name: 'email_password', // missing entity_ids and entity_type +})); +expectError(web.admin.auth.policy.assignEntities({ + entity_ids: ['U1234'], // missing policy_name + entity_type: 'USER', +})); +expectError(web.admin.auth.policy.assignEntities({ + entity_ids: ['U1234'], // missing entity_type + policy_name: 'email_password', +})); +expectError(web.admin.auth.policy.assignEntities({ + entity_type: 'USER', // missing entity_ids + policy_name: 'email_password', +})); +// -- happy path +expectAssignable>([{ + policy_name: 'email_password', + entity_type: 'USER', + entity_ids: ['U1234'], +}]); + +// admin.auth.policy.getEntities +// -- sad path +expectError(web.admin.auth.policy.getEntities()); // lacking argument +expectError(web.admin.auth.policy.getEntities({})); // empty argument +// -- happy path +expectAssignable>([{ + policy_name: 'email_password', +}]); + +// admin.auth.policy.removeEntities +// -- sad path +expectError(web.admin.auth.policy.removeEntities()); // lacking argument +expectError(web.admin.auth.policy.removeEntities({})); // empty argument +expectError(web.admin.auth.policy.removeEntities({ + entity_ids: ['U1234'], // missing entity_type and policy_name +})); +expectError(web.admin.auth.policy.removeEntities({ + entity_type: 'USER', // missing entity_ids and policy_name +})); +expectError(web.admin.auth.policy.removeEntities({ + policy_name: 'email_password', // missing entity_ids and entity_type +})); +expectError(web.admin.auth.policy.removeEntities({ + entity_ids: ['U1234'], // missing policy_name + entity_type: 'USER', +})); +expectError(web.admin.auth.policy.removeEntities({ + entity_ids: ['U1234'], // missing entity_type + policy_name: 'email_password', +})); +expectError(web.admin.auth.policy.removeEntities({ + entity_type: 'USER', // missing entity_ids + policy_name: 'email_password', +})); +// -- happy path +expectAssignable>([{ + policy_name: 'email_password', + entity_type: 'USER', + entity_ids: ['U1234'], +}]); From 1d94a701fc6b42c11a519777c5231e7216181cb5 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 27 Nov 2023 08:58:23 -0500 Subject: [PATCH 103/122] start of admin.barrier api rework --- packages/web-api/src/methods.ts | 26 ++++--------------- .../src/types/request/admin/barriers.ts | 23 ++++++++++++++++ .../types/methods/admin.barriers.test-d.ts | 11 ++++++++ 3 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/barriers.ts create mode 100644 packages/web-api/test/types/methods/admin.barriers.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 93570f4c2..bca97f83f 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -267,6 +267,7 @@ import type { APITestArguments } from './types/request/api'; import type { AdminAnalyticsGetFileArguments } from './types/request/admin/analytics'; import type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, AdminAppsApprovedListArguments, AdminAppsClearResolutionArguments, AdminAppsConfigLookupArguments, AdminAppsConfigSetArguments, AdminAppsRequestsCancelArguments, AdminAppsRequestsListArguments, AdminAppsRestrictArguments, AdminAppsRestrictedListArguments, AdminAppsUninstallArguments } from './types/request/admin/apps'; import type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntitiesArguments, AdminAuthPolicyRemoveEntitiesArguments } from './types/request/admin/auth'; +import type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminBarriersListArguments, AdminBarriersUpdateArguments } from './types/request/admin/barriers'; /** * Generic method definition @@ -409,6 +410,10 @@ export abstract class Methods extends EventEmitter { }, }, barriers: { + /** + * @description Create an Information Barrier. + * @see {@link https://api.slack.com/methods/admin.barriers.create `admin.barriers.create` API reference}. + */ create: bindApiCall(this, 'admin.barriers.create'), delete: bindApiCall(this, 'admin.barriers.delete'), list: bindApiCall(this, 'admin.barriers.list'), @@ -1545,27 +1550,6 @@ export abstract class Methods extends EventEmitter { }; } -// https://api.slack.com/methods/admin.barriers.create -export interface AdminBarriersCreateArguments extends TokenOverridable { - barriered_from_usergroup_ids: string[]; - primary_usergroup_id: string; - restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs -} -// https://api.slack.com/methods/admin.barriers.delete -export interface AdminBarriersDeleteArguments extends TokenOverridable { - barrier_id: string; -} -// https://api.slack.com/methods/admin.barriers.list -export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } - -// https://api.slack.com/methods/admin.barriers.update -export interface AdminBarriersUpdateArguments extends TokenOverridable { - barrier_id: string; - barriered_from_usergroup_ids: string[]; - primary_usergroup_id: string; - restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs -} - // https://api.slack.com/methods/admin.conversations.archive export interface AdminConversationsArchiveArguments extends TokenOverridable { channel_id: string; diff --git a/packages/web-api/src/types/request/admin/barriers.ts b/packages/web-api/src/types/request/admin/barriers.ts new file mode 100644 index 000000000..90a611dd1 --- /dev/null +++ b/packages/web-api/src/types/request/admin/barriers.ts @@ -0,0 +1,23 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +// https://api.slack.com/methods/admin.barriers.create +export interface AdminBarriersCreateArguments extends TokenOverridable { + barriered_from_usergroup_ids: string[]; + primary_usergroup_id: string; + restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs +} +// https://api.slack.com/methods/admin.barriers.delete +export interface AdminBarriersDeleteArguments extends TokenOverridable { + barrier_id: string; +} +// https://api.slack.com/methods/admin.barriers.list +export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } + +// https://api.slack.com/methods/admin.barriers.update +export interface AdminBarriersUpdateArguments extends TokenOverridable { + barrier_id: string; + barriered_from_usergroup_ids: string[]; + primary_usergroup_id: string; + restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs +} + diff --git a/packages/web-api/test/types/methods/admin.barriers.test-d.ts b/packages/web-api/test/types/methods/admin.barriers.test-d.ts new file mode 100644 index 000000000..5da414fa8 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.barriers.test-d.ts @@ -0,0 +1,11 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.barriers.create +// -- sad path +expectError(web.admin.barriers.create()); // lacking argument +expectError(web.admin.barriers.create({})); // empty argument +// -- happy path +expectAssignable>([{}]); // all optional args From 3687c89e2acbb34404b966fd90ff3b15f992b07b Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 27 Nov 2023 17:47:24 -0500 Subject: [PATCH 104/122] Refactor arguments and type tests for admin.barriers.* APIs. --- packages/web-api/src/methods.ts | 12 ++ .../src/types/request/admin/barriers.ts | 27 ++-- .../types/methods/admin.barriers.test-d.ts | 121 +++++++++++++++++- 3 files changed, 148 insertions(+), 12 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index bca97f83f..2aa62ddca 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -415,8 +415,20 @@ export abstract class Methods extends EventEmitter { * @see {@link https://api.slack.com/methods/admin.barriers.create `admin.barriers.create` API reference}. */ create: bindApiCall(this, 'admin.barriers.create'), + /** + * @description Delete an existing Information Barrier. + * @see {@link https://api.slack.com/methods/admin.barriers.delete `admin.barriers.delete` API reference}. + */ delete: bindApiCall(this, 'admin.barriers.delete'), + /** + * @description Get all Information Barriers for your organization. + * @see {@link https://api.slack.com/methods/admin.barriers.list `admin.barriers.list` API reference}. + */ list: bindApiCall(this, 'admin.barriers.list'), + /** + * @description Update an existing Information Barrier. + * @see {@link https://api.slack.com/methods/admin.barriers.update `admin.barriers.update` API reference}. + */ update: bindApiCall(this, 'admin.barriers.update'), }, conversations: { diff --git a/packages/web-api/src/types/request/admin/barriers.ts b/packages/web-api/src/types/request/admin/barriers.ts index 90a611dd1..6b4b21cd3 100644 --- a/packages/web-api/src/types/request/admin/barriers.ts +++ b/packages/web-api/src/types/request/admin/barriers.ts @@ -1,23 +1,28 @@ import type { CursorPaginationEnabled, TokenOverridable } from '../common'; +interface BarrierID { + /** @description The ID of the barrier. */ + barrier_id: string; +} + // https://api.slack.com/methods/admin.barriers.create export interface AdminBarriersCreateArguments extends TokenOverridable { + /** @description A list of {@link https://slack.com/help/articles/115001435788-Connect-identity-provider-groups-to-your-Enterprise-Grid-org IDP Groups} IDs ti associate with the barrier. */ barriered_from_usergroup_ids: string[]; + /** @description The ID of the primary {@link https://slack.com/help/articles/115001435788-Connect-identity-provider-groups-to-your-Enterprise-Grid-org IDP Group}. */ primary_usergroup_id: string; - restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs + /** + * @description What kind of interactions are blocked by this barrier? + * Currently you must provide all three: `im`, `mpim`, `call`. + */ + restricted_subjects: ['im', 'mpim', 'call']; } + // https://api.slack.com/methods/admin.barriers.delete -export interface AdminBarriersDeleteArguments extends TokenOverridable { - barrier_id: string; -} +export interface AdminBarriersDeleteArguments extends BarrierID, TokenOverridable {} + // https://api.slack.com/methods/admin.barriers.list export interface AdminBarriersListArguments extends TokenOverridable, CursorPaginationEnabled { } // https://api.slack.com/methods/admin.barriers.update -export interface AdminBarriersUpdateArguments extends TokenOverridable { - barrier_id: string; - barriered_from_usergroup_ids: string[]; - primary_usergroup_id: string; - restricted_subjects: string[]; // TODO: this should always be ['im','mpim','call'] according to the docs -} - +export interface AdminBarriersUpdateArguments extends AdminBarriersCreateArguments, BarrierID {} diff --git a/packages/web-api/test/types/methods/admin.barriers.test-d.ts b/packages/web-api/test/types/methods/admin.barriers.test-d.ts index 5da414fa8..9cfe78077 100644 --- a/packages/web-api/test/types/methods/admin.barriers.test-d.ts +++ b/packages/web-api/test/types/methods/admin.barriers.test-d.ts @@ -7,5 +7,124 @@ const web = new WebClient('TOKEN'); // -- sad path expectError(web.admin.barriers.create()); // lacking argument expectError(web.admin.barriers.create({})); // empty argument +expectError(web.admin.barriers.create({ + barriered_from_usergroup_ids: [], // missing primary_usergroup_id and restricted_subjects +})); +expectError(web.admin.barriers.create({ + primary_usergroup_id: '1234', // missing barriered_from_usergroup_ids and restricted_subjets +})); +expectError(web.admin.barriers.create({ + restricted_subjects: ['im', 'mpim', 'call'], // missing barriered_from_usergroup_ids and primary_usergroup_id +})); +expectError(web.admin.barriers.create({ + barriered_from_usergroup_ids: [], // missing restricted_subjects + primary_usergroup_id: '1234', +})); +expectError(web.admin.barriers.create({ + barriered_from_usergroup_ids: [], // missing primary_usergroup_id + restricted_subjects: ['im', 'mpim', 'call'], +})); +expectError(web.admin.barriers.create({ + primary_usergroup_id: '1234', // missing barriered_from_usergroup_ids + restricted_subjects: ['im', 'mpim', 'call'], +})); +expectError(web.admin.barriers.create({ + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + restricted_subjects: ['im', 'mpim'], // must provide all three of im, mpim and call +})); // -- happy path -expectAssignable>([{}]); // all optional args +expectAssignable>([{ + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + restricted_subjects: ['im', 'mpim', 'call'], +}]); + +// admin.barriers.delete +// -- sad path +expectError(web.admin.barriers.delete()); // lacking argument +expectError(web.admin.barriers.delete({})); // empty argument +// -- happy path +expectAssignable>([{ + barrier_id: 'B1234', +}]); + +// admin.barriers.list +// -- sad path +expectError(web.admin.barriers.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// admin.barriers.update +// -- sad path +expectError(web.admin.barriers.update()); // lacking argument +expectError(web.admin.barriers.update({})); // empty argument +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], // missing primary_usergroup_id and restricted_subjects and barrier_id +})); +expectError(web.admin.barriers.update({ + primary_usergroup_id: '1234', // missing barriered_from_usergroup_ids and restricted_subjets and barrier_id +})); +expectError(web.admin.barriers.update({ + restricted_subjects: ['im', 'mpim', 'call'], // missing barriered_from_usergroup_ids and primary_usergroup_id and barrier_id +})); +expectError(web.admin.barriers.update({ + barrier_id: 'B1234', // missing barriered_from_usergroup_ids, primary_usergroup_id and restricted_subjects +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], // missing restricted_subjects and barrier_id + primary_usergroup_id: '1234', +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], // missing primary_usergroup_id and barrier_id + restricted_subjects: ['im', 'mpim', 'call'], +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], // missing primary_usergroup_id and restructed_subjects + barrier_id: 'B1234', +})); +expectError(web.admin.barriers.update({ + primary_usergroup_id: '1234', // missing barriered_from_usergroup_ids and barrier_id + restricted_subjects: ['im', 'mpim', 'call'], +})); +expectError(web.admin.barriers.update({ + primary_usergroup_id: '1234', // missing barriered_from_usergroup_ids and restricted_subjects + barrier_id: 'B1234', +})); +expectError(web.admin.barriers.update({ + restricted_subjects: ['im', 'mpim', 'call'], + barrier_id: 'B1234', // missing barriered_from_usergroup_ids and primary_usergroup_id +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + restricted_subjects: ['im', 'mpim', 'call'], // missing barrier_id +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + barrier_id: 'B1234', // missing restricted_subjects +})); +expectError(web.admin.barriers.update({ + primary_usergroup_id: '1234', + barrier_id: 'B1234', + restricted_subjects: ['im', 'mpim', 'call'], // missing barriered_from_usergroup_ids +})); +expectError(web.admin.barriers.update({ + barriered_from_usergroup_ids: [], + barrier_id: 'B1234', + restricted_subjects: ['im', 'mpim', 'call'], // missing primary_usergroup_id +})); +expectError(web.admin.barriers.update({ + barrier_id: 'B1234', + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + restricted_subjects: ['im', 'mpim'], // must provide all three of im, mpim and call +})); +// -- happy path +expectAssignable>([{ + barrier_id: 'B1234', + barriered_from_usergroup_ids: [], + primary_usergroup_id: '1234', + restricted_subjects: ['im', 'mpim', 'call'], +}]); From 94c7c57143b1d47d921ff25708e13cec7fc2d813 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 28 Nov 2023 10:07:27 -0500 Subject: [PATCH 105/122] Refactor arguments and type tests for admin.analytics.getFile API. --- .../src/types/request/admin/analytics.ts | 49 ++++++++++++++++--- .../types/methods/admin.analytics.test-d.ts | 45 +++++++++++++++++ 2 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 packages/web-api/test/types/methods/admin.analytics.test-d.ts diff --git a/packages/web-api/src/types/request/admin/analytics.ts b/packages/web-api/src/types/request/admin/analytics.ts index 091eee681..5229ff446 100644 --- a/packages/web-api/src/types/request/admin/analytics.ts +++ b/packages/web-api/src/types/request/admin/analytics.ts @@ -1,11 +1,44 @@ import type { TokenOverridable } from '../common'; -// TODO: breaking changes - potential type improvements: -// - date is required _except_ if metadata_only=true. metadata=true, then we are to omit it (according to docs) -// - metadata_only=true only works with type=public_channel -// https://api.slack.com/methods/admin.analytics.getFile -export interface AdminAnalyticsGetFileArguments extends TokenOverridable { - type: 'public_channel' | 'member'; - date?: string; - metadata_only?: boolean; +interface Date { + /** + * @description Date to retrieve the analytics data for, expressed as `YYYY-MM-DD` in UTC. + * Required unless `metadata_only` is set to `true`. + */ + date: string; +} +interface MemberArgs extends Date { + /** + * @description The type of analytics to retrieve. The options are currently limited to + * `member` (for grid member analytics) and `public_channel` (for public channel analytics). + */ + type: 'member'; +} +interface TypeChannel { + /** + * @description The type of analytics to retrieve. The options are currently limited to + * `member` (for grid member analytics) and `public_channel` (for public channel analytics). + */ + type: 'public_channel'; +} +interface PublicChannelWithDate extends TypeChannel, Date { + /** + * @description Retrieve metadata for the `type` of analytics indicated. Can be used only with `type` set to + * `public_channel` analytics. Omit the date parameter when using this argument. Defaults to `false`. + * @see {@link https://api.slack.com/methods/admin.analytics.getFile#metadata_only Public channel metadata}. + */ + metadata_only?: false; } +interface PublicChannelWithMetadata extends TypeChannel { + /** + * @description Retrieve metadata for the `type` of analytics indicated. Can be used only with `type` set to + * `public_channel` analytics. Omit the date parameter when using this argument. Defaults to `false`. + * @see {@link https://api.slack.com/methods/admin.analytics.getFile#metadata_only Public channel metadata}. + */ + metadata_only: true; +} +// when type=public_channel, either date must be provided, or metadata_only must be set to true, but not both +type PublicChannelArgs = PublicChannelWithDate | PublicChannelWithMetadata; + +// https://api.slack.com/methods/admin.analytics.getFile +export type AdminAnalyticsGetFileArguments = TokenOverridable & (MemberArgs | PublicChannelArgs); diff --git a/packages/web-api/test/types/methods/admin.analytics.test-d.ts b/packages/web-api/test/types/methods/admin.analytics.test-d.ts new file mode 100644 index 000000000..629fad9e0 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.analytics.test-d.ts @@ -0,0 +1,45 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.analytics.getFile +// -- sad path +expectError(web.admin.analytics.getFile()); // lacking argument +expectError(web.admin.analytics.getFile({})); // empty argument +expectError(web.admin.analytics.getFile({ + type: 'member', // missing date +})); +expectError(web.admin.analytics.getFile({ + date: '2023-11-01', // missing type +})); +expectError(web.admin.analytics.getFile({ + type: 'public_channel', // missing date or metadata_only=true +})); +expectError(web.admin.analytics.getFile({ + type: 'public_channel', + metadata_only: false, // w/ type=public_channel and no date, metadata_only must be true +})); +expectError(web.admin.analytics.getFile({ + type: 'public_channel', + date: '2023-11-01', + metadata_only: true, // w/ type=public_channel and date specified, metadata_only must be falsy +})); +// -- happy path +expectAssignable>([{ + type: 'member', + date: '2023-11-01', +}]); +expectAssignable>([{ + type: 'public_channel', + date: '2023-11-01', +}]); +expectAssignable>([{ + type: 'public_channel', + date: '2023-11-01', + metadata_only: false, +}]); +expectAssignable>([{ + type: 'public_channel', + metadata_only: true, +}]); From 08d141310dad955dec7f9a66e023a5f8f6c9b723 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 30 Nov 2023 10:20:42 -0500 Subject: [PATCH 106/122] part of the way there for admin.conversations APIs --- packages/web-api/src/methods.ts | 189 ++++-------------- .../src/types/request/admin/conversations.ts | 163 +++++++++++++++ .../methods/admin.conversations.test-d.ts | 75 +++++++ 3 files changed, 278 insertions(+), 149 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/conversations.ts create mode 100644 packages/web-api/test/types/methods/admin.conversations.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2aa62ddca..8a767f1f5 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -268,6 +268,7 @@ import type { AdminAnalyticsGetFileArguments } from './types/request/admin/analy import type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, AdminAppsApprovedListArguments, AdminAppsClearResolutionArguments, AdminAppsConfigLookupArguments, AdminAppsConfigSetArguments, AdminAppsRequestsCancelArguments, AdminAppsRequestsListArguments, AdminAppsRestrictArguments, AdminAppsRestrictedListArguments, AdminAppsUninstallArguments } from './types/request/admin/apps'; import type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntitiesArguments, AdminAuthPolicyRemoveEntitiesArguments } from './types/request/admin/auth'; import type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminBarriersListArguments, AdminBarriersUpdateArguments } from './types/request/admin/barriers'; +import type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveArguments, AdminConversationsBulkDeleteArguments, AdminConversationsBulkMoveArguments, AdminConversationsConvertToPrivateArguments, AdminConversationsConvertToPublicArguments, AdminConversationsCreateArguments, AdminConversationsDeleteArguments, AdminConversationsDisconnectSharedArguments, AdminConversationsEKMListOriginalConnectedChannelInfoArguments, AdminConversationsGetConversationPrefsArguments, AdminConversationsGetCustomRetentionArguments, AdminConversationsGetTeamsArguments, AdminConversationsInviteArguments, AdminConversationsLookupArguments, AdminConversationsRemoveCustomRetentionArguments, AdminConversationsRenameArguments, AdminConversationsRestrictAccessAddGroupArguments, AdminConversationsRestrictAccessListGroupsArguments, AdminConversationsRestrictAccessRemoveGroupArguments, AdminConversationsSearchArguments, AdminConversationsSetConversationPrefsArguments, AdminConversationsSetCustomRetentionArguments, AdminConversationsSetTeamsArguments, AdminConversationsUnarchiveArguments } from './types/request/admin/conversations'; /** * Generic method definition @@ -432,15 +433,39 @@ export abstract class Methods extends EventEmitter { update: bindApiCall(this, 'admin.barriers.update'), }, conversations: { + /** + * @description Archive a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.archive `admin.conversations.archive` API reference}. + */ archive: bindApiCall(this, 'admin.conversations.archive'), + /** + * @description Archive public or private channels in bulk. + * @see {@link https://api.slack.com/methods/admin.conversations.bulkArchive `admin.conversations.bulkArchive` API reference}. + */ bulkArchive: bindApiCall(this, 'admin.conversations.bulkArchive'), + /** + * @description Delete public or private channels in bulk. + * @see {@link https://api.slack.com/methods/admin.conversations.bulkDelet `admin.conversations.bulkDelete` API reference}. + */ bulkDelete: bindApiCall(this, 'admin.conversations.bulkDelete'), + /** + * @description Move public or private channels in bulk. + * @see {@link https://api.slack.com/methods/admin.conversations.bulkMove `admin.conversations.bulkMove` API reference}. + */ bulkMove: bindApiCall(this, 'admin.conversations.bulkMove'), + /** + * @description Convert a public channel to a private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.convertToPrivate `admin.conversations.convertToPrivate` API reference}. + */ convertToPrivate: bindApiCall( this, 'admin.conversations.convertToPrivate', ), + /** + * @description Convert a private channel to a public channel. + * @see {@link https://api.slack.com/methods/admin.conversations.convertToPublic `admin.conversations.convertToPublic` API reference}. + */ convertToPublic: bindApiCall( this, @@ -466,11 +491,22 @@ export abstract class Methods extends EventEmitter { this, 'admin.conversations.getConversationPrefs', ), + getCustomRetention: + bindApiCall( + this, + 'admin.conversations.getCustomRetention', + ), getTeams: bindApiCall( this, 'admin.conversations.getTeams', ), invite: bindApiCall(this, 'admin.conversations.invite'), + lookup: bindApiCall(this, 'admin.conversations.lookup'), + removeCustomRetention: + bindApiCall( + this, + 'admin.conversations.removeCustomRetention', + ), rename: bindApiCall(this, 'admin.conversations.rename'), restrictAccess: { addGroup: bindApiCall { 'admin.conversations.restrictAccess.removeGroup', ), }, - getCustomRetention: - bindApiCall( + search: bindApiCall(this, 'admin.conversations.search'), + setConversationPrefs: + bindApiCall( this, - 'admin.conversations.getCustomRetention', + 'admin.conversations.setConversationPrefs', ), setCustomRetention: bindApiCall( this, 'admin.conversations.setCustomRetention', ), - removeCustomRetention: - bindApiCall( - this, - 'admin.conversations.removeCustomRetention', - ), - lookup: bindApiCall(this, 'admin.conversations.lookup'), - search: bindApiCall(this, 'admin.conversations.search'), - setConversationPrefs: - bindApiCall( - this, - 'admin.conversations.setConversationPrefs', - ), setTeams: bindApiCall( this, 'admin.conversations.setTeams', @@ -1561,140 +1586,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } - -// https://api.slack.com/methods/admin.conversations.archive -export interface AdminConversationsArchiveArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.bulkArchive -export interface AdminConversationsBulkArchiveArguments extends TokenOverridable { - channel_ids: string[]; // TODO: breaking change, enforce at least one array item? -} -// https://api.slack.com/methods/admin.conversations.bulkDelete -export interface AdminConversationsBulkDeleteArguments extends TokenOverridable { - channel_ids: string[]; // TODO: breaking change, enforce at least one array item? -} -// https://api.slack.com/methods/admin.conversations.bulkMove -export interface AdminConversationsBulkMoveArguments extends TokenOverridable { - channel_ids: string[]; // TODO: breaking change, enforce at least one array item? - target_team_id: string; -} -// https://api.slack.com/methods/admin.conversations.convertToPrivate -export interface AdminConversationsConvertToPrivateArguments extends TokenOverridable { - channel_id: string; - name?: string; -} -// https://api.slack.com/methods/admin.conversations.convertToPublic -export interface AdminConversationsConvertToPublicArguments extends TokenOverridable { - channel_id: string; -} -// TODO: breaking change; if org_wide=false then team_id is required. -// https://api.slack.com/methods/admin.conversations.create -export interface AdminConversationsCreateArguments extends TokenOverridable { - is_private: boolean; - name: string; - description?: string; - org_wide?: boolean; - team_id?: string; -} -// https://api.slack.com/methods/admin.conversations.delete -export interface AdminConversationsDeleteArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.disconnectShared -export interface AdminConversationsDisconnectSharedArguments extends TokenOverridable { - channel_id: string; - leaving_team_ids?: string[]; -} -// https://api.slack.com/methods/admin.conversations.lookup -export interface AdminConversationsLookupArguments - extends TokenOverridable, CursorPaginationEnabled { - last_message_activity_before: number; - team_ids: string[]; - max_member_count?: number; -} -// https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo -export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments - extends TokenOverridable, CursorPaginationEnabled { - channel_ids?: string[]; - team_ids?: string[]; -} -// https://api.slack.com/methods/admin.conversations.getConversationPrefs -export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.getTeams -export interface AdminConversationsGetTeamsArguments - extends TokenOverridable, CursorPaginationEnabled { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.invite -export interface AdminConversationsInviteArguments extends TokenOverridable { - channel_id: string; - user_ids: string[]; -} -// https://api.slack.com/methods/admin.conversations.rename -export interface AdminConversationsRenameArguments extends TokenOverridable { - channel_id: string; - name: string; -} -// https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup -export interface AdminConversationsRestrictAccessAddGroupArguments extends TokenOverridable { - channel_id: string; - group_id: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups -export interface AdminConversationsRestrictAccessListGroupsArguments extends TokenOverridable { - channel_id: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup -export interface AdminConversationsRestrictAccessRemoveGroupArguments extends TokenOverridable { - channel_id: string; - group_id: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.conversations.getCustomRetention -export interface AdminConversationsGetCustomRetentionArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.setCustomRetention -export interface AdminConversationsSetCustomRetentionArguments extends TokenOverridable { - channel_id: string; - duration_days: number; -} -// https://api.slack.com/methods/admin.conversations.removeCustomRetention -export interface AdminConversationsRemoveCustomRetentionArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.search -export interface AdminConversationsSearchArguments - extends TokenOverridable, CursorPaginationEnabled { - query?: string; - search_channel_types?: string[]; // TODO: breaking change: turn into an array of string literals? See all options here: https://api.slack.com/methods/admin.conversations.search#types - sort?: 'relevant' | 'name' | 'member_count' | 'created'; - sort_dir?: 'asc' | 'desc'; - team_ids?: string[]; - connected_team_ids?: string[]; - total_count_only?: boolean; -} -// https://api.slack.com/methods/admin.conversations.setConversationPrefs -export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { - channel_id: string; - prefs: Record; // TODO: should this be Record? See https://api.slack.com/methods/admin.conversations.setConversationPrefs#markdown -} -// https://api.slack.com/methods/admin.conversations.setTeams -export interface AdminConversationsSetTeamsArguments extends TokenOverridable { - channel_id: string; - team_id?: string; - target_team_ids?: string[]; - org_channel?: boolean; -} -// https://api.slack.com/methods/admin.conversations.unarchive -export interface AdminConversationsUnarchiveArguments extends TokenOverridable { - channel_id: string; -} // https://api.slack.com/methods/admin.emoji.add export interface AdminEmojiAddArguments extends TokenOverridable { name: string; diff --git a/packages/web-api/src/types/request/admin/conversations.ts b/packages/web-api/src/types/request/admin/conversations.ts new file mode 100644 index 000000000..c04ced37a --- /dev/null +++ b/packages/web-api/src/types/request/admin/conversations.ts @@ -0,0 +1,163 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +interface ChannelID { // an identical interface exists in src/types/request/conversations.ts, but it is only for invites + /** @description Encoded channel ID. */ + channel_id: string; +} + +interface ChannelIDs { + /** @description An array of channel IDs (must include at least one ID). */ + channel_ids: [string, ...string[]]; +} + +// https://api.slack.com/methods/admin.conversations.archive +export interface AdminConversationsArchiveArguments extends ChannelID, TokenOverridable {} + +// https://api.slack.com/methods/admin.conversations.bulkArchive +export interface AdminConversationsBulkArchiveArguments extends ChannelIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.conversations.bulkDelete +export interface AdminConversationsBulkDeleteArguments extends ChannelIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.conversations.bulkMove +export interface AdminConversationsBulkMoveArguments extends ChannelIDs, TokenOverridable { + /** @description Target team ID to move channels to. */ + target_team_id: string; +} + +// https://api.slack.com/methods/admin.conversations.convertToPrivate +export interface AdminConversationsConvertToPrivateArguments extends ChannelID, TokenOverridable { + /** @description Name of private channel to create. Only respected when converting an MPIM. */ + name?: string; +} + +// https://api.slack.com/methods/admin.conversations.convertToPublic +export interface AdminConversationsConvertToPublicArguments extends ChannelID, TokenOverridable {} + +interface OrgWide { + /** @description When `true`, the channel will be available org-wide. */ + org_wide: true; + team_id?: never; +} +interface SpecificTeam { + /** + * @description When `false` (the default), the channel will be available to only + * the workspace specified by `team_id`. + */ + org_wide?: false; + /** + * @description The workspace to create the channel in. This argument is required unless you set `org_wide` to `true`. + */ + team_id: string; +} +// When creating a channel, it can either be org wide or team specific, but not both +type WorkspaceAccess = OrgWide | SpecificTeam; + +// https://api.slack.com/methods/admin.conversations.create +export type AdminConversationsCreateArguments = TokenOverridable & WorkspaceAccess & { + /** @description When `true`, creates a private channel instead of a public channel. Defaults to `false`. */ + is_private: boolean; + /** @description Name of the public or private channel to create. */ + name: string; + /** @description Description of the public or private channel to create. */ + description?: string; +}; + +// https://api.slack.com/methods/admin.conversations.delete +export interface AdminConversationsDeleteArguments extends TokenOverridable { + channel_id: string; +} +// https://api.slack.com/methods/admin.conversations.disconnectShared +export interface AdminConversationsDisconnectSharedArguments extends TokenOverridable { + channel_id: string; + leaving_team_ids?: string[]; +} +// https://api.slack.com/methods/admin.conversations.lookup +export interface AdminConversationsLookupArguments + extends TokenOverridable, CursorPaginationEnabled { + last_message_activity_before: number; + team_ids: string[]; + max_member_count?: number; +} +// https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo +export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments + extends TokenOverridable, CursorPaginationEnabled { + channel_ids?: string[]; + team_ids?: string[]; +} +// https://api.slack.com/methods/admin.conversations.getConversationPrefs +export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { + channel_id: string; +} +// https://api.slack.com/methods/admin.conversations.getTeams +export interface AdminConversationsGetTeamsArguments + extends TokenOverridable, CursorPaginationEnabled { + channel_id: string; +} +// https://api.slack.com/methods/admin.conversations.invite +export interface AdminConversationsInviteArguments extends TokenOverridable { + channel_id: string; + user_ids: string[]; +} +// https://api.slack.com/methods/admin.conversations.rename +export interface AdminConversationsRenameArguments extends TokenOverridable { + channel_id: string; + name: string; +} +// https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup +export interface AdminConversationsRestrictAccessAddGroupArguments extends TokenOverridable { + channel_id: string; + group_id: string; + team_id?: string; +} +// https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups +export interface AdminConversationsRestrictAccessListGroupsArguments extends TokenOverridable { + channel_id: string; + team_id?: string; +} +// https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup +export interface AdminConversationsRestrictAccessRemoveGroupArguments extends TokenOverridable { + channel_id: string; + group_id: string; + team_id?: string; +} +// https://api.slack.com/methods/admin.conversations.getCustomRetention +export interface AdminConversationsGetCustomRetentionArguments extends TokenOverridable { + channel_id: string; +} +// https://api.slack.com/methods/admin.conversations.setCustomRetention +export interface AdminConversationsSetCustomRetentionArguments extends TokenOverridable { + channel_id: string; + duration_days: number; +} +// https://api.slack.com/methods/admin.conversations.removeCustomRetention +export interface AdminConversationsRemoveCustomRetentionArguments extends TokenOverridable { + channel_id: string; +} +// https://api.slack.com/methods/admin.conversations.search +export interface AdminConversationsSearchArguments + extends TokenOverridable, CursorPaginationEnabled { + query?: string; + search_channel_types?: string[]; // TODO: breaking change: turn into an array of string literals? See all options here: https://api.slack.com/methods/admin.conversations.search#types + sort?: 'relevant' | 'name' | 'member_count' | 'created'; + sort_dir?: 'asc' | 'desc'; + team_ids?: string[]; + connected_team_ids?: string[]; + total_count_only?: boolean; +} +// https://api.slack.com/methods/admin.conversations.setConversationPrefs +export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { + channel_id: string; + prefs: Record; // TODO: should this be Record? See https://api.slack.com/methods/admin.conversations.setConversationPrefs#markdown +} +// https://api.slack.com/methods/admin.conversations.setTeams +export interface AdminConversationsSetTeamsArguments extends TokenOverridable { + channel_id: string; + team_id?: string; + target_team_ids?: string[]; + org_channel?: boolean; +} +// https://api.slack.com/methods/admin.conversations.unarchive +export interface AdminConversationsUnarchiveArguments extends TokenOverridable { + channel_id: string; +} diff --git a/packages/web-api/test/types/methods/admin.conversations.test-d.ts b/packages/web-api/test/types/methods/admin.conversations.test-d.ts new file mode 100644 index 000000000..55d9814ea --- /dev/null +++ b/packages/web-api/test/types/methods/admin.conversations.test-d.ts @@ -0,0 +1,75 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.conversations.archive +// -- sad path +expectError(web.admin.conversations.archive()); // lacking argument +expectError(web.admin.conversations.archive({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.bulkArchive +// -- sad path +expectError(web.admin.conversations.bulkArchive()); // lacking argument +expectError(web.admin.conversations.bulkArchive({})); // empty argument +expectError(web.admin.conversations.bulkArchive({ + channel_ids: [], // must include at least one element +})); +// -- happy path +expectAssignable>([{ + channel_ids: ['C1234'], +}]); + +// admin.conversations.bulkDelete +// -- sad path +expectError(web.admin.conversations.bulkDelete()); // lacking argument +expectError(web.admin.conversations.bulkDelete({})); // empty argument +expectError(web.admin.conversations.bulkDelete({ + channel_ids: [], // must include at least one element +})); +// -- happy path +expectAssignable>([{ + channel_ids: ['C1234'], +}]); + +// admin.conversations.bulkMove +// -- sad path +expectError(web.admin.conversations.bulkMove()); // lacking argument +expectError(web.admin.conversations.bulkMove({})); // empty argument +expectError(web.admin.conversations.bulkMove({ + channel_ids: ['C1234'], // missing target_team_id +})); +expectError(web.admin.conversations.bulkMove({ + target_team_id: 'T1234', // missing channel_ids +})); +expectError(web.admin.conversations.bulkMove({ + target_team_id: 'T1234', + channel_ids: [], // must include at least one element +})); +// -- happy path +expectAssignable>([{ + target_team_id: 'T1234', + channel_ids: ['C1234'], +}]); + +// admin.conversations.convertToPrivate +// -- sad path +expectError(web.admin.conversations.convertToPrivate()); // lacking argument +expectError(web.admin.conversations.convertToPrivate({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.convertToPublic +// -- sad path +expectError(web.admin.conversations.convertToPublic()); // lacking argument +expectError(web.admin.conversations.convertToPublic({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); From 7d0335998d699301672d4793422a0a06b040077f Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 5 Dec 2023 16:02:48 -0500 Subject: [PATCH 107/122] Finishing up admin.conversations.* APIs. --- packages/web-api/src/methods.ts | 78 +++++ .../src/types/request/admin/conversations.ts | 186 +++++++----- packages/web-api/src/types/request/common.ts | 13 +- .../src/types/request/conversations.ts | 8 +- packages/web-api/src/types/request/search.ts | 6 +- .../methods/admin.conversations.test-d.ts | 268 ++++++++++++++++++ 6 files changed, 481 insertions(+), 78 deletions(-) diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 8a767f1f5..b18ce2531 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -471,14 +471,31 @@ export abstract class Methods extends EventEmitter { this, 'admin.conversations.convertToPublic', ), + /** + * @description Create a public or private channel-based conversation. + * @see {@link https://api.slack.com/methods/admin.conversations.create `admin.conversations.create` API reference}. + */ create: bindApiCall(this, 'admin.conversations.create'), + /** + * @description Delete a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.delete `admin.conversations.delete` API reference}. + */ delete: bindApiCall(this, 'admin.conversations.delete'), + /** + * @description Disconnect a connected channel from one or more workspaces. + * @see {@link https://api.slack.com/methods/admin.conversations.disconnectShared `admin.conversations.disconnectShared` API reference}. + */ disconnectShared: bindApiCall( this, 'admin.conversations.disconnectShared', ), ekm: { + /** + * @description List all disconnected channels — i.e., channels that were once connected to other workspaces + * and then disconnected — and the corresponding original channel IDs for key revocation with EKM. + * @see {@link https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo `admin.conversations.ekm.listOriginalConnectedChannelInfo` API reference}. + */ listOriginalConnectedChannelInfo: bindApiCall( @@ -486,40 +503,81 @@ export abstract class Methods extends EventEmitter { 'admin.conversations.ekm.listOriginalConnectedChannelInfo', ), }, + /** + * @description Get conversation preferences for a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.getConversationPrefs `admin.conversations.getConversationPrefs` API reference}. + */ getConversationPrefs: bindApiCall( this, 'admin.conversations.getConversationPrefs', ), + /** + * @description Get a conversation's retention policy. + * @see {@link https://api.slack.com/methods/admin.conversations.getCustomRetention `admin.conversations.getCustomRetention` API reference}. + */ getCustomRetention: bindApiCall( this, 'admin.conversations.getCustomRetention', ), + /** + * @description Get all the workspaces a given public or private channel is connected to within + * this Enterprise org. + * @see {@link https://api.slack.com/methods/admin.conversations.getTeams `admin.conversations.getTeams` API reference}. + */ getTeams: bindApiCall( this, 'admin.conversations.getTeams', ), + /** + * @description Invite a user to a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.invite `admin.conversations.invite` API reference}. + */ invite: bindApiCall(this, 'admin.conversations.invite'), + /** + * @description Returns channels on the given team using the filters. + * @see {@link https://api.slack.com/methods/admin.conversations.lookup `admin.conversations.lookup` API reference}. + */ lookup: bindApiCall(this, 'admin.conversations.lookup'), + /** + * @description Remove a conversation's retention policy. + * @see {@link https://api.slack.com/methods/admin.conversations.removeCustomRetention `admin.conversations.removeCustomRetention` API reference}. + */ removeCustomRetention: bindApiCall( this, 'admin.conversations.removeCustomRetention', ), + /** + * @description Rename a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.rename `admin.conversations.rename` API reference}. + */ rename: bindApiCall(this, 'admin.conversations.rename'), restrictAccess: { + /** + * @description Add an allowlist of IDP groups for accessing a channel. + * @see {@link https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup `admin.conversations.restrictAccess.addGroup` API reference}. + */ addGroup: bindApiCall( this, 'admin.conversations.restrictAccess.addGroup', ), + /** + * @description List all IDP Groups linked to a channel. + * @see {@link https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups `admin.conversations.restrictAccess.listGroups` API reference}. + */ listGroups: bindApiCall( this, 'admin.conversations.restrictAccess.listGroups', ), + /** + * @description Remove a linked IDP group linked from a private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup `admin.conversations.restrictAccess.removeGroup` API reference}. + */ removeGroup: bindApiCall( @@ -527,21 +585,41 @@ export abstract class Methods extends EventEmitter { 'admin.conversations.restrictAccess.removeGroup', ), }, + /** + * @description Search for public or private channels in an Enterprise organization. + * @see {@link https://api.slack.com/methods/admin.conversations.search `admin.conversations.search` API reference}. + */ search: bindApiCall(this, 'admin.conversations.search'), + /** + * @description Set the posting permissions for a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.setConversationPrefs `admin.conversations.setConversationPrefs` API reference}. + */ setConversationPrefs: bindApiCall( this, 'admin.conversations.setConversationPrefs', ), + /** + * @description Set a conversation's retention policy. + * @see {@link https://api.slack.com/methods/admin.conversations.setCustomRetention `admin.conversations.setCustomRetention` API reference}. + */ setCustomRetention: bindApiCall( this, 'admin.conversations.setCustomRetention', ), + /** + * @description Set the workspaces in an Enterprise grid org that connect to a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.setTeams `admin.conversations.setTeams` API reference}. + */ setTeams: bindApiCall( this, 'admin.conversations.setTeams', ), + /** + * @description Unarchive a public or private channel. + * @see {@link https://api.slack.com/methods/admin.conversations.unarchive `admin.conversations.unarchive` API reference}. + */ unarchive: bindApiCall( this, 'admin.conversations.unarchive', diff --git a/packages/web-api/src/types/request/admin/conversations.ts b/packages/web-api/src/types/request/admin/conversations.ts index c04ced37a..ed8174557 100644 --- a/packages/web-api/src/types/request/admin/conversations.ts +++ b/packages/web-api/src/types/request/admin/conversations.ts @@ -1,4 +1,4 @@ -import type { CursorPaginationEnabled, TokenOverridable } from '../common'; +import type { CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; interface ChannelID { // an identical interface exists in src/types/request/conversations.ts, but it is only for invites /** @description Encoded channel ID. */ @@ -10,6 +10,27 @@ interface ChannelIDs { channel_ids: [string, ...string[]]; } +type ChannelType = 'private' | 'private_exclude' | 'archived' | 'exclude_archived' | 'private_exclude_archived' | 'multi_workspace' | 'org_wide' | 'external_shared_exclude' | 'external_shared' | 'external_shared_private' | 'external_shared_archived' | 'exclude_org_shared'; + +interface GroupID { + /** @description The {@link https://slack.com/help/articles/115001435788-Connect-identity-provider-groups-to-your-Enterprise-Grid-org IDP Group} ID. */ + group_id: string; +} + +interface TeamIDs { + /** @description A list of team IDs to filter by (must include at least one ID). */ + team_ids: [string, ...string[]]; +} + +// Interface to extend from specifically for the retrictAccess.* APIs, as the JSDoc is relevant only to these APIs +interface RestrictAccessTeamID { + /** + * @description The workspace where the channel exists. This argument is required for channels only tied to + * one workspace, and optional for channels that are shared across an organization. + */ + team_id?: string; +} + // https://api.slack.com/methods/admin.conversations.archive export interface AdminConversationsArchiveArguments extends ChannelID, TokenOverridable {} @@ -55,7 +76,7 @@ type WorkspaceAccess = OrgWide | SpecificTeam; // https://api.slack.com/methods/admin.conversations.create export type AdminConversationsCreateArguments = TokenOverridable & WorkspaceAccess & { - /** @description When `true`, creates a private channel instead of a public channel. Defaults to `false`. */ + /** @description When `true`, creates a private channel instead of a public channel. */ is_private: boolean; /** @description Name of the public or private channel to create. */ name: string; @@ -64,100 +85,127 @@ export type AdminConversationsCreateArguments = TokenOverridable & WorkspaceAcce }; // https://api.slack.com/methods/admin.conversations.delete -export interface AdminConversationsDeleteArguments extends TokenOverridable { - channel_id: string; -} +export interface AdminConversationsDeleteArguments extends ChannelID, TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.disconnectShared -export interface AdminConversationsDisconnectSharedArguments extends TokenOverridable { - channel_id: string; +export interface AdminConversationsDisconnectSharedArguments extends ChannelID, TokenOverridable { + /** @description Team IDs getting removed from the channel, optional if there are only two teams in the channel. */ leaving_team_ids?: string[]; } -// https://api.slack.com/methods/admin.conversations.lookup -export interface AdminConversationsLookupArguments - extends TokenOverridable, CursorPaginationEnabled { - last_message_activity_before: number; - team_ids: string[]; - max_member_count?: number; -} + // https://api.slack.com/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo export interface AdminConversationsEKMListOriginalConnectedChannelInfoArguments - extends TokenOverridable, CursorPaginationEnabled { + extends Partial, TokenOverridable, CursorPaginationEnabled { + /** @description A comma-separated list of channels to filter to. */ channel_ids?: string[]; - team_ids?: string[]; } + // https://api.slack.com/methods/admin.conversations.getConversationPrefs -export interface AdminConversationsGetConversationPrefsArguments extends TokenOverridable { - channel_id: string; -} +export interface AdminConversationsGetConversationPrefsArguments extends ChannelID, TokenOverridable {} + +// https://api.slack.com/methods/admin.conversations.getCustomRetention +export interface AdminConversationsGetCustomRetentionArguments extends ChannelID, TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.getTeams export interface AdminConversationsGetTeamsArguments - extends TokenOverridable, CursorPaginationEnabled { - channel_id: string; -} + extends ChannelID, TokenOverridable, CursorPaginationEnabled {} + // https://api.slack.com/methods/admin.conversations.invite -export interface AdminConversationsInviteArguments extends TokenOverridable { - channel_id: string; - user_ids: string[]; +export interface AdminConversationsInviteArguments extends ChannelID, TokenOverridable { + /** @description The users to invite. */ + user_ids: [string, ...string[]]; +} + +// https://api.slack.com/methods/admin.conversations.lookup +export interface AdminConversationsLookupArguments + extends TeamIDs, TokenOverridable, CursorPaginationEnabled { + /** + * @description UNIX timestamp to filter by public channels where the most recent message + * was sent before this parameter. + */ + last_message_activity_before: number; + /** @description Filter by public channels with member count equal to or less than the specified number. */ + max_member_count?: number; } + +// https://api.slack.com/methods/admin.conversations.removeCustomRetention +export interface AdminConversationsRemoveCustomRetentionArguments extends ChannelID, TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.rename -export interface AdminConversationsRenameArguments extends TokenOverridable { - channel_id: string; +export interface AdminConversationsRenameArguments extends ChannelID, TokenOverridable { + /** @description The new name for the channel. */ name: string; } + // https://api.slack.com/methods/admin.conversations.restrictAccess.addGroup -export interface AdminConversationsRestrictAccessAddGroupArguments extends TokenOverridable { - channel_id: string; - group_id: string; - team_id?: string; -} +export interface AdminConversationsRestrictAccessAddGroupArguments extends ChannelID, GroupID, + RestrictAccessTeamID, TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.restrictAccess.listGroups -export interface AdminConversationsRestrictAccessListGroupsArguments extends TokenOverridable { - channel_id: string; - team_id?: string; -} +export interface AdminConversationsRestrictAccessListGroupsArguments extends ChannelID, RestrictAccessTeamID, + TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.restrictAccess.removeGroup -export interface AdminConversationsRestrictAccessRemoveGroupArguments extends TokenOverridable { - channel_id: string; - group_id: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.conversations.getCustomRetention -export interface AdminConversationsGetCustomRetentionArguments extends TokenOverridable { - channel_id: string; -} -// https://api.slack.com/methods/admin.conversations.setCustomRetention -export interface AdminConversationsSetCustomRetentionArguments extends TokenOverridable { - channel_id: string; - duration_days: number; -} -// https://api.slack.com/methods/admin.conversations.removeCustomRetention -export interface AdminConversationsRemoveCustomRetentionArguments extends TokenOverridable { - channel_id: string; -} +export interface AdminConversationsRestrictAccessRemoveGroupArguments extends ChannelID, GroupID, + RestrictAccessTeamID, TokenOverridable {} + // https://api.slack.com/methods/admin.conversations.search export interface AdminConversationsSearchArguments - extends TokenOverridable, CursorPaginationEnabled { + extends SortDir, Partial, TokenOverridable, CursorPaginationEnabled { + /** @description Array of encoded team IDs, signifying the external orgs to search through. */ + connected_team_ids?: string[]; + /** @description Name of the channel to query by. */ query?: string; - search_channel_types?: string[]; // TODO: breaking change: turn into an array of string literals? See all options here: https://api.slack.com/methods/admin.conversations.search#types + /** + * @description The type of channels to include or exclude in the search. For example `private` will search + * private channels, while `private_exclude` will exclude them. + * @see {@link https://api.slack.com/methods/admin.conversations.search#types Full list of channel types}. + */ + search_channel_types?: ChannelType[]; + /** + * @description Possible values are: + * - `relevant`: search ranking based on what we think is closest, + * - `name`: alphabetical, + * - `member_count`: number of users in the channel, + * - `created`: date channel was created. + * Defaults to `member_count`. + * You can optionally pair this with the `sort_dir` argument to change how it is sorted. + */ sort?: 'relevant' | 'name' | 'member_count' | 'created'; - sort_dir?: 'asc' | 'desc'; - team_ids?: string[]; - connected_team_ids?: string[]; + /** + * @description Only return the total count of channels. + * Omits channel data and allows access for admins without channel manager permissions. Defaults to `false`. + */ total_count_only?: boolean; } + // https://api.slack.com/methods/admin.conversations.setConversationPrefs -export interface AdminConversationsSetConversationPrefsArguments extends TokenOverridable { - channel_id: string; - prefs: Record; // TODO: should this be Record? See https://api.slack.com/methods/admin.conversations.setConversationPrefs#markdown +export interface AdminConversationsSetConversationPrefsArguments extends ChannelID, TokenOverridable { + /** @description The prefs for this channel. */ + prefs: Record; } + +// https://api.slack.com/methods/admin.conversations.setCustomRetention +export interface AdminConversationsSetCustomRetentionArguments extends ChannelID, TokenOverridable { + /** @description The message retention duration in days to set for this conversation. */ + duration_days: number; +} + // https://api.slack.com/methods/admin.conversations.setTeams -export interface AdminConversationsSetTeamsArguments extends TokenOverridable { - channel_id: string; - team_id?: string; - target_team_ids?: string[]; +export interface AdminConversationsSetTeamsArguments extends ChannelID, TokenOverridable { + /** @description Set to `true` if channel has to be converted to an org channel. Defaults to `false`. */ org_channel?: boolean; + /** + * @description A list of workspaces to which the channel should be shared. + * Not required if the channel is being shared org-wide. + */ + target_team_ids?: string[]; + /** + * @description The workspace to which the channel belongs. + * Omit this argument if the channel is a cross-workspace shared channel. + */ + team_id?: string; } + // https://api.slack.com/methods/admin.conversations.unarchive -export interface AdminConversationsUnarchiveArguments extends TokenOverridable { - channel_id: string; -} +export interface AdminConversationsUnarchiveArguments extends ChannelID, TokenOverridable {} diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 98428dbdf..cdbab61d3 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -81,10 +81,15 @@ export interface FileCommentArgument { file_comment: string; } -/** - * Some API methods use arguments related to OAuth flows. - * E.g. `openid.*` and `oauth.*` - */ +// Some API methods offer search functionality whose sort order can be customized. +// E.g. `admin.conversations.search` and `search.*` +export interface SortDir { + /** @description Change sort direction to ascending (`asc`) or descending (`desc`). Defaults to `desc`. */ + sort_dir?: 'asc' | 'desc'; +} + +// Some API methods use arguments related to OAuth flows. +// E.g. `openid.*` and `oauth.*` export interface OAuthCredentials { /** @description Issued when you created your application. */ diff --git a/packages/web-api/src/types/request/conversations.ts b/packages/web-api/src/types/request/conversations.ts index ba380b5ae..781d76b68 100644 --- a/packages/web-api/src/types/request/conversations.ts +++ b/packages/web-api/src/types/request/conversations.ts @@ -83,7 +83,13 @@ export interface ConversationsInfoArguments extends Channel, TokenOverridable, L } // https://api.slack.com/methods/conversations.invite -export interface ConversationsInviteArguments extends Channel, Users, TokenOverridable { } +export interface ConversationsInviteArguments extends Channel, Users, TokenOverridable { + /** + * @description When set to `true` and multiple user IDs are provided, continue inviting the valid ones while + * disregarding invalid IDs. Defaults to `false`. + */ + force?: boolean; +} // https://api.slack.com/methods/conversations.inviteShared export type ConversationsInviteSharedArguments = Channel & TokenOverridable & (Emails | UserIDs) & { diff --git a/packages/web-api/src/types/request/search.ts b/packages/web-api/src/types/request/search.ts index 62127c50a..e7264b845 100644 --- a/packages/web-api/src/types/request/search.ts +++ b/packages/web-api/src/types/request/search.ts @@ -1,6 +1,6 @@ -import { OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; +import { OptionalTeamAssignable, SortDir, TokenOverridable, TraditionalPagingEnabled } from './common'; -interface Searchable extends OptionalTeamAssignable { +interface Searchable extends OptionalTeamAssignable, SortDir { /** @description Search query. */ query: string; /** @@ -10,8 +10,6 @@ interface Searchable extends OptionalTeamAssignable { highlight?: boolean; /** @description Return matches sorted by either `score` or `timestamp`. Defaults to `score`. */ sort?: 'score' | 'timestamp'; - /** @description Change sort direction to ascending (`asc`) or descending (`desc`). Defaults to `desc`. */ - sort_dir?: 'asc' | 'desc'; } // https://api.slack.com/methods/search.all diff --git a/packages/web-api/test/types/methods/admin.conversations.test-d.ts b/packages/web-api/test/types/methods/admin.conversations.test-d.ts index 55d9814ea..eb1c517e2 100644 --- a/packages/web-api/test/types/methods/admin.conversations.test-d.ts +++ b/packages/web-api/test/types/methods/admin.conversations.test-d.ts @@ -73,3 +73,271 @@ expectError(web.admin.conversations.convertToPublic({})); // empty argument expectAssignable>([{ channel_id: 'C1234', }]); + +// admin.conversations.create +// -- sad path +expectError(web.admin.conversations.create()); // lacking argument +expectError(web.admin.conversations.create({})); // empty argument +expectError(web.admin.conversations.create({ + is_private: true, // missing name and either teamid or orgwide +})); +expectError(web.admin.conversations.create({ + name: 'test', // missing is_private and either teamid or orgwide +})); +expectError(web.admin.conversations.create({ + org_wide: true, // missing is_private and name +})); +expectError(web.admin.conversations.create({ + team_id: 'T1234', // missing is_private and name +})); +expectError(web.admin.conversations.create({ + is_private: true, // missing either teamid or orgwide + name: 'test', +})); +expectError(web.admin.conversations.create({ + is_private: true, // missing name + org_wide: true, +})); +expectError(web.admin.conversations.create({ + is_private: true, // missing name + team_id: 'T1234', +})); +expectError(web.admin.conversations.create({ + name: 'test', + org_wide: true, // missing is_private +})); +expectError(web.admin.conversations.create({ + name: 'test', + team_id: 'T1234', // missing is_private +})); +expectError(web.admin.conversations.create({ + is_private: true, + name: 'test', + org_wide: true, + team_id: 'T1234', // cannot specify org_wide=true and a team id +})); +// -- happy path +expectAssignable>([{ + is_private: false, + name: 'test', + org_wide: true, +}]); +expectAssignable>([{ + is_private: false, + name: 'test', + org_wide: false, + team_id: 'T1234', +}]); +expectAssignable>([{ + is_private: false, + name: 'test', + team_id: 'T1234', +}]); + +// admin.conversations.delete +// -- sad path +expectError(web.admin.conversations.delete()); // lacking argument +expectError(web.admin.conversations.delete({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.disconnectShared +// -- sad path +expectError(web.admin.conversations.disconnectShared()); // lacking argument +expectError(web.admin.conversations.disconnectShared({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.ekm.listOriginalConnectedChannelInfo +// -- sad path +expectError(web.admin.conversations.ekm.listOriginalConnectedChannelInfo()); // lacking argument +// -- happy path +expectAssignable>([{ +}]); // all optional args + +// admin.conversations.getConversationPrefs +// -- sad path +expectError(web.admin.conversations.getConversationPrefs()); // lacking argument +expectError(web.admin.conversations.getConversationPrefs({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.getCustomRetention +// -- sad path +expectError(web.admin.conversations.getCustomRetention()); // lacking argument +expectError(web.admin.conversations.getCustomRetention({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.getTeams +// -- sad path +expectError(web.admin.conversations.getTeams()); // lacking argument +expectError(web.admin.conversations.getTeams({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.invite +// -- sad path +expectError(web.admin.conversations.invite()); // lacking argument +expectError(web.admin.conversations.invite({})); // empty argument +expectError(web.admin.conversations.invite({ + channel_id: 'C1234', // missing user_ids +})); +expectError(web.admin.conversations.invite({ + channel_id: 'C1234', + user_ids: [], // empty user_ids +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + user_ids: ['U1234'], +}]); + +// admin.conversations.lookup +// -- sad path +expectError(web.admin.conversations.lookup()); // lacking argument +expectError(web.admin.conversations.lookup({})); // empty argument +expectError(web.admin.conversations.lookup({ + team_ids: [], // missing last_message_activity_before +})); +expectError(web.admin.conversations.lookup({ + last_message_activity_before: 1969, // missing team_ids +})); +// -- happy path +expectAssignable>([{ + team_ids: ['T1234'], + last_message_activity_before: 10, +}]); + +// admin.conversations.removeCustomRetention +// -- sad path +expectError(web.admin.conversations.removeCustomRetention()); // lacking argument +expectError(web.admin.conversations.removeCustomRetention({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.rename +// -- sad path +expectError(web.admin.conversations.rename()); // lacking argument +expectError(web.admin.conversations.rename({})); // empty argument +expectError(web.admin.conversations.rename({ + channel_id: 'C1234', // missing name +})); +expectError(web.admin.conversations.rename({ + name: 'C1234', // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + name: 'heyho', +}]); + +// admin.conversations.restrictAccess.addGroup +// -- sad path +expectError(web.admin.conversations.restrictAccess.addGroup()); // lacking argument +expectError(web.admin.conversations.restrictAccess.addGroup({})); // empty argument +expectError(web.admin.conversations.restrictAccess.addGroup({ + channel_id: 'C1234', // missing group_id +})); +expectError(web.admin.conversations.restrictAccess.addGroup({ + group_id: 'G1234', // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + group_id: 'G1234', +}]); + +// admin.conversations.restrictAccess.listGroups +// -- sad path +expectError(web.admin.conversations.restrictAccess.listGroups()); // lacking argument +expectError(web.admin.conversations.restrictAccess.listGroups({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.restrictAccess.removeGroup +// -- sad path +expectError(web.admin.conversations.restrictAccess.removeGroup()); // lacking argument +expectError(web.admin.conversations.restrictAccess.removeGroup({})); // empty argument +expectError(web.admin.conversations.restrictAccess.removeGroup({ + channel_id: 'C1234', // missing group_id +})); +expectError(web.admin.conversations.restrictAccess.removeGroup({ + group_id: 'G1234', // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + group_id: 'G1234', +}]); + +// admin.conversations.search +// -- sad path +expectError(web.admin.conversations.search()); // lacking argument +// -- happy path +expectAssignable>([{ +}]); // all optional args + +// admin.conversations.setConversationPrefs +// -- sad path +expectError(web.admin.conversations.setConversationPrefs()); // lacking argument +expectError(web.admin.conversations.setConversationPrefs({})); // empty argument +expectError(web.admin.conversations.setConversationPrefs({ + channel_id: 'C1234', // missing prefs +})); +expectError(web.admin.conversations.setConversationPrefs({ + prefs: {}, // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + prefs: {}, +}]); + +// admin.conversations.setCustomRetention +// -- sad path +expectError(web.admin.conversations.setCustomRetention()); // lacking argument +expectError(web.admin.conversations.setCustomRetention({})); // empty argument +expectError(web.admin.conversations.setCustomRetention({ + channel_id: 'C1234', // missing duration_days +})); +expectError(web.admin.conversations.setCustomRetention({ + duration_days: 420, // missing channel_id +})); +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', + duration_days: 69, +}]); + +// admin.conversations.setTeams +// -- sad path +expectError(web.admin.conversations.setTeams()); // lacking argument +expectError(web.admin.conversations.setTeams({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); + +// admin.conversations.unarchive +// -- sad path +expectError(web.admin.conversations.unarchive()); // lacking argument +expectError(web.admin.conversations.unarchive({})); // empty argument +// -- happy path +expectAssignable>([{ + channel_id: 'C1234', +}]); From 38dfcde5235cef35d4bd61382fcee0736f8a039c Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 5 Dec 2023 16:26:40 -0500 Subject: [PATCH 108/122] Refactor arguments and type tests for admin.emoji.* APIs. --- packages/web-api/src/methods.ts | 42 ++++++------ .../web-api/src/types/request/admin/emoji.ts | 39 +++++++++++ .../test/types/methods/admin.emoji.test-d.ts | 67 +++++++++++++++++++ 3 files changed, 127 insertions(+), 21 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/emoji.ts create mode 100644 packages/web-api/test/types/methods/admin.emoji.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index b18ce2531..0df81ac35 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -269,6 +269,7 @@ import type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, Admin import type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntitiesArguments, AdminAuthPolicyRemoveEntitiesArguments } from './types/request/admin/auth'; import type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminBarriersListArguments, AdminBarriersUpdateArguments } from './types/request/admin/barriers'; import type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveArguments, AdminConversationsBulkDeleteArguments, AdminConversationsBulkMoveArguments, AdminConversationsConvertToPrivateArguments, AdminConversationsConvertToPublicArguments, AdminConversationsCreateArguments, AdminConversationsDeleteArguments, AdminConversationsDisconnectSharedArguments, AdminConversationsEKMListOriginalConnectedChannelInfoArguments, AdminConversationsGetConversationPrefsArguments, AdminConversationsGetCustomRetentionArguments, AdminConversationsGetTeamsArguments, AdminConversationsInviteArguments, AdminConversationsLookupArguments, AdminConversationsRemoveCustomRetentionArguments, AdminConversationsRenameArguments, AdminConversationsRestrictAccessAddGroupArguments, AdminConversationsRestrictAccessListGroupsArguments, AdminConversationsRestrictAccessRemoveGroupArguments, AdminConversationsSearchArguments, AdminConversationsSetConversationPrefsArguments, AdminConversationsSetCustomRetentionArguments, AdminConversationsSetTeamsArguments, AdminConversationsUnarchiveArguments } from './types/request/admin/conversations'; +import type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiListArguments, AdminEmojiRemoveArguments, AdminEmojiRenameArguments } from './types/request/admin/emoji'; /** * Generic method definition @@ -626,10 +627,30 @@ export abstract class Methods extends EventEmitter { ), }, emoji: { + /** + * @description Add an emoji. + * @see {@link https://api.slack.com/methods/admin.emoji.add `admin.emoji.add` API reference}. + */ add: bindApiCall(this, 'admin.emoji.add'), + /** + * @description Add an emoji alias. + * @see {@link https://api.slack.com/methods/admin.emoji.addAlias `admin.emoji.addAlias` API reference}. + */ addAlias: bindApiCall(this, 'admin.emoji.addAlias'), + /** + * @description List emoji for an Enterprise Grid organization. + * @see {@link https://api.slack.com/methods/admin.emoji.list `admin.emoji.list` API reference}. + */ list: bindApiCall(this, 'admin.emoji.list'), + /** + * @description Remove an emoji across an Enterprise Grid organization. + * @see {@link https://api.slack.com/methods/admin.emoji.remove `admin.emoji.remove` API reference}. + */ remove: bindApiCall(this, 'admin.emoji.remove'), + /** + * @description Rename an emoji. + * @see {@link https://api.slack.com/methods/admin.emoji.rename `admin.emoji.rename` API reference}. + */ rename: bindApiCall(this, 'admin.emoji.rename'), }, functions: { @@ -1664,27 +1685,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.emoji.add -export interface AdminEmojiAddArguments extends TokenOverridable { - name: string; - url: string; -} -// https://api.slack.com/methods/admin.emoji.addAlias -export interface AdminEmojiAddAliasArguments extends TokenOverridable { - name: string; - alias_for: string; -} -// https://api.slack.com/methods/admin.emoji.list -export interface AdminEmojiListArguments extends TokenOverridable, CursorPaginationEnabled { } -// https://api.slack.com/methods/admin.emoji.remove -export interface AdminEmojiRemoveArguments extends TokenOverridable { - name: string; -} -// https://api.slack.com/methods/admin.emoji.rename -export interface AdminEmojiRenameArguments extends TokenOverridable { - name: string; - new_name: string; -} // https://api.slack.com/methods/admin.functions.list export interface AdminFunctionsListArguments extends TokenOverridable, CursorPaginationEnabled { app_ids: string[]; diff --git a/packages/web-api/src/types/request/admin/emoji.ts b/packages/web-api/src/types/request/admin/emoji.ts new file mode 100644 index 000000000..c2cecd873 --- /dev/null +++ b/packages/web-api/src/types/request/admin/emoji.ts @@ -0,0 +1,39 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +interface Name { + /** + * @description The name of the emoji. Colons (:myemoji:) around the value are not required, + * although they may be included. + */ + name: string; +} + +// https://api.slack.com/methods/admin.emoji.add +export interface AdminEmojiAddArguments extends Name, TokenOverridable { + /** + * @description The URL of a file to use as an image for the emoji. + * Square images under 128KB and with transparent backgrounds work best. + */ + url: string; +} + +// https://api.slack.com/methods/admin.emoji.addAlias +export interface AdminEmojiAddAliasArguments extends Name, TokenOverridable { + /** + * @description Name of the emoji for which the alias is being made. + * Any wrapping whitespace or colons will be automatically trimmed. + */ + alias_for: string; +} + +// https://api.slack.com/methods/admin.emoji.list +export interface AdminEmojiListArguments extends TokenOverridable, CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.emoji.remove +export interface AdminEmojiRemoveArguments extends Name, TokenOverridable {} + +// https://api.slack.com/methods/admin.emoji.rename +export interface AdminEmojiRenameArguments extends Name, TokenOverridable { + /** @description The new name of the emoji. */ + new_name: string; +} diff --git a/packages/web-api/test/types/methods/admin.emoji.test-d.ts b/packages/web-api/test/types/methods/admin.emoji.test-d.ts new file mode 100644 index 000000000..b04a7c3f9 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.emoji.test-d.ts @@ -0,0 +1,67 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.emoji.add +// -- sad path +expectError(web.admin.emoji.add()); // lacking argument +expectError(web.admin.emoji.add({})); // empty argument +expectError(web.admin.emoji.add({ + name: 'facepalm', // missing url +})); +expectError(web.admin.emoji.add({ + url: 'facepalm', // missing name +})); +// -- happy path +expectAssignable>([{ + name: 'facepalm', + url: 'http://example.com', +}]); + +// admin.emoji.addAlias +// -- sad path +expectError(web.admin.emoji.addAlias()); // lacking argument +expectError(web.admin.emoji.addAlias({})); // empty argument +expectError(web.admin.emoji.addAlias({ + name: 'facepalm', // missing alias_for +})); +expectError(web.admin.emoji.addAlias({ + alias_for: 'facepalm', // missing name +})); +// -- happy path +expectAssignable>([{ + name: 'facepalm', + alias_for: 'fp', +}]); + +// admin.emoji.list +// -- sad path +expectError(web.admin.emoji.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args + +// admin.emoji.remove +// -- sad path +expectError(web.admin.emoji.remove()); // lacking argument +expectError(web.admin.emoji.remove({})); // empty argument +// -- happy path +expectAssignable>([{ + name: 'facepalm', +}]); + +// admin.emoji.rename +// -- sad path +expectError(web.admin.emoji.rename()); // lacking argument +expectError(web.admin.emoji.rename({})); // empty argument +expectError(web.admin.emoji.rename({ + name: 'facepalm', // missing new_name +})); +expectError(web.admin.emoji.rename({ + new_name: 'facepalm', // missing name +})); +// -- happy path +expectAssignable>([{ + name: 'facepalm', + new_name: 'fp', +}]); From 692792facbc0f2a9c567b060a4531d8f02a1e182 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 13:48:25 -0500 Subject: [PATCH 109/122] Refactor arguments and type tests for admin.functions.* APIs. --- packages/web-api/src/methods.ts | 31 +++++++------- .../src/types/request/admin/functions.ts | 26 ++++++++++++ .../types/methods/admin.functions.test-d.ts | 41 +++++++++++++++++++ 3 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/functions.ts create mode 100644 packages/web-api/test/types/methods/admin.functions.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 0df81ac35..f8ade9173 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -270,6 +270,7 @@ import type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntities import type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminBarriersListArguments, AdminBarriersUpdateArguments } from './types/request/admin/barriers'; import type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveArguments, AdminConversationsBulkDeleteArguments, AdminConversationsBulkMoveArguments, AdminConversationsConvertToPrivateArguments, AdminConversationsConvertToPublicArguments, AdminConversationsCreateArguments, AdminConversationsDeleteArguments, AdminConversationsDisconnectSharedArguments, AdminConversationsEKMListOriginalConnectedChannelInfoArguments, AdminConversationsGetConversationPrefsArguments, AdminConversationsGetCustomRetentionArguments, AdminConversationsGetTeamsArguments, AdminConversationsInviteArguments, AdminConversationsLookupArguments, AdminConversationsRemoveCustomRetentionArguments, AdminConversationsRenameArguments, AdminConversationsRestrictAccessAddGroupArguments, AdminConversationsRestrictAccessListGroupsArguments, AdminConversationsRestrictAccessRemoveGroupArguments, AdminConversationsSearchArguments, AdminConversationsSetConversationPrefsArguments, AdminConversationsSetCustomRetentionArguments, AdminConversationsSetTeamsArguments, AdminConversationsUnarchiveArguments } from './types/request/admin/conversations'; import type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiListArguments, AdminEmojiRemoveArguments, AdminEmojiRenameArguments } from './types/request/admin/emoji'; +import type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArguments, AdminFunctionsPermissionsSetArguments } from './types/request/admin/functions'; /** * Generic method definition @@ -654,9 +655,23 @@ export abstract class Methods extends EventEmitter { rename: bindApiCall(this, 'admin.emoji.rename'), }, functions: { + /** + * @description Look up functions by a set of apps. + * @see {@link https://api.slack.com/methods/admin.functions.list `admin.functions.list` API reference}. + */ list: bindApiCall(this, 'admin.functions.list'), permissions: { + /** + * @description Lookup the visibility of multiple Slack functions and include the users if + * it is limited to particular named entities. + * @see {@link https://api.slack.com/methods/admin.functions.permissions.lookup `admin.functions.permissions.lookup` API reference}. + */ lookup: bindApiCall(this, 'admin.functions.permissions.lookup'), + /** + * @description Set the visibility of a Slack function and define the users or workspaces if + * it is set to named_entities. + * @see {@link https://api.slack.com/methods/admin.functions.permissions.set `admin.functions.permissions.set` API reference}. + */ set: bindApiCall(this, 'admin.functions.permissions.set'), }, }, @@ -1685,22 +1700,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.functions.list -export interface AdminFunctionsListArguments extends TokenOverridable, CursorPaginationEnabled { - app_ids: string[]; - team_id?: string; -} -// https://api.slack.com/methods/admin.functions.permissions.lookup -export interface AdminFunctionsPermissionsLookupArguments - extends TokenOverridable { - function_ids: string[]; -} -// https://api.slack.com/methods/admin.functions.permissions.set -export interface AdminFunctionsPermissionsSetArguments extends TokenOverridable { - function_id: string; - visibility: string; - user_ids?: string[]; -} // https://api.slack.com/methods/admin.inviteRequests.approve export interface AdminInviteRequestsApproveArguments extends TokenOverridable { diff --git a/packages/web-api/src/types/request/admin/functions.ts b/packages/web-api/src/types/request/admin/functions.ts new file mode 100644 index 000000000..95d09bf62 --- /dev/null +++ b/packages/web-api/src/types/request/admin/functions.ts @@ -0,0 +1,26 @@ +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + +// https://api.slack.com/methods/admin.functions.list +export interface AdminFunctionsListArguments extends TokenOverridable, CursorPaginationEnabled { + /** @description Array of app IDs to get functions for; max 50. */ + app_ids: string[]; + /** @description The team context to retrieve functions from. */ + team_id?: string; +} + +// https://api.slack.com/methods/admin.functions.permissions.lookup +export interface AdminFunctionsPermissionsLookupArguments + extends TokenOverridable { + /** @description An array of function IDs to get permissions for. */ + function_ids: [string, ...string[]]; +} + +// https://api.slack.com/methods/admin.functions.permissions.set +export interface AdminFunctionsPermissionsSetArguments extends TokenOverridable { + /** @description The function ID to set permissions for. */ + function_id: string; + /** @description The function visibility. */ + visibility: 'everyone' | 'app_collaborators' | 'named_entities' | 'no_one'; + /** @description List of user IDs to allow for `named_entities` visibility. */ + user_ids?: string[]; +} diff --git a/packages/web-api/test/types/methods/admin.functions.test-d.ts b/packages/web-api/test/types/methods/admin.functions.test-d.ts new file mode 100644 index 000000000..b2067ea7f --- /dev/null +++ b/packages/web-api/test/types/methods/admin.functions.test-d.ts @@ -0,0 +1,41 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.functions.list +// -- sad path +expectError(web.admin.functions.list()); // lacking argument +expectError(web.admin.functions.list({})); // empty argument +// -- happy path +expectAssignable>([{ + app_ids: [], +}]); + +// admin.functions.permissions.lookup +// -- sad path +expectError(web.admin.functions.permissions.lookup()); // lacking argument +expectError(web.admin.functions.permissions.lookup({})); // empty argument +expectError(web.admin.functions.permissions.lookup({ + function_ids: [], // must provide at least 1 +})); +// -- happy path +expectAssignable>([{ + function_ids: ['F1234'], +}]); + +// admin.functions.permissions.set +// -- sad path +expectError(web.admin.functions.permissions.set()); // lacking argument +expectError(web.admin.functions.permissions.set({})); // empty argument +expectError(web.admin.functions.permissions.set({ + function_id: 'F1234', // missing visibility +})); +expectError(web.admin.functions.permissions.set({ + visibility: 'named_entities', // missing function_id +})); +// -- happy path +expectAssignable>([{ + function_id: 'F1234', + visibility: 'named_entities', +}]); From 2f1f9da17b312c44b6517e90ae53fb8d8c2172d3 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 14:44:13 -0500 Subject: [PATCH 110/122] Refactor arguments and type tests for functions.* APIs. --- packages/web-api/src/methods.ts | 22 +++++------- packages/web-api/src/types/request/files.ts | 2 +- .../web-api/src/types/request/functions.ts | 15 ++++++++ .../test/types/methods/functions.test-d.ts | 36 +++++++++++++++++++ 4 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 packages/web-api/src/types/request/functions.ts create mode 100644 packages/web-api/test/types/methods/functions.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index ab45936c0..2c86ccd5b 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -273,6 +273,7 @@ import type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminB import type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveArguments, AdminConversationsBulkDeleteArguments, AdminConversationsBulkMoveArguments, AdminConversationsConvertToPrivateArguments, AdminConversationsConvertToPublicArguments, AdminConversationsCreateArguments, AdminConversationsDeleteArguments, AdminConversationsDisconnectSharedArguments, AdminConversationsEKMListOriginalConnectedChannelInfoArguments, AdminConversationsGetConversationPrefsArguments, AdminConversationsGetCustomRetentionArguments, AdminConversationsGetTeamsArguments, AdminConversationsInviteArguments, AdminConversationsLookupArguments, AdminConversationsRemoveCustomRetentionArguments, AdminConversationsRenameArguments, AdminConversationsRestrictAccessAddGroupArguments, AdminConversationsRestrictAccessListGroupsArguments, AdminConversationsRestrictAccessRemoveGroupArguments, AdminConversationsSearchArguments, AdminConversationsSetConversationPrefsArguments, AdminConversationsSetCustomRetentionArguments, AdminConversationsSetTeamsArguments, AdminConversationsUnarchiveArguments } from './types/request/admin/conversations'; import type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiListArguments, AdminEmojiRemoveArguments, AdminEmojiRenameArguments } from './types/request/admin/emoji'; import type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArguments, AdminFunctionsPermissionsSetArguments } from './types/request/admin/functions'; +import type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments } from './types/request/functions'; /** * Generic method definition @@ -1311,7 +1312,15 @@ export abstract class Methods extends EventEmitter { }; public readonly functions = { + /** + * @description Signal the failure to execute a Custom Function. + * @see {@link https://api.slack.com/methods/functions.completeError `functions.completeError` API reference}. + */ completeError: bindApiCall(this, 'functions.completeError'), + /** + * @description Signal the successful completion of a Custom Function. + * @see {@link https://api.slack.com/methods/functions.completeSuccess `functions.completeSuccess` API reference}. + */ completeSuccess: bindApiCall( this, 'functions.completeSuccess', @@ -1957,17 +1966,4 @@ export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { workflow_ids: string[]; } -/* - * `functions.*` - */ -export interface FunctionsCompleteErrorArguments extends TokenOverridable { - function_execution_id: string; - error: string; -} - -export interface FunctionsCompleteSuccessArguments extends TokenOverridable { - function_execution_id: string; - outputs: Record; -} - export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/files.ts b/packages/web-api/src/types/request/files.ts index ccaa26049..32c5b9009 100644 --- a/packages/web-api/src/types/request/files.ts +++ b/packages/web-api/src/types/request/files.ts @@ -1,5 +1,5 @@ import type { Stream } from 'node:stream'; -import { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; +import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common'; import type { FilesGetUploadURLExternalResponse } from '../response'; interface FileArgument { diff --git a/packages/web-api/src/types/request/functions.ts b/packages/web-api/src/types/request/functions.ts new file mode 100644 index 000000000..b00aaf1bd --- /dev/null +++ b/packages/web-api/src/types/request/functions.ts @@ -0,0 +1,15 @@ +import type { TokenOverridable } from './common'; + +interface ExecutionID { + function_execution_id: string; +} + +// https://api.slack.com/methods/functions.completeError +export interface FunctionsCompleteErrorArguments extends ExecutionID, TokenOverridable { + error: string; +} + +// https://api.slack.com/methods/functions.completeSuccess +export interface FunctionsCompleteSuccessArguments extends ExecutionID, TokenOverridable { + outputs: Record; +} diff --git a/packages/web-api/test/types/methods/functions.test-d.ts b/packages/web-api/test/types/methods/functions.test-d.ts new file mode 100644 index 000000000..20e8814bf --- /dev/null +++ b/packages/web-api/test/types/methods/functions.test-d.ts @@ -0,0 +1,36 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// functions.completeError +// -- sad path +expectError(web.functions.completeError()); // lacking argument +expectError(web.functions.completeError({})); // empty argument +expectError(web.functions.completeError({ + function_execution_id: 'Fx1234', // missing error +})); +expectError(web.functions.completeError({ + error: 'boomsies', // missing function_execution_id +})); +// -- happy path +expectAssignable>([{ + function_execution_id: 'Fx1234', + error: 'oh noes', +}]); + +// functions.completeSuccess +// -- sad path +expectError(web.functions.completeSuccess()); // lacking argument +expectError(web.functions.completeSuccess({})); // empty argument +expectError(web.functions.completeSuccess({ + function_execution_id: 'Fx1234', // missing output +})); +expectError(web.functions.completeSuccess({ + outputs: {}, // missing function_execution_id +})); +// -- happy path +expectAssignable>([{ + function_execution_id: 'Fx1234', + outputs: {}, +}]); From 22efb5a0ef3f13cd317587be7407d58a2aca181e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 14:49:12 -0500 Subject: [PATCH 111/122] fix bad reference --- .../src/types/response/FunctionsCompleteErrorResponse.ts | 2 +- .../src/types/response/FunctionsCompleteSuccessResponse.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web-api/src/types/response/FunctionsCompleteErrorResponse.ts b/packages/web-api/src/types/response/FunctionsCompleteErrorResponse.ts index 0cf44f406..0450f7591 100644 --- a/packages/web-api/src/types/response/FunctionsCompleteErrorResponse.ts +++ b/packages/web-api/src/types/response/FunctionsCompleteErrorResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FunctionsCompleteErrorResponse = WebAPICallResult & { error?: string; needed?: string; diff --git a/packages/web-api/src/types/response/FunctionsCompleteSuccessResponse.ts b/packages/web-api/src/types/response/FunctionsCompleteSuccessResponse.ts index e81792d51..d40df2d79 100644 --- a/packages/web-api/src/types/response/FunctionsCompleteSuccessResponse.ts +++ b/packages/web-api/src/types/response/FunctionsCompleteSuccessResponse.ts @@ -8,7 +8,7 @@ // // ///////////////////////////////////////////////////////////////////////////////////////// -import { WebAPICallResult } from '../WebClient'; +import { WebAPICallResult } from '../../WebClient'; export type FunctionsCompleteSuccessResponse = WebAPICallResult & { error?: string; needed?: string; From 0bec7f691e315866008bd15c5b6ff4c1ba81d720 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 15:06:01 -0500 Subject: [PATCH 112/122] Refactor arguments and type tests for admin.inviteRequests.* APIs. --- packages/web-api/src/methods.ts | 48 +++++++------- .../src/types/request/admin/inviteRequests.ts | 27 ++++++++ .../methods/admin.inviteRequests.test-d.ts | 63 +++++++++++++++++++ 3 files changed, 111 insertions(+), 27 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/inviteRequests.ts create mode 100644 packages/web-api/test/types/methods/admin.inviteRequests.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 2c86ccd5b..1c15c3d52 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -274,6 +274,7 @@ import type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveA import type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiListArguments, AdminEmojiRemoveArguments, AdminEmojiRenameArguments } from './types/request/admin/emoji'; import type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArguments, AdminFunctionsPermissionsSetArguments } from './types/request/admin/functions'; import type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments } from './types/request/functions'; +import type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedListArguments, AdminInviteRequestsDeniedListArguments, AdminInviteRequestsDenyArguments, AdminInviteRequestsListArguments } from './types/request/admin/inviteRequests'; /** * Generic method definition @@ -679,23 +680,43 @@ export abstract class Methods extends EventEmitter { }, }, inviteRequests: { + /** + * @description Approve a workspace invite request. + * @see {@link https://api.slack.com/methods/admin.inviteRequests.approve `admin.inviteRequests.approve` API reference}. + */ approve: bindApiCall( this, 'admin.inviteRequests.approve', ), approved: { + /** + * @description List all approved workspace invite requests. + * @see {@link https://api.slack.com/methods/admin.inviteRequests.approved.list `admin.inviteRequests.approved.list` API reference}. + */ list: bindApiCall( this, 'admin.inviteRequests.approved.list', ), }, denied: { + /** + * @description List all denied workspace invite requests. + * @see {@link https://api.slack.com/methods/admin.inviteRequests.denied.list `admin.inviteRequests.denied.list` API reference}. + */ list: bindApiCall( this, 'admin.inviteRequests.denied.list', ), }, + /** + * @description Deny a workspace invite request. + * @see {@link https://api.slack.com/methods/admin.inviteRequests.deny `admin.inviteRequests.deny` API reference}. + */ deny: bindApiCall(this, 'admin.inviteRequests.deny'), + /** + * @description List all pending workspace invite requests. + * @see {@link https://api.slack.com/methods/admin.inviteRequests.list `admin.inviteRequests.list` API reference}. + */ list: bindApiCall(this, 'admin.inviteRequests.list'), }, teams: { @@ -1719,33 +1740,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.inviteRequests.approve -export interface AdminInviteRequestsApproveArguments - extends TokenOverridable { - invite_request_id: string; - team_id: string; -} -// https://api.slack.com/methods/admin.inviteRequests.approved.list -export interface AdminInviteRequestsApprovedListArguments - extends TokenOverridable, CursorPaginationEnabled { - team_id: string; -} -// https://api.slack.com/methods/admin.inviteRequests.deny -export interface AdminInviteRequestsDenyArguments - extends TokenOverridable { - invite_request_id: string; - team_id: string; -} -// https://api.slack.com/methods/admin.inviteRequests.denied.list -export interface AdminInviteRequestsDeniedListArguments - extends TokenOverridable, CursorPaginationEnabled { - team_id: string; -} -// https://api.slack.com/methods/admin.inviteRequests.list -export interface AdminInviteRequestsListArguments - extends TokenOverridable, CursorPaginationEnabled { - team_id: string; -} // https://api.slack.com/methods/admin.roles.addAssignments export interface AdminRolesAddAssignmentsArguments extends TokenOverridable { diff --git a/packages/web-api/src/types/request/admin/inviteRequests.ts b/packages/web-api/src/types/request/admin/inviteRequests.ts new file mode 100644 index 000000000..1b2cc657f --- /dev/null +++ b/packages/web-api/src/types/request/admin/inviteRequests.ts @@ -0,0 +1,27 @@ +import { Option } from 'src/types/response/ChannelsHistoryResponse'; +import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable } from '../common'; + +interface InviteRequestID { + /** @description ID of the request to invite. */ + invite_request_id: string; +} + +// https://api.slack.com/methods/admin.inviteRequests.approve +export interface AdminInviteRequestsApproveArguments extends InviteRequestID, Required, + TokenOverridable {} + +// https://api.slack.com/methods/admin.inviteRequests.approved.list +export interface AdminInviteRequestsApprovedListArguments extends Required, TokenOverridable, + CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.inviteRequests.denied.list +export interface AdminInviteRequestsDeniedListArguments extends Required, TokenOverridable, + CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.inviteRequests.deny +export interface AdminInviteRequestsDenyArguments extends InviteRequestID, Required, + TokenOverridable {} + +// https://api.slack.com/methods/admin.inviteRequests.list +export interface AdminInviteRequestsListArguments extends Required, TokenOverridable, + CursorPaginationEnabled {} diff --git a/packages/web-api/test/types/methods/admin.inviteRequests.test-d.ts b/packages/web-api/test/types/methods/admin.inviteRequests.test-d.ts new file mode 100644 index 000000000..29a25a097 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.inviteRequests.test-d.ts @@ -0,0 +1,63 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.inviteRequests.approve +// -- sad path +expectError(web.admin.inviteRequests.approve()); // lacking argument +expectError(web.admin.inviteRequests.approve({})); // empty argument +expectError(web.admin.inviteRequests.approve({ + invite_request_id: 'I1234', // missing team_id +})); +expectError(web.admin.inviteRequests.approve({ + team_id: 'T1234', // missing invite_request_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + invite_request_id: 'I1234', +}]); + +// admin.inviteRequests.approved.list +// -- sad path +expectError(web.admin.inviteRequests.approved.list()); // lacking argument +expectError(web.admin.inviteRequests.approved.list({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); + +// admin.inviteRequests.denied.list +// -- sad path +expectError(web.admin.inviteRequests.denied.list()); // lacking argument +expectError(web.admin.inviteRequests.denied.list({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); + +// admin.inviteRequests.deny +// -- sad path +expectError(web.admin.inviteRequests.deny()); // lacking argument +expectError(web.admin.inviteRequests.deny({})); // empty argument +expectError(web.admin.inviteRequests.deny({ + invite_request_id: 'I1234', // missing team_id +})); +expectError(web.admin.inviteRequests.deny({ + team_id: 'T1234', // missing invite_request_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + invite_request_id: 'I1234', +}]); + +// admin.inviteRequests.list +// -- sad path +expectError(web.admin.inviteRequests.list()); // lacking argument +expectError(web.admin.inviteRequests.list({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); From 0f59b9600a9c5b4b2db2d47d4ebb23e0d466cf6e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 16:25:29 -0500 Subject: [PATCH 113/122] Refactor arguments and type tests for admin.roles.* APIs. --- packages/web-api/src/methods.ts | 22 +---- .../src/types/request/admin/inviteRequests.ts | 1 - .../web-api/src/types/request/admin/roles.ts | 38 ++++++++ .../test/types/methods/admin.roles.test-d.ts | 94 +++++++++++++++++++ 4 files changed, 133 insertions(+), 22 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/roles.ts create mode 100644 packages/web-api/test/types/methods/admin.roles.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1c15c3d52..c3f7c1f15 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -275,6 +275,7 @@ import type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiLis import type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArguments, AdminFunctionsPermissionsSetArguments } from './types/request/admin/functions'; import type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments } from './types/request/functions'; import type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedListArguments, AdminInviteRequestsDeniedListArguments, AdminInviteRequestsDenyArguments, AdminInviteRequestsListArguments } from './types/request/admin/inviteRequests'; +import type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArguments, AdminRolesRemoveAssignmentsArguments } from './types/request/admin/roles'; /** * Generic method definition @@ -1740,27 +1741,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.roles.addAssignments -export interface AdminRolesAddAssignmentsArguments - extends TokenOverridable { - role_id: string; - entity_ids: string[]; - user_ids: string[]; -} -// https://api.slack.com/methods/admin.roles.listAssignments -export interface AdminRolesListAssignmentsArguments - extends TokenOverridable, CursorPaginationEnabled { - entity_ids?: string[]; - role_ids?: string[]; - sort_dir?: string; // TODO: breaking change - turn to `asc` | `desc`? tho docs say this should be capital letters... -} -// https://api.slack.com/methods/admin.roles.removeAssignments -export interface AdminRolesRemoveAssignmentsArguments - extends TokenOverridable { - role_id: string; - entity_ids: string[]; - user_ids: string[]; -} // https://api.slack.com/methods/admin.teams.admins.list export interface AdminTeamsAdminsListArguments extends TokenOverridable, CursorPaginationEnabled { team_id: string; diff --git a/packages/web-api/src/types/request/admin/inviteRequests.ts b/packages/web-api/src/types/request/admin/inviteRequests.ts index 1b2cc657f..9ed4c5e86 100644 --- a/packages/web-api/src/types/request/admin/inviteRequests.ts +++ b/packages/web-api/src/types/request/admin/inviteRequests.ts @@ -1,4 +1,3 @@ -import { Option } from 'src/types/response/ChannelsHistoryResponse'; import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable } from '../common'; interface InviteRequestID { diff --git a/packages/web-api/src/types/request/admin/roles.ts b/packages/web-api/src/types/request/admin/roles.ts new file mode 100644 index 000000000..20073731a --- /dev/null +++ b/packages/web-api/src/types/request/admin/roles.ts @@ -0,0 +1,38 @@ +import type { CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; + +interface EntityIDs { + /** + * @description List of the entity IDs for which roles will be assigned/listed/removed. + * These can be Org IDs (E12345), Team IDs (T12345) or Channel IDs (C12345). + */ + entity_ids: [string, ...string[]]; +} + +interface RoleID { + /** + * @description ID of the role to which users will be assigned/removed. + * @see {@link https://api.slack.com/methods/admin.roles.addAssignments#markdown Admin Roles under Usage info}. + */ + role_id: string; +} + +interface UserIDs { + /** @description List of IDs from the users to be added to/removed from the given role. */ + user_ids: [string, ...string[]]; +} + +// https://api.slack.com/methods/admin.roles.addAssignments +export interface AdminRolesAddAssignmentsArguments extends EntityIDs, RoleID, UserIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.roles.listAssignments +export interface AdminRolesListAssignmentsArguments extends Partial, TokenOverridable, + CursorPaginationEnabled, SortDir { + /** + * @description Collection of role ids to scope results by. + * @see {@link https://api.slack.com/methods/admin.roles.addAssignments#markdown Admin Roles under Usage info}. + */ + role_ids?: string[]; +} + +// https://api.slack.com/methods/admin.roles.removeAssignments +export interface AdminRolesRemoveAssignmentsArguments extends EntityIDs, RoleID, UserIDs, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/admin.roles.test-d.ts b/packages/web-api/test/types/methods/admin.roles.test-d.ts new file mode 100644 index 000000000..6e670b2c7 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.roles.test-d.ts @@ -0,0 +1,94 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.roles.addAssignments +// -- sad path +expectError(web.admin.roles.addAssignments()); // lacking argument +expectError(web.admin.roles.addAssignments({})); // empty argument +expectError(web.admin.roles.addAssignments({ + entity_ids: ['E1234'], // missing role_id, user_ids +})); +expectError(web.admin.roles.addAssignments({ + role_id: 'Rl0A', // missing entity_ids, user_ids +})); +expectError(web.admin.roles.addAssignments({ + user_ids: ['U1234'], // missing entity_ids, role_id +})); +expectError(web.admin.roles.addAssignments({ + entity_ids: ['E1234'], // missing user_ids + role_id: 'Rl0A', +})); +expectError(web.admin.roles.addAssignments({ + entity_ids: ['E1234'], // missing role_id + user_ids: ['U1234'], +})); +expectError(web.admin.roles.addAssignments({ + role_id: 'Rl0A', // missing entity_ids + user_ids: ['U1234'], +})); +expectError(web.admin.roles.addAssignments({ + entity_ids: [], // need at least 1 item + role_id: 'Rl0A', + user_ids: ['U1234'], +})); +expectError(web.admin.roles.addAssignments({ + entity_ids: ['C1234'], + role_id: 'Rl0A', + user_ids: [], // need at least 1 item, +})); +// -- happy path +expectAssignable>([{ + entity_ids: ['C1234'], + role_id: 'Rl0A', + user_ids: ['U1234'], +}]); + +// admin.roles.listAssignments +// -- sad path +expectError(web.admin.roles.listAssignments()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional + +// admin.roles.removeAssignments +// -- sad path +expectError(web.admin.roles.removeAssignments()); // lacking argument +expectError(web.admin.roles.removeAssignments({})); // empty argument +expectError(web.admin.roles.removeAssignments({ + entity_ids: ['E1234'], // missing role_id, user_ids +})); +expectError(web.admin.roles.removeAssignments({ + role_id: 'Rl0A', // missing entity_ids, user_ids +})); +expectError(web.admin.roles.removeAssignments({ + user_ids: ['U1234'], // missing entity_ids, role_id +})); +expectError(web.admin.roles.removeAssignments({ + entity_ids: ['E1234'], // missing user_ids + role_id: 'Rl0A', +})); +expectError(web.admin.roles.removeAssignments({ + entity_ids: ['E1234'], // missing role_id + user_ids: ['U1234'], +})); +expectError(web.admin.roles.removeAssignments({ + role_id: 'Rl0A', // missing entity_ids + user_ids: ['U1234'], +})); +expectError(web.admin.roles.removeAssignments({ + entity_ids: [], // need at least 1 item + role_id: 'Rl0A', + user_ids: ['U1234'], +})); +expectError(web.admin.roles.removeAssignments({ + entity_ids: ['C1234'], + role_id: 'Rl0A', + user_ids: [], // need at least 1 item, +})); +// -- happy path +expectAssignable>([{ + entity_ids: ['C1234'], + role_id: 'Rl0A', + user_ids: ['U1234'], +}]); From fcebf0efb1dba412c51a0fa43b2a3586f2f38646 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 7 Dec 2023 17:03:24 -0500 Subject: [PATCH 114/122] Refactor arguments and type tests for admin.teams.* APIs. --- packages/web-api/src/methods.ts | 111 +++++++------- .../src/types/request/admin/conversations.ts | 7 +- .../web-api/src/types/request/admin/teams.ts | 59 ++++++++ packages/web-api/src/types/request/common.ts | 7 + .../test/types/methods/admin.teams.test-d.ts | 137 ++++++++++++++++++ 5 files changed, 263 insertions(+), 58 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/teams.ts create mode 100644 packages/web-api/test/types/methods/admin.teams.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index c3f7c1f15..8f733024c 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -276,6 +276,7 @@ import type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArgume import type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments } from './types/request/functions'; import type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedListArguments, AdminInviteRequestsDeniedListArguments, AdminInviteRequestsDenyArguments, AdminInviteRequestsListArguments } from './types/request/admin/inviteRequests'; import type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArguments, AdminRolesRemoveAssignmentsArguments } from './types/request/admin/roles'; +import type { AdminTeamsAdminsListArguments, AdminTeamsCreateArguments, AdminTeamsListArguments, AdminTeamsOwnersListArguments, AdminTeamsSettingsInfoArguments, AdminTeamsSettingsSetDefaultChannelsArguments, AdminTeamsSettingsSetDescriptionArguments, AdminTeamsSettingsSetDiscoverabilityArguments, AdminTeamsSettingsSetIconArguments, AdminTeamsSettingsSetNameArguments } from './types/request/admin/teams'; /** * Generic method definition @@ -720,48 +721,101 @@ export abstract class Methods extends EventEmitter { */ list: bindApiCall(this, 'admin.inviteRequests.list'), }, + roles: { + /** + * @description Adds members to the specified role with the specified scopes. + * @see {@link https://api.slack.com/methods/admin.roles.addAssignments `admin.roles.addAssignments` API reference}. + */ + addAssignments: bindApiCall(this, 'admin.roles.addAssignments'), + /** + * @description Lists assignments for all roles across entities. + * Options to scope results by any combination of roles or entities. + * @see {@link https://api.slack.com/methods/admin.roles.listAssignments `admin.roles.listAssignments` API reference}. + */ + listAssignments: bindApiCall(this, 'admin.roles.listAssignments'), + /** + * @description Removes a set of users from a role for the given scopes and entities. + * @see {@link https://api.slack.com/methods/admin.roles.removeAssignments `admin.roles.removeAssignments` API reference}. + */ + removeAssignments: bindApiCall(this, 'admin.roles.removeAssignments'), + }, teams: { admins: { + /** + * @description List all of the admins on a given workspace. + * @see {@link https://api.slack.com/methods/admin.teams.admins.list `admin.teams.admins.list` API reference}. + */ list: bindApiCall(this, 'admin.teams.admins.list'), }, + /** + * @description Create an Enterprise team. + * @see {@link https://api.slack.com/methods/admin.teams.create `admin.teams.create` API reference}. + */ create: bindApiCall(this, 'admin.teams.create'), + /** + * @description List all teams on an Enterprise organization. + * @see {@link https://api.slack.com/methods/admin.teams.list `admin.teams.list` API reference}. + */ list: bindApiCall(this, 'admin.teams.list'), owners: { + /** + * @description List all of the owners on a given workspace. + * @see {@link https://api.slack.com/methods/admin.teams.owners.list `admin.teams.owners.list` API reference}. + */ list: bindApiCall(this, 'admin.teams.owners.list'), }, settings: { + /** + * @description Fetch information about settings in a workspace. + * @see {@link https://api.slack.com/methods/admin.teams.owners.list `admin.teams.owners.list` API reference}. + */ info: bindApiCall(this, 'admin.teams.settings.info'), + /** + * @description Set the default channels of a workspace. + * @see {@link https://api.slack.com/methods/admin.teams.settings.setDefaultChannels `admin.teams.settings.setDefaultChannels` API reference}. + */ setDefaultChannels: bindApiCall( this, 'admin.teams.settings.setDefaultChannels', ), + /** + * @description Set the description of a given workspace. + * @see {@link https://api.slack.com/methods/admin.teams.settings.setDescription `admin.teams.settings.setDescription` API reference}. + */ setDescription: bindApiCall( this, 'admin.teams.settings.setDescription', ), + /** + * @description Set the discoverability of a given workspace. + * @see {@link https://api.slack.com/methods/admin.teams.settings.setDiscoverability `admin.teams.settings.setDiscoverability` API reference}. + */ setDiscoverability: bindApiCall( this, 'admin.teams.settings.setDiscoverability', ), + /** + * @description Sets the icon of a workspace. + * @see {@link https://api.slack.com/methods/admin.teams.settings.setIcon `admin.teams.settings.setIcon` API reference}. + */ setIcon: bindApiCall( this, 'admin.teams.settings.setIcon', ), + /** + * @description Set the name of a given workspace. + * @see {@link https://api.slack.com/methods/admin.teams.settings.setName `admin.teams.settings.setName` API reference}. + */ setName: bindApiCall( this, 'admin.teams.settings.setName', ), }, }, - roles: { - addAssignments: bindApiCall(this, 'admin.roles.addAssignments'), - listAssignments: bindApiCall(this, 'admin.roles.listAssignments'), - removeAssignments: bindApiCall(this, 'admin.roles.removeAssignments'), - }, usergroups: { addChannels: bindApiCall( this, @@ -1741,53 +1795,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.teams.admins.list -export interface AdminTeamsAdminsListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id: string; -} -type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; -// https://api.slack.com/methods/admin.teams.create -export interface AdminTeamsCreateArguments extends TokenOverridable { - team_domain: string; - team_name: string; - team_description?: string; - team_discoverability?: TeamDiscoverability; -} -// https://api.slack.com/methods/admin.teams.list -export interface AdminTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { } -// https://api.slack.com/methods/admin.teams.owners.list -export interface AdminTeamsOwnersListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id: string; -} -// https://api.slack.com/methods/admin.teams.settings.info -export interface AdminTeamsSettingsInfoArguments extends TokenOverridable { - team_id: string; -} -// https://api.slack.com/methods/admin.teams.settings.setDefaultChannels -export interface AdminTeamsSettingsSetDefaultChannelsArguments extends TokenOverridable { - team_id: string; - channel_ids: string[]; -} -// https://api.slack.com/methods/admin.teams.settings.setDescription -export interface AdminTeamsSettingsSetDescriptionArguments extends TokenOverridable { - team_id: string; - description: string; -} -// https://api.slack.com/methods/admin.teams.settings.setDiscoverability -export interface AdminTeamsSettingsSetDiscoverabilityArguments extends TokenOverridable { - team_id: string; - discoverability: TeamDiscoverability; -} -// https://api.slack.com/methods/admin.teams.settings.setIcon -export interface AdminTeamsSettingsSetIconArguments extends TokenOverridable { - team_id: string; - image_url: string; -} -// https://api.slack.com/methods/admin.teams.settings.setName -export interface AdminTeamsSettingsSetNameArguments extends TokenOverridable { - team_id: string; - name: string; -} // https://api.slack.com/methods/admin.usergroups.addChannels export interface AdminUsergroupsAddChannelsArguments extends TokenOverridable { usergroup_id: string; diff --git a/packages/web-api/src/types/request/admin/conversations.ts b/packages/web-api/src/types/request/admin/conversations.ts index ed8174557..26c949810 100644 --- a/packages/web-api/src/types/request/admin/conversations.ts +++ b/packages/web-api/src/types/request/admin/conversations.ts @@ -1,15 +1,10 @@ -import type { CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; +import type { ChannelIDs, CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; interface ChannelID { // an identical interface exists in src/types/request/conversations.ts, but it is only for invites /** @description Encoded channel ID. */ channel_id: string; } -interface ChannelIDs { - /** @description An array of channel IDs (must include at least one ID). */ - channel_ids: [string, ...string[]]; -} - type ChannelType = 'private' | 'private_exclude' | 'archived' | 'exclude_archived' | 'private_exclude_archived' | 'multi_workspace' | 'org_wide' | 'external_shared_exclude' | 'external_shared' | 'external_shared_private' | 'external_shared_archived' | 'exclude_org_shared'; interface GroupID { diff --git a/packages/web-api/src/types/request/admin/teams.ts b/packages/web-api/src/types/request/admin/teams.ts new file mode 100644 index 000000000..2e10248d1 --- /dev/null +++ b/packages/web-api/src/types/request/admin/teams.ts @@ -0,0 +1,59 @@ +import type { ChannelIDs, CursorPaginationEnabled, TokenOverridable } from '../common'; + +interface TeamID { + /** @description The encoded team ID to query. */ + team_id: string; +} + +type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; + +// https://api.slack.com/methods/admin.teams.admins.list +export interface AdminTeamsAdminsListArguments extends TeamID, TokenOverridable, CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.teams.create +export interface AdminTeamsCreateArguments extends TokenOverridable { + /** @description Team domain (for example, slacksoftballteam). Domains are limited to 21 characters. */ + team_domain: string; + /** @description Team name (for example, Slack Softball Team). */ + team_name: string; + /** @description Description for the team. */ + team_description?: string; + /** @description Who can join the team. */ + team_discoverability?: TeamDiscoverability; +} + +// https://api.slack.com/methods/admin.teams.list +export interface AdminTeamsListArguments extends TokenOverridable, CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.teams.owners.list +export interface AdminTeamsOwnersListArguments extends TeamID, TokenOverridable, CursorPaginationEnabled {} + +// https://api.slack.com/methods/admin.teams.settings.info +export interface AdminTeamsSettingsInfoArguments extends TeamID, TokenOverridable {} + +// https://api.slack.com/methods/admin.teams.settings.setDefaultChannels +export interface AdminTeamsSettingsSetDefaultChannelsArguments extends ChannelIDs, TeamID, TokenOverridable {} + +// https://api.slack.com/methods/admin.teams.settings.setDescription +export interface AdminTeamsSettingsSetDescriptionArguments extends TeamID, TokenOverridable { + /** @description The new description for the workspace. */ + description: string; +} + +// https://api.slack.com/methods/admin.teams.settings.setDiscoverability +export interface AdminTeamsSettingsSetDiscoverabilityArguments extends TeamID, TokenOverridable { + /** @description This workspace's discovery setting. */ + discoverability: TeamDiscoverability; +} + +// https://api.slack.com/methods/admin.teams.settings.setIcon +export interface AdminTeamsSettingsSetIconArguments extends TeamID, TokenOverridable { + /** @description Image URL for the icon. */ + image_url: string; +} + +// https://api.slack.com/methods/admin.teams.settings.setName +export interface AdminTeamsSettingsSetNameArguments extends TeamID, TokenOverridable { + /** @description The new name of the workspace. */ + name: string; +} diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index cdbab61d3..425469dd3 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -111,3 +111,10 @@ export interface OAuthGrantRefresh { /** @description The `refresh_token` param as described in the OAuth spec. */ refresh_token?: string; } + +// Some APIs (admin.teams.settings.setDefaultChannels, admin.conversations.*) require a minimum-1-item channel array + +export interface ChannelIDs { + /** @description An array of channel IDs (must include at least one ID). */ + channel_ids: [string, ...string[]]; +} diff --git a/packages/web-api/test/types/methods/admin.teams.test-d.ts b/packages/web-api/test/types/methods/admin.teams.test-d.ts new file mode 100644 index 000000000..7c037bb5e --- /dev/null +++ b/packages/web-api/test/types/methods/admin.teams.test-d.ts @@ -0,0 +1,137 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.teams.admins.list +// -- sad path +expectError(web.admin.teams.admins.list()); // lacking argument +expectError(web.admin.teams.admins.list({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); + +// admin.teams.create +// -- sad path +expectError(web.admin.teams.create()); // lacking argument +expectError(web.admin.teams.create({})); // empty argument +expectError(web.admin.teams.create({ + team_name: 'Jokers', // missing team_domain +})); +expectError(web.admin.teams.create({ + team_domain: 'jokers', // missing team_name +})); +// -- happy path +expectAssignable>([{ + team_domain: 'jokers', + team_name: 'Jokers', +}]); + +// admin.teams.list +// -- sad path +expectError(web.admin.teams.list()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional + +// admin.teams.owners.list +// -- sad path +expectError(web.admin.teams.owners.list()); // lacking argument +expectError(web.admin.teams.owners.list({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); + +// admin.teams.settings.info +// -- sad path +expectError(web.admin.teams.settings.info()); // lacking argument +expectError(web.admin.teams.settings.info({})); // empty argument +// -- happy path +expectAssignable>([{ + team_id: 'T1234', +}]); + +// admin.teams.settings.setDefaultChannels +// -- sad path +expectError(web.admin.teams.settings.setDefaultChannels()); // lacking argument +expectError(web.admin.teams.settings.setDefaultChannels({})); // empty argument +expectError(web.admin.teams.settings.setDefaultChannels({ + team_id: 'T1234', // missing channel_ids +})); +expectError(web.admin.teams.settings.setDefaultChannels({ + channel_ids: ['C1234'], // missing team_id +})); +expectError(web.admin.teams.settings.setDefaultChannels({ + team_id: 'T1234', + channel_ids: [], // must include at least 1 channel +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + channel_ids: ['C1234'], +}]); + +// admin.teams.settings.setDescription +// -- sad path +expectError(web.admin.teams.settings.setDescription()); // lacking argument +expectError(web.admin.teams.settings.setDescription({})); // empty argument +expectError(web.admin.teams.settings.setDescription({ + team_id: 'T1234', // missing description +})); +expectError(web.admin.teams.settings.setDescription({ + description: 'hey ho', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + description: 'existential dread', +}]); + +// admin.teams.settings.setDiscoverability +// -- sad path +expectError(web.admin.teams.settings.setDiscoverability()); // lacking argument +expectError(web.admin.teams.settings.setDiscoverability({})); // empty argument +expectError(web.admin.teams.settings.setDiscoverability({ + team_id: 'T1234', // missing discoverability +})); +expectError(web.admin.teams.settings.setDiscoverability({ + discoverability: 'open', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + discoverability: 'closed', +}]); + +// admin.teams.settings.setIcon +// -- sad path +expectError(web.admin.teams.settings.setIcon()); // lacking argument +expectError(web.admin.teams.settings.setIcon({})); // empty argument +expectError(web.admin.teams.settings.setIcon({ + team_id: 'T1234', // missing image_url +})); +expectError(web.admin.teams.settings.setIcon({ + image_url: 'example.com', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + image_url: 'example.com', +}]); + +// admin.teams.settings.setName +// -- sad path +expectError(web.admin.teams.settings.setName()); // lacking argument +expectError(web.admin.teams.settings.setName({})); // empty argument +expectError(web.admin.teams.settings.setName({ + team_id: 'T1234', // missing name +})); +expectError(web.admin.teams.settings.setName({ + name: 'SlackHQ', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + name: 'SlackHQ', +}]); From b6f1a880331f270d8e83b196e4579433c12c7390 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 11 Dec 2023 15:01:07 -0500 Subject: [PATCH 115/122] users.profile.set should accept an object for the `profile` argument. --- packages/web-api/src/types/request/users.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web-api/src/types/request/users.ts b/packages/web-api/src/types/request/users.ts index ff7942183..c13f74f91 100644 --- a/packages/web-api/src/types/request/users.ts +++ b/packages/web-api/src/types/request/users.ts @@ -68,11 +68,11 @@ export interface UsersProfileGetArguments extends TokenOverridable { export interface UsersProfileSetArguments extends TokenOverridable { /** * @description Sets profile fields using a single argument. - * Collection of key:value pairs presented as a URL-encoded JSON hash. - * At most 50 fields may be set. Each field `name` is limited to 255 characters. + * Collection of key:value pairs presented. + * At most 50 fields may be set. Each field name is limited to 255 characters. * @see {@link https://api.slack.com/methods/users.profile.set#profile-fields `users.profile.set` Profile fields usage info}. */ - profile?: string; // TODO: allow for an object (eg use Record) and add code to JSON encoded properly? + profile?: Record; /** @description ID of user to change. This argument may only be specified by admins on paid teams. */ user?: string; // must be an admin user and must be on a paid plan /** From d0526bf5da47cd53d1d5f6447d3dc2f2a0c209be Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 12 Dec 2023 11:39:38 -0500 Subject: [PATCH 116/122] Refactor arguments and type tests for admin.usergroups.* APIs. --- packages/web-api/src/methods.ts | 40 +++++----- .../src/types/request/admin/usergroups.ts | 38 ++++++++++ .../types/methods/admin.usergroups.test-d.ts | 73 +++++++++++++++++++ 3 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/usergroups.ts create mode 100644 packages/web-api/test/types/methods/admin.usergroups.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 8f733024c..c465d42c1 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -277,6 +277,7 @@ import type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments import type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedListArguments, AdminInviteRequestsDeniedListArguments, AdminInviteRequestsDenyArguments, AdminInviteRequestsListArguments } from './types/request/admin/inviteRequests'; import type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArguments, AdminRolesRemoveAssignmentsArguments } from './types/request/admin/roles'; import type { AdminTeamsAdminsListArguments, AdminTeamsCreateArguments, AdminTeamsListArguments, AdminTeamsOwnersListArguments, AdminTeamsSettingsInfoArguments, AdminTeamsSettingsSetDefaultChannelsArguments, AdminTeamsSettingsSetDescriptionArguments, AdminTeamsSettingsSetDiscoverabilityArguments, AdminTeamsSettingsSetIconArguments, AdminTeamsSettingsSetNameArguments } from './types/request/admin/teams'; +import type { AdminUsergroupsAddChannelsArguments, AdminUsergroupsAddTeamsArguments, AdminUsergroupsListChannelsArguments, AdminUsergroupsRemoveChannelsArguments } from './types/request/admin/usergroups'; /** * Generic method definition @@ -817,18 +818,34 @@ export abstract class Methods extends EventEmitter { }, }, usergroups: { + /** + * @description Add up to one hundred default channels to an IDP group. + * @see {@link https://api.slack.com/methods/admin.usergroups.addChannels `admin.teams.usergroups.addChannels` API reference}. + */ addChannels: bindApiCall( this, 'admin.usergroups.addChannels', ), + /** + * @description Associate one or more default workspaces with an organization-wide IDP group. + * @see {@link https://api.slack.com/methods/admin.usergroups.addTeams `admin.teams.usergroups.addTeams` API reference}. + */ addTeams: bindApiCall( this, 'admin.usergroups.addTeams', ), + /** + * @description List the channels linked to an org-level IDP group (user group). + * @see {@link https://api.slack.com/methods/admin.usergroups.listChannels `admin.teams.usergroups.listChannels` API reference}. + */ listChannels: bindApiCall( this, 'admin.usergroups.listChannels', ), + /** + * @description Remove one or more default channels from an org-level IDP group (user group). + * @see {@link https://api.slack.com/methods/admin.usergroups.removeChannels `admin.teams.usergroups.removeChannels` API reference}. + */ removeChannels: bindApiCall( this, 'admin.usergroups.removeChannels', @@ -1795,29 +1812,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.usergroups.addChannels -export interface AdminUsergroupsAddChannelsArguments extends TokenOverridable { - usergroup_id: string; - team_id?: string; - channel_ids: string | string[]; -} -// https://api.slack.com/methods/admin.usergroups.addTeams -export interface AdminUsergroupsAddTeamsArguments extends TokenOverridable { - usergroup_id: string; - team_ids: string | string[]; - auto_provision?: boolean; -} -// https://api.slack.com/methods/admin.usergroups.listChannels -export interface AdminUsergroupsListChannelsArguments extends TokenOverridable { - usergroup_id: string; - include_num_members?: boolean; - team_id?: string; -} -// https://api.slack.com/methods/admin.usergroups.removeChannels -export interface AdminUsergroupsRemoveChannelsArguments extends TokenOverridable { - usergroup_id: string; - channel_ids: string | string[]; -} // https://api.slack.com/methods/admin.users.assign export interface AdminUsersAssignArguments extends TokenOverridable { team_id: string; diff --git a/packages/web-api/src/types/request/admin/usergroups.ts b/packages/web-api/src/types/request/admin/usergroups.ts new file mode 100644 index 000000000..b424dea54 --- /dev/null +++ b/packages/web-api/src/types/request/admin/usergroups.ts @@ -0,0 +1,38 @@ +import type { OptionalTeamAssignable, TokenOverridable } from '../common'; + +interface ChannelIDs { + /** @description One or more encoded channel IDs. */ + channel_ids: string | string[]; +} + +interface UsergroupID { + /** @description ID of the IDP group to list/manage channels for. */ + usergroup_id: string; +} + +// https://api.slack.com/methods/admin.usergroups.addChannels +export interface AdminUsergroupsAddChannelsArguments extends ChannelIDs, UsergroupID, OptionalTeamAssignable, + TokenOverridable {} + +// https://api.slack.com/methods/admin.usergroups.addTeams +export interface AdminUsergroupsAddTeamsArguments extends UsergroupID, TokenOverridable { + /** + * @description One or more encoded team (workspace) IDs. + * Each workspace MUST belong to the organization associated with the token. + */ + team_ids: string | string[]; + /** + * @description When `true`, this method automatically creates new workspace accounts for the IDP group members. + * Defaults to `false`. + */ + auto_provision?: boolean; +} + +// https://api.slack.com/methods/admin.usergroups.listChannels +export interface AdminUsergroupsListChannelsArguments extends UsergroupID, OptionalTeamAssignable, TokenOverridable { + /** @description Flag to include or exclude the count of members per channel. */ + include_num_members?: boolean; +} + +// https://api.slack.com/methods/admin.usergroups.removeChannels +export interface AdminUsergroupsRemoveChannelsArguments extends ChannelIDs, UsergroupID, TokenOverridable {} diff --git a/packages/web-api/test/types/methods/admin.usergroups.test-d.ts b/packages/web-api/test/types/methods/admin.usergroups.test-d.ts new file mode 100644 index 000000000..2b12d49d7 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.usergroups.test-d.ts @@ -0,0 +1,73 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.usergroups.addChannels +// -- sad path +expectError(web.admin.usergroups.addChannels()); // lacking argument +expectError(web.admin.usergroups.addChannels({})); // lacking argument +expectError(web.admin.usergroups.addChannels({ + channel_ids: 'C1234', // missing usergroup_id +})); +expectError(web.admin.usergroups.addChannels({ + usergroup_id: 'S1234', // missing channel_ids +})); +// -- happy path +expectAssignable>([{ + channel_ids: 'C1234', // can accept a string + usergroup_id: 'S1234', +}]); +expectAssignable>([{ + channel_ids: ['C1234', 'C2345'], // can accept an array + usergroup_id: 'S1234', +}]); + +// admin.usergroups.addTeams +// -- sad path +expectError(web.admin.usergroups.addTeams()); // lacking argument +expectError(web.admin.usergroups.addTeams({})); // lacking argument +expectError(web.admin.usergroups.addTeams({ + team_ids: 'T1234', // missing usergroup_id +})); +expectError(web.admin.usergroups.addTeams({ + usergroup_id: 'S1234', // missing team_ids +})); +// -- happy path +expectAssignable>([{ + team_ids: 'T1234', // can accept a string + usergroup_id: 'S1234', +}]); +expectAssignable>([{ + team_ids: ['T1234', 'T2345'], // can accept an array + usergroup_id: 'S1234', +}]); + +// admin.usergroups.listChannels +// -- sad path +expectError(web.admin.usergroups.listChannels()); // lacking argument +expectError(web.admin.usergroups.listChannels({})); // lacking argument +// -- happy path +expectAssignable>([{ + usergroup_id: 'S1234', +}]); + +// admin.usergroups.removeChannels +// -- sad path +expectError(web.admin.usergroups.removeChannels()); // lacking argument +expectError(web.admin.usergroups.removeChannels({})); // lacking argument +expectError(web.admin.usergroups.removeChannels({ + channel_ids: 'C1234', // missing usergroup_id +})); +expectError(web.admin.usergroups.removeChannels({ + usergroup_id: 'S1234', // missing channel_ids +})); +// -- happy path +expectAssignable>([{ + channel_ids: 'C1234', // can accept a string + usergroup_id: 'S1234', +}]); +expectAssignable>([{ + channel_ids: ['C1234', 'C2345'], // can accept an array + usergroup_id: 'S1234', +}]); From 260e242842b69c457898d430162a1652dd6bbbf7 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 12 Dec 2023 14:31:15 -0500 Subject: [PATCH 117/122] Refactor arguments and type tests for admin.users.* APIs. --- packages/web-api/src/methods.ts | 194 ++++++------- .../src/types/request/admin/conversations.ts | 7 +- .../web-api/src/types/request/admin/roles.ts | 7 +- .../web-api/src/types/request/admin/teams.ts | 7 +- .../web-api/src/types/request/admin/users.ts | 149 ++++++++++ packages/web-api/src/types/request/common.ts | 29 +- .../test/types/methods/admin.users.test-d.ts | 264 ++++++++++++++++++ 7 files changed, 522 insertions(+), 135 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/users.ts create mode 100644 packages/web-api/test/types/methods/admin.users.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index c465d42c1..4770e3263 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -278,6 +278,7 @@ import type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedLi import type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArguments, AdminRolesRemoveAssignmentsArguments } from './types/request/admin/roles'; import type { AdminTeamsAdminsListArguments, AdminTeamsCreateArguments, AdminTeamsListArguments, AdminTeamsOwnersListArguments, AdminTeamsSettingsInfoArguments, AdminTeamsSettingsSetDefaultChannelsArguments, AdminTeamsSettingsSetDescriptionArguments, AdminTeamsSettingsSetDiscoverabilityArguments, AdminTeamsSettingsSetIconArguments, AdminTeamsSettingsSetNameArguments } from './types/request/admin/teams'; import type { AdminUsergroupsAddChannelsArguments, AdminUsergroupsAddTeamsArguments, AdminUsergroupsListChannelsArguments, AdminUsergroupsRemoveChannelsArguments } from './types/request/admin/usergroups'; +import type { AdminUsersAssignArguments, AdminUsersInviteArguments, AdminUsersListArguments, AdminUsersRemoveArguments, AdminUsersSessionListArguments, AdminUsersSessionClearSettingsArguments, AdminUsersSessionGetSettingsArguments, AdminUsersSessionInvalidateArguments, AdminUsersSessionResetArguments, AdminUsersSessionResetBulkArguments, AdminUsersSessionSetSettingsArguments, AdminUsersSetAdminArguments, AdminUsersSetExpirationArguments, AdminUsersSetOwnerArguments, AdminUsersSetRegularArguments, AdminUsersUnsupportedVersionsExportArguments } from './types/request/admin/users'; /** * Generic method definition @@ -852,51 +853,119 @@ export abstract class Methods extends EventEmitter { ), }, users: { + /** + * @description Add an Enterprise user to a workspace. + * @see {@link https://api.slack.com/methods/admin.users.assign `admin.users.assign` API reference}. + */ assign: bindApiCall(this, 'admin.users.assign'), + /** + * @description Invite a user to a workspace. + * @see {@link https://api.slack.com/methods/admin.users.invite `admin.users.invite` API reference}. + */ invite: bindApiCall(this, 'admin.users.invite'), + /** + * @description List users on a workspace. + * @see {@link https://api.slack.com/methods/admin.users.list `admin.users.list` API reference}. + */ list: bindApiCall(this, 'admin.users.list'), + /** + * @description Remove a user from a workspace. + * @see {@link https://api.slack.com/methods/admin.users.remove `admin.users.remove` API reference}. + */ remove: bindApiCall(this, 'admin.users.remove'), session: { - list: bindApiCall(this, 'admin.users.session.list'), - reset: bindApiCall(this, 'admin.users.session.reset'), - resetBulk: bindApiCall(this, 'admin.users.session.resetBulk'), - invalidate: bindApiCall( + /** + * @description Clear user-specific session settings—the session duration and what happens when the client + * closes—for a list of users. + * @see {@link https://api.slack.com/methods/admin.users.session.clearSettings `admin.users.session.clearSettings` API reference}. + */ + clearSettings: bindApiCall( this, - 'admin.users.session.invalidate', + 'admin.users.session.clearSettings', ), + /** + * @description Get user-specific session settings—the session duration and what happens when the client + * closes—given a list of users. + * @see {@link https://api.slack.com/methods/admin.users.session.getSettings `admin.users.session.getSettings` API reference}. + */ getSettings: bindApiCall( this, 'admin.users.session.getSettings', ), - setSettings: bindApiCall( - this, - 'admin.users.session.setSettings', - ), - clearSettings: bindApiCall( + /** + * @description Revoke a single session for a user. The user will be forced to login to Slack. + * @see {@link https://api.slack.com/methods/admin.users.session.invalidate `admin.users.session.invalidate` API reference}. + */ + invalidate: bindApiCall( this, - 'admin.users.session.clearSettings', + 'admin.users.session.invalidate', ), - }, - unsupportedVersions: { - export: bindApiCall( + /** + * @description List active user sessions for an organization. + * @see {@link https://api.slack.com/methods/admin.users.session.list `admin.users.session.list` API reference}. + */ + list: bindApiCall(this, 'admin.users.session.list'), + /** + * @description Wipes all valid sessions on all devices for a given user. + * @see {@link https://api.slack.com/methods/admin.users.session.reset `admin.users.session.reset` API reference}. + */ + reset: bindApiCall(this, 'admin.users.session.reset'), + /** + * @description Enqueues an asynchronous job to wipe all valid sessions on all devices for a given user list. + * @see {@link https://api.slack.com/methods/admin.users.session.resetBulk `admin.users.session.resetBulk` API reference}. + */ + resetBulk: bindApiCall(this, 'admin.users.session.resetBulk'), + /** + * @description Configure the user-level session settings—the session duration and what happens when the client + * closes—for one or more users. + * @see {@link https://api.slack.com/methods/admin.users.session.setSettings `admin.users.session.setSettings` API reference}. + */ + setSettings: bindApiCall( this, - 'admin.users.unsupportedVersions.export', + 'admin.users.session.setSettings', ), }, + /** + * @description Set an existing guest, regular user, or owner to be an admin user. + * @see {@link https://api.slack.com/methods/admin.users.setAdmin `admin.users.setAdmin` API reference}. + */ setAdmin: bindApiCall(this, 'admin.users.setAdmin'), + /** + * @description Set an expiration for a guest user. + * @see {@link https://api.slack.com/methods/admin.users.setExpiration `admin.users.setExpiration` API reference}. + */ setExpiration: bindApiCall( this, 'admin.users.setExpiration', ), + /** + * @description Set an existing guest, regular user, or admin user to be a workspace owner. + * @see {@link https://api.slack.com/methods/admin.users.setOwner `admin.users.setOwner` API reference}. + */ setOwner: bindApiCall( this, 'admin.users.setOwner', ), + /** + * @description Set an existing guest user, admin user, or owner to be a regular user. + * @see {@link https://api.slack.com/methods/admin.users.setRegular `admin.users.setRegular` API reference}. + */ setRegular: bindApiCall( this, 'admin.users.setRegular', ), + unsupportedVersions: { + /** + * @description Ask Slackbot to send you an export listing all workspace members using unsupported software, + * presented as a zipped CSV file. + * @see {@link https://api.slack.com/methods/admin.users.unsupportedVersions.export `admin.users.unsupportedVersions.export` API reference}. + */ + export: bindApiCall( + this, + 'admin.users.unsupportedVersions.export', + ), + }, }, workflows: { search: bindApiCall(this, 'admin.workflows.search'), @@ -1812,101 +1881,6 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.users.assign -export interface AdminUsersAssignArguments extends TokenOverridable { - team_id: string; - user_id: string; - channel_ids?: string | string[]; - is_restricted?: boolean; - is_ultra_restricted?: boolean; -} -// https://api.slack.com/methods/admin.users.invite -export interface AdminUsersInviteArguments extends TokenOverridable { - channel_ids: string | string[]; - email: string; - team_id: string; - custom_message?: string; - email_password_policy_enabled?: boolean; - guest_expiration_ts?: string; - is_restricted?: boolean; - is_ultra_restricted?: boolean; - real_name?: string; - resend?: boolean; -} -// https://api.slack.com/methods/admin.users.list -export interface AdminUsersListArguments extends TokenOverridable, CursorPaginationEnabled { - team_id?: string; // Only required if org-level token is used - include_deactivated_user_workspaces?: boolean; - is_active?: boolean; -} -// https://api.slack.com/methods/admin.users.remove -export interface AdminUsersRemoveArguments extends TokenOverridable { - team_id: string; - user_id: string; -} -// https://api.slack.com/methods/admin.users.setAdmin -export interface AdminUsersSetAdminArguments extends TokenOverridable { - team_id: string; - user_id: string; -} -// https://api.slack.com/methods/admin.users.setExpiration -export interface AdminUsersSetExpirationArguments extends TokenOverridable { - team_id?: string; - user_id: string; - expiration_ts: number; -} -// https://api.slack.com/methods/admin.users.setOwner -export interface AdminUsersSetOwnerArguments extends TokenOverridable { - team_id: string; - user_id: string; -} -// https://api.slack.com/methods/admin.users.setRegular -export interface AdminUsersSetRegularArguments extends TokenOverridable { - team_id: string; - user_id: string; -} -// TODO: breaking change: if user_id is provided, team_id must be provided, too. -// https://api.slack.com/methods/admin.users.session.list -export interface AdminUsersSessionListArguments extends TokenOverridable, CursorPaginationEnabled { - user_id?: string; - team_id?: string; -} -// https://api.slack.com/methods/admin.users.session.reset -export interface AdminUsersSessionResetArguments extends TokenOverridable { - user_id: string; - mobile_only?: boolean; - web_only?: boolean; -} -// https://api.slack.com/methods/admin.users.session.resetBulk -export interface AdminUsersSessionResetBulkArguments extends TokenOverridable { - user_ids: string[]; - mobile_only?: boolean; - web_only?: boolean; -} -// https://api.slack.com/methods/admin.users.session.invalidate -export interface AdminUsersSessionInvalidateArguments extends TokenOverridable { - session_id: string; - team_id: string; -} -// https://api.slack.com/methods/admin.users.session.getSettings -export interface AdminUsersSessionGetSettingsArguments extends TokenOverridable { - user_ids: string[]; -} -// https://api.slack.com/methods/admin.users.session.setSettings -export interface AdminUsersSessionSetSettingsArguments extends TokenOverridable { - user_ids: string[]; - desktop_app_browser_quit?: boolean; - duration?: number; -} -// https://api.slack.com/methods/admin.users.session.clearSettings -export interface AdminUsersSessionClearSettingsArguments extends TokenOverridable { - user_ids: string[]; -} -// https://api.slack.com/methods/admin.users.unsupportedVersions.export -export interface AdminUsersUnsupportedVersionsExportArguments extends TokenOverridable { - date_end_of_support?: number; - date_sessions_started?: number; -} // https://api.slack.com/methods/admin.workflows.collaborators.add export interface AdminWorkflowsCollaboratorsAddArguments extends TokenOverridable { diff --git a/packages/web-api/src/types/request/admin/conversations.ts b/packages/web-api/src/types/request/admin/conversations.ts index 26c949810..40796e908 100644 --- a/packages/web-api/src/types/request/admin/conversations.ts +++ b/packages/web-api/src/types/request/admin/conversations.ts @@ -1,4 +1,4 @@ -import type { ChannelIDs, CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; +import type { ChannelIDs, CursorPaginationEnabled, SortDir, TokenOverridable, UserIDs } from '../common'; interface ChannelID { // an identical interface exists in src/types/request/conversations.ts, but it is only for invites /** @description Encoded channel ID. */ @@ -106,10 +106,7 @@ export interface AdminConversationsGetTeamsArguments extends ChannelID, TokenOverridable, CursorPaginationEnabled {} // https://api.slack.com/methods/admin.conversations.invite -export interface AdminConversationsInviteArguments extends ChannelID, TokenOverridable { - /** @description The users to invite. */ - user_ids: [string, ...string[]]; -} +export interface AdminConversationsInviteArguments extends ChannelID, UserIDs, TokenOverridable {} // https://api.slack.com/methods/admin.conversations.lookup export interface AdminConversationsLookupArguments diff --git a/packages/web-api/src/types/request/admin/roles.ts b/packages/web-api/src/types/request/admin/roles.ts index 20073731a..5b53b7b57 100644 --- a/packages/web-api/src/types/request/admin/roles.ts +++ b/packages/web-api/src/types/request/admin/roles.ts @@ -1,4 +1,4 @@ -import type { CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; +import type { CursorPaginationEnabled, SortDir, TokenOverridable, UserIDs } from '../common'; interface EntityIDs { /** @@ -16,11 +16,6 @@ interface RoleID { role_id: string; } -interface UserIDs { - /** @description List of IDs from the users to be added to/removed from the given role. */ - user_ids: [string, ...string[]]; -} - // https://api.slack.com/methods/admin.roles.addAssignments export interface AdminRolesAddAssignmentsArguments extends EntityIDs, RoleID, UserIDs, TokenOverridable {} diff --git a/packages/web-api/src/types/request/admin/teams.ts b/packages/web-api/src/types/request/admin/teams.ts index 2e10248d1..6cdd3b8b9 100644 --- a/packages/web-api/src/types/request/admin/teams.ts +++ b/packages/web-api/src/types/request/admin/teams.ts @@ -1,9 +1,4 @@ -import type { ChannelIDs, CursorPaginationEnabled, TokenOverridable } from '../common'; - -interface TeamID { - /** @description The encoded team ID to query. */ - team_id: string; -} +import type { ChannelIDs, CursorPaginationEnabled, TeamID, TokenOverridable } from '../common'; type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; diff --git a/packages/web-api/src/types/request/admin/users.ts b/packages/web-api/src/types/request/admin/users.ts new file mode 100644 index 000000000..cc017f6dd --- /dev/null +++ b/packages/web-api/src/types/request/admin/users.ts @@ -0,0 +1,149 @@ +import type { ChannelIDs, CursorPaginationEnabled, OptionalTeamAssignable, TeamID, TokenOverridable, UserIDs } from '../common'; + +interface UserID { + /** @description The ID of the user. */ + user_id: string; +} + +interface IsRestricted { + /** @description Set to `true` if user should be added to the workspace as a guest. */ + is_restricted?: boolean; +} + +interface IsUltraRestricted { + /** @description Set to `true` if user should be added to the workspace as a guest. */ + is_ultra_restricted?: boolean; +} + +interface SessionExpirationTarget { + /** @description Only expire mobile sessions. Defaults to `false`. */ + mobile_only?: boolean; + /** @description Only expire web sessions. Defaults to `false`. */ + web_only?: boolean; +} + +interface TeamIDWithoutDeactivatedWorkspaces extends TeamID { + include_deactivated_user_workspaces?: false; +} +interface DeactivatedWorkspacesWithoutTeamID { + team_id?: never; + /** + * @description Only applies when using an org token and when no `team_id` is provided. If `true`, return workspaces + * for a user even if they may be deactivated on them. If `false`, return workspaces for a user only when user is + * active on them. Default is `false`. + */ + include_deactivated_user_workspaces?: true; +} +// `admin.users.list` accepts either a team_id, or include_deactivated_user_workspaces=true, but not both +type TeamIDOrDeactivatedWorkspaces = TeamIDWithoutDeactivatedWorkspaces | DeactivatedWorkspacesWithoutTeamID; + +interface BothTeamAndUserID extends TeamID, UserID {} +interface NeitherTeamNorUserID { + team_id?: never; + user_id?: never; +} +// `admin.users.session.list` accepts either BOTH team_id+user_id, or neither +type EitherTeamAndUserIDOrNeither = BothTeamAndUserID | NeitherTeamNorUserID; + +// https://api.slack.com/methods/admin.users.assign +export interface AdminUsersAssignArguments extends TeamID, UserID, Partial, IsRestricted, + IsUltraRestricted, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.invite +export interface AdminUsersInviteArguments extends ChannelIDs, TeamID, IsRestricted, IsUltraRestricted, + TokenOverridable { + /** @description The email address of the person to invite. */ + email: string; + /** @description An optional message to send to the user in the invite email. */ + custom_message?: string; + /** + * @description Allow invited user to sign in via email and password. Only available for Enterprise Grid teams via + * admin invite. + */ + email_password_policy_enabled?: boolean; + /** + * @description Timestamp when guest account should be disabled. Only include this timestamp if you are inviting a + * guest user and you want their account to expire on a certain date. + */ + guest_expiration_ts?: string; + /** @description Full name of the user. */ + real_name?: string; + /** + * @description Allow this invite to be resent in the future if a user has not signed up yet. + * Resending can only be done via the UI and has no expiration. Defaults to `false`. + */ + resend?: boolean; +} + +// https://api.slack.com/methods/admin.users.list +export type AdminUsersListArguments = TeamIDOrDeactivatedWorkspaces & TokenOverridable & CursorPaginationEnabled & { + /** + * @description If `true`, only active users will be returned. If `false`, only deactivated users will be returned. + * Default is `true`. + */ + is_active?: boolean; +}; + +// https://api.slack.com/methods/admin.users.remove +export interface AdminUsersRemoveArguments extends TeamID, UserID, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.session.clearSettings +export interface AdminUsersSessionClearSettingsArguments extends UserIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.session.getSettings +export interface AdminUsersSessionGetSettingsArguments extends UserIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.session.invalidate +export interface AdminUsersSessionInvalidateArguments extends TeamID, TokenOverridable { + /** @description ID of the session to invalidate. */ + session_id: string; +} + +// https://api.slack.com/methods/admin.users.session.list +export type AdminUsersSessionListArguments = EitherTeamAndUserIDOrNeither & TokenOverridable & CursorPaginationEnabled; + +// https://api.slack.com/methods/admin.users.session.reset +export interface AdminUsersSessionResetArguments extends UserID, SessionExpirationTarget, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.session.resetBulk +export interface AdminUsersSessionResetBulkArguments extends UserIDs, SessionExpirationTarget, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.session.setSettings +export interface AdminUsersSessionSetSettingsArguments extends UserIDs, TokenOverridable { + /** @description Terminate the session when the client—either the desktop app or a browser window—is closed. */ + desktop_app_browser_quit?: boolean; + /** + * @description The session duration in seconds. The minimum value is 28800, which represents 8 hours; + * the max value is 315569520 or 10 years (that's a long Slack session). + */ + duration?: number; +} + +// https://api.slack.com/methods/admin.users.setAdmin +export interface AdminUsersSetAdminArguments extends TeamID, UserID, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.setExpiration +export interface AdminUsersSetExpirationArguments extends UserID, TokenOverridable, OptionalTeamAssignable { + /** @description Epoch timestamp in seconds when guest account should be disabled. */ + expiration_ts: number; +} + +// https://api.slack.com/methods/admin.users.setOwner +export interface AdminUsersSetOwnerArguments extends TeamID, UserID, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.setRegular +export interface AdminUsersSetRegularArguments extends TeamID, UserID, TokenOverridable {} + +// https://api.slack.com/methods/admin.users.unsupportedVersions.export +export interface AdminUsersUnsupportedVersionsExportArguments extends TokenOverridable { + /** + * @description Unix timestamp of the date of past or upcoming end of support cycles. + * If not provided will include all announced end of support cycles. Defaults to `0`. + */ + date_end_of_support?: number; + /** + * @description Unix timestamp of a date to start looking for user sessions. + * If not provided will start six months ago. + */ + date_sessions_started?: number; +} diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 425469dd3..904e2383e 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -52,13 +52,33 @@ export interface LocaleAware { } /** - * Some API methods optionally require a `team_id` if an org token is used. + * Some API methods take a `team_id` - different interfaces here so that we can provide a different JSDoc. */ + +export interface TeamID { + /** @description The encoded team ID. */ + team_id: string; +} + export interface OptionalTeamAssignable { /** @description If using an org token, `team_id` is required. */ team_id?: string; } +// Some APIs (admin.teams.settings.setDefaultChannels, admin.conversations.*) require a minimum-1-item channel array + +export interface ChannelIDs { + /** @description An array of channel IDs (must include at least one ID). */ + channel_ids: [string, ...string[]]; +} + +// Same for user IDs + +export interface UserIDs { + /** @description List of encoded user IDs. */ + user_ids: [string, ...string[]]; +} + /** * Some API methods use arguments for specifying a message, file or file comment. * E.g. `stars.*` and `reactions.*` @@ -111,10 +131,3 @@ export interface OAuthGrantRefresh { /** @description The `refresh_token` param as described in the OAuth spec. */ refresh_token?: string; } - -// Some APIs (admin.teams.settings.setDefaultChannels, admin.conversations.*) require a minimum-1-item channel array - -export interface ChannelIDs { - /** @description An array of channel IDs (must include at least one ID). */ - channel_ids: [string, ...string[]]; -} diff --git a/packages/web-api/test/types/methods/admin.users.test-d.ts b/packages/web-api/test/types/methods/admin.users.test-d.ts new file mode 100644 index 000000000..5c1ef1b43 --- /dev/null +++ b/packages/web-api/test/types/methods/admin.users.test-d.ts @@ -0,0 +1,264 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.users.assign +// -- sad path +expectError(web.admin.users.assign()); // lacking argument +expectError(web.admin.users.assign({})); // empty argument +expectError(web.admin.users.assign({ + team_id: 'T1234', // missing user_id +})); +expectError(web.admin.users.assign({ + user_id: 'U1234', // missing team_id +})); +expectError(web.admin.users.assign({ + user_id: 'U1234', + team_id: 'T1234', + channel_ids: [], // requires at least 1 channel +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', +}]); + +// admin.users.invite +// -- sad path +expectError(web.admin.users.invite()); // lacking argument +expectError(web.admin.users.invite({})); // empty argument +expectError(web.admin.users.invite({ + team_id: 'T1234', // missing channel_ids, email +})); +expectError(web.admin.users.invite({ + channel_ids: ['C1234'], // missing team_id, email +})); +expectError(web.admin.users.invite({ + email: 'me@you.com', // missing channel_ids, team_id +})); +expectError(web.admin.users.invite({ + email: 'me@you.com', + team_id: 'T1234', // missing channel_ids +})); +expectError(web.admin.users.invite({ + email: 'me@you.com', + channel_ids: ['C1234'], // missing team_id +})); +expectError(web.admin.users.invite({ + team_id: 'T1234', + channel_ids: ['C1234'], // missing email +})); +expectError(web.admin.users.invite({ + team_id: 'T1234', + channel_ids: [], // requires at least 1 channel +})); +expectError(web.admin.users.invite({ + email: 'me@you.com', + team_id: 'T1234', + channel_ids: [], // required at least 1 channel +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + email: 'me@you.com', + channel_ids: ['C1234'], +}]); + +// admin.users.list +// -- sad path +expectError(web.admin.users.list()); // lacking argument +expectError(web.admin.users.list({ + team_id: 'T1234', + include_deactivated_user_workspaces: true, // cannot set both team_id and include_deactivated=true +})); +expectError(web.admin.users.list({ + user_id: 'U1234', // missing team_id +})); +// -- happy path +expectAssignable>([{}]); // all optional args is ok +expectAssignable>([{ + team_id: 'T1234', + include_deactivated_user_workspaces: false, // team_id and include_deactivated=false is ok +}]); +expectAssignable>([{ + team_id: 'T1234', // team_id and undefined include_deactivated is ok +}]); +expectAssignable>([{ + include_deactivated_user_workspaces: true, // team_id and=undefined and include_deactivated is ok +}]); + +// admin.users.remove +// -- sad path +expectError(web.admin.users.remove()); // lacking argument +expectError(web.admin.users.remove({})); // empty argument +expectError(web.admin.users.remove({ + team_id: 'T1234', // missing user_id +})); +expectError(web.admin.users.remove({ + user_id: 'U1234', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', +}]); + +// admin.users.session.clearSettings +// -- sad path +expectError(web.admin.users.session.clearSettings()); // lacking argument +expectError(web.admin.users.session.clearSettings({})); // empty argument +expectError(web.admin.users.session.clearSettings({ + user_ids: [], +})); // must provide at least one user_id +// -- happy path +expectAssignable>([{ + user_ids: ['U1234'], +}]); + +// admin.users.session.getSettings +// -- sad path +expectError(web.admin.users.session.getSettings()); // lacking argument +expectError(web.admin.users.session.getSettings({})); // empty argument +expectError(web.admin.users.session.getSettings({ + user_ids: [], +})); // must provide at least one user_id +// -- happy path +expectAssignable>([{ + user_ids: ['U1234'], +}]); + +// admin.users.session.invalidate +// -- sad path +expectError(web.admin.users.session.invalidate()); // lacking argument +expectError(web.admin.users.session.invalidate({})); // empty argument +expectError(web.admin.users.session.invalidate({ + team_id: 'T1234', // missing session_id +})); +expectError(web.admin.users.session.invalidate({ + session_id: '1234', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + session_id: '1234', +}]); + +// admin.users.session.list +// -- sad path +expectError(web.admin.users.session.list()); // lacking argument +expectError(web.admin.users.session.list({ + team_id: 'T1234', // if team_id is provided, must also provide user_id +})); +expectError(web.admin.users.session.list({ + user_id: 'T1234', // if user_id is provided, must also provide team_id +})); +// -- happy path +expectAssignable>([{}]); // all optional args is OK +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', // also providing both team and user id - but has to be both +}]); + +// admin.users.session.reset +// -- sad path +expectError(web.admin.users.session.reset()); // lacking argument +expectError(web.admin.users.session.reset({})); // empty argument +// -- happy path +expectAssignable>([{ + user_id: 'U1234', +}]); + +// admin.users.session.resetBulk +// -- sad path +expectError(web.admin.users.session.resetBulk()); // lacking argument +expectError(web.admin.users.session.resetBulk({})); // empty argument +expectError(web.admin.users.session.resetBulk({ + user_ids: [], +})); // must provide at least one user_id +// -- happy path +expectAssignable>([{ + user_ids: ['U1234'], +}]); + +// admin.users.session.setSettings +// -- sad path +expectError(web.admin.users.session.setSettings()); // lacking argument +expectError(web.admin.users.session.setSettings({})); // empty argument +expectError(web.admin.users.session.setSettings({ + user_ids: [], +})); // must provide at least one user_id +// -- happy path +expectAssignable>([{ + user_ids: ['U1234'], +}]); + +// admin.users.session.setAdmin +// -- sad path +expectError(web.admin.users.setAdmin()); // lacking argument +expectError(web.admin.users.setAdmin({})); // empty argument +expectError(web.admin.users.setAdmin({ + team_id: 'T1234', // missing user_id +})); +expectError(web.admin.users.setAdmin({ + user_id: 'T1234', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', +}]); + +// admin.users.session.setExpiration +// -- sad path +expectError(web.admin.users.setExpiration()); // lacking argument +expectError(web.admin.users.setExpiration({})); // empty argument +expectError(web.admin.users.setExpiration({ + expiration_ts: 1234, // missing user_id +})); +expectError(web.admin.users.setExpiration({ + user_id: 'T1234', // missing expiration_ts +})); +// -- happy path +expectAssignable>([{ + user_id: 'U1234', + expiration_ts: 1234, +}]); + +// admin.users.session.setOwner +// -- sad path +expectError(web.admin.users.setOwner()); // lacking argument +expectError(web.admin.users.setOwner({})); // empty argument +expectError(web.admin.users.setOwner({ + team_id: 'T1234', // missing user_id +})); +expectError(web.admin.users.setOwner({ + user_id: 'T1234', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', +}]); + +// admin.users.session.setRegular +// -- sad path +expectError(web.admin.users.setRegular()); // lacking argument +expectError(web.admin.users.setRegular({})); // empty argument +expectError(web.admin.users.setRegular({ + team_id: 'T1234', // missing user_id +})); +expectError(web.admin.users.setRegular({ + user_id: 'T1234', // missing team_id +})); +// -- happy path +expectAssignable>([{ + team_id: 'T1234', + user_id: 'U1234', +}]); + +// admin.users.session.unsupportedVersions.export +// -- sad path +expectError(web.admin.users.unsupportedVersions.export()); // lacking argument +// -- happy path +expectAssignable>([{}]); // all optional args OK From a193b6eeb0de21717902e411a07f002fb7676832 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 12 Dec 2023 14:55:43 -0500 Subject: [PATCH 118/122] Refactor arguments and type tests for admin.workflows.* APIs. --- packages/web-api/src/methods.ts | 59 +++++-------- .../web-api/src/types/request/admin/apps.ts | 6 +- .../src/types/request/admin/workflows.ts | 44 ++++++++++ packages/web-api/src/types/request/apps.ts | 16 ++-- packages/web-api/src/types/request/common.ts | 5 ++ packages/web-api/src/types/request/team.ts | 6 +- .../types/methods/admin.workflows.test-d.ts | 84 +++++++++++++++++++ 7 files changed, 164 insertions(+), 56 deletions(-) create mode 100644 packages/web-api/src/types/request/admin/workflows.ts create mode 100644 packages/web-api/test/types/methods/admin.workflows.test-d.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 4770e3263..c40f0b032 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -238,7 +238,6 @@ import type { AdminAppsConfigSetResponse, } from './types/response'; // Request types -import type { TokenOverridable, CursorPaginationEnabled } from './types/request/common'; import type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './types/request/workflows'; import type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './types/request/views'; import type { UsersConversationsArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './types/request/users'; @@ -279,6 +278,7 @@ import type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArgume import type { AdminTeamsAdminsListArguments, AdminTeamsCreateArguments, AdminTeamsListArguments, AdminTeamsOwnersListArguments, AdminTeamsSettingsInfoArguments, AdminTeamsSettingsSetDefaultChannelsArguments, AdminTeamsSettingsSetDescriptionArguments, AdminTeamsSettingsSetDiscoverabilityArguments, AdminTeamsSettingsSetIconArguments, AdminTeamsSettingsSetNameArguments } from './types/request/admin/teams'; import type { AdminUsergroupsAddChannelsArguments, AdminUsergroupsAddTeamsArguments, AdminUsergroupsListChannelsArguments, AdminUsergroupsRemoveChannelsArguments } from './types/request/admin/usergroups'; import type { AdminUsersAssignArguments, AdminUsersInviteArguments, AdminUsersListArguments, AdminUsersRemoveArguments, AdminUsersSessionListArguments, AdminUsersSessionClearSettingsArguments, AdminUsersSessionGetSettingsArguments, AdminUsersSessionInvalidateArguments, AdminUsersSessionResetArguments, AdminUsersSessionResetBulkArguments, AdminUsersSessionSetSettingsArguments, AdminUsersSetAdminArguments, AdminUsersSetExpirationArguments, AdminUsersSetOwnerArguments, AdminUsersSetRegularArguments, AdminUsersUnsupportedVersionsExportArguments } from './types/request/admin/users'; +import type { AdminWorkflowsCollaboratorsAddArguments, AdminWorkflowsCollaboratorsRemoveArguments, AdminWorkflowsPermissionsLookupArguments, AdminWorkflowsSearchArguments, AdminWorkflowsUnpublishArguments } from './types/request/admin/workflows'; /** * Generic method definition @@ -968,15 +968,35 @@ export abstract class Methods extends EventEmitter { }, }, workflows: { - search: bindApiCall(this, 'admin.workflows.search'), - unpublish: bindApiCall(this, 'admin.workflows.unpublish'), collaborators: { + /** + * @description Add collaborators to workflows within the team or enterprise. + * @see {@link https://api.slack.com/methods/admin.workflows.collaborators.add `admin.workflows.collaborators.add` API reference}. + */ add: bindApiCall(this, 'admin.workflows.collaborators.add'), + /** + * @description Remove collaborators from workflows within the team or enterprise. + * @see {@link https://api.slack.com/methods/admin.workflows.collaborators.remove `admin.workflows.collaborators.remove` API reference}. + */ remove: bindApiCall(this, 'admin.workflows.collaborators.remove'), }, permissions: { + /** + * @description Look up the permissions for a set of workflows. + * @see {@link https://api.slack.com/methods/admin.workflows.permissions.lookup `admin.workflows.permissions.lookup` API reference}. + */ lookup: bindApiCall(this, 'admin.workflows.permissions.lookup'), }, + /** + * @description Search workflows within the team or enterprise. + * @see {@link https://api.slack.com/methods/admin.workflows.search `admin.workflows.search` API reference}. + */ + search: bindApiCall(this, 'admin.workflows.search'), + /** + * @description Unpublish workflows within the team or enterprise. + * @see {@link https://api.slack.com/methods/admin.workflows.unpublish `admin.workflows.unpublish` API reference}. + */ + unpublish: bindApiCall(this, 'admin.workflows.unpublish'), }, }; @@ -1881,38 +1901,5 @@ export abstract class Methods extends EventEmitter { updateStep: bindApiCall(this, 'workflows.updateStep'), }; } -// https://api.slack.com/methods/admin.workflows.collaborators.add -export interface AdminWorkflowsCollaboratorsAddArguments - extends TokenOverridable { - collaborator_ids: string[]; - workflow_ids: string[]; -} -// https://api.slack.com/methods/admin.workflows.collaborators.remove -export interface AdminWorkflowsCollaboratorsRemoveArguments - extends TokenOverridable { - collaborator_ids: string[]; - workflow_ids: string[]; -} -// https://api.slack.com/methods/admin.workflows.permissions.lookup -export interface AdminWorkflowsPermissionsLookupArguments - extends TokenOverridable { - workflow_ids: string[]; - max_workflow_triggers?: number; -} -// https://api.slack.com/methods/admin.workflows.search -export interface AdminWorkflowsSearchArguments extends TokenOverridable, CursorPaginationEnabled { - app_id?: string; - collaborator_ids?: string[]; - no_collaborators?: boolean; - num_trigger_ids?: number; - query?: string; - sort?: string; - sort_dir?: 'asc' | 'desc'; - source?: 'code' | 'workflow_builder'; -} -// https://api.slack.com/methods/admin.workflows.unpublish -export interface AdminWorkflowsUnpublishArguments extends TokenOverridable { - workflow_ids: string[]; -} export * from '@slack/types'; diff --git a/packages/web-api/src/types/request/admin/apps.ts b/packages/web-api/src/types/request/admin/apps.ts index 1795e3987..c8ca8dc59 100644 --- a/packages/web-api/src/types/request/admin/apps.ts +++ b/packages/web-api/src/types/request/admin/apps.ts @@ -1,9 +1,5 @@ -import type { CursorPaginationEnabled, TokenOverridable } from '../common'; +import type { AppID, CursorPaginationEnabled, TokenOverridable } from '../common'; -interface AppID { - /** @description The ID of the app. */ - app_id: string; -} interface RequestID { /** @description The id of the request. */ request_id: string; diff --git a/packages/web-api/src/types/request/admin/workflows.ts b/packages/web-api/src/types/request/admin/workflows.ts new file mode 100644 index 000000000..c7cabb9c4 --- /dev/null +++ b/packages/web-api/src/types/request/admin/workflows.ts @@ -0,0 +1,44 @@ +import type { AppID, CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; + +interface CollaboratorIDs { + /** @description Array of collaborators (encoded user IDs) - maximum of 50 items. */ + collaborator_ids: [string, ...string[]]; +} + +interface WorkflowIDs { + /** @description Array of workflow IDs - maximum of 50 items. */ + workflow_ids: [string, ...string[]]; +} + +// https://api.slack.com/methods/admin.workflows.collaborators.add +export interface AdminWorkflowsCollaboratorsAddArguments extends CollaboratorIDs, WorkflowIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.workflows.collaborators.remove +export interface AdminWorkflowsCollaboratorsRemoveArguments extends CollaboratorIDs, WorkflowIDs, TokenOverridable {} + +// https://api.slack.com/methods/admin.workflows.permissions.lookup +export interface AdminWorkflowsPermissionsLookupArguments extends WorkflowIDs, TokenOverridable { + /** + * @description Maximum number of triggers to fetch for each workflow when determining overall run permissions. + * Defaults to `100`. Maximum of `1000`. + */ + max_workflow_triggers?: number; +} + +// https://api.slack.com/methods/admin.workflows.search +export interface AdminWorkflowsSearchArguments extends Partial, Partial, SortDir, + TokenOverridable, CursorPaginationEnabled { + /** @description Only include workflows with no collaborators in the result; default is `false`. */ + no_collaborators?: boolean; + /** @description Number of trigger IDs to fetch for each workflow; default is `0`. */ + num_trigger_ids?: number; + /** @description A search query to filter for workflow name or description. */ + query?: string; + /** @description The field used to sort the returned workflows. Currently only `premium_runs` is supported. */ + sort?: 'premium_runs'; + /** @description Source of workflow creation, either from `code` or `workflow_builder`. */ + source?: 'code' | 'workflow_builder'; +} + +// https://api.slack.com/methods/admin.workflows.unpublish +export interface AdminWorkflowsUnpublishArguments extends WorkflowIDs, TokenOverridable {} diff --git a/packages/web-api/src/types/request/apps.ts b/packages/web-api/src/types/request/apps.ts index 6d2370c3e..9da00378d 100644 --- a/packages/web-api/src/types/request/apps.ts +++ b/packages/web-api/src/types/request/apps.ts @@ -1,4 +1,4 @@ -import type { CursorPaginationEnabled, TokenOverridable, OAuthCredentials } from './common'; +import type { AppID, CursorPaginationEnabled, TokenOverridable, OAuthCredentials } from './common'; // https://api.slack.com/methods/apps.connections.open // eslint-disable-next-line @typescript-eslint/no-empty-interface @@ -21,24 +21,18 @@ export interface AppsManifestCreateArguments extends TokenOverridable { } // https://api.slack.com/methods/apps.manifest.delete -export interface AppsManifestDeleteArguments extends TokenOverridable { - app_id: string; -} +export interface AppsManifestDeleteArguments extends AppID, TokenOverridable {} // https://api.slack.com/methods/apps.manifest.export -export interface AppsManifestExportArguments extends TokenOverridable { - app_id: string; -} +export interface AppsManifestExportArguments extends AppID, TokenOverridable {} // https://api.slack.com/methods/apps.manifest.update -export interface AppsManifestUpdateArguments extends TokenOverridable { - app_id: string; +export interface AppsManifestUpdateArguments extends AppID, TokenOverridable { manifest: string; } // https://api.slack.com/methods/apps.manifest.validate -export interface AppsManifestValidateArguments extends TokenOverridable { - app_id?: string; +export interface AppsManifestValidateArguments extends Partial, TokenOverridable { manifest: string; } diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 904e2383e..7ba67762c 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -79,6 +79,11 @@ export interface UserIDs { user_ids: [string, ...string[]]; } +export interface AppID { + /** @description The ID of the app. */ + app_id: string; +} + /** * Some API methods use arguments for specifying a message, file or file comment. * E.g. `stars.*` and `reactions.*` diff --git a/packages/web-api/src/types/request/team.ts b/packages/web-api/src/types/request/team.ts index 2869b654f..b2c9038cd 100644 --- a/packages/web-api/src/types/request/team.ts +++ b/packages/web-api/src/types/request/team.ts @@ -1,4 +1,4 @@ -import { OptionalTeamAssignable, TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled } from './common'; +import { AppID, OptionalTeamAssignable, TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled } from './common'; // https://api.slack.com/methods/team.accessLogs export interface TeamAccessLogsArguments extends TokenOverridable, CursorPaginationEnabled, @@ -28,10 +28,8 @@ export interface TeamInfoArguments extends TokenOverridable { team?: string; } // https://api.slack.com/methods/team.integrationLogs -export interface TeamIntegrationLogsArguments extends TokenOverridable, +export interface TeamIntegrationLogsArguments extends Partial, TokenOverridable, OptionalTeamAssignable, TraditionalPagingEnabled { - /** @description Filter logs to this Slack app. Defaults to all logs. */ - app_id?: string; /** @description Filter logs with this change type. Defaults to all logs. */ change_type?: 'added' | 'removed' | 'enabled' | 'disabled' | 'updated'; /** @description Filter logs to this service. Defaults to all logs. */ diff --git a/packages/web-api/test/types/methods/admin.workflows.test-d.ts b/packages/web-api/test/types/methods/admin.workflows.test-d.ts new file mode 100644 index 000000000..1947d925e --- /dev/null +++ b/packages/web-api/test/types/methods/admin.workflows.test-d.ts @@ -0,0 +1,84 @@ +import { expectAssignable, expectError } from 'tsd'; +import { WebClient } from '../../../src/WebClient'; + +const web = new WebClient('TOKEN'); + +// admin.workflows.collaborators.add +// -- sad path +expectError(web.admin.workflows.collaborators.add()); // lacking argument +expectError(web.admin.workflows.collaborators.add({})); // empty argument +expectError(web.admin.workflows.collaborators.add({ + collaborator_ids: ['U1234'], // missing workflow_ids +})); +expectError(web.admin.workflows.collaborators.add({ + workflow_ids: ['Wf1234'], // missing user_ids +})); +expectError(web.admin.workflows.collaborators.add({ + collaborator_ids: ['U1234'], + workflow_ids: [], // must provide at least 1 id +})); +expectError(web.admin.workflows.collaborators.add({ + workflow_ids: ['Wf1234'], + collaborator_ids: [], // must provide at least 1 id +})); +// -- happy path +expectAssignable>([{ + collaborator_ids: ['U1234'], + workflow_ids: ['Wf1234'], +}]); + +// admin.workflows.collaborators.remove +// -- sad path +expectError(web.admin.workflows.collaborators.remove()); // lacking argument +expectError(web.admin.workflows.collaborators.remove({})); // empty argument +expectError(web.admin.workflows.collaborators.remove({ + collaborator_ids: ['U1234'], // missing workflow_ids +})); +expectError(web.admin.workflows.collaborators.remove({ + workflow_ids: ['Wf1234'], // missing user_ids +})); +expectError(web.admin.workflows.collaborators.remove({ + collaborator_ids: ['U1234'], + workflow_ids: [], // must provide at least 1 id +})); +expectError(web.admin.workflows.collaborators.remove({ + workflow_ids: ['Wf1234'], + collaborator_ids: [], // must provide at least 1 id +})); +// -- happy path +expectAssignable>([{ + collaborator_ids: ['U1234'], + workflow_ids: ['Wf1234'], +}]); + +// admin.workflows.permissions.lookup +// -- sad path +expectError(web.admin.workflows.permissions.lookup()); // lacking argument +expectError(web.admin.workflows.permissions.lookup({})); // empty argument +expectError(web.admin.workflows.permissions.lookup({ + workflow_ids: [], // must provide at least 1 id +})); +// -- happy path +expectAssignable>([{ + workflow_ids: ['Wf1234'], +}]); + +// admin.workflows.search +// -- sad path +expectError(web.admin.workflows.search()); // lacking argument +expectError(web.admin.workflows.search({ + collaborator_ids: [], // must provide at least 1 ID +})); +// -- happy path +expectAssignable>([{}]); // all optional args OK + +// admin.workflows.unpublish +// -- sad path +expectError(web.admin.workflows.unpublish()); // lacking argument +expectError(web.admin.workflows.unpublish({ + workflow_ids: [], // must provide at least 1 ID +})); +// -- happy path +expectAssignable>([{ + workflow_ids: ['Wf1234'], +}]); From f01e0e64a34ce6ed5a21c12c1691e9aaf5430742 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 13 Dec 2023 15:21:30 -0500 Subject: [PATCH 119/122] Refactor arguments and type tests for apps.manifest.* APIs. Add first pass at typing the manifest. --- packages/web-api/src/types/request/apps.ts | 13 +- .../web-api/src/types/request/manifest.ts | 547 ++++++++++++++++++ .../web-api/test/types/methods/apps.test-d.ts | 68 +++ 3 files changed, 619 insertions(+), 9 deletions(-) create mode 100644 packages/web-api/src/types/request/manifest.ts diff --git a/packages/web-api/src/types/request/apps.ts b/packages/web-api/src/types/request/apps.ts index 9da00378d..2e8d80a55 100644 --- a/packages/web-api/src/types/request/apps.ts +++ b/packages/web-api/src/types/request/apps.ts @@ -1,7 +1,7 @@ import type { AppID, CursorPaginationEnabled, TokenOverridable, OAuthCredentials } from './common'; +import type { Manifest } from './manifest'; // https://api.slack.com/methods/apps.connections.open -// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface AppsConnectionsOpenArguments { } // https://api.slack.com/methods/apps.event.authorizations.list @@ -10,14 +10,9 @@ export interface AppsEventAuthorizationsListArguments event_context: string; } -// TODO:determine how to type the `manifest` field: string? actual interface? -// some prior art we can borrow/steal from: -// - https://github.com/seratch/slack-web-api-client/blob/main/src/manifest/manifest-params.ts -// - https://github.com/slackapi/deno-slack-sdk/blob/main/src/manifest/manifest_schema.ts#L14 -// TODO:should also link to https://api.slack.com/reference/manifests#fields throughout // https://api.slack.com/methods/apps.manifest.create export interface AppsManifestCreateArguments extends TokenOverridable { - manifest: string; + manifest: Manifest; } // https://api.slack.com/methods/apps.manifest.delete @@ -28,12 +23,12 @@ export interface AppsManifestExportArguments extends AppID, TokenOverridable {} // https://api.slack.com/methods/apps.manifest.update export interface AppsManifestUpdateArguments extends AppID, TokenOverridable { - manifest: string; + manifest: Manifest; } // https://api.slack.com/methods/apps.manifest.validate export interface AppsManifestValidateArguments extends Partial, TokenOverridable { - manifest: string; + manifest: Manifest; } // https://api.slack.com/methods/apps.uninstall diff --git a/packages/web-api/src/types/request/manifest.ts b/packages/web-api/src/types/request/manifest.ts new file mode 100644 index 000000000..abae3f15e --- /dev/null +++ b/packages/web-api/src/types/request/manifest.ts @@ -0,0 +1,547 @@ +export interface Manifest extends Record { + /** @description A group of settings that describe the manifest. */ + _metadata?: ManifestMetadata; // eslint-disable-line @typescript-eslint/naming-convention + /** + * @description A group of settings that describe parts of an app's appearance within Slack. If you're distributing + * the app via the App Directory, read our {@link https://api.slack.com/start/distributing/guidelines#listing listing guidelines} to pick the best values for these settings. + */ + display_information: ManifestDisplayInformation; + /** @description A group of settings corresponding to the Features section of the app config pages. */ + features?: ManifestFeatures; + /** @description A group of settings describing OAuth configuration for the app. */ + oauth_config?: ManifestOAuthConfig; + /** @description A group of settings corresponding to the Settings section of the app config pages. */ + settings?: ManifestSettings; + /** @description A group of settings corresponding to Custom Functions bundled in your application. */ + functions?: Record; + // TODO: future additions: external_auth_providers, workflows +} + +interface ManifestMetadata { + /** + * @description An integer that specifies the major version of the manifest schema to target. + * Only `1` and `2` are supported. Defaults to `1`. + */ + major_version?: number; + /** @description An integer that specifies the minor version of the manifest schema to target. */ + minor_version?: number; +} + +interface ManifestDisplayInformation { + /** @description A string of the name of the app. Maximum length is 35 characters. */ + name: string; + /** + * @description A string with a short description of the app for display to users. Maximum length is 140 characters. + */ + description?: string; + /** @description A string with a longer version of the description of the app. Maximum length is 4000 characters. */ + long_description?: string; + /** + * @description A string containing a hex color value (including the hex sign) that specifies the background color + * used on hovercards that display information about your app. Can be 3-digit (`#000`) or 6-digit (`#000000`) hex + * values. Once an app has set a background color value, it cannot be removed, only updated. + */ + background_color?: string; +} + +interface ManifestFeatures { + /** + * @description A subgroup of settings that describe {@link https://api.slack.com/surfaces/app-home App Home} configuration. + * @see {@link https://api.slack.com/surfaces/app-home App Home}. + */ + app_home?: ManifestAppHome; + /** + * @description A subgroup of settings that describe {@link https://api.slack.com/legacy/enabling-bot-users bot user} configuration. + * @see {@link https://api.slack.com/legacy/enabling-bot-users Legacy bots}. + */ + bot_user?: ManifestBotUser; + /** + * @description An array of settings groups that describe {@link https://api.slack.com/interactivity/shortcuts shortcuts} + * configuration. A maximum of 10 shortcuts can be included in this array. + * @see {@link https://api.slack.com/interactivity/shortcuts Shortcuts}. + */ + shortcuts?: ManifestShortcut[]; + /** + * @description An array of settings groups that describe {@link https://api.slack.com/interactivity/slash-commands slash commands} + * configuration. A maximum of 50 slash commands can be included in this array. + * @see {@link https://api.slack.com/interactivity/slash-commands Slash Commands}. + */ + slash_commands?: ManifestSlashCommand[]; + /** + * @description An array of strings containing valid unfurl domains to register. A maximum of 5 unfurl domains can be + * included in this array. + * @see {@link https://api.slack.com/reference/messaging/link-unfurling#configuring_domains Link unfurling: configuring domains}. + */ + unfurl_domains?: string[]; +} + +interface ManifestAppHome { + /** + * @description A boolean that specifies whether or not the {@link https://api.slack.com/surfaces/app-home#home-tab Home tab} is enabled. + * @see {@link https://api.slack.com/surfaces/app-home#home-tab Home tab}. + */ + home_tab_enabled?: boolean; + /** + * @description A boolean that specifies whether or not the Messages tab in your App Home is enabled. + * @see {@link https://api.slack.com/surfaces/app-home#messages-tab Message tab}. + */ + messages_tab_enabled?: boolean; + /** + * @description A boolean that specifies whether or not the users can send messages to your app in the + * {@link https://api.slack.com/surfaces/app-home#messages-tab Messages tab} + * of your App Home. + * @see {@link https://api.slack.com/surfaces/app-home#messages-tab Messages tab}. + */ + messages_tab_read_only_enabled?: boolean; +} + +interface ManifestBotUser { + /** + * @description A string containing the display name of the bot user. Maximum length is 80 characters. + * Allowed characters: `a-z`, `0-9`, `-`, `_`, and `.`. + */ + display_name: string; + /** @description A boolean that specifies whether or not the bot user will always appear to be online. */ + always_online?: boolean; +} + +interface ManifestShortcut { + /** @description Specifies which {@link https://api.slack.com/interactivity/shortcuts#shortcut-types type of shortcut} is being described. */ + type: 'global' | 'message'; + /** @description A string containing the name of the shortcut. */ + name: string; + /** @description A string containing the callback_id of this shortcut. Maximum length is 255 characters. */ + callback_id: string; + /** @description A string containing a short description of this shortcut. Maximum length is 150 characters. */ + description: string; +} + +interface ManifestSlashCommand { + /** + * @description A string containing the actual slash command. Maximum length is 32 characters, and should include + * the leading `/` character. + */ + command: string; + /** + * @description A string containing a description of the slash command that will be displayed to users. + * Maximum length is 2000 characters. + */ + description: string; + /** + * @description A boolean that specifies whether or not channels, users, and links typed with + * the slash command should be escaped. Defaults to `false`. + */ + should_escape?: boolean; + /** + * @description A string containing the full `https` URL that acts as the + * {@link https://api.slack.com/interactivity/slash-commands#creating_commands slash command's request URL}. + */ + url?: string; // can be absent when enabling Socket Mode + /** @description A string a short usage hint about the slash command for users. Maximum length is 1000 characters. */ + usage_hint?: string; +} + +interface ManifestOAuthConfig { + /** + * @description An array of strings containing {@link https://api.slack.com/authentication/oauth-v2#asking OAuth redirect URLs}. + * A maximum of 1000 redirect URLs can be included in this array. + */ + redirect_urls?: string[]; + /** @description A subgroup of settings that describe {@link https://api.slack.com/scopes permission scopes} configuration. */ + scopes?: ManifestOAuthScopes; + token_management_enabled?: boolean; +} + +interface ManifestOAuthScopes { + /** + * @description An array of strings containing {@link https://api.slack.com/scopes?filter=granular_bot granular bot scopes} + * to request upon app installation. A maximum of 255 scopes can included in this array. + */ + bot?: BotScope[]; + /** + * @description An array of strings containing {@link https://api.slack.com/scopes?filter=user user scopes} + * to request upon app installation. A maximum of 255 scopes can included in this array. + */ + user?: UserScope[]; +} + +interface ManifestSettings { + /** + * @description An array of strings that contain IP addresses that conform to the + * {@link https://api.slack.com/authentication/best-practices#ip_allowlisting Allowed IP Ranges} feature. Maximum of 50 IP addresses. + */ + allowed_ip_address_ranges?: string[]; + /** @description A subgroup of settings that describe {@link https://api.slack.com/apis/connections/events-api Events API} configuration for the app. */ + event_subscriptions?: ManifestEventSubscriptions; + /** @description A subgroup of settings that describe {@link https://api.slack.com/messaging/webhooks Incoming Webhooks} configuration for the app. */ + incoming_webhooks?: ManifestIncomingWebhooks; + /** @description A subgroup of settings that describe {@link https://api.slack.com/interactivity interactivity} configuration for the app. */ + interactivity?: ManifestInteractivity; + /** @description A boolean that specifies whether or not {@link https://api.slack.com/enterprise/apps organization-wide deployment} is enabled. */ + org_deploy_enabled?: boolean; + /** @description A boolean that specifies whether or not {@link https://api.slack.com/apis/connections/socket Socket Mode} is enabled. */ + socket_mode_enabled?: boolean; + /** @description A boolean that specifies whether or not {@link https://api.slack.com/authentication/rotation token rotation} is enabled. */ + token_rotation_enabled?: boolean; + function_runtime?: string; +} + +interface ManifestEventSubscriptions { + /** + * @description An array of strings matching the event types you want to the app to subscribe to. + * A maximum of 100 event types can be used. + * @see {@link https://api.slack.com/events Event types}. + */ + bot_events?: ManifestEvent[]; + /** + * @description An array of strings matching the event types you want to the app to subscribe to on + * behalf of authorized users. A maximum of 100 event types can be used. + * @see {@link https://api.slack.com/events Event types}. + */ + user_events?: ManifestEvent[]; + /** + * @description A string containing the full `https` URL that acts as the + * {@link https://api.slack.com/apis/connections/events-api#request-urls Events API request URL}. + * If set, you'll need to manually verify the Request URL in the App Manifest section of App Management. + */ + request_url?: string; // can be absent when enabling Socket Mode +} + +interface ManifestIncomingWebhooks { + /** @description Whether to {@link https://api.slack.com/messaging/webhooks#enable_webhooks enable Incoming Webhooks} for your application or not. */ + incoming_webhooks_enabled?: boolean; +} + +interface ManifestInteractivity { + /** @description A boolean that specifies whether or not interactivity features are enabled. */ + is_enabled: boolean; + /** @description A string containing the full https URL that acts as the {@link https://api.slack.com/interactivity/handling#setup interactive Options Load URL}. */ + message_menu_options_url?: string; + /** @description A string containing the full https URL that acts as the {@link https://api.slack.com/interactivity/handling#setup interactive Request URL}. */ + request_url?: string; // can be absent when enabling Socket Mode +} + +interface ManifestFunction { + /** @description The name of your function. */ + title: string; + /** @description A description of your function. */ + description: string; + /** @description Input parameters that your function will accept. */ + input_parameters: ManifestParameters; + /** @description Output parameters that your function will produce. */ + output_parameters: ManifestParameters; +} + +interface ManifestParameters { + /** + * @description A map of property names to property definitions describing the parameter set. + * Maximum of 50 property names can be defined. + */ + properties: Record; + /** @description Array of strings matching the propert names defined in `properties`. */ + required?: string[]; +} + +export type ManifestParameterProperty = + | CommonManifestParameterProperty + | StringManifestParameterProperty + | NumberManifestParameterProperty; + +interface CommonManifestParameterProperty { + /** @description The type of the property. */ + type: string; + /** @description The description of the property. */ + description?: string; + /** @description The title of the property. */ + title?: string; + /** @description Property usage hint. */ + hint?: string; +} + +interface StringManifestParameterProperty extends CommonManifestParameterProperty { + /** @description The type of the property. For strings, this will always be `string`. */ + type: 'string'; + minLength?: number; + maxLength?: number; +} + +interface NumberManifestParameterProperty extends CommonManifestParameterProperty { + /** @description The type of the property. For numbers, this will always be `number`. */ + type: 'number'; + minimum?: number; + maximum?: number; +} + +// TODO: add more types that we support + +// https://api.slack.com/scopes?filter=granular_bot +// var scopes = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')) +// .map(e => '"' + e.innerText + '"').join(' | '); console.log("type BotScope = " + scopes + ";"); +type BotScope = + | 'app_mentions:read' + | 'bookmarks:read' + | 'bookmarks:write' + | 'calls:read' + | 'calls:write' + | 'channels:history' + | 'channels:join' + | 'channels:manage' + | 'channels:read' + | 'channels:write.invites' + | 'channels:write.topic' + | 'chat:write' + | 'chat:write.customize' + | 'chat:write.public' + | 'commands' + | 'conversations.connect:manage' + | 'conversations.connect:read' + | 'conversations.connect:write' + | 'datastore:read' + | 'datastore:write' + | 'dnd:read' + | 'emoji:read' + | 'files:read' + | 'files:write' + | 'groups:history' + | 'groups:read' + | 'groups:write' + | 'groups:write.invites' + | 'groups:write.topic' + | 'im:history' + | 'im:read' + | 'im:write' + | 'incoming-webhook' + | 'links.embed:write' + | 'links:read' + | 'links:write' + | 'metadata.message:read' + | 'mpim:history' + | 'mpim:read' + | 'mpim:write' + | 'mpim:write.invites' + | 'mpim:write.topic' + | 'none' + | 'pins:read' + | 'pins:write' + | 'reactions:read' + | 'reactions:write' + | 'reminders:read' + | 'reminders:write' + | 'remote_files:read' + | 'remote_files:share' + | 'remote_files:write' + | 'team.billing:read' + | 'team.preferences:read' + | 'team:read' + | 'tokens.basic' + | 'triggers:read' + | 'triggers:write' + | 'usergroups:read' + | 'usergroups:write' + | 'users.profile:read' + | 'users:read' + | 'users:read.email' + | 'users:write' + | 'workflow.steps:execute'; + +// https://api.slack.com/scopes?filter=user +// var scopes = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')) +// .map(e => ''' + e.innerText + ''').join(' | '); console.log('type UserScope = ' + scopes + ';'); +type UserScope = + | 'admin' + | 'admin.analytics:read' + | 'admin.app_activities:read' + | 'admin.apps:read' + | 'admin.apps:write' + | 'admin.barriers:read' + | 'admin.barriers:write' + | 'admin.conversations:read' + | 'admin.conversations:write' + | 'admin.invites:read' + | 'admin.invites:write' + | 'admin.roles:read' + | 'admin.roles:write' + | 'admin.teams:read' + | 'admin.teams:write' + | 'admin.usergroups:read' + | 'admin.usergroups:write' + | 'admin.users:read' + | 'admin.users:write' + | 'admin.workflows:read' + | 'admin.workflows:write' + | 'auditlogs:read' + | 'bookmarks:read' + | 'bookmarks:write' + | 'calls:read' + | 'calls:write' + | 'channels:history' + | 'channels:read' + | 'channels:write' + | 'channels:write.invites' + | 'channels:write.topic' + | 'chat:write' + | 'chat:write:bot' + | 'chat:write:user' + | 'commands' + | 'dnd:read' + | 'dnd:write' + | 'email' + | 'emoji:read' + | 'files:read' + | 'files:write' + | 'files:write:user' + | 'groups:history' + | 'groups:read' + | 'groups:write' + | 'groups:write.invites' + | 'groups:write.topic' + | 'identity.avatar' + | 'identity.basic' + | 'identity.email' + | 'identity.team' + | 'im:history' + | 'im:read' + | 'im:write' + | 'incoming-webhook' + | 'links.embed:write' + | 'links:read' + | 'links:write' + | 'mpim:history' + | 'mpim:read' + | 'mpim:write' + | 'mpim:write.invites' + | 'mpim:write.topic' + | 'openid' + | 'pins:read' + | 'pins:write' + | 'profile' + | 'reactions:read' + | 'reactions:write' + | 'reminders:read' + | 'reminders:write' + | 'remote_files:read' + | 'remote_files:share' + | 'search:read' + | 'stars:read' + | 'stars:write' + | 'team.billing:read' + | 'team.preferences:read' + | 'team:read' + | 'tokens.basic' + | 'usergroups:read' + | 'usergroups:write' + | 'users.profile:read' + | 'users.profile:write' + | 'users:read' + | 'users:read.email' + | 'users:write'; + +// https://api.slack.com/scopes?query=Configuration +// var scopes = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')) +// .map(e => ''' + e.innerText + ''').join(' | '); console.log('export type AnyConfigurationScope = ' + scopes + ';'); +export type AnyManifestConfigurationScope = + | 'app_configurations:read' + | 'app_configurations:write'; + +export type AppManifestLevelScopes = + | 'authorizations:read' + | 'connections:write'; + +// https://api.slack.com/events?filter=Events +// var events = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')) +// .map(e => '"' + e.innerText + '"').join(' | '); console.log("export type AnyMafifestEvent = " + events + ";"); +type ManifestEvent = + | 'app_home_opened' + | 'app_mention' + | 'app_rate_limited' + | 'app_requested' + | 'app_uninstalled' + | 'call_rejected' + | 'channel_archive' + | 'channel_created' + | 'channel_deleted' + | 'channel_history_changed' + | 'channel_id_changed' + | 'channel_left' + | 'channel_rename' + | 'channel_shared' + | 'channel_unarchive' + | 'channel_unshared' + | 'dnd_updated' + | 'dnd_updated_user' + | 'email_domain_changed' + | 'emoji_changed' + | 'file_change' + | 'file_comment_added' + | 'file_comment_deleted' + | 'file_comment_edited' + | 'file_created' + | 'file_deleted' + | 'file_public' + | 'file_shared' + | 'file_unshared' + | 'grid_migration_finished' + | 'grid_migration_started' + | 'group_archive' + | 'group_close' + | 'group_deleted' + | 'group_history_changed' + | 'group_left' + | 'group_open' + | 'group_rename' + | 'group_unarchive' + | 'im_close' + | 'im_created' + | 'im_history_changed' + | 'im_open' + | 'invite_requested' + | 'link_shared' + | 'member_joined_channel' + | 'member_left_channel' + | 'message' + | 'message.app_home' + | 'message.channels' + | 'message.groups' + | 'message.im' + | 'message.mpim' + | 'message_metadata_deleted' + | 'message_metadata_posted' + | 'message_metadata_updated' + | 'pin_added' + | 'pin_removed' + | 'reaction_added' + | 'reaction_removed' + | 'resources_added' + | 'resources_removed' + | 'scope_denied' + | 'scope_granted' + | 'shared_channel_invite_accepted' + | 'shared_channel_invite_approved' + | 'shared_channel_invite_declined' + | 'shared_channel_invite_received' + | 'star_added' + | 'star_removed' + | 'subteam_created' + | 'subteam_members_changed' + | 'subteam_self_added' + | 'subteam_self_removed' + | 'subteam_updated' + | 'team_access_granted' + | 'team_access_revoked' + | 'team_domain_change' + | 'team_join' + | 'team_rename' + | 'tokens_revoked' + | 'url_verification' + | 'user_change' + | 'user_huddle_changed' + | 'user_profile_changed' + | 'user_resource_denied' + | 'user_resource_granted' + | 'user_resource_removed' + | 'user_status_changed' + | 'workflow_deleted' + | 'workflow_published' + | 'workflow_step_deleted' + | 'workflow_step_execute' + | 'workflow_unpublished'; diff --git a/packages/web-api/test/types/methods/apps.test-d.ts b/packages/web-api/test/types/methods/apps.test-d.ts index ce2b08ae7..d97492041 100644 --- a/packages/web-api/test/types/methods/apps.test-d.ts +++ b/packages/web-api/test/types/methods/apps.test-d.ts @@ -18,6 +18,74 @@ expectAssignable>([{ event_context: '12345', }]); +// apps.manifest.create +// -- sad path +expectError(web.apps.manifest.create()); // lacking argument +expectError(web.apps.manifest.create({})); // empty argument +// -- happy path +expectAssignable>([{ + manifest: { + display_information: { + name: 'Bare Minimum', + }, + }, +}]); + +// apps.manifest.delete +// -- sad path +expectError(web.apps.manifest.delete()); // lacking argument +expectError(web.apps.manifest.delete({})); // empty argument +// -- happy path +expectAssignable>([{ + app_id: 'A1234', +}]); + +// apps.manifest.export +// -- sad path +expectError(web.apps.manifest.export()); // lacking argument +expectError(web.apps.manifest.export({})); // empty argument +// -- happy path +expectAssignable>([{ + app_id: 'A1234', +}]); + +// apps.manifest.update +// -- sad path +expectError(web.apps.manifest.update()); // lacking argument +expectError(web.apps.manifest.update({})); // empty argument +expectError(web.apps.manifest.update({ + app_id: 'A1234', // missing manifest +})); +expectError(web.apps.manifest.update({ + manifest: { // missing app_id + display_information: { + name: 'Bare Minimum', + }, + }, +})); +// -- happy path +expectAssignable>([{ + app_id: 'A1234', + manifest: { + display_information: { + name: 'Bare Minimum', + }, + }, +}]); + +// apps.manifest.validate +// -- sad path +expectError(web.apps.manifest.validate()); // lacking argument +expectError(web.apps.manifest.validate({})); // empty argument +// -- happy path +expectAssignable>([{ + manifest: { + display_information: { + name: 'Bare Minimum', + }, + }, +}]); + // apps.uninstall // -- sad path expectError(web.apps.uninstall()); // lacking argument From 920c3fb7f53f7201d75f9c026e56f9fae1e1be80 Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 14 Dec 2023 08:10:25 -0500 Subject: [PATCH 120/122] Update packages/web-api/src/types/request/bots.ts Co-authored-by: Kazuhiro Sera --- packages/web-api/src/types/request/bots.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/src/types/request/bots.ts b/packages/web-api/src/types/request/bots.ts index c448f7f24..84f58240d 100644 --- a/packages/web-api/src/types/request/bots.ts +++ b/packages/web-api/src/types/request/bots.ts @@ -2,6 +2,6 @@ import type { OptionalTeamAssignable, TokenOverridable } from './common'; // https://api.slack.com/methods/bots.info export interface BotsInfoArguments extends TokenOverridable, OptionalTeamAssignable { - /** @description Bot user ID to retrieve information about. */ + /** @description Bot ID, which starts with 'B', to retrieve information about. */ bot?: string; } From 6e2d515e335fe44a08c783175d0d819079049041 Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 14 Dec 2023 12:35:49 -0500 Subject: [PATCH 121/122] 7.0.0-rc.0 (#1704) --- packages/web-api/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-api/package.json b/packages/web-api/package.json index e584d17d6..198bff97e 100644 --- a/packages/web-api/package.json +++ b/packages/web-api/package.json @@ -1,6 +1,6 @@ { "name": "@slack/web-api", - "version": "6.9.0", + "version": "7.0.0-rc.0", "description": "Official library for using the Slack Platform's Web API", "author": "Slack Technologies, LLC", "license": "MIT", From f340482a4fcfadd53e2d33b831e9d321aee3f392 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 14 Dec 2023 15:30:13 -0500 Subject: [PATCH 122/122] Tweaks to some JSDocs and being extra careful to allow for `text` with message-posting APIs, added tests to ensure this remains the case --- packages/web-api/src/types/request/chat.ts | 9 ++-- packages/web-api/src/types/request/common.ts | 4 +- .../web-api/test/types/methods/chat.test-d.ts | 46 +++++++++++++++++++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/packages/web-api/src/types/request/chat.ts b/packages/web-api/src/types/request/chat.ts index cd78b7d56..623e67b36 100644 --- a/packages/web-api/src/types/request/chat.ts +++ b/packages/web-api/src/types/request/chat.ts @@ -33,18 +33,21 @@ interface Parse { parse?: 'full' | 'none'; } interface Text { - /** @description Text of the message. */ + /** + * @description Text of the message. If used in conjunction with `blocks` or `attachments`, `text` will be used + * as fallback text for notifications only. + */ text: string; } interface ChannelAndText extends Channel, Text {} -interface ChannelAndBlocks extends Channel { +interface ChannelAndBlocks extends Channel, Partial { /** * @description An array of structured Blocks. * @see {@link https://api.slack.com/reference/block-kit/blocks Blocks reference}. */ blocks: (KnownBlock | Block)[]; } -interface ChannelAndAttachments extends Channel { +interface ChannelAndAttachments extends Channel, Partial { /** * @description An array of structured attachments. * @see {@link https://api.slack.com/messaging/composing/layouts#attachments Adding secondary attachments}. diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 7ba67762c..6ae527a59 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -97,12 +97,12 @@ export interface MessageArgument { } export interface FileArgument { - /** @description Encoded file ID reacted to. */ + /** @description Encoded file ID. */ file: string; } export interface FileCommentArgument { - /** @description Encoded file comment ID reacted to. */ + /** @description Encoded file comment ID. */ file_comment: string; } diff --git a/packages/web-api/test/types/methods/chat.test-d.ts b/packages/web-api/test/types/methods/chat.test-d.ts index 369698a6c..b30f0e676 100644 --- a/packages/web-api/test/types/methods/chat.test-d.ts +++ b/packages/web-api/test/types/methods/chat.test-d.ts @@ -134,10 +134,22 @@ expectAssignable>([{ user: 'U1234', blocks: [], }]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + blocks: [], + text: 'fallback', +}]); +expectAssignable>([{ + channel: 'C1234', + user: 'U1234', + attachments: [], +}]); expectAssignable>([{ channel: 'C1234', user: 'U1234', attachments: [], + text: 'fallback', }]); expectAssignable>([{ channel: 'C1234', @@ -220,10 +232,20 @@ expectAssignable>([{ channel: 'C1234', blocks: [], }]); +expectAssignable>([{ + channel: 'C1234', + blocks: [], + text: 'fallback', +}]); expectAssignable>([{ channel: 'C1234', attachments: [], }]); +expectAssignable>([{ + channel: 'C1234', + attachments: [], + text: 'fallback', +}]); expectAssignable>([{ channel: 'C1234', attachments: [], @@ -315,10 +337,22 @@ expectAssignable>([{ post_at: 'U1234', blocks: [], }]); +expectAssignable>([{ + channel: 'C1234', + post_at: 'U1234', + blocks: [], + text: 'fallback', +}]); +expectAssignable>([{ + channel: 'C1234', + post_at: 'U1234', + attachments: [], +}]); expectAssignable>([{ channel: 'C1234', post_at: 'U1234', attachments: [], + text: 'fallback', }]); expectAssignable>([{ channel: 'C1234', @@ -441,10 +475,22 @@ expectAssignable>([{ ts: '1234.56', blocks: [], }]); +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + blocks: [], + text: 'fallback', +}]); +expectAssignable>([{ + channel: 'C1234', + ts: '1234.56', + attachments: [], +}]); expectAssignable>([{ channel: 'C1234', ts: '1234.56', attachments: [], + text: 'fallback', }]); expectAssignable>([{ channel: 'C1234',