huge work for nextcloud api
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using Pilz.Networking.CloudProviders.Nextcloud.OCS.Data.Apps.FileRetention;
|
||||
using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses;
|
||||
using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses.Apps.FilesRetention;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs.Apps
|
||||
{
|
||||
public class OcsApiFilesRetention : OcsApiBase
|
||||
{
|
||||
public static readonly OcsApiUrlPath OCS_FILE_RETENTION_RULES = new("/ocs/v2.php/apps/files_retention/api/v1/retentions");
|
||||
public static readonly OcsApiUrlPath OCS_FILE_RETENTION_RULE = new("/ocs/v2.php/apps/files_retention/api/v1/retentions/{0}");
|
||||
|
||||
public OcsApiFilesRetention(OcsApi manager) : base(manager)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<bool> CreateRetentionRule(OcsDataRetentionRule rule)
|
||||
{
|
||||
var response = await Manager.MakeRequest(HttpMethod.Put, OCS_FILE_RETENTION_RULES, content: rule);
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteRetentionRule(int ruleID)
|
||||
{
|
||||
var response = await Manager.MakeRequest(HttpMethod.Delete, OCS_FILE_RETENTION_RULE.FillParameters(ruleID));
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
public Task<OcsResponseRetention?> GetRetentionRules()
|
||||
{
|
||||
return Manager.MakeRequest<OcsResponseRetention>(HttpMethod.Get, OCS_FILE_RETENTION_RULES);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs
|
||||
|
||||
public Task<OcsResponseUser?> GetUserMeta(string username)
|
||||
{
|
||||
return Manager.MakeRequestJson<OcsResponseUser>(HttpMethod.Get, OCS_CLOUD_USER_METADATA.FillParameters(username));
|
||||
return Manager.MakeRequest<OcsResponseUser>(HttpMethod.Get, OCS_CLOUD_USER_METADATA.FillParameters(username));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs
|
||||
|
||||
public Task<OcsResponseLoginFlowV2?> Init(string url)
|
||||
{
|
||||
return Manager.MakeRequestJson<OcsResponseLoginFlowV2>(HttpMethod.Get, url + OCS_LOGIN_INIT);
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2>(HttpMethod.Get, url + OCS_LOGIN_INIT);
|
||||
}
|
||||
|
||||
public Task<OcsResponseLoginFlowV2Credentials?> Poll(OcsResponseLoginFlowV2.PollData poll)
|
||||
@@ -25,7 +25,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.OCS.APIs
|
||||
ArgumentNullException.ThrowIfNull(poll?.Endpoint);
|
||||
ArgumentNullException.ThrowIfNull(poll?.Token);
|
||||
|
||||
return Manager.MakeRequestJson<OcsResponseLoginFlowV2Credentials?>(HttpMethod.Get, poll.Endpoint,
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2Credentials?>(HttpMethod.Get, poll.Endpoint,
|
||||
parameters: new Dictionary<string, string>
|
||||
{
|
||||
{ "token", poll.Token }
|
||||
|
||||
Reference in New Issue
Block a user