mailslurp.api.TemplateControllerApi
Load the API package
All URIs are relative to https://api.mailslurp.com
Method | HTTP request | Description |
---|---|---|
createTemplate | POST /templates | Create a Template |
deleteTemplate | DELETE /templates/{templateId} | Delete email template |
getAllTemplates | GET /templates/paginated | List templates |
getTemplate | GET /templates/{templateId} | Get template |
getTemplates | GET /templates | List templates |
updateTemplate | PUT /templates/{templateId} | Update template |
TemplateDto createTemplate(createTemplateOptions)
Create a Template
Create an email template with variables for use with templated transactional emails.
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 = TemplateControllerApi();
final createTemplateOptions = CreateTemplateOptions(); // CreateTemplateOptions |
try {
final result = api_instance.createTemplate(createTemplateOptions);
print(result);
} catch (e) {
print('Exception when calling TemplateControllerApi->createTemplate: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
createTemplateOptions | CreateTemplateOptions |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
deleteTemplate(templateId)
Delete email template
Delete template
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 = TemplateControllerApi();
final templateId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | Template ID
try {
api_instance.deleteTemplate(templateId);
} catch (e) {
print('Exception when calling TemplateControllerApi->deleteTemplate: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
templateId | String | Template ID |
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 ]
PageTemplateProjection getAllTemplates(page, size, sort, since, before)
List templates
Get all templates in paginated format
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 = TemplateControllerApi();
final page = 56; // int | Optional page in list pagination
final size = 56; // int | Optional page size in list pagination
final sort = sort_example; // String | Optional createdAt sort direction ASC or DESC
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.getAllTemplates(page, size, sort, since, before);
print(result);
} catch (e) {
print('Exception when calling TemplateControllerApi->getAllTemplates: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
page | int | Optional page in list pagination | [optional] [default to 0] |
size | int | Optional page size in list pagination | [optional] [default to 20] |
sort | String | Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] |
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 ]
TemplateDto getTemplate(templateId)
Get template
Get email template
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 = TemplateControllerApi();
final templateId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | Template ID
try {
final result = api_instance.getTemplate(templateId);
print(result);
} catch (e) {
print('Exception when calling TemplateControllerApi->getTemplate: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
templateId | String | Template ID |
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
getTemplates()
List templates
Get all templates
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 = TemplateControllerApi();
try {
final result = api_instance.getTemplates();
print(result);
} catch (e) {
print('Exception when calling TemplateControllerApi->getTemplates: $en');
}
Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]
TemplateDto updateTemplate(templateId, createTemplateOptions)
Update template
Update email template
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 = TemplateControllerApi();
final templateId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | Template ID
final createTemplateOptions = CreateTemplateOptions(); // CreateTemplateOptions |
try {
final result = api_instance.updateTemplate(templateId, createTemplateOptions);
print(result);
} catch (e) {
print('Exception when calling TemplateControllerApi->updateTemplate: $en');
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
templateId | String | Template ID | |
createTemplateOptions | CreateTemplateOptions |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to ]