forked from elastic/elasticsearch-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NamespacedClientProxy.cs
30 lines (23 loc) · 1.2 KB
/
NamespacedClientProxy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Elasticsearch.Net
{
public class NamespacedClientProxy
{
private readonly ElasticLowLevelClient _client;
internal NamespacedClientProxy(ElasticLowLevelClient client) => _client = client;
protected TResponse DoRequest<TResponse>(HttpMethod post, string url, PostData body, IRequestParameters @params)
where TResponse : class, IElasticsearchResponse, new() =>
_client.DoRequest<TResponse>(post, url, body, @params);
protected Task<TResponse> DoRequestAsync<TResponse>(HttpMethod post, string url, CancellationToken ctx, PostData body, IRequestParameters @params)
where TResponse : class, IElasticsearchResponse, new() =>
_client.DoRequestAsync<TResponse>(post, url, ctx, body, @params);
protected string Url(FormattableString formattable) => _client.Url(formattable);
protected TRequestParams RequestParams<TRequestParams>(TRequestParams requestParams)
where TRequestParams : class, IRequestParameters, new()
=> _client.RequestParams(requestParams, ContentType, ContentType);
// ReSharper disable once UnassignedGetOnlyAutoProperty intended to be overridden
protected virtual string ContentType { get; }
}
}