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

downloadAttachmentAsBase64Encoded

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

Defined in src/generated/api.ts:6759

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:6779

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


getAttachmentInfo

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

Defined in src/generated/api.ts:6796

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>


uploadAttachment

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

Defined in src/generated/api.ts:6811

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(string?: string, byteArray?: string, filename?: string, options?: any): Promise<string[]>

Defined in src/generated/api.ts:6831

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
string?string
byteArray?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:6857

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[]>