PingAMPushResponder
public final class PingAMPushResponder : @unchecked Sendable
extension PingAMPushResponder: PingAMPushResponderType
Handles PingAM-specific network operations such as registration and authentication responses.
The responder encapsulates JWT generation, challenge response calculation, and request payload
creation for PingAM endpoints. Networking operations are executed using the supplied
HttpClient, while logging is delegated to the provided Logger instance.
-
Creates a new PingAM responder.
Declaration
Swift
public init(httpClient: any HttpClientProtocol, logger: Logger? = LogManager.logger)Parameters
httpClientThe HTTP client responsible for executing network requests.
loggerOptional logger used for diagnostic output. Defaults to the global logger.
-
register(credential:Asynchronousparams: ) Registers a push credential with PingAM.
Throws
PushErrorwhen required parameters are missing, the request fails, or the response is unsuccessful.Declaration
Swift
@discardableResult public func register( credential: PushCredential, params: [String: Any] ) async throws -> BoolParameters
credentialThe credential that should be enrolled with PingAM.
paramsAdditional registration parameters including challenge, messageId, and device metadata.
Return Value
truewhen the registration request succeeds (HTTP 2xx).
-
Sends an authentication decision (approve or deny) to PingAM.
Throws
PushErrorwhen required data is missing or the network request fails.Declaration
Swift
@discardableResult public func sendAuthenticationResponse( credential: PushCredential, notification: PushNotification, approve: Bool, numbersChallengeResponse: String? = nil ) async throws -> BoolParameters
credentialThe credential associated with the notification.
notificationThe notification being responded to.
approvetrueto approve,falseto deny.numbersChallengeResponseOptional user-entered response for number-matching challenges.
Return Value
truewhen the request succeeds (HTTP 2xx).
-
Updates the device token registered with PingAM.
Throws
PushErrorwhen the token is invalid or the request fails.Declaration
Swift
@discardableResult public func updateDeviceToken( credential: PushCredential, deviceToken: String, deviceName: String? = nil ) async throws -> BoolParameters
credentialThe credential whose device token should be refreshed.
deviceTokenThe APNs token to register.
deviceNameOptional device name; defaults to a platform-specific value when nil.
Return Value
truewhen the request succeeds (HTTP 2xx).
View on GitHub