aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/ProtoRPC
diff options
context:
space:
mode:
authorGravatar Hongwei Wang <hongweiw@google.com>2015-07-17 17:38:34 -0700
committerGravatar Hongwei Wang <hongweiw@google.com>2015-07-17 17:38:34 -0700
commitb307ae280b974a927cd1319ffd974c1dd90ec95d (patch)
treee38b428e51ec491cc7aac5a78925540092079131 /src/objective-c/ProtoRPC
parenteec3b9103baa784bbcd6be10d101ab53b1f169de (diff)
parentefccb3f5ce7cae89739d3a0474fcc0d6e2a5b12c (diff)
Merge branch 'master' into zookeeper
Diffstat (limited to 'src/objective-c/ProtoRPC')
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.h2
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.m16
-rw-r--r--src/objective-c/ProtoRPC/ProtoService.h4
-rw-r--r--src/objective-c/ProtoRPC/ProtoService.m2
4 files changed, 11 insertions, 13 deletions
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h
index fcc0a507fe..bd926b7328 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.h
+++ b/src/objective-c/ProtoRPC/ProtoRPC.h
@@ -40,7 +40,7 @@
- (instancetype)initWithHost:(NSString *)host
method:(ProtoMethod *)method
- requestsWriter:(id<GRXWriter>)requestsWriter
+ requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable NS_DESIGNATED_INITIALIZER;
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index fe3ccf0541..889d71a308 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -35,7 +35,6 @@
#import <GPBProtocolBuffers.h>
#import <RxLibrary/GRXWriteable.h>
-#import <RxLibrary/GRXWriter.h>
#import <RxLibrary/GRXWriter+Transformations.h>
@implementation ProtoRPC {
@@ -46,7 +45,7 @@
#pragma clang diagnostic ignored "-Wobjc-designated-initializers"
- (instancetype)initWithHost:(NSString *)host
path:(NSString *)path
- requestsWriter:(id<GRXWriter>)requestsWriter {
+ requestsWriter:(GRXWriter *)requestsWriter {
[NSException raise:NSInvalidArgumentException
format:@"Please use ProtoRPC's designated initializer instead."];
return nil;
@@ -56,7 +55,7 @@
// Designated initializer
- (instancetype)initWithHost:(NSString *)host
method:(ProtoMethod *)method
- requestsWriter:(id<GRXWriter>)requestsWriter
+ requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable {
// Because we can't tell the type system to constrain the class, we need to check at runtime:
@@ -65,12 +64,11 @@
format:@"A protobuf class to parse the responses must be provided."];
}
// A writer that serializes the proto messages to send.
- id<GRXWriter> bytesWriter =
- [[[GRXWriter alloc] initWithWriter:requestsWriter] map:^id(GPBMessage *proto) {
- // TODO(jcanizales): Fail with an understandable error message if the requestsWriter isn't
- // sending GPBMessages.
- return [proto data];
- }];
+ GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) {
+ // TODO(jcanizales): Fail with an understandable error message if the requestsWriter isn't
+ // sending GPBMessages.
+ return [proto data];
+ }];
if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) {
// A writeable that parses the proto messages received.
_responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h
index c5ef820f48..2e8cb33696 100644
--- a/src/objective-c/ProtoRPC/ProtoService.h
+++ b/src/objective-c/ProtoRPC/ProtoService.h
@@ -35,7 +35,7 @@
@class ProtoRPC;
@protocol GRXWriteable;
-@protocol GRXWriter;
+@class GRXWriter;
@interface ProtoService : NSObject
- (instancetype)initWithHost:(NSString *)host
@@ -43,7 +43,7 @@
serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER;
- (ProtoRPC *)RPCToMethod:(NSString *)method
- requestsWriter:(id<GRXWriter>)requestsWriter
+ requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable;
@end
diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m
index d7c5b6a850..fccc6aadc9 100644
--- a/src/objective-c/ProtoRPC/ProtoService.m
+++ b/src/objective-c/ProtoRPC/ProtoService.m
@@ -66,7 +66,7 @@
}
- (ProtoRPC *)RPCToMethod:(NSString *)method
- requestsWriter:(id<GRXWriter>)requestsWriter
+ requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable {
ProtoMethod *methodName = [[ProtoMethod alloc] initWithPackage:_packageName