GRPC Objective-C  1.71.0
GRPCCall.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
37 #import <Foundation/Foundation.h>
38 
39 #import "GRPCCallOptions.h"
40 #import "GRPCDispatchable.h"
41 #import "GRPCTypes.h"
42 
43 // The legacy header is included for backwards compatibility. Some V1 API users are still using
44 // GRPCCall by importing GRPCCall.h header so we need this import.
45 #import "GRPCCallLegacy.h"
46 
47 NS_ASSUME_NONNULL_BEGIN
48 
51 
52 @optional
53 
57 - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata;
58 
68 - (void)didReceiveRawMessage:(nullable NSData *)message;
69 
79 - (void)didReceiveData:(id)data;
80 
87 - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata
88  error:(nullable NSError *)error;
89 
94 - (void)didWriteData;
95 
96 @end
97 
102 @interface GRPCRequestOptions : NSObject <NSCopying>
103 
104 - (instancetype)init NS_UNAVAILABLE;
105 
106 + (instancetype)new NS_UNAVAILABLE;
107 
109 - (instancetype)initWithHost:(NSString *)host
110  path:(NSString *)path
111  safety:(GRPCCallSafety)safety NS_DESIGNATED_INITIALIZER;
112 
114 @property(copy, readonly) NSString *host;
116 @property(copy, readonly) NSString *path;
121 @property(readonly) GRPCCallSafety safety;
122 
123 @end
124 
125 #pragma mark GRPCCall
126 
130 @interface GRPCCall2 : NSObject
131 
132 - (instancetype)init NS_UNAVAILABLE;
133 
134 + (instancetype)new NS_UNAVAILABLE;
135 
142 - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
143  responseHandler:(id<GRPCResponseHandler>)responseHandler
144  callOptions:(nullable GRPCCallOptions *)callOptions
145  NS_DESIGNATED_INITIALIZER;
150 - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
151  responseHandler:(id<GRPCResponseHandler>)responseHandler;
152 
156 - (void)start;
157 
163 - (void)cancel;
164 
169 - (void)writeData:(id)data;
170 
175 - (void)finish;
176 
183 - (void)receiveNextMessages:(NSUInteger)numberOfMessages;
184 
188 @property(readonly, copy) GRPCCallOptions *callOptions;
189 
191 @property(readonly, copy) GRPCRequestOptions *requestOptions;
192 
193 @end
194 
195 NS_ASSUME_NONNULL_END
GRPCDispatchable-p
An object that processes its methods with a dispatch queue.
Definition: GRPCDispatchable.h:23
GRPCCall2::requestOptions
GRPCRequestOptions * requestOptions
Get a copy of the original request options.
Definition: GRPCCall.h:191
-[GRPCResponseHandler-p didWriteData]
void didWriteData()
Issued when flow control is enabled for the call and a message written with GRPCCall2::writeData is p...
GRPCCall2
A GRPCCall2 object represents an RPC call.
Definition: GRPCCall.h:130
GRPCCallOptions
Immutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:32
GRPCCallLegacy.h
GRPCRequestOptions::host
NSString * host
The host serving the RPC service.
Definition: GRPCCall.h:114
GRPCDispatchable.h
GRPCRequestOptions::safety
GRPCCallSafety safety
Specify whether the call is idempotent or cachable.
Definition: GRPCCall.h:121
-[GRPCCall2 start]
void start()
Starts the call.
-[GRPCCall2 finish]
void finish()
Finish the RPC request and half-close the call.
GRPCCall2::callOptions
GRPCCallOptions * callOptions
Get a copy of the original call options.
Definition: GRPCCall.h:188
-[GRPCRequestOptions NS_UNAVAILABLE]
instancetype NS_UNAVAILABLE()
GRPCRequestOptions::path
NSString * path
The path to the RPC call.
Definition: GRPCCall.h:116
-[GRPCCall2 NS_UNAVAILABLE]
instancetype NS_UNAVAILABLE()
GRPCRequestOptions
HTTP request parameters.
Definition: GRPCCall.h:102
GRPCCallOptions.h
GRPCTypes.h
-[GRPCCall2 cancel]
void cancel()
Cancel the request of this call at best effort.
GRPCResponseHandler-p
An object can implement this protocol to receive responses from server from a call.
Definition: GRPCCall.h:50