objc2_health_kit/generated/
HKDiscreteQuantitySample.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// An HKQuantitySample subclass representing a quantity measurement with
11    /// discrete aggregation style.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdiscretequantitysample?language=objc)
14    #[unsafe(super(HKQuantitySample, HKSample, HKObject, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(all(
17        feature = "HKObject",
18        feature = "HKQuantitySample",
19        feature = "HKSample"
20    ))]
21    pub struct HKDiscreteQuantitySample;
22);
23
24#[cfg(all(
25    feature = "HKObject",
26    feature = "HKQuantitySample",
27    feature = "HKSample"
28))]
29unsafe impl Send for HKDiscreteQuantitySample {}
30
31#[cfg(all(
32    feature = "HKObject",
33    feature = "HKQuantitySample",
34    feature = "HKSample"
35))]
36unsafe impl Sync for HKDiscreteQuantitySample {}
37
38#[cfg(all(
39    feature = "HKObject",
40    feature = "HKQuantitySample",
41    feature = "HKSample"
42))]
43extern_conformance!(
44    unsafe impl NSCoding for HKDiscreteQuantitySample {}
45);
46
47#[cfg(all(
48    feature = "HKObject",
49    feature = "HKQuantitySample",
50    feature = "HKSample"
51))]
52extern_conformance!(
53    unsafe impl NSObjectProtocol for HKDiscreteQuantitySample {}
54);
55
56#[cfg(all(
57    feature = "HKObject",
58    feature = "HKQuantitySample",
59    feature = "HKSample"
60))]
61extern_conformance!(
62    unsafe impl NSSecureCoding for HKDiscreteQuantitySample {}
63);
64
65#[cfg(all(
66    feature = "HKObject",
67    feature = "HKQuantitySample",
68    feature = "HKSample"
69))]
70impl HKDiscreteQuantitySample {
71    extern_methods!(
72        #[cfg(feature = "HKQuantity")]
73        /// The minimum of the receiver's quantities
74        #[unsafe(method(minimumQuantity))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn minimumQuantity(&self) -> Retained<HKQuantity>;
77
78        #[cfg(feature = "HKQuantity")]
79        /// The average of the receiver's quantities
80        #[unsafe(method(averageQuantity))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn averageQuantity(&self) -> Retained<HKQuantity>;
83
84        #[cfg(feature = "HKQuantity")]
85        /// The maximum of the receiver's quantities
86        #[unsafe(method(maximumQuantity))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn maximumQuantity(&self) -> Retained<HKQuantity>;
89
90        #[cfg(feature = "HKQuantity")]
91        /// The receiver's quantity with most recent date interval
92        #[unsafe(method(mostRecentQuantity))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn mostRecentQuantity(&self) -> Retained<HKQuantity>;
95
96        /// The date interval for the receiver's most recent quantity
97        #[unsafe(method(mostRecentQuantityDateInterval))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn mostRecentQuantityDateInterval(&self) -> Retained<NSDateInterval>;
100    );
101}
102
103/// Methods declared on superclass `HKQuantitySample`.
104#[cfg(all(
105    feature = "HKObject",
106    feature = "HKQuantitySample",
107    feature = "HKSample"
108))]
109impl HKDiscreteQuantitySample {
110    extern_methods!(
111        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
112        /// Creates a new HKQuantitySample with the given type, quantity, start date, and end date.
113        ///
114        /// The quantity must have a unit that is compatible with the given quantity type.
115        /// See -[HKQuantityType isCompatibleWithUnit:].
116        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate(
119            quantity_type: &HKQuantityType,
120            quantity: &HKQuantity,
121            start_date: &NSDate,
122            end_date: &NSDate,
123        ) -> Retained<Self>;
124
125        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
126        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
127        ///
128        /// The quantity must have a unit that is compatible with the given quantity type.
129        /// See -[HKQuantityType isCompatibleWithUnit:].
130        ///
131        /// # Safety
132        ///
133        /// `metadata` generic should be of the correct type.
134        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:metadata:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_metadata(
137            quantity_type: &HKQuantityType,
138            quantity: &HKQuantity,
139            start_date: &NSDate,
140            end_date: &NSDate,
141            metadata: Option<&NSDictionary<NSString, AnyObject>>,
142        ) -> Retained<Self>;
143
144        #[cfg(all(feature = "HKDevice", feature = "HKObjectType", feature = "HKQuantity"))]
145        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
146        ///
147        /// Parameter `quantityType`: The type of the sample.
148        ///
149        /// Parameter `startDate`: The start date of the sample.
150        ///
151        /// Parameter `endDate`: The end date of the sample.
152        ///
153        /// Parameter `device`: The HKDevice that generated the sample (optional).
154        ///
155        /// Parameter `metadata`: Metadata for the sample (optional).
156        ///
157        /// The quantity must have a unit that is compatible with the given quantity type.
158        /// See -[HKQuantityType isCompatibleWithUnit:].
159        ///
160        /// # Safety
161        ///
162        /// `metadata` generic should be of the correct type.
163        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:device:metadata:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_device_metadata(
166            quantity_type: &HKQuantityType,
167            quantity: &HKQuantity,
168            start_date: &NSDate,
169            end_date: &NSDate,
170            device: Option<&HKDevice>,
171            metadata: Option<&NSDictionary<NSString, AnyObject>>,
172        ) -> Retained<Self>;
173    );
174}
175
176/// Methods declared on superclass `HKObject`.
177#[cfg(all(
178    feature = "HKObject",
179    feature = "HKQuantitySample",
180    feature = "HKSample"
181))]
182impl HKDiscreteQuantitySample {
183    extern_methods!(
184        #[unsafe(method(init))]
185        #[unsafe(method_family = init)]
186        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
187    );
188}
189
190/// Methods declared on superclass `NSObject`.
191#[cfg(all(
192    feature = "HKObject",
193    feature = "HKQuantitySample",
194    feature = "HKSample"
195))]
196impl HKDiscreteQuantitySample {
197    extern_methods!(
198        #[unsafe(method(new))]
199        #[unsafe(method_family = new)]
200        pub unsafe fn new() -> Retained<Self>;
201    );
202}
203
204extern "C" {
205    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmin?language=objc)
206    pub static HKPredicateKeyPathMin: &'static NSString;
207}
208
209extern "C" {
210    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathaverage?language=objc)
211    pub static HKPredicateKeyPathAverage: &'static NSString;
212}
213
214extern "C" {
215    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmax?language=objc)
216    pub static HKPredicateKeyPathMax: &'static NSString;
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmostrecent?language=objc)
221    pub static HKPredicateKeyPathMostRecent: &'static NSString;
222}
223
224extern "C" {
225    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmostrecentstartdate?language=objc)
226    pub static HKPredicateKeyPathMostRecentStartDate: &'static NSString;
227}
228
229extern "C" {
230    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmostrecentenddate?language=objc)
231    pub static HKPredicateKeyPathMostRecentEndDate: &'static NSString;
232}
233
234extern "C" {
235    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmostrecentduration?language=objc)
236    pub static HKPredicateKeyPathMostRecentDuration: &'static NSString;
237}