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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

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

extern_conformance!(
    unsafe impl NSCopying for SKPayment {}
);

unsafe impl CopyingHelper for SKPayment {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for SKPayment {}
);

unsafe impl MutableCopyingHelper for SKPayment {
    type Result = SKMutablePayment;
}

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

impl SKPayment {
    extern_methods!(
        #[cfg(feature = "SKProduct")]
        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(paymentWithProduct:))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentWithProduct(product: &SKProduct) -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(paymentWithProductIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentWithProductIdentifier(identifier: &NSString) -> Retained<AnyObject>;

        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(productIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn productIdentifier(&self) -> Retained<NSString>;

        #[deprecated = "Create Product.PurchaseOption.custom values to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(requestData))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestData(&self) -> Option<Retained<NSData>>;

        #[deprecated = "Create a Product.PurchaseOption.quantity to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(quantity))]
        #[unsafe(method_family = none)]
        pub unsafe fn quantity(&self) -> NSInteger;

        #[deprecated = "Create a Product.PurchaseOption.appAccountToken to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(applicationUsername))]
        #[unsafe(method_family = none)]
        pub unsafe fn applicationUsername(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Create a Product.PurchaseOption.simulatesAskToBuyInSandbox to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(simulatesAskToBuyInSandbox))]
        #[unsafe(method_family = none)]
        pub unsafe fn simulatesAskToBuyInSandbox(&self) -> bool;

        #[cfg(feature = "SKPaymentDiscount")]
        #[deprecated = "Create a Product.PurchaseOption.promotionalOffer to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(paymentDiscount))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentDiscount(&self) -> Option<Retained<SKPaymentDiscount>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl SKPayment {
    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/skmutablepayment?language=objc)
    #[unsafe(super(SKPayment, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use Product.purchase(confirmIn:options:)"]
    pub struct SKMutablePayment;
);

extern_conformance!(
    unsafe impl NSCopying for SKMutablePayment {}
);

unsafe impl CopyingHelper for SKMutablePayment {
    type Result = SKPayment;
}

extern_conformance!(
    unsafe impl NSMutableCopying for SKMutablePayment {}
);

unsafe impl MutableCopyingHelper for SKMutablePayment {
    type Result = Self;
}

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

impl SKMutablePayment {
    extern_methods!(
        #[deprecated = "Create a Product.PurchaseOption.appAccountToken to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(applicationUsername))]
        #[unsafe(method_family = none)]
        pub unsafe fn applicationUsername(&self) -> Option<Retained<NSString>>;

        /// Setter for [`applicationUsername`][Self::applicationUsername].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Create a Product.PurchaseOption.appAccountToken to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setApplicationUsername:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setApplicationUsername(&self, application_username: Option<&NSString>);

        #[cfg(feature = "SKPaymentDiscount")]
        #[deprecated = "Create a Product.PurchaseOption.promotionalOffer to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(paymentDiscount))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentDiscount(&self) -> Option<Retained<SKPaymentDiscount>>;

        #[cfg(feature = "SKPaymentDiscount")]
        /// Setter for [`paymentDiscount`][Self::paymentDiscount].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Create a Product.PurchaseOption.promotionalOffer to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setPaymentDiscount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPaymentDiscount(&self, payment_discount: Option<&SKPaymentDiscount>);

        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(productIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn productIdentifier(&self) -> Retained<NSString>;

        /// Setter for [`productIdentifier`][Self::productIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setProductIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProductIdentifier(&self, product_identifier: &NSString);

        #[deprecated = "Create a Product.PurchaseOption.quantity to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(quantity))]
        #[unsafe(method_family = none)]
        pub unsafe fn quantity(&self) -> NSInteger;

        /// Setter for [`quantity`][Self::quantity].
        #[deprecated = "Create a Product.PurchaseOption.quantity to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setQuantity:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setQuantity(&self, quantity: NSInteger);

        #[deprecated = "Create Product.PurchaseOption.custom values to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(requestData))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestData(&self) -> Option<Retained<NSData>>;

        /// Setter for [`requestData`][Self::requestData].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Create Product.PurchaseOption.custom values to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setRequestData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRequestData(&self, request_data: Option<&NSData>);

        #[deprecated = "Create a Product.PurchaseOption.simulatesAskToBuyInSandbox to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(simulatesAskToBuyInSandbox))]
        #[unsafe(method_family = none)]
        pub unsafe fn simulatesAskToBuyInSandbox(&self) -> bool;

        /// Setter for [`simulatesAskToBuyInSandbox`][Self::simulatesAskToBuyInSandbox].
        #[deprecated = "Create a Product.PurchaseOption.simulatesAskToBuyInSandbox to use in Product.purchase(confirmIn:options:)"]
        #[unsafe(method(setSimulatesAskToBuyInSandbox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSimulatesAskToBuyInSandbox(&self, simulates_ask_to_buy_in_sandbox: bool);
    );
}

/// Methods declared on superclass `SKPayment`.
impl SKMutablePayment {
    extern_methods!(
        #[cfg(feature = "SKProduct")]
        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(paymentWithProduct:))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentWithProduct(product: &SKProduct) -> Retained<Self>;
    );
}

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