Table of Contents

Class BatchEmailRequestBuilder

Namespace
Mailtrap.Emails.Requests
Assembly
Mailtrap.dll

A set of helper methods to streamline BatchEmailRequest instance construction using fluent style.

public static class BatchEmailRequestBuilder
Inheritance
BatchEmailRequestBuilder

Methods

Base(BatchEmailRequest, EmailRequest)

Sets provided request to the batchRequest.

public static BatchEmailRequest Base(this BatchEmailRequest batchRequest, EmailRequest request)

Parameters

batchRequest BatchEmailRequest
BatchEmailRequest instance to update.
request EmailRequest

EmailRequest object to initialize request's Base property.

Returns

BatchEmailRequest
Updated BatchEmailRequest instance so subsequent calls can be chained.

Exceptions

ArgumentNullException

Base(BatchEmailRequest, Action<EmailRequest>)

Configure and set the Base request using a builder lambda.

public static BatchEmailRequest Base(this BatchEmailRequest batchRequest, Action<EmailRequest> configure)

Parameters

batchRequest BatchEmailRequest
BatchEmailRequest instance to update.
configure Action<EmailRequest>

Action delegate to configure a new EmailRequest instance which will be set as the Base request.

Returns

BatchEmailRequest
Updated BatchEmailRequest instance so subsequent calls can be chained.

Exceptions

ArgumentNullException

When batchRequest or configure is null.

Requests(BatchEmailRequest, SendEmailRequest)

Adds provided request to the Requests collection of the batchRequest.

public static BatchEmailRequest Requests(this BatchEmailRequest batchRequest, SendEmailRequest request)

Parameters

batchRequest BatchEmailRequest
BatchEmailRequest instance to update.
request SendEmailRequest

Single SendEmailRequest object to add to the batch request's requests collection.

Returns

BatchEmailRequest
Updated BatchEmailRequest instance so subsequent calls can be chained.

Remarks

Duplicates can be added by calling this method multiple times with the same requests.

Exceptions

ArgumentNullException

When batchRequest or request is null.

Requests(BatchEmailRequest, params SendEmailRequest[])

Adds provided requests to the Requests collection of the batchRequest.

public static BatchEmailRequest Requests(this BatchEmailRequest batchRequest, params SendEmailRequest[] requests)

Parameters

batchRequest BatchEmailRequest

BatchEmailRequest instance to update.

requests SendEmailRequest[]

One or more SendEmailRequest objects to add to the batch request's requests collection.

Returns

BatchEmailRequest

Updated BatchEmailRequest instance so subsequent calls can be chained.

Remarks

Duplicates can be added by calling this method multiple times with the same requests.

Exceptions

ArgumentNullException

When batchRequest or requests is null.

Requests(BatchEmailRequest, Action<SendEmailRequest>)

Configures and adds a new SendEmailRequest to the Requests collection of the batchRequest using a builder lambda.

public static BatchEmailRequest Requests(this BatchEmailRequest batchRequest, Action<SendEmailRequest> configure)

Parameters

batchRequest BatchEmailRequest
BatchEmailRequest instance to update.
configure Action<SendEmailRequest>

Action delegate to configure a new SendEmailRequest instance which will be added to the batch Requests collection.

Returns

BatchEmailRequest
Updated BatchEmailRequest instance so subsequent calls can be chained.

Remarks

Duplicates can be added by calling this method multiple times with the same requests.

Exceptions

ArgumentNullException

When batchRequest or configure is null.

Requests(BatchEmailRequest, IEnumerable<SendEmailRequest>)

Adds provided requests to the Requests collection of the batchRequest.

public static BatchEmailRequest Requests(this BatchEmailRequest batchRequest, IEnumerable<SendEmailRequest> requests)

Parameters

batchRequest BatchEmailRequest
BatchEmailRequest instance to update.
requests IEnumerable<SendEmailRequest>

Collection of SendEmailRequest objects to add to the batch request's requests collection.

Returns

BatchEmailRequest
Updated BatchEmailRequest instance so subsequent calls can be chained.

Remarks

Duplicates can be added by calling this method multiple times with the same requests.

Exceptions

ArgumentNullException