objc2_health_kit/generated/
HKCorrelationQuery.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    /// A query to find HKCorrelations
12    ///
13    /// Correlations are HKSamples that contain a set of correlated samples. HKCorrelationQuery
14    /// accepts a predicate to filter HKCorrelations and a dictionary of predicates to filter the
15    /// correlated samples.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcorrelationquery?language=objc)
18    #[unsafe(super(HKQuery, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "HKQuery")]
21    pub struct HKCorrelationQuery;
22);
23
24#[cfg(feature = "HKQuery")]
25unsafe impl Send for HKCorrelationQuery {}
26
27#[cfg(feature = "HKQuery")]
28unsafe impl Sync for HKCorrelationQuery {}
29
30#[cfg(feature = "HKQuery")]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for HKCorrelationQuery {}
33);
34
35#[cfg(feature = "HKQuery")]
36impl HKCorrelationQuery {
37    extern_methods!(
38        #[cfg(feature = "HKObjectType")]
39        #[unsafe(method(correlationType))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn correlationType(&self) -> Retained<HKCorrelationType>;
42
43        #[cfg(feature = "HKObjectType")]
44        /// A dictionary of predicates for the HKCorrelation's objects
45        ///
46        /// samplePredicates maps HKSampleTypes to NSPredicates. The predicate value will apply
47        /// to objects of the key type.
48        #[unsafe(method(samplePredicates))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn samplePredicates(
51            &self,
52        ) -> Option<Retained<NSDictionary<HKSampleType, NSPredicate>>>;
53
54        #[cfg(all(
55            feature = "HKCorrelation",
56            feature = "HKObject",
57            feature = "HKObjectType",
58            feature = "HKSample",
59            feature = "block2"
60        ))]
61        /// The designated initializer for HKCorrelationQuery.
62        ///
63        ///
64        /// Parameter `correlationType`: The type of correlation that is being queried for
65        ///
66        ///
67        /// Parameter `predicate`: The predicate for scoping which HKCorrelations are returned
68        ///
69        ///
70        /// Parameter `samplePredicates`: A dictionary mapping HKSampleTypes to NSPredicates. If no predicate for a particular type
71        /// is provided, it is assumed to be a nil predicate and objects of that type will not be
72        /// filtered.
73        ///
74        /// # Safety
75        ///
76        /// `completion` block must be sendable.
77        #[unsafe(method(initWithType:predicate:samplePredicates:completion:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithType_predicate_samplePredicates_completion(
80            this: Allocated<Self>,
81            correlation_type: &HKCorrelationType,
82            predicate: Option<&NSPredicate>,
83            sample_predicates: Option<&NSDictionary<HKSampleType, NSPredicate>>,
84            completion: &block2::DynBlock<
85                dyn Fn(NonNull<HKCorrelationQuery>, *mut NSArray<HKCorrelation>, *mut NSError),
86            >,
87        ) -> Retained<Self>;
88    );
89}
90
91/// Methods declared on superclass `HKQuery`.
92#[cfg(feature = "HKQuery")]
93impl HKCorrelationQuery {
94    extern_methods!(
95        #[unsafe(method(init))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98    );
99}
100
101/// Methods declared on superclass `NSObject`.
102#[cfg(feature = "HKQuery")]
103impl HKCorrelationQuery {
104    extern_methods!(
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new() -> Retained<Self>;
108    );
109}