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