objc2_health_kit/generated/HKCDADocumentSample.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 /// A sample object representing a CDA document.
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcdadocumentsample?language=objc)
13 #[unsafe(super(HKDocumentSample, HKSample, HKObject, NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[cfg(all(
16 feature = "HKDocumentSample",
17 feature = "HKObject",
18 feature = "HKSample"
19 ))]
20 pub struct HKCDADocumentSample;
21);
22
23#[cfg(all(
24 feature = "HKDocumentSample",
25 feature = "HKObject",
26 feature = "HKSample"
27))]
28unsafe impl Send for HKCDADocumentSample {}
29
30#[cfg(all(
31 feature = "HKDocumentSample",
32 feature = "HKObject",
33 feature = "HKSample"
34))]
35unsafe impl Sync for HKCDADocumentSample {}
36
37#[cfg(all(
38 feature = "HKDocumentSample",
39 feature = "HKObject",
40 feature = "HKSample"
41))]
42extern_conformance!(
43 unsafe impl NSCoding for HKCDADocumentSample {}
44);
45
46#[cfg(all(
47 feature = "HKDocumentSample",
48 feature = "HKObject",
49 feature = "HKSample"
50))]
51extern_conformance!(
52 unsafe impl NSObjectProtocol for HKCDADocumentSample {}
53);
54
55#[cfg(all(
56 feature = "HKDocumentSample",
57 feature = "HKObject",
58 feature = "HKSample"
59))]
60extern_conformance!(
61 unsafe impl NSSecureCoding for HKCDADocumentSample {}
62);
63
64#[cfg(all(
65 feature = "HKDocumentSample",
66 feature = "HKObject",
67 feature = "HKSample"
68))]
69impl HKCDADocumentSample {
70 extern_methods!(
71 /// The contents of the document.
72 ///
73 /// Access to each CDA instance must be authorized by the user in order for the document data to be
74 /// accessible to an app. The authorization request occurs the first time a document matches the predicate
75 /// of an executed HKDocumentQuery. This property will always be nil if the sample is returned by an
76 /// HKSampleQuery or an HKAnchoredObjectQuery.
77 #[unsafe(method(document))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn document(&self) -> Option<Retained<HKCDADocument>>;
80
81 /// Creates a new document sample with the specified attributes.
82 ///
83 /// Parameter `documentData`: Document contents in an XML format that meets the CDA standard.
84 ///
85 /// Parameter `startDate`: The start date for the document.
86 ///
87 /// Parameter `endDate`: The end date for the document.
88 ///
89 /// Parameter `metadata`: Metadata for the document.
90 ///
91 /// Parameter `validationError`: The XML content will be validated against the standard for CDA content. If that validation
92 /// fails, then this parameter will be set with the relavant error. Detailed information about the
93 /// failure may be obtained by examining the value for the HKDetailedCDAValidationErrorKey key of
94 /// the NSError's userInfo dictionary.
95 ///
96 /// Returns: The new instance or nil if the documentData does not pass validation.
97 ///
98 /// Attributes of the document, such as title, patient name, etc. will be extracted automatically
99 /// from the document content.
100 ///
101 /// # Safety
102 ///
103 /// `metadata` generic should be of the correct type.
104 #[unsafe(method(CDADocumentSampleWithData:startDate:endDate:metadata:validationError:_))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn CDADocumentSampleWithData_startDate_endDate_metadata_validationError(
107 document_data: &NSData,
108 start_date: &NSDate,
109 end_date: &NSDate,
110 metadata: Option<&NSDictionary<NSString, AnyObject>>,
111 ) -> Result<Retained<Self>, Retained<NSError>>;
112 );
113}
114
115/// Methods declared on superclass `HKObject`.
116#[cfg(all(
117 feature = "HKDocumentSample",
118 feature = "HKObject",
119 feature = "HKSample"
120))]
121impl HKCDADocumentSample {
122 extern_methods!(
123 #[unsafe(method(init))]
124 #[unsafe(method_family = init)]
125 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
126 );
127}
128
129/// Methods declared on superclass `NSObject`.
130#[cfg(all(
131 feature = "HKDocumentSample",
132 feature = "HKObject",
133 feature = "HKSample"
134))]
135impl HKCDADocumentSample {
136 extern_methods!(
137 #[unsafe(method(new))]
138 #[unsafe(method_family = new)]
139 pub unsafe fn new() -> Retained<Self>;
140 );
141}
142
143extern_class!(
144 /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcdadocument?language=objc)
145 #[unsafe(super(NSObject))]
146 #[derive(Debug, PartialEq, Eq, Hash)]
147 pub struct HKCDADocument;
148);
149
150unsafe impl Send for HKCDADocument {}
151
152unsafe impl Sync for HKCDADocument {}
153
154extern_conformance!(
155 unsafe impl NSObjectProtocol for HKCDADocument {}
156);
157
158impl HKCDADocument {
159 extern_methods!(
160 /// The CDA document content in XML format as specified in the CDA standard. This may be nil if the
161 /// includeDocumentData option in HKDocumentQuery is specified as NO.
162 #[unsafe(method(documentData))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn documentData(&self) -> Option<Retained<NSData>>;
165
166 /// The title of the document.
167 ///
168 /// This property is extracted automatically from the document.
169 #[unsafe(method(title))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn title(&self) -> Retained<NSString>;
172
173 /// The name of the patient receiving treatment.
174 ///
175 /// This property is extracted automatically from the document.
176 #[unsafe(method(patientName))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn patientName(&self) -> Retained<NSString>;
179
180 /// The person responsible for authoring the document. Usually, this is the treating physician.
181 ///
182 /// This property is extracted automatically from the document.
183 #[unsafe(method(authorName))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn authorName(&self) -> Retained<NSString>;
186
187 /// The organization responsible for the document. This is usually the treating institution name.
188 ///
189 /// This property is extracted automatically from the document.
190 #[unsafe(method(custodianName))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn custodianName(&self) -> Retained<NSString>;
193 );
194}
195
196/// Methods declared on superclass `NSObject`.
197impl HKCDADocument {
198 extern_methods!(
199 #[unsafe(method(init))]
200 #[unsafe(method_family = init)]
201 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203 #[unsafe(method(new))]
204 #[unsafe(method_family = new)]
205 pub unsafe fn new() -> Retained<Self>;
206 );
207}
208
209extern "C" {
210 /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcdatitle?language=objc)
211 pub static HKPredicateKeyPathCDATitle: &'static NSString;
212}
213
214extern "C" {
215 /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcdapatientname?language=objc)
216 pub static HKPredicateKeyPathCDAPatientName: &'static NSString;
217}
218
219extern "C" {
220 /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcdaauthorname?language=objc)
221 pub static HKPredicateKeyPathCDAAuthorName: &'static NSString;
222}
223
224extern "C" {
225 /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcdacustodianname?language=objc)
226 pub static HKPredicateKeyPathCDACustodianName: &'static NSString;
227}
228
229extern "C" {
230 /// This may be used with the validationError parameter of
231 /// CDADocumentSampleWithData:startDate:endDate:device:metadata:validationError: to obtain a detailed
232 /// description of the validation errors encountered when creating a CDA document.
233 ///
234 /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdetailedcdavalidationerrorkey?language=objc)
235 pub static HKDetailedCDAValidationErrorKey: &'static NSString;
236}