]> git.saurik.com Git - apple/security.git/blob - keychain/ckks/CloudKitDependencies.h
d3bb1b3fa21f1eb0d176603f251afd3cfc2835d1
[apple/security.git] / keychain / ckks / CloudKitDependencies.h
1 /*
2 * Copyright (c) 2016 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef CloudKitDependencies_h
25 #define CloudKitDependencies_h
26
27 #import <Foundation/Foundation.h>
28 #import <CloudKit/CloudKit.h>
29 #import <ApplePushService/ApplePushService.h>
30
31 NS_ASSUME_NONNULL_BEGIN
32
33 /* CKModifyRecordZonesOperation */
34 @protocol CKKSModifyRecordZonesOperation <NSObject>
35 + (instancetype)alloc;
36 - (instancetype)initWithRecordZonesToSave:(nullable NSArray<CKRecordZone *> *)recordZonesToSave recordZoneIDsToDelete:(nullable NSArray<CKRecordZoneID *> *)recordZoneIDsToDelete;
37
38 @property (nonatomic, strong, nullable) CKDatabase *database;
39 @property (nonatomic, copy, nullable) NSArray<CKRecordZone *> *recordZonesToSave;
40 @property (nonatomic, copy, nullable) NSArray<CKRecordZoneID *> *recordZoneIDsToDelete;
41 @property NSOperationQueuePriority queuePriority;
42 @property NSQualityOfService qualityOfService;
43
44 @property (nonatomic, copy, nullable) void (^modifyRecordZonesCompletionBlock)(NSArray<CKRecordZone *> * _Nullable savedRecordZones, NSArray<CKRecordZoneID *> * _Nullable deletedRecordZoneIDs, NSError * _Nullable operationError);
45
46 @end
47
48 @interface CKModifyRecordZonesOperation (SecCKKSModifyRecordZonesOperation) <CKKSModifyRecordZonesOperation>;
49 @end
50
51 /* CKModifySubscriptionsOperation */
52 @protocol CKKSModifySubscriptionsOperation <NSObject>
53 + (instancetype)alloc;
54 - (instancetype)initWithSubscriptionsToSave:(nullable NSArray<CKSubscription *> *)subscriptionsToSave subscriptionIDsToDelete:(nullable NSArray<NSString *> *)subscriptionIDsToDelete;
55
56 @property (nonatomic, strong, nullable) CKDatabase *database;
57 @property (nonatomic, copy, nullable) NSArray<CKSubscription *> *subscriptionsToSave;
58 @property (nonatomic, copy, nullable) NSArray<NSString *> *subscriptionIDsToDelete;
59 @property NSOperationQueuePriority queuePriority;
60 @property NSQualityOfService qualityOfService;
61 @property (nonatomic, strong, nullable) CKOperationGroup *group;
62
63 @property (nonatomic, copy, nullable) void (^modifySubscriptionsCompletionBlock)(NSArray<CKSubscription *> * _Nullable savedSubscriptions, NSArray<NSString *> * _Nullable deletedSubscriptionIDs, NSError * _Nullable operationError);
64 @end
65
66 @interface CKModifySubscriptionsOperation (SecCKKSModifySubscriptionsOperation) <CKKSModifySubscriptionsOperation>;
67 @end
68
69 /* CKFetchRecordZoneChangesOperation */
70 @protocol CKKSFetchRecordZoneChangesOperation <NSObject>
71 + (instancetype)alloc;
72 - (instancetype)initWithRecordZoneIDs:(NSArray<CKRecordZoneID *> *)recordZoneIDs optionsByRecordZoneID:(nullable NSDictionary<CKRecordZoneID *, CKFetchRecordZoneChangesOptions *> *)optionsByRecordZoneID;
73
74 @property (nonatomic, copy, nullable) NSArray<CKRecordZoneID *> *recordZoneIDs;
75 @property (nonatomic, copy, nullable) NSDictionary<CKRecordZoneID *, CKFetchRecordZoneChangesOptions *> *optionsByRecordZoneID;
76
77 @property (nonatomic, assign) BOOL fetchAllChanges;
78 @property (nonatomic, copy, nullable) void (^recordChangedBlock)(CKRecord *record);
79 @property (nonatomic, copy, nullable) void (^recordWithIDWasDeletedBlock)(CKRecordID *recordID, NSString *recordType);
80 @property (nonatomic, copy, nullable) void (^recordZoneChangeTokensUpdatedBlock)(CKRecordZoneID *recordZoneID, CKServerChangeToken * _Nullable serverChangeToken, NSData * _Nullable clientChangeTokenData);
81 @property (nonatomic, copy, nullable) void (^recordZoneFetchCompletionBlock)(CKRecordZoneID *recordZoneID, CKServerChangeToken * _Nullable serverChangeToken, NSData * _Nullable clientChangeTokenData, BOOL moreComing, NSError * _Nullable recordZoneError);
82 @property (nonatomic, copy, nullable) void (^fetchRecordZoneChangesCompletionBlock)(NSError * _Nullable operationError);
83
84 @property (nonatomic, strong, nullable) CKOperationGroup *group;
85 @end
86
87 @interface CKFetchRecordZoneChangesOperation () <CKKSFetchRecordZoneChangesOperation>;
88 @end
89
90 /* APSConnection */
91 @protocol CKKSAPSConnection <NSObject>
92 + (instancetype)alloc;
93 - (id)initWithEnvironmentName:(NSString *)environmentName namedDelegatePort:(NSString*)namedDelegatePort queue:(dispatch_queue_t)queue;
94
95 - (void)setEnabledTopics:(NSArray *)enabledTopics;
96
97 @property (nonatomic, readwrite, assign) id<APSConnectionDelegate> delegate;
98 @end
99
100 @interface APSConnection (SecCKKSAPSConnection) <CKKSAPSConnection>;
101 @end
102
103 /* NSNotificationCenter */
104 @protocol CKKSNSNotificationCenter <NSObject>
105 + (instancetype)defaultCenter;
106 - (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject;
107 - (void)removeObserver:(id)observer;
108 @end
109 @interface NSNotificationCenter () <CKKSNSNotificationCenter>
110 @end
111
112 /* Since CKDatabase doesn't share any types with NSOperationQueue, tell the type system about addOperation */
113 @protocol CKKSOperationQueue <NSObject>
114 - (void)addOperation:(NSOperation *)operation;
115 @end
116
117 @interface CKDatabase () <CKKSOperationQueue>;
118 @end
119
120 @interface NSOperationQueue () <CKKSOperationQueue>;
121 @end
122
123 NS_ASSUME_NONNULL_END
124
125 #endif /* CloudKitDependencies_h */