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.

Initialization

  • Creates a new PingAM handler.

    Declaration

    Swift

    public init(
        httpClient: any HttpClientProtocol,
        logger: Logger? = LogManager.logger,
        pushResponder: PingAMPushResponderType? = nil
    )

    Parameters

    httpClient

    HTTP client used by the responder.

    logger

    Optional logger for diagnostics.

    pushResponder

    Optional responder override (useful for testing).

PushHandler Conformance (Message Detection)

  • Check if this handler can process the given message.

    Declaration

    Swift

    public func canHandle(messageData: [String : Any]) -> Bool

    Parameters

    messageData

    The raw message data dictionary.

    Return Value

    true if the message can be handled; false otherwise

  • Check if this handler can process the given message.

    Declaration

    Swift

    public func canHandle(message: String) -> Bool

    Parameters

    message

    The raw message string.

    Return Value

    true if the message can be handled; false otherwise

PushHandler Conformance (Message Parsing)

  • Parse a PingAM push notification message data into a normalized dictionary.

    Declaration

    Swift

    public func parseMessage(messageData: [String : Any]) throws -> [String : Any]

    Parameters

    messageData

    The 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

    message

    The raw message string.

    Return Value

    A dictionary containing the parsed message fields.

PushHandler Conformance (Operations - Implemented in later tasks)

  • Send approval for a PingAM push notification.

    Declaration

    Swift

    public func sendApproval(
        credential: PushCredential,
        notification: PushNotification,
        params: [String: Any]
    ) async throws -> Bool

    Parameters

    credential

    The push credential associated with the notification.

    notification

    The push notification to approve.

    params

    Additional parameters for the approval.

    Return Value

    true if the approval was sent successfully; false otherwise.

  • Send denial for a PingAM push notification.

    Declaration

    Swift

    public func sendDenial(
        credential: PushCredential,
        notification: PushNotification,
        params: [String: Any]
    ) async throws -> Bool

    Parameters

    credential

    The push credential associated with the notification.

    notification

    The push notification to deny.

    params

    Additional parameters for the denial.

    Return Value

    true if the denial was sent successfully; false otherwise

  • Set or update the device token for push notifications.

    Declaration

    Swift

    public func setDeviceToken(
        credential: PushCredential,
        deviceToken: String,
        params: [String: Any]
    ) async throws -> Bool

    Parameters

    credential

    The push credential associated with the device.

    deviceToken

    The device token string.

    params

    Additional parameters, including optional device name.

    Return Value

    true if the device token was set successfully; false otherwise.

  • Register the push credential with PingAM.

    Declaration

    Swift

    public func register(
        credential: PushCredential,
        params: [String: Any]
    ) async throws -> Bool

    Parameters

    credential

    The push credential to register.

    params

    Additional registration parameters.

    Return Value

    true if registration was successful; false otherwise.