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        #[unsafe(method(setNamePrefix:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setNamePrefix(&self, name_prefix: &NSString);
81
82        #[unsafe(method(givenName))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn givenName(&self) -> Retained<NSString>;
85
86        /// Setter for [`givenName`][Self::givenName].
87        #[unsafe(method(setGivenName:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setGivenName(&self, given_name: &NSString);
90
91        #[unsafe(method(middleName))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn middleName(&self) -> Retained<NSString>;
94
95        /// Setter for [`middleName`][Self::middleName].
96        #[unsafe(method(setMiddleName:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setMiddleName(&self, middle_name: &NSString);
99
100        #[unsafe(method(familyName))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn familyName(&self) -> Retained<NSString>;
103
104        /// Setter for [`familyName`][Self::familyName].
105        #[unsafe(method(setFamilyName:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setFamilyName(&self, family_name: &NSString);
108
109        #[unsafe(method(previousFamilyName))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn previousFamilyName(&self) -> Retained<NSString>;
112
113        /// Setter for [`previousFamilyName`][Self::previousFamilyName].
114        #[unsafe(method(setPreviousFamilyName:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setPreviousFamilyName(&self, previous_family_name: &NSString);
117
118        #[unsafe(method(nameSuffix))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn nameSuffix(&self) -> Retained<NSString>;
121
122        /// Setter for [`nameSuffix`][Self::nameSuffix].
123        #[unsafe(method(setNameSuffix:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setNameSuffix(&self, name_suffix: &NSString);
126
127        #[unsafe(method(nickname))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn nickname(&self) -> Retained<NSString>;
130
131        /// Setter for [`nickname`][Self::nickname].
132        #[unsafe(method(setNickname:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setNickname(&self, nickname: &NSString);
135
136        #[unsafe(method(organizationName))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn organizationName(&self) -> Retained<NSString>;
139
140        /// Setter for [`organizationName`][Self::organizationName].
141        #[unsafe(method(setOrganizationName:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setOrganizationName(&self, organization_name: &NSString);
144
145        #[unsafe(method(departmentName))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn departmentName(&self) -> Retained<NSString>;
148
149        /// Setter for [`departmentName`][Self::departmentName].
150        #[unsafe(method(setDepartmentName:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setDepartmentName(&self, department_name: &NSString);
153
154        #[unsafe(method(jobTitle))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn jobTitle(&self) -> Retained<NSString>;
157
158        /// Setter for [`jobTitle`][Self::jobTitle].
159        #[unsafe(method(setJobTitle:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setJobTitle(&self, job_title: &NSString);
162
163        #[unsafe(method(phoneticGivenName))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn phoneticGivenName(&self) -> Retained<NSString>;
166
167        /// Setter for [`phoneticGivenName`][Self::phoneticGivenName].
168        #[unsafe(method(setPhoneticGivenName:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setPhoneticGivenName(&self, phonetic_given_name: &NSString);
171
172        #[unsafe(method(phoneticMiddleName))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn phoneticMiddleName(&self) -> Retained<NSString>;
175
176        /// Setter for [`phoneticMiddleName`][Self::phoneticMiddleName].
177        #[unsafe(method(setPhoneticMiddleName:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setPhoneticMiddleName(&self, phonetic_middle_name: &NSString);
180
181        #[unsafe(method(phoneticFamilyName))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn phoneticFamilyName(&self) -> Retained<NSString>;
184
185        /// Setter for [`phoneticFamilyName`][Self::phoneticFamilyName].
186        #[unsafe(method(setPhoneticFamilyName:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setPhoneticFamilyName(&self, phonetic_family_name: &NSString);
189
190        #[unsafe(method(phoneticOrganizationName))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn phoneticOrganizationName(&self) -> Retained<NSString>;
193
194        /// Setter for [`phoneticOrganizationName`][Self::phoneticOrganizationName].
195        #[unsafe(method(setPhoneticOrganizationName:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn setPhoneticOrganizationName(&self, phonetic_organization_name: &NSString);
198
199        #[unsafe(method(note))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn note(&self) -> Retained<NSString>;
202
203        /// Setter for [`note`][Self::note].
204        #[unsafe(method(setNote:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setNote(&self, note: &NSString);
207
208        #[unsafe(method(imageData))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn imageData(&self) -> Option<Retained<NSData>>;
211
212        /// Setter for [`imageData`][Self::imageData].
213        #[unsafe(method(setImageData:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setImageData(&self, image_data: Option<&NSData>);
216
217        #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
218        #[unsafe(method(phoneNumbers))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn phoneNumbers(&self) -> Retained<NSArray<CNLabeledValue<CNPhoneNumber>>>;
221
222        #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
223        /// Setter for [`phoneNumbers`][Self::phoneNumbers].
224        #[unsafe(method(setPhoneNumbers:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setPhoneNumbers(
227            &self,
228            phone_numbers: &NSArray<CNLabeledValue<CNPhoneNumber>>,
229        );
230
231        #[cfg(feature = "CNLabeledValue")]
232        #[unsafe(method(emailAddresses))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn emailAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
235
236        #[cfg(feature = "CNLabeledValue")]
237        /// Setter for [`emailAddresses`][Self::emailAddresses].
238        #[unsafe(method(setEmailAddresses:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setEmailAddresses(&self, email_addresses: &NSArray<CNLabeledValue<NSString>>);
241
242        #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
243        #[unsafe(method(postalAddresses))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn postalAddresses(&self) -> Retained<NSArray<CNLabeledValue<CNPostalAddress>>>;
246
247        #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
248        /// Setter for [`postalAddresses`][Self::postalAddresses].
249        #[unsafe(method(setPostalAddresses:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn setPostalAddresses(
252            &self,
253            postal_addresses: &NSArray<CNLabeledValue<CNPostalAddress>>,
254        );
255
256        #[cfg(feature = "CNLabeledValue")]
257        #[unsafe(method(urlAddresses))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn urlAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
260
261        #[cfg(feature = "CNLabeledValue")]
262        /// Setter for [`urlAddresses`][Self::urlAddresses].
263        #[unsafe(method(setUrlAddresses:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn setUrlAddresses(&self, url_addresses: &NSArray<CNLabeledValue<NSString>>);
266
267        #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
268        #[unsafe(method(contactRelations))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn contactRelations(
271            &self,
272        ) -> Retained<NSArray<CNLabeledValue<CNContactRelation>>>;
273
274        #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
275        /// Setter for [`contactRelations`][Self::contactRelations].
276        #[unsafe(method(setContactRelations:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn setContactRelations(
279            &self,
280            contact_relations: &NSArray<CNLabeledValue<CNContactRelation>>,
281        );
282
283        #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
284        #[unsafe(method(socialProfiles))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn socialProfiles(&self) -> Retained<NSArray<CNLabeledValue<CNSocialProfile>>>;
287
288        #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
289        /// Setter for [`socialProfiles`][Self::socialProfiles].
290        #[unsafe(method(setSocialProfiles:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn setSocialProfiles(
293            &self,
294            social_profiles: &NSArray<CNLabeledValue<CNSocialProfile>>,
295        );
296
297        #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
298        #[unsafe(method(instantMessageAddresses))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn instantMessageAddresses(
301            &self,
302        ) -> Retained<NSArray<CNLabeledValue<CNInstantMessageAddress>>>;
303
304        #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
305        /// Setter for [`instantMessageAddresses`][Self::instantMessageAddresses].
306        #[unsafe(method(setInstantMessageAddresses:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn setInstantMessageAddresses(
309            &self,
310            instant_message_addresses: &NSArray<CNLabeledValue<CNInstantMessageAddress>>,
311        );
312
313        /// The Gregorian birthday.
314        ///
315        /// Only uses day, month and year components. Needs to have at least a day and a month.
316        #[unsafe(method(birthday))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn birthday(&self) -> Option<Retained<NSDateComponents>>;
319
320        /// Setter for [`birthday`][Self::birthday].
321        #[unsafe(method(setBirthday:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn setBirthday(&self, birthday: Option<&NSDateComponents>);
324
325        /// The alternate birthday (Lunisolar).
326        ///
327        /// 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.
328        #[unsafe(method(nonGregorianBirthday))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn nonGregorianBirthday(&self) -> Option<Retained<NSDateComponents>>;
331
332        /// Setter for [`nonGregorianBirthday`][Self::nonGregorianBirthday].
333        #[unsafe(method(setNonGregorianBirthday:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn setNonGregorianBirthday(
336            &self,
337            non_gregorian_birthday: Option<&NSDateComponents>,
338        );
339
340        #[cfg(feature = "CNLabeledValue")]
341        /// Other Gregorian dates (anniversaries, etc).
342        ///
343        /// Only uses day, month and year components. Needs to have at least a day and a month.
344        #[unsafe(method(dates))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn dates(&self) -> Retained<NSArray<CNLabeledValue<NSDateComponents>>>;
347
348        #[cfg(feature = "CNLabeledValue")]
349        /// Setter for [`dates`][Self::dates].
350        #[unsafe(method(setDates:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn setDates(&self, dates: &NSArray<CNLabeledValue<NSDateComponents>>);
353    );
354}
355
356/// Methods declared on superclass `NSObject`.
357#[cfg(feature = "CNContact")]
358impl CNMutableContact {
359    extern_methods!(
360        #[unsafe(method(init))]
361        #[unsafe(method_family = init)]
362        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
363
364        #[unsafe(method(new))]
365        #[unsafe(method_family = new)]
366        pub unsafe fn new() -> Retained<Self>;
367    );
368}