GRPCRequest
public class GRPCRequest<RequestModel> : GRPCRequestType where RequestModel : GRPCModel
A GRPCRequest
instance represents a unary gRPC request that provides the single incoming value and a generic succeed
method to create a singe response future.
It implements the GRPCRequestType
that requires it to contain its Vapor Request
and provides several shortcuts to several Vapor stack functionality.
This is also a generic class which has type constrait for the RequestModel
type which implements the GRPCModel
protocol.
-
Single incoming
RequestModel
value which type is defined by the class constraint.Declaration
Swift
public let message: RequestModel
-
Vapor
Request
from which the gRPC request was instantiated. This reference is required by theGRPCRequestType
protocol.Declaration
Swift
public var vaporRequest: Request
-
Creates a succeeded future of a
GRPCModel
type which is usually the response type on the event loop of thevaporRequest
. This is a generic function with aResponseModel
which implements theGRPCModel
protocol as a type constraint. It acts as shortcut to thesucceed
method of the VaporsRequest
type.Declaration
Swift
public func succeed<ResponseModel>(value: ResponseModel) -> EventLoopFuture<ResponseModel> where ResponseModel : GRPCModel
Parameters
value
Single value of the
ResponseModel
that is used to succeed the created future.Return Value
A succeeded future of the type
ResponseModel
on thevaporRequest
event loop.