fixes for Nextcloud
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user