huge work for nextcloud api

This commit is contained in:
2023-10-01 16:51:10 +02:00
parent c87c117c94
commit 16ca4ecbb6
27 changed files with 472 additions and 87 deletions

View File

@@ -0,0 +1,73 @@
using Pilz.Networking.CloudProviders.Nextcloud.OCS.Data.Apps.FileRetention;
using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses.Apps.FilesRetention;
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 RetentionRule
{
/// <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)
{
ID = iD;
TagID = tagID;
TimeUnit = timeUnit;
TimeAmount = timeAmount;
TimeAfter = timeAfter;
HasJob = hasJob;
}
public RetentionRule(OcsResponseDataEntryRetention data)
{
ID = data.ID ?? -1;
TagID = data.TagID ?? -1;
TimeUnit = (RetentionTimeUnit)(data.TimeUnit ?? 0);
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,14 @@
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 enum RetentionTimeAfter
{
CreationDate,
LastAccess
}
}

View File

@@ -0,0 +1,16 @@
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 enum RetentionTimeUnit
{
Day,
Week,
Month,
Year
}
}

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.Networking.CloudProviders.Nextcloud.Model
namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud
{
public class UserBackendCapabilities
{

View File

@@ -5,84 +5,84 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.Networking.CloudProviders.Nextcloud.Model
namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud
{
public class UserInfo
{
/// <summary>
/// Defines if the user is enabled.
/// </summary>
public bool Enabled { get; set; }
public bool Enabled { get; init; }
/// <summary>
/// The location of the user's storage directory.
/// </summary>
public string? StorageLocation { get; set; }
public string? StorageLocation { get; init; }
/// <summary>
/// The uniquie user id that infos are for.
/// </summary>
public string? ID { get; set; }
public string? ID { get; init; }
/// <summary>
/// The last time when the user has logged in to its account.
/// </summary>
public DateTime LastLogin { get; set; }
public DateTime LastLogin { get; init; }
/// <summary>
/// The backend of the user. Common values are "Database" or "LDAP".
/// </summary>
public string? Backend { get; set; }
public string? Backend { get; init; }
/// <summary>
/// The Email address of the user.
/// </summary>
public string? Email { get; set; }
public string? Email { get; init; }
/// <summary>
/// The displayname of the user.
/// </summary>
public string? Displayname { get; set; }
public string? Displayname { get; init; }
/// <summary>
/// The displayname of the user.
/// </summary>
public string? Displayname2 { get; set; }
public string? Displayname2 { get; init; }
/// <summary>
/// The phone number of the user.
/// </summary>
public string? Phone { get; set; }
public string? Phone { get; init; }
/// <summary>
/// The address of the user.
/// </summary>
public string? Address { get; set; }
public string? Address { get; init; }
/// <summary>
/// The Website of the user.
/// </summary>
public string? Website { get; set; }
public string? Website { get; init; }
/// <summary>
/// The twitter profile name of the user.
/// </summary>
public string? Twitter { get; set; }
public string? Twitter { get; init; }
/// <summary>
/// Defines the groups the user is member of.
/// </summary>
public string[] Groups { get; set; }
public string[] Groups { get; init; }
/// <summary>
/// The configured language of the user.
/// </summary>
public string? Language { get; set; }
public string? Language { get; init; }
/// <summary>
/// The configured location of the user.
/// </summary>
public string? Locale { get; set; }
public string? Locale { get; init; }
/// <summary>
/// Quota informations for the user.

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.Networking.CloudProviders.Nextcloud.Model
namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud
{
public class UserQuota
{