1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// An HKWorkoutActivity is an object describing the properties of an activity within an HKWorkout.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutactivity?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct HKWorkoutActivity;
);
unsafe impl Send for HKWorkoutActivity {}
unsafe impl Sync for HKWorkoutActivity {}
extern_conformance!(
unsafe impl NSCoding for HKWorkoutActivity {}
);
extern_conformance!(
unsafe impl NSCopying for HKWorkoutActivity {}
);
unsafe impl CopyingHelper for HKWorkoutActivity {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for HKWorkoutActivity {}
);
extern_conformance!(
unsafe impl NSSecureCoding for HKWorkoutActivity {}
);
impl HKWorkoutActivity {
extern_methods!(
/// A unique identifier of the activity in the HealthKit database.
#[unsafe(method(UUID))]
#[unsafe(method_family = none)]
pub unsafe fn UUID(&self) -> Retained<NSUUID>;
#[cfg(feature = "HKWorkoutConfiguration")]
/// The configuration object describing the workout activity.
#[unsafe(method(workoutConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn workoutConfiguration(&self) -> Retained<HKWorkoutConfiguration>;
/// The point in time when the workout activity was started.
#[unsafe(method(startDate))]
#[unsafe(method_family = none)]
pub unsafe fn startDate(&self) -> Retained<NSDate>;
/// The point in time when the workout activity was ended.
///
/// This value is nil when a workout activity is in progress.
#[unsafe(method(endDate))]
#[unsafe(method_family = none)]
pub unsafe fn endDate(&self) -> Option<Retained<NSDate>>;
/// Extra information describing properties of the workout activity.
///
/// Keys must be NSString and values must be either NSString, NSNumber, NSDate, or
/// HKQuantity. See HKMetadata.h for potential metadata keys and values.
#[unsafe(method(metadata))]
#[unsafe(method_family = none)]
pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
/// The length of time that the workout activity was recording
///
/// The duration is derived from the start and end dates of the activity and takes
/// into account periods that the activity was paused. Periods that the activity was
/// paused are based off of the workoutEvents property of the parent workout object.
#[unsafe(method(duration))]
#[unsafe(method_family = none)]
pub unsafe fn duration(&self) -> NSTimeInterval;
#[cfg(feature = "HKWorkout")]
/// An array of HKWorkoutEvents that occurred during the workout activity.
///
/// These events will be ordered by date in ascending order. These events are a subset
/// of the workout events that take place between the start date and end date of the
/// activity. This includes any event that overlaps the activity, even partially.
/// Consequently, some events may be included in more than one activity.
#[unsafe(method(workoutEvents))]
#[unsafe(method_family = none)]
pub unsafe fn workoutEvents(&self) -> Retained<NSArray<HKWorkoutEvent>>;
#[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
/// A dictionary of statistics per quantity type during the activity
///
/// This dictionary will contain HKStatistics objects containing the statistics by quantity
/// sample type for all of the samples that have been added to the workout within the date
/// interval of this activity.
#[unsafe(method(allStatistics))]
#[unsafe(method_family = none)]
pub unsafe fn allStatistics(&self) -> Retained<NSDictionary<HKQuantityType, HKStatistics>>;
#[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
/// Returns an HKStatistics object containing the statistics for all the samples of the given type that
/// have been added to the workout within the date interval of this activity. If there are no samples of
/// the given type then nil is returned.
///
///
/// Parameter `quantityType`: The quantity type to gather statistics about.
#[unsafe(method(statisticsForType:))]
#[unsafe(method_family = none)]
pub unsafe fn statisticsForType(
&self,
quantity_type: &HKQuantityType,
) -> Option<Retained<HKStatistics>>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[cfg(feature = "HKWorkoutConfiguration")]
/// Initialize a new HKWorkoutActivity with the specified values.
///
///
/// Parameter `workoutConfiguration`: The configuration object describing the workout activity.
///
/// Parameter `startDate`: The point in time when the workout activity was started.
///
/// Parameter `endDate`: The point in time when the workout activity was ended.
///
/// Parameter `metadata`: Metadata for the workout activity. (Optional)
///
/// # Safety
///
/// `metadata` generic should be of the correct type.
#[unsafe(method(initWithWorkoutConfiguration:startDate:endDate:metadata:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithWorkoutConfiguration_startDate_endDate_metadata(
this: Allocated<Self>,
workout_configuration: &HKWorkoutConfiguration,
start_date: &NSDate,
end_date: Option<&NSDate>,
metadata: Option<&NSDictionary<NSString, AnyObject>>,
) -> Retained<Self>;
);
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivitytype?language=objc)
pub static HKPredicateKeyPathWorkoutActivityType: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivityduration?language=objc)
pub static HKPredicateKeyPathWorkoutActivityDuration: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivitystartdate?language=objc)
pub static HKPredicateKeyPathWorkoutActivityStartDate: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivityenddate?language=objc)
pub static HKPredicateKeyPathWorkoutActivityEndDate: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivitysumquantity?language=objc)
pub static HKPredicateKeyPathWorkoutActivitySumQuantity: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivityminimumquantity?language=objc)
pub static HKPredicateKeyPathWorkoutActivityMinimumQuantity: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivitymaximumquantity?language=objc)
pub static HKPredicateKeyPathWorkoutActivityMaximumQuantity: &'static NSString;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivityaveragequantity?language=objc)
pub static HKPredicateKeyPathWorkoutActivityAverageQuantity: &'static NSString;
}