32
32
{% endblock %}
33
33
34
34
{% block method_body %}
35
- pass
35
+ {% if method .server_streaming %}
36
+ {% if method .client_streaming %}
37
+ for response in self._channel.stream_stream(
38
+ "{{ method.route }}",
39
+ {{ method.py_input_message_type }}.SerializeToString,
40
+ {{ method.py_output_message_type }}.FromString,
41
+ )({{ method.py_input_message_param }}_iterator):
42
+ yield response
43
+ {% else %}
44
+ {% if method .is_input_msg_empty %}
45
+ if {{ method.py_input_message_param }} is None:
46
+ {{ method.py_input_message_param }} = {{ method.py_input_message_type }}()
47
+
48
+ {% endif %}
49
+ for response in self._channel.unary_stream(
50
+ "{{ method.route }}",
51
+ {{ method.py_input_message_type }}.SerializeToString,
52
+ {{ method.py_output_message_type }}.FromString,
53
+ )({{ method.py_input_message_param }}):
54
+ yield response
55
+
56
+ {% endif %}
57
+ {% else %}
58
+ {% if method .client_streaming %}
59
+ return self._channel.stream_unary(
60
+ "{{ method.route }}",
61
+ {{ method.py_input_message_type }}.SerializeToString,
62
+ {{ method.py_output_message_type }}.FromString,
63
+ )({{ method.py_input_message_param }}_iterator)
64
+ {% else %}
65
+ {% if method .is_input_msg_empty %}
66
+ if {{ method.py_input_message_param }} is None:
67
+ {{ method.py_input_message_param }} = {{ method.py_input_message_type }}()
68
+
69
+ {% endif %}
70
+ return self._channel.unary_unary(
71
+ "{{ method.route }}",
72
+ {{ method.py_input_message_type }}.SerializeToString,
73
+ {{ method.py_output_message_type }}.FromString,
74
+ )({{ method.py_input_message_param }})
75
+ {% endif %}
76
+ {% endif %}
36
77
{% endblock %}
0 commit comments