Skip to content

mailslurp.api.TemplateControllerApi

Load the API package

import 'package:mailslurp/api.dart';

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
getTemplatePreviewHtml GET /templates/{templateId}/preview/html Get template preview HTML
getTemplatePreviewJson GET /templates/{templateId}/preview/json Get template preview Json
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

TemplateDto

Authorization

API_KEY

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

API_KEY

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

PageTemplateProjection

Authorization

API_KEY

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

TemplateDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

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

String getTemplatePreviewHtml(templateId)

Get template preview HTML

Get email template preview with passed template variables in HTML format for browsers. Pass template variables as query params.

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.getTemplatePreviewHtml(templateId);
    print(result);
} catch (e) {
    print('Exception when calling TemplateControllerApi->getTemplatePreviewHtml: $en');
}

Parameters

Name Type Description Notes
templateId String Template ID

Return type

String

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/html;charset=utf-8, text/html

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

TemplatePreview getTemplatePreviewJson(templateId)

Get template preview Json

Get email template preview with passed template variables in JSON format. Pass template variables as query params.

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.getTemplatePreviewJson(templateId);
    print(result);
} catch (e) {
    print('Exception when calling TemplateControllerApi->getTemplatePreviewJson: $en');
}

Parameters

Name Type Description Notes
templateId String Template ID

Return type

TemplatePreview

Authorization

API_KEY

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

List

Authorization

API_KEY

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

TemplateDto

Authorization

API_KEY

HTTP request headers

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

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