Inherits from NSObject
Declared in NMBServer.h

Overview

NMBServer represents an app of Google Drive, Dropbox or Box.

Properties

authState

Indicates the current state of NMBServer in authentication flow.

@property (nonatomic, readonly) NMBAuthState authState

Declared In

NMBServer+Auth.h

isInitialized

Indicates whether the server is initialized. Only when this property is YES, you can call CRUD method.

@property (nonatomic, readonly, assign) BOOL isInitialized

Declared In

NMBServer+Client.h

isReadyToIPush

Indicates if the server is ready to push your changes to cloud immediately.

@property (nonatomic, readonly) BOOL isReadyToIPush

Discussion

“iPush” is short for “immediately push”. Different from synchronization, iPush only push local changes to cloud without fetching changes from cloud. And every time you save the tracked NSManagedContext, iPush is fired. To active iPush, server need to acquire directory structure of the root folder. In most cases, this means you need to sync at least once.

Declared In

NMBServer+Sync.h

isResetingCloud

Indicates if the server is being reset or not.

@property (nonatomic, readonly) BOOL isResetingCloud

Declared In

NMBServer+Sync.h

isSynchronizing

Indicates if the server is synchronizing or not.

@property (nonatomic, readonly) BOOL isSynchronizing

Declared In

NMBServer+Sync.h

resetCloudPromise

The on going cloud reset promise.

@property (nonatomic, readonly) NMBPromise *resetCloudPromise

Declared In

NMBServer+Sync.h

root

The root folder of the server.

@property (nonatomic, readonly, strong) NMBFile *root

Declared In

NMBServer+Client.h

syncPromise

The on going synchronization promise.

@property (nonatomic, readonly) NMBPromise *syncPromise

Declared In

NMBServer+Sync.h

Instance Methods

authorizeWithController:

Authenticate with a instance of UIViewController can interact with user.

- (BOOL)authorizeWithController:(UIViewController *)controller

Parameters

controller

The instance of UIViewController will present the authentication controller.

Return Value

Indicates whether the server is in proper state and can authenticate with UIViewController.

Declared In

NMBServer+Auth.h

createFileWithForm:inParent:

Create a file or a folder in location where parent represents.

- (NMBPromise *)createFileWithForm:(NMBFileForm *)form inParent:(NMBFile *)parent

Parameters

form

The information collection of the file will be created. For example, if it is a file or a folder.

parent

Indicates the location where the new file will be.

Return Value

An object to manage netwrok operation. See NMBPromise.

Declared In

NMBServer+Client.h

deleteFile:

Delete a file or a folder parameter file represents.

- (NMBPromise *)deleteFile:(NMBFile *)file

Parameters

file

The file you want to delete.

Return Value

An object to manage netwrok operation. See NMBPromise.

Declared In

NMBServer+Client.h

firePromise:

Instead of go method of NMBPromise, we recommand you to fire a promise with this method if the promise itself is related to an instance of NMBServer (e.g. CRUD file on cloud server).

- (void)firePromise:(NMBPromise *)promise

Parameters

promise

The promise you want to fire.

Declared In

NMBServer+Client.h

prmoisesForFilesBeingCreatedInParent:

Query the on going promises for file creation in specific parent folder.

- (NSArray *)prmoisesForFilesBeingCreatedInParent:(NMBFile *)parent

Parameters

parent

The specific parent folder.

Return Value

An array of eligible promises.

Declared In

NMBServer+Client.h

promisesForFile:methods:

Delete a file or a folder parameter file represents.

- (NSArray *)promisesForFile:(NMBFile *)file methods:(NSSet *)methods

Parameters

file

The file you want to query on.

methods

The promises with which methods you want to select. Should be chosen in NValMethodRetrieve, NValMethodUpdate or NValMethodDelete.

Return Value

An array of eligible promises.

Declared In

NMBServer+Client.h

renameFile:withForm:

Rename a file.

- (NMBPromise *)renameFile:(NMBFile *)file withForm:(NMBFileForm *)form

Parameters

file

The file you want to rename.

form

The information collection contains the new name.

Return Value

An object to manage netwrok operation. See NMBPromise.

Declared In

NMBServer+Client.h

resetCloud

Reset the reciever.

- (NMBPromise *)resetCloud

Return Value

The reseting promise.

Discussion

Different from file promise, the returned resetting promise is fired immediately after you calling this method. This method eliminates all the object and binary files managed by nimbus base on cloud.

Declared In

NMBServer+Sync.h

retrieveFile:

Retrieve the content of the file. For a folder, content means it’s children files. For a file, content means an instance of NSData, which contains an image or something else.

- (NMBPromise *)retrieveFile:(NMBFile *)file

Parameters

file

The file you want to retrieve.

Return Value

An object to manage netwrok operation. See NMBPromise.

Declared In

NMBServer+Client.h

signOut

Sign out.

- (void)signOut

Declared In

NMBServer+Auth.h

synchronize

Synchronize with this cloud server.

- (NMBPromise *)synchronize

Return Value

The synchronization promise.

Discussion

Different from file promise, the returned sync promise is fired immediately after you calling this method. This method invokes synchronizeWithOptions: with NMBSyncCommitTypeNormal for key NMBSyncCommitType as options.

Declared In

NMBServer+Sync.h

synchronizeWithOptions:

Synchronize with this cloud server with the options.

- (NMBPromise *)synchronizeWithOptions:(NSDictionary *)options

Parameters

options

A dictionary containing key-value pairs that specify how the synchronization calculates which objects should be created, updated or deleted. This value may be nil.

Return Value

The synchronization promise.

See Also

Declared In

NMBServer+Sync.h

updateFile:withForm:

Update a file.

- (NMBPromise *)updateFile:(NMBFile *)file withForm:(NMBFileForm *)form

Parameters

file

The file you want to update, should not represent folder.

form

The information collection of the file’s change.

Return Value

An object to manage netwrok operation. See NMBPromise.

Declared In

NMBServer+Client.h