class AttachmentBuilder

export declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment>

A builder that creates API-compatible JSON data for attachments.

Constructors

constructor()

Creates a new attachment builder.

clearDescription() : this

Clears the description of this attachment.

clearDuration() : this

Clears the duration of this attachment.

clearFileContentType() : this

Clears the content type of the file data from this attachment.

clearFileData() : this

Clears the file data from this attachment.

clearFilename() : this

Clears the filename of this attachment.

clearTitle() : this

Clears the title of this attachment.

clearWaveform() : this

Clears the waveform of this attachment.

getRawFile() : Partial<RawFile> | undefined

Converts this attachment to a RawFile for uploading.

Returns: A RawFile object, or undefined if no file data is set

setDescription(
description: string
) : this

Sets the description of this attachment.

setDuration(
duration: number
) : this

Sets the duration of this attachment (audio clips).

setFileContentType(
contentType: string
) : this

Sets the content type of the file data to upload with this attachment.

setFileData() : this

Sets the file data to upload with this attachment.

setFilename(
filename: string
) : this

Sets the filename of this attachment.

setId() : this

Sets the id of the attachment.

setTitle(
title: string
) : this

Sets the title of this attachment.

setWaveform(
waveform: string
) : this

Sets the waveform of this attachment (audio clips).

toJSON(
validationOverride?: boolean
) : RESTAPIAttachment

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