Add provide data export
This commit is contained in:
@ -11,7 +11,26 @@ namespace Hcs.Client.Api
|
||||
public class OrgRegistryCommonApi(ClientBase client) : ApiBase(client)
|
||||
{
|
||||
/// <summary>
|
||||
/// Возвращает сведения из реестра организаций
|
||||
/// Экспорт сведений о поставщиках информации ИС
|
||||
/// </summary>
|
||||
/// <param name="isActual">Выгрузить только активных поставщиков данных</param>
|
||||
/// <param name="token">Токен отмены</param>
|
||||
/// <returns>Сведения о поставщиках данных</returns>
|
||||
public async Task<IEnumerable<exportDataProviderResultType>> ExportDataProviderAsync(bool isActual, CancellationToken token = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
var request = new ExportDataProviderRequest(client);
|
||||
return await request.ExecuteAsync(isActual, token);
|
||||
}
|
||||
catch (NoResultsRemoteException)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Экспорт сведений из реестра организаций
|
||||
/// </summary>
|
||||
/// <param name="ogrn">ОГРН</param>
|
||||
/// <param name="kpp">КПП</param>
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
using Hcs.Client.Internal;
|
||||
using Hcs.Service.Async.OrgRegistryCommon;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hcs.Client.Api.Request.OrgRegistryCommon
|
||||
{
|
||||
internal class ExportDataProviderRequest(ClientBase client) : OrgRegistryCommonRequestBase(client)
|
||||
{
|
||||
internal async Task<IEnumerable<exportDataProviderResultType>> ExecuteAsync(bool isActual, CancellationToken token)
|
||||
{
|
||||
// http://open-gkh.ru/OrganizationsRegistryCommon/exportDataProviderRequest.html
|
||||
var request = new exportDataProviderRequest
|
||||
{
|
||||
Id = Constants.SIGNED_XML_ELEMENT_ID,
|
||||
version = "10.0.2.1"
|
||||
};
|
||||
|
||||
if (isActual)
|
||||
{
|
||||
request.IsActual = true;
|
||||
request.IsActualSpecified = true;
|
||||
}
|
||||
|
||||
var result = await SendAndWaitResultAsync(request, async asyncClient =>
|
||||
{
|
||||
var response = await asyncClient.exportDataProviderAsync(CreateRequestHeader(), request);
|
||||
return response.AckRequest.Ack;
|
||||
}, token);
|
||||
|
||||
return result.Items.OfType<exportDataProviderResultType>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,6 +125,7 @@
|
||||
<Compile Include="Client\Api\Request\NsiCommon\ExportNsiItemRequest.cs" />
|
||||
<Compile Include="Client\Api\Request\NsiCommon\NsiCommonRequestBase.cs" />
|
||||
<Compile Include="Client\Api\Request\Nsi\NsiRequestBase.cs" />
|
||||
<Compile Include="Client\Api\Request\OrgRegistryCommon\ExportDataProviderRequest.cs" />
|
||||
<Compile Include="Client\Api\Request\OrgRegistryCommon\ExportOrgRegistryRequest.cs" />
|
||||
<Compile Include="Client\Api\Request\OrgRegistryCommon\OrgRegistryCommonRequestBase.cs" />
|
||||
<Compile Include="Client\Api\Request\PaginationData.cs" />
|
||||
|
||||
Reference in New Issue
Block a user