Skip to content

Commit 75972b1

Browse files
committed
Separate IDispatch interface for dispatch methods
1 parent 3534c2f commit 75972b1

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

src/Nest/ElasticClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Nest
1313
/// <summary>
1414
/// ElasticClient is NEST's strongly typed client which exposes fully mapped elasticsearch endpoints
1515
/// </summary>
16-
public partial class ElasticClient : Nest.IElasticClient
16+
public partial class ElasticClient : IElasticClient, IDispatch
1717
{
1818
private readonly IConnectionSettingsValues _connectionSettings;
1919

src/Nest/IDispatch.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Elasticsearch.Net;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Nest
9+
{
10+
public interface IDispatch
11+
{
12+
R Dispatch<D, Q, R>(D descriptor, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch)
13+
where Q : FluentRequestParameters<Q>, new()
14+
where D : IRequest<Q>
15+
where R : BaseResponse;
16+
17+
R Dispatch<D, Q, R>(Func<D, D> selector, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch)
18+
where Q : FluentRequestParameters<Q>, new()
19+
where D : IRequest<Q>, new()
20+
where R : BaseResponse;
21+
22+
Task<I> DispatchAsync<D, Q, R, I>(D descriptor, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch)
23+
where Q : FluentRequestParameters<Q>, new()
24+
where D : IRequest<Q>
25+
where R : BaseResponse, I
26+
where I : IResponse;
27+
28+
Task<I> DispatchAsync<D, Q, R, I>(Func<D, D> selector, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch)
29+
where Q : FluentRequestParameters<Q>, new()
30+
where D : IRequest<Q>, new()
31+
where R : BaseResponse, I
32+
where I : IResponse;
33+
}
34+
}

src/Nest/IElasticClient.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,39 +1767,5 @@ Task<IExistsResponse> SearchExistsAsync<T>(Func<SearchExistsDescriptor<T>, Searc
17671767
ICatResponse<CatSegmentsRecord> CatSegments(ICatSegmentsRequest request);
17681768
Task<ICatResponse<CatSegmentsRecord>> CatSegmentsAsync(Func<CatSegmentsDescriptor, CatSegmentsDescriptor> selector = null);
17691769
Task<ICatResponse<CatSegmentsRecord>> CatSegmentsAsync(ICatSegmentsRequest request);
1770-
1771-
R Dispatch<D, Q, R>(
1772-
D descriptor
1773-
, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch
1774-
)
1775-
where Q : FluentRequestParameters<Q>, new()
1776-
where D : IRequest<Q>
1777-
where R : BaseResponse;
1778-
1779-
R Dispatch<D, Q, R>(
1780-
Func<D, D> selector
1781-
, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch
1782-
)
1783-
where Q : FluentRequestParameters<Q>, new()
1784-
where D : IRequest<Q>, new()
1785-
where R : BaseResponse;
1786-
1787-
Task<I> DispatchAsync<D, Q, R, I>(
1788-
D descriptor
1789-
, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch
1790-
)
1791-
where Q : FluentRequestParameters<Q>, new()
1792-
where D : IRequest<Q>
1793-
where R : BaseResponse, I
1794-
where I : IResponse;
1795-
1796-
Task<I> DispatchAsync<D, Q, R, I>(
1797-
Func<D, D> selector
1798-
, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch
1799-
)
1800-
where Q : FluentRequestParameters<Q>, new()
1801-
where D : IRequest<Q>, new()
1802-
where R : BaseResponse, I
1803-
where I : IResponse;
18041770
}
18051771
}

src/Nest/Nest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@
410410
<Compile Include="Exception\SnapshotException.cs" />
411411
<Compile Include="ExposedInternals\NestSerializer.cs" />
412412
<Compile Include="Enums\GeoDistance.cs" />
413+
<Compile Include="IDispatch.cs" />
413414
<Compile Include="Obsolete\Obsolete.cs" />
414415
<Compile Include="Resolvers\Converters\Aggregations\FiltersAggregatorConverter.cs" />
415416
<Compile Include="Resolvers\Converters\Aggregations\FilterAggregatorConverter.cs" />

0 commit comments

Comments
 (0)