Skip to main content

GrpcUtils

Assembly: ServiceStack.GrpcClient.dll​
View Source​
Declaration
public static class GrpcUtils

Methods​

Execute<TRequest, TResponse>(Channel, TRequest, String, String, CallOptions, String)​

View Source​
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​
TypeName
Channelchannel
<TRequest>request
System.StringservicesName
System.StringmethodName
CallOptionsoptions
System.Stringhost
Type Parameters​
  • TRequest
  • TResponse

Execute<TRequest, TResponse>(CallInvoker, TRequest, String, String, CallOptions, String)​

View Source​
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​
TypeName
CallInvokerinvoker
<TRequest>request
System.StringservicesName
System.StringmethodName
CallOptionsoptions
System.Stringhost
Type Parameters​
  • TRequest
  • TResponse

AddPemCertificate(HttpClientHandler, X509Certificate2, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, Boolean>)​

View Source​
Declaration
public static HttpClientHandler AddPemCertificate(this HttpClientHandler handler, X509Certificate2 cert, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> serverCertificateCustomValidationCallback = null)
Returns​

System.Net.Http.HttpClientHandler

Parameters​
TypeName
System.Net.Http.HttpClientHandlerhandler
System.Security.Cryptography.X509Certificates.X509Certificate2cert
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>)​

View Source​
Declaration
public static HttpClientHandler AddPemCertificateFromFile(this HttpClientHandler handler, string fileName, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> serverCertificateCustomValidationCallback = null)
Returns​

System.Net.Http.HttpClientHandler

Parameters​
TypeName
System.Net.Http.HttpClientHandlerhandler
System.StringfileName
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)​

View Source​
Declaration
public static HttpClientHandler AllowSelfSignedCertificatesFrom(this HttpClientHandler handler, string dnsName)
Returns​

System.Net.Http.HttpClientHandler

Parameters​
TypeName
System.Net.Http.HttpClientHandlerhandler
System.StringdnsName

AllowSelfSignedCertificatesFrom(String)​

View Source​
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​
TypeName
System.StringdnsName

Set(Metadata, String, String)​

View Source​
Declaration
public static void Set(this Metadata headers, string name, string value)
Parameters​
TypeName
Metadataheaders
System.Stringname
System.Stringvalue

Init(CallOptions, GrpcClientConfig, Boolean)​

View Source​
Declaration
public static CallOptions Init(this CallOptions options, GrpcClientConfig config, bool noAuth)
Returns​

CallOptions

Parameters​
TypeName
CallOptionsoptions
ServiceStack.GrpcClientConfigconfig
System.BooleannoAuth

InitRequestDto(GrpcClientConfig, Object)​

View Source​
Declaration
public static bool InitRequestDto(GrpcClientConfig config, object requestDto)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.GrpcClientConfigconfig
System.ObjectrequestDto

GetResponseAsync<TResponse>(GrpcClientConfig, AsyncUnaryCall<TResponse>)​

View Source​
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​
TypeName
ServiceStack.GrpcClientConfigconfig
AsyncUnaryCall<<TResponse>>auc
Type Parameters​
  • TResponse

InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig, AsyncUnaryCall<TResponse>, TResponse, Action<ResponseCallContext>)​

View Source​
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​
TypeName
ServiceStack.GrpcClientConfigconfig
AsyncUnaryCall<<TResponse>>auc
<TResponse>response
System.Action<ServiceStack.ResponseCallContext>fn
Type Parameters​
  • TResponse

InvokeResponseFiltersAsync<TResponse>(GrpcClientConfig, AsyncServerStreamingCall<TResponse>, IAsyncStreamReader<TResponse>, Action<ResponseCallContext>)​

View Source​
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​
TypeName
ServiceStack.GrpcClientConfigconfig
AsyncServerStreamingCall<<TResponse>>asc
IAsyncStreamReader<<TResponse>>response
System.Action<ServiceStack.ResponseCallContext>fn
Type Parameters​
  • TResponse

GetResponseAsync<TResponse>(GrpcClientConfig, AsyncServerStreamingCall<TResponse>)​

View Source​
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​
TypeName
ServiceStack.GrpcClientConfigconfig
AsyncServerStreamingCall<<TResponse>>auc
Type Parameters​
  • TResponse

HandleRpcException(Metadata, RpcException)​

View Source​
Declaration
public static ResponseStatus HandleRpcException(Metadata headers, RpcException ex)
Returns​

ServiceStack.ResponseStatus

Parameters​
TypeName
Metadataheaders
RpcExceptionex

ResolveHeaders(Metadata)​

View Source​
Declaration
public static WebHeaderCollection ResolveHeaders(Metadata headers)
Returns​

System.Net.WebHeaderCollection

Parameters​
TypeName
Metadataheaders

ToHeaders(Dictionary<String, String>)​

View Source​
Declaration
public static Metadata ToHeaders(Dictionary<string, string> headers)
Returns​

Metadata

Parameters​
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>headers

ToHeaders<T>(T)​

View Source​
Declaration
public static Metadata ToHeaders<T>(T headers)
Returns​

Metadata

Parameters​
TypeName
<T>headers
Type Parameters​
  • T