aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcCore/Method.cs
blob: 9067ae8c9474bcb41616c8481fd390e913e92aa1 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;

namespace Google.GRPC.Core
{
    public enum MethodType
    {
        Unary,
        ClientStreaming,
        ServerStreaming,
        DuplexStreaming
    }

    /// <summary>
    /// A description of a service method.
    /// </summary>
    public class Method<TRequest, TResponse>
    {
        readonly MethodType type;
        readonly string name;
        readonly Marshaller<TRequest> requestMarshaller;
        readonly Marshaller<TResponse> responseMarshaller;

        public Method(MethodType type, string name, Marshaller<TRequest> requestMarshaller, Marshaller<TResponse> responseMarshaller)
        {
            this.type = type;
            this.name = name;
            this.requestMarshaller = requestMarshaller;
            this.responseMarshaller = responseMarshaller;
        }

        public MethodType Type
        {
            get
            {
                return this.type;
            }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
        }

        public Marshaller<TRequest> RequestMarshaller
        {
            get
            {
                return this.requestMarshaller;
            }
        }

        public Marshaller<TResponse> ResponseMarshaller
        {
            get
            {
                return this.responseMarshaller;
            }
        }
    }
}