objc2_background_tasks/generated/
BGTaskRequest.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    /// An abstract class for representing task requests.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundtasks/bgtaskrequest?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct BGTaskRequest;
17);
18
19unsafe impl NSCopying for BGTaskRequest {}
20
21unsafe impl CopyingHelper for BGTaskRequest {
22    type Result = Self;
23}
24
25unsafe impl NSObjectProtocol for BGTaskRequest {}
26
27impl BGTaskRequest {
28    extern_methods!(
29        /// The identifier of the task associated with the request.
30        #[unsafe(method(identifier))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn identifier(&self) -> Retained<NSString>;
33
34        /// The earliest date and time at which to run the task.
35        ///
36        /// Specify `nil` for no start delay.
37        ///
38        /// Setting the property indicates that the background task shouldn’t start any
39        /// earlier than this date. However, the system doesn’t guarantee launching the
40        /// task at the specified date, but only that it won’t begin sooner.
41        #[unsafe(method(earliestBeginDate))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn earliestBeginDate(&self) -> Option<Retained<NSDate>>;
44
45        /// Setter for [`earliestBeginDate`][Self::earliestBeginDate].
46        #[unsafe(method(setEarliestBeginDate:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setEarliestBeginDate(&self, earliest_begin_date: Option<&NSDate>);
49
50        #[unsafe(method(init))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
53
54        #[unsafe(method(new))]
55        #[unsafe(method_family = new)]
56        pub unsafe fn new() -> Retained<Self>;
57    );
58}
59
60extern_class!(
61    /// A request to launch your app in the background to execute a short refresh task.
62    ///
63    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundtasks/bgapprefreshtaskrequest?language=objc)
64    #[unsafe(super(BGTaskRequest, NSObject))]
65    #[derive(Debug, PartialEq, Eq, Hash)]
66    pub struct BGAppRefreshTaskRequest;
67);
68
69unsafe impl NSCopying for BGAppRefreshTaskRequest {}
70
71unsafe impl CopyingHelper for BGAppRefreshTaskRequest {
72    type Result = Self;
73}
74
75unsafe impl NSObjectProtocol for BGAppRefreshTaskRequest {}
76
77impl BGAppRefreshTaskRequest {
78    extern_methods!(
79        /// Return a new refresh task request for the specified identifier.
80        ///
81        /// - Parameters:
82        /// - identifier: The string identifier of the refresh task associated with the request.
83        #[unsafe(method(initWithIdentifier:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithIdentifier(
86            this: Allocated<Self>,
87            identifier: &NSString,
88        ) -> Retained<Self>;
89    );
90}
91
92/// Methods declared on superclass `BGTaskRequest`.
93impl BGAppRefreshTaskRequest {
94    extern_methods!(
95        #[unsafe(method(init))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98
99        #[unsafe(method(new))]
100        #[unsafe(method_family = new)]
101        pub unsafe fn new() -> Retained<Self>;
102    );
103}
104
105extern_class!(
106    /// A request to launch your app in the background to execute a processing task
107    /// that can take minutes to complete.
108    ///
109    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundtasks/bgprocessingtaskrequest?language=objc)
110    #[unsafe(super(BGTaskRequest, NSObject))]
111    #[derive(Debug, PartialEq, Eq, Hash)]
112    pub struct BGProcessingTaskRequest;
113);
114
115unsafe impl NSCopying for BGProcessingTaskRequest {}
116
117unsafe impl CopyingHelper for BGProcessingTaskRequest {
118    type Result = Self;
119}
120
121unsafe impl NSObjectProtocol for BGProcessingTaskRequest {}
122
123impl BGProcessingTaskRequest {
124    extern_methods!(
125        /// Return a new processing task request for the specified identifier.
126        ///
127        /// - Parameters:
128        /// - identifier: The string identifier of the processing task associated with the request.
129        #[unsafe(method(initWithIdentifier:))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn initWithIdentifier(
132            this: Allocated<Self>,
133            identifier: &NSString,
134        ) -> Retained<Self>;
135
136        /// A Boolean specifying if the processing task requires network connectivity.
137        #[unsafe(method(requiresNetworkConnectivity))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn requiresNetworkConnectivity(&self) -> bool;
140
141        /// Setter for [`requiresNetworkConnectivity`][Self::requiresNetworkConnectivity].
142        #[unsafe(method(setRequiresNetworkConnectivity:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setRequiresNetworkConnectivity(&self, requires_network_connectivity: bool);
145
146        /// A Boolean specifying if the processing task requires a device connected to power.
147        #[unsafe(method(requiresExternalPower))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn requiresExternalPower(&self) -> bool;
150
151        /// Setter for [`requiresExternalPower`][Self::requiresExternalPower].
152        #[unsafe(method(setRequiresExternalPower:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setRequiresExternalPower(&self, requires_external_power: bool);
155    );
156}
157
158/// Methods declared on superclass `BGTaskRequest`.
159impl BGProcessingTaskRequest {
160    extern_methods!(
161        #[unsafe(method(init))]
162        #[unsafe(method_family = init)]
163        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
164
165        #[unsafe(method(new))]
166        #[unsafe(method_family = new)]
167        pub unsafe fn new() -> Retained<Self>;
168    );
169}
170
171extern_class!(
172    /// A request to launch your app in the background to execute a health research task for studies a user has opted into and
173    /// that can take minutes to complete.
174    ///
175    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundtasks/bghealthresearchtaskrequest?language=objc)
176    #[unsafe(super(BGProcessingTaskRequest, BGTaskRequest, NSObject))]
177    #[derive(Debug, PartialEq, Eq, Hash)]
178    pub struct BGHealthResearchTaskRequest;
179);
180
181unsafe impl NSCopying for BGHealthResearchTaskRequest {}
182
183unsafe impl CopyingHelper for BGHealthResearchTaskRequest {
184    type Result = Self;
185}
186
187unsafe impl NSObjectProtocol for BGHealthResearchTaskRequest {}
188
189impl BGHealthResearchTaskRequest {
190    extern_methods!(
191        /// A String indicating file protection availability required for processing.
192        #[unsafe(method(protectionTypeOfRequiredData))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn protectionTypeOfRequiredData(&self) -> Retained<NSFileProtectionType>;
195
196        /// Setter for [`protectionTypeOfRequiredData`][Self::protectionTypeOfRequiredData].
197        #[unsafe(method(setProtectionTypeOfRequiredData:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setProtectionTypeOfRequiredData(
200            &self,
201            protection_type_of_required_data: &NSFileProtectionType,
202        );
203    );
204}
205
206/// Methods declared on superclass `BGProcessingTaskRequest`.
207impl BGHealthResearchTaskRequest {
208    extern_methods!(
209        /// Return a new processing task request for the specified identifier.
210        ///
211        /// - Parameters:
212        /// - identifier: The string identifier of the processing task associated with the request.
213        #[unsafe(method(initWithIdentifier:))]
214        #[unsafe(method_family = init)]
215        pub unsafe fn initWithIdentifier(
216            this: Allocated<Self>,
217            identifier: &NSString,
218        ) -> Retained<Self>;
219    );
220}
221
222/// Methods declared on superclass `BGTaskRequest`.
223impl BGHealthResearchTaskRequest {
224    extern_methods!(
225        #[unsafe(method(init))]
226        #[unsafe(method_family = init)]
227        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
228
229        #[unsafe(method(new))]
230        #[unsafe(method_family = new)]
231        pub unsafe fn new() -> Retained<Self>;
232    );
233}