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::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-uniform-type-identifiers")]
use objc2_uniform_type_identifiers::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phasset?language=objc)
    #[unsafe(super(PHObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PHObject")]
    pub struct PHAsset;
);

#[cfg(feature = "PHObject")]
unsafe impl Send for PHAsset {}

#[cfg(feature = "PHObject")]
unsafe impl Sync for PHAsset {}

#[cfg(feature = "PHObject")]
extern_conformance!(
    unsafe impl NSCopying for PHAsset {}
);

#[cfg(feature = "PHObject")]
unsafe impl CopyingHelper for PHAsset {
    type Result = Self;
}

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

#[cfg(feature = "PHObject")]
impl PHAsset {
    extern_methods!(
        #[cfg(feature = "PhotosTypes")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(playbackStyle))]
        #[unsafe(method_family = none)]
        pub unsafe fn playbackStyle(&self) -> PHAssetPlaybackStyle;

        #[cfg(feature = "PhotosTypes")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(mediaType))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaType(&self) -> PHAssetMediaType;

        #[cfg(feature = "PhotosTypes")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(mediaSubtypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaSubtypes(&self) -> PHAssetMediaSubtype;

        #[cfg(feature = "objc2-uniform-type-identifiers")]
        /// The type of image or video data that is presented for the asset
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(contentType))]
        #[unsafe(method_family = none)]
        pub unsafe fn contentType(&self) -> Retained<UTType>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(pixelWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn pixelWidth(&self) -> NSUInteger;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(pixelHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn pixelHeight(&self) -> NSUInteger;

        /// The date and time of this asset's creation (can be updated by the user)
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(creationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;

        /// The date and time of the last modification to this asset or one of its properties
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(modificationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;

        /// The date and time this asset was added to the photo library (from the device that was used to add this asset)
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(addedDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn addedDate(&self) -> Retained<NSDate>;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(location))]
        #[unsafe(method_family = none)]
        pub unsafe fn location(&self) -> Option<Retained<CLLocation>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isHidden))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHidden(&self) -> bool;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isFavorite))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFavorite(&self) -> bool;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "No longer supported"]
        #[unsafe(method(isSyncFailureHidden))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSyncFailureHidden(&self) -> bool;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(burstIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn burstIdentifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "PhotosTypes")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(burstSelectionTypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn burstSelectionTypes(&self) -> PHAssetBurstSelectionType;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(representsBurst))]
        #[unsafe(method_family = none)]
        pub unsafe fn representsBurst(&self) -> bool;

        #[cfg(feature = "PhotosTypes")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(sourceType))]
        #[unsafe(method_family = none)]
        pub unsafe fn sourceType(&self) -> PHAssetSourceType;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(hasAdjustments))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasAdjustments(&self) -> bool;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(adjustmentFormatIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn adjustmentFormatIdentifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "PhotosTypes")]
        #[unsafe(method(canPerformEditOperation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn canPerformEditOperation(&self, edit_operation: PHAssetEditOperation) -> bool;

        #[cfg(all(
            feature = "PHCollection",
            feature = "PHFetchOptions",
            feature = "PHFetchResult"
        ))]
        #[unsafe(method(fetchAssetsInAssetCollection:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsInAssetCollection_options(
            asset_collection: &PHAssetCollection,
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;

        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
        #[unsafe(method(fetchAssetsWithLocalIdentifiers:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsWithLocalIdentifiers_options(
            identifiers: &NSArray<NSString>,
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;

        #[cfg(all(
            feature = "PHCollection",
            feature = "PHFetchOptions",
            feature = "PHFetchResult"
        ))]
        #[unsafe(method(fetchKeyAssetsInAssetCollection:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchKeyAssetsInAssetCollection_options(
            asset_collection: &PHAssetCollection,
            options: Option<&PHFetchOptions>,
        ) -> Option<Retained<PHFetchResult<PHAsset>>>;

        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
        #[unsafe(method(fetchAssetsWithBurstIdentifier:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsWithBurstIdentifier_options(
            burst_identifier: &NSString,
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;

        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
        #[unsafe(method(fetchAssetsWithOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsWithOptions(
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;

        #[cfg(all(
            feature = "PHFetchOptions",
            feature = "PHFetchResult",
            feature = "PhotosTypes"
        ))]
        #[unsafe(method(fetchAssetsWithMediaType:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsWithMediaType_options(
            media_type: PHAssetMediaType,
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;

        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
        #[deprecated = "Will be removed in a future release"]
        #[unsafe(method(fetchAssetsWithALAssetURLs:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAssetsWithALAssetURLs_options(
            asset_ur_ls: &NSArray<NSURL>,
            options: Option<&PHFetchOptions>,
        ) -> Retained<PHFetchResult<PHAsset>>;
    );
}

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