objc2-store-kit 0.3.2

Bindings to the StoreKit 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/storekit/skpaymenttransactionstate?language=objc)
// NS_ENUM
#[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKPaymentTransactionState(pub NSInteger);
impl SKPaymentTransactionState {
    #[doc(alias = "SKPaymentTransactionStatePurchasing")]
    #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
    pub const Purchasing: Self = Self(0);
    #[doc(alias = "SKPaymentTransactionStatePurchased")]
    #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
    pub const Purchased: Self = Self(1);
    #[doc(alias = "SKPaymentTransactionStateFailed")]
    #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
    pub const Failed: Self = Self(2);
    #[doc(alias = "SKPaymentTransactionStateRestored")]
    #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
    pub const Restored: Self = Self(3);
    #[doc(alias = "SKPaymentTransactionStateDeferred")]
    #[deprecated = "Use PurchaseResult.pending from Product.purchase(confirmIn:options:)"]
    pub const Deferred: Self = Self(4);
}

unsafe impl Encode for SKPaymentTransactionState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SKPaymentTransactionState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skpaymenttransaction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
    pub struct SKPaymentTransaction;
);

unsafe impl Send for SKPaymentTransaction {}

unsafe impl Sync for SKPaymentTransaction {}

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

impl SKPaymentTransaction {
    extern_methods!(
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(error))]
        #[unsafe(method_family = none)]
        pub unsafe fn error(&self) -> Option<Retained<NSError>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(originalTransaction))]
        #[unsafe(method_family = none)]
        pub unsafe fn originalTransaction(&self) -> Option<Retained<SKPaymentTransaction>>;

        #[cfg(feature = "SKPayment")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(payment))]
        #[unsafe(method_family = none)]
        pub unsafe fn payment(&self) -> Retained<SKPayment>;

        #[cfg(feature = "SKDownload")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Hosted content is no longer supported"]
        #[unsafe(method(downloads))]
        #[unsafe(method_family = none)]
        pub unsafe fn downloads(&self) -> Retained<NSArray<SKDownload>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(transactionDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactionDate(&self) -> Option<Retained<NSDate>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(transactionIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactionIdentifier(&self) -> Option<Retained<NSString>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated]
        #[unsafe(method(transactionReceipt))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactionReceipt(&self) -> Option<Retained<NSData>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(transactionState))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactionState(&self) -> SKPaymentTransactionState;
    );
}

/// Methods declared on superclass `NSObject`.
impl SKPaymentTransaction {
    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>;
    );
}