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
RequestModelvalue which type is defined by the class constraint.Declaration
Swift
public let message: RequestModel -
Vapor
Requestfrom which the gRPC request was instantiated. This reference is required by theGRPCRequestTypeprotocol.Declaration
Swift
public var vaporRequest: Request -
Creates a succeeded future of a
GRPCModeltype which is usually the response type on the event loop of thevaporRequest. This is a generic function with aResponseModelwhich implements theGRPCModelprotocol as a type constraint. It acts as shortcut to thesucceedmethod of the VaporsRequesttype.Declaration
Swift
public func succeed<ResponseModel>(value: ResponseModel) -> EventLoopFuture<ResponseModel> where ResponseModel : GRPCModelParameters
valueSingle value of the
ResponseModelthat is used to succeed the created future.Return Value
A succeeded future of the type
ResponseModelon thevaporRequestevent loop.
View on GitHub
GRPCRequest Class Reference