Files
hcs/Hcs.Client/Client/Api/OrgRegistryCommonApi.cs

34 lines
1.2 KiB
C#

using Hcs.Client.Api.Request.Exception;
using Hcs.Client.Api.Request.OrgRegistryCommon;
using Hcs.Service.Async.OrgRegistryCommon;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Hcs.Client.Api
{
// http://open-gkh.ru/OrganizationsRegistryCommonAsyncService/
public class OrgRegistryCommonApi(ClientBase client) : ApiBase(client)
{
/// <summary>
/// Возвращает сведения из реестра организаций
/// </summary>
/// <param name="ogrn">ОГРН</param>
/// <param name="kpp">КПП</param>
/// <param name="token">Токен отмены</param>
/// <returns>Сведения из реестра организаций</returns>
public async Task<IEnumerable<exportOrgRegistryResultType>> ExportOrgRegistryAsync(string ogrn, string kpp, CancellationToken token = default)
{
try
{
var request = new ExportOrgRegistryRequest(client);
return await request.ExecuteAsync(ogrn, kpp, token);
}
catch (NoResultsRemoteException)
{
return [];
}
}
}
}