fixes for Nextcloud

This commit is contained in:
2023-10-02 15:25:16 +02:00
parent c7f5de4974
commit b2ef1e5cce
21 changed files with 233 additions and 101 deletions

View File

@@ -8,46 +8,20 @@ using System.Threading.Tasks;
namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Apps.FilesRetention
{
public class RetentionRule
public class RetentionRule : RetentionRuleInfo
{
/// <summary>
/// The ID for the retention rule.
/// </summary>
public int ID { get; init; }
/// <summary>
/// The ID for the tag that is used for this rule.
/// </summary>
public int TagID { get; init; }
/// <summary>
/// The unit used for the time.
/// </summary>
public RetentionTimeUnit TimeUnit { get; init; }
/// <summary>
/// Represents numer of days/weeks/months/years.
/// </summary>
public int TimeAmount { get; init; }
/// <summary>
/// The time used for the rule.
/// </summary>
public RetentionTimeAfter TimeAfter { get; init; }
/// <summary>
/// Defines if a background job has been generated
/// </summary>
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
};
}
}
}

View File

@@ -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
{
/// <summary>
/// The ID for the tag that is used for this rule.
/// </summary>
public int TagID { get; init; }
/// <summary>
/// The unit used for the time.
/// </summary>
public RetentionTimeUnit TimeUnit { get; init; }
/// <summary>
/// Represents numer of days/weeks/months/years.
/// </summary>
public int TimeAmount { get; init; }
/// <summary>
/// The time used for the rule.
/// </summary>
public RetentionTimeAfter TimeAfter { get; init; }
public OcsDataRetentionRule ToOcsData()
{
return new OcsDataRetentionRule
{
TagID = TagID,
TimeUnit = (int)TimeUnit,
TimeAmount = TimeAmount,
TimeAfter = (int)TimeAfter
};
}
}
}

View File

@@ -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;

View File

@@ -12,17 +12,17 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud
/// <summary>
/// Amount of free bytes left.
/// </summary>
public ulong Free { get; set; }
public long Free { get; set; }
/// <summary>
/// Amount of already used bytes.
/// </summary>
public ulong Used { get; set; }
public long Used { get; set; }
/// <summary>
/// Total amount of all bytes (free + used).
/// </summary>
public ulong Total { get; set; }
public long Total { get; set; }
/// <summary>
/// Relative amount of used quota in percent.
@@ -32,6 +32,6 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud
/// <summary>
/// Total amount of bytes available.
/// </summary>
public ulong Quota { get; set; }
public long Quota { get; set; }
}
}