-
Notifications
You must be signed in to change notification settings - Fork 1
/
CKObjectBase.h
70 lines (48 loc) · 4.46 KB
/
CKObjectBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// CKObject.h
// Ringo
//
// Created by Alexander Ivanov on 27.06.15.
// Copyright (c) 2015 Alexander Ivanov. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CKDatabase+Convenience.h"
#import "CloudKit+Convenience.h"
@import CloudKit;
@protocol CKObjectBase <NSObject>
- (instancetype)initWithRecordFields:(NSDictionary *)recordFields;
- (NSDictionary *)recordFields;
@optional
- (NSString *)recordName;
- (NSString *)recordType;
- (void)load:(void(^)(void))completion;
@end
@interface CKObjectBase : NSObject <CKObjectBase>
@property (strong, nonatomic, readonly) CKRecord *record;
- (instancetype)initWithRecord:(CKRecord *)record;
//- (void)save:(CKDatabase *)database;
//- (void)save;
- (CKModifyRecordsOperation *)remove:(CKDatabase *)database completion:(void (^)(NSString *deletedRecordName))completion;
- (CKModifyRecordsOperation *)remove:(void (^)(NSString *deletedRecordName))completion;
- (CKModifyRecordsOperation *)update:(CKDatabase *)database completion:(void (^)(__kindof CKObjectBase *savedObject))completion;
- (CKModifyRecordsOperation *)update:(void (^)(__kindof CKObjectBase *savedObject))completion;
- (CKReference *)reference:(CKReferenceAction)action;
- (CKReference *)reference;
+ (CKQueryOperation *)fetch:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit allowsCellularAccess:(BOOL)allowsCellularAccess database:(CKDatabase *)database completion:(void(^)(CKRecord *record))completion;
+ (CKQueryOperation *)fetch:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit allowsCellularAccess:(BOOL)allowsCellularAccess completion:(void(^)(CKRecord *record))completion;
+ (CKQueryOperation *)fetch:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit completion:(void(^)(CKRecord *record))completion;
+ (CKQueryOperation *)fetch:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors completion:(void(^)(CKRecord *record))completion;
+ (CKQueryOperation *)fetch:(NSPredicate *)predicate completion:(void(^)(CKRecord *record))completion;
+ (CKQueryOperation *)query:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit allowsCellularAccess:(BOOL)allowsCellularAccess database:(CKDatabase *)database completion:(void(^)(NSArray<__kindof CKObjectBase *> *results))completion;
+ (CKQueryOperation *)query:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit allowsCellularAccess:(BOOL)allowsCellularAccess completion:(void(^)(NSArray<__kindof CKObjectBase *> *results))completion;
+ (CKQueryOperation *)query:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors resultsLimit:(NSUInteger)resultsLimit completion:(void(^)(NSArray<__kindof CKObjectBase *> *results))completion;
+ (CKQueryOperation *)query:(NSPredicate *)predicate sortDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors completion:(void(^)(NSArray<__kindof CKObjectBase *> *results))completion;
+ (CKQueryOperation *)query:(NSPredicate *)predicate completion:(void(^)(NSArray<__kindof CKObjectBase *> *results))completion;
+ (CKQueryOperation *)findByRecordID:(CKRecordID *)recordID allowsCellularAccess:(BOOL)allowsCellularAccess completion:(void(^)(__kindof CKObjectBase *result))completion;
+ (CKQueryOperation *)findByRecordID:(CKRecordID *)recordID completion:(void(^)(__kindof CKObjectBase *result))completion;
+ (CKQueryOperation *)loadByRecordID:(CKRecordID *)recordID allowsCellularAccess:(BOOL)allowsCellularAccess completion:(void(^)(__kindof CKObjectBase *result))completion;
+ (CKQueryOperation *)loadByRecordID:(CKRecordID *)recordID completion:(void(^)(__kindof CKObjectBase *result))completion;
+ (CKSubscription *)subscriptionWithPredicate:(NSPredicate *)predicate ID:(NSString *)ID options:(CKQuerySubscriptionOptions)options notificationInfo:(CKNotificationInfo *)notificationInfo;
+ (CKSubscription *)saveSubscriptionWithPredicate:(NSPredicate *)predicate options:(CKQuerySubscriptionOptions)options database:(CKDatabase *)database notificationInfo:(CKNotificationInfo *)notificationInfo;
+ (CKSubscription *)saveSubscriptionWithPredicate:(NSPredicate *)predicate options:(CKQuerySubscriptionOptions)options notificationInfo:(CKNotificationInfo *)notificationInfo;
@end