objc2-background-assets 0.3.2

Bindings to the BackgroundAssets 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::*;

extern_class!(
    /// An archive of assets that the system downloads together.
    ///
    /// An instance of this class can be invalidated when the asset pack that it represents is updated on the server.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/baassetpack?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct BAAssetPack;
);

unsafe impl Send for BAAssetPack {}

unsafe impl Sync for BAAssetPack {}

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

impl BAAssetPack {
    extern_methods!(
        /// A unique identifier for the asset pack.
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        /// The size of the download file containing the asset pack in bytes.
        ///
        /// This is different than the installation size, which could be larger.
        #[unsafe(method(downloadSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn downloadSize(&self) -> NSInteger;

        /// The asset pack’s version number
        #[unsafe(method(version))]
        #[unsafe(method_family = none)]
        pub unsafe fn version(&self) -> NSInteger;

        /// JSON-encoded custom information that’s associated with the asset pack.
        ///
        /// This property is `nil` for Apple-hosted asset packs.
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub unsafe fn userInfo(&self) -> Option<Retained<NSData>>;

        #[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>;

        #[cfg(feature = "BADownload")]
        /// Creates a download object for the asset pack that you schedule using a download manager.
        /// - Remark: Use this method in your main app; use ``BAAssetPack/downloadForContentRequest:`` instead in your downloader extension.
        #[unsafe(method(download))]
        #[unsafe(method_family = none)]
        pub unsafe fn download(&self) -> Retained<BADownload>;

        #[cfg(all(feature = "BADownload", feature = "BATypes"))]
        /// Creates a download object for the asset pack that you schedule using a download manager.
        /// - Parameter contentRequest: The content request for the current extension invocation.
        /// - Returns: A download object.
        /// - Remark: Use this method in your downloader extension; use ``BAAssetPack/download`` instead in your main app.
        #[unsafe(method(downloadForContentRequest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn downloadForContentRequest(
            &self,
            content_request: BAContentRequest,
        ) -> Retained<BADownload>;
    );
}