Implementation
factory Project.fromMap(
Map<String, dynamic> map,
) {
map = {
'\$id': "",
'\$createdAt': "",
'\$updatedAt': "",
'name': "",
'teamId': "",
'region': "fra",
'smtpEnabled': false,
'smtpSenderName': "",
'smtpSenderEmail': "",
'smtpReplyToName': "",
'smtpReplyToEmail': "",
'smtpHost': "",
'smtpPort': 0,
'smtpUsername': "",
'smtpPassword': "",
'smtpSecure': "",
'ldapEnabled': false,
'ldapHosts': [],
'ldapPort': 636,
'ldapEncryption': "ldaps",
'ldapVerification': true,
'ldapCertificate': "",
'ldapTimeout': 10,
'ldapBaseDn': "",
'ldapBindDn': "",
'ldapBindPassword': "",
'ldapUserFilter': "(uid={username})",
'ldapRequiredGroupDn': "",
'ldapIdAttribute': "entryUUID",
'ldapEmailAttribute': "mail",
'ldapNameAttribute': "cn",
'ldapPhoneAttribute': "",
'pingCount': 0,
'pingedAt': "",
'labels': [],
'status': "active",
'onboarding': <String, dynamic>{},
'authMethods': [],
'services': [],
'protocols': [],
'blocks': [],
'consoleAccessedAt': "",
...map,
};
return Project(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
name: map['name'].toString(),
teamId: map['teamId'].toString(),
region: map['region'].toString(),
smtpEnabled: map['smtpEnabled'],
smtpSenderName: map['smtpSenderName'].toString(),
smtpSenderEmail: map['smtpSenderEmail'].toString(),
smtpReplyToName: map['smtpReplyToName'].toString(),
smtpReplyToEmail: map['smtpReplyToEmail'].toString(),
smtpHost: map['smtpHost'].toString(),
smtpPort: map['smtpPort'],
smtpUsername: map['smtpUsername'].toString(),
smtpPassword: map['smtpPassword'].toString(),
smtpSecure: map['smtpSecure'].toString(),
ldapEnabled: map['ldapEnabled'],
ldapHosts: List.from(map['ldapHosts'] ?? []),
ldapPort: map['ldapPort'],
ldapEncryption: map['ldapEncryption'].toString(),
ldapVerification: map['ldapVerification'],
ldapCertificate: map['ldapCertificate'].toString(),
ldapTimeout: map['ldapTimeout'],
ldapBaseDn: map['ldapBaseDn'].toString(),
ldapBindDn: map['ldapBindDn'].toString(),
ldapBindPassword: map['ldapBindPassword'].toString(),
ldapUserFilter: map['ldapUserFilter'].toString(),
ldapRequiredGroupDn: map['ldapRequiredGroupDn'].toString(),
ldapIdAttribute: map['ldapIdAttribute'].toString(),
ldapEmailAttribute: map['ldapEmailAttribute'].toString(),
ldapNameAttribute: map['ldapNameAttribute'].toString(),
ldapPhoneAttribute: map['ldapPhoneAttribute'].toString(),
pingCount: map['pingCount'],
pingedAt: map['pingedAt'].toString(),
labels: List.from(map['labels'] ?? []),
prefs: map['prefs'] != null
? Preferences.fromMap(
map['prefs'],
)
: null,
status: map['status'].toString(),
onboarding: map['onboarding'],
authMethods: List<ProjectAuthMethod>.from(
map['authMethods'].map((p) => ProjectAuthMethod.fromMap(p)),
),
services: List<ProjectService>.from(
map['services'].map((p) => ProjectService.fromMap(p)),
),
protocols: List<ProjectProtocol>.from(
map['protocols'].map((p) => ProjectProtocol.fromMap(p)),
),
blocks: List<Block>.from(
map['blocks'].map((p) => Block.fromMap(p)),
),
consoleAccessedAt: map['consoleAccessedAt'].toString(),
wafEnabled: map['wafEnabled'],
parentId: map['parentId']?.toString(),
environmentId: map['environmentId']?.toString(),
billingLimits: map['billingLimits'] != null
? BillingLimits.fromMap(
map['billingLimits'],
)
: null,
firstAccessedAt: map['firstAccessedAt']?.toString(),
mcpAccessedAt: map['mcpAccessedAt']?.toString(),
oAuth2ServerEnabled: map['oAuth2ServerEnabled'],
oAuth2ServerAuthorizationUrl:
map['oAuth2ServerAuthorizationUrl']?.toString(),
oAuth2ServerScopes: List.from(map['oAuth2ServerScopes'] ?? []),
oAuth2ServerDefaultScopes:
List.from(map['oAuth2ServerDefaultScopes'] ?? []),
oAuth2ServerInstallationScopes:
List.from(map['oAuth2ServerInstallationScopes'] ?? []),
oAuth2ServerAuthorizationDetailsTypes:
List.from(map['oAuth2ServerAuthorizationDetailsTypes'] ?? []),
oAuth2ServerAccessTokenDuration: map['oAuth2ServerAccessTokenDuration'],
oAuth2ServerRefreshTokenDuration: map['oAuth2ServerRefreshTokenDuration'],
oAuth2ServerPublicAccessTokenDuration:
map['oAuth2ServerPublicAccessTokenDuration'],
oAuth2ServerPublicRefreshTokenDuration:
map['oAuth2ServerPublicRefreshTokenDuration'],
oAuth2ServerInstallationAccessTokenDuration:
map['oAuth2ServerInstallationAccessTokenDuration'],
oAuth2ServerConfidentialPkce: map['oAuth2ServerConfidentialPkce'],
oAuth2ServerVerificationUrl:
map['oAuth2ServerVerificationUrl']?.toString(),
oAuth2ServerUserCodeLength: map['oAuth2ServerUserCodeLength'],
oAuth2ServerUserCodeFormat: map['oAuth2ServerUserCodeFormat']?.toString(),
oAuth2ServerDeviceCodeDuration: map['oAuth2ServerDeviceCodeDuration'],
oAuth2ServerDiscoveryUrl: map['oAuth2ServerDiscoveryUrl']?.toString(),
);
}