forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrpcClientConfig.cs
More file actions
43 lines (35 loc) · 1.53 KB
/
GrpcClientConfig.cs
File metadata and controls
43 lines (35 loc) · 1.53 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using Grpc.Core;
using Grpc.Net.Client;
using ProtoBuf.Grpc;
using ServiceStack.Text;
namespace ServiceStack
{
public class GrpcClientConfig : IHasSessionId, IHasBearerToken, IHasVersion
{
public static class Keywords
{
internal const string HeaderSessionId = "X-ss-id";
internal const string HttpStatus = "httpstatus";
internal const string GrpcResponseStatus = "responsestatus-bin";
internal const string Dynamic = nameof(Dynamic);
}
public GrpcChannel Channel { get; set; }
public string ServicesName { get; set; } = "GrpcServices";
public string BaseUri { get; set; }
public string SessionId { get; set; }
public string BearerToken { get; set; }
public string RefreshToken { get; set; }
public string RefreshTokenUri { get; set; }
public int Version { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Grpc.Core.Metadata Headers { get; set; } = new Metadata();
public static Action<CallContext> GlobalRequestFilter { get; set; }
public Action<CallContext> RequestFilter { get; set; }
public static Action<ResponseCallContext> GlobalResponseFilter { get; set; }
public Action<ResponseCallContext> ResponseFilter { get; set; }
public string UserAgent { get; set; } = ".NET gRPC Client " + Env.VersionString;
public CallInvoker Init() => Channel.ForServiceStack(this);
}
}