objc2_background_assets/generated/
BADownload.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
9/// [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownloadstate?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct BADownloadState(pub NSInteger);
14impl BADownloadState {
15    #[doc(alias = "BADownloadStateFailed")]
16    pub const Failed: Self = Self(-1);
17    #[doc(alias = "BADownloadStateCreated")]
18    pub const Created: Self = Self(0);
19    #[doc(alias = "BADownloadStateWaiting")]
20    pub const Waiting: Self = Self(1);
21    #[doc(alias = "BADownloadStateDownloading")]
22    pub const Downloading: Self = Self(2);
23    #[doc(alias = "BADownloadStateFinished")]
24    pub const Finished: Self = Self(3);
25}
26
27unsafe impl Encode for BADownloadState {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for BADownloadState {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// A download's priority
36///
37/// The priority applied to a given download or group of downloads. This is a range from `BADownloaderPriorityMin` to `BADownloaderPriorityMax`.
38/// The priority only applies to how downloads are ordered for your application. Higher priority items will be enqued for download before lower priority items regardless of order in which they are scheduled.
39///
40/// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownloaderpriority?language=objc)
41// NS_TYPED_EXTENSIBLE_ENUM
42pub type BADownloaderPriority = NSInteger;
43
44extern "C" {
45    /// A value that represents the lowest priority for a download.
46    ///
47    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownloaderprioritymin?language=objc)
48    pub static BADownloaderPriorityMin: BADownloaderPriority;
49}
50
51extern "C" {
52    /// A value that represents average priority for a download.
53    ///
54    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownloaderprioritydefault?language=objc)
55    pub static BADownloaderPriorityDefault: BADownloaderPriority;
56}
57
58extern "C" {
59    /// A value that represents the highest priority for a download.
60    ///
61    /// See also [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownloaderprioritymax?language=objc)
62    pub static BADownloaderPriorityMax: BADownloaderPriority;
63}
64
65extern_class!(
66    /// [Apple's documentation](https://developer.apple.com/documentation/backgroundassets/badownload?language=objc)
67    #[unsafe(super(NSObject))]
68    #[derive(Debug, PartialEq, Eq, Hash)]
69    pub struct BADownload;
70);
71
72unsafe impl Send for BADownload {}
73
74unsafe impl Sync for BADownload {}
75
76extern_conformance!(
77    unsafe impl NSCoding for BADownload {}
78);
79
80extern_conformance!(
81    unsafe impl NSCopying for BADownload {}
82);
83
84unsafe impl CopyingHelper for BADownload {
85    type Result = Self;
86}
87
88extern_conformance!(
89    unsafe impl NSObjectProtocol for BADownload {}
90);
91
92extern_conformance!(
93    unsafe impl NSSecureCoding for BADownload {}
94);
95
96impl BADownload {
97    extern_methods!(
98        /// The current state of the respresented download.
99        #[unsafe(method(state))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn state(&self) -> BADownloadState;
102
103        /// A client defined identifier that uniquely identifies this asset.
104        #[unsafe(method(identifier))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn identifier(&self) -> Retained<NSString>;
107
108        /// A UUID that uniquely identifies the download object.
109        #[unsafe(method(uniqueIdentifier))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn uniqueIdentifier(&self) -> Retained<NSString>;
112
113        /// A client set priority to try to order downloads in order of importance
114        #[unsafe(method(priority))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn priority(&self) -> BADownloaderPriority;
117
118        /// Whether this download is essential.
119        /// Essential downloads will occur while the app is being installed. Users cannot launch the app while these downloads are occurring.
120        /// Essential downloads cannot be scheduled with `BADownloadManager`, they may only be scheduled from the extension with
121        /// a `BAContentRequest` type of `Update` or `Install`.
122        /// Essential downloads must have an accurate `fileSize` or they will fail.
123        #[unsafe(method(isEssential))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn isEssential(&self) -> bool;
126
127        /// Copies an existing download ensuring that it has `isEssential == false`.
128        ///
129        /// This serves as a convenience method for constructing a non-essential representation of an existing
130        /// download. It is important to note that essential downloads can only be enqueued by
131        /// the app extension during a content request. If an essential download fails, `copyAsNonEssential`
132        /// can be used to create a copy with `isEssential == false` that can be re-queued with `BADownloadManager`.
133        #[unsafe(method(copyAsNonEssential))]
134        #[unsafe(method_family = copy)]
135        pub unsafe fn copyAsNonEssential(&self) -> Retained<Self>;
136
137        #[unsafe(method(init))]
138        #[unsafe(method_family = init)]
139        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
140
141        #[unsafe(method(new))]
142        #[unsafe(method_family = new)]
143        pub unsafe fn new() -> Retained<Self>;
144    );
145}