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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/storekit/skoverlayposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKOverlayPosition(pub NSInteger);
impl SKOverlayPosition {
    #[doc(alias = "SKOverlayPositionBottom")]
    pub const Bottom: Self = Self(0);
    #[doc(alias = "SKOverlayPositionBottomRaised")]
    pub const BottomRaised: Self = Self(1);
}

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

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

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

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

impl SKOverlayConfiguration {
    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!(
    /// An overlay configuration that can be used to show any app from the App Store.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/storekit/skoverlayappconfiguration?language=objc)
    #[unsafe(super(SKOverlayConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKOverlayAppConfiguration;
);

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

impl SKOverlayAppConfiguration {
    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>;

        /// Creates a new app overlay configuration that will show an app from the App Store.
        ///
        /// Parameter `appIdentifier`: the app identifier of the app to show.
        ///
        /// Parameter `position`: the desired position of the overlay.
        #[unsafe(method(initWithAppIdentifier:position:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAppIdentifier_position(
            this: Allocated<Self>,
            app_identifier: &NSString,
            position: SKOverlayPosition,
        ) -> Retained<Self>;

        /// The identifier of the app that will be shown.
        #[unsafe(method(appIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn appIdentifier(&self) -> Retained<NSString>;

        /// Setter for [`appIdentifier`][Self::appIdentifier].
        #[unsafe(method(setAppIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAppIdentifier(&self, app_identifier: &NSString);

        /// A token representing an App Analytics campaign.
        #[unsafe(method(campaignToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn campaignToken(&self) -> Option<Retained<NSString>>;

        /// Setter for [`campaignToken`][Self::campaignToken].
        #[unsafe(method(setCampaignToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCampaignToken(&self, campaign_token: Option<&NSString>);

        /// The provider token for the developer that created the app being presented.
        #[unsafe(method(providerToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn providerToken(&self) -> Option<Retained<NSString>>;

        /// Setter for [`providerToken`][Self::providerToken].
        #[unsafe(method(setProviderToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProviderToken(&self, provider_token: Option<&NSString>);

        /// An optional identifier for an app's custom product page.
        #[unsafe(method(customProductPageIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn customProductPageIdentifier(&self) -> Option<Retained<NSString>>;

        /// Setter for [`customProductPageIdentifier`][Self::customProductPageIdentifier].
        #[unsafe(method(setCustomProductPageIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCustomProductPageIdentifier(
            &self,
            custom_product_page_identifier: Option<&NSString>,
        );

        /// An optional extra parameter for specifying the version of your app that will be shown to the user.
        #[unsafe(method(latestReleaseID))]
        #[unsafe(method_family = none)]
        pub unsafe fn latestReleaseID(&self) -> Option<Retained<NSString>>;

        /// Setter for [`latestReleaseID`][Self::latestReleaseID].
        #[unsafe(method(setLatestReleaseID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLatestReleaseID(&self, latest_release_id: Option<&NSString>);

        /// The position an overlay will show at on screen.
        #[unsafe(method(position))]
        #[unsafe(method_family = none)]
        pub unsafe fn position(&self) -> SKOverlayPosition;

        /// Setter for [`position`][Self::position].
        #[unsafe(method(setPosition:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPosition(&self, position: SKOverlayPosition);

        /// Allows the user to interactively dismiss an overlay.
        #[unsafe(method(userDismissible))]
        #[unsafe(method_family = none)]
        pub unsafe fn userDismissible(&self) -> bool;

        /// Setter for [`userDismissible`][Self::userDismissible].
        #[unsafe(method(setUserDismissible:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserDismissible(&self, user_dismissible: bool);

        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setAdditionalValue:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAdditionalValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);

        #[must_use]
        #[unsafe(method(additionalValueForKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn additionalValueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "SKAdImpression")]
        #[unsafe(method(setAdImpression:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAdImpression(&self, impression: &SKAdImpression);
    );
}

extern_class!(
    /// An overlay configuration that can be used to show an app clip's full app.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/storekit/skoverlayappclipconfiguration?language=objc)
    #[unsafe(super(SKOverlayConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKOverlayAppClipConfiguration;
);

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

impl SKOverlayAppClipConfiguration {
    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>;

        /// Creates a new app overlay configuration that will show an app clip's full app.
        ///
        /// Parameter `position`: the desired position of the overlay.
        #[unsafe(method(initWithPosition:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPosition(
            this: Allocated<Self>,
            position: SKOverlayPosition,
        ) -> Retained<Self>;

        /// A token representing an App Analytics campaign.
        #[unsafe(method(campaignToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn campaignToken(&self) -> Option<Retained<NSString>>;

        /// Setter for [`campaignToken`][Self::campaignToken].
        #[unsafe(method(setCampaignToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCampaignToken(&self, campaign_token: Option<&NSString>);

        /// The provider token for the developer that created the app being presented.
        #[unsafe(method(providerToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn providerToken(&self) -> Option<Retained<NSString>>;

        /// Setter for [`providerToken`][Self::providerToken].
        #[unsafe(method(setProviderToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProviderToken(&self, provider_token: Option<&NSString>);

        /// An optional identifier for a parent app's custom product page.
        #[unsafe(method(customProductPageIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn customProductPageIdentifier(&self) -> Option<Retained<NSString>>;

        /// Setter for [`customProductPageIdentifier`][Self::customProductPageIdentifier].
        #[unsafe(method(setCustomProductPageIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCustomProductPageIdentifier(
            &self,
            custom_product_page_identifier: Option<&NSString>,
        );

        /// An optional extra parameter for specifying the version of your app that will be shown to the user.
        #[unsafe(method(latestReleaseID))]
        #[unsafe(method_family = none)]
        pub unsafe fn latestReleaseID(&self) -> Option<Retained<NSString>>;

        /// Setter for [`latestReleaseID`][Self::latestReleaseID].
        #[unsafe(method(setLatestReleaseID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLatestReleaseID(&self, latest_release_id: Option<&NSString>);

        /// The position an overlay will show at on screen.
        #[unsafe(method(position))]
        #[unsafe(method_family = none)]
        pub unsafe fn position(&self) -> SKOverlayPosition;

        /// Setter for [`position`][Self::position].
        #[unsafe(method(setPosition:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPosition(&self, position: SKOverlayPosition);

        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setAdditionalValue:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAdditionalValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);

        #[must_use]
        #[unsafe(method(additionalValueForKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn additionalValueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
    );
}