objc2_contacts/generated/
CNContactFetchRequest.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Specifies the search criteria to fetch contacts.
12    ///
13    ///
14    /// Used with [CNContactStore enumerateContactsWithFetchRequest:error:usingBlock:]. Can combine any of these options to create a contact fetch request.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/contacts/cncontactfetchrequest?language=objc)
17    #[unsafe(super(CNFetchRequest, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(feature = "CNFetchRequest")]
20    pub struct CNContactFetchRequest;
21);
22
23#[cfg(feature = "CNFetchRequest")]
24extern_conformance!(
25    unsafe impl NSCoding for CNContactFetchRequest {}
26);
27
28#[cfg(feature = "CNFetchRequest")]
29extern_conformance!(
30    unsafe impl NSObjectProtocol for CNContactFetchRequest {}
31);
32
33#[cfg(feature = "CNFetchRequest")]
34extern_conformance!(
35    unsafe impl NSSecureCoding for CNContactFetchRequest {}
36);
37
38#[cfg(feature = "CNFetchRequest")]
39impl CNContactFetchRequest {
40    extern_methods!(
41        #[unsafe(method(init))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
44
45        #[unsafe(method(new))]
46        #[unsafe(method_family = new)]
47        pub unsafe fn new() -> Retained<Self>;
48
49        #[cfg(feature = "CNContact")]
50        /// Parameter `keysToFetch`: The properties to fetch for the returned contacts.
51        ///
52        ///
53        /// Only fetch the properties that will be used.
54        #[unsafe(method(initWithKeysToFetch:))]
55        #[unsafe(method_family = init)]
56        pub unsafe fn initWithKeysToFetch(
57            this: Allocated<Self>,
58            keys_to_fetch: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
59        ) -> Retained<Self>;
60
61        /// The predicate to match contacts against.
62        ///
63        ///
64        /// Use only predicates from CNContact+Predicates.h. Compound predicates are not supported. Set to nil to match all contacts.
65        #[unsafe(method(predicate))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;
68
69        /// Setter for [`predicate`][Self::predicate].
70        ///
71        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
72        #[unsafe(method(setPredicate:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
75
76        #[cfg(feature = "CNContact")]
77        /// The properties to fetch in the returned contacts.
78        ///
79        ///
80        /// Should only fetch the properties that will be used. Can combine contact keys and contact key descriptors.
81        #[unsafe(method(keysToFetch))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn keysToFetch(&self) -> Retained<NSArray<ProtocolObject<dyn CNKeyDescriptor>>>;
84
85        #[cfg(feature = "CNContact")]
86        /// Setter for [`keysToFetch`][Self::keysToFetch].
87        ///
88        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
89        #[unsafe(method(setKeysToFetch:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setKeysToFetch(
92            &self,
93            keys_to_fetch: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
94        );
95
96        /// To return mutable contacts.
97        ///
98        ///
99        /// If YES returns CNMutableContact objects, otherwise returns CNContact objects. Default is NO.
100        #[unsafe(method(mutableObjects))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn mutableObjects(&self) -> bool;
103
104        /// Setter for [`mutableObjects`][Self::mutableObjects].
105        #[unsafe(method(setMutableObjects:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setMutableObjects(&self, mutable_objects: bool);
108
109        /// To return linked contacts as unified contacts.
110        ///
111        ///
112        /// If YES returns unified contacts, otherwise returns individual contacts. Default is YES.
113        ///
114        ///
115        /// 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.
116        #[unsafe(method(unifyResults))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn unifyResults(&self) -> bool;
119
120        /// Setter for [`unifyResults`][Self::unifyResults].
121        #[unsafe(method(setUnifyResults:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setUnifyResults(&self, unify_results: bool);
124
125        #[cfg(feature = "CNContact")]
126        /// To return contacts in a specific sort order.
127        ///
128        ///
129        /// Default is CNContactSortOrderNone.
130        #[unsafe(method(sortOrder))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn sortOrder(&self) -> CNContactSortOrder;
133
134        #[cfg(feature = "CNContact")]
135        /// Setter for [`sortOrder`][Self::sortOrder].
136        #[unsafe(method(setSortOrder:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setSortOrder(&self, sort_order: CNContactSortOrder);
139    );
140}