sendWithSchedule method
Future<ScheduledJobDto?>
sendWithSchedule(
- String inboxId,
- SendEmailOptions sendEmailOptions, {
- DateTime? sendAtTimestamp,
- int? sendAtNowPlusSeconds,
- bool? validateBeforeEnqueue,
Send email with with delay or schedule
Send an email using a delay. Will place the email onto a scheduler that will then be processed and sent. Use delays to schedule email sending.
Parameters:
-
String inboxId (required): ID of the inbox you want to send the email from
-
SendEmailOptions sendEmailOptions (required):
-
DateTime sendAtTimestamp: Sending timestamp
-
int sendAtNowPlusSeconds: Send after n seconds
-
bool validateBeforeEnqueue: Validate before adding to queue
Implementation
Future<ScheduledJobDto?> sendWithSchedule(String inboxId, SendEmailOptions sendEmailOptions, { DateTime? sendAtTimestamp, int? sendAtNowPlusSeconds, bool? validateBeforeEnqueue, }) async {
final response = await sendWithScheduleWithHttpInfo(inboxId, sendEmailOptions, sendAtTimestamp: sendAtTimestamp, sendAtNowPlusSeconds: sendAtNowPlusSeconds, validateBeforeEnqueue: validateBeforeEnqueue, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ScheduledJobDto',) as ScheduledJobDto;
}
return null;
}