// // CKModifySubscriptionsOperation.h // CloudKit // // Copyright (c) 2014 Apple Inc. All rights reserved. // #import #import NS_HEADER_AUDIT_BEGIN(nullability, sendability) API_AVAILABLE(macos(10.10), ios(8.0), watchos(6.0)) @interface CKModifySubscriptionsOperation : CKDatabaseOperation - (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)initWithSubscriptionsToSave:(nullable NSArray *)subscriptionsToSave subscriptionIDsToDelete:(nullable NSArray *)subscriptionIDsToDelete; @property (nonatomic, copy, nullable) NSArray *subscriptionsToSave; @property (nonatomic, copy, nullable) NSArray *subscriptionIDsToDelete; /*! @abstract Called on success or failure of a subscription save * * @discussion Each @c CKOperation instance has a private serial queue. This queue is used for all callback block invocations. * This block may share mutable state with other blocks assigned to this operation, but any such mutable state * should not be concurrently used outside of blocks assigned to this operation. */ @property (nonatomic, copy, nullable) void (^perSubscriptionSaveBlock)(CKSubscriptionID subscriptionID, CKSubscription * _Nullable subscription, NSError * _Nullable error) API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0)) NS_REFINED_FOR_SWIFT; /*! @abstract Called on success or failure of a subscription deletion * * @discussion Each @c CKOperation instance has a private serial queue. This queue is used for all callback block invocations. * This block may share mutable state with other blocks assigned to this operation, but any such mutable state * should not be concurrently used outside of blocks assigned to this operation. */ @property (nonatomic, copy, nullable) void (^perSubscriptionDeleteBlock)(CKSubscriptionID subscriptionID, NSError * _Nullable error) API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0)) NS_REFINED_FOR_SWIFT; /*! @abstract This block is called when the operation completes. * * @discussion The @code -[NSOperation completionBlock] @endcode will also be called if both are set. * If the error is @c CKErrorPartialFailure, the error's userInfo dictionary contains a dictionary of subscriptionIDs to errors keyed off of @c CKPartialErrorsByItemIDKey. * @c savedSubscriptions, @c deletedSubscriptionIDs and any @c CKPartialErrorsByItemIDKey errors are repeats of the data sent back in previous @c perSubscriptionSaveBlock and @c perSubscriptionDeleteBlock invocations * Each @c CKOperation instance has a private serial queue. This queue is used for all callback block invocations. * This block may share mutable state with other blocks assigned to this operation, but any such mutable state * should not be concurrently used outside of blocks assigned to this operation. */ @property (nonatomic, copy, nullable) void (^modifySubscriptionsCompletionBlock)(NSArray * _Nullable savedSubscriptions, NSArray * _Nullable deletedSubscriptionIDs, NSError * _Nullable operationError); @end NS_HEADER_AUDIT_END(nullability, sendability)