mailslurp.api.AttachmentControllerApi
Load the API package
All URIs are relative to https://api.mailslurp.com
Method | HTTP request | Description |
---|---|---|
deleteAllAttachments | DELETE /attachments | Delete all attachments |
deleteAttachment | DELETE /attachments/{attachmentId} | Delete an attachment |
downloadAttachmentAsBase64Encoded | GET /attachments/{attachmentId}/base64 | Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. |
downloadAttachmentAsBytes | GET /attachments/{attachmentId}/bytes | Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints. |
getAttachment | GET /attachments/{attachmentId} | Get an attachment entity |
getAttachmentInfo | GET /attachments/{attachmentId}/metadata | Get email attachment metadata information |
getAttachments | GET /attachments | Get email attachments |
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. |
deleteAllAttachments()
Delete all attachments
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';
final api_instance = AttachmentControllerApi();
try {
api_instance.deleteAllAttachments();
} catch (e) {
print('Exception when calling AttachmentControllerApi->deleteAllAttachments: $en');
}
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to ]
deleteAttachment(attachmentId)
Delete an attachment
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';
final api_instance = AttachmentControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
try {
api_instance.deleteAttachment(attachmentId);
} catch (e) {
print('Exception when calling AttachmentControllerApi->deleteAttachment: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | String | ID of attachment |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to ]
DownloadAttachmentDto downloadAttachmentAsBase64Encoded(attachmentId)
Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
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.
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';
final api_instance = AttachmentControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
try {
final result = api_instance.downloadAttachmentAsBase64Encoded(attachmentId);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->downloadAttachmentAsBase64Encoded: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | String | ID of attachment |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
String downloadAttachmentAsBytes(attachmentId)
Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64
response endpoints.
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.
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';
final api_instance = AttachmentControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
try {
final result = api_instance.downloadAttachmentAsBytes(attachmentId);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->downloadAttachmentAsBytes: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | String | ID of attachment |
Return type
String
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/octet-stream
[Back to top] [Back to API list] [Back to Model list] [Back to ]
AttachmentEntity getAttachment(attachmentId)
Get an attachment entity
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';
final api_instance = AttachmentControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
try {
final result = api_instance.getAttachment(attachmentId);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->getAttachment: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | String | ID of attachment |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
AttachmentMetaData getAttachmentInfo(attachmentId)
Get email attachment metadata information
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.
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';
final api_instance = AttachmentControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
try {
final result = api_instance.getAttachmentInfo(attachmentId);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->getAttachmentInfo: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | String | ID of attachment |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
PageAttachmentEntity getAttachments(page, size, sort, fileNameFilter, since, before)
Get email attachments
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.
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';
final api_instance = AttachmentControllerApi();
final page = 56; // int | Optional page for list pagination
final size = 56; // int | Optional page size for list pagination
final sort = sort_example; // String | Optional createdAt sort direction ASC or DESC
final fileNameFilter = fileNameFilter_example; // String | Optional file name and content type search filter
final since = 2013-10-20T19:20:30+01:00; // DateTime | Filter by created at after the given timestamp
final before = 2013-10-20T19:20:30+01:00; // DateTime | Filter by created at before the given timestamp
try {
final result = api_instance.getAttachments(page, size, sort, fileNameFilter, since, before);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->getAttachments: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
page | int | Optional page for list pagination | [optional] [default to 0] |
size | int | Optional page size for list pagination | [optional] [default to 20] |
sort | String | Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] |
fileNameFilter | String | Optional file name and content type search filter | [optional] |
since | DateTime | Filter by created at after the given timestamp | [optional] |
before | DateTime | Filter by created at before the given timestamp | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
List
uploadAttachment(uploadAttachmentOptions)
Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
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';
final api_instance = AttachmentControllerApi();
final uploadAttachmentOptions = UploadAttachmentOptions(); // UploadAttachmentOptions |
try {
final result = api_instance.uploadAttachment(uploadAttachmentOptions);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->uploadAttachment: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
uploadAttachmentOptions | UploadAttachmentOptions |
Return type
List
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
List
uploadAttachmentBytes(inlineObject1, contentType, filename)
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.
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';
final api_instance = AttachmentControllerApi();
final inlineObject1 = InlineObject1(); // InlineObject1 |
final contentType = contentType_example; // String | Optional contentType for file. For instance `application/pdf`
final filename = filename_example; // String | Optional filename to save upload with
try {
final result = api_instance.uploadAttachmentBytes(inlineObject1, contentType, filename);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->uploadAttachmentBytes: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
inlineObject1 | InlineObject1 | ||
contentType | String | Optional contentType for file. For instance application/pdf | [optional] |
filename | String | Optional filename to save upload with | [optional] |
Return type
List
Authorization
HTTP request headers
- Content-Type: application/octet-stream
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to ]
List
uploadMultipartForm(contentType, filename, xFilename, inlineObject)
Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
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';
final api_instance = AttachmentControllerApi();
final contentType = contentType_example; // String | Optional content type of attachment
final filename = filename_example; // String | Optional name of file
final xFilename = xFilename_example; // String | Optional content type header of attachment
final inlineObject = InlineObject(); // InlineObject |
try {
final result = api_instance.uploadMultipartForm(contentType, filename, xFilename, inlineObject);
print(result);
} catch (e) {
print('Exception when calling AttachmentControllerApi->uploadMultipartForm: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
contentType | String | Optional content type of attachment | [optional] |
filename | String | Optional name of file | [optional] |
xFilename | String | Optional content type header of attachment | [optional] |
inlineObject | InlineObject | [optional] |
Return type
List
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]