PingAMPushHandler
public final class PingAMPushHandler : PushHandler, @unchecked Sendable
PingAM implementation of the PushHandler protocol.
This handler is responsible for determining whether an incoming push message belongs to
PingAM and for parsing the payload into a normalized dictionary that can be consumed by the
Push service layer. Network operations (registration, approvals, etc.) are delegated to
PingAMPushResponder and completed in subsequent phases of the implementation plan.
-
Creates a new PingAM handler.
Declaration
Swift
public init( httpClient: any HttpClientProtocol, logger: Logger? = LogManager.logger, pushResponder: PingAMPushResponderType? = nil )Parameters
httpClientHTTP client used by the responder.
loggerOptional logger for diagnostics.
pushResponderOptional responder override (useful for testing).
-
Check if this handler can process the given message.
Declaration
Swift
public func canHandle(messageData: [String : Any]) -> BoolParameters
messageDataThe raw message data dictionary.
Return Value
trueif the message can be handled;falseotherwise -
Check if this handler can process the given message.
Declaration
Swift
public func canHandle(message: String) -> BoolParameters
messageThe raw message string.
Return Value
trueif the message can be handled;falseotherwise
-
Parse a PingAM push notification message data into a normalized dictionary.
Declaration
Swift
public func parseMessage(messageData: [String : Any]) throws -> [String : Any]Parameters
messageDataThe raw message data dictionary.
Return Value
A dictionary containing the parsed message fields.
-
Parse a PingAM push notification message string into a normalized dictionary.
Declaration
Swift
public func parseMessage(message: String) throws -> [String : Any]Parameters
messageThe raw message string.
Return Value
A dictionary containing the parsed message fields.
-
sendApproval(credential:Asynchronousnotification: params: ) Send approval for a PingAM push notification.
Declaration
Swift
public func sendApproval( credential: PushCredential, notification: PushNotification, params: [String: Any] ) async throws -> BoolParameters
credentialThe push credential associated with the notification.
notificationThe push notification to approve.
paramsAdditional parameters for the approval.
Return Value
trueif the approval was sent successfully;falseotherwise. -
sendDenial(credential:Asynchronousnotification: params: ) Send denial for a PingAM push notification.
Declaration
Swift
public func sendDenial( credential: PushCredential, notification: PushNotification, params: [String: Any] ) async throws -> BoolParameters
credentialThe push credential associated with the notification.
notificationThe push notification to deny.
paramsAdditional parameters for the denial.
Return Value
trueif the denial was sent successfully;falseotherwise -
setDeviceToken(credential:AsynchronousdeviceToken: params: ) Set or update the device token for push notifications.
Declaration
Swift
public func setDeviceToken( credential: PushCredential, deviceToken: String, params: [String: Any] ) async throws -> BoolParameters
credentialThe push credential associated with the device.
deviceTokenThe device token string.
paramsAdditional parameters, including optional device name.
Return Value
trueif the device token was set successfully;falseotherwise. -
register(credential:Asynchronousparams: ) Register the push credential with PingAM.
Declaration
Swift
public func register( credential: PushCredential, params: [String: Any] ) async throws -> BoolParameters
credentialThe push credential to register.
paramsAdditional registration parameters.
Return Value
trueif registration was successful;falseotherwise.
View on GitHub