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!(
    /// A representation of a manifest that lists asset packs that are available to download.
    ///
    /// This class applies only when you want to manage your asset packs manually. Don’t use this class if you want to opt in to automatic management of asset packs.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/baassetpackmanifest?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct BAAssetPackManifest;
);

unsafe impl Send for BAAssetPackManifest {}

unsafe impl Sync for BAAssetPackManifest {}

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

impl BAAssetPackManifest {
    extern_methods!(
        #[cfg(feature = "BAAssetPack")]
        /// The asset packs that are available to download.
        #[unsafe(method(assetPacks))]
        #[unsafe(method_family = none)]
        pub unsafe fn assetPacks(&self) -> Retained<NSSet<BAAssetPack>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Initializes a representation of a manifest in memory given a URL to the manifest’s representation as a JSON file on disk.
        /// - Parameters:
        /// - URL: A URL to a local JSON file.
        /// - applicationGroupIdentifier: The identifier of the application group in which to store unmanaged asset packs that are downloaded from the manifest.
        /// - error: A pointer to an error that will be set if an error occurs.
        #[unsafe(method(initWithContentsOfURL:applicationGroupIdentifier:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfURL_applicationGroupIdentifier_error(
            this: Allocated<Self>,
            url: &NSURL,
            application_group_identifier: &NSString,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        /// Initializes a representation of a manifest in memory from JSON-encoded data.
        /// - Parameters:
        /// - data: JSON-encoded data.
        /// - applicationGroupIdentifier: The identifier of the application group in which to store unmanaged asset packs that are downloaded from the manifest.
        /// - error: A pointer to an error that will be set if an error occurs.
        #[unsafe(method(initFromData:applicationGroupIdentifier:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initFromData_applicationGroupIdentifier_error(
            this: Allocated<Self>,
            data: &NSData,
            application_group_identifier: &NSString,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "BADownload")]
        /// Creates download objects for every asset pack in this manifest.
        ///
        /// The returned download objects can be scheduled with the download manager.
        /// - Returns: A collection of download objects.
        /// - Remark: Use this method in your main app; use `-allDownloadsForContentRequest:` in your downloader extension.
        #[unsafe(method(allDownloads))]
        #[unsafe(method_family = none)]
        pub unsafe fn allDownloads(&self) -> Retained<NSSet<BADownload>>;

        #[cfg(all(feature = "BADownload", feature = "BATypes"))]
        /// Creates download objects for every asset pack in this manifest.
        ///
        /// The returned download objects can be scheduled with the download manager.
        /// - Parameter contentRequest: The content request for the current extension invocation.
        /// - Returns: A collection of download objects.
        /// - Remark: Use this method in your downloader extension; use `-allDownloads` instead in your main app.
        #[unsafe(method(allDownloadsForContentRequest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn allDownloadsForContentRequest(
            &self,
            content_request: BAContentRequest,
        ) -> Retained<NSSet<BADownload>>;
    );
}