MailSlurp JS

Globals / AttachmentControllerApi

Class: AttachmentControllerApi

AttachmentControllerApi - object-oriented interface

export

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Inherited from BaseAPI.constructor

Defined in src/generated/api.ts:57

Parameters:

NameTypeDefault value
configuration?Configuration-
basePathstringBASE_PATH
fetchFetchAPIportableFetch

Returns: AttachmentControllerApi

Properties

basePath

Protected basePath: string

Inherited from BaseAPI.basePath

Defined in src/generated/api.ts:61


configuration

Protected configuration: Configuration

Inherited from BaseAPI.configuration

Defined in src/generated/api.ts:57


fetch

Protected fetch: FetchAPI

Inherited from BaseAPI.fetch

Defined in src/generated/api.ts:62

Methods

deleteAllAttachments

deleteAllAttachments(options?: any): Promise

Defined in src/generated/api.ts:9279

summary Delete all attachments

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameType
options?any

Returns: Promise


deleteAttachment

deleteAttachment(attachmentId: string, options?: any): Promise

Defined in src/generated/api.ts:9293

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

summary Delete an attachment

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
options?any-

Returns: Promise


downloadAttachmentAsBase64Encoded

downloadAttachmentAsBase64Encoded(attachmentId: string, options?: any): Promise<DownloadAttachmentDto>

Defined in src/generated/api.ts:9308

Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the downloadAttachment method but allows some clients to get around issues with binary responses.

summary Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
options?any-

Returns: Promise<DownloadAttachmentDto>


downloadAttachmentAsBytes

downloadAttachmentAsBytes(attachmentId: string, options?: any): Promise

Defined in src/generated/api.ts:9328

Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.

summary Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
options?any-

Returns: Promise


getAttachment

getAttachment(attachmentId: string, options?: any): Promise<AttachmentEntity>

Defined in src/generated/api.ts:9345

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

summary Get an attachment entity

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
options?any-

Returns: Promise<AttachmentEntity>


getAttachmentInfo

getAttachmentInfo(attachmentId: string, options?: any): Promise<AttachmentMetaData>

Defined in src/generated/api.ts:9360

Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties name and content-type and content-length in bytes for a given attachment.

summary Get email attachment metadata information

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
options?any-

Returns: Promise<AttachmentMetaData>


getAttachments

getAttachments(fileNameFilter?: string, page?: number, size?: number, sort?: “ASC” | “DESC”, options?: any): Promise<PageAttachmentEntity>

Defined in src/generated/api.ts:9378

Get all attachments in paginated response. Each entity contains meta data for the attachment such as name and content-type. Use the attachmentId and the download endpoints to get the file contents.

summary Get email attachments

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameType
fileNameFilter?string
page?number
size?number
sort?“ASC”
options?any

Returns: Promise<PageAttachmentEntity>


uploadAttachment

uploadAttachment(uploadOptions: UploadAttachmentOptions, options?: any): Promise<string[]>

Defined in src/generated/api.ts:9402

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

summary Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
uploadOptionsUploadAttachmentOptionsuploadOptions
options?any-

Returns: Promise<string[]>


uploadAttachmentBytes

uploadAttachmentBytes(byteArray?: string, contentType?: string, filename?: string, options?: any): Promise<string[]>

Defined in src/generated/api.ts:9422

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

summary Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameType
byteArray?string
contentType?string
filename?string
options?any

Returns: Promise<string[]>


uploadMultipartForm

uploadMultipartForm(file: any, contentType?: string, contentTypeHeader?: string, filename?: string, xFilename?: string, options?: any): Promise<string[]>

Defined in src/generated/api.ts:9448

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

summary Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

throws {RequiredError}

memberof AttachmentControllerApi

Parameters:

NameTypeDescription
fileanyfile
contentType?string-
contentTypeHeader?string-
filename?string-
xFilename?string-
options?any-

Returns: Promise<string[]>