objc2_contacts/generated/
CNContact.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct CNContactType(pub NSInteger);
14impl CNContactType {
15 #[doc(alias = "CNContactTypePerson")]
16 pub const Person: Self = Self(0);
17 #[doc(alias = "CNContactTypeOrganization")]
18 pub const Organization: Self = Self(1);
19}
20
21unsafe impl Encode for CNContactType {
22 const ENCODING: Encoding = NSInteger::ENCODING;
23}
24
25unsafe impl RefEncode for CNContactType {
26 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
27}
28
29#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct CNContactSortOrder(pub NSInteger);
39impl CNContactSortOrder {
40 #[doc(alias = "CNContactSortOrderNone")]
41 pub const None: Self = Self(0);
42 #[doc(alias = "CNContactSortOrderUserDefault")]
43 pub const UserDefault: Self = Self(1);
44 #[doc(alias = "CNContactSortOrderGivenName")]
45 pub const GivenName: Self = Self(2);
46 #[doc(alias = "CNContactSortOrderFamilyName")]
47 pub const FamilyName: Self = Self(3);
48}
49
50unsafe impl Encode for CNContactSortOrder {
51 const ENCODING: Encoding = NSInteger::ENCODING;
52}
53
54unsafe impl RefEncode for CNContactSortOrder {
55 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_protocol!(
59 pub unsafe trait CNKeyDescriptor: NSObjectProtocol + NSSecureCoding + NSCopying {}
63);
64
65extern_conformance!(
66 unsafe impl CNKeyDescriptor for NSString {}
67);
68
69extern_class!(
70 #[unsafe(super(NSObject))]
79 #[derive(Debug, PartialEq, Eq, Hash)]
80 pub struct CNContact;
81);
82
83extern_conformance!(
84 unsafe impl NSCoding for CNContact {}
85);
86
87extern_conformance!(
88 unsafe impl NSCopying for CNContact {}
89);
90
91unsafe impl CopyingHelper for CNContact {
92 type Result = Self;
93}
94
95extern_conformance!(
96 unsafe impl NSMutableCopying for CNContact {}
97);
98
99#[cfg(feature = "CNMutableContact")]
100unsafe impl MutableCopyingHelper for CNContact {
101 type Result = CNMutableContact;
102}
103
104extern_conformance!(
105 unsafe impl NSObjectProtocol for CNContact {}
106);
107
108extern_conformance!(
109 unsafe impl NSSecureCoding for CNContact {}
110);
111
112impl CNContact {
113 extern_methods!(
114 #[unsafe(method(identifier))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn identifier(&self) -> Retained<NSString>;
118
119 #[unsafe(method(contactType))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn contactType(&self) -> CNContactType;
122
123 #[unsafe(method(namePrefix))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn namePrefix(&self) -> Retained<NSString>;
126
127 #[unsafe(method(givenName))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn givenName(&self) -> Retained<NSString>;
130
131 #[unsafe(method(middleName))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn middleName(&self) -> Retained<NSString>;
134
135 #[unsafe(method(familyName))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn familyName(&self) -> Retained<NSString>;
138
139 #[unsafe(method(previousFamilyName))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn previousFamilyName(&self) -> Retained<NSString>;
142
143 #[unsafe(method(nameSuffix))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn nameSuffix(&self) -> Retained<NSString>;
146
147 #[unsafe(method(nickname))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn nickname(&self) -> Retained<NSString>;
150
151 #[unsafe(method(organizationName))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn organizationName(&self) -> Retained<NSString>;
154
155 #[unsafe(method(departmentName))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn departmentName(&self) -> Retained<NSString>;
158
159 #[unsafe(method(jobTitle))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn jobTitle(&self) -> Retained<NSString>;
162
163 #[unsafe(method(phoneticGivenName))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn phoneticGivenName(&self) -> Retained<NSString>;
166
167 #[unsafe(method(phoneticMiddleName))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn phoneticMiddleName(&self) -> Retained<NSString>;
170
171 #[unsafe(method(phoneticFamilyName))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn phoneticFamilyName(&self) -> Retained<NSString>;
174
175 #[unsafe(method(phoneticOrganizationName))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn phoneticOrganizationName(&self) -> Retained<NSString>;
178
179 #[unsafe(method(note))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn note(&self) -> Retained<NSString>;
182
183 #[unsafe(method(imageData))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn imageData(&self) -> Option<Retained<NSData>>;
186
187 #[unsafe(method(thumbnailImageData))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn thumbnailImageData(&self) -> Option<Retained<NSData>>;
190
191 #[unsafe(method(imageDataAvailable))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn imageDataAvailable(&self) -> bool;
194
195 #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
196 #[unsafe(method(phoneNumbers))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn phoneNumbers(&self) -> Retained<NSArray<CNLabeledValue<CNPhoneNumber>>>;
199
200 #[cfg(feature = "CNLabeledValue")]
201 #[unsafe(method(emailAddresses))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn emailAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
204
205 #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
206 #[unsafe(method(postalAddresses))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn postalAddresses(&self) -> Retained<NSArray<CNLabeledValue<CNPostalAddress>>>;
209
210 #[cfg(feature = "CNLabeledValue")]
211 #[unsafe(method(urlAddresses))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn urlAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
214
215 #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
216 #[unsafe(method(contactRelations))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn contactRelations(
219 &self,
220 ) -> Retained<NSArray<CNLabeledValue<CNContactRelation>>>;
221
222 #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
223 #[unsafe(method(socialProfiles))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn socialProfiles(&self) -> Retained<NSArray<CNLabeledValue<CNSocialProfile>>>;
226
227 #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
228 #[unsafe(method(instantMessageAddresses))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn instantMessageAddresses(
231 &self,
232 ) -> Retained<NSArray<CNLabeledValue<CNInstantMessageAddress>>>;
233
234 #[unsafe(method(birthday))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn birthday(&self) -> Option<Retained<NSDateComponents>>;
238
239 #[unsafe(method(nonGregorianBirthday))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn nonGregorianBirthday(&self) -> Option<Retained<NSDateComponents>>;
243
244 #[cfg(feature = "CNLabeledValue")]
245 #[unsafe(method(dates))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn dates(&self) -> Retained<NSArray<CNLabeledValue<NSDateComponents>>>;
249
250 #[unsafe(method(isKeyAvailable:))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn isKeyAvailable(&self, key: &NSString) -> bool;
254
255 #[unsafe(method(areKeysAvailable:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn areKeysAvailable(
259 &self,
260 key_descriptors: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
261 ) -> bool;
262
263 #[unsafe(method(localizedStringForKey:))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn localizedStringForKey(key: &NSString) -> Retained<NSString>;
267
268 #[unsafe(method(comparatorForNameSortOrder:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn comparatorForNameSortOrder(sort_order: CNContactSortOrder) -> NSComparator;
277
278 #[unsafe(method(descriptorForAllComparatorKeys))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn descriptorForAllComparatorKeys(
282 ) -> Retained<ProtocolObject<dyn CNKeyDescriptor>>;
283
284 #[unsafe(method(isUnifiedWithContactWithIdentifier:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn isUnifiedWithContactWithIdentifier(
288 &self,
289 contact_identifier: &NSString,
290 ) -> bool;
291 );
292}
293
294impl CNContact {
296 extern_methods!(
297 #[unsafe(method(init))]
298 #[unsafe(method_family = init)]
299 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
300
301 #[unsafe(method(new))]
302 #[unsafe(method_family = new)]
303 pub unsafe fn new() -> Retained<Self>;
304 );
305}
306
307extern "C" {
308 pub static CNContactPropertyNotFetchedExceptionName: &'static NSString;
310}
311
312extern "C" {
313 pub static CNContactIdentifierKey: &'static NSString;
315}
316
317extern "C" {
318 pub static CNContactNamePrefixKey: &'static NSString;
320}
321
322extern "C" {
323 pub static CNContactGivenNameKey: &'static NSString;
325}
326
327extern "C" {
328 pub static CNContactMiddleNameKey: &'static NSString;
330}
331
332extern "C" {
333 pub static CNContactFamilyNameKey: &'static NSString;
335}
336
337extern "C" {
338 pub static CNContactPreviousFamilyNameKey: &'static NSString;
340}
341
342extern "C" {
343 pub static CNContactNameSuffixKey: &'static NSString;
345}
346
347extern "C" {
348 pub static CNContactNicknameKey: &'static NSString;
350}
351
352extern "C" {
353 pub static CNContactOrganizationNameKey: &'static NSString;
355}
356
357extern "C" {
358 pub static CNContactDepartmentNameKey: &'static NSString;
360}
361
362extern "C" {
363 pub static CNContactJobTitleKey: &'static NSString;
365}
366
367extern "C" {
368 pub static CNContactPhoneticGivenNameKey: &'static NSString;
370}
371
372extern "C" {
373 pub static CNContactPhoneticMiddleNameKey: &'static NSString;
375}
376
377extern "C" {
378 pub static CNContactPhoneticFamilyNameKey: &'static NSString;
380}
381
382extern "C" {
383 pub static CNContactPhoneticOrganizationNameKey: &'static NSString;
385}
386
387extern "C" {
388 pub static CNContactBirthdayKey: &'static NSString;
390}
391
392extern "C" {
393 pub static CNContactNonGregorianBirthdayKey: &'static NSString;
395}
396
397extern "C" {
398 pub static CNContactNoteKey: &'static NSString;
400}
401
402extern "C" {
403 pub static CNContactImageDataKey: &'static NSString;
405}
406
407extern "C" {
408 pub static CNContactThumbnailImageDataKey: &'static NSString;
410}
411
412extern "C" {
413 pub static CNContactImageDataAvailableKey: &'static NSString;
415}
416
417extern "C" {
418 pub static CNContactTypeKey: &'static NSString;
420}
421
422extern "C" {
423 pub static CNContactPhoneNumbersKey: &'static NSString;
425}
426
427extern "C" {
428 pub static CNContactEmailAddressesKey: &'static NSString;
430}
431
432extern "C" {
433 pub static CNContactPostalAddressesKey: &'static NSString;
435}
436
437extern "C" {
438 pub static CNContactDatesKey: &'static NSString;
440}
441
442extern "C" {
443 pub static CNContactUrlAddressesKey: &'static NSString;
445}
446
447extern "C" {
448 pub static CNContactRelationsKey: &'static NSString;
450}
451
452extern "C" {
453 pub static CNContactSocialProfilesKey: &'static NSString;
455}
456
457extern "C" {
458 pub static CNContactInstantMessageAddressesKey: &'static NSString;
460}