Interface IEmailCampaignResource
- Namespace
- Mailtrap.EmailCampaigns
- Assembly
- Mailtrap.Abstractions.dll
Represents a single email campaign resource.
public interface IEmailCampaignResource : IRestResource
- Inherited Members
Methods
Cancel(CancellationToken)
Cancels the scheduled email campaign, represented by this resource instance, removing the
pending send job and returning the campaign to the Draft state.
The campaign must be in the Scheduled state.
Task<EmailCampaign> Cancel(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details after the state transition.
Delete(CancellationToken)
Deletes the email campaign, represented by this resource instance.
Only a campaign in the Draft state can be deleted.
Task Delete(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task
Awaitable task, representing the operation.
Remarks
On success the API returns HTTP 204 with no response body. After deletion, the resource represented by this instance should no longer be used.
GetDetails(CancellationToken)
Gets the details of the email campaign, represented by this resource instance.
Task<EmailCampaign> GetDetails(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details.
GetStats(EmailCampaignStatsFilter?, CancellationToken)
Gets aggregated performance statistics for the email campaign, represented by this resource instance.
Task<EmailCampaignStats> GetStats(EmailCampaignStatsFilter? filter = null, CancellationToken cancellationToken = default)
Parameters
filterEmailCampaignStatsFilterOptional aggregation window (
start_date/end_date).cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaignStats>
Aggregated campaign statistics. All counts and rates are
0when the campaign has not been started.
Reset(CancellationToken)
Resets the email campaign, represented by this resource instance, back to the
Draft state.
Allowed only from the Scheduled state.
Task<EmailCampaign> Reset(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details after the state transition.
Schedule(ScheduleEmailCampaignRequest, CancellationToken)
Schedules the email campaign, represented by this resource instance, to start sending
at a future time.
The campaign must be in the Draft state and pass full
sending validation. After scheduling, the time is reported back in
ScheduledAt.
Task<EmailCampaign> Schedule(ScheduleEmailCampaignRequest request, CancellationToken cancellationToken = default)
Parameters
requestScheduleEmailCampaignRequestRequest containing the date and time to send the campaign at.
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details after the state transition.
Start(CancellationToken)
Starts sending the email campaign, represented by this resource instance, immediately.
The campaign must be in the Draft state and pass full
sending validation (design, audience, verified sending domain, billing).
Task<EmailCampaign> Start(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details after the state transition.
Terminate(CancellationToken)
Terminates the email campaign, represented by this resource instance, aborting the
in-flight send.
The campaign must be in a sending state (Started,
Queued, or Paused).
Task<EmailCampaign> Terminate(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Email campaign details after the state transition.
Update(UpdateEmailCampaignRequest, CancellationToken)
Updates the email campaign, represented by this resource instance, with details specified
by request.
Only Draft campaigns can be updated.
Only the provided attributes are changed.
Task<EmailCampaign> Update(UpdateEmailCampaignRequest request, CancellationToken cancellationToken = default)
Parameters
requestUpdateEmailCampaignRequestRequest containing email campaign details to update.
cancellationTokenCancellationToken- Token to control operation cancellation.
Returns
- Task<EmailCampaign>
Updated email campaign details.