GrpcUtils
Assembly: ServiceStack.GrpcClient.dll
Declaration
public static class GrpcUtils
Methods
Execute<TRequest, TResponse>(Channel, TRequest, String, String, CallOptions, String)
Declaration
public static Task<TResponse> Execute<TRequest, TResponse>(this Channel channel, TRequest request, string servicesName, string methodName, CallOptions options = null, string host = null)
where TRequest : class where TResponse : class
Returns
System.Threading.Tasks.Task<<TResponse>>
Parameters
Type | Name |
---|
Channel | channel |
<TRequest> | request |
System.String | servicesName |
System.String | methodName |
CallOptions | options |
System.String | host |
Type Parameters
Execute<TRequest, TResponse>(CallInvoker, TRequest, String, String, CallOptions, String)
Declaration
public static async Task<TResponse> Execute<TRequest, TResponse>(this CallInvoker invoker, TRequest request, string servicesName, string methodName, CallOptions options = null, string host = null)
where TRequest : class where TResponse : class
Returns
System.Threading.Tasks.Task<<TResponse>>
Parameters
Type | Name |
---|
CallInvoker | invoker |
<TRequest> | request |
System.String | servicesName |
System.String | methodName |
CallOptions | options |
System.String | host |
Type Parameters
AddPemCertificate(HttpClientHandler, X509Certificate2, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, Boolean>)
Declaration
public static HttpClientHandler AddPemCertificate(this HttpClientHandler handler, X509Certificate2 cert, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> serverCertificateCustomValidationCallback = null)
Returns
System.Net.Http.HttpClientHandler
Parameters
Type | Name |
---|
System.Net.Http.HttpClientHandler | handler |
System.Security.Cryptography.X509Certificates.X509Certificate2 | cert |
System.Func<System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,System.Boolean> | serverCertificateCustomValidationCallback |
AddPemCertificateFromFile(HttpClientHandler, String, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, Boolean>)
Declaration
public static HttpClientHandler AddPemCertificateFromFile(this HttpClientHandler handler, string fileName, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> serverCertificateCustomValidationCallback = null)
Returns
System.Net.Http.HttpClientHandler
Parameters
Type | Name |
---|
System.Net.Http.HttpClientHandler | handler |
System.String | fileName |
System.Func<System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,System.Boolean> | serverCertificateCustomValidationCallback |
AllowSelfSignedCertificatesFrom(HttpClientHandler, String)
Declaration
public static HttpClientHandler AllowSelfSignedCertificatesFrom(this HttpClientHandler handler, string dnsName)
Returns
System.Net.Http.HttpClientHandler
Parameters
Type | Name |
---|
System.Net.Http.HttpClientHandler | handler |
System.String | dnsName |
AllowSelfSignedCertificatesFrom(String)
Declaration
public static Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> AllowSelfSignedCertificatesFrom(string dnsName)
Returns
System.Func<System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,System.Boolean>
Parameters
Type | Name |
---|
System.String | dnsName |
Declaration
public static void Set(this Metadata headers, string name, string value)
Parameters
Type | Name |
---|
Metadata | headers |
System.String | name |
System.String | value |
Init(CallOptions, GrpcClientConfig, Boolean)
Declaration
public static CallOptions Init(this CallOptions options, GrpcClientConfig config, bool noAuth)
Returns
CallOptions
Parameters
InitRequestDto(GrpcClientConfig, Object)
Declaration
public static bool InitRequestDto(GrpcClientConfig config, object requestDto)
Returns
System.Boolean
Parameters
GetResponseAsync<TResponse>(GrpcClientConfig, AsyncUnaryCall<TResponse>)
Declaration
public static async Task<(TResponse, ResponseStatus, Metadata)> GetResponseAsync<TResponse>(GrpcClientConfig config, AsyncUnaryCall<TResponse> auc)
Returns
System.Threading.Tasks.Task<System.ValueTuple<<TResponse>,ServiceStack.ResponseStatus,Metadata>>
Parameters
Type Parameters
InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig, AsyncUnaryCall<TResponse>, TResponse, Action<ResponseCallContext>)
Declaration
public static async Task<Metadata> InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig config, AsyncUnaryCall<TResponse> auc, TResponse response, Action<ResponseCallContext> fn = null)
Returns
System.Threading.Tasks.Task<Metadata>
Parameters
Type Parameters
InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig, AsyncServerStreamingCall<TResponse>, IAsyncStreamReader<TResponse>, Action<ResponseCallContext>)
Declaration
public static async Task<Metadata> InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig config, AsyncServerStreamingCall<TResponse> asc, IAsyncStreamReader<TResponse> response, Action<ResponseCallContext> fn = null)
Returns
System.Threading.Tasks.Task<Metadata>
Parameters
Type | Name |
---|
ServiceStack.GrpcClientConfig | config |
AsyncServerStreamingCall<<TResponse>> | asc |
IAsyncStreamReader<<TResponse>> | response |
System.Action<ServiceStack.ResponseCallContext> | fn |
Type Parameters
GetResponseAsync<TResponse>(GrpcClientConfig, AsyncServerStreamingCall<TResponse>)
Declaration
public static async Task<(IAsyncStreamReader<TResponse>, ResponseStatus, Metadata)> GetResponseAsync<TResponse>(GrpcClientConfig config, AsyncServerStreamingCall<TResponse> auc)
Returns
System.Threading.Tasks.Task<System.ValueTuple<IAsyncStreamReader<<TResponse>>,ServiceStack.ResponseStatus,Metadata>>
Parameters
Type Parameters
Declaration
public static ResponseStatus HandleRpcException(Metadata headers, RpcException ex)
Returns
ServiceStack.ResponseStatus
Parameters
Type | Name |
---|
Metadata | headers |
RpcException | ex |
Declaration
public static WebHeaderCollection ResolveHeaders(Metadata headers)
Returns
System.Net.WebHeaderCollection
Parameters
Declaration
public static Metadata ToHeaders(Dictionary<string, string> headers)
Returns
Metadata
Parameters
Type | Name |
---|
System.Collections.Generic.Dictionary<System.String,System.String> | headers |
Declaration
public static Metadata ToHeaders<T>(T headers)
Returns
Metadata
Parameters
Type Parameters