objc2_health_kit/generated/
HKCategorySample.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 HKObject subclass representing an category measurement
11    ///
12    /// Category samples are samples that can be categorized into an enum of concrete values
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcategorysample?language=objc)
15    #[unsafe(super(HKSample, HKObject, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
18    pub struct HKCategorySample;
19);
20
21#[cfg(all(feature = "HKObject", feature = "HKSample"))]
22unsafe impl Send for HKCategorySample {}
23
24#[cfg(all(feature = "HKObject", feature = "HKSample"))]
25unsafe impl Sync for HKCategorySample {}
26
27#[cfg(all(feature = "HKObject", feature = "HKSample"))]
28extern_conformance!(
29    unsafe impl NSCoding for HKCategorySample {}
30);
31
32#[cfg(all(feature = "HKObject", feature = "HKSample"))]
33extern_conformance!(
34    unsafe impl NSObjectProtocol for HKCategorySample {}
35);
36
37#[cfg(all(feature = "HKObject", feature = "HKSample"))]
38extern_conformance!(
39    unsafe impl NSSecureCoding for HKCategorySample {}
40);
41
42#[cfg(all(feature = "HKObject", feature = "HKSample"))]
43impl HKCategorySample {
44    extern_methods!(
45        #[cfg(feature = "HKObjectType")]
46        #[unsafe(method(categoryType))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn categoryType(&self) -> Retained<HKCategoryType>;
49
50        /// The preferred enum for the value is determined by the receiver's category type.
51        #[unsafe(method(value))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn value(&self) -> NSInteger;
54
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[cfg(feature = "HKObjectType")]
60        /// Creates a new HKCategorySample.
61        ///
62        ///
63        /// Parameter `type`: The type of the sample.
64        ///
65        /// Parameter `value`: The enumeration value for the sample. See HKCategoryTypeIdentifier for appropriate value.
66        ///
67        /// Parameter `startDate`: The start date of the sample.
68        ///
69        /// Parameter `endDate`: The end date of the sample.
70        ///
71        /// Parameter `metadata`: Metadata for the sample (optional).
72        ///
73        /// # Safety
74        ///
75        /// `metadata` generic should be of the correct type.
76        #[unsafe(method(categorySampleWithType:value:startDate:endDate:metadata:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn categorySampleWithType_value_startDate_endDate_metadata(
79            r#type: &HKCategoryType,
80            value: NSInteger,
81            start_date: &NSDate,
82            end_date: &NSDate,
83            metadata: Option<&NSDictionary<NSString, AnyObject>>,
84        ) -> Retained<Self>;
85
86        #[cfg(feature = "HKObjectType")]
87        /// Creates a new HKCategorySample.
88        ///
89        ///
90        /// Parameter `type`: The type of the sample.
91        ///
92        /// Parameter `value`: The enumeration value for the sample. See HKCategoryTypeIdentifier for appropriate value.
93        ///
94        /// Parameter `startDate`: The start date of the sample.
95        ///
96        /// Parameter `endDate`: The end date of the sample.
97        #[unsafe(method(categorySampleWithType:value:startDate:endDate:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn categorySampleWithType_value_startDate_endDate(
100            r#type: &HKCategoryType,
101            value: NSInteger,
102            start_date: &NSDate,
103            end_date: &NSDate,
104        ) -> Retained<Self>;
105
106        #[cfg(all(feature = "HKDevice", feature = "HKObjectType"))]
107        /// Creates a new HKCategorySample.
108        ///
109        ///
110        /// Parameter `type`: The type of the sample.
111        ///
112        /// Parameter `value`: The enumeration value for the sample. See HKCategoryTypeIdentifier for appropriate value.
113        ///
114        /// Parameter `startDate`: The start date of the sample.
115        ///
116        /// Parameter `endDate`: The end date of the sample.
117        ///
118        /// Parameter `device`: The HKDevice that generated the sample (optional).
119        ///
120        /// Parameter `metadata`: Metadata for the sample (optional).
121        ///
122        /// # Safety
123        ///
124        /// `metadata` generic should be of the correct type.
125        #[unsafe(method(categorySampleWithType:value:startDate:endDate:device:metadata:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn categorySampleWithType_value_startDate_endDate_device_metadata(
128            r#type: &HKCategoryType,
129            value: NSInteger,
130            start_date: &NSDate,
131            end_date: &NSDate,
132            device: Option<&HKDevice>,
133            metadata: Option<&NSDictionary<NSString, AnyObject>>,
134        ) -> Retained<Self>;
135    );
136}
137
138/// Methods declared on superclass `NSObject`.
139#[cfg(all(feature = "HKObject", feature = "HKSample"))]
140impl HKCategorySample {
141    extern_methods!(
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}
147
148extern "C" {
149    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcategoryvalue?language=objc)
150    pub static HKPredicateKeyPathCategoryValue: &'static NSString;
151}