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,34 @@
using Pilz.Networking.CloudProviders.Nextcloud.Model.Cloud;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.Networking.CloudProviders.Nextcloud.Client
{
public class CloudClient : ClientBase
{
public CloudClient(NextcloudClient client) : base(client)
{
}
public Task<UserInfo?> GetUserInfo()
{
if (!string.IsNullOrEmpty(Client.CurrentLogin?.LoginName))
return GetUserInfo(Client.CurrentLogin.LoginName);
else
return Task.FromResult<UserInfo?>(null);
}
public async Task<UserInfo?> GetUserInfo(string username)
{
var result = await Client.Ocs.Cloud.GetUserMeta(username);
if (result?.Data != null)
return new UserInfo(result.Data);
return null;
}
}
}