2023-03-26 13:47:18 +00:00
|
|
|
|
using System;
|
2022-12-21 19:23:48 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-03-26 13:47:18 +00:00
|
|
|
|
using Export;
|
2022-12-21 19:23:48 +00:00
|
|
|
|
|
2023-03-30 20:01:43 +00:00
|
|
|
|
namespace Pal.Client.Net;
|
|
|
|
|
|
|
|
|
|
internal partial class RemoteApi
|
2022-12-21 19:23:48 +00:00
|
|
|
|
{
|
2023-03-30 20:01:43 +00:00
|
|
|
|
public async Task<(bool, ExportRoot)> DoExport(CancellationToken cancellationToken = default)
|
2022-12-21 19:23:48 +00:00
|
|
|
|
{
|
2023-03-30 20:01:43 +00:00
|
|
|
|
if (!await Connect(cancellationToken))
|
|
|
|
|
return new(false, new());
|
2022-12-21 19:23:48 +00:00
|
|
|
|
|
2023-03-30 20:01:43 +00:00
|
|
|
|
var exportClient = new ExportService.ExportServiceClient(_channel);
|
|
|
|
|
var exportReply = await exportClient.ExportAsync(new ExportRequest
|
2023-10-03 20:05:19 +00:00
|
|
|
|
{
|
|
|
|
|
ServerUrl = RemoteUrl,
|
|
|
|
|
}, headers: AuthorizedHeaders(), deadline: DateTime.UtcNow.AddSeconds(120),
|
|
|
|
|
cancellationToken: cancellationToken);
|
2023-03-30 20:01:43 +00:00
|
|
|
|
return (exportReply.Success, exportReply.Data);
|
2022-12-21 19:23:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|