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
65extern_conformance!(
66    unsafe impl NSCoding for CKOperationGroup {}
67);
68
69extern_conformance!(
70    unsafe impl NSCopying for CKOperationGroup {}
71);
72
73unsafe impl CopyingHelper for CKOperationGroup {
74    type Result = Self;
75}
76
77extern_conformance!(
78    unsafe impl NSObjectProtocol for CKOperationGroup {}
79);
80
81extern_conformance!(
82    unsafe impl NSSecureCoding for CKOperationGroup {}
83);
84
85impl CKOperationGroup {
86    extern_methods!(
87        #[unsafe(method(init))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
90
91        /// # Safety
92        ///
93        /// `a_decoder` possibly has further requirements.
94        #[unsafe(method(initWithCoder:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithCoder(this: Allocated<Self>, a_decoder: &NSCoder) -> Retained<Self>;
97
98        /// This is an identifier unique to this
99        /// `CKOperationGroup`
100        ///
101        /// This value is chosen by the system, and will be unique to this instance of a
102        /// `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.
103        #[unsafe(method(operationGroupID))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn operationGroupID(&self) -> Retained<NSString>;
106
107        #[cfg(feature = "CKOperation")]
108        /// This is the default configuration applied to operations in this operation group.
109        ///
110        ///
111        /// 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
112        #[unsafe(method(defaultConfiguration))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn defaultConfiguration(&self) -> Retained<CKOperationConfiguration>;
115
116        #[cfg(feature = "CKOperation")]
117        /// Setter for [`defaultConfiguration`][Self::defaultConfiguration].
118        ///
119        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
120        #[unsafe(method(setDefaultConfiguration:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setDefaultConfiguration(
123            &self,
124            default_configuration: Option<&CKOperationConfiguration>,
125        );
126
127        /// Describes the user action attributed to the operation group.
128        ///
129        ///
130        /// `name`should describe the type of work being done.  Some examples:
131        /// "Initial Fetch"
132        /// "Incremental Fetch"
133        /// "Saving User-Entered Record"
134        /// This string will be sent to Apple servers to provide aggregate reporting for
135        /// `CKOperationGroup`s and therefore must not include personally identifying data.
136        #[unsafe(method(name))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
139
140        /// Setter for [`name`][Self::name].
141        ///
142        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
143        #[unsafe(method(setName:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setName(&self, name: Option<&NSString>);
146
147        /// Describes an application-specific "number of elements" associated with the operation group.
148        ///
149        ///
150        /// `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.
151        #[unsafe(method(quantity))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn quantity(&self) -> NSUInteger;
154
155        /// Setter for [`quantity`][Self::quantity].
156        #[unsafe(method(setQuantity:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setQuantity(&self, quantity: NSUInteger);
159
160        /// Estimated size of traffic being uploaded to the CloudKit Server
161        ///
162        ///
163        /// 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
164        /// `CKOperationConfiguration.qualityOfService).`Overestimating your workload means that an operation group issuing discretionary network requests may be delayed until network conditions are good.
165        /// Underestimating your workload may cause the system to oversaturate a constrained connection, leading to network failures.
166        /// You may update after the
167        /// `CKOperationGroup`is created.  If it is increased, then subsequent
168        /// `CKOperation`s associated with this operation group may be delayed until network conditions are good.
169        /// Defaults to
170        /// `CKOperationGroupTransferSizeUnknown`
171        #[unsafe(method(expectedSendSize))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn expectedSendSize(&self) -> CKOperationGroupTransferSize;
174
175        /// Setter for [`expectedSendSize`][Self::expectedSendSize].
176        #[unsafe(method(setExpectedSendSize:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn setExpectedSendSize(&self, expected_send_size: CKOperationGroupTransferSize);
179
180        /// Estimated size of traffic being downloaded from the CloudKit Server
181        ///
182        ///
183        /// 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
184        /// `CKOperationConfiguration.qualityOfService).`Overestimating your workload means that an operation group issuing discretionary network requests may be delayed until network conditions are good.
185        /// Underestimating your workload may cause the system to oversaturate a constrained connection, leading to network failures.
186        /// You may update after the
187        /// `CKOperationGroup`is created.  If it is increased, then subsequent
188        /// `CKOperation`s associated with this operation group may be delayed until network conditions are good.
189        /// Defaults to
190        /// `CKOperationGroupTransferSizeUnknown`
191        #[unsafe(method(expectedReceiveSize))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn expectedReceiveSize(&self) -> CKOperationGroupTransferSize;
194
195        /// Setter for [`expectedReceiveSize`][Self::expectedReceiveSize].
196        #[unsafe(method(setExpectedReceiveSize:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setExpectedReceiveSize(
199            &self,
200            expected_receive_size: CKOperationGroupTransferSize,
201        );
202    );
203}
204
205/// Methods declared on superclass `NSObject`.
206impl CKOperationGroup {
207    extern_methods!(
208        #[unsafe(method(new))]
209        #[unsafe(method_family = new)]
210        pub unsafe fn new() -> Retained<Self>;
211    );
212}