CreateNotificationModifier
public final class CreateNotificationModifier<
A: CreateEndpoint>:
CreateEndpoint, RestEndpointModifier where A.QuerySubject: NotificationProtocol
A class that wraps a component which utilizes a .notify()
modifier. That
allows Corvus to chain modifiers, as it gets treated as any other struct
conforming to CreateEndpoint
. Requires an object A
that represents the
message to send.
-
The return type for the
.handler()
modifier.Declaration
Swift
public typealias Element = A.Element
-
The return value of the
.query()
, so the type being operated on in the current component.Declaration
Swift
public typealias QuerySubject = A.QuerySubject
-
The instance of
Endpoint
theCreateNotificationModifier
is modifying.Declaration
Swift
public let modifiedEndpoint: A
-
Initializes the modifier with its underlying
QueryEndpoint
Declaration
Swift
public init(_ notificationEndpoint: A)
Parameters
notificationEndpoint
The
QueryEndpoint
to which the modifer is attached. -
A default implementation of
.query()
for components that do not require customized database queries.Throws
An error if something goes wrong.Declaration
Swift
public func query(_ req: Request) throws -> QueryBuilder<QuerySubject>
Parameters
req
The incoming
Request
.Return Value
A
QueryBuilder
object for further querying. -
A method which sends the message supplied in the
Request
as a push notification.Throws
An error if something goes wrong.Declaration
Swift
public func handler(_ req: Request) throws -> EventLoopFuture<Element>
Parameters
req
An incoming
Request
.Return Value
An
EventLoopFuture
containing an eagerloaded value as defined byElement
.