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_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductsrequestdelegate?language=objc)
    #[cfg(feature = "SKRequest")]
    #[deprecated = "Get products using Product.products(for:)"]
    pub unsafe trait SKProductsRequestDelegate: SKRequestDelegate {
        #[deprecated = "Get products using Product.products(for:)"]
        #[unsafe(method(productsRequest:didReceiveResponse:))]
        #[unsafe(method_family = none)]
        unsafe fn productsRequest_didReceiveResponse(
            &self,
            request: &SKProductsRequest,
            response: &SKProductsResponse,
        );
    }
);

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

#[cfg(feature = "SKRequest")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SKProductsRequest {}
);

#[cfg(feature = "SKRequest")]
impl SKProductsRequest {
    extern_methods!(
        #[deprecated = "Use Product.products(for:)"]
        #[unsafe(method(initWithProductIdentifiers:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProductIdentifiers(
            this: Allocated<Self>,
            product_identifiers: &NSSet<NSString>,
        ) -> Retained<Self>;

        #[deprecated = "Use Product.products(for:)"]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn SKProductsRequestDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[deprecated = "Use Product.products(for:)"]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn SKProductsRequestDelegate>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "SKRequest")]
impl SKProductsRequest {
    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/skproductsresponse?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Get products using Product.products(for:)"]
    pub struct SKProductsResponse;
);

unsafe impl Send for SKProductsResponse {}

unsafe impl Sync for SKProductsResponse {}

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

impl SKProductsResponse {
    extern_methods!(
        #[cfg(feature = "SKProduct")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Get products using Product.products(for:)"]
        #[unsafe(method(products))]
        #[unsafe(method_family = none)]
        pub unsafe fn products(&self) -> Retained<NSArray<SKProduct>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Get products using Product.products(for:)"]
        #[unsafe(method(invalidProductIdentifiers))]
        #[unsafe(method_family = none)]
        pub unsafe fn invalidProductIdentifiers(&self) -> Retained<NSArray<NSString>>;
    );
}

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