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