Table of Contents

Class CreateTemplateRequest

Namespace
Mailtrap.Templates.Requests
Assembly
Mailtrap.Abstractions.dll

Request object for creating a template.
The request body is sent flat (no envelope).

public sealed record CreateTemplateRequest : IValidatable, IEquatable<CreateTemplateRequest>
Inheritance
CreateTemplateRequest
Implements

Properties

BodyHtml

Gets or sets the template body HTML.

[JsonPropertyName("body_html")]
[JsonPropertyOrder(4)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BodyHtml { get; set; }

Property Value

string

Template body HTML, or null to omit it.

Remarks

Template body HTML must be no longer than 10_000_000 characters.

BodyText

Gets or sets the template body text.

[JsonPropertyName("body_text")]
[JsonPropertyOrder(5)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BodyText { get; set; }

Property Value

string

Template body text, or null to omit it.

Remarks

Template body text must be no longer than 10_000_000 characters.

Category

Gets or sets the template category. Required.

[JsonPropertyName("category")]
[JsonPropertyOrder(2)]
[JsonRequired]
public string? Category { get; set; }

Property Value

string

Template category.

Remarks

Template category must be no longer than 255 characters.

Name

Gets or sets the template name. Required.

[JsonPropertyName("name")]
[JsonPropertyOrder(1)]
[JsonRequired]
public string? Name { get; set; }

Property Value

string

Template name.

Remarks

Template name must be no longer than 255 characters.

Subject

Gets or sets the template subject. Required.

[JsonPropertyName("subject")]
[JsonPropertyOrder(3)]
[JsonRequired]
public string? Subject { get; set; }

Property Value

string

Template subject.

Remarks

Template subject must be no longer than 255 characters.

Methods

Validate()

Validates the current instance.

public ValidationResult Validate()

Returns

ValidationResult

Object containing validation errors, if any.