objc2_event_kit/generated/
EKCalendarItem.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    /// [Apple's documentation](https://developer.apple.com/documentation/eventkit/ekcalendaritem?language=objc)
12    #[unsafe(super(EKObject, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "EKObject")]
15    pub struct EKCalendarItem;
16);
17
18#[cfg(feature = "EKObject")]
19extern_conformance!(
20    unsafe impl NSObjectProtocol for EKCalendarItem {}
21);
22
23#[cfg(feature = "EKObject")]
24impl EKCalendarItem {
25    extern_methods!(
26        /// This is now deprecated; use calendarItemIdentifier instead.
27        #[unsafe(method(UUID))]
28        #[unsafe(method_family = none)]
29        pub unsafe fn UUID(&self) -> Retained<NSString>;
30
31        #[cfg(feature = "EKCalendar")]
32        /// The calendar that this calendar item belongs to.
33        ///
34        /// This will be nil for new calendar items until you set it.
35        #[unsafe(method(calendar))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn calendar(&self) -> Option<Retained<EKCalendar>>;
38
39        #[cfg(feature = "EKCalendar")]
40        /// Setter for [`calendar`][Self::calendar].
41        ///
42        /// # Safety
43        ///
44        /// `calendar` might not allow `None`.
45        #[unsafe(method(setCalendar:))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn setCalendar(&self, calendar: Option<&EKCalendar>);
48
49        /// A unique identifier for a calendar item.
50        ///
51        /// Item identifiers are not sync-proof in that a full sync will lose
52        /// this identifier, so you should always have a back up plan for dealing
53        /// with a reminder that is no longer fetchable by this property, e.g. by title, etc.
54        /// Use [EKEventStore calendarItemWithIdentifier:] to look up the item by this value.
55        #[unsafe(method(calendarItemIdentifier))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn calendarItemIdentifier(&self) -> Retained<NSString>;
58
59        /// A server-provided identifier for this calendar item
60        ///
61        /// This identifier, provided by the server, allows you to reference the same event or reminder across
62        /// multiple devices. For calendars stored locally on the device, including the birthday calendar,
63        /// it simply passes through to calendarItemIdentifier.
64        ///
65        /// This identifier is unique as of creation for every calendar item.  However, there are some
66        /// cases where duplicate copies of a calendar item can exist in the same database, including:
67        /// - A calendar item was imported from an ICS file into multiple calendars
68        /// - An event was created in a calendar shared with the user and the user was also invited to the event
69        /// - The user is a delegate of a calendar that also has this event
70        /// - A subscribed calendar was added to multiple accounts
71        /// In such cases, you should choose between calendar items based on other factors, such as
72        /// the calendar or source.
73        ///
74        /// This identifier is the same for all occurrences of a recurring event. If you wish to differentiate
75        /// between occurrences, you may want to use the start date.
76        ///
77        /// This may be nil for new calendar items that do not yet belong to a calendar.
78        ///
79        /// In addition, there are two caveats for Exchange-based calendars:
80        /// - This identifier will be different between EventKit on iOS versus OS X
81        /// - This identifier will be different between devices for EKReminders
82        #[unsafe(method(calendarItemExternalIdentifier))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn calendarItemExternalIdentifier(&self) -> Option<Retained<NSString>>;
85
86        /// The title of this calendar item.
87        ///
88        /// This will be an empty string for new calendar items until you set it.
89        #[unsafe(method(title))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn title(&self) -> Retained<NSString>;
92
93        /// Setter for [`title`][Self::title].
94        ///
95        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
96        #[unsafe(method(setTitle:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setTitle(&self, title: Option<&NSString>);
99
100        #[unsafe(method(location))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn location(&self) -> Option<Retained<NSString>>;
103
104        /// Setter for [`location`][Self::location].
105        ///
106        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
107        #[unsafe(method(setLocation:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn setLocation(&self, location: Option<&NSString>);
110
111        #[unsafe(method(notes))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn notes(&self) -> Option<Retained<NSString>>;
114
115        /// Setter for [`notes`][Self::notes].
116        ///
117        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
118        #[unsafe(method(setNotes:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setNotes(&self, notes: Option<&NSString>);
121
122        #[unsafe(method(URL))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
125
126        /// Setter for [`URL`][Self::URL].
127        ///
128        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
129        #[unsafe(method(setURL:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setURL(&self, url: Option<&NSURL>);
132
133        #[unsafe(method(lastModifiedDate))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn lastModifiedDate(&self) -> Option<Retained<NSDate>>;
136
137        #[unsafe(method(creationDate))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
140
141        #[unsafe(method(timeZone))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
144
145        /// Setter for [`timeZone`][Self::timeZone].
146        ///
147        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
148        #[unsafe(method(setTimeZone:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
151
152        #[unsafe(method(hasAlarms))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn hasAlarms(&self) -> bool;
155
156        #[unsafe(method(hasRecurrenceRules))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn hasRecurrenceRules(&self) -> bool;
159
160        #[unsafe(method(hasAttendees))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn hasAttendees(&self) -> bool;
163
164        #[unsafe(method(hasNotes))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn hasNotes(&self) -> bool;
167
168        #[cfg(feature = "EKParticipant")]
169        #[unsafe(method(attendees))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn attendees(&self) -> Option<Retained<NSArray<EKParticipant>>>;
172
173        #[cfg(feature = "EKAlarm")]
174        #[unsafe(method(alarms))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn alarms(&self) -> Option<Retained<NSArray<EKAlarm>>>;
177
178        #[cfg(feature = "EKAlarm")]
179        /// Setter for [`alarms`][Self::alarms].
180        ///
181        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
182        #[unsafe(method(setAlarms:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setAlarms(&self, alarms: Option<&NSArray<EKAlarm>>);
185
186        #[cfg(feature = "EKAlarm")]
187        /// Adds an alarm to this item.
188        ///
189        /// This method add an alarm to an item. Be warned that some calendars can only
190        /// allow a certain maximum number of alarms. When this item is saved, it will
191        /// truncate any extra alarms from the array.
192        #[unsafe(method(addAlarm:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn addAlarm(&self, alarm: &EKAlarm);
195
196        #[cfg(feature = "EKAlarm")]
197        /// Removes an alarm from this item.
198        #[unsafe(method(removeAlarm:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn removeAlarm(&self, alarm: &EKAlarm);
201
202        #[cfg(feature = "EKRecurrenceRule")]
203        /// An array of EKRecurrenceRules, or nil if none.
204        #[unsafe(method(recurrenceRules))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn recurrenceRules(&self) -> Option<Retained<NSArray<EKRecurrenceRule>>>;
207
208        #[cfg(feature = "EKRecurrenceRule")]
209        /// Setter for [`recurrenceRules`][Self::recurrenceRules].
210        ///
211        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
212        #[unsafe(method(setRecurrenceRules:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setRecurrenceRules(
215            &self,
216            recurrence_rules: Option<&NSArray<EKRecurrenceRule>>,
217        );
218
219        #[cfg(feature = "EKRecurrenceRule")]
220        #[unsafe(method(addRecurrenceRule:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn addRecurrenceRule(&self, rule: &EKRecurrenceRule);
223
224        #[cfg(feature = "EKRecurrenceRule")]
225        #[unsafe(method(removeRecurrenceRule:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn removeRecurrenceRule(&self, rule: &EKRecurrenceRule);
228    );
229}
230
231/// Methods declared on superclass `NSObject`.
232#[cfg(feature = "EKObject")]
233impl EKCalendarItem {
234    extern_methods!(
235        #[unsafe(method(init))]
236        #[unsafe(method_family = init)]
237        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
238
239        #[unsafe(method(new))]
240        #[unsafe(method_family = new)]
241        pub unsafe fn new() -> Retained<Self>;
242    );
243}