objc2_cloud_kit/generated/CKOperationGroup.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
10/// Valid values for expectedSendSize and expectedReceiveSize
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckoperationgrouptransfersize?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CKOperationGroupTransferSize(pub NSInteger);
17impl CKOperationGroupTransferSize {
18 #[doc(alias = "CKOperationGroupTransferSizeUnknown")]
19 pub const Unknown: Self = Self(0);
20 #[doc(alias = "CKOperationGroupTransferSizeKilobytes")]
21 pub const Kilobytes: Self = Self(1);
22 #[doc(alias = "CKOperationGroupTransferSizeMegabytes")]
23 pub const Megabytes: Self = Self(2);
24 #[doc(alias = "CKOperationGroupTransferSizeTensOfMegabytes")]
25 pub const TensOfMegabytes: Self = Self(3);
26 #[doc(alias = "CKOperationGroupTransferSizeHundredsOfMegabytes")]
27 pub const HundredsOfMegabytes: Self = Self(4);
28 #[doc(alias = "CKOperationGroupTransferSizeGigabytes")]
29 pub const Gigabytes: Self = Self(5);
30 #[doc(alias = "CKOperationGroupTransferSizeTensOfGigabytes")]
31 pub const TensOfGigabytes: Self = Self(6);
32 #[doc(alias = "CKOperationGroupTransferSizeHundredsOfGigabytes")]
33 pub const HundredsOfGigabytes: Self = Self(7);
34}
35
36unsafe impl Encode for CKOperationGroupTransferSize {
37 const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for CKOperationGroupTransferSize {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45 /// A mechanism for your app to group several operations at the granularity of a user action.
46 ///
47 ///
48 /// For example, when building a Calendar application, these things might warrant being their own operation groups:
49 /// - an initial fetch of data from the server, consisting of many queries, fetchChanges, and fetch operations
50 /// - doing an incremental fetch of data in response to a push notification
51 /// - saving several records due to a user saving a calendar event
52 ///
53 /// You associate
54 /// `CKOperationGroup`s with
55 /// `CKOperation`s by setting the
56 /// `CKOperation.group`property. Create a new
57 /// `CKOperationGroup`instance for each distinct user action.
58 ///
59 /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckoperationgroup?language=objc)
60 #[unsafe(super(NSObject))]
61 #[derive(Debug, PartialEq, Eq, Hash)]
62 pub struct CKOperationGroup;
63);
64
65unsafe impl NSCoding for CKOperationGroup {}
66
67unsafe impl NSObjectProtocol for CKOperationGroup {}
68
69unsafe impl NSSecureCoding for CKOperationGroup {}
70
71impl CKOperationGroup {
72 extern_methods!(
73 #[unsafe(method(init))]
74 #[unsafe(method_family = init)]
75 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
76
77 #[unsafe(method(initWithCoder:))]
78 #[unsafe(method_family = init)]
79 pub unsafe fn initWithCoder(this: Allocated<Self>, a_decoder: &NSCoder) -> Retained<Self>;
80
81 /// This is an identifier unique to this
82 /// `CKOperationGroup`
83 ///
84 /// This value is chosen by the system, and will be unique to this instance of a
85 /// `CKOperationGroup.`This identifier will be sent to Apple's servers, and can be used to identify any server-side logging associated with this operation group.
86 #[unsafe(method(operationGroupID))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn operationGroupID(&self) -> Retained<NSString>;
89
90 #[cfg(feature = "CKOperation")]
91 /// This is the default configuration applied to operations in this operation group.
92 ///
93 ///
94 /// If an operation associated with this operation group has its own configuration, then any explicitly-set properties in that operation's configuration will override these default configuration values. See the example in CKOperation.h
95 #[unsafe(method(defaultConfiguration))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn defaultConfiguration(&self) -> Retained<CKOperationConfiguration>;
98
99 #[cfg(feature = "CKOperation")]
100 /// Setter for [`defaultConfiguration`][Self::defaultConfiguration].
101 #[unsafe(method(setDefaultConfiguration:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn setDefaultConfiguration(
104 &self,
105 default_configuration: Option<&CKOperationConfiguration>,
106 );
107
108 /// Describes the user action attributed to the operation group.
109 ///
110 ///
111 /// `name`should describe the type of work being done. Some examples:
112 /// "Initial Fetch"
113 /// "Incremental Fetch"
114 /// "Saving User-Entered Record"
115 /// This string will be sent to Apple servers to provide aggregate reporting for
116 /// `CKOperationGroup`s and therefore must not include personally identifying data.
117 #[unsafe(method(name))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn name(&self) -> Option<Retained<NSString>>;
120
121 /// Setter for [`name`][Self::name].
122 #[unsafe(method(setName:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setName(&self, name: Option<&NSString>);
125
126 /// Describes an application-specific "number of elements" associated with the operation group.
127 ///
128 ///
129 /// `quantity`is intended to show the app-specific count of items contained within the operation group. It is your job to assign meaning to this value. For example, if an app created an operation group to save 3 calendar events the user had created, the app might want to set this to "3". This value is not shown to your users, it's meant to aid your development and debugging. This value will be reported in the CloudKit Dashboard's log entries for all operations associated with this operation group.
130 #[unsafe(method(quantity))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn quantity(&self) -> NSUInteger;
133
134 /// Setter for [`quantity`][Self::quantity].
135 #[unsafe(method(setQuantity:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setQuantity(&self, quantity: NSUInteger);
138
139 /// Estimated size of traffic being uploaded to the CloudKit Server
140 ///
141 ///
142 /// Inform the system how much data you plan on transferring. Obviously, these won't be exact. Be as accurate as possible, but even an order-of-magnitude estimate is better than no value. The system will consult these values when scheduling discretionary network requests (see the description of
143 /// `CKOperationConfiguration.qualityOfService).`Overestimating your workload means that an operation group issuing discretionary network requests may be delayed until network conditions are good.
144 /// Underestimating your workload may cause the system to oversaturate a constrained connection, leading to network failures.
145 /// You may update after the
146 /// `CKOperationGroup`is created. If it is increased, then subsequent
147 /// `CKOperation`s associated with this operation group may be delayed until network conditions are good.
148 /// Defaults to
149 /// `CKOperationGroupTransferSizeUnknown`
150 #[unsafe(method(expectedSendSize))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn expectedSendSize(&self) -> CKOperationGroupTransferSize;
153
154 /// Setter for [`expectedSendSize`][Self::expectedSendSize].
155 #[unsafe(method(setExpectedSendSize:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setExpectedSendSize(&self, expected_send_size: CKOperationGroupTransferSize);
158
159 /// Estimated size of traffic being downloaded from the CloudKit Server
160 ///
161 ///
162 /// Inform the system how much data you plan on transferring. Obviously, these won't be exact. Be as accurate as possible, but even an order-of-magnitude estimate is better than no value. The system will consult these values when scheduling discretionary network requests (see the description of
163 /// `CKOperationConfiguration.qualityOfService).`Overestimating your workload means that an operation group issuing discretionary network requests may be delayed until network conditions are good.
164 /// Underestimating your workload may cause the system to oversaturate a constrained connection, leading to network failures.
165 /// You may update after the
166 /// `CKOperationGroup`is created. If it is increased, then subsequent
167 /// `CKOperation`s associated with this operation group may be delayed until network conditions are good.
168 /// Defaults to
169 /// `CKOperationGroupTransferSizeUnknown`
170 #[unsafe(method(expectedReceiveSize))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn expectedReceiveSize(&self) -> CKOperationGroupTransferSize;
173
174 /// Setter for [`expectedReceiveSize`][Self::expectedReceiveSize].
175 #[unsafe(method(setExpectedReceiveSize:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setExpectedReceiveSize(
178 &self,
179 expected_receive_size: CKOperationGroupTransferSize,
180 );
181 );
182}
183
184/// Methods declared on superclass `NSObject`.
185impl CKOperationGroup {
186 extern_methods!(
187 #[unsafe(method(new))]
188 #[unsafe(method_family = new)]
189 pub unsafe fn new() -> Retained<Self>;
190 );
191}