Skip to main content

objc2_health_kit/generated/
HKActivitySummary.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    /// An object that represents a summary of a user's activity for a given day.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkactivitysummary?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct HKActivitySummary;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for HKActivitySummary {}
21);
22
23extern_conformance!(
24    unsafe impl NSCopying for HKActivitySummary {}
25);
26
27unsafe impl CopyingHelper for HKActivitySummary {
28    type Result = Self;
29}
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for HKActivitySummary {}
33);
34
35extern_conformance!(
36    unsafe impl NSSecureCoding for HKActivitySummary {}
37);
38
39impl HKActivitySummary {
40    extern_methods!(
41        /// The date components representing the day for this particular HKActivitySummary.
42        ///
43        /// These date components will contain era, year, month, and day components in the provided calendar.
44        #[unsafe(method(dateComponentsForCalendar:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn dateComponentsForCalendar(
47            &self,
48            calendar: &NSCalendar,
49        ) -> Retained<NSDateComponents>;
50
51        #[cfg(feature = "HKCharacteristicValues")]
52        /// The move mode of this activity summary
53        ///
54        /// The move mode of an activity summary determines if activeEnergyBurned or appleMoveTime are used for the move ring.
55        #[unsafe(method(activityMoveMode))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn activityMoveMode(&self) -> HKActivityMoveMode;
58
59        #[cfg(feature = "HKCharacteristicValues")]
60        /// Setter for [`activityMoveMode`][Self::activityMoveMode].
61        #[unsafe(method(setActivityMoveMode:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn setActivityMoveMode(&self, activity_move_mode: HKActivityMoveMode);
64
65        /// The paused state of this activity summary
66        ///
67        /// The paused state of an activity summary indicates if the user is tracking their rings for the given day.
68        #[unsafe(method(isPaused))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn isPaused(&self) -> bool;
71
72        /// Setter for [`isPaused`][Self::isPaused].
73        #[unsafe(method(setPaused:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setPaused(&self, paused: bool);
76
77        #[cfg(feature = "HKQuantity")]
78        /// The amount of active energy that the user burned.
79        ///
80        /// This quantity is compatible with energy units.
81        #[unsafe(method(activeEnergyBurned))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn activeEnergyBurned(&self) -> Retained<HKQuantity>;
84
85        #[cfg(feature = "HKQuantity")]
86        /// Setter for [`activeEnergyBurned`][Self::activeEnergyBurned].
87        #[unsafe(method(setActiveEnergyBurned:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setActiveEnergyBurned(&self, active_energy_burned: &HKQuantity);
90
91        #[cfg(feature = "HKQuantity")]
92        /// The amount of move time that the user performed.
93        ///
94        /// This quantity is compatible with time units. The measurement criteria of
95        /// move time time is defined by Apple.
96        #[unsafe(method(appleMoveTime))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn appleMoveTime(&self) -> Retained<HKQuantity>;
99
100        #[cfg(feature = "HKQuantity")]
101        /// Setter for [`appleMoveTime`][Self::appleMoveTime].
102        #[unsafe(method(setAppleMoveTime:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setAppleMoveTime(&self, apple_move_time: &HKQuantity);
105
106        #[cfg(feature = "HKQuantity")]
107        /// The amount of exercise time that the user performed.
108        ///
109        /// This quantity is compatible with time units. The measurement criteria of
110        /// exercise time is defined by Apple.
111        #[unsafe(method(appleExerciseTime))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn appleExerciseTime(&self) -> Retained<HKQuantity>;
114
115        #[cfg(feature = "HKQuantity")]
116        /// Setter for [`appleExerciseTime`][Self::appleExerciseTime].
117        #[unsafe(method(setAppleExerciseTime:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setAppleExerciseTime(&self, apple_exercise_time: &HKQuantity);
120
121        #[cfg(feature = "HKQuantity")]
122        /// The number of stand hours that the user earned.
123        ///
124        /// This quantity is compatible with the count unit. The measurement criteria of
125        /// stand hours is defined by Apple.
126        #[unsafe(method(appleStandHours))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn appleStandHours(&self) -> Retained<HKQuantity>;
129
130        #[cfg(feature = "HKQuantity")]
131        /// Setter for [`appleStandHours`][Self::appleStandHours].
132        #[unsafe(method(setAppleStandHours:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setAppleStandHours(&self, apple_stand_hours: &HKQuantity);
135
136        #[cfg(feature = "HKQuantity")]
137        /// The user's active energy goal for the day.
138        ///
139        /// This quantity is compatible with energy units.
140        #[unsafe(method(activeEnergyBurnedGoal))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn activeEnergyBurnedGoal(&self) -> Retained<HKQuantity>;
143
144        #[cfg(feature = "HKQuantity")]
145        /// Setter for [`activeEnergyBurnedGoal`][Self::activeEnergyBurnedGoal].
146        #[unsafe(method(setActiveEnergyBurnedGoal:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setActiveEnergyBurnedGoal(&self, active_energy_burned_goal: &HKQuantity);
149
150        #[cfg(feature = "HKQuantity")]
151        /// The user's move time goal for the day.
152        ///
153        /// This quantity is compatible with time units.
154        #[unsafe(method(appleMoveTimeGoal))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn appleMoveTimeGoal(&self) -> Retained<HKQuantity>;
157
158        #[cfg(feature = "HKQuantity")]
159        /// Setter for [`appleMoveTimeGoal`][Self::appleMoveTimeGoal].
160        #[unsafe(method(setAppleMoveTimeGoal:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setAppleMoveTimeGoal(&self, apple_move_time_goal: &HKQuantity);
163
164        #[cfg(feature = "HKQuantity")]
165        /// The user's exercise time goal for the day.
166        ///
167        /// This quantity is compatible with time units.
168        #[deprecated]
169        #[unsafe(method(appleExerciseTimeGoal))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn appleExerciseTimeGoal(&self) -> Retained<HKQuantity>;
172
173        #[cfg(feature = "HKQuantity")]
174        /// Setter for [`appleExerciseTimeGoal`][Self::appleExerciseTimeGoal].
175        #[deprecated]
176        #[unsafe(method(setAppleExerciseTimeGoal:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn setAppleExerciseTimeGoal(&self, apple_exercise_time_goal: &HKQuantity);
179
180        #[cfg(feature = "HKQuantity")]
181        /// The user's exercise time goal for the day.
182        ///
183        /// This quantity is compatible with time units.
184        #[unsafe(method(exerciseTimeGoal))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn exerciseTimeGoal(&self) -> Option<Retained<HKQuantity>>;
187
188        #[cfg(feature = "HKQuantity")]
189        /// Setter for [`exerciseTimeGoal`][Self::exerciseTimeGoal].
190        #[unsafe(method(setExerciseTimeGoal:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setExerciseTimeGoal(&self, exercise_time_goal: Option<&HKQuantity>);
193
194        #[cfg(feature = "HKQuantity")]
195        /// The user's active stand hours goal for the day.
196        ///
197        /// This quantity is compatible with the count unit.
198        #[deprecated]
199        #[unsafe(method(appleStandHoursGoal))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn appleStandHoursGoal(&self) -> Retained<HKQuantity>;
202
203        #[cfg(feature = "HKQuantity")]
204        /// Setter for [`appleStandHoursGoal`][Self::appleStandHoursGoal].
205        #[deprecated]
206        #[unsafe(method(setAppleStandHoursGoal:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setAppleStandHoursGoal(&self, apple_stand_hours_goal: &HKQuantity);
209
210        #[cfg(feature = "HKQuantity")]
211        /// The user's active stand hours goal for the day.
212        ///
213        /// This quantity is compatible with the count unit.
214        #[unsafe(method(standHoursGoal))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn standHoursGoal(&self) -> Option<Retained<HKQuantity>>;
217
218        #[cfg(feature = "HKQuantity")]
219        /// Setter for [`standHoursGoal`][Self::standHoursGoal].
220        #[unsafe(method(setStandHoursGoal:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setStandHoursGoal(&self, stand_hours_goal: Option<&HKQuantity>);
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227impl HKActivitySummary {
228    extern_methods!(
229        #[unsafe(method(init))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
232
233        #[unsafe(method(new))]
234        #[unsafe(method_family = new)]
235        pub unsafe fn new() -> Retained<Self>;
236    );
237}
238
239extern "C" {
240    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathdatecomponents?language=objc)
241    pub static HKPredicateKeyPathDateComponents: &'static NSString;
242}