Merge pull request #1945 from jcanizales/fix-test-and-sample-podspecs

Fix podspec of tests, sample and README
pull/1950/head
Michael Lumish 10 years ago
commit a6ddb30f98
  1. 120
      src/objective-c/README.md
  2. 1
      src/objective-c/examples/Sample/Podfile
  3. 33
      src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.h
  4. 59
      src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.m
  5. 221
      src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.h
  6. 603
      src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.m
  7. 32
      src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec
  8. 12
      src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.h
  9. 9
      src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.m
  10. 59
      src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.h
  11. 96
      src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.m
  12. 134
      src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h
  13. 355
      src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m
  14. 43
      src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h
  15. 72
      src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m
  16. 26
      src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec
  17. 24
      src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec
  18. 2
      src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto
  19. 82
      src/objective-c/tests/LocalClearTextTests.m
  20. 3
      src/objective-c/tests/Podfile

@ -1,78 +1,89 @@
# gRPC for Objective-C
- [Install protoc with the gRPC plugin](#install)
- [Use protoc to generate a gRPC library](#protoc)
- [Integrate the generated gRPC library in your project](#cocoapods)
- [Write your API declaration in proto format](#write-protos)
- [Integrate a proto library in your project](#cocoapods)
- [Use the generated library in your code](#use)
- [Alternative methods](#alternatives)
- [Install protoc and the gRPC plugin without using Homebrew](#nohomebrew)
- [Integrate the generated gRPC library without using Cocoapods](#nococoapods)
- [Use gRPC without Protobuf](#no-proto)
- [Alternative installation methods](#alternatives)
- [Install protoc and the gRPC plugin without using Homebrew](#no-homebrew)
- [Integrate the generated gRPC library without using Cocoapods](#no-cocoapods)
While gRPC doesn't require the use of an IDL to describe the API of services, using one simplifies
usage and adds some interoperability guarantees. Here we use [Protocol Buffers][], and provide a
plugin for the Protobuf Compiler (_protoc_) to generate client libraries to communicate with gRPC
services.
<a name="install"></a>
## Install protoc with the gRPC plugin
On Mac OS X, install [homebrew][]. On Linux, install [linuxbrew][].
Run the following command to install the Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin:
Run the following command to install _protoc_ and the gRPC _protoc_ plugin:
```sh
$ curl -fsSL https://goo.gl/getgrpc | bash -
```
This will download and run the [gRPC install script][]. After the command completes, you're ready to proceed.
<a name="protoc"></a>
## Use protoc to generate a gRPC library
This will download and run the [gRPC install script][]. After the command completes, you're ready to
proceed.
Run _protoc_ with the following flags to generate the client library for your `.proto` files:
```sh
protoc --objc_out=. --objcgrpc_out=. *.proto
```
<a name="write-protos"></a>
## Write your API declaration in proto format
This will generate a pair of `.pbobjc.h`/`.pbobjc.m` files for each `.proto` file, with the messages and enums defined in them. And a pair of `.pbrpc.h`/`.pbrpc.m` files for each `.proto` file with services defined. The latter contains the code to make remote calls to the specified API.
For this you can consult the [Protocol Buffers][]' official documentation, or learn from a quick
example [here](https://github.com/grpc/grpc-common#defining-a-service).
<a name="cocoapods"></a>
## Integrate the generated gRPC library in your project
## Integrate a proto library in your project
Install [Cocoapods](https://cocoapods.org/#install).
You need to create a Podspec file for the generated library. You may simply copy the following example to the directory where the source files were generated, updating the name and other metadata of the Podspec as necessary:
You need to create a Podspec file for your proto library. You may simply copy the following example
to the directory where your `.proto` files are located, updating the name, version and license as
necessary:
```ruby
Pod::Spec.new do |s|
s.name = '<Podspec file name>'
s.version = '...'
s.summary = 'Client library to make RPCs to <my proto API>'
s.homepage = '...'
s.version = '0.0.1'
s.license = '...'
s.authors = { '<my name>' => '<my email>' }
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.subspec 'Messages' do |ms|
ms.source_files = '*.pbobjc.{h,m}', '**/*.pbobjc.{h,m}'
ms.header_mappings_dir = '.'
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
# You can run this command manually if you later change your protos and need to regenerate.
s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto"
# The --objc_out plugin generates a pair of .pbobjc.h/.pbobjc.m files for each .proto file.
s.subspec "Messages" do |ms|
ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}"
ms.header_mappings_dir = "."
ms.requires_arc = false
ms.dependency 'Protobuf', '~> 3.0'
ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
end
s.subspec 'Services' do |ss|
ss.source_files = '*.pbrpc.{h,m}', '**/*.pbrpc.{h,m}'
ss.header_mappings_dir = '.'
# The --objcgrpc_out plugin generates a pair of .pbrpc.h/.pbrpc.m files for each .proto file with
# a service defined.
s.subspec "Services" do |ss|
ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}"
ss.header_mappings_dir = "."
ss.requires_arc = true
ss.dependency 'gRPC', '~> 0.0'
ss.dependency '<Podspec file name>/Messages'
ss.dependency "gRPC", "~> 0.5"
ss.dependency "#{s.name}/Messages"
end
end
```
The file should be named `<Podspec file name>.podspec`. You can refer to this [example Podspec][]. Once your library has a Podspec, Cocoapods can install it into any XCode project. For that, go into your project's directory and create a Podfile by running:
The file should be named `<Podspec file name>.podspec`. Once your library has a Podspec, Cocoapods
can install it into any XCode project. For that, go into your project's directory and create a
Podfile by running:
```sh
pod init
```
Next add a line to your Podfile to refer to your library's Podspec. Use `:path` as described [here](https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine):
Next add a line to your Podfile to refer to your library's Podspec. Use `:path` as described
[here](https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine):
```ruby
pod '<Podspec file name>', :path => 'path/to/the/directory/of/your/podspec'
@ -91,15 +102,25 @@ pod install
Please check this [sample app][] for examples of how to use a generated gRPC library.
<a name="no-proto"></a>
## Use gRPC without Protobuf
The [sample app][] has an example of how to use the generic gRPC Objective-C client without
generated files.
<a name="alternatives"></a>
## Alternative methods
## Alternative installation methods
<a name="nohomebrew"></a>
<a name="no-homebrew"></a>
### Install protoc and the gRPC plugin without using Homebrew
First install v3 of the Protocol Buffers compiler (_protoc_), by cloning [its Git repository](https://github.com/google/protobuf) and following these [installation instructions](https://github.com/google/protobuf#c-installation---unix) (the ones titled C++; don't miss the note for Mac users).
First install v3 of the Protocol Buffers compiler (_protoc_), by cloning
[its Git repository](https://github.com/google/protobuf) and following these
[installation instructions](https://github.com/google/protobuf#c-installation---unix)
(the ones titled C++; don't miss the note for Mac users).
Then clone this repository and execute the following commands from the root directory where it was cloned.
Then clone this repository and execute the following commands from the root directory where it was
cloned.
Compile the gRPC plugins for _protoc_:
```sh
@ -110,23 +131,32 @@ Create a symbolic link to the compiled plugin binary somewhere in your `$PATH`:
```sh
ln -s `pwd`/bins/opt/grpc_objective_c_plugin /usr/local/bin/protoc-gen-objcgrpc
```
(Notice that the name of the created link must begin with "protoc-gen-" for _protoc_ to recognize it as a plugin).
(Notice that the name of the created link must begin with "protoc-gen-" for _protoc_ to recognize it
as a plugin).
If you don't want to create the symbolic link, you can alternatively copy the binary (with the appropriate name). Or you might prefer instead to specify the plugin's path as a flag when invoking _protoc_, in which case no system modification nor renaming is necessary.
If you don't want to create the symbolic link, you can alternatively copy the binary (with the
appropriate name). Or you might prefer instead to specify the plugin's path as a flag when invoking
_protoc_, in which case no system modification nor renaming is necessary.
<a name="nococoapods"></a>
<a name="no-cocoapods"></a>
### Integrate the generated gRPC library without using Cocoapods
You need to compile the generated `.pbpbjc.*` files (the enums and messages) without ARC support, and the generated `.pbrpc.*` files (the services) with ARC support. The generated code depends on v0.3+ of the Objective-C gRPC runtime library and v3.0+ of the Objective-C Protobuf runtime library.
You need to compile the generated `.pbpbjc.*` files (the enums and messages) without ARC support,
and the generated `.pbrpc.*` files (the services) with ARC support. The generated code depends on
v0.5+ of the Objective-C gRPC runtime library and v3.0.0-alpha-3+ of the Objective-C Protobuf
runtime library.
These libraries need to be integrated into your project as described in their respective Podspec files:
These libraries need to be integrated into your project as described in their respective Podspec
files:
* [Podspec](https://github.com/grpc/grpc/blob/master/gRPC.podspec) for the Objective-C gRPC runtime library. This can be tedious to configure manually.
* [Podspec](https://github.com/jcanizales/protobuf/blob/add-podspec/Protobuf.podspec) for the Objective-C Protobuf runtime library.
* [Podspec](https://github.com/grpc/grpc/blob/master/gRPC.podspec) for the Objective-C gRPC runtime
library. This can be tedious to configure manually.
* [Podspec](https://github.com/jcanizales/protobuf/blob/add-podspec/Protobuf.podspec) for the
Objective-C Protobuf runtime library.
[Protocol Buffers]:https://developers.google.com/protocol-buffers/
[homebrew]:http://brew.sh
[linuxbrew]:https://github.com/Homebrew/linuxbrew
[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install
[example Podspec]:https://github.com/grpc/grpc/blob/master/src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec
[example Podfile]:https://github.com/grpc/grpc/blob/master/src/objective-c/examples/Sample/Podfile
[sample app]: https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample

@ -2,7 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'gRPC', :path => "../../../.."
pod 'Protobuf', :git => 'https://github.com/google/protobuf.git'
pod 'RemoteTest', :path => "../../generated_libraries/RemoteTestClient"
target 'Sample' do

@ -1,33 +0,0 @@
// 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

@ -1,59 +0,0 @@
// 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,221 +0,0 @@
// 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

@ -1,603 +0,0 @@
// 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

@ -1,24 +1,26 @@
Pod::Spec.new do |s|
s.name = 'RemoteTest'
s.version = '0.0.1'
s.summary = 'Protobuf library generated from test.proto, messages.proto, and empty.proto'
s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RemoteTestClient'
s.license = 'New BSD'
s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' }
s.name = "RemoteTest"
s.version = "0.0.1"
s.license = "New BSD"
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.ios.deployment_target = "6.0"
s.osx.deployment_target = "10.8"
s.subspec 'Messages' do |ms|
ms.source_files = '*.pbobjc.{h,m}'
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto"
s.subspec "Messages" do |ms|
ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}"
ms.header_mappings_dir = "."
ms.requires_arc = false
ms.dependency 'Protobuf', '~> 3.0'
ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
end
s.subspec 'Services' do |ss|
ss.source_files = '*.pbrpc.{h,m}'
s.subspec "Services" do |ss|
ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}"
ss.header_mappings_dir = "."
ss.requires_arc = true
ss.dependency 'gRPC', '~> 0.0'
ss.dependency 'RemoteTest/Messages'
ss.dependency "gRPC", "~> 0.5"
ss.dependency "#{s.name}/Messages"
end
end

@ -1,12 +0,0 @@
// 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

@ -1,9 +0,0 @@
// 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;

@ -1,59 +0,0 @@
#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

@ -1,96 +0,0 @@
#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

@ -1,134 +0,0 @@
// 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

@ -1,355 +0,0 @@
// 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

@ -1,43 +0,0 @@
#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

@ -1,72 +0,0 @@
#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

@ -0,0 +1,26 @@
Pod::Spec.new do |s|
s.name = "RouteGuide"
s.version = "0.0.1"
s.license = "New BSD"
s.ios.deployment_target = "6.0"
s.osx.deployment_target = "10.8"
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto"
s.subspec "Messages" do |ms|
ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}"
ms.header_mappings_dir = "."
ms.requires_arc = false
ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
end
s.subspec "Services" do |ss|
ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}"
ss.header_mappings_dir = "."
ss.requires_arc = true
ss.dependency "gRPC", "~> 0.5"
ss.dependency "#{s.name}/Messages"
end
end

@ -1,24 +0,0 @@
Pod::Spec.new do |s|
s.name = 'Route_guide'
s.version = '0.0.1'
s.summary = 'Protobuf library generated from route_guide.proto'
s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RouteGuideClient'
s.license = 'New BSD'
s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' }
s.ios.deployment_target = '6.0'
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.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

@ -29,7 +29,7 @@
syntax = "proto3";
package grpc.example.routeguide;
package examples;
option objc_class_prefix = "RGD";

@ -38,56 +38,62 @@
#import <gRPC/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <Route_guide/RouteGuide.pbobjc.h>
#import <Route_guide/RouteGuide.pbrpc.h>
#import <RouteGuide/RouteGuide.pbobjc.h>
#import <RouteGuide/RouteGuide.pbrpc.h>
// These tests require the gRPC-Java "RouteGuide" sample server to be running locally. To do so,
// install Gradle by following the instructions here: https://docs.gradle.org/current/userguide/installation.html
// And use it to run the server by following the instructions here: https://github.com/grpc/grpc-java/tree/master/examples
// These tests require a gRPC "RouteGuide" sample server to be running locally. You can compile and
// run one by following the instructions here: https://github.com/grpc/grpc-common/blob/master/cpp/cpptutorial.md#try-it-out
// Be sure to have the C gRPC library installed in your system (for example, by having followed the
// instructions at https://github.com/grpc/homebrew-grpc
static NSString * const kRouteGuideHost = @"http://localhost:50051";
static NSString * const kPackage = @"examples";
static NSString * const kService = @"RouteGuide";
@interface LocalClearTextTests : XCTestCase
@end
@implementation LocalClearTextTests
- (void)testConnectionToLocalServer {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Server reachable."];
// This method isn't implemented by the local server.
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing"
interface:@"TestService"
method:@"EmptyCall"];
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[NSData data]];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980"
method:method
requestsWriter:requestsWriter];
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTFail(@"Received unexpected response: %@", value);
} completionHandler:^(NSError *errorOrNil) {
XCTAssertNotNil(errorOrNil, @"Finished without error!");
XCTAssertEqual(errorOrNil.code, 12, @"Finished with unexpected error: %@", errorOrNil);
[expectation fulfill];
}];
[call startWithWriteable:responsesWriteable];
[self waitForExpectationsWithTimeout:2.0 handler:nil];
}
// This test currently fails: see Issue #1907.
//- (void)testConnectionToLocalServer {
// __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Server reachable."];
//
// // This method isn't implemented by the local server.
// GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage
// interface:kService
// method:@"EmptyCall"];
//
// id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[NSData data]];
//
// GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost
// method:method
// requestsWriter:requestsWriter];
//
// id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
// XCTFail(@"Received unexpected response: %@", value);
// } completionHandler:^(NSError *errorOrNil) {
// XCTAssertNotNil(errorOrNil, @"Finished without error!");
// XCTAssertEqual(errorOrNil.code, 12, @"Finished with unexpected error: %@", errorOrNil);
// [expectation fulfill];
// }];
//
// [call startWithWriteable:responsesWriteable];
//
// [self waitForExpectationsWithTimeout:8.0 handler:nil];
//}
- (void)testEmptyRPC {
__weak XCTestExpectation *response = [self expectationWithDescription:@"Empty response received."];
__weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."];
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide"
interface:@"RouteGuide"
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage
interface:kService
method:@"RecordRoute"];
id<GRXWriter> requestsWriter = [GRXWriter emptyWriter];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980"
GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost
method:method
requestsWriter:requestsWriter];
@ -109,8 +115,8 @@
__weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."];
__weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."];
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide"
interface:@"RouteGuide"
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage
interface:kService
method:@"GetFeature"];
RGDPoint *point = [RGDPoint message];
@ -118,7 +124,7 @@
point.longitude = -15E7;
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[point data]];
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980"
GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost
method:method
requestsWriter:requestsWriter];
@ -145,7 +151,7 @@
point.latitude = 28E7;
point.longitude = -15E7;
RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:@"http://127.0.0.1:8980"];
RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:kRouteGuideHost];
[service getFeatureWithRequest:point handler:^(RGDFeature *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssertEqualObjects(point, response.location);

@ -2,9 +2,8 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'gRPC', :path => "../../.."
pod 'Protobuf', :git => 'https://github.com/google/protobuf.git'
pod 'RemoteTest', :path => "../generated_libraries/RemoteTestClient"
pod 'Route_guide', :path => "../generated_libraries/RouteGuideClient"
pod 'RouteGuide', :path => "../generated_libraries/RouteGuideClient"
link_with 'AllTests'

Loading…
Cancel
Save