objc2_cloud_kit/generated/
CKSyncEngineRecordZoneChangeBatch.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    /// A batch of record zone changes that `CKSyncEngine` will send to the server in a single request.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksyncenginerecordzonechangebatch?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct CKSyncEngineRecordZoneChangeBatch;
17);
18
19unsafe impl Send for CKSyncEngineRecordZoneChangeBatch {}
20
21unsafe impl Sync for CKSyncEngineRecordZoneChangeBatch {}
22
23unsafe impl NSObjectProtocol for CKSyncEngineRecordZoneChangeBatch {}
24
25impl CKSyncEngineRecordZoneChangeBatch {
26    extern_methods!(
27        #[cfg(all(
28            feature = "CKRecord",
29            feature = "CKRecordID",
30            feature = "CKSyncEngineState",
31            feature = "block2"
32        ))]
33        /// Creates a batch of record zone changes according to a list of pending changes.
34        ///
35        /// This will iterate over the pending changes in order and add them to the batch until it reaches the max batch size.
36        ///
37        /// When it sees a pending save, it will ask the record provider for the actual `CKRecord` to send to the server.
38        /// If you return `nil` from the record provider, this will skip to the next pending change.
39        ///
40        /// This will return `nil` if there are no pending changes to send.
41        #[unsafe(method(initWithPendingChanges:recordProvider:))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn initWithPendingChanges_recordProvider(
44            this: Allocated<Self>,
45            pending_changes: &NSArray<CKSyncEnginePendingRecordZoneChange>,
46            record_provider: &block2::Block<dyn Fn(NonNull<CKRecordID>) -> *mut CKRecord + '_>,
47        ) -> Option<Retained<Self>>;
48
49        #[cfg(all(feature = "CKRecord", feature = "CKRecordID"))]
50        /// Creates a batch of record zone changes to send to the server with a specific set of changes.
51        ///
52        /// If you'd like to construct your own custom batches of changes to send to the server, you can do so with this initializer.
53        ///
54        /// ## Batch size limitations
55        ///
56        /// When creating your own batches, you need to consider batch size limitations.
57        /// There is a maximum count and size of records that can be sent to the server in a single batch.
58        /// If you supply too many changes, or if the total size of the records is too large, then you might get a ``CKErrorLimitExceeded``.
59        ///
60        /// > Tip: These batch size limitations are handled automatically by the ``initWithPendingChanges:recordProvider:`` initializer.
61        #[unsafe(method(initWithRecordsToSave:recordIDsToDelete:atomicByZone:))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn initWithRecordsToSave_recordIDsToDelete_atomicByZone(
64            this: Allocated<Self>,
65            records_to_save: Option<&NSArray<CKRecord>>,
66            record_i_ds_to_delete: Option<&NSArray<CKRecordID>>,
67            atomic_by_zone: bool,
68        ) -> Retained<Self>;
69
70        #[unsafe(method(init))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
73
74        #[unsafe(method(new))]
75        #[unsafe(method_family = new)]
76        pub unsafe fn new() -> Retained<Self>;
77
78        #[cfg(feature = "CKRecord")]
79        /// The records to save to the server.
80        #[unsafe(method(recordsToSave))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn recordsToSave(&self) -> Retained<NSArray<CKRecord>>;
83
84        #[cfg(feature = "CKRecordID")]
85        /// The IDs of the records to delete from the server.
86        #[unsafe(method(recordIDsToDelete))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn recordIDsToDelete(&self) -> Retained<NSArray<CKRecordID>>;
89
90        /// If set to true, the sync engine will modify these records atomically by zone.
91        ///
92        /// If this is true, and if any record change fails, then any other changes from that zone in this batch will also fail with ``CKErrorBatchRequestFailed``.
93        ///
94        /// Records that exist in different zones will not be modified together atomically.
95        #[unsafe(method(atomicByZone))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn atomicByZone(&self) -> bool;
98
99        /// Setter for [`atomicByZone`][Self::atomicByZone].
100        #[unsafe(method(setAtomicByZone:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setAtomicByZone(&self, atomic_by_zone: bool);
103    );
104}