# mailslurp.api.AttachmentControllerApi

# Load the API package

import 'package:mailslurp/api.dart';

All URIs are relative to https://api.mailslurp.com

Method HTTP request Description
uploadAttachment POST /attachments Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
uploadAttachmentBytes POST /attachments/bytes 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.
uploadMultipartForm POST /attachments/multipart Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

# uploadAttachment

List<String> uploadAttachment(uploadOptions)

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

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.

# Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';
var api_instance = AttachmentControllerApi();
var uploadOptions = UploadAttachmentOptions(); // UploadAttachmentOptions | uploadOptions
try { 
    var result = api_instance.uploadAttachment(uploadOptions);
    print(result);
} catch (e) {
    print("Exception when calling AttachmentControllerApi->uploadAttachment: $e\n");
}

# Parameters

Name Type Description Notes
uploadOptions UploadAttachmentOptions uploadOptions

# Return type

List<String>

# Authorization

API_KEY

# HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

# uploadAttachmentBytes

List<String> uploadAttachmentBytes(string, filename, byteArray)

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.

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.

# Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';
var api_instance = AttachmentControllerApi();
var string = string_example; // String | Optional contentType for file. For instance `application/pdf`
var filename = filename_example; // String | Optional filename to save upload with
var byteArray = String(); // String | Byte array request body
try { 
    var result = api_instance.uploadAttachmentBytes(string, filename, byteArray);
    print(result);
} catch (e) {
    print("Exception when calling AttachmentControllerApi->uploadAttachmentBytes: $e\n");
}

# Parameters

Name Type Description Notes
string String Optional contentType for file. For instance `application/pdf` [optional] [default to null]
filename String Optional filename to save upload with [optional] [default to null]
byteArray String Byte array request body [optional]

# Return type

List<String>

# Authorization

API_KEY

# HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

# uploadMultipartForm

List<String> uploadMultipartForm(file, contentType, filename, xFilename)

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

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.

# Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';
var api_instance = AttachmentControllerApi();
var file = BINARY_DATA_HERE; // MultipartFile | file
var contentType = contentType_example; // String | Optional content type of attachment
var filename = filename_example; // String | Optional name of file
var xFilename = xFilename_example; // String | Optional content type header of attachment
try { 
    var result = api_instance.uploadMultipartForm(file, contentType, filename, xFilename);
    print(result);
} catch (e) {
    print("Exception when calling AttachmentControllerApi->uploadMultipartForm: $e\n");
}

# Parameters

Name Type Description Notes
file MultipartFile file [default to null]
contentType String Optional content type of attachment [optional] [default to null]
filename String Optional name of file [optional] [default to null]
xFilename String Optional content type header of attachment [optional] [default to null]

# Return type

List<String>

# Authorization

API_KEY

# HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]