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