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