TaskOptions constructor

TaskOptions({
  1. DeliverySchedule? schedule,
  2. int? dispatchDeadlineSeconds,
  3. String? id,
  4. Map<String, String>? headers,
  5. TaskOptionsExperimental? experimental,
})

Creates task options with the specified configuration.

Implementation

TaskOptions({
  this.schedule,
  this.dispatchDeadlineSeconds,
  this.id,
  this.headers,
  this.experimental,
}) {
  // Validate dispatchDeadlineSeconds range
  if (dispatchDeadlineSeconds != null &&
      (dispatchDeadlineSeconds! < 15 || dispatchDeadlineSeconds! > 1800)) {
    throw FirebaseFunctionsAdminException(
      FunctionsClientErrorCode.invalidArgument,
      'dispatchDeadlineSeconds must be between 15 and 1800 seconds.',
    );
  }

  // Validate task ID format
  if (id != null && !isValidTaskId(id)) {
    throw FirebaseFunctionsAdminException(
      FunctionsClientErrorCode.invalidArgument,
      'id can contain only letters ([A-Za-z]), numbers ([0-9]), '
      'hyphens (-), or underscores (_). The maximum length is 500 characters.',
    );
  }
}