Package io.mailtrap.api.emailcampaigns
Class EmailCampaignsImpl
java.lang.Object
io.mailtrap.api.apiresource.ApiResource
io.mailtrap.api.emailcampaigns.EmailCampaignsImpl
- All Implemented Interfaces:
EmailCampaigns
-
Field Summary
Fields inherited from class io.mailtrap.api.apiresource.ApiResource
apiHost, httpClient, token -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancelEmailCampaign(long emailCampaignId) Cancel ascheduledcampaign, returning it to thedraftstate.createEmailCampaign(CreateEmailCampaign request) Create a new email campaign in thedraftstate.voiddeleteEmailCampaign(long emailCampaignId) Delete an email campaign.getEmailCampaign(long emailCampaignId) Get a single email campaign by ID.List the account's email campaigns, newest first.getEmailCampaignStats(long emailCampaignId, EmailCampaignStatsFilter filter) Get aggregated performance statistics for an email campaign.resetEmailCampaign(long emailCampaignId) Reset ascheduledcampaign back to thedraftstate.scheduleEmailCampaign(long emailCampaignId, ScheduleEmailCampaignRequest request) Schedule adraftcampaign to start sending at a future time.startEmailCampaign(long emailCampaignId) Start sending adraftcampaign immediately.terminateEmailCampaign(long emailCampaignId) Terminate a campaign that is currently sending (started,queuedorpaused), aborting the in-flight send.updateEmailCampaign(long emailCampaignId, UpdateEmailCampaign request) Update an existingdraftemail campaign.
-
Constructor Details
-
EmailCampaignsImpl
-
-
Method Details
-
getEmailCampaigns
Description copied from interface:EmailCampaignsList the account's email campaigns, newest first.- Specified by:
getEmailCampaignsin interfaceEmailCampaigns- Parameters:
filter- filtering and pagination parameters;nullfor the first page with API defaults- Returns:
- a page of campaigns and the pagination metadata
-
createEmailCampaign
Description copied from interface:EmailCampaignsCreate a new email campaign in thedraftstate.- Specified by:
createEmailCampaignin interfaceEmailCampaigns- Parameters:
request- the campaign attributes (name,domainId,fromLocalPartand a templatesubjectare required)- Returns:
- the created email campaign
-
getEmailCampaign
Description copied from interface:EmailCampaignsGet a single email campaign by ID.- Specified by:
getEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID- Returns:
- the email campaign
-
updateEmailCampaign
Description copied from interface:EmailCampaignsUpdate an existingdraftemail campaign. Only the provided attributes are changed.- Specified by:
updateEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign IDrequest- the attributes to update- Returns:
- the updated email campaign
-
deleteEmailCampaign
public void deleteEmailCampaign(long emailCampaignId) Description copied from interface:EmailCampaignsDelete an email campaign. Only a campaign in thedraftstate can be deleted.- Specified by:
deleteEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID
-
startEmailCampaign
Description copied from interface:EmailCampaignsStart sending adraftcampaign immediately.- Specified by:
startEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID- Returns:
- the started email campaign
-
scheduleEmailCampaign
public EmailCampaignResponse scheduleEmailCampaign(long emailCampaignId, ScheduleEmailCampaignRequest request) Description copied from interface:EmailCampaignsSchedule adraftcampaign to start sending at a future time. The scheduled time is reported back incurrentStateMetadata.scheduledAt.- Specified by:
scheduleEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign IDrequest- when to start sending the campaign- Returns:
- the scheduled email campaign
-
cancelEmailCampaign
Description copied from interface:EmailCampaignsCancel ascheduledcampaign, returning it to thedraftstate.- Specified by:
cancelEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID- Returns:
- the cancelled email campaign
-
terminateEmailCampaign
Description copied from interface:EmailCampaignsTerminate a campaign that is currently sending (started,queuedorpaused), aborting the in-flight send.- Specified by:
terminateEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID- Returns:
- the terminated email campaign
-
resetEmailCampaign
Description copied from interface:EmailCampaignsReset ascheduledcampaign back to thedraftstate.- Specified by:
resetEmailCampaignin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign ID- Returns:
- the reset email campaign
-
getEmailCampaignStats
public EmailCampaignStatsResponse getEmailCampaignStats(long emailCampaignId, EmailCampaignStatsFilter filter) Description copied from interface:EmailCampaignsGet aggregated performance statistics for an email campaign. If the campaign has never been started, all counts and rates are returned as0.- Specified by:
getEmailCampaignStatsin interfaceEmailCampaigns- Parameters:
emailCampaignId- unique email campaign IDfilter- aggregation window;nullfor the whole period since the campaign was last started- Returns:
- aggregated campaign statistics
-