objc2_health_kit/generated/HKDocumentQuery.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 concrete subclass of HKQuery that provides an interface to retrieve documents from the Health store.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdocumentquery?language=objc)
14 #[unsafe(super(HKQuery, NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 #[cfg(feature = "HKQuery")]
17 pub struct HKDocumentQuery;
18);
19
20#[cfg(feature = "HKQuery")]
21unsafe impl Send for HKDocumentQuery {}
22
23#[cfg(feature = "HKQuery")]
24unsafe impl Sync for HKDocumentQuery {}
25
26#[cfg(feature = "HKQuery")]
27extern_conformance!(
28 unsafe impl NSObjectProtocol for HKDocumentQuery {}
29);
30
31#[cfg(feature = "HKQuery")]
32impl HKDocumentQuery {
33 extern_methods!(
34 /// The maximum number of documents the receiver will return upon completion.
35 #[unsafe(method(limit))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn limit(&self) -> NSUInteger;
38
39 /// An array of NSSortDescriptors.
40 #[unsafe(method(sortDescriptors))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn sortDescriptors(&self) -> Option<Retained<NSArray<NSSortDescriptor>>>;
43
44 /// The XML content for documents may be large. This property can be used to control whether the query
45 /// returns the XML content for each record.
46 #[unsafe(method(includeDocumentData))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn includeDocumentData(&self) -> bool;
49
50 #[cfg(all(
51 feature = "HKDocumentSample",
52 feature = "HKObject",
53 feature = "HKObjectType",
54 feature = "HKSample",
55 feature = "block2"
56 ))]
57 /// Returns a query that will retrieve HKDocumentSamples matching the given predicate.
58 ///
59 ///
60 /// Parameter `documentType`: The type of document to retreive.
61 ///
62 /// Parameter `predicate`: The predicate which documents should match.
63 ///
64 /// Parameter `limit`: The maximum number of documents to return. Pass HKObjectQueryNoLimit for no limit.
65 ///
66 /// Parameter `sortDescriptors`: The sort descriptors to use to order the resulting documents.
67 ///
68 /// Parameter `includeDocumentData`: If true, the document content will be returned with the HKDocumentSample instance.
69 /// This option can be used to limit the size of the content returned since the content
70 /// may be large.
71 ///
72 /// Parameter `resultsHandler`: The block that will receive query results. Results will be returned incrementally
73 /// through several calls to this block. When there are no more results, the done
74 /// parameter will be YES and the results array will be empty. If results is nil, then
75 /// an error has occurred and the error parameter will be set. Delivery of results can
76 /// be stopped by calling HKHealthStore's stopQuery: method.
77 ///
78 ///
79 /// Health documents may contain sensitive data that a user may want to control explicitly. HKDocumentSample
80 /// objects returned by HKSampleQuery and HKAnchoredObjectQuery do not include this data (i.e., the document
81 /// property is nil). This query can be used to retrieve fully populated HKDocumentSample instances. The
82 /// query will prompt the user to authorize your app to read individual documents. The query will then
83 /// return the documents that your app is authorized to read. The user will only be asked to authorize your
84 /// app to read documents that are new since the last time an HKDocumentQuery was executed.
85 ///
86 /// # Safety
87 ///
88 /// `results_handler` block must be sendable.
89 #[unsafe(method(initWithDocumentType:predicate:limit:sortDescriptors:includeDocumentData:resultsHandler:))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn initWithDocumentType_predicate_limit_sortDescriptors_includeDocumentData_resultsHandler(
92 this: Allocated<Self>,
93 document_type: &HKDocumentType,
94 predicate: Option<&NSPredicate>,
95 limit: NSUInteger,
96 sort_descriptors: Option<&NSArray<NSSortDescriptor>>,
97 include_document_data: bool,
98 results_handler: &block2::DynBlock<
99 dyn Fn(
100 NonNull<HKDocumentQuery>,
101 *mut NSArray<HKDocumentSample>,
102 Bool,
103 *mut NSError,
104 ),
105 >,
106 ) -> Retained<Self>;
107 );
108}
109
110/// Methods declared on superclass `HKQuery`.
111#[cfg(feature = "HKQuery")]
112impl HKDocumentQuery {
113 extern_methods!(
114 #[unsafe(method(init))]
115 #[unsafe(method_family = init)]
116 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
117 );
118}
119
120/// Methods declared on superclass `NSObject`.
121#[cfg(feature = "HKQuery")]
122impl HKDocumentQuery {
123 extern_methods!(
124 #[unsafe(method(new))]
125 #[unsafe(method_family = new)]
126 pub unsafe fn new() -> Retained<Self>;
127 );
128}