@@ -3,37 +3,199 @@ package com.google.protobuf.kotlin
33
44import kotlinx.rpc.internal.utils.*
55
6+ /* *
7+ * Api is a light-weight descriptor for an API Interface.
8+ *
9+ * Interfaces are also described as "protocol buffer services" in some contexts,
10+ * such as by the "service" keyword in a .proto file, but they are different
11+ * from API Services, which represent a concrete implementation of an interface
12+ * as opposed to simply a description of methods and bindings. They are also
13+ * sometimes simply referred to as "APIs" in other contexts, such as the name of
14+ * this message itself. See https://cloud.google.com/apis/design/glossary for
15+ * detailed terminology.
16+ */
617@kotlinx.rpc.grpc.codec.WithCodec (com.google.protobuf.kotlin.ApiInternal .CODEC ::class )
718public interface Api {
19+ /* *
20+ * The fully qualified name of this interface, including package name
21+ * followed by the interface's simple name.
22+ */
823 public val name: String
24+ /* *
25+ * The methods of this interface, in unspecified order.
26+ */
927 public val methods: List < com.google.protobuf.kotlin.Method >
28+ /* *
29+ * Any metadata attached to the interface.
30+ */
1031 public val options: List < com.google.protobuf.kotlin.Option >
32+ /* *
33+ * A version string for this interface. If specified, must have the form
34+ * `major-version.minor-version`, as in `1.10`. If the minor version is
35+ * omitted, it defaults to zero. If the entire version field is empty, the
36+ * major version is derived from the package name, as outlined below. If the
37+ * field is not empty, the version in the package name will be verified to be
38+ * consistent with what is provided here.
39+ *
40+ * The versioning schema uses [semantic
41+ * versioning](http://semver.org) where the major version number
42+ * indicates a breaking change and the minor version an additive,
43+ * non-breaking change. Both version numbers are signals to users
44+ * what to expect from different versions, and should be carefully
45+ * chosen based on the product plan.
46+ *
47+ * The major version is also reflected in the package name of the
48+ * interface, which must end in `v<major-version>`, as in
49+ * `google.feature.v1`. For major versions 0 and 1, the suffix can
50+ * be omitted. Zero major versions must only be used for
51+ * experimental, non-GA interfaces.
52+ */
1153 public val version: String
54+ /* *
55+ * Source context for the protocol buffer service represented by this
56+ * message.
57+ */
1258 public val sourceContext: com.google.protobuf.kotlin.SourceContext
59+ /* *
60+ * Included interfaces. See [Mixin][].
61+ */
1362 public val mixins: List < com.google.protobuf.kotlin.Mixin >
63+ /* *
64+ * The source syntax of the service.
65+ */
1466 public val syntax: com.google.protobuf.kotlin.Syntax
1567
1668 public companion object
1769}
1870
71+ /* *
72+ * Method represents a method of an API interface.
73+ */
1974@kotlinx.rpc.grpc.codec.WithCodec (com.google.protobuf.kotlin.MethodInternal .CODEC ::class )
2075public interface Method {
76+ /* *
77+ * The simple name of this method.
78+ */
2179 public val name: String
80+ /* *
81+ * A URL of the input message type.
82+ */
2283 public val requestTypeUrl: String
84+ /* *
85+ * If true, the request is streamed.
86+ */
2387 public val requestStreaming: Boolean
88+ /* *
89+ * The URL of the output message type.
90+ */
2491 public val responseTypeUrl: String
92+ /* *
93+ * If true, the response is streamed.
94+ */
2595 public val responseStreaming: Boolean
96+ /* *
97+ * Any metadata attached to the method.
98+ */
2699 public val options: List < com.google.protobuf.kotlin.Option >
100+ /* *
101+ * The source syntax of this method.
102+ */
27103 public val syntax: com.google.protobuf.kotlin.Syntax
28104
29105 public companion object
30106}
31107
108+ /* *
109+ * Declares an API Interface to be included in this interface. The including
110+ * interface must redeclare all the methods from the included interface, but
111+ * documentation and options are inherited as follows:
112+ *
113+ * - If after comment and whitespace stripping, the documentation
114+ * string of the redeclared method is empty, it will be inherited
115+ * from the original method.
116+ *
117+ * - Each annotation belonging to the service config (http,
118+ * visibility) which is not set in the redeclared method will be
119+ * inherited.
120+ *
121+ * - If an http annotation is inherited, the path pattern will be
122+ * modified as follows. Any version prefix will be replaced by the
123+ * version of the including interface plus the [root][] path if
124+ * specified.
125+ *
126+ * Example of a simple mixin:
127+ *
128+ * package google.acl.v1;
129+ * service AccessControl {
130+ * // Get the underlying ACL object.
131+ * rpc GetAcl(GetAclRequest) returns (Acl) {
132+ * option (google.api.http).get = "/v1/{resource=**}:getAcl";
133+ * }
134+ * }
135+ *
136+ * package google.storage.v2;
137+ * service Storage {
138+ * rpc GetAcl(GetAclRequest) returns (Acl);
139+ *
140+ * // Get a data record.
141+ * rpc GetData(GetDataRequest) returns (Data) {
142+ * option (google.api.http).get = "/v2/{resource=**}";
143+ * }
144+ * }
145+ *
146+ * Example of a mixin configuration:
147+ *
148+ * apis:
149+ * - name: google.storage.v2.Storage
150+ * mixins:
151+ * - name: google.acl.v1.AccessControl
152+ *
153+ * The mixin construct implies that all methods in `AccessControl` are
154+ * also declared with same name and request/response types in
155+ * `Storage`. A documentation generator or annotation processor will
156+ * see the effective `Storage.GetAcl` method after inheriting
157+ * documentation and annotations as follows:
158+ *
159+ * service Storage {
160+ * // Get the underlying ACL object.
161+ * rpc GetAcl(GetAclRequest) returns (Acl) {
162+ * option (google.api.http).get = "/v2/{resource=**}:getAcl";
163+ * }
164+ * ...
165+ * }
166+ *
167+ * Note how the version in the path pattern changed from `v1` to `v2`.
168+ *
169+ * If the `root` field in the mixin is specified, it should be a
170+ * relative path under which inherited HTTP paths are placed. Example:
171+ *
172+ * apis:
173+ * - name: google.storage.v2.Storage
174+ * mixins:
175+ * - name: google.acl.v1.AccessControl
176+ * root: acls
177+ *
178+ * This implies the following inherited HTTP annotation:
179+ *
180+ * service Storage {
181+ * // Get the underlying ACL object.
182+ * rpc GetAcl(GetAclRequest) returns (Acl) {
183+ * option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
184+ * }
185+ * ...
186+ * }
187+ */
32188@kotlinx.rpc.grpc.codec.WithCodec (com.google.protobuf.kotlin.MixinInternal .CODEC ::class )
33189public interface Mixin {
190+ /* *
191+ * The fully qualified name of the interface which is included.
192+ */
34193 public val name: String
194+ /* *
195+ * If non-empty specifies a path under which inherited HTTP paths
196+ * are rooted.
197+ */
35198 public val root: String
36199
37200 public companion object
38201}
39-
0 commit comments