using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model; public class UserInfo { /// /// Defines if the user is enabled. /// public bool Enabled { get; init; } /// /// The location of the user's storage directory. /// public string? StorageLocation { get; init; } /// /// The uniquie user id that infos are for. /// public string? ID { get; init; } /// /// The last time when the user has logged in to its account. /// public DateTime LastLogin { get; init; } /// /// The backend of the user. Common values are "Database" or "LDAP". /// public string? Backend { get; init; } /// /// The Email address of the user. /// public string? Email { get; init; } /// /// The displayname of the user. /// public string? Displayname { get; init; } /// /// The displayname of the user. /// public string? Displayname2 { get; init; } /// /// The phone number of the user. /// public string? Phone { get; init; } /// /// The address of the user. /// public string? Address { get; init; } /// /// The Website of the user. /// public string? Website { get; init; } /// /// The twitter profile name of the user. /// public string? Twitter { get; init; } /// /// Defines the groups the user is member of. /// public string[] Groups { get; init; } /// /// The configured language of the user. /// public string? Language { get; init; } /// /// The configured location of the user. /// public string? Locale { get; init; } /// /// Quota informations for the user. /// public UserQuota Quota { get; } = new(); /// /// Backend capabilities of the user. /// public UserBackendCapabilities BackendCapabilities { get; } = new(); public UserInfo(OcsResponseDataUser responseData) { Enabled = Convert.ToBoolean(responseData.Enabled); StorageLocation = responseData.StorageLocation; ID = responseData.ID; LastLogin = responseData.LastLogin.UnixTimeMillisecondsToDateTime(); Backend = responseData.Backend; Email = responseData.Email; Displayname = responseData.Displayname; Displayname2 = responseData.Displayname2; Phone = responseData.Phone; Address = responseData.Address; Website = responseData.Website; Twitter = responseData.Twitter; Groups = responseData.Groups ?? Array.Empty(); Language = responseData.Language; Locale = responseData.Locale; if (responseData.Quota != null) { Quota.Free = responseData.Quota.Free ?? 0; Quota.Used = responseData.Quota.Used ?? 0; Quota.Total = responseData.Quota.Total ?? 0; Quota.Relative = responseData.Quota.Relative ?? 0.0F; Quota.Quota = responseData.Quota.Quota ?? 0; } if (responseData.BackendCapabilities != null) { BackendCapabilities.SetDisplayName = Convert.ToBoolean(responseData.BackendCapabilities.SetDisplayName); BackendCapabilities.SetPassword = Convert.ToBoolean(responseData.BackendCapabilities.SetPassword); } } }