private static R ResultsSelector <D, Q, R>(ElasticsearchResponse <R> c, D descriptor, bool allow404) where Q : FluentRequestParameters <Q>, new() where D : IPathInfo <Q> where R : BaseResponse { if (c.Success || allow404 && c.HttpStatusCode == 404) { c.Response.IsValid = true; return(c.Response); } var badResponse = CreateInvalidInstance <R>(c); return(badResponse); }
private static R ResultsSelector <D, Q, R>( ElasticsearchResponse <R> c, D descriptor ) where Q : FluentRequestParameters <Q>, new() where D : IRequest <Q> where R : BaseResponse { var config = descriptor.RequestConfiguration; var statusCodeAllowed = config != null && config.AllowedStatusCodes.HasAny(i => i == c.HttpStatusCode); if (c.Success || statusCodeAllowed) { c.Response.IsValid = true; return(c.Response); } var badResponse = CreateInvalidInstance <R>(c); return(badResponse); }
private static TResponse ResultsSelector <TResponse>(ElasticsearchResponse <TResponse> c) where TResponse : ResponseBase => c.Body ?? CreateInvalidInstance <TResponse>(c);
private ElasticsearchResponse <ExistsResponse> ToExistsResponse(IElasticsearchResponse existsDispatch) { return(ElasticsearchResponse.CloneFrom <ExistsResponse>(existsDispatch, new ExistsResponse(existsDispatch))); }