diff options
Diffstat (limited to 'src/objective-c/GRPCClient/GRPCCall.h')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 5918f8857a..c9fda42855 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -50,6 +50,8 @@ #import <Foundation/Foundation.h> #import <RxLibrary/GRXWriter.h> +#include <AvailabilityMacros.h> + #pragma mark gRPC errors /** Domain of NSError objects produced by gRPC. */ @@ -161,6 +163,9 @@ extern id const kGRPCTrailersKey; #pragma mark GRPCCall +/** Represents a single gRPC remote call. */ +@interface GRPCCall : GRXWriter + /** * The container of the request headers of an RPC conforms to this protocol, which is a subset of * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. @@ -170,21 +175,6 @@ extern id const kGRPCTrailersKey; * A header value is a NSString object (with only ASCII characters), unless the header name has the * suffix "-bin", in which case the value has to be a NSData object. */ -@protocol GRPCRequestHeaders <NSObject> - -@property(nonatomic, readonly) NSUInteger count; - -- (id)objectForKeyedSubscript:(NSString *)key; -- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key; - -- (void)removeAllObjects; -- (void)removeObjectForKey:(NSString *)key; - -@end - -/** Represents a single gRPC remote call. */ -@interface GRPCCall : GRXWriter - /** * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a * name-value pair with string names and either string or binary values. @@ -200,7 +190,7 @@ extern id const kGRPCTrailersKey; * * The property is initialized to an empty NSMutableDictionary. */ -@property(atomic, readonly) id<GRPCRequestHeaders> requestHeaders; +@property(atomic, readonly) NSMutableDictionary *requestHeaders; /** * This dictionary is populated with the HTTP headers received from the server. This happens before @@ -243,3 +233,24 @@ extern id const kGRPCTrailersKey; // TODO(jcanizales): Let specify a deadline. As a category of GRXWriter? @end + +#pragma mark Backwards compatibiity + +/** This protocol is kept for backwards compatibility with existing code. */ +DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") +@protocol GRPCRequestHeaders <NSObject> +@property(nonatomic, readonly) NSUInteger count; + +- (id)objectForKeyedSubscript:(NSString *)key; +- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key; + +- (void)removeAllObjects; +- (void)removeObjectForKey:(NSString *)key; +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +/** This is only needed for backwards-compatibility. */ +@interface NSMutableDictionary (GRPCRequestHeaders) <GRPCRequestHeaders> +@end +#pragma clang diagnostic pop |