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/skproductperiodunit?language=objc)
// NS_ENUM
#[deprecated = "Use Product.SubscriptionPeriod.Unit"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKProductPeriodUnit(pub NSUInteger);
impl SKProductPeriodUnit {
    #[doc(alias = "SKProductPeriodUnitDay")]
    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
    pub const Day: Self = Self(0);
    #[doc(alias = "SKProductPeriodUnitWeek")]
    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
    pub const Week: Self = Self(1);
    #[doc(alias = "SKProductPeriodUnitMonth")]
    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
    pub const Month: Self = Self(2);
    #[doc(alias = "SKProductPeriodUnitYear")]
    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
    pub const Year: Self = Self(3);
}

unsafe impl Encode for SKProductPeriodUnit {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductsubscriptionperiod?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use Product.SubscriptionPeriod"]
    pub struct SKProductSubscriptionPeriod;
);

unsafe impl Send for SKProductSubscriptionPeriod {}

unsafe impl Sync for SKProductSubscriptionPeriod {}

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

impl SKProductSubscriptionPeriod {
    extern_methods!(
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionPeriod"]
        #[unsafe(method(numberOfUnits))]
        #[unsafe(method_family = none)]
        pub unsafe fn numberOfUnits(&self) -> NSUInteger;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionPeriod"]
        #[unsafe(method(unit))]
        #[unsafe(method_family = none)]
        pub unsafe fn unit(&self) -> SKProductPeriodUnit;
    );
}

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

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

unsafe impl Send for SKProduct {}

unsafe impl Sync for SKProduct {}

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

impl SKProduct {
    extern_methods!(
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.description"]
        #[unsafe(method(localizedDescription))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedDescription(&self) -> Retained<NSString>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.displayName"]
        #[unsafe(method(localizedTitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedTitle(&self) -> Retained<NSString>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.displayPrice"]
        #[unsafe(method(price))]
        #[unsafe(method_family = none)]
        pub unsafe fn price(&self) -> Retained<NSDecimalNumber>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.displayPrice"]
        #[unsafe(method(priceLocale))]
        #[unsafe(method_family = none)]
        pub unsafe fn priceLocale(&self) -> Retained<NSLocale>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.id"]
        #[unsafe(method(productIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn productIdentifier(&self) -> Retained<NSString>;

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

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

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.isFamilyShareable"]
        #[unsafe(method(isFamilyShareable))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFamilyShareable(&self) -> bool;

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

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

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

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

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

        #[cfg(feature = "SKProductDiscount")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.subscription.introductionaryOffer"]
        #[unsafe(method(introductoryPrice))]
        #[unsafe(method_family = none)]
        pub unsafe fn introductoryPrice(&self) -> Option<Retained<SKProductDiscount>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.subscription.subscriptionGroupID"]
        #[unsafe(method(subscriptionGroupIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn subscriptionGroupIdentifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "SKProductDiscount")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.subscription.promotionalOffers"]
        #[unsafe(method(discounts))]
        #[unsafe(method_family = none)]
        pub unsafe fn discounts(&self) -> Retained<NSArray<SKProductDiscount>>;
    );
}

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