objc2-cloud-kit 0.3.2

Bindings to the CloudKit 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/cloudkit/ckacceptsharesoperation?language=objc)
    #[unsafe(super(CKOperation, NSOperation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CKOperation")]
    pub struct CKAcceptSharesOperation;
);

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

#[cfg(feature = "CKOperation")]
impl CKAcceptSharesOperation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "CKShareMetadata")]
        #[unsafe(method(initWithShareMetadatas:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithShareMetadatas(
            this: Allocated<Self>,
            share_metadatas: &NSArray<CKShareMetadata>,
        ) -> Retained<Self>;

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

        #[cfg(feature = "CKShareMetadata")]
        /// Setter for [`shareMetadatas`][Self::shareMetadatas].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setShareMetadatas:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShareMetadatas(&self, share_metadatas: Option<&NSArray<CKShareMetadata>>);

        #[cfg(all(
            feature = "CKRecord",
            feature = "CKShare",
            feature = "CKShareMetadata",
            feature = "block2"
        ))]
        /// Called once for each share metadata that the server processed
        ///
        ///
        /// If error is nil then the share was successfully accepted.
        /// Each
        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
        /// should not be concurrently used outside of blocks assigned to this operation.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 2 must be a valid pointer or null.
        /// - The returned block's argument 3 must be a valid pointer or null.
        /// - This might not be thread-safe.
        #[unsafe(method(perShareCompletionBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn perShareCompletionBlock(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKShareMetadata>, *mut CKShare, *mut NSError)>;

        #[cfg(all(
            feature = "CKRecord",
            feature = "CKShare",
            feature = "CKShareMetadata",
            feature = "block2"
        ))]
        /// Setter for [`perShareCompletionBlock`][Self::perShareCompletionBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setPerShareCompletionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPerShareCompletionBlock(
            &self,
            per_share_completion_block: Option<
                &block2::DynBlock<dyn Fn(NonNull<CKShareMetadata>, *mut CKShare, *mut NSError)>,
            >,
        );

        #[cfg(feature = "block2")]
        /// This block is called when the operation completes.
        ///
        ///
        /// The
        ///
        /// ```text
        ///  -[NSOperation completionBlock]
        /// ```
        ///
        /// will also be called if both are set.
        /// If the error is
        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of shareURLs to errors keyed off of
        /// `CKPartialErrorsByItemIDKey.`These errors are repeats of those sent back in previous
        /// `perShareCompletionBlock`invocations
        /// Each
        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
        /// should not be concurrently used outside of blocks assigned to this operation.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - The returned block's argument must be a valid pointer or null.
        /// - This might not be thread-safe.
        #[unsafe(method(acceptSharesCompletionBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn acceptSharesCompletionBlock(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(*mut NSError)>;

        #[cfg(feature = "block2")]
        /// Setter for [`acceptSharesCompletionBlock`][Self::acceptSharesCompletionBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setAcceptSharesCompletionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAcceptSharesCompletionBlock(
            &self,
            accept_shares_completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CKOperation")]
impl CKAcceptSharesOperation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}