aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/ProtoRPC/ProtoRPC.h
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-10-16 15:34:39 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-10-16 15:34:39 -0700
commitbf092064962664a1a949750c9f9b273f7d27c529 (patch)
treea91fa94f703d0b81a49bed32a7e497a36e82a527 /src/objective-c/ProtoRPC/ProtoRPC.h
parente69a7cc7f7497e67232843a3843f543740480c4e (diff)
Separate GRPCProtoResponseHandler from GRPCResponseHandler
Diffstat (limited to 'src/objective-c/ProtoRPC/ProtoRPC.h')
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h
index a045ef10a6..d20098ce8c 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.h
+++ b/src/objective-c/ProtoRPC/ProtoRPC.h
@@ -23,6 +23,39 @@
@class GPBMessage;
+/** An object can implement this protocol to receive responses from server from a call. */
+@protocol GRPCProtoResponseHandler <NSObject>
+
+@optional
+
+/** Issued when initial metadata is received from the server. */
+- (void)receivedInitialMetadata:(NSDictionary *)initialMetadata;
+
+/**
+ * Issued when a message is received from the server. The message is the deserialized proto object.
+ */
+- (void)receivedProtoMessage:(id)message;
+
+/**
+ * Issued when a call finished. If the call finished successfully, \a error is nil and \a
+ * trainingMetadata consists any trailing metadata received from the server. Otherwise, \a error
+ * is non-nil and contains the corresponding error information, including gRPC error codes and
+ * error descriptions.
+ */
+- (void)closedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error;
+
+@required
+
+/**
+ * All the responses must be issued to a user-provided dispatch queue. This property specifies the
+ * dispatch queue to be used for issuing the notifications. A serial queue should be provided if
+ * the order of responses (initial metadata, message, message, ..., message, trailing metadata)
+ * needs to be maintained.
+ */
+@property(atomic, readonly) dispatch_queue_t dispatchQueue;
+
+@end
+
/** A unary-request RPC call with Protobuf. */
@interface GRPCUnaryProtoCall : NSObject
@@ -36,7 +69,7 @@
*/
- (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
message:(GPBMessage *)message
- responseHandler:(id<GRPCResponseHandler>)handler
+ responseHandler:(id<GRPCProtoResponseHandler>)handler
callOptions:(GRPCCallOptions *)callOptions
responseClass:(Class)responseClass NS_DESIGNATED_INITIALIZER;
@@ -57,7 +90,7 @@
* returned to users by methods of the generated service.
*/
- (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
- responseHandler:(id<GRPCResponseHandler>)handler
+ responseHandler:(id<GRPCProtoResponseHandler>)handler
callOptions:(GRPCCallOptions *)callOptions
responseClass:(Class)responseClass NS_DESIGNATED_INITIALIZER;