objc2-photos 0.3.2

Bindings to the Photos/PhotoKit 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_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phassetcollectionchangerequest?language=objc)
    #[unsafe(super(PHChangeRequest, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PHChangeRequest")]
    pub struct PHAssetCollectionChangeRequest;
);

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

#[cfg(feature = "PHChangeRequest")]
impl PHAssetCollectionChangeRequest {
    extern_methods!(
        #[unsafe(method(creationRequestForAssetCollectionWithTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn creationRequestForAssetCollectionWithTitle(
            title: &NSString,
        ) -> Retained<Self>;

        #[cfg(feature = "PHObject")]
        #[unsafe(method(placeholderForCreatedAssetCollection))]
        #[unsafe(method_family = none)]
        pub unsafe fn placeholderForCreatedAssetCollection(&self) -> Retained<PHObjectPlaceholder>;

        /// # Safety
        ///
        /// `asset_collections` should be of the correct type.
        #[unsafe(method(deleteAssetCollections:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteAssetCollections(
            asset_collections: &ProtocolObject<dyn NSFastEnumeration>,
        );

        #[cfg(all(feature = "PHCollection", feature = "PHObject"))]
        #[unsafe(method(changeRequestForAssetCollection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn changeRequestForAssetCollection(
            asset_collection: &PHAssetCollection,
        ) -> Option<Retained<Self>>;

        #[cfg(all(
            feature = "PHAsset",
            feature = "PHCollection",
            feature = "PHFetchResult",
            feature = "PHObject"
        ))]
        #[unsafe(method(changeRequestForAssetCollection:assets:))]
        #[unsafe(method_family = none)]
        pub unsafe fn changeRequestForAssetCollection_assets(
            asset_collection: &PHAssetCollection,
            assets: Option<&PHFetchResult<PHAsset>>,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> Retained<NSString>;

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

        /// # Safety
        ///
        /// `assets` should be of the correct type.
        #[unsafe(method(addAssets:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addAssets(&self, assets: &ProtocolObject<dyn NSFastEnumeration>);

        /// # Safety
        ///
        /// `assets` should be of the correct type.
        #[unsafe(method(insertAssets:atIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertAssets_atIndexes(
            &self,
            assets: &ProtocolObject<dyn NSFastEnumeration>,
            indexes: &NSIndexSet,
        );

        /// # Safety
        ///
        /// `assets` should be of the correct type.
        #[unsafe(method(removeAssets:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAssets(&self, assets: &ProtocolObject<dyn NSFastEnumeration>);

        #[unsafe(method(removeAssetsAtIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAssetsAtIndexes(&self, indexes: &NSIndexSet);

        /// # Safety
        ///
        /// `assets` should be of the correct type.
        #[unsafe(method(replaceAssetsAtIndexes:withAssets:))]
        #[unsafe(method_family = none)]
        pub unsafe fn replaceAssetsAtIndexes_withAssets(
            &self,
            indexes: &NSIndexSet,
            assets: &ProtocolObject<dyn NSFastEnumeration>,
        );

        #[unsafe(method(moveAssetsAtIndexes:toIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn moveAssetsAtIndexes_toIndex(
            &self,
            from_indexes: &NSIndexSet,
            to_index: NSUInteger,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "PHChangeRequest")]
impl PHAssetCollectionChangeRequest {
    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>;
    );
}