Merge pull request #1636 from jcanizales/move-sample-to-proto3

Move sample app and tests to proto3
pull/1639/head
Michael Lumish 10 years ago
commit 7dff30d8fb
  1. 6
      gRPC.podspec
  2. 4
      src/objective-c/ProtoRPC/ProtoRPC.m
  3. 1
      src/objective-c/examples/Sample/Podfile
  4. 103
      src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.h
  5. 179
      src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.m
  6. 33
      src/objective-c/examples/Sample/RemoteTestClient/Empty.pbobjc.h
  7. 59
      src/objective-c/examples/Sample/RemoteTestClient/Empty.pbobjc.m
  8. 578
      src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.h
  9. 2256
      src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.m
  10. 221
      src/objective-c/examples/Sample/RemoteTestClient/Messages.pbobjc.h
  11. 603
      src/objective-c/examples/Sample/RemoteTestClient/Messages.pbobjc.m
  12. 20
      src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec
  13. 167
      src/objective-c/examples/Sample/RemoteTestClient/Test.pb.h
  14. 163
      src/objective-c/examples/Sample/RemoteTestClient/Test.pb.m
  15. 12
      src/objective-c/examples/Sample/RemoteTestClient/Test.pbobjc.h
  16. 9
      src/objective-c/examples/Sample/RemoteTestClient/Test.pbobjc.m
  17. 59
      src/objective-c/examples/Sample/RemoteTestClient/Test.pbrpc.h
  18. 96
      src/objective-c/examples/Sample/RemoteTestClient/Test.pbrpc.m
  19. 6
      src/objective-c/examples/Sample/RemoteTestClient/empty.proto
  20. 40
      src/objective-c/examples/Sample/RemoteTestClient/messages.proto
  21. 21
      src/objective-c/examples/Sample/RemoteTestClient/test.proto
  22. 134
      src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.h
  23. 355
      src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.m
  24. 43
      src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.h
  25. 72
      src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.m
  26. 387
      src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.h
  27. 1435
      src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.m
  28. 19
      src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec
  29. 35
      src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto
  30. 37
      src/objective-c/examples/Sample/Sample/ViewController.m
  31. 120
      src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
  32. 11
      src/objective-c/examples/Sample/SampleTests/RemoteTests.m
  33. 30
      src/objective-c/examples/Sample/SampleTests/SampleTests.m

@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.homepage = 'https://www.grpc.io'
s.license = 'New BSD'
s.authors = { 'Jorge Canizales' => 'jcanizales@google.com',
'Michael Lumish' => 'mlumish@google.com' }
'Michael Lumish' => 'mlumish@google.com' }
# s.source = { :git => 'https://github.com/grpc/grpc.git', :tag => 'release-0_5_0' }
@ -67,7 +67,8 @@ Pod::Spec.new do |s|
s.subspec 'GRPCClient' do |gs|
gs.summary = 'Objective-C wrapper around the core gRPC library.'
gs.authors = { 'Jorge Canizales' => 'jcanizales@google.com' }
gs.authors = { 'Jorge Canizales' => 'jcanizales@google.com',
'Michael Lumish' => 'mlumish@google.com' }
gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}',
'src/objective-c/GRPCClient/private/*.{h,m}'
@ -90,5 +91,6 @@ Pod::Spec.new do |s|
ps.dependency 'gRPC/GRPCClient'
ps.dependency 'gRPC/RxLibrary'
ps.dependency 'Protobuf', '~> 3.0'
end
end

@ -36,7 +36,7 @@
#import <gRPC/GRXWriteable.h>
#import <gRPC/GRXWriter.h>
#import <gRPC/GRXWriter+Transformations.h>
#import <ProtocolBuffers/ProtocolBuffers.h>
#import <Protobuf/GPBProtocolBuffers.h>
@implementation ProtoRPC {
id<GRXWriteable> _responseWriteable;
@ -65,7 +65,7 @@
}
// A writer that serializes the proto messages to send.
id<GRXWriter> bytesWriter =
[[[GRXWriter alloc] initWithWriter:requestsWriter] map:^id(PBGeneratedMessage *proto) {
[[[GRXWriter alloc] initWithWriter:requestsWriter] map:^id(GPBMessage *proto) {
return [proto data];
}];
if ((self = [super initWithHost:host method:method requestsWriter:bytesWriter])) {

@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'gRPC', :path => "../../../.."
pod 'Protobuf', :git => 'https://github.com/jcanizales/protobuf.git', :branch => 'add-podspec'
pod 'Route_guide', :path => "RouteGuideClient"
pod 'RemoteTest', :path => "RemoteTestClient"

@ -1,103 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import <ProtocolBuffers/ProtocolBuffers.h>
// @@protoc_insertion_point(imports)
@class ObjectiveCFileOptions;
@class ObjectiveCFileOptionsBuilder;
@class PBDescriptorProto;
@class PBDescriptorProtoBuilder;
@class PBDescriptorProtoExtensionRange;
@class PBDescriptorProtoExtensionRangeBuilder;
@class PBEnumDescriptorProto;
@class PBEnumDescriptorProtoBuilder;
@class PBEnumOptions;
@class PBEnumOptionsBuilder;
@class PBEnumValueDescriptorProto;
@class PBEnumValueDescriptorProtoBuilder;
@class PBEnumValueOptions;
@class PBEnumValueOptionsBuilder;
@class PBFieldDescriptorProto;
@class PBFieldDescriptorProtoBuilder;
@class PBFieldOptions;
@class PBFieldOptionsBuilder;
@class PBFileDescriptorProto;
@class PBFileDescriptorProtoBuilder;
@class PBFileDescriptorSet;
@class PBFileDescriptorSetBuilder;
@class PBFileOptions;
@class PBFileOptionsBuilder;
@class PBMessageOptions;
@class PBMessageOptionsBuilder;
@class PBMethodDescriptorProto;
@class PBMethodDescriptorProtoBuilder;
@class PBMethodOptions;
@class PBMethodOptionsBuilder;
@class PBOneofDescriptorProto;
@class PBOneofDescriptorProtoBuilder;
@class PBServiceDescriptorProto;
@class PBServiceDescriptorProtoBuilder;
@class PBServiceOptions;
@class PBServiceOptionsBuilder;
@class PBSourceCodeInfo;
@class PBSourceCodeInfoBuilder;
@class PBSourceCodeInfoLocation;
@class PBSourceCodeInfoLocationBuilder;
@class PBUninterpretedOption;
@class PBUninterpretedOptionBuilder;
@class PBUninterpretedOptionNamePart;
@class PBUninterpretedOptionNamePartBuilder;
@class RMTEmpty;
@class RMTEmptyBuilder;
@interface RMTEmptyRoot : NSObject {
}
+ (PBExtensionRegistry*) extensionRegistry;
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
@end
@interface RMTEmpty : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
}
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTEmptyBuilder*) builder;
+ (RMTEmptyBuilder*) builder;
+ (RMTEmptyBuilder*) builderWithPrototype:(RMTEmpty*) prototype;
- (RMTEmptyBuilder*) toBuilder;
+ (RMTEmpty*) parseFromData:(NSData*) data;
+ (RMTEmpty*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input;
+ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTEmptyBuilder : PBGeneratedMessageBuilder {
@private
RMTEmpty* resultEmpty;
}
- (RMTEmpty*) defaultInstance;
- (RMTEmptyBuilder*) clear;
- (RMTEmptyBuilder*) clone;
- (RMTEmpty*) build;
- (RMTEmpty*) buildPartial;
- (RMTEmptyBuilder*) mergeFrom:(RMTEmpty*) other;
- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
// @@protoc_insertion_point(global_scope)

@ -1,179 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import "Empty.pb.h"
// @@protoc_insertion_point(imports)
@implementation RMTEmptyRoot
static PBExtensionRegistry* extensionRegistry = nil;
+ (PBExtensionRegistry*) extensionRegistry {
return extensionRegistry;
}
+ (void) initialize {
if (self == [RMTEmptyRoot class]) {
PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry];
[self registerAllExtensions:registry];
[ObjectivecDescriptorRoot registerAllExtensions:registry];
extensionRegistry = registry;
}
}
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry {
}
@end
@interface RMTEmpty ()
@end
@implementation RMTEmpty
- (instancetype) init {
if ((self = [super init])) {
}
return self;
}
static RMTEmpty* defaultRMTEmptyInstance = nil;
+ (void) initialize {
if (self == [RMTEmpty class]) {
defaultRMTEmptyInstance = [[RMTEmpty alloc] init];
}
}
+ (instancetype) defaultInstance {
return defaultRMTEmptyInstance;
}
- (instancetype) defaultInstance {
return defaultRMTEmptyInstance;
}
- (BOOL) isInitialized {
return YES;
}
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output {
[self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32) serializedSize {
__block SInt32 size_ = memoizedSerializedSize;
if (size_ != -1) {
return size_;
}
size_ = 0;
size_ += self.unknownFields.serializedSize;
memoizedSerializedSize = size_;
return size_;
}
+ (RMTEmpty*) parseFromData:(NSData*) data {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromData:data] build];
}
+ (RMTEmpty*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromData:data extensionRegistry:extensionRegistry] build];
}
+ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromInputStream:input] build];
}
+ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromCodedInputStream:input] build];
}
+ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
return (RMTEmpty*)[[[RMTEmpty builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (RMTEmptyBuilder*) builder {
return [[RMTEmptyBuilder alloc] init];
}
+ (RMTEmptyBuilder*) builderWithPrototype:(RMTEmpty*) prototype {
return [[RMTEmpty builder] mergeFrom:prototype];
}
- (RMTEmptyBuilder*) builder {
return [RMTEmpty builder];
}
- (RMTEmptyBuilder*) toBuilder {
return [RMTEmpty builderWithPrototype:self];
}
- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent {
[self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (BOOL) isEqual:(id)other {
if (other == self) {
return YES;
}
if (![other isKindOfClass:[RMTEmpty class]]) {
return NO;
}
RMTEmpty *otherMessage = other;
return
(self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger) hash {
__block NSUInteger hashCode = 7;
hashCode = hashCode * 31 + [self.unknownFields hash];
return hashCode;
}
@end
@interface RMTEmptyBuilder()
@property (strong) RMTEmpty* resultEmpty;
@end
@implementation RMTEmptyBuilder
@synthesize resultEmpty;
- (instancetype) init {
if ((self = [super init])) {
self.resultEmpty = [[RMTEmpty alloc] init];
}
return self;
}
- (PBGeneratedMessage*) internalGetResult {
return resultEmpty;
}
- (RMTEmptyBuilder*) clear {
self.resultEmpty = [[RMTEmpty alloc] init];
return self;
}
- (RMTEmptyBuilder*) clone {
return [RMTEmpty builderWithPrototype:resultEmpty];
}
- (RMTEmpty*) defaultInstance {
return [RMTEmpty defaultInstance];
}
- (RMTEmpty*) build {
[self checkInitialized];
return [self buildPartial];
}
- (RMTEmpty*) buildPartial {
RMTEmpty* returnMe = resultEmpty;
self.resultEmpty = nil;
return returnMe;
}
- (RMTEmptyBuilder*) mergeFrom:(RMTEmpty*) other {
if (other == [RMTEmpty defaultInstance]) {
return self;
}
[self mergeUnknownFields:other.unknownFields];
return self;
}
- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input {
return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]];
}
- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields];
while (YES) {
SInt32 tag = [input readTag];
switch (tag) {
case 0:
[self setUnknownFields:[unknownFields build]];
return self;
default: {
if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) {
[self setUnknownFields:[unknownFields build]];
return self;
}
break;
}
}
}
}
@end
// @@protoc_insertion_point(global_scope)

@ -0,0 +1,33 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: empty.proto
#import "GPBProtocolBuffers.h"
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources.
#endif
CF_EXTERN_C_BEGIN
@class RMTEmpty;
#pragma mark - RMTEmptyRoot
@interface RMTEmptyRoot : GPBRootObject
@end
#pragma mark - RMTEmpty
// An empty message that you can re-use to avoid defining duplicated empty
// messages in your project. A typical example is to use it as argument or the
// return value of a service API. For instance:
//
// service Foo {
// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
// };
@interface RMTEmpty : GPBMessage
@end
CF_EXTERN_C_END

@ -0,0 +1,59 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: empty.proto
#import "GPBProtocolBuffers_RuntimeSupport.h"
#import "Empty.pbobjc.h"
#pragma mark - RMTEmptyRoot
@implementation RMTEmptyRoot
@end
static GPBFileDescriptor *RMTEmptyRoot_FileDescriptor(void) {
// This is called by +initialize so there is no need to worry
// about thread safety of the singleton.
static GPBFileDescriptor *descriptor = NULL;
if (!descriptor) {
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.testing"
syntax:GPBFileSyntaxProto3];
}
return descriptor;
}
#pragma mark - RMTEmpty
@implementation RMTEmpty
typedef struct RMTEmpty_Storage {
uint32_t _has_storage_[0];
} RMTEmpty_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTEmpty class]
rootClass:[RMTEmptyRoot class]
file:RMTEmptyRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTEmpty_Storage)
wireFormat:NO];
}
return descriptor;
}
@end

@ -1,578 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import <ProtocolBuffers/ProtocolBuffers.h>
// @@protoc_insertion_point(imports)
@class ObjectiveCFileOptions;
@class ObjectiveCFileOptionsBuilder;
@class PBDescriptorProto;
@class PBDescriptorProtoBuilder;
@class PBDescriptorProtoExtensionRange;
@class PBDescriptorProtoExtensionRangeBuilder;
@class PBEnumDescriptorProto;
@class PBEnumDescriptorProtoBuilder;
@class PBEnumOptions;
@class PBEnumOptionsBuilder;
@class PBEnumValueDescriptorProto;
@class PBEnumValueDescriptorProtoBuilder;
@class PBEnumValueOptions;
@class PBEnumValueOptionsBuilder;
@class PBFieldDescriptorProto;
@class PBFieldDescriptorProtoBuilder;
@class PBFieldOptions;
@class PBFieldOptionsBuilder;
@class PBFileDescriptorProto;
@class PBFileDescriptorProtoBuilder;
@class PBFileDescriptorSet;
@class PBFileDescriptorSetBuilder;
@class PBFileOptions;
@class PBFileOptionsBuilder;
@class PBMessageOptions;
@class PBMessageOptionsBuilder;
@class PBMethodDescriptorProto;
@class PBMethodDescriptorProtoBuilder;
@class PBMethodOptions;
@class PBMethodOptionsBuilder;
@class PBOneofDescriptorProto;
@class PBOneofDescriptorProtoBuilder;
@class PBServiceDescriptorProto;
@class PBServiceDescriptorProtoBuilder;
@class PBServiceOptions;
@class PBServiceOptionsBuilder;
@class PBSourceCodeInfo;
@class PBSourceCodeInfoBuilder;
@class PBSourceCodeInfoLocation;
@class PBSourceCodeInfoLocationBuilder;
@class PBUninterpretedOption;
@class PBUninterpretedOptionBuilder;
@class PBUninterpretedOptionNamePart;
@class PBUninterpretedOptionNamePartBuilder;
@class RMTPayload;
@class RMTPayloadBuilder;
@class RMTResponseParameters;
@class RMTResponseParametersBuilder;
@class RMTSimpleRequest;
@class RMTSimpleRequestBuilder;
@class RMTSimpleResponse;
@class RMTSimpleResponseBuilder;
@class RMTStreamingInputCallRequest;
@class RMTStreamingInputCallRequestBuilder;
@class RMTStreamingInputCallResponse;
@class RMTStreamingInputCallResponseBuilder;
@class RMTStreamingOutputCallRequest;
@class RMTStreamingOutputCallRequestBuilder;
@class RMTStreamingOutputCallResponse;
@class RMTStreamingOutputCallResponseBuilder;
typedef NS_ENUM(SInt32, RMTPayloadType) {
RMTPayloadTypeCompressable = 0,
RMTPayloadTypeUncompressable = 1,
RMTPayloadTypeRandom = 2,
};
BOOL RMTPayloadTypeIsValidValue(RMTPayloadType value);
NSString *NSStringFromRMTPayloadType(RMTPayloadType value);
@interface RMTMessagesRoot : NSObject {
}
+ (PBExtensionRegistry*) extensionRegistry;
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
@end
@interface RMTPayload : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasBody_:1;
BOOL hasType_:1;
NSData* body;
RMTPayloadType type;
}
- (BOOL) hasType;
- (BOOL) hasBody;
@property (readonly) RMTPayloadType type;
@property (readonly, strong) NSData* body;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTPayloadBuilder*) builder;
+ (RMTPayloadBuilder*) builder;
+ (RMTPayloadBuilder*) builderWithPrototype:(RMTPayload*) prototype;
- (RMTPayloadBuilder*) toBuilder;
+ (RMTPayload*) parseFromData:(NSData*) data;
+ (RMTPayload*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTPayload*) parseFromInputStream:(NSInputStream*) input;
+ (RMTPayload*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTPayloadBuilder : PBGeneratedMessageBuilder {
@private
RMTPayload* resultPayload;
}
- (RMTPayload*) defaultInstance;
- (RMTPayloadBuilder*) clear;
- (RMTPayloadBuilder*) clone;
- (RMTPayload*) build;
- (RMTPayload*) buildPartial;
- (RMTPayloadBuilder*) mergeFrom:(RMTPayload*) other;
- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasType;
- (RMTPayloadType) type;
- (RMTPayloadBuilder*) setType:(RMTPayloadType) value;
- (RMTPayloadBuilder*) clearType;
- (BOOL) hasBody;
- (NSData*) body;
- (RMTPayloadBuilder*) setBody:(NSData*) value;
- (RMTPayloadBuilder*) clearBody;
@end
@interface RMTSimpleRequest : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasFillUsername_:1;
BOOL hasFillOauthScope_:1;
BOOL hasResponseSize_:1;
BOOL hasPayload_:1;
BOOL hasResponseType_:1;
BOOL fillUsername_:1;
BOOL fillOauthScope_:1;
SInt32 responseSize;
RMTPayload* payload;
RMTPayloadType responseType;
}
- (BOOL) hasResponseType;
- (BOOL) hasResponseSize;
- (BOOL) hasPayload;
- (BOOL) hasFillUsername;
- (BOOL) hasFillOauthScope;
@property (readonly) RMTPayloadType responseType;
@property (readonly) SInt32 responseSize;
@property (readonly, strong) RMTPayload* payload;
- (BOOL) fillUsername;
- (BOOL) fillOauthScope;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTSimpleRequestBuilder*) builder;
+ (RMTSimpleRequestBuilder*) builder;
+ (RMTSimpleRequestBuilder*) builderWithPrototype:(RMTSimpleRequest*) prototype;
- (RMTSimpleRequestBuilder*) toBuilder;
+ (RMTSimpleRequest*) parseFromData:(NSData*) data;
+ (RMTSimpleRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input;
+ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTSimpleRequestBuilder : PBGeneratedMessageBuilder {
@private
RMTSimpleRequest* resultSimpleRequest;
}
- (RMTSimpleRequest*) defaultInstance;
- (RMTSimpleRequestBuilder*) clear;
- (RMTSimpleRequestBuilder*) clone;
- (RMTSimpleRequest*) build;
- (RMTSimpleRequest*) buildPartial;
- (RMTSimpleRequestBuilder*) mergeFrom:(RMTSimpleRequest*) other;
- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasResponseType;
- (RMTPayloadType) responseType;
- (RMTSimpleRequestBuilder*) setResponseType:(RMTPayloadType) value;
- (RMTSimpleRequestBuilder*) clearResponseType;
- (BOOL) hasResponseSize;
- (SInt32) responseSize;
- (RMTSimpleRequestBuilder*) setResponseSize:(SInt32) value;
- (RMTSimpleRequestBuilder*) clearResponseSize;
- (BOOL) hasPayload;
- (RMTPayload*) payload;
- (RMTSimpleRequestBuilder*) setPayload:(RMTPayload*) value;
- (RMTSimpleRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue;
- (RMTSimpleRequestBuilder*) mergePayload:(RMTPayload*) value;
- (RMTSimpleRequestBuilder*) clearPayload;
- (BOOL) hasFillUsername;
- (BOOL) fillUsername;
- (RMTSimpleRequestBuilder*) setFillUsername:(BOOL) value;
- (RMTSimpleRequestBuilder*) clearFillUsername;
- (BOOL) hasFillOauthScope;
- (BOOL) fillOauthScope;
- (RMTSimpleRequestBuilder*) setFillOauthScope:(BOOL) value;
- (RMTSimpleRequestBuilder*) clearFillOauthScope;
@end
@interface RMTSimpleResponse : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasUsername_:1;
BOOL hasOauthScope_:1;
BOOL hasPayload_:1;
NSString* username;
NSString* oauthScope;
RMTPayload* payload;
}
- (BOOL) hasPayload;
- (BOOL) hasUsername;
- (BOOL) hasOauthScope;
@property (readonly, strong) RMTPayload* payload;
@property (readonly, strong) NSString* username;
@property (readonly, strong) NSString* oauthScope;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTSimpleResponseBuilder*) builder;
+ (RMTSimpleResponseBuilder*) builder;
+ (RMTSimpleResponseBuilder*) builderWithPrototype:(RMTSimpleResponse*) prototype;
- (RMTSimpleResponseBuilder*) toBuilder;
+ (RMTSimpleResponse*) parseFromData:(NSData*) data;
+ (RMTSimpleResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input;
+ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTSimpleResponseBuilder : PBGeneratedMessageBuilder {
@private
RMTSimpleResponse* resultSimpleResponse;
}
- (RMTSimpleResponse*) defaultInstance;
- (RMTSimpleResponseBuilder*) clear;
- (RMTSimpleResponseBuilder*) clone;
- (RMTSimpleResponse*) build;
- (RMTSimpleResponse*) buildPartial;
- (RMTSimpleResponseBuilder*) mergeFrom:(RMTSimpleResponse*) other;
- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasPayload;
- (RMTPayload*) payload;
- (RMTSimpleResponseBuilder*) setPayload:(RMTPayload*) value;
- (RMTSimpleResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue;
- (RMTSimpleResponseBuilder*) mergePayload:(RMTPayload*) value;
- (RMTSimpleResponseBuilder*) clearPayload;
- (BOOL) hasUsername;
- (NSString*) username;
- (RMTSimpleResponseBuilder*) setUsername:(NSString*) value;
- (RMTSimpleResponseBuilder*) clearUsername;
- (BOOL) hasOauthScope;
- (NSString*) oauthScope;
- (RMTSimpleResponseBuilder*) setOauthScope:(NSString*) value;
- (RMTSimpleResponseBuilder*) clearOauthScope;
@end
@interface RMTStreamingInputCallRequest : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasPayload_:1;
RMTPayload* payload;
}
- (BOOL) hasPayload;
@property (readonly, strong) RMTPayload* payload;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTStreamingInputCallRequestBuilder*) builder;
+ (RMTStreamingInputCallRequestBuilder*) builder;
+ (RMTStreamingInputCallRequestBuilder*) builderWithPrototype:(RMTStreamingInputCallRequest*) prototype;
- (RMTStreamingInputCallRequestBuilder*) toBuilder;
+ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data;
+ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input;
+ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTStreamingInputCallRequestBuilder : PBGeneratedMessageBuilder {
@private
RMTStreamingInputCallRequest* resultStreamingInputCallRequest;
}
- (RMTStreamingInputCallRequest*) defaultInstance;
- (RMTStreamingInputCallRequestBuilder*) clear;
- (RMTStreamingInputCallRequestBuilder*) clone;
- (RMTStreamingInputCallRequest*) build;
- (RMTStreamingInputCallRequest*) buildPartial;
- (RMTStreamingInputCallRequestBuilder*) mergeFrom:(RMTStreamingInputCallRequest*) other;
- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasPayload;
- (RMTPayload*) payload;
- (RMTStreamingInputCallRequestBuilder*) setPayload:(RMTPayload*) value;
- (RMTStreamingInputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue;
- (RMTStreamingInputCallRequestBuilder*) mergePayload:(RMTPayload*) value;
- (RMTStreamingInputCallRequestBuilder*) clearPayload;
@end
@interface RMTStreamingInputCallResponse : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasAggregatedPayloadSize_:1;
SInt32 aggregatedPayloadSize;
}
- (BOOL) hasAggregatedPayloadSize;
@property (readonly) SInt32 aggregatedPayloadSize;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTStreamingInputCallResponseBuilder*) builder;
+ (RMTStreamingInputCallResponseBuilder*) builder;
+ (RMTStreamingInputCallResponseBuilder*) builderWithPrototype:(RMTStreamingInputCallResponse*) prototype;
- (RMTStreamingInputCallResponseBuilder*) toBuilder;
+ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data;
+ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input;
+ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTStreamingInputCallResponseBuilder : PBGeneratedMessageBuilder {
@private
RMTStreamingInputCallResponse* resultStreamingInputCallResponse;
}
- (RMTStreamingInputCallResponse*) defaultInstance;
- (RMTStreamingInputCallResponseBuilder*) clear;
- (RMTStreamingInputCallResponseBuilder*) clone;
- (RMTStreamingInputCallResponse*) build;
- (RMTStreamingInputCallResponse*) buildPartial;
- (RMTStreamingInputCallResponseBuilder*) mergeFrom:(RMTStreamingInputCallResponse*) other;
- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasAggregatedPayloadSize;
- (SInt32) aggregatedPayloadSize;
- (RMTStreamingInputCallResponseBuilder*) setAggregatedPayloadSize:(SInt32) value;
- (RMTStreamingInputCallResponseBuilder*) clearAggregatedPayloadSize;
@end
@interface RMTResponseParameters : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasSize_:1;
BOOL hasIntervalUs_:1;
SInt32 size;
SInt32 intervalUs;
}
- (BOOL) hasSize;
- (BOOL) hasIntervalUs;
@property (readonly) SInt32 size;
@property (readonly) SInt32 intervalUs;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTResponseParametersBuilder*) builder;
+ (RMTResponseParametersBuilder*) builder;
+ (RMTResponseParametersBuilder*) builderWithPrototype:(RMTResponseParameters*) prototype;
- (RMTResponseParametersBuilder*) toBuilder;
+ (RMTResponseParameters*) parseFromData:(NSData*) data;
+ (RMTResponseParameters*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input;
+ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTResponseParametersBuilder : PBGeneratedMessageBuilder {
@private
RMTResponseParameters* resultResponseParameters;
}
- (RMTResponseParameters*) defaultInstance;
- (RMTResponseParametersBuilder*) clear;
- (RMTResponseParametersBuilder*) clone;
- (RMTResponseParameters*) build;
- (RMTResponseParameters*) buildPartial;
- (RMTResponseParametersBuilder*) mergeFrom:(RMTResponseParameters*) other;
- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasSize;
- (SInt32) size;
- (RMTResponseParametersBuilder*) setSize:(SInt32) value;
- (RMTResponseParametersBuilder*) clearSize;
- (BOOL) hasIntervalUs;
- (SInt32) intervalUs;
- (RMTResponseParametersBuilder*) setIntervalUs:(SInt32) value;
- (RMTResponseParametersBuilder*) clearIntervalUs;
@end
@interface RMTStreamingOutputCallRequest : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasPayload_:1;
BOOL hasResponseType_:1;
RMTPayload* payload;
RMTPayloadType responseType;
NSMutableArray * responseParametersArray;
}
- (BOOL) hasResponseType;
- (BOOL) hasPayload;
@property (readonly) RMTPayloadType responseType;
@property (readonly, strong) NSArray * responseParameters;
@property (readonly, strong) RMTPayload* payload;
- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTStreamingOutputCallRequestBuilder*) builder;
+ (RMTStreamingOutputCallRequestBuilder*) builder;
+ (RMTStreamingOutputCallRequestBuilder*) builderWithPrototype:(RMTStreamingOutputCallRequest*) prototype;
- (RMTStreamingOutputCallRequestBuilder*) toBuilder;
+ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data;
+ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input;
+ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTStreamingOutputCallRequestBuilder : PBGeneratedMessageBuilder {
@private
RMTStreamingOutputCallRequest* resultStreamingOutputCallRequest;
}
- (RMTStreamingOutputCallRequest*) defaultInstance;
- (RMTStreamingOutputCallRequestBuilder*) clear;
- (RMTStreamingOutputCallRequestBuilder*) clone;
- (RMTStreamingOutputCallRequest*) build;
- (RMTStreamingOutputCallRequest*) buildPartial;
- (RMTStreamingOutputCallRequestBuilder*) mergeFrom:(RMTStreamingOutputCallRequest*) other;
- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasResponseType;
- (RMTPayloadType) responseType;
- (RMTStreamingOutputCallRequestBuilder*) setResponseType:(RMTPayloadType) value;
- (RMTStreamingOutputCallRequestBuilder*) clearResponseType;
- (NSMutableArray *)responseParameters;
- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index;
- (RMTStreamingOutputCallRequestBuilder *)addResponseParameters:(RMTResponseParameters*)value;
- (RMTStreamingOutputCallRequestBuilder *)setResponseParametersArray:(NSArray *)array;
- (RMTStreamingOutputCallRequestBuilder *)clearResponseParameters;
- (BOOL) hasPayload;
- (RMTPayload*) payload;
- (RMTStreamingOutputCallRequestBuilder*) setPayload:(RMTPayload*) value;
- (RMTStreamingOutputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue;
- (RMTStreamingOutputCallRequestBuilder*) mergePayload:(RMTPayload*) value;
- (RMTStreamingOutputCallRequestBuilder*) clearPayload;
@end
@interface RMTStreamingOutputCallResponse : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasPayload_:1;
RMTPayload* payload;
}
- (BOOL) hasPayload;
@property (readonly, strong) RMTPayload* payload;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RMTStreamingOutputCallResponseBuilder*) builder;
+ (RMTStreamingOutputCallResponseBuilder*) builder;
+ (RMTStreamingOutputCallResponseBuilder*) builderWithPrototype:(RMTStreamingOutputCallResponse*) prototype;
- (RMTStreamingOutputCallResponseBuilder*) toBuilder;
+ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data;
+ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input;
+ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RMTStreamingOutputCallResponseBuilder : PBGeneratedMessageBuilder {
@private
RMTStreamingOutputCallResponse* resultStreamingOutputCallResponse;
}
- (RMTStreamingOutputCallResponse*) defaultInstance;
- (RMTStreamingOutputCallResponseBuilder*) clear;
- (RMTStreamingOutputCallResponseBuilder*) clone;
- (RMTStreamingOutputCallResponse*) build;
- (RMTStreamingOutputCallResponse*) buildPartial;
- (RMTStreamingOutputCallResponseBuilder*) mergeFrom:(RMTStreamingOutputCallResponse*) other;
- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasPayload;
- (RMTPayload*) payload;
- (RMTStreamingOutputCallResponseBuilder*) setPayload:(RMTPayload*) value;
- (RMTStreamingOutputCallResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue;
- (RMTStreamingOutputCallResponseBuilder*) mergePayload:(RMTPayload*) value;
- (RMTStreamingOutputCallResponseBuilder*) clearPayload;
@end
// @@protoc_insertion_point(global_scope)

@ -0,0 +1,221 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: messages.proto
#import "GPBProtocolBuffers.h"
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources.
#endif
CF_EXTERN_C_BEGIN
@class RMTPayload;
@class RMTResponseParameters;
@class RMTSimpleRequest;
@class RMTSimpleResponse;
@class RMTStreamingInputCallRequest;
@class RMTStreamingInputCallResponse;
@class RMTStreamingOutputCallRequest;
@class RMTStreamingOutputCallResponse;
#pragma mark - Enum RMTPayloadType
// The type of payload that should be returned.
typedef GPB_ENUM(RMTPayloadType) {
RMTPayloadType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,
// Compressable text format.
RMTPayloadType_Compressable = 0,
// Uncompressable binary format.
RMTPayloadType_Uncompressable = 1,
// Randomly chosen from all other formats defined in this enum.
RMTPayloadType_Random = 2,
};
GPBEnumDescriptor *RMTPayloadType_EnumDescriptor(void);
BOOL RMTPayloadType_IsValidValue(int32_t value);
#pragma mark - RMTMessagesRoot
@interface RMTMessagesRoot : GPBRootObject
@end
#pragma mark - RMTPayload
typedef GPB_ENUM(RMTPayload_FieldNumber) {
RMTPayload_FieldNumber_Type = 1,
RMTPayload_FieldNumber_Body = 2,
};
// A block of data, to simply increase gRPC message size.
@interface RMTPayload : GPBMessage
// The type of data in body.
@property(nonatomic, readwrite) RMTPayloadType type;
// Primary contents of payload.
@property(nonatomic, readwrite, copy) NSData *body;
@end
int32_t RMTPayload_Type_RawValue(RMTPayload *message);
void SetRMTPayload_Type_RawValue(RMTPayload *message, int32_t value);
#pragma mark - RMTSimpleRequest
typedef GPB_ENUM(RMTSimpleRequest_FieldNumber) {
RMTSimpleRequest_FieldNumber_ResponseType = 1,
RMTSimpleRequest_FieldNumber_ResponseSize = 2,
RMTSimpleRequest_FieldNumber_Payload = 3,
RMTSimpleRequest_FieldNumber_FillUsername = 4,
RMTSimpleRequest_FieldNumber_FillOauthScope = 5,
};
// Unary request.
@interface RMTSimpleRequest : GPBMessage
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
@property(nonatomic, readwrite) RMTPayloadType responseType;
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
@property(nonatomic, readwrite) int32_t responseSize;
// Optional input payload sent along with the request.
@property(nonatomic, readwrite) BOOL hasPayload;
@property(nonatomic, readwrite, strong) RMTPayload *payload;
// Whether SimpleResponse should include username.
@property(nonatomic, readwrite) BOOL fillUsername;
// Whether SimpleResponse should include OAuth scope.
@property(nonatomic, readwrite) BOOL fillOauthScope;
@end
int32_t RMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message);
void SetRMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message, int32_t value);
#pragma mark - RMTSimpleResponse
typedef GPB_ENUM(RMTSimpleResponse_FieldNumber) {
RMTSimpleResponse_FieldNumber_Payload = 1,
RMTSimpleResponse_FieldNumber_Username = 2,
RMTSimpleResponse_FieldNumber_OauthScope = 3,
};
// Unary response, as configured by the request.
@interface RMTSimpleResponse : GPBMessage
// Payload to increase message size.
@property(nonatomic, readwrite) BOOL hasPayload;
@property(nonatomic, readwrite, strong) RMTPayload *payload;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
@property(nonatomic, readwrite, copy) NSString *username;
// OAuth scope.
@property(nonatomic, readwrite, copy) NSString *oauthScope;
@end
#pragma mark - RMTStreamingInputCallRequest
typedef GPB_ENUM(RMTStreamingInputCallRequest_FieldNumber) {
RMTStreamingInputCallRequest_FieldNumber_Payload = 1,
};
// Client-streaming request.
@interface RMTStreamingInputCallRequest : GPBMessage
// Optional input payload sent along with the request.
@property(nonatomic, readwrite) BOOL hasPayload;
@property(nonatomic, readwrite, strong) RMTPayload *payload;
@end
#pragma mark - RMTStreamingInputCallResponse
typedef GPB_ENUM(RMTStreamingInputCallResponse_FieldNumber) {
RMTStreamingInputCallResponse_FieldNumber_AggregatedPayloadSize = 1,
};
// Client-streaming response.
@interface RMTStreamingInputCallResponse : GPBMessage
// Aggregated size of payloads received from the client.
@property(nonatomic, readwrite) int32_t aggregatedPayloadSize;
@end
#pragma mark - RMTResponseParameters
typedef GPB_ENUM(RMTResponseParameters_FieldNumber) {
RMTResponseParameters_FieldNumber_Size = 1,
RMTResponseParameters_FieldNumber_IntervalUs = 2,
};
// Configuration for a particular response.
@interface RMTResponseParameters : GPBMessage
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
@property(nonatomic, readwrite) int32_t size;
// Desired interval between consecutive responses in the response stream in
// microseconds.
@property(nonatomic, readwrite) int32_t intervalUs;
@end
#pragma mark - RMTStreamingOutputCallRequest
typedef GPB_ENUM(RMTStreamingOutputCallRequest_FieldNumber) {
RMTStreamingOutputCallRequest_FieldNumber_ResponseType = 1,
RMTStreamingOutputCallRequest_FieldNumber_ResponseParametersArray = 2,
RMTStreamingOutputCallRequest_FieldNumber_Payload = 3,
};
// Server-streaming request.
@interface RMTStreamingOutputCallRequest : GPBMessage
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
@property(nonatomic, readwrite) RMTPayloadType responseType;
// Configuration for each expected response message.
// |responseParametersArray| contains |RMTResponseParameters|
@property(nonatomic, readwrite, strong) NSMutableArray *responseParametersArray;
// Optional input payload sent along with the request.
@property(nonatomic, readwrite) BOOL hasPayload;
@property(nonatomic, readwrite, strong) RMTPayload *payload;
@end
int32_t RMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message);
void SetRMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message, int32_t value);
#pragma mark - RMTStreamingOutputCallResponse
typedef GPB_ENUM(RMTStreamingOutputCallResponse_FieldNumber) {
RMTStreamingOutputCallResponse_FieldNumber_Payload = 1,
};
// Server-streaming response, as configured by the request and parameters.
@interface RMTStreamingOutputCallResponse : GPBMessage
// Payload to increase response size.
@property(nonatomic, readwrite) BOOL hasPayload;
@property(nonatomic, readwrite, strong) RMTPayload *payload;
@end
CF_EXTERN_C_END

@ -0,0 +1,603 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: messages.proto
#import "GPBProtocolBuffers_RuntimeSupport.h"
#import "Messages.pbobjc.h"
#pragma mark - RMTMessagesRoot
@implementation RMTMessagesRoot
@end
static GPBFileDescriptor *RMTMessagesRoot_FileDescriptor(void) {
// This is called by +initialize so there is no need to worry
// about thread safety of the singleton.
static GPBFileDescriptor *descriptor = NULL;
if (!descriptor) {
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.testing"
syntax:GPBFileSyntaxProto3];
}
return descriptor;
}
#pragma mark - Enum RMTPayloadType
GPBEnumDescriptor *RMTPayloadType_EnumDescriptor(void) {
static GPBEnumDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageEnumValueDescription values[] = {
{ .name = "Compressable", .number = RMTPayloadType_Compressable },
{ .name = "Uncompressable", .number = RMTPayloadType_Uncompressable },
{ .name = "Random", .number = RMTPayloadType_Random },
};
descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(RMTPayloadType)
values:values
valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)
enumVerifier:RMTPayloadType_IsValidValue];
}
return descriptor;
}
BOOL RMTPayloadType_IsValidValue(int32_t value__) {
switch (value__) {
case RMTPayloadType_Compressable:
case RMTPayloadType_Uncompressable:
case RMTPayloadType_Random:
return YES;
default:
return NO;
}
}
#pragma mark - RMTPayload
@implementation RMTPayload
@dynamic type;
@dynamic body;
typedef struct RMTPayload_Storage {
uint32_t _has_storage_[1];
RMTPayloadType type;
NSData *body;
} RMTPayload_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "type",
.number = RMTPayload_FieldNumber_Type,
.hasIndex = 0,
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
.type = GPBTypeEnum,
.offset = offsetof(RMTPayload_Storage, type),
.defaultValue.valueEnum = RMTPayloadType_Compressable,
.typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor,
.fieldOptions = NULL,
},
{
.name = "body",
.number = RMTPayload_FieldNumber_Body,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeData,
.offset = offsetof(RMTPayload_Storage, body),
.defaultValue.valueData = nil,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTPayload class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTPayload_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
int32_t RMTPayload_Type_RawValue(RMTPayload *message) {
GPBDescriptor *descriptor = [RMTPayload descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTPayload_FieldNumber_Type];
return GPBGetInt32IvarWithField(message, field);
}
void SetRMTPayload_Type_RawValue(RMTPayload *message, int32_t value) {
GPBDescriptor *descriptor = [RMTPayload descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTPayload_FieldNumber_Type];
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
}
#pragma mark - RMTSimpleRequest
@implementation RMTSimpleRequest
@dynamic responseType;
@dynamic responseSize;
@dynamic hasPayload, payload;
@dynamic fillUsername;
@dynamic fillOauthScope;
typedef struct RMTSimpleRequest_Storage {
uint32_t _has_storage_[1];
BOOL fillUsername;
BOOL fillOauthScope;
RMTPayloadType responseType;
int32_t responseSize;
RMTPayload *payload;
} RMTSimpleRequest_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "responseType",
.number = RMTSimpleRequest_FieldNumber_ResponseType,
.hasIndex = 0,
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
.type = GPBTypeEnum,
.offset = offsetof(RMTSimpleRequest_Storage, responseType),
.defaultValue.valueEnum = RMTPayloadType_Compressable,
.typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor,
.fieldOptions = NULL,
},
{
.name = "responseSize",
.number = RMTSimpleRequest_FieldNumber_ResponseSize,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RMTSimpleRequest_Storage, responseSize),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "payload",
.number = RMTSimpleRequest_FieldNumber_Payload,
.hasIndex = 2,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RMTSimpleRequest_Storage, payload),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTPayload),
.fieldOptions = NULL,
},
{
.name = "fillUsername",
.number = RMTSimpleRequest_FieldNumber_FillUsername,
.hasIndex = 3,
.flags = GPBFieldOptional,
.type = GPBTypeBool,
.offset = offsetof(RMTSimpleRequest_Storage, fillUsername),
.defaultValue.valueBool = NO,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "fillOauthScope",
.number = RMTSimpleRequest_FieldNumber_FillOauthScope,
.hasIndex = 4,
.flags = GPBFieldOptional,
.type = GPBTypeBool,
.offset = offsetof(RMTSimpleRequest_Storage, fillOauthScope),
.defaultValue.valueBool = NO,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTSimpleRequest class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTSimpleRequest_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
int32_t RMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message) {
GPBDescriptor *descriptor = [RMTSimpleRequest descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTSimpleRequest_FieldNumber_ResponseType];
return GPBGetInt32IvarWithField(message, field);
}
void SetRMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message, int32_t value) {
GPBDescriptor *descriptor = [RMTSimpleRequest descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTSimpleRequest_FieldNumber_ResponseType];
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
}
#pragma mark - RMTSimpleResponse
@implementation RMTSimpleResponse
@dynamic hasPayload, payload;
@dynamic username;
@dynamic oauthScope;
typedef struct RMTSimpleResponse_Storage {
uint32_t _has_storage_[1];
RMTPayload *payload;
NSString *username;
NSString *oauthScope;
} RMTSimpleResponse_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "payload",
.number = RMTSimpleResponse_FieldNumber_Payload,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RMTSimpleResponse_Storage, payload),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTPayload),
.fieldOptions = NULL,
},
{
.name = "username",
.number = RMTSimpleResponse_FieldNumber_Username,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeString,
.offset = offsetof(RMTSimpleResponse_Storage, username),
.defaultValue.valueString = nil,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "oauthScope",
.number = RMTSimpleResponse_FieldNumber_OauthScope,
.hasIndex = 2,
.flags = GPBFieldOptional,
.type = GPBTypeString,
.offset = offsetof(RMTSimpleResponse_Storage, oauthScope),
.defaultValue.valueString = nil,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTSimpleResponse class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTSimpleResponse_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RMTStreamingInputCallRequest
@implementation RMTStreamingInputCallRequest
@dynamic hasPayload, payload;
typedef struct RMTStreamingInputCallRequest_Storage {
uint32_t _has_storage_[1];
RMTPayload *payload;
} RMTStreamingInputCallRequest_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "payload",
.number = RMTStreamingInputCallRequest_FieldNumber_Payload,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RMTStreamingInputCallRequest_Storage, payload),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTPayload),
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingInputCallRequest class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTStreamingInputCallRequest_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RMTStreamingInputCallResponse
@implementation RMTStreamingInputCallResponse
@dynamic aggregatedPayloadSize;
typedef struct RMTStreamingInputCallResponse_Storage {
uint32_t _has_storage_[1];
int32_t aggregatedPayloadSize;
} RMTStreamingInputCallResponse_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "aggregatedPayloadSize",
.number = RMTStreamingInputCallResponse_FieldNumber_AggregatedPayloadSize,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RMTStreamingInputCallResponse_Storage, aggregatedPayloadSize),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingInputCallResponse class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTStreamingInputCallResponse_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RMTResponseParameters
@implementation RMTResponseParameters
@dynamic size;
@dynamic intervalUs;
typedef struct RMTResponseParameters_Storage {
uint32_t _has_storage_[1];
int32_t size;
int32_t intervalUs;
} RMTResponseParameters_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "size",
.number = RMTResponseParameters_FieldNumber_Size,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RMTResponseParameters_Storage, size),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "intervalUs",
.number = RMTResponseParameters_FieldNumber_IntervalUs,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RMTResponseParameters_Storage, intervalUs),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTResponseParameters class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTResponseParameters_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RMTStreamingOutputCallRequest
@implementation RMTStreamingOutputCallRequest
@dynamic responseType;
@dynamic responseParametersArray;
@dynamic hasPayload, payload;
typedef struct RMTStreamingOutputCallRequest_Storage {
uint32_t _has_storage_[1];
RMTPayloadType responseType;
NSMutableArray *responseParametersArray;
RMTPayload *payload;
} RMTStreamingOutputCallRequest_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "responseType",
.number = RMTStreamingOutputCallRequest_FieldNumber_ResponseType,
.hasIndex = 0,
.flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
.type = GPBTypeEnum,
.offset = offsetof(RMTStreamingOutputCallRequest_Storage, responseType),
.defaultValue.valueEnum = RMTPayloadType_Compressable,
.typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor,
.fieldOptions = NULL,
},
{
.name = "responseParametersArray",
.number = RMTStreamingOutputCallRequest_FieldNumber_ResponseParametersArray,
.hasIndex = GPBNoHasBit,
.flags = GPBFieldRepeated,
.type = GPBTypeMessage,
.offset = offsetof(RMTStreamingOutputCallRequest_Storage, responseParametersArray),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTResponseParameters),
.fieldOptions = NULL,
},
{
.name = "payload",
.number = RMTStreamingOutputCallRequest_FieldNumber_Payload,
.hasIndex = 2,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RMTStreamingOutputCallRequest_Storage, payload),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTPayload),
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingOutputCallRequest class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTStreamingOutputCallRequest_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
int32_t RMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message) {
GPBDescriptor *descriptor = [RMTStreamingOutputCallRequest descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTStreamingOutputCallRequest_FieldNumber_ResponseType];
return GPBGetInt32IvarWithField(message, field);
}
void SetRMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message, int32_t value) {
GPBDescriptor *descriptor = [RMTStreamingOutputCallRequest descriptor];
GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTStreamingOutputCallRequest_FieldNumber_ResponseType];
GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
}
#pragma mark - RMTStreamingOutputCallResponse
@implementation RMTStreamingOutputCallResponse
@dynamic hasPayload, payload;
typedef struct RMTStreamingOutputCallResponse_Storage {
uint32_t _has_storage_[1];
RMTPayload *payload;
} RMTStreamingOutputCallResponse_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "payload",
.number = RMTStreamingOutputCallResponse_FieldNumber_Payload,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RMTStreamingOutputCallResponse_Storage, payload),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RMTPayload),
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingOutputCallResponse class]
rootClass:[RMTMessagesRoot class]
file:RMTMessagesRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RMTStreamingOutputCallResponse_Storage)
wireFormat:NO];
}
return descriptor;
}
@end

@ -6,13 +6,19 @@ Pod::Spec.new do |s|
s.license = 'New BSD'
s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' }
s.source_files = '*.pb.{h,m}'
s.public_header_files = '*.pb.h'
s.platform = :ios
s.ios.deployment_target = '6.0'
s.requires_arc = true
s.osx.deployment_target = '10.8'
s.subspec 'Messages' do |ms|
ms.source_files = '*.pbobjc.{h,m}'
ms.requires_arc = false
ms.dependency 'Protobuf', '~> 3.0'
end
s.dependency 'ProtocolBuffers', '~> 1.9'
s.dependency 'gRPC', '~> 0.0'
s.subspec 'Services' do |ss|
ss.source_files = '*.pbrpc.{h,m}'
ss.requires_arc = true
ss.dependency 'gRPC', '~> 0.0'
ss.dependency 'RemoteTest/Messages'
end
end

@ -1,167 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import <ProtocolBuffers/ProtocolBuffers.h>
#import "Empty.pb.h"
#import "Messages.pb.h"
#import <gRPC/ProtoService.h>
// @@protoc_insertion_point(imports)
@class ObjectiveCFileOptions;
@class ObjectiveCFileOptionsBuilder;
@class PBDescriptorProto;
@class PBDescriptorProtoBuilder;
@class PBDescriptorProtoExtensionRange;
@class PBDescriptorProtoExtensionRangeBuilder;
@class PBEnumDescriptorProto;
@class PBEnumDescriptorProtoBuilder;
@class PBEnumOptions;
@class PBEnumOptionsBuilder;
@class PBEnumValueDescriptorProto;
@class PBEnumValueDescriptorProtoBuilder;
@class PBEnumValueOptions;
@class PBEnumValueOptionsBuilder;
@class PBFieldDescriptorProto;
@class PBFieldDescriptorProtoBuilder;
@class PBFieldOptions;
@class PBFieldOptionsBuilder;
@class PBFileDescriptorProto;
@class PBFileDescriptorProtoBuilder;
@class PBFileDescriptorSet;
@class PBFileDescriptorSetBuilder;
@class PBFileOptions;
@class PBFileOptionsBuilder;
@class PBMessageOptions;
@class PBMessageOptionsBuilder;
@class PBMethodDescriptorProto;
@class PBMethodDescriptorProtoBuilder;
@class PBMethodOptions;
@class PBMethodOptionsBuilder;
@class PBOneofDescriptorProto;
@class PBOneofDescriptorProtoBuilder;
@class PBServiceDescriptorProto;
@class PBServiceDescriptorProtoBuilder;
@class PBServiceOptions;
@class PBServiceOptionsBuilder;
@class PBSourceCodeInfo;
@class PBSourceCodeInfoBuilder;
@class PBSourceCodeInfoLocation;
@class PBSourceCodeInfoLocationBuilder;
@class PBUninterpretedOption;
@class PBUninterpretedOptionBuilder;
@class PBUninterpretedOptionNamePart;
@class PBUninterpretedOptionNamePartBuilder;
@class RMTEmpty;
@class RMTEmptyBuilder;
@class RMTPayload;
@class RMTPayloadBuilder;
@class RMTResponseParameters;
@class RMTResponseParametersBuilder;
@class RMTSimpleRequest;
@class RMTSimpleRequestBuilder;
@class RMTSimpleResponse;
@class RMTSimpleResponseBuilder;
@class RMTStreamingInputCallRequest;
@class RMTStreamingInputCallRequestBuilder;
@class RMTStreamingInputCallResponse;
@class RMTStreamingInputCallResponseBuilder;
@class RMTStreamingOutputCallRequest;
@class RMTStreamingOutputCallRequestBuilder;
@class RMTStreamingOutputCallResponse;
@class RMTStreamingOutputCallResponseBuilder;
@interface RMTTestRoot : NSObject {
}
+ (PBExtensionRegistry*) extensionRegistry;
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
@end
@protocol GRXWriteable;
@protocol GRXWriter;
@protocol RMTTestService <NSObject>
#pragma mark EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty)
// One empty request followed by one empty response.
- (void)emptyCallWithRequest:(RMTEmpty *)request
handler:(void(^)(RMTEmpty *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request
handler:(void(^)(RMTEmpty *response, NSError *error))handler;
#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse)
// One request followed by one response.
- (void)unaryCallWithRequest:(RMTSimpleRequest *)request
handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request
handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler;
#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse)
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
- (void)streamingInputCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler;
#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
- (void)fullDuplexCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
- (void)halfDuplexCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id<GRXWriter>)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
@end
// Basic service implementation, over gRPC, that only does marshalling and parsing.
@interface RMTTestService : ProtoService<RMTTestService>
- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
@end
// @@protoc_insertion_point(global_scope)

@ -1,163 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import "Test.pb.h"
#import <gRPC/GRXWriteable.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/ProtoRPC.h>
// @@protoc_insertion_point(imports)
@implementation RMTTestRoot
static PBExtensionRegistry* extensionRegistry = nil;
+ (PBExtensionRegistry*) extensionRegistry {
return extensionRegistry;
}
+ (void) initialize {
if (self == [RMTTestRoot class]) {
PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry];
[self registerAllExtensions:registry];
[RMTEmptyRoot registerAllExtensions:registry];
[RMTMessagesRoot registerAllExtensions:registry];
[ObjectivecDescriptorRoot registerAllExtensions:registry];
extensionRegistry = registry;
}
}
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry {
}
@end
static NSString *const kPackageName = @"grpc.testing";
static NSString *const kServiceName = @"TestService";
@implementation RMTTestService
// Designated initializer
- (instancetype)initWithHost:(NSString *)host {
return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]);
}
- (instancetype)initWithHost:(NSString *)host
packageName:(NSString *)packageName
serviceName:(NSString *)serviceName {
return [self initWithHost:host];
}
#pragma mark EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty)
// One empty request followed by one empty response.
- (void)emptyCallWithRequest:(RMTEmpty *)request
handler:(void(^)(RMTEmpty *response, NSError *error))handler {
[[self RPCToEmptyCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request
handler:(void(^)(RMTEmpty *response, NSError *error))handler {
return [self RPCToMethod:@"EmptyCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTEmpty class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse)
// One request followed by one response.
- (void)unaryCallWithRequest:(RMTSimpleRequest *)request
handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler {
[[self RPCToUnaryCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request
handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler {
return [self RPCToMethod:@"UnaryCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTSimpleResponse class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
[[self RPCToStreamingOutputCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
return [self RPCToMethod:@"StreamingOutputCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse)
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
- (void)streamingInputCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler {
[[self RPCToStreamingInputCallWithRequestsWriter:requestsWriter handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler {
return [self RPCToMethod:@"StreamingInputCall"
requestsWriter:requestsWriter
responseClass:[RMTStreamingInputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
- (void)fullDuplexCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
[[self RPCToFullDuplexCallWithRequestsWriter:requestsWriter handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
return [self RPCToMethod:@"FullDuplexCall"
requestsWriter:requestsWriter
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
- (void)halfDuplexCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
[[self RPCToHalfDuplexCallWithRequestsWriter:requestsWriter handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id<GRXWriter>)requestsWriter
handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler {
return [self RPCToMethod:@"HalfDuplexCall"
requestsWriter:requestsWriter
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
@end
// @@protoc_insertion_point(global_scope)

@ -0,0 +1,12 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: test.proto
#import "GPBProtocolBuffers.h"
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources.
#endif
CF_EXTERN_C_BEGIN
CF_EXTERN_C_END

@ -0,0 +1,9 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: test.proto
// File empty because all messages, extensions and enum have been filtered.
// Dummy symbol that will be stripped but will avoid linker warnings about
// no symbols in the .o form compiling this file.
static int RMTTestRoot_dummy __attribute__((unused,used)) = 0;

@ -0,0 +1,59 @@
#import "Test.pbobjc.h"
#import <gRPC/ProtoService.h>
#import "Empty.pbobjc.h"
#import "Messages.pbobjc.h"
@protocol GRXWriteable;
@protocol GRXWriter;
@protocol RMTTestService <NSObject>
#pragma mark EmptyCall(Empty) returns (Empty)
- (void)emptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler;
- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler;
#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse)
- (void)unaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler;
- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler;
#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse)
- (void)streamingInputCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler;
- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler;
#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)fullDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)halfDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler;
@end
// Basic service implementation, over gRPC, that only does marshalling and parsing.
@interface RMTTestService : ProtoService<RMTTestService>
- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
@end

@ -0,0 +1,96 @@
#import "Test.pbrpc.h"
#import <gRPC/GRXWriteable.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/ProtoRPC.h>
static NSString *const kPackageName = @"grpc.testing";
static NSString *const kServiceName = @"TestService";
@implementation RMTTestService
// Designated initializer
- (instancetype)initWithHost:(NSString *)host {
return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]);
}
// Override superclass initializer to disallow different package and service names.
- (instancetype)initWithHost:(NSString *)host
packageName:(NSString *)packageName
serviceName:(NSString *)serviceName {
return [self initWithHost:host];
}
#pragma mark EmptyCall(Empty) returns (Empty)
- (void)emptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler{
[[self RPCToEmptyCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler{
return [self RPCToMethod:@"EmptyCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTEmpty class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse)
- (void)unaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler{
[[self RPCToUnaryCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler{
return [self RPCToMethod:@"UnaryCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTSimpleResponse class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
[[self RPCToStreamingOutputCallWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
return [self RPCToMethod:@"StreamingOutputCall"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse)
- (void)streamingInputCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler{
[[self RPCToStreamingInputCallWithRequestsWriter:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler{
return [self RPCToMethod:@"StreamingInputCall"
requestsWriter:request
responseClass:[RMTStreamingInputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)fullDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
[[self RPCToFullDuplexCallWithRequestsWriter:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
return [self RPCToMethod:@"FullDuplexCall"
requestsWriter:request
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse)
- (void)halfDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
[[self RPCToHalfDuplexCallWithRequestsWriter:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{
return [self RPCToMethod:@"HalfDuplexCall"
requestsWriter:request
responseClass:[RMTStreamingOutputCallResponse class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
@end

@ -27,13 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto2";
import "google/protobuf/objectivec-descriptor.proto";
syntax = "proto3";
package grpc.testing;
option (google.protobuf.objectivec_file_options).class_prefix = "RMT";
option objc_class_prefix = "RMT";
// An empty message that you can re-use to avoid defining duplicated empty
// messages in your project. A typical example is to use it as argument or the

@ -29,13 +29,11 @@
// Message definitions to be used by integration test service definitions.
syntax = "proto2";
import "google/protobuf/objectivec-descriptor.proto";
syntax = "proto3";
package grpc.testing;
option (google.protobuf.objectivec_file_options).class_prefix = "RMT";
option objc_class_prefix = "RMT";
// The type of payload that should be returned.
enum PayloadType {
@ -52,46 +50,46 @@ enum PayloadType {
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
optional PayloadType type = 1;
PayloadType type = 1;
// Primary contents of payload.
optional bytes body = 2;
bytes body = 2;
}
// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
optional PayloadType response_type = 1;
PayloadType response_type = 1;
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
optional int32 response_size = 2;
int32 response_size = 2;
// Optional input payload sent along with the request.
optional Payload payload = 3;
Payload payload = 3;
// Whether SimpleResponse should include username.
optional bool fill_username = 4;
bool fill_username = 4;
// Whether SimpleResponse should include OAuth scope.
optional bool fill_oauth_scope = 5;
bool fill_oauth_scope = 5;
}
// Unary response, as configured by the request.
message SimpleResponse {
// Payload to increase message size.
optional Payload payload = 1;
Payload payload = 1;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
optional string username = 2;
string username = 2;
// OAuth scope.
optional string oauth_scope = 3;
string oauth_scope = 3;
}
// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
optional Payload payload = 1;
Payload payload = 1;
// Not expecting any payload from the response.
}
@ -99,18 +97,18 @@ message StreamingInputCallRequest {
// Client-streaming response.
message StreamingInputCallResponse {
// Aggregated size of payloads received from the client.
optional int32 aggregated_payload_size = 1;
int32 aggregated_payload_size = 1;
}
// Configuration for a particular response.
message ResponseParameters {
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
optional int32 size = 1;
int32 size = 1;
// Desired interval between consecutive responses in the response stream in
// microseconds.
optional int32 interval_us = 2;
int32 interval_us = 2;
}
// Server-streaming request.
@ -119,17 +117,17 @@ message StreamingOutputCallRequest {
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
optional PayloadType response_type = 1;
PayloadType response_type = 1;
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
// Optional input payload sent along with the request.
optional Payload payload = 3;
Payload payload = 3;
}
// Server-streaming response, as configured by the request and parameters.
message StreamingOutputCallResponse {
// Payload to increase response size.
optional Payload payload = 1;
Payload payload = 1;
}

@ -29,15 +29,14 @@
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto2";
syntax = "proto3";
import "empty.proto";
import "messages.proto";
import "google/protobuf/objectivec-descriptor.proto";
package grpc.testing;
option (google.protobuf.objectivec_file_options).class_prefix = "RMT";
option objc_class_prefix = "RMT";
// A simple service to test the various types of RPCs and experiment with
// performance with various types of payload.
@ -51,24 +50,24 @@ service TestService {
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
// rpc StreamingOutputCall(StreamingOutputCallRequest)
// returns (stream StreamingOutputCallResponse);
rpc StreamingOutputCall(StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
// rpc StreamingInputCall(stream StreamingInputCallRequest)
// returns (StreamingInputCallResponse);
rpc StreamingInputCall(stream StreamingInputCallRequest)
returns (StreamingInputCallResponse);
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
// rpc FullDuplexCall(stream StreamingOutputCallRequest)
// returns (stream StreamingOutputCallResponse);
rpc FullDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
// rpc HalfDuplexCall(stream StreamingOutputCallRequest)
// returns (stream StreamingOutputCallResponse);
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
}

@ -0,0 +1,134 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: route_guide.proto
#import "GPBProtocolBuffers.h"
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000
#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources.
#endif
CF_EXTERN_C_BEGIN
@class RGDFeature;
@class RGDPoint;
@class RGDRectangle;
@class RGDRouteNote;
@class RGDRouteSummary;
#pragma mark - RGDRouteGuideRoot
@interface RGDRouteGuideRoot : GPBRootObject
@end
#pragma mark - RGDPoint
typedef GPB_ENUM(RGDPoint_FieldNumber) {
RGDPoint_FieldNumber_Latitude = 1,
RGDPoint_FieldNumber_Longitude = 2,
};
// Points are represented as latitude-longitude pairs in the E7 representation
// (degrees multiplied by 10**7 and rounded to the nearest integer).
// Latitudes should be in the range +/- 90 degrees and longitude should be in
// the range +/- 180 degrees (inclusive).
@interface RGDPoint : GPBMessage
@property(nonatomic, readwrite) int32_t latitude;
@property(nonatomic, readwrite) int32_t longitude;
@end
#pragma mark - RGDRectangle
typedef GPB_ENUM(RGDRectangle_FieldNumber) {
RGDRectangle_FieldNumber_Lo = 1,
RGDRectangle_FieldNumber_Hi = 2,
};
// A latitude-longitude rectangle, represented as two diagonally opposite
// points "lo" and "hi".
@interface RGDRectangle : GPBMessage
// One corner of the rectangle.
@property(nonatomic, readwrite) BOOL hasLo;
@property(nonatomic, readwrite, strong) RGDPoint *lo;
// The other corner of the rectangle.
@property(nonatomic, readwrite) BOOL hasHi;
@property(nonatomic, readwrite, strong) RGDPoint *hi;
@end
#pragma mark - RGDFeature
typedef GPB_ENUM(RGDFeature_FieldNumber) {
RGDFeature_FieldNumber_Name = 1,
RGDFeature_FieldNumber_Location = 2,
};
// A feature names something at a given point.
//
// If a feature could not be named, the name is empty.
@interface RGDFeature : GPBMessage
// The name of the feature.
@property(nonatomic, readwrite, copy) NSString *name;
// The point where the feature is detected.
@property(nonatomic, readwrite) BOOL hasLocation;
@property(nonatomic, readwrite, strong) RGDPoint *location;
@end
#pragma mark - RGDRouteNote
typedef GPB_ENUM(RGDRouteNote_FieldNumber) {
RGDRouteNote_FieldNumber_Location = 1,
RGDRouteNote_FieldNumber_Message = 2,
};
// A RouteNote is a message sent while at a given point.
@interface RGDRouteNote : GPBMessage
// The location from which the message is sent.
@property(nonatomic, readwrite) BOOL hasLocation;
@property(nonatomic, readwrite, strong) RGDPoint *location;
// The message to be sent.
@property(nonatomic, readwrite, copy) NSString *message;
@end
#pragma mark - RGDRouteSummary
typedef GPB_ENUM(RGDRouteSummary_FieldNumber) {
RGDRouteSummary_FieldNumber_PointCount = 1,
RGDRouteSummary_FieldNumber_FeatureCount = 2,
RGDRouteSummary_FieldNumber_Distance = 3,
RGDRouteSummary_FieldNumber_ElapsedTime = 4,
};
// A RouteSummary is received in response to a RecordRoute rpc.
//
// It contains the number of individual points received, the number of
// detected features, and the total distance covered as the cumulative sum of
// the distance between each point.
@interface RGDRouteSummary : GPBMessage
// The number of points received.
@property(nonatomic, readwrite) int32_t pointCount;
// The number of known features passed while traversing the route.
@property(nonatomic, readwrite) int32_t featureCount;
// The distance covered in metres.
@property(nonatomic, readwrite) int32_t distance;
// The duration of the traversal in seconds.
@property(nonatomic, readwrite) int32_t elapsedTime;
@end
CF_EXTERN_C_END

@ -0,0 +1,355 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: route_guide.proto
#import "GPBProtocolBuffers_RuntimeSupport.h"
#import "RouteGuide.pbobjc.h"
#pragma mark - RGDRouteGuideRoot
@implementation RGDRouteGuideRoot
@end
static GPBFileDescriptor *RGDRouteGuideRoot_FileDescriptor(void) {
// This is called by +initialize so there is no need to worry
// about thread safety of the singleton.
static GPBFileDescriptor *descriptor = NULL;
if (!descriptor) {
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.example.routeguide"
syntax:GPBFileSyntaxProto3];
}
return descriptor;
}
#pragma mark - RGDPoint
@implementation RGDPoint
@dynamic latitude;
@dynamic longitude;
typedef struct RGDPoint_Storage {
uint32_t _has_storage_[1];
int32_t latitude;
int32_t longitude;
} RGDPoint_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "latitude",
.number = RGDPoint_FieldNumber_Latitude,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDPoint_Storage, latitude),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "longitude",
.number = RGDPoint_FieldNumber_Longitude,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDPoint_Storage, longitude),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RGDPoint class]
rootClass:[RGDRouteGuideRoot class]
file:RGDRouteGuideRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RGDPoint_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RGDRectangle
@implementation RGDRectangle
@dynamic hasLo, lo;
@dynamic hasHi, hi;
typedef struct RGDRectangle_Storage {
uint32_t _has_storage_[1];
RGDPoint *lo;
RGDPoint *hi;
} RGDRectangle_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "lo",
.number = RGDRectangle_FieldNumber_Lo,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RGDRectangle_Storage, lo),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RGDPoint),
.fieldOptions = NULL,
},
{
.name = "hi",
.number = RGDRectangle_FieldNumber_Hi,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RGDRectangle_Storage, hi),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RGDPoint),
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRectangle class]
rootClass:[RGDRouteGuideRoot class]
file:RGDRouteGuideRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RGDRectangle_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RGDFeature
@implementation RGDFeature
@dynamic name;
@dynamic hasLocation, location;
typedef struct RGDFeature_Storage {
uint32_t _has_storage_[1];
NSString *name;
RGDPoint *location;
} RGDFeature_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "name",
.number = RGDFeature_FieldNumber_Name,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeString,
.offset = offsetof(RGDFeature_Storage, name),
.defaultValue.valueString = nil,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "location",
.number = RGDFeature_FieldNumber_Location,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RGDFeature_Storage, location),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RGDPoint),
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RGDFeature class]
rootClass:[RGDRouteGuideRoot class]
file:RGDRouteGuideRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RGDFeature_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RGDRouteNote
@implementation RGDRouteNote
@dynamic hasLocation, location;
@dynamic message;
typedef struct RGDRouteNote_Storage {
uint32_t _has_storage_[1];
RGDPoint *location;
NSString *message;
} RGDRouteNote_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "location",
.number = RGDRouteNote_FieldNumber_Location,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeMessage,
.offset = offsetof(RGDRouteNote_Storage, location),
.defaultValue.valueMessage = nil,
.typeSpecific.className = GPBStringifySymbol(RGDPoint),
.fieldOptions = NULL,
},
{
.name = "message",
.number = RGDRouteNote_FieldNumber_Message,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeString,
.offset = offsetof(RGDRouteNote_Storage, message),
.defaultValue.valueString = nil,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteNote class]
rootClass:[RGDRouteGuideRoot class]
file:RGDRouteGuideRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RGDRouteNote_Storage)
wireFormat:NO];
}
return descriptor;
}
@end
#pragma mark - RGDRouteSummary
@implementation RGDRouteSummary
@dynamic pointCount;
@dynamic featureCount;
@dynamic distance;
@dynamic elapsedTime;
typedef struct RGDRouteSummary_Storage {
uint32_t _has_storage_[1];
int32_t pointCount;
int32_t featureCount;
int32_t distance;
int32_t elapsedTime;
} RGDRouteSummary_Storage;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+ (GPBDescriptor *)descriptor {
static GPBDescriptor *descriptor = NULL;
if (!descriptor) {
static GPBMessageFieldDescription fields[] = {
{
.name = "pointCount",
.number = RGDRouteSummary_FieldNumber_PointCount,
.hasIndex = 0,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDRouteSummary_Storage, pointCount),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "featureCount",
.number = RGDRouteSummary_FieldNumber_FeatureCount,
.hasIndex = 1,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDRouteSummary_Storage, featureCount),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "distance",
.number = RGDRouteSummary_FieldNumber_Distance,
.hasIndex = 2,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDRouteSummary_Storage, distance),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
{
.name = "elapsedTime",
.number = RGDRouteSummary_FieldNumber_ElapsedTime,
.hasIndex = 3,
.flags = GPBFieldOptional,
.type = GPBTypeInt32,
.offset = offsetof(RGDRouteSummary_Storage, elapsedTime),
.defaultValue.valueInt32 = 0,
.typeSpecific.className = NULL,
.fieldOptions = NULL,
},
};
descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteSummary class]
rootClass:[RGDRouteGuideRoot class]
file:RGDRouteGuideRoot_FileDescriptor()
fields:fields
fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription)
oneofs:NULL
oneofCount:0
enums:NULL
enumCount:0
ranges:NULL
rangeCount:0
storageSize:sizeof(RGDRouteSummary_Storage)
wireFormat:NO];
}
return descriptor;
}
@end

@ -0,0 +1,43 @@
#import "RouteGuide.pbobjc.h"
#import <gRPC/ProtoService.h>
@protocol GRXWriteable;
@protocol GRXWriter;
@protocol RGDRouteGuide <NSObject>
#pragma mark GetFeature(Point) returns (Feature)
- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler;
- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler;
#pragma mark ListFeatures(Rectangle) returns (stream Feature)
- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler;
- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler;
#pragma mark RecordRoute(stream Point) returns (RouteSummary)
- (void)recordRouteWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler;
- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler;
#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote)
- (void)routeChatWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler;
- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler;
@end
// Basic service implementation, over gRPC, that only does marshalling and parsing.
@interface RGDRouteGuide : ProtoService<RGDRouteGuide>
- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
@end

@ -0,0 +1,72 @@
#import "RouteGuide.pbrpc.h"
#import <gRPC/GRXWriteable.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/ProtoRPC.h>
static NSString *const kPackageName = @"grpc.example.routeguide";
static NSString *const kServiceName = @"RouteGuide";
@implementation RGDRouteGuide
// Designated initializer
- (instancetype)initWithHost:(NSString *)host {
return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]);
}
// Override superclass initializer to disallow different package and service names.
- (instancetype)initWithHost:(NSString *)host
packageName:(NSString *)packageName
serviceName:(NSString *)serviceName {
return [self initWithHost:host];
}
#pragma mark GetFeature(Point) returns (Feature)
- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{
[[self RPCToGetFeatureWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{
return [self RPCToMethod:@"GetFeature"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RGDFeature class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark ListFeatures(Rectangle) returns (stream Feature)
- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{
[[self RPCToListFeaturesWithRequest:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{
return [self RPCToMethod:@"ListFeatures"
requestsWriter:[GRXWriter writerWithValue:request]
responseClass:[RGDFeature class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
#pragma mark RecordRoute(stream Point) returns (RouteSummary)
- (void)recordRouteWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{
[[self RPCToRecordRouteWithRequestsWriter:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{
return [self RPCToMethod:@"RecordRoute"
requestsWriter:request
responseClass:[RGDRouteSummary class]
responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]];
}
#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote)
- (void)routeChatWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{
[[self RPCToRouteChatWithRequestsWriter:request handler:handler] start];
}
// Returns a not-yet-started RPC object.
- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id<GRXWriter>)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{
return [self RPCToMethod:@"RouteChat"
requestsWriter:request
responseClass:[RGDRouteNote class]
responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]];
}
@end

@ -1,387 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#import <ProtocolBuffers/ProtocolBuffers.h>
// @@protoc_insertion_point(imports)
@class ObjectiveCFileOptions;
@class ObjectiveCFileOptionsBuilder;
@class PBDescriptorProto;
@class PBDescriptorProtoBuilder;
@class PBDescriptorProtoExtensionRange;
@class PBDescriptorProtoExtensionRangeBuilder;
@class PBEnumDescriptorProto;
@class PBEnumDescriptorProtoBuilder;
@class PBEnumOptions;
@class PBEnumOptionsBuilder;
@class PBEnumValueDescriptorProto;
@class PBEnumValueDescriptorProtoBuilder;
@class PBEnumValueOptions;
@class PBEnumValueOptionsBuilder;
@class PBFieldDescriptorProto;
@class PBFieldDescriptorProtoBuilder;
@class PBFieldOptions;
@class PBFieldOptionsBuilder;
@class PBFileDescriptorProto;
@class PBFileDescriptorProtoBuilder;
@class PBFileDescriptorSet;
@class PBFileDescriptorSetBuilder;
@class PBFileOptions;
@class PBFileOptionsBuilder;
@class PBMessageOptions;
@class PBMessageOptionsBuilder;
@class PBMethodDescriptorProto;
@class PBMethodDescriptorProtoBuilder;
@class PBMethodOptions;
@class PBMethodOptionsBuilder;
@class PBOneofDescriptorProto;
@class PBOneofDescriptorProtoBuilder;
@class PBServiceDescriptorProto;
@class PBServiceDescriptorProtoBuilder;
@class PBServiceOptions;
@class PBServiceOptionsBuilder;
@class PBSourceCodeInfo;
@class PBSourceCodeInfoBuilder;
@class PBSourceCodeInfoLocation;
@class PBSourceCodeInfoLocationBuilder;
@class PBUninterpretedOption;
@class PBUninterpretedOptionBuilder;
@class PBUninterpretedOptionNamePart;
@class PBUninterpretedOptionNamePartBuilder;
@class RGDFeature;
@class RGDFeatureBuilder;
@class RGDPoint;
@class RGDPointBuilder;
@class RGDRectangle;
@class RGDRectangleBuilder;
@class RGDRouteNote;
@class RGDRouteNoteBuilder;
@class RGDRouteSummary;
@class RGDRouteSummaryBuilder;
@interface RGDRouteGuideRoot : NSObject {
}
+ (PBExtensionRegistry*) extensionRegistry;
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
@end
@interface RGDPoint : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasLatitude_:1;
BOOL hasLongitude_:1;
SInt32 latitude;
SInt32 longitude;
}
- (BOOL) hasLatitude;
- (BOOL) hasLongitude;
@property (readonly) SInt32 latitude;
@property (readonly) SInt32 longitude;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RGDPointBuilder*) builder;
+ (RGDPointBuilder*) builder;
+ (RGDPointBuilder*) builderWithPrototype:(RGDPoint*) prototype;
- (RGDPointBuilder*) toBuilder;
+ (RGDPoint*) parseFromData:(NSData*) data;
+ (RGDPoint*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDPoint*) parseFromInputStream:(NSInputStream*) input;
+ (RGDPoint*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RGDPointBuilder : PBGeneratedMessageBuilder {
@private
RGDPoint* resultPoint;
}
- (RGDPoint*) defaultInstance;
- (RGDPointBuilder*) clear;
- (RGDPointBuilder*) clone;
- (RGDPoint*) build;
- (RGDPoint*) buildPartial;
- (RGDPointBuilder*) mergeFrom:(RGDPoint*) other;
- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasLatitude;
- (SInt32) latitude;
- (RGDPointBuilder*) setLatitude:(SInt32) value;
- (RGDPointBuilder*) clearLatitude;
- (BOOL) hasLongitude;
- (SInt32) longitude;
- (RGDPointBuilder*) setLongitude:(SInt32) value;
- (RGDPointBuilder*) clearLongitude;
@end
@interface RGDRectangle : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasLo_:1;
BOOL hasHi_:1;
RGDPoint* lo;
RGDPoint* hi;
}
- (BOOL) hasLo;
- (BOOL) hasHi;
@property (readonly, strong) RGDPoint* lo;
@property (readonly, strong) RGDPoint* hi;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RGDRectangleBuilder*) builder;
+ (RGDRectangleBuilder*) builder;
+ (RGDRectangleBuilder*) builderWithPrototype:(RGDRectangle*) prototype;
- (RGDRectangleBuilder*) toBuilder;
+ (RGDRectangle*) parseFromData:(NSData*) data;
+ (RGDRectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input;
+ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RGDRectangleBuilder : PBGeneratedMessageBuilder {
@private
RGDRectangle* resultRectangle;
}
- (RGDRectangle*) defaultInstance;
- (RGDRectangleBuilder*) clear;
- (RGDRectangleBuilder*) clone;
- (RGDRectangle*) build;
- (RGDRectangle*) buildPartial;
- (RGDRectangleBuilder*) mergeFrom:(RGDRectangle*) other;
- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasLo;
- (RGDPoint*) lo;
- (RGDRectangleBuilder*) setLo:(RGDPoint*) value;
- (RGDRectangleBuilder*) setLoBuilder:(RGDPointBuilder*) builderForValue;
- (RGDRectangleBuilder*) mergeLo:(RGDPoint*) value;
- (RGDRectangleBuilder*) clearLo;
- (BOOL) hasHi;
- (RGDPoint*) hi;
- (RGDRectangleBuilder*) setHi:(RGDPoint*) value;
- (RGDRectangleBuilder*) setHiBuilder:(RGDPointBuilder*) builderForValue;
- (RGDRectangleBuilder*) mergeHi:(RGDPoint*) value;
- (RGDRectangleBuilder*) clearHi;
@end
@interface RGDFeature : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasName_:1;
BOOL hasLocation_:1;
NSString* name;
RGDPoint* location;
}
- (BOOL) hasName;
- (BOOL) hasLocation;
@property (readonly, strong) NSString* name;
@property (readonly, strong) RGDPoint* location;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RGDFeatureBuilder*) builder;
+ (RGDFeatureBuilder*) builder;
+ (RGDFeatureBuilder*) builderWithPrototype:(RGDFeature*) prototype;
- (RGDFeatureBuilder*) toBuilder;
+ (RGDFeature*) parseFromData:(NSData*) data;
+ (RGDFeature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDFeature*) parseFromInputStream:(NSInputStream*) input;
+ (RGDFeature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RGDFeatureBuilder : PBGeneratedMessageBuilder {
@private
RGDFeature* resultFeature;
}
- (RGDFeature*) defaultInstance;
- (RGDFeatureBuilder*) clear;
- (RGDFeatureBuilder*) clone;
- (RGDFeature*) build;
- (RGDFeature*) buildPartial;
- (RGDFeatureBuilder*) mergeFrom:(RGDFeature*) other;
- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasName;
- (NSString*) name;
- (RGDFeatureBuilder*) setName:(NSString*) value;
- (RGDFeatureBuilder*) clearName;
- (BOOL) hasLocation;
- (RGDPoint*) location;
- (RGDFeatureBuilder*) setLocation:(RGDPoint*) value;
- (RGDFeatureBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue;
- (RGDFeatureBuilder*) mergeLocation:(RGDPoint*) value;
- (RGDFeatureBuilder*) clearLocation;
@end
@interface RGDRouteNote : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasMessage_:1;
BOOL hasLocation_:1;
NSString* message;
RGDPoint* location;
}
- (BOOL) hasLocation;
- (BOOL) hasMessage;
@property (readonly, strong) RGDPoint* location;
@property (readonly, strong) NSString* message;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RGDRouteNoteBuilder*) builder;
+ (RGDRouteNoteBuilder*) builder;
+ (RGDRouteNoteBuilder*) builderWithPrototype:(RGDRouteNote*) prototype;
- (RGDRouteNoteBuilder*) toBuilder;
+ (RGDRouteNote*) parseFromData:(NSData*) data;
+ (RGDRouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input;
+ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RGDRouteNoteBuilder : PBGeneratedMessageBuilder {
@private
RGDRouteNote* resultRouteNote;
}
- (RGDRouteNote*) defaultInstance;
- (RGDRouteNoteBuilder*) clear;
- (RGDRouteNoteBuilder*) clone;
- (RGDRouteNote*) build;
- (RGDRouteNote*) buildPartial;
- (RGDRouteNoteBuilder*) mergeFrom:(RGDRouteNote*) other;
- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasLocation;
- (RGDPoint*) location;
- (RGDRouteNoteBuilder*) setLocation:(RGDPoint*) value;
- (RGDRouteNoteBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue;
- (RGDRouteNoteBuilder*) mergeLocation:(RGDPoint*) value;
- (RGDRouteNoteBuilder*) clearLocation;
- (BOOL) hasMessage;
- (NSString*) message;
- (RGDRouteNoteBuilder*) setMessage:(NSString*) value;
- (RGDRouteNoteBuilder*) clearMessage;
@end
@interface RGDRouteSummary : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasPointCount_:1;
BOOL hasFeatureCount_:1;
BOOL hasDistance_:1;
BOOL hasElapsedTime_:1;
SInt32 pointCount;
SInt32 featureCount;
SInt32 distance;
SInt32 elapsedTime;
}
- (BOOL) hasPointCount;
- (BOOL) hasFeatureCount;
- (BOOL) hasDistance;
- (BOOL) hasElapsedTime;
@property (readonly) SInt32 pointCount;
@property (readonly) SInt32 featureCount;
@property (readonly) SInt32 distance;
@property (readonly) SInt32 elapsedTime;
+ (instancetype) defaultInstance;
- (instancetype) defaultInstance;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (RGDRouteSummaryBuilder*) builder;
+ (RGDRouteSummaryBuilder*) builder;
+ (RGDRouteSummaryBuilder*) builderWithPrototype:(RGDRouteSummary*) prototype;
- (RGDRouteSummaryBuilder*) toBuilder;
+ (RGDRouteSummary*) parseFromData:(NSData*) data;
+ (RGDRouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input;
+ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface RGDRouteSummaryBuilder : PBGeneratedMessageBuilder {
@private
RGDRouteSummary* resultRouteSummary;
}
- (RGDRouteSummary*) defaultInstance;
- (RGDRouteSummaryBuilder*) clear;
- (RGDRouteSummaryBuilder*) clone;
- (RGDRouteSummary*) build;
- (RGDRouteSummary*) buildPartial;
- (RGDRouteSummaryBuilder*) mergeFrom:(RGDRouteSummary*) other;
- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
- (BOOL) hasPointCount;
- (SInt32) pointCount;
- (RGDRouteSummaryBuilder*) setPointCount:(SInt32) value;
- (RGDRouteSummaryBuilder*) clearPointCount;
- (BOOL) hasFeatureCount;
- (SInt32) featureCount;
- (RGDRouteSummaryBuilder*) setFeatureCount:(SInt32) value;
- (RGDRouteSummaryBuilder*) clearFeatureCount;
- (BOOL) hasDistance;
- (SInt32) distance;
- (RGDRouteSummaryBuilder*) setDistance:(SInt32) value;
- (RGDRouteSummaryBuilder*) clearDistance;
- (BOOL) hasElapsedTime;
- (SInt32) elapsedTime;
- (RGDRouteSummaryBuilder*) setElapsedTime:(SInt32) value;
- (RGDRouteSummaryBuilder*) clearElapsedTime;
@end
// @@protoc_insertion_point(global_scope)

@ -6,12 +6,19 @@ Pod::Spec.new do |s|
s.license = 'New BSD'
s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' }
s.source_files = '*.pb.{h,m}'
s.public_header_files = '*.pb.h'
s.platform = :ios
s.ios.deployment_target = '6.0'
s.requires_arc = true
s.osx.deployment_target = '10.8'
s.subspec 'Messages' do |ms|
ms.source_files = '*.pbobjc.{h,m}'
ms.requires_arc = false
ms.dependency 'Protobuf', '~> 3.0'
end
s.dependency 'ProtocolBuffers', '~> 1.9'
s.subspec 'Services' do |ss|
ss.source_files = '*.pbrpc.{h,m}'
ss.requires_arc = true
ss.dependency 'gRPC', '~> 0.0'
ss.dependency 'Route_guide/Messages'
end
end

@ -27,12 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto2";
syntax = "proto3";
package grpc.example.routeguide;
import "google/protobuf/objectivec-descriptor.proto";
option (google.protobuf.objectivec_file_options).class_prefix = "RGD";
option objc_class_prefix = "RGD";
// Interface exported by the server.
service RouteGuide {
@ -47,19 +46,19 @@ service RouteGuide {
// streamed rather than returned at once (e.g. in a response message with a
// repeated field), as the rectangle may cover a large area and contain a
// huge number of features.
// rpc ListFeatures(Rectangle) returns (stream Feature) {}
rpc ListFeatures(Rectangle) returns (stream Feature) {}
// A client-to-server streaming RPC.
//
// Accepts a stream of Points on a route being traversed, returning a
// RouteSummary when traversal is completed.
// rpc RecordRoute(stream Point) returns (RouteSummary) {}
rpc RecordRoute(stream Point) returns (RouteSummary) {}
// A Bidirectional streaming RPC.
//
// Accepts a stream of RouteNotes sent while a route is being traversed,
// while receiving other RouteNotes (e.g. from other users).
// rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
}
// Points are represented as latitude-longitude pairs in the E7 representation
@ -67,18 +66,18 @@ service RouteGuide {
// Latitudes should be in the range +/- 90 degrees and longitude should be in
// the range +/- 180 degrees (inclusive).
message Point {
optional int32 latitude = 1;
optional int32 longitude = 2;
int32 latitude = 1;
int32 longitude = 2;
}
// A latitude-longitude rectangle, represented as two diagonally opposite
// points "lo" and "hi".
message Rectangle {
// One corner of the rectangle.
optional Point lo = 1;
Point lo = 1;
// The other corner of the rectangle.
optional Point hi = 2;
Point hi = 2;
}
// A feature names something at a given point.
@ -86,19 +85,19 @@ message Rectangle {
// If a feature could not be named, the name is empty.
message Feature {
// The name of the feature.
optional string name = 1;
string name = 1;
// The point where the feature is detected.
optional Point location = 2;
Point location = 2;
}
// A RouteNote is a message sent while at a given point.
message RouteNote {
// The location from which the message is sent.
optional Point location = 1;
Point location = 1;
// The message to be sent.
optional string message = 2;
string message = 2;
}
// A RouteSummary is received in response to a RecordRoute rpc.
@ -108,14 +107,14 @@ message RouteNote {
// the distance between each point.
message RouteSummary {
// The number of points received.
optional int32 point_count = 1;
int32 point_count = 1;
// The number of known features passed while traversing the route.
optional int32 feature_count = 2;
int32 feature_count = 2;
// The distance covered in metres.
optional int32 distance = 3;
int32 distance = 3;
// The duration of the traversal in seconds.
optional int32 elapsed_time = 4;
int32 elapsed_time = 4;
}

@ -37,7 +37,8 @@
#import <gRPC/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Messages.pbobjc.h>
#import <RemoteTest/Test.pbrpc.h>
@interface ViewController ()
@end
@ -47,18 +48,34 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSString * const kRemoteHost = @"grpc-test.sandbox.google.com";
RMTSimpleRequest *request = [[RMTSimpleRequest alloc] init];
request.responseSize = 10;
request.fillUsername = YES;
request.fillOauthScope = YES;
// Example gRPC call using a generated proto client library:
RMTTestService *service = [[RMTTestService alloc] initWithHost:kRemoteHost];
[service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
if (response) {
NSLog(@"Finished successfully with response:\n%@", response);
} else if (error) {
NSLog(@"Finished with error: %@", error);
}
}];
// Same example call using the generic gRPC client library:
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing"
interface:@"TestService"
method:@"UnaryCall"];
RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init]
setResponseSize:100]
setFillUsername:YES]
setFillOauthScope:YES]
build];
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[request data]];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com"
GRPCCall *call = [[GRPCCall alloc] initWithHost:kRemoteHost
method:method
requestsWriter:requestsWriter];
@ -66,7 +83,11 @@
RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value];
NSLog(@"Received response:\n%@", response);
} completionHandler:^(NSError *errorOrNil) {
NSLog(@"Finished with error: %@", errorOrNil);
if (errorOrNil) {
NSLog(@"Finished with error: %@", errorOrNil);
} else {
NSLog(@"Finished successfully.");
}
}];
[call startWithWriteable:responsesWriteable];

@ -38,8 +38,10 @@
#import <gRPC/ProtoRPC.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Test.pb.h>
#import <RemoteTest/Empty.pbobjc.h>
#import <RemoteTest/Messages.pbobjc.h>
#import <RemoteTest/Test.pbobjc.h>
#import <RemoteTest/Test.pbrpc.h>
@interface RemoteProtoTests : XCTestCase
@end
@ -57,12 +59,12 @@
- (void)testEmptyUnaryRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyUnary"];
RMTEmpty *request = [RMTEmpty defaultInstance];
RMTEmpty *request = [RMTEmpty message];
[_service emptyCallWithRequest:request handler:^(RMTEmpty *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
id expectedResponse = [RMTEmpty defaultInstance];
id expectedResponse = [RMTEmpty message];
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
@ -74,21 +76,17 @@
- (void)testLargeUnaryRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"LargeUnary"];
RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init]
setResponseType:RMTPayloadTypeCompressable]
setResponseSize:314159]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
setBody:[NSMutableData dataWithLength:271828]]]
build];
RMTSimpleRequest *request = [RMTSimpleRequest message];
request.responseType = RMTPayloadType_Compressable;
request.responseSize = 314159;
request.payload.body = [NSMutableData dataWithLength:271828];
[_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
id expectedResponse = [[[[RMTSimpleResponseBuilder alloc] init]
setPayloadBuilder:[[[[RMTPayloadBuilder alloc] init]
setType:RMTPayloadTypeCompressable]
setBody:[NSMutableData dataWithLength:314159]]]
build];
RMTSimpleResponse *expectedResponse = [RMTSimpleResponse message];
expectedResponse.payload.type = RMTPayloadType_Compressable;
expectedResponse.payload.body = [NSMutableData dataWithLength:314159];
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
@ -100,31 +98,27 @@
- (void)testClientStreamingRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"];
id request1 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
setBody:[NSMutableData dataWithLength:27182]]]
build];
id request2 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
setBody:[NSMutableData dataWithLength:8]]]
build];
id request3 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
setBody:[NSMutableData dataWithLength:1828]]]
build];
id request4 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
setBody:[NSMutableData dataWithLength:45904]]]
build];
RMTStreamingInputCallRequest *request1 = [RMTStreamingInputCallRequest message];
request1.payload.body = [NSMutableData dataWithLength:27182];
RMTStreamingInputCallRequest *request2 = [RMTStreamingInputCallRequest message];
request2.payload.body = [NSMutableData dataWithLength:8];
RMTStreamingInputCallRequest *request3 = [RMTStreamingInputCallRequest message];
request3.payload.body = [NSMutableData dataWithLength:1828];
RMTStreamingInputCallRequest *request4 = [RMTStreamingInputCallRequest message];
request4.payload.body = [NSMutableData dataWithLength:45904];
id<GRXWriter> writer = [GRXWriter writerWithContainer:@[request1, request2, request3, request4]];
[_service streamingInputCallWithRequestsWriter:writer
handler:^(RMTStreamingInputCallResponse *response, NSError *error) {
handler:^(RMTStreamingInputCallResponse *response,
NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
id expectedResponse = [[[[RMTStreamingInputCallResponseBuilder alloc] init]
setAggregatedPayloadSize:74922]
build];
RMTStreamingInputCallResponse *expectedResponse = [RMTStreamingInputCallResponse message];
expectedResponse.aggregatedPayloadSize = 74922;
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
@ -136,26 +130,25 @@
- (void)testServerStreamingRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"];
NSArray *expectedSizes = @[@31415, @9, @2653, @58979];
RMTStreamingOutputCallRequest *request = [RMTStreamingOutputCallRequest message];
for (NSNumber *size in expectedSizes) {
RMTResponseParameters *parameters = [RMTResponseParameters message];
parameters.size = [size integerValue];
[request.responseParametersArray addObject:parameters];
}
__block int index = 0;
id request = [[[[[[[RMTStreamingOutputCallRequestBuilder alloc] init]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:31415] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:9] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:2653] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:58979] build]]
build];
[_service streamingOutputCallWithRequest:request handler:^(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error){
[_service streamingOutputCallWithRequest:request
handler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error){
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
id expectedResponseBuilder = [[RMTStreamingOutputCallResponseBuilder alloc] init];
id expectedPayload = [[[[[RMTPayloadBuilder alloc] init]
setType:RMTPayloadTypeCompressable]
setBody:[NSMutableData dataWithLength:[expectedSizes[index] unsignedIntegerValue]]]
build];
expectedResponseBuilder = [expectedResponseBuilder setPayload:expectedPayload];
id expectedResponse = [expectedResponseBuilder build];
RMTStreamingOutputCallResponse *expectedResponse = [RMTStreamingOutputCallResponse message];
expectedResponse.payload.type = RMTPayloadType_Compressable;
int expectedSize = [expectedSizes[index] unsignedIntegerValue];
expectedResponse.payload.body = [NSMutableData dataWithLength:expectedSize];
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
@ -168,11 +161,13 @@
- (void)testEmptyStreamRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyStream"];
[_service fullDuplexCallWithRequestsWriter:[GRXWriter emptyWriter]
handler:^(bool done, RMTStreamingOutputCallResponse *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssert(done, @"Unexpected response: %@", response);
[expectation fulfill];
}];
handler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssert(done, @"Unexpected response: %@", response);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:4 handler:nil];
}
@ -180,10 +175,11 @@
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"CancelAfterBegin"];
// TODO(mlumish): change to writing that blocks instead of writing
ProtoRPC *call = [_service RPCToStreamingInputCallWithRequestsWriter:[GRXWriter emptyWriter]
handler:^(RMTStreamingInputCallResponse *response, NSError *error) {
XCTAssertEqual([error code], GRPC_STATUS_CANCELLED);
[expectation fulfill];
}];
handler:^(RMTStreamingInputCallResponse *response,
NSError *error) {
XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED);
[expectation fulfill];
}];
[call start];
[call cancel];
[self waitForExpectationsWithTimeout:1 handler:nil];

@ -38,7 +38,7 @@
#import <gRPC/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Messages.pbobjc.h>
@interface RemoteTests : XCTestCase
@end
@ -111,11 +111,10 @@
interface:@"TestService"
method:@"UnaryCall"];
RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init]
setResponseSize:100]
setFillUsername:YES]
setFillOauthScope:YES]
build];
RMTSimpleRequest *request = [[RMTSimpleRequest alloc] init];
request.responseSize = 100;
request.fillUsername = YES;
request.fillOauthScope = YES;
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[request data]];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com"

@ -38,7 +38,8 @@
#import <gRPC/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <Route_guide/Route_guide.pb.h>
#import <Route_guide/RouteGuide.pbobjc.h>
#import <Route_guide/RouteGuide.pbrpc.h>
@interface SampleTests : XCTestCase
@end
@ -105,15 +106,15 @@
- (void)testSimpleProtoRPC {
__weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."];
__weak XCTestExpectation *expectedResponse =
[self expectationWithDescription:@"Expected response."];
__weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."];
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide"
interface:@"RouteGuide"
method:@"GetFeature"];
RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build];
RGDPoint *point = [RGDPoint message];
point.latitude = 28E7;
point.longitude = -15E7;
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[point data]];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980"
@ -122,11 +123,10 @@
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTAssertNotNil(value, @"nil value received as response.");
[response fulfill];
RGDFeature *feature = [RGDFeature parseFromData:value];
XCTAssertEqualObjects(point, feature.location);
XCTAssertNotNil(feature.name, @"Response's name is nil.");
[expectedResponse fulfill];
[response fulfill];
} completionHandler:^(NSError *errorOrNil) {
XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil);
[completion fulfill];
@ -136,4 +136,22 @@
[self waitForExpectationsWithTimeout:2.0 handler:nil];
}
- (void)testSimpleProtoRPCUsingGeneratedService {
__weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."];
RGDPoint *point = [RGDPoint message];
point.latitude = 28E7;
point.longitude = -15E7;
RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:@"http://127.0.0.1:8980"];
[service getFeatureWithRequest:point handler:^(RGDFeature *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssertEqualObjects(point, response.location);
XCTAssertNotNil(response.name, @"Response's name is nil.");
[completion fulfill];
}];
[self waitForExpectationsWithTimeout:2.0 handler:nil];
}
@end

Loading…
Cancel
Save