objc2_health_kit/generated/
HKCorrelation.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 HKCorrelation is a collection of correlated objects.
11    ///
12    /// When multiple readings are taken together, it may be beneficial to correlate them so that they can be
13    /// displayed together and share common metadata about how they were created.
14    ///
15    /// For example, systolic and diastolic blood pressure readings are typically presented together so these
16    /// readings should be saved with a correlation of type blood pressure.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcorrelation?language=objc)
19    #[unsafe(super(HKSample, HKObject, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
22    pub struct HKCorrelation;
23);
24
25#[cfg(all(feature = "HKObject", feature = "HKSample"))]
26unsafe impl Send for HKCorrelation {}
27
28#[cfg(all(feature = "HKObject", feature = "HKSample"))]
29unsafe impl Sync for HKCorrelation {}
30
31#[cfg(all(feature = "HKObject", feature = "HKSample"))]
32extern_conformance!(
33    unsafe impl NSCoding for HKCorrelation {}
34);
35
36#[cfg(all(feature = "HKObject", feature = "HKSample"))]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for HKCorrelation {}
39);
40
41#[cfg(all(feature = "HKObject", feature = "HKSample"))]
42extern_conformance!(
43    unsafe impl NSSecureCoding for HKCorrelation {}
44);
45
46#[cfg(all(feature = "HKObject", feature = "HKSample"))]
47impl HKCorrelation {
48    extern_methods!(
49        #[cfg(feature = "HKObjectType")]
50        #[unsafe(method(correlationType))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn correlationType(&self) -> Retained<HKCorrelationType>;
53
54        /// A set of HKSamples containing all of the objects that were saved with the receiver.
55        #[unsafe(method(objects))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn objects(&self) -> Retained<NSSet<HKSample>>;
58
59        #[cfg(feature = "HKObjectType")]
60        /// Creates a new HKCorrelation with the given type, start date, end date, and objects.
61        ///
62        /// objects must be a set of HKQuantitySamples and HKCategorySamples
63        #[unsafe(method(correlationWithType:startDate:endDate:objects:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn correlationWithType_startDate_endDate_objects(
66            correlation_type: &HKCorrelationType,
67            start_date: &NSDate,
68            end_date: &NSDate,
69            objects: &NSSet<HKSample>,
70        ) -> Retained<Self>;
71
72        #[cfg(feature = "HKObjectType")]
73        /// Creates a new HKCorrelation with the given type, start date, end date, objects, and metadata.
74        ///
75        /// objects must be a set of HKQuantitySamples and HKCategorySamples
76        ///
77        /// # Safety
78        ///
79        /// `metadata` generic should be of the correct type.
80        #[unsafe(method(correlationWithType:startDate:endDate:objects:metadata:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn correlationWithType_startDate_endDate_objects_metadata(
83            correlation_type: &HKCorrelationType,
84            start_date: &NSDate,
85            end_date: &NSDate,
86            objects: &NSSet<HKSample>,
87            metadata: Option<&NSDictionary<NSString, AnyObject>>,
88        ) -> Retained<Self>;
89
90        #[cfg(all(feature = "HKDevice", feature = "HKObjectType"))]
91        /// Creates a new HKCorrelation with the given type, start date, end date, objects, and metadata.
92        ///
93        /// Parameter `correlationType`: The correlation type of the objects set.
94        ///
95        /// Parameter `startDate`: The start date of the correlation.
96        ///
97        /// Parameter `endDate`: The end date of the correlation.
98        ///
99        /// Parameter `device`: The HKDevice that generated the samples (optional).
100        ///
101        /// Parameter `metadata`: Metadata for the correlation (optional).
102        ///
103        /// objects must be a set of HKQuantitySamples and HKCategorySamples
104        ///
105        /// # Safety
106        ///
107        /// `metadata` generic should be of the correct type.
108        #[unsafe(method(correlationWithType:startDate:endDate:objects:device:metadata:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn correlationWithType_startDate_endDate_objects_device_metadata(
111            correlation_type: &HKCorrelationType,
112            start_date: &NSDate,
113            end_date: &NSDate,
114            objects: &NSSet<HKSample>,
115            device: Option<&HKDevice>,
116            metadata: Option<&NSDictionary<NSString, AnyObject>>,
117        ) -> Retained<Self>;
118
119        #[cfg(feature = "HKObjectType")]
120        /// Returns the set of correlated objects with the specified type.
121        #[unsafe(method(objectsForType:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn objectsForType(
124            &self,
125            object_type: &HKObjectType,
126        ) -> Retained<NSSet<HKSample>>;
127    );
128}
129
130/// Methods declared on superclass `HKObject`.
131#[cfg(all(feature = "HKObject", feature = "HKSample"))]
132impl HKCorrelation {
133    extern_methods!(
134        #[unsafe(method(init))]
135        #[unsafe(method_family = init)]
136        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
137    );
138}
139
140/// Methods declared on superclass `NSObject`.
141#[cfg(all(feature = "HKObject", feature = "HKSample"))]
142impl HKCorrelation {
143    extern_methods!(
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}