Skip to content

Commit 35956c8

Browse files
authored
Merge pull request #3284 from jclyne/jclyne/client-streaming-enhancements
Client Streaming Enhancements
2 parents 904dd81 + 08855ec commit 35956c8

File tree

31 files changed

+992
-49
lines changed

31 files changed

+992
-49
lines changed

gen-tests.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ val generateGrpcTests by tasks.creating(JavaExec::class) {
564564
args = listOf(
565565
"--proto_path=wire-grpc-tests/src/test/proto",
566566
"--kotlin_out=wire-grpc-tests/src/test/proto-grpc",
567+
"--kotlin_explicit_streaming_calls",
567568
"routeguide/RouteGuideProto.proto"
568569
) + GRPC_PROTOS
569570
}

wire-compiler/api/wire-compiler.api

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public final class com/squareup/wire/DryRunFileSystem : okio/ForwardingFileSyste
88
public final class com/squareup/wire/WireCompiler {
99
public static final field CODE_GENERATED_BY_WIRE Ljava/lang/String;
1010
public static final field Companion Lcom/squareup/wire/WireCompiler$Companion;
11-
public synthetic fun <init> (Lokio/FileSystem;Lcom/squareup/wire/WireLogger;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/Map;ZZZZZZZZIZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZLjava/lang/String;ZZZLjava/util/List;Ljava/util/Map;Ljava/util/List;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
11+
public synthetic fun <init> (Lokio/FileSystem;Lcom/squareup/wire/WireLogger;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/Map;ZZZZZZZZIZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZLjava/lang/String;ZZZZLjava/util/List;Ljava/util/Map;Ljava/util/List;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
1212
public final fun compile ()V
1313
public static final fun forArgs (Ljava/nio/file/FileSystem;Lcom/squareup/wire/WireLogger;[Ljava/lang/String;)Lcom/squareup/wire/WireCompiler;
1414
public static final fun forArgs (Lokio/FileSystem;Lcom/squareup/wire/WireLogger;[Ljava/lang/String;)Lcom/squareup/wire/WireCompiler;
@@ -31,6 +31,7 @@ public final class com/squareup/wire/WireCompiler {
3131
public final fun getKotlinBuildersOnly ()Z
3232
public final fun getKotlinEscapeKeywords ()Z
3333
public final fun getKotlinExclusive ()Z
34+
public final fun getKotlinExplicitStreamingCalls ()Z
3435
public final fun getKotlinNameSuffix ()Ljava/lang/String;
3536
public final fun getKotlinOut ()Ljava/lang/String;
3637
public final fun getKotlinRpcCallStyle ()Lcom/squareup/wire/kotlin/RpcCallStyle;
@@ -117,8 +118,8 @@ public final class com/squareup/wire/schema/JavaTarget : com/squareup/wire/schem
117118
}
118119

119120
public final class com/squareup/wire/schema/KotlinTarget : com/squareup/wire/schema/Target {
120-
public fun <init> (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZ)V
121-
public synthetic fun <init> (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
121+
public fun <init> (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZZ)V
122+
public synthetic fun <init> (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
122123
public final fun component1 ()Ljava/util/List;
123124
public final fun component10 ()Lcom/squareup/wire/kotlin/RpcRole;
124125
public final fun component11 ()Z
@@ -135,8 +136,8 @@ public final class com/squareup/wire/schema/KotlinTarget : com/squareup/wire/sch
135136
public final fun component7 ()Z
136137
public final fun component8 ()Z
137138
public final fun component9 ()Lcom/squareup/wire/kotlin/RpcCallStyle;
138-
public final fun copy (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZ)Lcom/squareup/wire/schema/KotlinTarget;
139-
public static synthetic fun copy$default (Lcom/squareup/wire/schema/KotlinTarget;Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZILjava/lang/Object;)Lcom/squareup/wire/schema/KotlinTarget;
139+
public final fun copy (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZZ)Lcom/squareup/wire/schema/KotlinTarget;
140+
public static synthetic fun copy$default (Lcom/squareup/wire/schema/KotlinTarget;Ljava/util/List;Ljava/util/List;ZLjava/lang/String;ZZZZLcom/squareup/wire/kotlin/RpcCallStyle;Lcom/squareup/wire/kotlin/RpcRole;ZILjava/lang/String;ZZLcom/squareup/wire/kotlin/EnumMode;ZZZILjava/lang/Object;)Lcom/squareup/wire/schema/KotlinTarget;
140141
public fun copyTarget (Ljava/util/List;Ljava/util/List;ZLjava/lang/String;)Lcom/squareup/wire/schema/Target;
141142
public fun equals (Ljava/lang/Object;)Z
142143
public final fun getAndroid ()Z

wire-compiler/src/main/java/com/squareup/wire/WireCompiler.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class WireCompiler internal constructor(
142142
val kotlinBuildersOnly: Boolean,
143143
val kotlinEscapeKeywords: Boolean,
144144
val emitProtoReader32: Boolean,
145+
val kotlinExplicitStreamingCalls: Boolean,
145146
val eventListenerFactoryClasses: List<String>,
146147
val customOptions: Map<String, String>,
147148
val opaqueTypes: List<String> = listOf(),
@@ -177,6 +178,7 @@ class WireCompiler internal constructor(
177178
buildersOnly = kotlinBuildersOnly,
178179
escapeKotlinKeywords = kotlinEscapeKeywords,
179180
emitProtoReader32 = emitProtoReader32,
181+
explicitStreamingCalls = kotlinExplicitStreamingCalls,
180182
)
181183
}
182184
if (swiftOut != null) {
@@ -290,6 +292,7 @@ class WireCompiler internal constructor(
290292
private const val EMIT_PROTO_READER_32 = "--emit_proto_reader_32"
291293
private const val CUSTOM_OPTION_FLAG = "--custom_option="
292294
private const val OPAQUE_TYPES_FLAG = "--opaque_types="
295+
private const val KOTLIN_EXPLICIT_STREAMING_CALLS = "--kotlin_explicit_streaming_calls"
293296

294297
@Throws(IOException::class)
295298
@JvmStatic
@@ -353,6 +356,7 @@ class WireCompiler internal constructor(
353356
var kotlinBuildersOnly = false
354357
var kotlinEscapeKeywords = false
355358
var emitProtoReader32 = false
359+
var kotlinExplicitStreamingCalls = false
356360
var dryRun = false
357361
val customOptions = mutableMapOf<String, String>()
358362
val opaqueTypes = mutableListOf<String>()
@@ -473,6 +477,7 @@ class WireCompiler internal constructor(
473477
arg == LOAD_EXHAUSTIVELY -> loadExhaustively = true
474478
arg == JAVA_INTEROP -> javaInterop = true
475479
arg == EMIT_PROTO_READER_32 -> emitProtoReader32 = true
480+
arg == KOTLIN_EXPLICIT_STREAMING_CALLS -> kotlinExplicitStreamingCalls = true
476481
arg.startsWith("--") -> throw IllegalArgumentException("Unknown argument '$arg'.")
477482
else -> sourceFileNames.add(arg)
478483
}
@@ -527,6 +532,7 @@ class WireCompiler internal constructor(
527532
eventListenerFactoryClasses = eventListenerFactoryClasses,
528533
customOptions = customOptions,
529534
opaqueTypes = opaqueTypes,
535+
kotlinExplicitStreamingCalls = kotlinExplicitStreamingCalls,
530536
)
531537
}
532538
}

wire-compiler/src/main/java/com/squareup/wire/schema/Target.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ data class KotlinTarget(
147147
* If true, the generated classes will be mutable..
148148
*/
149149
private val mutableTypes: Boolean = false,
150+
151+
/**
152+
* If true, the generated gRPC client will use explicit classes for client, server,
153+
* and bidirectional streaming calls.
154+
*/
155+
private val explicitStreamingCalls: Boolean = false,
156+
150157
) : Target() {
151158
override fun newHandler(): SchemaHandler {
152159
return KotlinSchemaHandler(
@@ -165,6 +172,7 @@ data class KotlinTarget(
165172
enumMode = enumMode,
166173
emitProtoReader32 = emitProtoReader32,
167174
mutableTypes = mutableTypes,
175+
explicitStreamingCalls = explicitStreamingCalls,
168176
)
169177
}
170178

wire-gradle-plugin/api/wire-gradle-plugin.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class com/squareup/wire/gradle/KotlinOutput : com/squareup/wire/gradle/Wi
5252
public final fun getEscapeKotlinKeywords ()Z
5353
public final fun getExcludes ()Ljava/util/List;
5454
public final fun getExclusive ()Z
55+
public final fun getExplicitStreamingCalls ()Z
5556
public final fun getGrpcServerCompatible ()Z
5657
public final fun getIncludes ()Ljava/util/List;
5758
public final fun getJavaInterop ()Z
@@ -70,6 +71,7 @@ public class com/squareup/wire/gradle/KotlinOutput : com/squareup/wire/gradle/Wi
7071
public final fun setEscapeKotlinKeywords (Z)V
7172
public final fun setExcludes (Ljava/util/List;)V
7273
public final fun setExclusive (Z)V
74+
public final fun setExplicitStreamingCalls (Z)V
7375
public final fun setGrpcServerCompatible (Z)V
7476
public final fun setIncludes (Ljava/util/List;)V
7577
public final fun setJavaInterop (Z)V

wire-gradle-plugin/src/main/kotlin/com/squareup/wire/gradle/WireOutput.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ open class KotlinOutput @Inject constructor() : WireOutput() {
159159
*/
160160
var mutableTypes: Boolean = false
161161

162+
/**
163+
* If true, the generated gRPC client will use explicit classes for client, server,
164+
* and bidirectional streaming calls.
165+
*/
166+
var explicitStreamingCalls: Boolean = false
167+
162168
override fun toTarget(outputDirectory: String): KotlinTarget {
163169
if (grpcServerCompatible) {
164170
throw IllegalArgumentException(
@@ -203,6 +209,7 @@ open class KotlinOutput @Inject constructor() : WireOutput() {
203209
enumMode = enumMode,
204210
emitProtoReader32 = emitProtoReader32,
205211
mutableTypes = mutableTypes,
212+
explicitStreamingCalls = explicitStreamingCalls,
206213
)
207214
}
208215
}

wire-grpc-client/api/wire-grpc-client.api

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public abstract interface class com/squareup/wire/GrpcCall$Callback {
2020

2121
public final class com/squareup/wire/GrpcCalls {
2222
public static final fun grpcCall (Lkotlin/jvm/functions/Function1;)Lcom/squareup/wire/GrpcCall;
23+
public static final fun grpcClientStreamingCall (Lkotlin/jvm/functions/Function2;)Lcom/squareup/wire/GrpcClientStreamingCall;
24+
public static final fun grpcServerStreamingCall (Lkotlin/jvm/functions/Function3;)Lcom/squareup/wire/GrpcServerStreamingCall;
2325
public static final fun grpcStreamingCall (Lkotlin/jvm/functions/Function3;)Lcom/squareup/wire/GrpcStreamingCall;
2426
}
2527

@@ -28,6 +30,8 @@ public abstract class com/squareup/wire/GrpcClient {
2830
public final fun create (Lkotlin/reflect/KClass;)Lcom/squareup/wire/Service;
2931
public final fun newBuilder ()Lcom/squareup/wire/GrpcClient$Builder;
3032
public abstract fun newCall (Lcom/squareup/wire/GrpcMethod;)Lcom/squareup/wire/GrpcCall;
33+
public abstract fun newClientStreamingCall (Lcom/squareup/wire/GrpcMethod;)Lcom/squareup/wire/GrpcClientStreamingCall;
34+
public abstract fun newServerStreamingCall (Lcom/squareup/wire/GrpcMethod;)Lcom/squareup/wire/GrpcServerStreamingCall;
3135
public abstract fun newStreamingCall (Lcom/squareup/wire/GrpcMethod;)Lcom/squareup/wire/GrpcStreamingCall;
3236
}
3337

@@ -41,6 +45,25 @@ public final class com/squareup/wire/GrpcClient$Builder {
4145
public final fun minMessageToCompress (J)Lcom/squareup/wire/GrpcClient$Builder;
4246
}
4347

48+
public abstract interface class com/squareup/wire/GrpcClientStreamingCall {
49+
public abstract fun cancel ()V
50+
public abstract fun clone ()Lcom/squareup/wire/GrpcClientStreamingCall;
51+
public abstract fun executeBlocking ()Lkotlin/Pair;
52+
public abstract fun executeIn (Lkotlinx/coroutines/CoroutineScope;)Lkotlin/Pair;
53+
public abstract fun getMethod ()Lcom/squareup/wire/GrpcMethod;
54+
public abstract fun getRequestMetadata ()Ljava/util/Map;
55+
public abstract fun getResponseMetadata ()Ljava/util/Map;
56+
public abstract fun getTimeout ()Lokio/Timeout;
57+
public abstract fun isCanceled ()Z
58+
public abstract fun isExecuted ()Z
59+
public abstract fun setRequestMetadata (Ljava/util/Map;)V
60+
}
61+
62+
public abstract interface class com/squareup/wire/GrpcDeferredResponse {
63+
public abstract fun close ()V
64+
public abstract fun get ()Ljava/lang/Object;
65+
}
66+
4467
public final class com/squareup/wire/GrpcException : java/io/IOException {
4568
public synthetic fun <init> (Lcom/squareup/wire/GrpcStatus;Ljava/lang/String;[B)V
4669
public synthetic fun <init> (Lcom/squareup/wire/GrpcStatus;Ljava/lang/String;[BILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -63,6 +86,20 @@ public final class com/squareup/wire/GrpcMethod {
6386
public final fun getResponseAdapter ()Lcom/squareup/wire/ProtoAdapter;
6487
}
6588

89+
public abstract interface class com/squareup/wire/GrpcServerStreamingCall {
90+
public abstract fun cancel ()V
91+
public abstract fun clone ()Lcom/squareup/wire/GrpcServerStreamingCall;
92+
public abstract fun executeBlocking (Ljava/lang/Object;)Lcom/squareup/wire/MessageSource;
93+
public abstract fun executeIn (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
94+
public abstract fun getMethod ()Lcom/squareup/wire/GrpcMethod;
95+
public abstract fun getRequestMetadata ()Ljava/util/Map;
96+
public abstract fun getResponseMetadata ()Ljava/util/Map;
97+
public abstract fun getTimeout ()Lokio/Timeout;
98+
public abstract fun isCanceled ()Z
99+
public abstract fun isExecuted ()Z
100+
public abstract fun setRequestMetadata (Ljava/util/Map;)V
101+
}
102+
66103
public final class com/squareup/wire/GrpcStatus : java/io/Serializable {
67104
public static final field ABORTED Lcom/squareup/wire/GrpcStatus;
68105
public static final field ALREADY_EXISTS Lcom/squareup/wire/GrpcStatus;
@@ -106,6 +143,13 @@ public abstract interface class com/squareup/wire/GrpcStreamingCall {
106143
public abstract fun setRequestMetadata (Ljava/util/Map;)V
107144
}
108145

146+
public final class com/squareup/wire/GrpcStreamingCallExtensionsKt {
147+
public static final fun bidirectionalStream (Lcom/squareup/wire/GrpcStreamingCall;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
148+
public static final fun bidirectionalStreamBlocking (Lcom/squareup/wire/GrpcStreamingCall;Lkotlin/jvm/functions/Function2;)Lcom/squareup/wire/MessageSource;
149+
public static final fun clientStream (Lcom/squareup/wire/GrpcClientStreamingCall;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
150+
public static final fun clientStreamBlocking (Lcom/squareup/wire/GrpcClientStreamingCall;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
151+
}
152+
109153
public abstract interface annotation class com/squareup/wire/WireGrpcExperimental : java/lang/annotation/Annotation {
110154
}
111155

wire-grpc-client/src/commonMain/kotlin/com/squareup/wire/GrpcClient.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ package com.squareup.wire
1818
expect abstract class GrpcClient() {
1919
abstract fun <S : Any, R : Any> newCall(method: GrpcMethod<S, R>): GrpcCall<S, R>
2020
abstract fun <S : Any, R : Any> newStreamingCall(method: GrpcMethod<S, R>): GrpcStreamingCall<S, R>
21+
abstract fun <S : Any, R : Any> newClientStreamingCall(method: GrpcMethod<S, R>): GrpcClientStreamingCall<S, R>
22+
abstract fun <S : Any, R : Any> newServerStreamingCall(method: GrpcMethod<S, R>): GrpcServerStreamingCall<S, R>
2123
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright (C) 2025 Square, Inc.
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+
* https://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+
package com.squareup.wire
17+
18+
import kotlinx.coroutines.CoroutineScope
19+
import kotlinx.coroutines.Deferred
20+
import kotlinx.coroutines.Dispatchers
21+
import kotlinx.coroutines.channels.SendChannel
22+
import okio.IOException
23+
import okio.Timeout
24+
25+
/**
26+
* A single streaming call to a remote server.
27+
*
28+
* * This class handles a client streaming call . The send channel or message sink accept zero or more
29+
* messages. The returned deferred repsonse will ensure that the corresponding send channel or message sink
30+
* is closed before returning the single response message.
31+
*
32+
* A gRPC call cannot be executed twice.
33+
*
34+
* gRPC calls can be [suspending][executeIn] or [blocking][executeBlocking]. Use whichever mechanism
35+
* works at your call site: the bytes transmitted on the network are the same.
36+
*/
37+
interface GrpcClientStreamingCall<S : Any, R : Any> {
38+
/** The method invoked by this call. */
39+
val method: GrpcMethod<S, R>
40+
41+
/**
42+
* Configures how long the call can take to complete before it is automatically canceled. The
43+
* timeout applies to the full set of messages transmitted. For long-running streams you must
44+
* configure a sufficiently long timeout.
45+
*/
46+
val timeout: Timeout
47+
48+
/**
49+
* A map containing request metadata. This is initially empty; it can be assigned to any other map
50+
* of metadata before the call is executed. It is an error to set this value after the call is
51+
* executed.
52+
*/
53+
var requestMetadata: Map<String, String>
54+
55+
/**
56+
* A map containing response metadata. This is null until the call has executed, at which point
57+
* it will be non-null if the call completed successfully. It may also be non-null in failure
58+
* cases if the failure was not a problem of connectivity. For example, if the gRPC call fails
59+
* with an HTTP 503 error, response metadata will be present.
60+
*/
61+
val responseMetadata: Map<String, String>?
62+
63+
/**
64+
* Attempts to cancel the call. This function is safe to call concurrently with execution. When
65+
* canceled, execution fails with an immediate [IOException] rather than waiting to complete
66+
* normally.
67+
*/
68+
fun cancel()
69+
70+
/** True if [cancel] was called. */
71+
fun isCanceled(): Boolean
72+
73+
/**
74+
* Enqueues this call for execution and returns a channel to send the call's messages and a deferred
75+
* response that will ensure the sender is closed and return the single response.
76+
* This uses the [Dispatchers.IO] to transmit outbound messages.
77+
*/
78+
fun executeIn(scope: CoroutineScope): Pair<SendChannel<S>, Deferred<R>>
79+
80+
/**
81+
* Enqueues this call for execution and returns a stream to send call's messages and a deferred
82+
* response that will ensure the sender is closed and return the single response.
83+
* Reads and writes on the returned streams are blocking.
84+
*/
85+
fun executeBlocking(): Pair<MessageSink<S>, GrpcDeferredResponse<R>>
86+
87+
/**
88+
* Returns true if [executeIn] or [executeBlocking] was called. It is an error to execute a call
89+
* more than once.
90+
*/
91+
fun isExecuted(): Boolean
92+
93+
/**
94+
* Create a new, identical gRPC call to this one which can be enqueued or executed even if this
95+
* call has already been.
96+
*/
97+
fun clone(): GrpcClientStreamingCall<S, R>
98+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (C) 2025 Square, Inc.
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+
* https://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+
package com.squareup.wire
17+
18+
interface GrpcDeferredResponse<T : Any> {
19+
20+
fun get(): T
21+
22+
fun close()
23+
}

0 commit comments

Comments
 (0)