diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/FilesRetentionClient.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/FilesRetentionClient.cs index e258a45..ff9eb8c 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/FilesRetentionClient.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/Apps/FilesRetentionClient.cs @@ -14,21 +14,21 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.Apps { } - public Task CreateRetentionRule(RetentionRule rule) + public bool CreateRetentionRule(RetentionRuleInfo rule) { var entry = rule.ToOcsData(); return Client.Ocs.GetApi().CreateRetentionRule(entry); } - public Task DeleteRetentionRule(int ruleID) + public bool DeleteRetentionRule(int ruleID) { return Client.Ocs.GetApi().DeleteRetentionRule(ruleID); } - public async Task GetRetentionRules() + public RetentionRule[]? GetRetentionRules() { var api = Client.Ocs.GetApi(); - var response = await api.GetRetentionRules(); + var response = api.GetRetentionRules(); if (response?.Data is not null) { diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs index 94eb24d..33cd7e0 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/ClientBase.cs @@ -8,7 +8,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client { public abstract class ClientBase { - public NextcloudClient Client { get; init; } + protected NextcloudClient Client { get; init; } public ClientBase(NextcloudClient client) { diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Client/CloudClient.cs b/Pilz.Networking.CloudProviders.Nextcloud/Client/CloudClient.cs index 361e8c7..cc35a5b 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Client/CloudClient.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Client/CloudClient.cs @@ -13,17 +13,17 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client { } - public Task GetUserInfo() + public UserInfo? GetUserInfo() { if (!string.IsNullOrEmpty(Client.CurrentLogin?.LoginName)) return GetUserInfo(Client.CurrentLogin.LoginName); else - return Task.FromResult(null); + return null; } - public async Task GetUserInfo(string username) + public UserInfo? GetUserInfo(string username) { - var result = await Client.Ocs.Cloud.GetUserMeta(username); + var result = Client.Ocs.Cloud.GetUserMeta(username); if (result?.Data != null) return new UserInfo(result.Data); diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRule.cs b/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRule.cs index 088b760..73c81a5 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRule.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRule.cs @@ -8,46 +8,20 @@ using System.Threading.Tasks; namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Apps.FilesRetention { - public class RetentionRule + public class RetentionRule : RetentionRuleInfo { /// /// The ID for the retention rule. /// public int ID { get; init; } - /// - /// The ID for the tag that is used for this rule. - /// - public int TagID { get; init; } - - /// - /// The unit used for the time. - /// - public RetentionTimeUnit TimeUnit { get; init; } - - /// - /// Represents numer of days/weeks/months/years. - /// - public int TimeAmount { get; init; } - - /// - /// The time used for the rule. - /// - public RetentionTimeAfter TimeAfter { get; init; } - /// /// Defines if a background job has been generated /// public bool HasJob { get; init; } - public RetentionRule(int iD, int tagID, RetentionTimeUnit timeUnit, int timeAmount, RetentionTimeAfter timeAfter, bool hasJob) + public RetentionRule() { - ID = iD; - TagID = tagID; - TimeUnit = timeUnit; - TimeAmount = timeAmount; - TimeAfter = timeAfter; - HasJob = hasJob; } public RetentionRule(OcsResponseDataEntryRetention data) @@ -58,16 +32,5 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Apps.FilesRetention TimeAmount = data.TimeAmount ?? -1; TimeAfter = (RetentionTimeAfter)(data.TimeAfter ?? 0); } - - public OcsDataRetentionRule ToOcsData() - { - return new OcsDataRetentionRule - { - TagID = TagID, - TimeUnit = (int)TimeUnit, - TimeAmount = TimeAmount, - TimeAfter = (int)TimeAfter - }; - } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRuleInfo.cs b/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRuleInfo.cs new file mode 100644 index 0000000..d77aa59 --- /dev/null +++ b/Pilz.Networking.CloudProviders.Nextcloud/Model/Apps/FilesRetention/RetentionRuleInfo.cs @@ -0,0 +1,43 @@ +using Pilz.Networking.CloudProviders.Nextcloud.OCS.Data.Apps.FileRetention; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Apps.FilesRetention +{ + public class RetentionRuleInfo + { + /// + /// The ID for the tag that is used for this rule. + /// + public int TagID { get; init; } + + /// + /// The unit used for the time. + /// + public RetentionTimeUnit TimeUnit { get; init; } + + /// + /// Represents numer of days/weeks/months/years. + /// + public int TimeAmount { get; init; } + + /// + /// The time used for the rule. + /// + public RetentionTimeAfter TimeAfter { get; init; } + + public OcsDataRetentionRule ToOcsData() + { + return new OcsDataRetentionRule + { + TagID = TagID, + TimeUnit = (int)TimeUnit, + TimeAmount = TimeAmount, + TimeAfter = (int)TimeAfter + }; + } + } +} diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserInfo.cs b/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserInfo.cs index 30d2e3d..d003a5c 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserInfo.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserInfo.cs @@ -99,7 +99,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud Enabled = Convert.ToBoolean(responseData.Enabled); StorageLocation = responseData.StorageLocation; ID = responseData.ID; - LastLogin = Convert.ToDateTime(responseData.LastLogin); + LastLogin = DateTimeOffset.FromUnixTimeMilliseconds(responseData.LastLogin ?? 0).LocalDateTime; Backend = responseData.Backend; Email = responseData.Email; Displayname = responseData.Displayname; diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserQuota.cs b/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserQuota.cs index 921092a..fb711ea 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserQuota.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/Model/Cloud/UserQuota.cs @@ -12,17 +12,17 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud /// /// Amount of free bytes left. /// - public ulong Free { get; set; } + public long Free { get; set; } /// /// Amount of already used bytes. /// - public ulong Used { get; set; } + public long Used { get; set; } /// /// Total amount of all bytes (free + used). /// - public ulong Total { get; set; } + public long Total { get; set; } /// /// Relative amount of used quota in percent. @@ -32,6 +32,6 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud /// /// Total amount of bytes available. /// - public ulong Quota { get; set; } + public long Quota { get; set; } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/NextcloudClient.cs b/Pilz.Networking.CloudProviders.Nextcloud/NextcloudClient.cs index dae0f21..a0be030 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/NextcloudClient.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/NextcloudClient.cs @@ -17,9 +17,19 @@ namespace Pilz.Networking.CloudProviders.Nextcloud public class NextcloudClient : IDisposable { private readonly List clients = new(); + private NextcloudLogin? currentLogin; public OcsApi Ocs { get; init; } = new(); - public NextcloudLogin? CurrentLogin { get; private set; } + + public NextcloudLogin? CurrentLogin + { + get => currentLogin; + private set + { + currentLogin = value; + Ocs.BaseUrl = value?.Server ?? string.Empty; + } + } public CloudClient Cloud => GetClient(); @@ -52,16 +62,16 @@ namespace Pilz.Networking.CloudProviders.Nextcloud return instance; } - public async Task Login(NextcloudLogin login) + public UserInfo? Login(NextcloudLogin login) { // Ensure we are logged out - await Logout(); + Logout(false); // Temporary set user login CurrentLogin = login; // Try get user info & check if user is enabled - var userInfo = await Cloud.GetUserInfo(); + var userInfo = Cloud.GetUserInfo(); var isValid = userInfo != null && userInfo.Enabled; // If invalid, reset login credentials @@ -71,13 +81,13 @@ namespace Pilz.Networking.CloudProviders.Nextcloud return userInfo; } - public async Task Login(string baseUrl, CancellationToken cancellationToken) + public NextcloudLogin? Login(string baseUrl, CancellationToken cancellationToken) { // Ensure we are logged out - await Logout(); + Logout(false); // Init the login process - var initResponse = await Ocs.LoginFlowV2.Init(baseUrl); + var initResponse = Ocs.LoginFlowV2.Init(baseUrl); if (!string.IsNullOrEmpty(initResponse?.LoginUrl) && initResponse.Poll != null) { @@ -97,7 +107,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud // Poll the credentials if (!cancellationToken.IsCancellationRequested) - pollResponse = await Ocs.LoginFlowV2.Poll(initResponse.Poll); + pollResponse = Ocs.LoginFlowV2.Poll(initResponse.Poll); } // Check login credentials @@ -108,18 +118,18 @@ namespace Pilz.Networking.CloudProviders.Nextcloud return CurrentLogin; } - public Task Logout() + public void Logout() { - return Logout(true); + Logout(true); } - public async Task Logout(bool logoutOnServer) + public void Logout(bool logoutOnServer) { if (CurrentLogin != null) { // Delete currently used app password if (logoutOnServer) - await Ocs.Core.DeleteAppPassword(); + Ocs.Core.DeleteAppPassword(); // Reset current login infos CurrentLogin = null; diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/Apps/OcsApiFilesRetention.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/Apps/OcsApiFilesRetention.cs index 7897bf2..4a50eb3 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/Apps/OcsApiFilesRetention.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/Apps/OcsApiFilesRetention.cs @@ -19,21 +19,21 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs.Apps { } - public async Task CreateRetentionRule(OcsDataRetentionRule rule) + public bool CreateRetentionRule(OcsDataRetentionRule rule) { - var response = await Manager.MakeRequest(HttpMethod.Post, OCS_FILE_RETENTION_RULES, content: rule); + var response = Manager.MakeRequest(HttpMethod.Post, OCS_FILE_RETENTION_RULES, content: rule); return response.IsSuccessStatusCode; } - public async Task DeleteRetentionRule(int ruleID) + public bool DeleteRetentionRule(int ruleID) { - var response = await Manager.MakeRequest(HttpMethod.Delete, OCS_FILE_RETENTION_RULE.FillParameters(ruleID)); + var response = Manager.MakeRequest(HttpMethod.Delete, OCS_FILE_RETENTION_RULE.FillParameters(ruleID)); return response.IsSuccessStatusCode; } - public Task GetRetentionRules() + public OcsResponseRetention? GetRetentionRules() { - return Manager.MakeRequest(HttpMethod.Get, OCS_FILE_RETENTION_RULES); + return Manager.MakeRequestOcs(HttpMethod.Get, OCS_FILE_RETENTION_RULES); } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiBase.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiBase.cs index a0ec4ed..d1d9952 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiBase.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiBase.cs @@ -8,7 +8,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs { public abstract class OcsApiBase { - public OcsApi Manager { get; init; } + protected OcsApi Manager { get; init; } protected OcsApiBase(OcsApi manager) { diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCloud.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCloud.cs index 1f32186..d74fcd8 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCloud.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCloud.cs @@ -15,9 +15,9 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs { } - public Task GetUserMeta(string username) + public OcsResponseUser? GetUserMeta(string username) { - return Manager.MakeRequest(HttpMethod.Get, OCS_CLOUD_USER_METADATA.FillParameters(username)); + return Manager.MakeRequestOcs(HttpMethod.Get, OCS_CLOUD_USER_METADATA.FillParameters(username)); } } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCore.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCore.cs index 2c53cbe..2ed8e33 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCore.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiCore.cs @@ -14,9 +14,9 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs { } - public async Task DeleteAppPassword() + public bool DeleteAppPassword() { - using var msg = await Manager.MakeRequest(HttpMethod.Delete, OCS_CORE_APPPASSWORD); + using var msg = Manager.MakeRequest(HttpMethod.Delete, OCS_CORE_APPPASSWORD); return msg != null && msg.IsSuccessStatusCode; } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiLoginFlowV2.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiLoginFlowV2.cs index 824dc4b..62d27ee 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiLoginFlowV2.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/APIs/OcsApiLoginFlowV2.cs @@ -15,12 +15,12 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs { } - public Task Init(string url) + public OcsResponseLoginFlowV2? Init(string url) { return Manager.MakeRequest(HttpMethod.Get, url + OCS_LOGIN_INIT); } - public Task Poll(OcsResponseLoginFlowV2.PollData poll) + public OcsResponseLoginFlowV2Credentials? Poll(OcsResponseLoginFlowV2.PollData poll) { ArgumentNullException.ThrowIfNull(poll?.Endpoint); ArgumentNullException.ThrowIfNull(poll?.Token); diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApi.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApi.cs index 43091a0..9007d46 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApi.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApi.cs @@ -10,6 +10,8 @@ using System.Net; using Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs; using System.Net.Sockets; using Pilz.Networking.CloudProviders.Nextcloud.OCS.Data; +using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses; +using System.Xml.Linq; namespace Pilz.Networking.CloudProviders.Nextcloud.OCS { @@ -51,30 +53,103 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS return BaseUrl + path; } - public Task MakeRequest(HttpMethod httpMethod, OcsApiUrlPath url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) + /// + /// Makes an request with the given arguments and deserialize it to the given type. + /// + /// + /// + /// + /// + /// + /// + /// Returns the given OcsResponse type from the deserialized OcsApiResponse content. + public TResponse? MakeRequestOcs(HttpMethod httpMethod, OcsApiUrlPath url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) where TResponse : IOcsResponse + { + return MakeRequestOcs(httpMethod, BuildFullUrl(url), useAuthentication: useAuthentication, parameters: parameters, content: content); + } + + /// + /// Makes an request with the given arguments and deserialize it to the given type. + /// + /// + /// + /// + /// + /// + /// + /// Returns the given OcsResponse type from the deserialized OcsApiResponse content. + public TResponse? MakeRequestOcs(HttpMethod httpMethod, string url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) where TResponse : IOcsResponse + { + var response = MakeRequest?>(httpMethod, url, useAuthentication: useAuthentication, parameters: parameters, content: content); + + if (response != null) + return response.Ocs; + + return default; + } + + /// + /// Makes an request with the given arguments and deserialize it to the given type. + /// + /// + /// + /// + /// + /// + /// + /// Returns the deserialized content of type given type. + public TResponse? MakeRequest(HttpMethod httpMethod, OcsApiUrlPath url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) { return MakeRequest(httpMethod, BuildFullUrl(url), useAuthentication: useAuthentication, parameters: parameters, content: content); } - public Task MakeRequest(HttpMethod httpMethod, OcsApiUrlPath url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) + /// + /// Makes an request with the given arguments and deserialize it to the given type. + /// + /// + /// + /// + /// + /// + /// + /// Returns the deserialized content of type given type. + public TResponse? MakeRequest(HttpMethod httpMethod, string url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) { - return MakeRequest(httpMethod, BuildFullUrl(url), useAuthentication: useAuthentication, parameters: parameters, content: content); - } - - public async Task MakeRequest(HttpMethod httpMethod, string url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) - { - using var responseInit = await MakeRequest(httpMethod, url, useAuthentication: useAuthentication, parameters: parameters, content: content); + using var responseInit = MakeRequest(httpMethod, url, useAuthentication: useAuthentication, parameters: parameters, content: content); if (responseInit != null) { - var bodyInit = await responseInit.Content.ReadAsStringAsync(); + var bodyInit = responseInit.Content.ReadAsStringAsync().Result; return JsonConvert.DeserializeObject(bodyInit); } return default; } - public async Task MakeRequest(HttpMethod httpMethod, string url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) + /// + /// Makes an request with the given arguments. + /// + /// + /// + /// + /// + /// + /// Returns a HttpResponseMessage as result. + public HttpResponseMessage MakeRequest(HttpMethod httpMethod, OcsApiUrlPath url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) + { + return MakeRequest(httpMethod, BuildFullUrl(url), useAuthentication: useAuthentication, parameters: parameters, content: content); + } + + /// + /// Makes an request with the given arguments. + /// + /// + /// + /// + /// + /// + /// Returns a HttpResponseMessage as result. + public HttpResponseMessage MakeRequest(HttpMethod httpMethod, string url, bool useAuthentication = true, Dictionary? parameters = null, object? content = null) { OcsApiAuthCredentials? authentication; string @params; @@ -118,7 +193,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS Content = httpContent }; - return await client.SendAsync(request); + return client.Send(request); } public void Dispose() diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApiResponse.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApiResponse.cs new file mode 100644 index 0000000..4189d18 --- /dev/null +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/OcsApiResponse.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; +using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace Pilz.Networking.CloudProviders.Nextcloud.OCS +{ + public class OcsApiResponse where TOcsResponse : IOcsResponse + { + [JsonProperty("ocs")] + public TOcsResponse? Ocs { get; set; } + } +} diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/Cloud/OcsResponseDataUser.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/Cloud/OcsResponseDataUser.cs index 0000713..331be95 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/Cloud/OcsResponseDataUser.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/Cloud/OcsResponseDataUser.cs @@ -12,32 +12,32 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses.Cloud public class ResponseQuota { [JsonProperty("free")] - public ulong? Free { get; set; } + public long? Free { get; set; } [JsonProperty("used")] - public ulong? Used { get; set; } + public long? Used { get; set; } [JsonProperty("total")] - public ulong? Total { get; set; } + public long? Total { get; set; } [JsonProperty("relative")] public float? Relative { get; set; } [JsonProperty("quota")] - public ulong? Quota { get; set; } + public long? Quota { get; set; } } public class ResponseBackendCapabilities { [JsonProperty("setDisplayName")] - public int? SetDisplayName { get; set; } + public bool? SetDisplayName { get; set; } [JsonProperty("setPassword")] - public int? SetPassword { get; set; } + public bool? SetPassword { get; set; } } [JsonProperty("enabled")] - public int? Enabled { get; set; } + public bool? Enabled { get; set; } [JsonProperty("storageLocation")] public string? StorageLocation { get; set; } @@ -46,7 +46,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses.Cloud public string? ID { get; set; } [JsonProperty("lastLogin")] - public ulong? LastLogin { get; set; } + public long? LastLogin { get; set; } [JsonProperty("backend")] public string? Backend { get; set; } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponse.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponse.cs new file mode 100644 index 0000000..fda24f6 --- /dev/null +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses +{ + public interface IOcsResponse + { + } +} diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponseMeta.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponseMeta.cs new file mode 100644 index 0000000..54d08e1 --- /dev/null +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/IOcsResponseMeta.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses +{ + public interface IOcsResponseMeta + { + } +} diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponse.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponse.cs index 2003436..4d8154e 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponse.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponse.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses { - public class OcsResponse where TMeta : OcsResponseMeta where TData : IOcsResponseData + public class OcsResponse : IOcsResponse where TMeta : IOcsResponseMeta where TData : IOcsResponseData { [JsonProperty("meta")] public TMeta? Meta { get; set; } @@ -20,7 +20,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses { } - public class OcsResponse : OcsResponse + public class OcsResponse : OcsResponse { } } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponseMeta.cs b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponseMeta.cs index 049eeb7..b3d9c5a 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponseMeta.cs +++ b/Pilz.Networking.CloudProviders.Nextcloud/OCS/Responses/OcsResponseMeta.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses { - public class OcsResponseMeta + public class OcsResponseMeta : IOcsResponseMeta { [JsonProperty("status")] public string? Status { get; set; } diff --git a/Pilz.Networking.CloudProviders.Nextcloud/Pilz.Networking.CloudProviders.Nextcloud.csproj b/Pilz.Networking.CloudProviders.Nextcloud/Pilz.Networking.CloudProviders.Nextcloud.csproj index b280cb9..a0a8ce4 100644 --- a/Pilz.Networking.CloudProviders.Nextcloud/Pilz.Networking.CloudProviders.Nextcloud.csproj +++ b/Pilz.Networking.CloudProviders.Nextcloud/Pilz.Networking.CloudProviders.Nextcloud.csproj @@ -9,7 +9,7 @@ True 1.yyyy.Mdd.Hmm - 1.2023.1001.1650 + 1.2023.1002.1520