UNPKG

8.11 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3/// <reference types="node" />
4import type { Stream } from 'node:stream';
5import type { ExcludeFromUnion } from '../helpers';
6import type { FilesGetUploadURLExternalResponse } from '../response/index';
7import type { CursorPaginationEnabled, OptionalTeamAssignable, TokenOverridable, TraditionalPagingEnabled } from './common';
8export interface FileArgument {
9 /** @description Encoded file ID. */
10 file: string;
11}
12export interface ExternalIDArgument {
13 /** @description Creator defined GUID for the file. */
14 external_id: string;
15}
16export interface ChannelsArgument {
17 /**
18 * @description Comma-seperated list of channel IDs where the file will be shared. If not specified the file will
19 * be private.
20 */
21 channels?: string;
22}
23export interface FileType {
24 /**
25 * @description A file type identifier.
26 * @see {@link https://api.slack.com/types/file#file_types File types} for a complete list of supported file types.
27 */
28 filetype?: string;
29}
30export interface FileUploadComplete {
31 /** @description Encoded file ID. */
32 id: string;
33 /** @description File title. */
34 title?: string;
35}
36export interface FileChannelDestinationArgument {
37 /** @description Channel ID where the file will be shared. If not specified the file will be private. */
38 channel_id?: string;
39 thread_ts?: never;
40}
41export interface FileThreadDestinationArgument {
42 /** @description Channel ID where the file will be shared as a thread reply. */
43 channel_id: string;
44 /** @description Provide another message's `ts` value to upload this file as a reply. */
45 thread_ts: string;
46}
47type FileDestinationArgument = FileChannelDestinationArgument | FileThreadDestinationArgument;
48export interface FileChannelDestinationArgumentChannels extends ChannelsArgument {
49 thread_ts?: never;
50}
51export interface FileThreadDestinationArgumentChannels extends Required<ChannelsArgument> {
52 /** @description Provide another message's `ts` value to upload this file as a reply. */
53 thread_ts: string;
54}
55type FileDestinationArgumentChannels = FileChannelDestinationArgumentChannels | FileThreadDestinationArgumentChannels;
56export type FilesCompleteUploadExternalArguments = FileDestinationArgument & TokenOverridable & {
57 /** @description Array of file IDs and their corresponding (optional) titles. */
58 files: [FileUploadComplete, ...FileUploadComplete[]];
59 /** @description The message text introducing the file in the specified channel. */
60 initial_comment?: string;
61};
62export interface FilesDeleteArguments extends FileArgument, TokenOverridable {
63}
64export interface FilesGetUploadURLExternalArguments extends TokenOverridable {
65 /** @description Name of the file being uploaded. */
66 filename: string;
67 /** @description Size in bytes of the file being uploaded. */
68 length: number;
69 /** @description Description of image for screen-reader. */
70 alt_text?: string;
71 /** @description Syntax type of the snippet being uploaded. E.g. `python`. */
72 snippet_type?: string;
73}
74export interface FilesInfoArguments extends FileArgument, TokenOverridable, CursorPaginationEnabled, TraditionalPagingEnabled {
75}
76export interface FilesListArguments extends TokenOverridable, TraditionalPagingEnabled, OptionalTeamAssignable {
77 /** @description Filter files appearing in a specific channel, indicated by its ID. */
78 channel?: string;
79 /**
80 * @description Show truncated file info for files hidden due to being too old, and the team who owns the file
81 * being over the file limit.
82 */
83 show_files_hidden_by_limit?: boolean;
84 /** @description Filter files created after this timestamp (inclusive). */
85 ts_from?: string;
86 /** @description Filter files created before this timestamp (inclusive). */
87 ts_to?: string;
88 /**
89 * @description Filter files by type. Pass multiple values for `types` argument by comma-seperating the values.
90 * The default value is `all`, which does not filter the list.
91 * Available types are `all`, `spaces`, `snippets`, `images`, `gdocs`, `zips` and `pdfs`.
92 */
93 types?: string;
94 /** @description Filter files created by a single user. */
95 user?: string;
96}
97export interface FilesRevokePublicURLArguments extends FileArgument, TokenOverridable {
98}
99export interface FilesSharedPublicURLArguments extends FileArgument, TokenOverridable {
100}
101export interface FileUploadStringContents {
102 /** @description File contents. If omitted, you must provide the `file` argument. */
103 content: string;
104}
105export interface FileUploadBinaryContents {
106 /**
107 * @description File contents as a `Buffer` or `Stream`.
108 * If providing a `string`, this parameter will be interpreted as a _path_ to a file, which will be read from disk
109 * before uploading. If omitted, you must provide the `content` argument.
110 */
111 file: Buffer | Stream | string;
112}
113type FileUploadContents = FileUploadStringContents | FileUploadBinaryContents;
114type FileUpload = FileUploadContents & (FileDestinationArgumentChannels | FileDestinationArgument) & FileType & {
115 /** @description Name of the file. */
116 filename?: string;
117 /** @description The message text introducing the file in specified channel(s). */
118 initial_comment?: string;
119 /** @description File title. */
120 title?: string;
121};
122export type FilesUploadArguments = FileUpload & TokenOverridable;
123export type FileUploadV2 = FileUpload & {
124 /** @description Description of image for screen-reader. */
125 alt_text?: string;
126 /** @description Channel ID where the file will be shared. If not specified the file will be private. */
127 channel_id?: string;
128 /** @deprecated use channel_id instead */
129 channels?: string;
130 /** @description Syntax type of the snippet being uploaded. E.g. `python`. */
131 snippet_type?: string;
132};
133export interface FilesUploadV2ArgumentsMultipleFiles {
134 file_uploads: ExcludeFromUnion<FileUploadV2, 'channel_id' | 'channels' | 'initial_comment' | 'thread_ts'>[];
135}
136export type FilesUploadV2Arguments = TokenOverridable & (FileUploadV2 | (Omit<FileUploadV2, 'file' | 'content'> & FilesUploadV2ArgumentsMultipleFiles));
137export type FileUploadV2Job = FileUploadV2 & TokenOverridable & Pick<FilesGetUploadURLExternalResponse, 'file_id' | 'upload_url' | 'error'> & {
138 length?: number;
139 data?: Buffer;
140};
141export interface FilesCommentsDeleteArguments extends FileArgument, TokenOverridable {
142 /** @description The ID of the comment to delete. */
143 id: string;
144}
145export interface SharedFile {
146 /** @description Title of the file being shared. */
147 title: string;
148 /** @description URL of the remote file. */
149 external_url: string;
150 /** @description Preview of the document. */
151 preview_image?: Buffer | Stream;
152 /**
153 * @description A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery
154 * of the remote file.
155 */
156 indexable_file_contents?: Buffer | Stream;
157}
158export interface FilesRemoteAddArguments extends SharedFile, FileType, ExternalIDArgument, TokenOverridable {
159}
160type FileOrExternalID = (FileArgument & {
161 external_id?: never;
162}) | (ExternalIDArgument & {
163 file?: never;
164});
165export type FilesRemoteInfoArguments = FileOrExternalID & TokenOverridable;
166export interface FilesRemoteListArguments extends TokenOverridable, CursorPaginationEnabled {
167 /** @description Filter files appearing in a specific channel, indicated by its ID. */
168 channel?: string;
169 /** @description Filter files created after this timestamp (inclusive). */
170 ts_from?: string;
171 /** @description Filter files created before this timestamp (inclusive). */
172 ts_to?: string;
173}
174export type FilesRemoteRemoveArguments = FileOrExternalID & TokenOverridable;
175export type FilesRemoteShareArguments = Required<ChannelsArgument> & FileOrExternalID & TokenOverridable;
176export type FilesRemoteUpdateArguments = Partial<SharedFile> & FileOrExternalID & FileType & TokenOverridable;
177export {};
178//# sourceMappingURL=files.d.ts.map
\No newline at end of file