objc2-push-kit 0.3.2

Bindings to the PushKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// An object that encapsulates the device token you use to deliver push notifications
    /// to your app.
    ///
    /// When registering your app's push types, PushKit creates a ``PushKit/PKPushCredentials``
    /// object for each type your app supports and delivers it to your delegate's ``PushKit/PKPushRegistryDelegate/pushRegistry:didUpdatePushCredentials:forType:``
    /// method. Don't create ``PushKit/PKPushCredentials`` objects yourself.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/pushkit/pkpushcredentials?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKPushCredentials;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for PKPushCredentials {}
);

impl PKPushCredentials {
    extern_methods!(
        #[cfg(feature = "PKDefines")]
        /// The push type constant associated with the token.
        ///
        /// For possible values, see ``PushKit/PKPushType``.
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> Retained<PKPushType>;

        /// A unique device token to use when sending push notifications to the current device.
        ///
        /// Forward this token to the server you use to generate push notifications. When preparing
        /// to deliver a push notification to the current device, include the token in the HTTP
        /// request you send to Apple Push Notification service (APNs).
        #[unsafe(method(token))]
        #[unsafe(method_family = none)]
        pub unsafe fn token(&self) -> Retained<NSData>;
    );
}

/// Methods declared on superclass `NSObject`.
impl PKPushCredentials {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}