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