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::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductviewcontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct SKStoreProductViewController;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for SKStoreProductViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSEditor for SKStoreProductViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SKStoreProductViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSeguePerforming for SKStoreProductViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for SKStoreProductViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKStoreProductViewController {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn SKStoreProductViewControllerDelegate>>>;

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

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `parameters` generic should be of the correct type.
        #[unsafe(method(loadProductWithParameters:completionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadProductWithParameters_completionBlock(
            &self,
            parameters: &NSDictionary<NSString, AnyObject>,
            block: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "SKAdImpression", feature = "block2"))]
        /// # Safety
        ///
        /// `parameters` generic should be of the correct type.
        #[unsafe(method(loadProductWithParameters:impression:completionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadProductWithParameters_impression_completionBlock(
            &self,
            parameters: &NSDictionary<NSString, AnyObject>,
            impression: &SKAdImpression,
            block: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
        );
    );
}

/// Methods declared on superclass `NSViewController`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKStoreProductViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSNibName>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKStoreProductViewController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKStoreProductViewController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductviewcontrollerdelegate?language=objc)
    pub unsafe trait SKStoreProductViewControllerDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(productViewControllerDidFinish:))]
        #[unsafe(method_family = none)]
        unsafe fn productViewControllerDidFinish(
            &self,
            view_controller: &SKStoreProductViewController,
        );
    }
);

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparameteritunesitemidentifier?language=objc)
    pub static SKStoreProductParameterITunesItemIdentifier: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparameterproductidentifier?language=objc)
    pub static SKStoreProductParameterProductIdentifier: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparametercustomproductpageidentifier?language=objc)
    pub static SKStoreProductParameterCustomProductPageIdentifier: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparameteraffiliatetoken?language=objc)
    pub static SKStoreProductParameterAffiliateToken: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparametercampaigntoken?language=objc)
    pub static SKStoreProductParameterCampaignToken: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparameterprovidertoken?language=objc)
    pub static SKStoreProductParameterProviderToken: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skstoreproductparameteradvertisingpartnertoken?language=objc)
    pub static SKStoreProductParameterAdvertisingPartnerToken: &'static NSString;
}