objc2_contacts/generated/
CNMutableContact.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    /// A mutable value object representing a contact.
12    ///
13    ///
14    /// CNMutableContact is not thread safe. If this is a mutable copy of CNContact then it will throw CNContactPropertyNotFetchedExceptionName when accessing a property that was not fetched for the CNContact.
15    ///
16    ///
17    /// Note: To remove properties when saving a mutable contact, set string properties and array properties to empty values. Set other properties to nil.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/contacts/cnmutablecontact?language=objc)
20    #[unsafe(super(CNContact, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "CNContact")]
23    pub struct CNMutableContact;
24);
25
26#[cfg(feature = "CNContact")]
27extern_conformance!(
28    unsafe impl NSCoding for CNMutableContact {}
29);
30
31#[cfg(feature = "CNContact")]
32extern_conformance!(
33    unsafe impl NSCopying for CNMutableContact {}
34);
35
36#[cfg(feature = "CNContact")]
37unsafe impl CopyingHelper for CNMutableContact {
38    type Result = CNContact;
39}
40
41#[cfg(feature = "CNContact")]
42extern_conformance!(
43    unsafe impl NSMutableCopying for CNMutableContact {}
44);
45
46#[cfg(feature = "CNContact")]
47unsafe impl MutableCopyingHelper for CNMutableContact {
48    type Result = Self;
49}
50
51#[cfg(feature = "CNContact")]
52extern_conformance!(
53    unsafe impl NSObjectProtocol for CNMutableContact {}
54);
55
56#[cfg(feature = "CNContact")]
57extern_conformance!(
58    unsafe impl NSSecureCoding for CNMutableContact {}
59);
60
61#[cfg(feature = "CNContact")]
62impl CNMutableContact {
63    extern_methods!(
64        #[unsafe(method(contactType))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn contactType(&self) -> CNContactType;
67
68        /// Setter for [`contactType`][Self::contactType].
69        #[unsafe(method(setContactType:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setContactType(&self, contact_type: CNContactType);
72
73        #[unsafe(method(namePrefix))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn namePrefix(&self) -> Retained<NSString>;
76
77        /// Setter for [`namePrefix`][Self::namePrefix].
78        ///
79        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
80        #[unsafe(method(setNamePrefix:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setNamePrefix(&self, name_prefix: &NSString);
83
84        #[unsafe(method(givenName))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn givenName(&self) -> Retained<NSString>;
87
88        /// Setter for [`givenName`][Self::givenName].
89        ///
90        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
91        #[unsafe(method(setGivenName:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setGivenName(&self, given_name: &NSString);
94
95        #[unsafe(method(middleName))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn middleName(&self) -> Retained<NSString>;
98
99        /// Setter for [`middleName`][Self::middleName].
100        ///
101        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
102        #[unsafe(method(setMiddleName:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setMiddleName(&self, middle_name: &NSString);
105
106        #[unsafe(method(familyName))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn familyName(&self) -> Retained<NSString>;
109
110        /// Setter for [`familyName`][Self::familyName].
111        ///
112        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
113        #[unsafe(method(setFamilyName:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setFamilyName(&self, family_name: &NSString);
116
117        #[unsafe(method(previousFamilyName))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn previousFamilyName(&self) -> Retained<NSString>;
120
121        /// Setter for [`previousFamilyName`][Self::previousFamilyName].
122        ///
123        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
124        #[unsafe(method(setPreviousFamilyName:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setPreviousFamilyName(&self, previous_family_name: &NSString);
127
128        #[unsafe(method(nameSuffix))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn nameSuffix(&self) -> Retained<NSString>;
131
132        /// Setter for [`nameSuffix`][Self::nameSuffix].
133        ///
134        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
135        #[unsafe(method(setNameSuffix:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setNameSuffix(&self, name_suffix: &NSString);
138
139        #[unsafe(method(nickname))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn nickname(&self) -> Retained<NSString>;
142
143        /// Setter for [`nickname`][Self::nickname].
144        ///
145        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
146        #[unsafe(method(setNickname:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setNickname(&self, nickname: &NSString);
149
150        #[unsafe(method(organizationName))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn organizationName(&self) -> Retained<NSString>;
153
154        /// Setter for [`organizationName`][Self::organizationName].
155        ///
156        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
157        #[unsafe(method(setOrganizationName:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setOrganizationName(&self, organization_name: &NSString);
160
161        #[unsafe(method(departmentName))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn departmentName(&self) -> Retained<NSString>;
164
165        /// Setter for [`departmentName`][Self::departmentName].
166        ///
167        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
168        #[unsafe(method(setDepartmentName:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setDepartmentName(&self, department_name: &NSString);
171
172        #[unsafe(method(jobTitle))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn jobTitle(&self) -> Retained<NSString>;
175
176        /// Setter for [`jobTitle`][Self::jobTitle].
177        ///
178        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
179        #[unsafe(method(setJobTitle:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setJobTitle(&self, job_title: &NSString);
182
183        #[unsafe(method(phoneticGivenName))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn phoneticGivenName(&self) -> Retained<NSString>;
186
187        /// Setter for [`phoneticGivenName`][Self::phoneticGivenName].
188        ///
189        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
190        #[unsafe(method(setPhoneticGivenName:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setPhoneticGivenName(&self, phonetic_given_name: &NSString);
193
194        #[unsafe(method(phoneticMiddleName))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn phoneticMiddleName(&self) -> Retained<NSString>;
197
198        /// Setter for [`phoneticMiddleName`][Self::phoneticMiddleName].
199        ///
200        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
201        #[unsafe(method(setPhoneticMiddleName:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn setPhoneticMiddleName(&self, phonetic_middle_name: &NSString);
204
205        #[unsafe(method(phoneticFamilyName))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn phoneticFamilyName(&self) -> Retained<NSString>;
208
209        /// Setter for [`phoneticFamilyName`][Self::phoneticFamilyName].
210        ///
211        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
212        #[unsafe(method(setPhoneticFamilyName:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setPhoneticFamilyName(&self, phonetic_family_name: &NSString);
215
216        #[unsafe(method(phoneticOrganizationName))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn phoneticOrganizationName(&self) -> Retained<NSString>;
219
220        /// Setter for [`phoneticOrganizationName`][Self::phoneticOrganizationName].
221        ///
222        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
223        #[unsafe(method(setPhoneticOrganizationName:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setPhoneticOrganizationName(&self, phonetic_organization_name: &NSString);
226
227        #[unsafe(method(note))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn note(&self) -> Retained<NSString>;
230
231        /// Setter for [`note`][Self::note].
232        ///
233        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
234        #[unsafe(method(setNote:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setNote(&self, note: &NSString);
237
238        #[unsafe(method(imageData))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn imageData(&self) -> Option<Retained<NSData>>;
241
242        /// Setter for [`imageData`][Self::imageData].
243        ///
244        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
245        #[unsafe(method(setImageData:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn setImageData(&self, image_data: Option<&NSData>);
248
249        #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
250        #[unsafe(method(phoneNumbers))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn phoneNumbers(&self) -> Retained<NSArray<CNLabeledValue<CNPhoneNumber>>>;
253
254        #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
255        /// Setter for [`phoneNumbers`][Self::phoneNumbers].
256        ///
257        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
258        #[unsafe(method(setPhoneNumbers:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn setPhoneNumbers(
261            &self,
262            phone_numbers: &NSArray<CNLabeledValue<CNPhoneNumber>>,
263        );
264
265        #[cfg(feature = "CNLabeledValue")]
266        #[unsafe(method(emailAddresses))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn emailAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
269
270        #[cfg(feature = "CNLabeledValue")]
271        /// Setter for [`emailAddresses`][Self::emailAddresses].
272        ///
273        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
274        #[unsafe(method(setEmailAddresses:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn setEmailAddresses(&self, email_addresses: &NSArray<CNLabeledValue<NSString>>);
277
278        #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
279        #[unsafe(method(postalAddresses))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn postalAddresses(&self) -> Retained<NSArray<CNLabeledValue<CNPostalAddress>>>;
282
283        #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
284        /// Setter for [`postalAddresses`][Self::postalAddresses].
285        ///
286        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
287        #[unsafe(method(setPostalAddresses:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn setPostalAddresses(
290            &self,
291            postal_addresses: &NSArray<CNLabeledValue<CNPostalAddress>>,
292        );
293
294        #[cfg(feature = "CNLabeledValue")]
295        #[unsafe(method(urlAddresses))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn urlAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
298
299        #[cfg(feature = "CNLabeledValue")]
300        /// Setter for [`urlAddresses`][Self::urlAddresses].
301        ///
302        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
303        #[unsafe(method(setUrlAddresses:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn setUrlAddresses(&self, url_addresses: &NSArray<CNLabeledValue<NSString>>);
306
307        #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
308        #[unsafe(method(contactRelations))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn contactRelations(
311            &self,
312        ) -> Retained<NSArray<CNLabeledValue<CNContactRelation>>>;
313
314        #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
315        /// Setter for [`contactRelations`][Self::contactRelations].
316        ///
317        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
318        #[unsafe(method(setContactRelations:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn setContactRelations(
321            &self,
322            contact_relations: &NSArray<CNLabeledValue<CNContactRelation>>,
323        );
324
325        #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
326        #[unsafe(method(socialProfiles))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn socialProfiles(&self) -> Retained<NSArray<CNLabeledValue<CNSocialProfile>>>;
329
330        #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
331        /// Setter for [`socialProfiles`][Self::socialProfiles].
332        ///
333        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
334        #[unsafe(method(setSocialProfiles:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setSocialProfiles(
337            &self,
338            social_profiles: &NSArray<CNLabeledValue<CNSocialProfile>>,
339        );
340
341        #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
342        #[unsafe(method(instantMessageAddresses))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn instantMessageAddresses(
345            &self,
346        ) -> Retained<NSArray<CNLabeledValue<CNInstantMessageAddress>>>;
347
348        #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
349        /// Setter for [`instantMessageAddresses`][Self::instantMessageAddresses].
350        ///
351        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
352        #[unsafe(method(setInstantMessageAddresses:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn setInstantMessageAddresses(
355            &self,
356            instant_message_addresses: &NSArray<CNLabeledValue<CNInstantMessageAddress>>,
357        );
358
359        /// The Gregorian birthday.
360        ///
361        /// Only uses day, month and year components. Needs to have at least a day and a month.
362        #[unsafe(method(birthday))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn birthday(&self) -> Option<Retained<NSDateComponents>>;
365
366        /// Setter for [`birthday`][Self::birthday].
367        ///
368        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
369        #[unsafe(method(setBirthday:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn setBirthday(&self, birthday: Option<&NSDateComponents>);
372
373        /// The alternate birthday (Lunisolar).
374        ///
375        /// Only uses day, month, year and calendar components. Needs to have at least a day and a month. Calendar must be Chinese, Hebrew or Islamic.
376        #[unsafe(method(nonGregorianBirthday))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn nonGregorianBirthday(&self) -> Option<Retained<NSDateComponents>>;
379
380        /// Setter for [`nonGregorianBirthday`][Self::nonGregorianBirthday].
381        ///
382        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
383        #[unsafe(method(setNonGregorianBirthday:))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn setNonGregorianBirthday(
386            &self,
387            non_gregorian_birthday: Option<&NSDateComponents>,
388        );
389
390        #[cfg(feature = "CNLabeledValue")]
391        /// Other Gregorian dates (anniversaries, etc).
392        ///
393        /// Only uses day, month and year components. Needs to have at least a day and a month.
394        #[unsafe(method(dates))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn dates(&self) -> Retained<NSArray<CNLabeledValue<NSDateComponents>>>;
397
398        #[cfg(feature = "CNLabeledValue")]
399        /// Setter for [`dates`][Self::dates].
400        ///
401        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
402        #[unsafe(method(setDates:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn setDates(&self, dates: &NSArray<CNLabeledValue<NSDateComponents>>);
405    );
406}
407
408/// Methods declared on superclass `NSObject`.
409#[cfg(feature = "CNContact")]
410impl CNMutableContact {
411    extern_methods!(
412        #[unsafe(method(init))]
413        #[unsafe(method_family = init)]
414        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
415
416        #[unsafe(method(new))]
417        #[unsafe(method_family = new)]
418        pub unsafe fn new() -> Retained<Self>;
419    );
420}