Skip to content

Commit d4020e0

Browse files
committed
Revert "Revert "removed Wrap() from low level client and ElasticsearchResponse, removed unecessary clonefroms in NEST but could not delete the ones in the low level client, used to short circuit auth failures or void responses""
This reverts commit 4fcecae.
1 parent a5eebec commit d4020e0

File tree

10 files changed

+1075
-1049
lines changed

10 files changed

+1075
-1049
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiEndpoint.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ public IEnumerable<CsharpMethod> CsharpMethods
213213
QueryStringParamName = queryStringParamName,
214214
ReturnType = string.Format("ElasticsearchResponse<{0}>", defaultBoundGeneric),
215215
ReturnTypeGeneric = null,
216-
CallTypeGeneric = defaultBoundGeneric == "DynamicDictionary"
217-
? "Dictionary<string, object>" : defaultBoundGeneric,
216+
//CallTypeGeneric = defaultBoundGeneric == "DynamicDictionary" ? "Dictionary<string, object>" : defaultBoundGeneric,
217+
CallTypeGeneric = defaultBoundGeneric,
218218
ReturnDescription =
219219
"ElasticsearchResponse&lt;T&gt; holding the response body deserialized as DynamicDictionary"
220220
+ explanationOfDynamic,
@@ -234,8 +234,8 @@ public IEnumerable<CsharpMethod> CsharpMethods
234234
QueryStringParamName = queryStringParamName,
235235
ReturnType = string.Format("Task<ElasticsearchResponse<{0}>>", defaultBoundGeneric),
236236
ReturnTypeGeneric = null,
237-
CallTypeGeneric = defaultBoundGeneric == "DynamicDictionary"
238-
? "Dictionary<string, object>" : defaultBoundGeneric,
237+
//CallTypeGeneric = defaultBoundGeneric == "DynamicDictionary" ? "Dictionary<string, object>" : defaultBoundGeneric,
238+
CallTypeGeneric = defaultBoundGeneric,
239239
ReturnDescription =
240240
"Task that'll return an ElasticsearchResponse&lt;T$gt; holding the response body deserialized as DynamicDictionary"
241241
+ explanationOfDynamic,

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,7 @@ namespace Elasticsearch.Net
2222
// TODO: Make this class internal in 2.0
2323
public static class ElasticsearchResponse
2424
{
25-
public static Task<ElasticsearchResponse<DynamicDictionary>> WrapAsync(Task<ElasticsearchResponse<Dictionary<string, object>>> responseTask)
26-
{
27-
return responseTask
28-
.ContinueWith(t =>
29-
{
30-
if (t.IsFaulted && t.Exception != null)
31-
{
32-
t.Exception.Flatten().InnerException.RethrowKeepingStackTrace();
33-
return null; //won't be hit
34-
}
35-
return ToDynamicResponse(t.Result);
36-
});
37-
}
38-
39-
public static ElasticsearchResponse<DynamicDictionary> Wrap(ElasticsearchResponse<Dictionary<string, object>> response)
40-
{
41-
return ToDynamicResponse(response);
42-
}
43-
44-
public static ElasticsearchResponse<TTo> CloneFrom<TTo>(IElasticsearchResponse from, TTo to)
25+
internal static ElasticsearchResponse<TTo> CloneFrom<TTo>(IElasticsearchResponse from, TTo to)
4526
{
4627
var response = new ElasticsearchResponse<TTo>(from.Settings)
4728
{
@@ -62,11 +43,6 @@ public static ElasticsearchResponse<TTo> CloneFrom<TTo>(IElasticsearchResponse f
6243
tt.RequestInformation = response;
6344
return response;
6445
}
65-
66-
public static ElasticsearchResponse<DynamicDictionary> ToDynamicResponse(ElasticsearchResponse<Dictionary<string, object>> response)
67-
{
68-
return CloneFrom(response, response.Response != null ? DynamicDictionary.Create(response.Response) : null);
69-
}
7046
}
7147

7248
public class ElasticsearchResponse<T> : IElasticsearchResponse

0 commit comments

Comments
 (0)