@@ -76,6 +76,23 @@ public class ApiInternal: com.google.protobuf.kotlin.Api, kotlinx.rpc.protobuf.i
7676 }
7777 }
7878
79+ @kotlinx.rpc.internal.utils.InternalRpcApi
80+ public fun copyInternal (body : ApiInternal .() -> Unit ): ApiInternal {
81+ val copy = ApiInternal ()
82+ copy.name = name
83+ copy.methods = methods.map { it.copy() }
84+ copy.options = options.map { it.copy() }
85+ copy.version = version
86+ if (presenceMask[0 ]) {
87+ copy.sourceContext = sourceContext.copy()
88+ }
89+
90+ copy.mixins = mixins.map { it.copy() }
91+ copy.syntax = syntax
92+ copy.apply (body)
93+ return copy
94+ }
95+
7996 @kotlinx.rpc.internal.utils.InternalRpcApi
8097 public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec<com.google.protobuf.kotlin.Api> {
8198 public override fun encode (value : com.google.protobuf.kotlin.Api ): kotlinx.rpc.protobuf.input.stream.InputStream {
@@ -165,6 +182,20 @@ public class MethodInternal: com.google.protobuf.kotlin.Method, kotlinx.rpc.prot
165182 }
166183 }
167184
185+ @kotlinx.rpc.internal.utils.InternalRpcApi
186+ public fun copyInternal (body : MethodInternal .() -> Unit ): MethodInternal {
187+ val copy = MethodInternal ()
188+ copy.name = name
189+ copy.requestTypeUrl = requestTypeUrl
190+ copy.requestStreaming = requestStreaming
191+ copy.responseTypeUrl = responseTypeUrl
192+ copy.responseStreaming = responseStreaming
193+ copy.options = options.map { it.copy() }
194+ copy.syntax = syntax
195+ copy.apply (body)
196+ return copy
197+ }
198+
168199 @kotlinx.rpc.internal.utils.InternalRpcApi
169200 public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec<com.google.protobuf.kotlin.Method> {
170201 public override fun encode (value : com.google.protobuf.kotlin.Method ): kotlinx.rpc.protobuf.input.stream.InputStream {
@@ -234,6 +265,15 @@ public class MixinInternal: com.google.protobuf.kotlin.Mixin, kotlinx.rpc.protob
234265 }
235266 }
236267
268+ @kotlinx.rpc.internal.utils.InternalRpcApi
269+ public fun copyInternal (body : MixinInternal .() -> Unit ): MixinInternal {
270+ val copy = MixinInternal ()
271+ copy.name = name
272+ copy.root = root
273+ copy.apply (body)
274+ return copy
275+ }
276+
237277 @kotlinx.rpc.internal.utils.InternalRpcApi
238278 public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec<com.google.protobuf.kotlin.Mixin> {
239279 public override fun encode (value : com.google.protobuf.kotlin.Mixin ): kotlinx.rpc.protobuf.input.stream.InputStream {
@@ -262,24 +302,84 @@ public class MixinInternal: com.google.protobuf.kotlin.Mixin, kotlinx.rpc.protob
262302 public companion object
263303}
264304
305+ /* *
306+ * Constructs a new message.
307+ * ```
308+ * val message = Api {
309+ * name = ...
310+ * }
311+ * ```
312+ */
265313public operator fun com.google.protobuf.kotlin.Api.Companion.invoke (body : com.google.protobuf.kotlin.ApiInternal .() -> Unit ): com.google.protobuf.kotlin.Api {
266314 val msg = com.google.protobuf.kotlin.ApiInternal ().apply (body)
267315 msg.checkRequiredFields()
268316 return msg
269317}
270318
319+ /* *
320+ * Copies the original message, including unknown fields.
321+ * ```
322+ * val copy = original.copy {
323+ * name = ...
324+ * }
325+ * ```
326+ */
327+ public fun com.google.protobuf.kotlin.Api.copy (body : com.google.protobuf.kotlin.ApiInternal .() -> Unit = {}): com.google.protobuf.kotlin.Api {
328+ return this .asInternal().copyInternal(body)
329+ }
330+
331+ /* *
332+ * Constructs a new message.
333+ * ```
334+ * val message = Method {
335+ * name = ...
336+ * }
337+ * ```
338+ */
271339public operator fun com.google.protobuf.kotlin.Method.Companion.invoke (body : com.google.protobuf.kotlin.MethodInternal .() -> Unit ): com.google.protobuf.kotlin.Method {
272340 val msg = com.google.protobuf.kotlin.MethodInternal ().apply (body)
273341 msg.checkRequiredFields()
274342 return msg
275343}
276344
345+ /* *
346+ * Copies the original message, including unknown fields.
347+ * ```
348+ * val copy = original.copy {
349+ * name = ...
350+ * }
351+ * ```
352+ */
353+ public fun com.google.protobuf.kotlin.Method.copy (body : com.google.protobuf.kotlin.MethodInternal .() -> Unit = {}): com.google.protobuf.kotlin.Method {
354+ return this .asInternal().copyInternal(body)
355+ }
356+
357+ /* *
358+ * Constructs a new message.
359+ * ```
360+ * val message = Mixin {
361+ * name = ...
362+ * }
363+ * ```
364+ */
277365public operator fun com.google.protobuf.kotlin.Mixin.Companion.invoke (body : com.google.protobuf.kotlin.MixinInternal .() -> Unit ): com.google.protobuf.kotlin.Mixin {
278366 val msg = com.google.protobuf.kotlin.MixinInternal ().apply (body)
279367 msg.checkRequiredFields()
280368 return msg
281369}
282370
371+ /* *
372+ * Copies the original message, including unknown fields.
373+ * ```
374+ * val copy = original.copy {
375+ * name = ...
376+ * }
377+ * ```
378+ */
379+ public fun com.google.protobuf.kotlin.Mixin.copy (body : com.google.protobuf.kotlin.MixinInternal .() -> Unit = {}): com.google.protobuf.kotlin.Mixin {
380+ return this .asInternal().copyInternal(body)
381+ }
382+
283383@kotlinx.rpc.internal.utils.InternalRpcApi
284384public fun com.google.protobuf.kotlin.ApiInternal.checkRequiredFields () {
285385 // no required fields to check
@@ -345,41 +445,34 @@ public fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com.
345445 tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
346446 msg.name = decoder.readString()
347447 }
348-
349448 tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
350449 val elem = com.google.protobuf.kotlin.MethodInternal ()
351450 decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.MethodInternal ::decodeWith)
352451 (msg.methods as MutableList ).add(elem)
353452 }
354-
355453 tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
356454 val elem = com.google.protobuf.kotlin.OptionInternal ()
357455 decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal ::decodeWith)
358456 (msg.options as MutableList ).add(elem)
359457 }
360-
361458 tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
362459 msg.version = decoder.readString()
363460 }
364-
365461 tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
366462 if (! msg.presenceMask[0 ]) {
367463 msg.sourceContext = com.google.protobuf.kotlin.SourceContextInternal ()
368464 }
369465
370466 decoder.readMessage(msg.sourceContext.asInternal(), com.google.protobuf.kotlin.SourceContextInternal ::decodeWith)
371467 }
372-
373468 tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
374469 val elem = com.google.protobuf.kotlin.MixinInternal ()
375470 decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.MixinInternal ::decodeWith)
376471 (msg.mixins as MutableList ).add(elem)
377472 }
378-
379473 tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .VARINT -> {
380474 msg.syntax = com.google.protobuf.kotlin.Syntax .fromNumber(decoder.readEnum())
381475 }
382-
383476 else -> {
384477 if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType .END_GROUP ) {
385478 throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException (" Unexpected END_GROUP tag." )
@@ -479,33 +572,26 @@ public fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: c
479572 tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
480573 msg.name = decoder.readString()
481574 }
482-
483575 tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
484576 msg.requestTypeUrl = decoder.readString()
485577 }
486-
487578 tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .VARINT -> {
488579 msg.requestStreaming = decoder.readBool()
489580 }
490-
491581 tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
492582 msg.responseTypeUrl = decoder.readString()
493583 }
494-
495584 tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .VARINT -> {
496585 msg.responseStreaming = decoder.readBool()
497586 }
498-
499587 tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
500588 val elem = com.google.protobuf.kotlin.OptionInternal ()
501589 decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal ::decodeWith)
502590 (msg.options as MutableList ).add(elem)
503591 }
504-
505592 tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .VARINT -> {
506593 msg.syntax = com.google.protobuf.kotlin.Syntax .fromNumber(decoder.readEnum())
507594 }
508-
509595 else -> {
510596 if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType .END_GROUP ) {
511597 throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException (" Unexpected END_GROUP tag." )
@@ -580,11 +666,9 @@ public fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: co
580666 tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
581667 msg.name = decoder.readString()
582668 }
583-
584669 tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType .LENGTH_DELIMITED -> {
585670 msg.root = decoder.readString()
586671 }
587-
588672 else -> {
589673 if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType .END_GROUP ) {
590674 throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException (" Unexpected END_GROUP tag." )
0 commit comments