CreateMailboxRequest.fromJson constructor

CreateMailboxRequest.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CreateMailboxRequest.fromJson(Map<String, dynamic> json) {
  // Use explicit type field from JSON instead of parsing from address string
  final typeStr = json['type'] as String;
  final type = MailboxType.values.firstWhere((e) => e.name == typeStr);

  return CreateMailboxRequest(
    address: parseAddress(json['address'] as String, type: type),
    maxMessages: json['maxMessages'] as int?,
    retentionDays: json['retentionDays'] as int?,
    retentionCount: json['retentionCount'] as int?,
  );
}