Skip to content

Commit c90ff77

Browse files
committed
Merge branch 'feature/extensibility' into develop
2 parents cac5478 + 8c96841 commit c90ff77

File tree

5 files changed

+49
-13
lines changed

5 files changed

+49
-13
lines changed

src/Elasticsearch.Net/Domain/Response/ElasticsearchResponse.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Elasticsearch.Net
2323

2424
public static class ElasticsearchResponse
2525
{
26-
internal static Task<ElasticsearchResponse<DynamicDictionary>> WrapAsync(Task<ElasticsearchResponse<Dictionary<string, object>>> responseTask)
26+
public static Task<ElasticsearchResponse<DynamicDictionary>> WrapAsync(Task<ElasticsearchResponse<Dictionary<string, object>>> responseTask)
2727
{
2828
return responseTask
2929
.ContinueWith(t =>
@@ -35,7 +35,7 @@ internal static Task<ElasticsearchResponse<DynamicDictionary>> WrapAsync(Task<El
3535
});
3636
}
3737

38-
internal static ElasticsearchResponse<DynamicDictionary> Wrap(ElasticsearchResponse<Dictionary<string, object>> response)
38+
public static ElasticsearchResponse<DynamicDictionary> Wrap(ElasticsearchResponse<Dictionary<string, object>> response)
3939
{
4040
return ToDynamicResponse(response);
4141
}
@@ -62,7 +62,7 @@ public static ElasticsearchResponse<TTo> CloneFrom<TTo>(IElasticsearchResponse f
6262
return response;
6363
}
6464

65-
private static ElasticsearchResponse<DynamicDictionary> ToDynamicResponse(ElasticsearchResponse<Dictionary<string, object>> response)
65+
public static ElasticsearchResponse<DynamicDictionary> ToDynamicResponse(ElasticsearchResponse<Dictionary<string, object>> response)
6666
{
6767
return CloneFrom(response, response.Response != null ? DynamicDictionary.Create(response.Response) : null);
6868
}
@@ -138,20 +138,20 @@ public bool SuccessOrKnownError
138138
}
139139
}
140140

141-
protected internal ElasticsearchResponse(IConnectionConfigurationValues settings)
141+
public ElasticsearchResponse(IConnectionConfigurationValues settings)
142142
{
143143
this.Settings = settings;
144144
this.Serializer = settings.Serializer;
145145
}
146146

147-
private ElasticsearchResponse(IConnectionConfigurationValues settings, Exception e)
147+
public ElasticsearchResponse(IConnectionConfigurationValues settings, Exception e)
148148
: this(settings)
149149
{
150150
this.Success = false;
151151
this.OriginalException = e;
152152
}
153153

154-
private ElasticsearchResponse(IConnectionConfigurationValues settings, int statusCode)
154+
public ElasticsearchResponse(IConnectionConfigurationValues settings, int statusCode)
155155
: this(settings)
156156
{
157157
this.Success = statusCode >= 200 && statusCode < 300;

src/Elasticsearch.Net/IElasticsearchClient.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public partial interface IElasticsearchClient
2828
/// <param name="data">The body of the request, string and byte[] are posted as is other types will be serialized to JSON</param>
2929
/// <param name="requestParameters">Optionally configure request specific timeouts, headers</param>
3030
/// <returns>A task of ElasticsearchResponse of T where T represents the JSON response body</returns>
31-
Task<ElasticsearchResponse<T>> DoRequestAsync<T>(string method, string path, object data = null, IRequestParameters requestParameters = null);
32-
31+
Task<ElasticsearchResponse<T>> DoRequestAsync<T>(string method, string path, object data = null, IRequestParameters requestParameters = null);
32+
33+
string Encoded(object o);
3334
}
3435
}

src/Nest/ElasticClient.cs

Lines changed: 5 additions & 5 deletions
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, IHighLevelToLowLevelDispatcher
1717
{
1818
private readonly IConnectionSettingsValues _connectionSettings;
1919

@@ -57,7 +57,7 @@ public ElasticClient(
5757
}
5858

5959

60-
private R Dispatch<D, Q, R>(
60+
public R Dispatch<D, Q, R>(
6161
Func<D, D> selector
6262
, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch
6363
)
@@ -70,7 +70,7 @@ Func<D, D> selector
7070
return this.Dispatch<D, Q, R>(descriptor, dispatch);
7171
}
7272

73-
private R Dispatch<D, Q, R>(
73+
public R Dispatch<D, Q, R>(
7474
D descriptor
7575
, Func<ElasticsearchPathInfo<Q>, D, ElasticsearchResponse<R>> dispatch
7676
)
@@ -111,7 +111,7 @@ private static R CreateInvalidInstance<R>(IElasticsearchResponse response) where
111111
return r;
112112
}
113113

114-
private Task<I> DispatchAsync<D, Q, R, I>(
114+
public Task<I> DispatchAsync<D, Q, R, I>(
115115
Func<D, D> selector
116116
, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch
117117
)
@@ -125,7 +125,7 @@ Func<D, D> selector
125125
return this.DispatchAsync<D, Q, R, I>(descriptor, dispatch);
126126
}
127127

128-
private Task<I> DispatchAsync<D, Q, R, I>(
128+
public Task<I> DispatchAsync<D, Q, R, I>(
129129
D descriptor
130130
, Func<ElasticsearchPathInfo<Q>, D, Task<ElasticsearchResponse<R>>> dispatch
131131
)
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 IHighLevelToLowLevelDispatcher
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/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="IHighLevelToLowLevelDispatcher.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)