xref: /aosp_15_r20/external/grpc-grpc-java/compiler/src/test/proto/grpc/testing/compiler/test.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1// Copyright 2015 The gRPC Authors
2// All rights reserved.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16// A simple service definition for testing the protoc plugin.
17syntax = "proto3";
18
19package grpc.testing.compiler;
20
21option java_package = "io.grpc.testing.compiler";
22
23message SimpleRequest {
24}
25
26message SimpleResponse {
27}
28
29message StreamingInputCallRequest {
30}
31
32message StreamingInputCallResponse {
33}
34
35message StreamingOutputCallRequest {
36}
37
38message StreamingOutputCallResponse {
39}
40
41// Test service that supports all call types.
42service TestService {
43  // One request followed by one response.
44  // The server returns the client payload as-is.
45  rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
46
47  // One request followed by a sequence of responses (streamed download).
48  // The server returns the payload with client desired type and sizes.
49  rpc StreamingOutputCall(StreamingOutputCallRequest)
50      returns (stream StreamingOutputCallResponse);
51
52  // A sequence of requests followed by one response (streamed upload).
53  // The server returns the aggregated size of client payload as the result.
54  rpc StreamingInputCall(stream StreamingInputCallRequest)
55      returns (StreamingInputCallResponse);
56
57  // A sequence of requests with each request served by the server immediately.
58  // As one request could lead to multiple responses, this interface
59  // demonstrates the idea of full bidirectionality.
60  rpc FullBidiCall(stream StreamingOutputCallRequest)
61      returns (stream StreamingOutputCallResponse);
62
63  // A sequence of requests followed by a sequence of responses.
64  // The server buffers all the client requests and then serves them in order. A
65  // stream of responses are returned to the client when the server starts with
66  // first request.
67  rpc HalfBidiCall(stream StreamingOutputCallRequest)
68      returns (stream StreamingOutputCallResponse);
69
70  // An RPC method whose Java name collides with a keyword, and whose generated
71  // method should have a '_' appended.
72  rpc Import(stream StreamingInputCallRequest) returns (stream StreamingInputCallResponse);
73
74  // A unary call that is Safe.
75  rpc SafeCall(SimpleRequest) returns (SimpleResponse) {
76      option idempotency_level = NO_SIDE_EFFECTS;
77  }
78
79  // A unary call that is Idempotent.
80  rpc IdempotentCall(SimpleRequest) returns (SimpleResponse) {
81      option idempotency_level = IDEMPOTENT;
82  }
83}
84
85// Test service that has been deprecated and should generate with Java's @Deprecated annotation
86service TestDeprecatedService {
87  option deprecated = true;
88
89  // An RPC method that has been deprecated and should generate with Java's @Deprecated annotation
90  rpc DeprecatedMethod(SimpleRequest) returns (SimpleResponse) {
91    option deprecated = true;
92  }
93}
94