SKYDatabase

@interface SKYDatabase : NSObject

Undocumented

  • Undocumented

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSString *_Nonnull databaseID;

    Swift

    var databaseID: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) SKYContainer *_Nonnull container;

    Swift

    var container: SKYContainer { get }
  • Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Undocumented

    Declaration

    Objective-C

    - (void)addOperation:(nonnull SKYDatabaseOperation *)operation;

    Swift

    func add(_ operation: SKYDatabaseOperation)
  • Undocumented

    Declaration

    Objective-C

    - (void)executeOperation:(nonnull SKYDatabaseOperation *)operation;

    Swift

    func execute(_ operation: SKYDatabaseOperation)
  • Undocumented

    Declaration

    Objective-C

    - (void)commit;

    Swift

    func commit()
  • Undocumented

    Declaration

    Objective-C

    - (void)performQuery:(nonnull SKYQuery *)query
        completionHandler:(void (^_Nullable)(NSArray<SKYRecord *> *_Nullable,
                                             NSError *_Nullable))completionHandler;

    Swift

    func perform(_ query: SKYQuery, completionHandler: (([SKYRecord]?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)performCachedQuery:(nonnull SKYQuery *)query
             completionHandler:
                 (void (^_Nullable)(NSArray<SKYRecord *> *_Nullable, BOOL,
                                    NSError *_Nullable))completionHandler;

    Swift

    func performCachedQuery(_ query: SKYQuery, completionHandler: (([SKYRecord]?, Bool, Error?) -> Void)? = nil)
  • Fetches a single record from Skygear.

    Use this method to fetch a single record from Skygear by specifying a . The fetch will be performed asynchronously and will be called when the operation completes.

    This is a convenient method for , which supports fetching multiple records by specifying multiple s.

    Declaration

    Objective-C

    - (void)fetchRecordWithID:(nonnull SKYRecordID *)recordID
            completionHandler:
                (void (^_Nullable)(SKYRecord *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func fetchRecord(with recordID: SKYRecordID, completionHandler: ((SKYRecord?, Error?) -> Void)? = nil)

    Parameters

    recordID

    the record identifier to fetch

    completionHandler

    the block to be called when operation completes.

  • Fetches multiple records from Skygear.

    Use this method to fetch multiple records from Skygear by specifying an array of s. The fetch will be performed asynchronously and will be called when the operation completes.

    This is a convenient method for .

    Declaration

    Objective-C

    - (void)fetchRecordsWithIDs:(nonnull NSArray<SKYRecordID *> *)recordIDs
              completionHandler:
                  (void (^_Nullable)(NSDictionary *_Nullable,
                                     NSError *_Nullable))completionHandler
          perRecordErrorHandler:(void (^_Nullable)(SKYRecordID *_Nullable,
                                                   NSError *_Nullable))errorHandler;

    Swift

    func fetchRecords(with recordIDs: [SKYRecordID], completionHandler: (([AnyHashable : Any]?, Error?) -> Void)?, perRecordErrorHandler errorHandler: ((SKYRecordID?, Error?) -> Void)? = nil)

    Parameters

    recordIDs

    the record identifiers to fetch

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

    errorHandler

    the block to be called when an error occurred to individual record operation

  • Saves a single record to Skygear.

    Use this method to save a single record to Skygear by specifying a . The save will be performed asynchronously and will be called when the operation completes.

    New record will be created in the database while existing record will be modified.

    This is a convenient method for , which supports saving multiple records by specifying multiple s.

    Declaration

    Objective-C

    - (void)saveRecord:(nonnull SKYRecord *)record
            completion:(SKYRecordSaveCompletion _Nullable)completion;

    Swift

    func save(_ record: SKYRecord, completion: SKYRecordSaveCompletion? = nil)

    Parameters

    record

    the record to save

    completion

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

  • Saves multiple records to Skygear.

    Use this method to save multiple record to Skygear by specifying an array of s. The save will be performed asynchronously and will be called when the operation completes.

    New records will be created in the database while existing records will be modified.

    This is a convenient method for .

    Declaration

    Objective-C

    - (void)saveRecords:(nonnull NSArray<SKYRecord *> *)records
            completionHandler:
                (void (^_Nullable)(NSArray *_Nullable,
                                   NSError *_Nullable))completionHandler
        perRecordErrorHandler:(void (^_Nullable)(SKYRecord *_Nullable,
                                                 NSError *_Nullable))errorHandler;

    Swift

    func save(_ records: [SKYRecord], completionHandler: (([Any]?, Error?) -> Void)?, perRecordErrorHandler errorHandler: ((SKYRecord?, Error?) -> Void)? = nil)

    Parameters

    records

    the records to save

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

    errorHandler

    the block to be called when an error occurred to individual record operation

  • Saves multiple records atomically to Skygear.

    The behaviour of this method is identical to saveRecords:completionHandler:perRecordErrorHandler:, except that it also sets the atomic flag on the operation.

    Since the operation either succeeds or fails as a whole, perRecordErrorHandler is omitted.

    Declaration

    Objective-C

    - (void)saveRecordsAtomically:(nonnull NSArray<SKYRecord *> *)records
                completionHandler:
                    (void (^_Nullable)(NSArray *_Nullable,
                                       NSError *_Nullable))completionHandler;

    Swift

    func saveRecordsAtomically(_ records: [SKYRecord], completionHandler: (([Any]?, Error?) -> Void)? = nil)

    Parameters

    records

    the records to save

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

  • Deletes a single record from Skygear.

    Use this method to delete a single record from Skygear by specifying a . The deletion will be performed asynchronously and will be called when the operation completes.

    This is a convenient method for , which supports deleting multiple records by specifying multiple s.

    Declaration

    Objective-C

    - (void)deleteRecordWithID:(nonnull SKYRecordID *)recordID
             completionHandler:
                 (void (^_Nullable)(SKYRecordID *_Nullable,
                                    NSError *_Nullable))completionHandler;

    Swift

    func deleteRecord(with recordID: SKYRecordID, completionHandler: ((SKYRecordID?, Error?) -> Void)? = nil)

    Parameters

    recordID

    the record identifier to delete

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

  • Deletes multiple records from Skygear.

    Use this method to delete multiple records from Skygear by specifying a s. The deletion will be performed asynchronously and will be called when the operation completes.

    This is a convenient method for .

    Declaration

    Objective-C

    - (void)
     deleteRecordsWithIDs:(nonnull NSArray<SKYRecordID *> *)recordIDs
        completionHandler:(void (^_Nullable)(NSArray *_Nullable,
                                             NSError *_Nullable))completionHandler
    perRecordErrorHandler:
        (void (^_Nullable)(SKYRecordID *_Nullable, NSError *_Nullable))errorHandler;

    Swift

    func deleteRecords(with recordIDs: [SKYRecordID], completionHandler: (([Any]?, Error?) -> Void)?, perRecordErrorHandler errorHandler: ((SKYRecordID?, Error?) -> Void)? = nil)

    Parameters

    recordIDs

    the record identifiers to delete

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

    errorHandler

    the block to be called when an error occurred to individual record operation

  • Deletes multiple records atomically to Skygear.

    The behaviour of this method is identical to deleteRecordsWithIDs:completionHandler:perRecordErrorHandler:, except that it also sets the atomic flag on the operation.

    Since the operation either succeeds or fails as a whole, perRecordErrorHandler is omitted.

    Declaration

    Objective-C

    - (void)
    deleteRecordsWithIDsAtomically:(nonnull NSArray<SKYRecordID *> *)recordIDs
                 completionHandler:
                     (void (^_Nullable)(NSArray *_Nullable,
                                        NSError *_Nullable))completionHandler;

    Swift

    func deleteRecords(withIDsAtomically recordIDs: [SKYRecordID], completionHandler: (([Any]?, Error?) -> Void)? = nil)

    Parameters

    recordIDs

    the records to save

    completionHandler

    the block to be called when operation completes. The specified block is also called when an operation error occurred.

  • Undocumented

    Declaration

    Objective-C

    - (void)fetchAllSubscriptionsWithCompletionHandler:
        (void (^_Nullable)(NSArray *_Nullable,
                           NSError *_Nullable))completionHandler;

    Swift

    func fetchAllSubscriptions(completionHandler: (([Any]?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)fetchSubscriptionWithID:(nonnull NSString *)subscriptionID
                  completionHandler:
                      (void (^_Nullable)(SKYSubscription *_Nullable,
                                         NSError *_Nullable))completionHandler;

    Swift

    func fetchSubscription(withID subscriptionID: String, completionHandler: ((SKYSubscription?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)saveSubscription:(nonnull SKYSubscription *)subscription
           completionHandler:
               (void (^_Nullable)(SKYSubscription *_Nullable,
                                  NSError *_Nullable))completionHandler;

    Swift

    func save(_ subscription: SKYSubscription, completionHandler: ((SKYSubscription?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)deleteSubscriptionWithID:(nonnull NSString *)subscriptionID
                   completionHandler:
                       (void (^_Nullable)(NSString *_Nullable,
                                          NSError *_Nullable))completionHandler;

    Swift

    func deleteSubscription(withID subscriptionID: String, completionHandler: ((String?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)uploadAsset:(SKYAsset *_Nonnull)asset
        completionHandler:(void (^_Nullable)(SKYAsset *_Nullable,
                                             NSError *_Nullable))completionHandler;

    Swift

    func uploadAsset(_ asset: SKYAsset, completionHandler: ((SKYAsset?, Error?) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nullable currentUserRecordID;

    Swift

    var currentUserRecordID: String? { get }
  • Undocumented

    Declaration

    Objective-C

    - (void)fetchUserNewsFeed:(nonnull NSString *)newsfeedID
            completionHandler:
                (void (^_Nullable)(SKYRecord *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func fetchUserNewsFeed(_ newsfeedID: String, completionHandler: ((SKYRecord?, Error?) -> Void)? = nil)