class FileUploadBuilder

export declare class FileUploadBuilder extends ComponentBuilder<APIFileUploadComponent>

A builder that creates API-compatible JSON data for file uploads.

Constructors

constructor()

Creates a new file upload.

Examples:Creating a file upload from an API data object:
const fileUpload = new FileUploadBuilder({
	custom_id: "file_upload",
 min_values: 2,
 max_values: 5,
 file_types: ["image", ".pdf"],
});
Creating a file upload using setters and API data:
const fileUpload = new FileUploadBuilder({
	custom_id: "file_upload",
 min_values: 2,
 max_values: 5,
})
	.setFileTypes("image", ".pdf")
	.setRequired();

addFileTypes() : this

Adds file types allowed in this file upload.

clearFileTypes() : this

Clears the file types allowed in this file upload.

clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

clearMaxValues() : this

Clears the maximum values.

clearMinValues() : this

Clears the minimum values.

setCustomId(
customId: string
) : this

Sets the custom id for this file upload.

setFileTypes() : this

Sets the file types allowed in this file upload.

setId(
id: number
) : this

Sets the id of this component.

Inherited from: ComponentBuilder

setMaxValues(
maxValues: number
) : this

Sets the maximum number of file uploads required.

setMinValues(
minValues: number
) : this

Sets the minimum number of file uploads required.

setRequired(
required?: boolean
) : this

Sets whether this file upload is required.

toJSON(
validationOverride?: boolean
) : APIFileUploadComponent

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.