objc2-contacts 0.3.2

Bindings to the Contacts 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!(
    /// Specifies the criteria to fetch change history.
    ///
    ///
    /// Changes to contacts are always returned.
    /// All changes are coalesced to remove redundant adds, updates and deletes.
    /// This request is used with [CNContactStore enumeratorForChangeHistoryFetchRequest:error:].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/contacts/cnchangehistoryfetchrequest?language=objc)
    #[unsafe(super(CNFetchRequest, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CNFetchRequest")]
    pub struct CNChangeHistoryFetchRequest;
);

#[cfg(feature = "CNFetchRequest")]
extern_conformance!(
    unsafe impl NSCoding for CNChangeHistoryFetchRequest {}
);

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

#[cfg(feature = "CNFetchRequest")]
extern_conformance!(
    unsafe impl NSSecureCoding for CNChangeHistoryFetchRequest {}
);

#[cfg(feature = "CNFetchRequest")]
impl CNChangeHistoryFetchRequest {
    extern_methods!(
        /// Request changes made after a certain point.
        ///
        ///
        /// If non-nil, only changes made after this point in history will be returned.
        ///
        /// If nil, a
        /// `CNChangeHistoryDropEverythingEvent`will be returned, followed by an add event
        /// for every contact and group currently in the contacts database.
        #[unsafe(method(startingToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn startingToken(&self) -> Option<Retained<NSData>>;

        /// Setter for [`startingToken`][Self::startingToken].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setStartingToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setStartingToken(&self, starting_token: Option<&NSData>);

        #[cfg(feature = "CNContact")]
        /// Additional keys to include in the fetched contacts.
        ///
        ///
        /// By default, only
        /// `CNContactIdentifierKey`will be fetched. If you
        /// would like to include additional key descriptors to process the contacts,
        /// include the key descriptors you need.
        ///
        /// `CNContactIdentifierKey`will always be fetched, whether you
        /// request it or not.
        #[unsafe(method(additionalContactKeyDescriptors))]
        #[unsafe(method_family = none)]
        pub unsafe fn additionalContactKeyDescriptors(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn CNKeyDescriptor>>>>;

        #[cfg(feature = "CNContact")]
        /// Setter for [`additionalContactKeyDescriptors`][Self::additionalContactKeyDescriptors].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAdditionalContactKeyDescriptors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAdditionalContactKeyDescriptors(
            &self,
            additional_contact_key_descriptors: Option<
                &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
            >,
        );

        /// Returns contact changes as unified contacts.
        ///
        ///
        /// If
        /// `YES,`returns unified contact history. Otherwise returns individual contact history. Default is
        /// `YES.`
        ///
        /// Note: A unified contact is the aggregation of properties from a set of linked individual contacts.
        /// If an individual contact is not linked then the unified contact is simply that individual contact.
        #[unsafe(method(shouldUnifyResults))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldUnifyResults(&self) -> bool;

        /// Setter for [`shouldUnifyResults`][Self::shouldUnifyResults].
        #[unsafe(method(setShouldUnifyResults:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldUnifyResults(&self, should_unify_results: bool);

        /// To return mutable contacts and groups.
        ///
        ///
        /// If
        /// `YES`returns mutable contacts and groups. Default is
        /// `NO.`
        #[unsafe(method(mutableObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn mutableObjects(&self) -> bool;

        /// Setter for [`mutableObjects`][Self::mutableObjects].
        #[unsafe(method(setMutableObjects:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMutableObjects(&self, mutable_objects: bool);

        /// Set to
        /// `YES`to also fetch group changes. Default is
        /// `NO.`
        #[unsafe(method(includeGroupChanges))]
        #[unsafe(method_family = none)]
        pub unsafe fn includeGroupChanges(&self) -> bool;

        /// Setter for [`includeGroupChanges`][Self::includeGroupChanges].
        #[unsafe(method(setIncludeGroupChanges:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIncludeGroupChanges(&self, include_group_changes: bool);

        /// Exclude changes made by certain authors.
        ///
        ///
        /// If set, transactions made by the specified authors will be excluded
        /// from the results. Use this, in conjunction with
        /// `CNSaveRequest.transactionAuthor,`to suppress processing of changes you already know about.
        #[unsafe(method(excludedTransactionAuthors))]
        #[unsafe(method_family = none)]
        pub unsafe fn excludedTransactionAuthors(&self) -> Option<Retained<NSArray<NSString>>>;

        /// Setter for [`excludedTransactionAuthors`][Self::excludedTransactionAuthors].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setExcludedTransactionAuthors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExcludedTransactionAuthors(
            &self,
            excluded_transaction_authors: Option<&NSArray<NSString>>,
        );
    );
}

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