class FileUploadBuilder
extends
ComponentBuilder<APIFileUploadComponent>export declare class FileUploadBuilder extends ComponentBuilder<APIFileUploadComponent>A builder that creates API-compatible JSON data for file uploads.
Constructors
constructor(data?: Partial<APIFileUploadComponent>)
data?: Partial<APIFileUploadComponent>
Creates a new file upload.
Examples:Creating a file upload from an API data object:Creating a file upload using setters and API data:
const fileUpload = new FileUploadBuilder({
custom_id: "file_upload",
min_values: 2,
max_values: 5,
});const fileUpload = new FileUploadBuilder({
custom_id: "file_upload",
min_values: 2,
max_values: 5,
}).setRequired();Clears the id of this component, defaulting to a default incremented id.
Inherited from: ComponentBuilder
setCustomId(customId: string) : this
customId: string
Sets the custom id for this file upload.
setMaxValues(maxValues: number) : this
maxValues: number
Sets the maximum number of file uploads required.
setMinValues(minValues: number) : this
minValues: number
Sets the minimum number of file uploads required.
setRequired(required?: boolean) : this
required?: boolean
Sets whether this file upload is required.
toJSON(validationOverride?: boolean) : APIFileUploadComponent
validationOverride?: boolean
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.