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        #[unsafe(method(setPredicate:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
73
74        #[cfg(feature = "CNContact")]
75        /// The properties to fetch in the returned contacts.
76        ///
77        ///
78        /// Should only fetch the properties that will be used. Can combine contact keys and contact key descriptors.
79        #[unsafe(method(keysToFetch))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn keysToFetch(&self) -> Retained<NSArray<ProtocolObject<dyn CNKeyDescriptor>>>;
82
83        #[cfg(feature = "CNContact")]
84        /// Setter for [`keysToFetch`][Self::keysToFetch].
85        #[unsafe(method(setKeysToFetch:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setKeysToFetch(
88            &self,
89            keys_to_fetch: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
90        );
91
92        /// To return mutable contacts.
93        ///
94        ///
95        /// If YES returns CNMutableContact objects, otherwise returns CNContact objects. Default is NO.
96        #[unsafe(method(mutableObjects))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn mutableObjects(&self) -> bool;
99
100        /// Setter for [`mutableObjects`][Self::mutableObjects].
101        #[unsafe(method(setMutableObjects:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setMutableObjects(&self, mutable_objects: bool);
104
105        /// To return linked contacts as unified contacts.
106        ///
107        ///
108        /// If YES returns unified contacts, otherwise returns individual contacts. Default is YES.
109        ///
110        ///
111        /// 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.
112        #[unsafe(method(unifyResults))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn unifyResults(&self) -> bool;
115
116        /// Setter for [`unifyResults`][Self::unifyResults].
117        #[unsafe(method(setUnifyResults:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setUnifyResults(&self, unify_results: bool);
120
121        #[cfg(feature = "CNContact")]
122        /// To return contacts in a specific sort order.
123        ///
124        ///
125        /// Default is CNContactSortOrderNone.
126        #[unsafe(method(sortOrder))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn sortOrder(&self) -> CNContactSortOrder;
129
130        #[cfg(feature = "CNContact")]
131        /// Setter for [`sortOrder`][Self::sortOrder].
132        #[unsafe(method(setSortOrder:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setSortOrder(&self, sort_order: CNContactSortOrder);
135    );
136}