ACLIPSession Class Reference

Inherits from NSObject
Declared in ACLIPSession.h

Overview

An ACLIPSession encapsulates the communication session between the client application and the Aclipsa server. A session MUST be created before any other calls to the AclipsaSDK can occur. An ACLIPInvalidSessionExecption will be thrown if a session has not been created.

  appID

The appID of the active session

var appID: String! { get }
@property (nonatomic, readonly) NSString *appID

Discussion

The appID of the active session

Declared In

ACLIPSession.h

  userID

The userID currently logged into the active session

var userID: String! { get }
@property (nonatomic, readonly) NSString *userID

Discussion

The userID currently logged into the active session

Declared In

ACLIPSession.h

  serverEnvironment

The flag indicating which server should be used. Defaults to ACLIPDevelopmentServer

var serverEnvironment: ACLIPServerEnvironment { get }
@property (nonatomic, readonly) ACLIPServerEnvironment serverEnvironment

Discussion

The flag indicating which server should be used. Defaults to ACLIPDevelopmentServer

Declared In

ACLIPSession.h

+ createSessionWithAppID:serverEnvironment:

An appication may get or set the current active session.

class func createSessionWithAppID(_ appID: String!, serverEnvironment serverType: ACLIPServerEnvironment) -> ACLIPSession
+ (ACLIPSession *)createSessionWithAppID:(NSString *)appID serverEnvironment:(ACLIPServerEnvironment)serverType

Parameters

appID

The id string for the app provided by the AclipsaSDK admin site.

serverType

An ACLIPServerEnvironment value for which server environment should be used.

Return Value

An active ACLIPSession for the appID.

Discussion

An appication may get or set the current active session.

Only one ACLIPSession can be created. Calling createSessionWithAppID: more than once will result in the same object being returned that is initialized to the appID used in the first call to it.

Declared In

ACLIPSession.h

+ activeSession

An appication may get or set the current active session.

class func activeSession() -> ACLIPSession
+ (ACLIPSession *)activeSession

Discussion

An appication may get or set the current active session.

Warning: Important: An ACLIPInvalidSessionExecption will be thrown if a session has not been created first.

Declared In

ACLIPSession.h

– loginWithUserID:completionBlock:errorBlock:

Logs the user with userID in as the user for the session

func loginWithUserID(_ userID: String!, completionBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)loginWithUserID:(NSString *)userID completionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

userID

The id string for the user to be logged in.

completedBlock

A block that gets called upon successfully logging in. completedBlock can be nil if no post login action is required.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Logs the user with userID in as the user for the session

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating.

Declared In

ACLIPSession.h

– logoutWithCompletionBlock:errorBlock:

Logs the user out for the session

func logoutWithCompletionBlock(_ completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)logoutWithCompletionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

completedBlock

A block that gets called upon successfully logging out. completedBlock can be nil if no post login action is required.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Logs the user out for the session

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. Any method that requires a user to be logged in will fail after completion until loginWithUserID:completionBlock:errorBlock: is called again.

Declared In

ACLIPSession.h

– deleteUserWithID:completionBlock:errorBlock:

Deletes the user associated with the session

func deleteUserWithID(_ userID: String!, completionBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)deleteUserWithID:(NSString *)userID completionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

userID

The id string for the user to be deleted.

completedBlock

A block that gets called upon successfully deleting the user. completedBlock can be nil if no post deletion action is required.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Deletes the user associated with the session

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. Any method that requires a user to be logged in will fail after completion until deleteUserWithUserID:completionBlock:errorBlock: is called again.

Declared In

ACLIPSession.h

– uploadVideoAtURL:title:attributes:completeBlock:errorBlock:

Uploads the video file at videoURL.

func uploadVideoAtURL(_ videoURL: NSURL!, title title: String!, attributes attributes: [NSObject: AnyObject]!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPVideo
- (ACLIPVideo *)uploadVideoAtURL:(NSURL *)videoURL title:(NSString *)title attributes:(NSDictionary *)attributes completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

videoURL

A URL that points to the video to be uploaded. Can not be nil.

title

A title for the video.

attributes

The attributes of the video. All values must be of types suppored by NSJSONSerialization.

completedBlock

A block that gets called upon successfully uploading the video.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new video object that represents the video being uploaded.

Discussion

Uploads the video file at videoURL.

The complete block gets called once the video has been successfully transmitted to the Aclipsa Servers and the ACLIPVideo object is put into the ACLIPVideoProcessingState state. Note: The video is not available for playback until the state changes to ACLIPVideoCompletedState from ACLIPVideoProcessingState.

The upload call happens asyncronously. The caller should expect the complete and error blocks to happen at an indeterminate time in the future to properly handle the error and only post successful action that it need to perform.

Declared In

ACLIPSession.h

– uploadVideoAtURL:title:attributes:skipEncoding:completeBlock:errorBlock:

Uploads the video file at videoURL.

func uploadVideoAtURL(_ videoURL: NSURL!, title title: String!, attributes attributes: [NSObject: AnyObject]!, skipEncoding skipEncoding: Bool, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPVideo
- (ACLIPVideo *)uploadVideoAtURL:(NSURL *)videoURL title:(NSString *)title attributes:(NSDictionary *)attributes skipEncoding:(BOOL)skipEncoding completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

videoURL

A URL that points to the video to be uploaded. Can not be nil.

title

A title for the video.

attributes

The attributes of the video. All values must be of types suppored by NSJSONSerialization.

skipEncoding

BOOL to bypass Elemental encoding and encryption.

completedBlock

A block that gets called upon successfully uploading the video.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new video object that represents the video being uploaded.

Discussion

Uploads the video file at videoURL.

The complete block gets called once the video has been successfully transmitted to the Aclipsa Servers and the ACLIPVideo object is put into the ACLIPVideoProcessingState state. Note: The video is not available for playback until the state changes to ACLIPVideoCompletedState from ACLIPVideoProcessingState.

The upload call happens asyncronously. The caller should expect the complete and error blocks to happen at an indeterminate time in the future to properly handle the error and only post successful action that it need to perform.

Declared In

ACLIPSession.h

– loadUserVideoWithID:completionBlock:errorBlock:

Loads the video for the given videoID.

func loadUserVideoWithID(_ videoID: String!, completionBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)loadUserVideoWithID:(NSString *)videoID completionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

videoID

The ID of the video to load.

completedBlock

A block that gets called upon successfully loading the video. The completedBlock parameter will be the ACLIPVideo for the videoID. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Loads the video for the given videoID.

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. The video will be returned as an ACLIPVideo in the completedBlock’s parameter.

Declared In

ACLIPSession.h

– loadUserVideosWithCompletionBlock:errorBlock:

Loads the videos for the logged in user.

func loadUserVideosWithCompletionBlock(_ completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)loadUserVideosWithCompletionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

completedBlock

A block that gets called upon successfully loading the video list. The completeBlock may be called more then once if cached results exist. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Loads the videos for the logged in user.

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. The videos will be returned as an NSArray in the completedBlock’s parameter.

Declared In

ACLIPSession.h

– loadUserVideosWithFilter:completionBlock:errorBlock:

Loads the videos for the logged in user.

func loadUserVideosWithFilter(_ predicate: NSPredicate!, completionBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)loadUserVideosWithFilter:(NSPredicate *)predicate completionBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

predicate

An NSPredicate that will filter the results based the video’s custom attributes. Currently only is equal (==) operators are supported.

completedBlock

A block that gets called upon successfully loading the video list. The completeBlock may be called more then once if cached results exist. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Loads the videos for the logged in user.

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. The videos will be returned as an NSArray in the completedBlock’s parameter.

Declared In

ACLIPSession.h

– loadMessageWithGUID:completeBlock:errorBlock:

Loads the message for the given guid.

func loadMessageWithGUID(_ guid: String!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)loadMessageWithGUID:(NSString *)guid completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

guid

The ID of the message to load.

completedBlock

A block that gets called upon successfully loading the video. The completedBlock parameter will be the ACLIPMessage for the guid. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Loads the message for the given guid.

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. The message will be returned as an ACLIPMessage in the completedBlock’s parameter.

Declared In

ACLIPSession.h

– registerMessageLoadingCompletionBlock:errorBlock:

Registers the completion and error blocks for message loading.

func registerMessageLoadingCompletionBlock(_ completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)registerMessageLoadingCompletionBlock:(ACLIPMessageLoadCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

completedBlock

A block that gets called upon successfully loading the messages list. The first NSArray paramater will return a list of all messages for the user. The second will contain an array of ACLIPMessageThread objects. The completeBlock may be called more then once if cached results exist. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Registers the completion and error blocks for message loading.

The call registers a completion and error block for loading messages. The completion block will be called when ever messages are available. Multiple calls will replace the previous blocks with the new blocks.

Declared In

ACLIPSession.h

– unregisterMessageLoading

Unregisters the completion and error blocks that were registered in registerMessageLoadingCompletionBlock:errorBlock:. The blocks will not be called again.

func unregisterMessageLoading()
- (void)unregisterMessageLoading

Discussion

Unregisters the completion and error blocks that were registered in registerMessageLoadingCompletionBlock:errorBlock:. The blocks will not be called again.

Declared In

ACLIPSession.h

– sendMessage:messageText:recipients:videoURL:completeBlock:errorBlock:

Sends a message to recipients

func sendMessage(_ title: String!, messageText messageText: String!, recipients recipients: [AnyObject]!, videoURL videoURL: NSURL!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPMessage
- (ACLIPMessage *)sendMessage:(NSString *)title messageText:(NSString *)messageText recipients:(NSArray *)recipients videoURL:(NSURL *)videoURL completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

title

An optional title for the message.

messageText

An optional text message that can be included in the message

recipients

An array of recipient user IDs. The array must contain at least one user ID.

videoURL

An optional URL that points to the video to be uploaded.

completedBlock

A block that gets called upon successfully sending the message.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new message object that represents the message being sent.

Discussion

Sends a message to recipients

Declared In

ACLIPSession.h

– sendMessage:messageText:recipients:videoURL:messageGuid:completeBlock:errorBlock:

Sends a message to recipients while providing your own message guid

func sendMessage(_ title: String!, messageText messageText: String!, recipients recipients: [AnyObject]!, videoURL videoURL: NSURL!, messageGuid messageGuid: String!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPMessage
- (ACLIPMessage *)sendMessage:(NSString *)title messageText:(NSString *)messageText recipients:(NSArray *)recipients videoURL:(NSURL *)videoURL messageGuid:(NSString *)messageGuid completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

title

An optional title for the message.

messageText

An optional text message that can be included in the message

recipients

An array of recipient user IDs. The array must contain at least one user ID.

videoURL

An optional URL that points to the video to be uploaded.

messageGuid

An optional message GUID to use for the message.

completedBlock

A block that gets called upon successfully sending the message.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new message object that represents the message being sent.

Discussion

Sends a message to recipients while providing your own message guid

Declared In

ACLIPSession.h

– sendMessage:messageText:recipients:videoURL:skipEncoding:completeBlock:errorBlock:

Sends a message to recipients with the option to skip encoding the video

func sendMessage(_ title: String!, messageText messageText: String, recipients recipients: [AnyObject]!, videoURL videoURL: NSURL!, skipEncoding skipEncoding: Bool, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPMessage
- (ACLIPMessage *)sendMessage:(NSString *)title messageText:(NSString *)messageText recipients:(NSArray *)recipients videoURL:(NSURL *)videoURL skipEncoding:(BOOL)skipEncoding completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

title

An optional title for the message.

messageText

An optional text message that can be included in the message

recipients

An array of recipient user IDs. The array must contain at least one user ID.

videoURL

An optional URL that points to the video to be uploaded.

skipEncoding

BOOL to bypass Elemental encoding and encryption.

completedBlock

A block that gets called upon successfully sending the message.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new message object that represents the message being sent.

Discussion

Sends a message to recipients with the option to skip encoding the video

Declared In

ACLIPSession.h

– sendMessage:messageText:recipients:videoURL:skipEncoding:messageGuid:completeBlock:errorBlock:

Sends a message to recipients with the option to skip encoding the video while providing your own message guid

func sendMessage(_ title: String!, messageText messageText: String!, recipients recipients: [AnyObject]!, videoURL videoURL: NSURL!, skipEncoding skipEncoding: Bool, messageGuid messageGuid: String!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPMessage
- (ACLIPMessage *)sendMessage:(NSString *)title messageText:(NSString *)messageText recipients:(NSArray *)recipients videoURL:(NSURL *)videoURL skipEncoding:(BOOL)skipEncoding messageGuid:(NSString *)messageGuid completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

title

An optional title for the message.

messageText

An optional text message that can be included in the message

recipients

An array of recipient user IDs. The array must contain at least one user ID.

videoURL

An optional URL that points to the video to be uploaded.

skipEncoding

BOOL to bypass Elemental encoding and encryption.

messageGuid

An optional message GUID to use for the message.

completedBlock

A block that gets called upon successfully sending the message.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new message object that represents the message being sent.

Discussion

Sends a message to recipients with the option to skip encoding the video while providing your own message guid

Declared In

ACLIPSession.h

– forwardMessage:messageText:recipients:video:oldMessageGuid:newMessageGuid:completeBlock:errorBlock:

Forwards a message to recipients

func forwardMessage(_ title: String!, messageText messageText: String!, recipients recipients: [AnyObject]!, video video: ACLIPVideo!, oldMessageGuid oldMessageGuid: String!, newMessageGuid newMessageGuid: String!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!) -> ACLIPMessage
- (ACLIPMessage *)forwardMessage:(NSString *)title messageText:(NSString *)messageText recipients:(NSArray *)recipients video:(ACLIPVideo *)video oldMessageGuid:(NSString *)oldMessageGuid newMessageGuid:(NSString *)newMessageGuid completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

title

An optional title for the message.

messageText

An optional text message that can be included in the message

recipients

An array of recipient user IDs. The array must contain at least one user ID.

video

An optional ACLIPVideo belonging to the forwarded message.

oldMessageGuid

The guid of the message that is being forwarded.

newMessageGuid

The guid of the new message=.

completedBlock

A block that gets called upon successfully sending the message.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Return Value

A new message object that represents the message being sent.

Discussion

Forwards a message to recipients

Declared In

ACLIPSession.h

– deleteMessages:completeBlock:errorBlock:

Deletes the ACLIPMessage objects

func deleteMessages(_ messages: [AnyObject]!, completeBlock completedBlock: ACLIPNetworkCompleteBlock!, errorBlock errorBlock: ACLIPNetworkErrorBlock!)
- (void)deleteMessages:(NSArray *)messages completeBlock:(ACLIPNetworkCompleteBlock)completedBlock errorBlock:(ACLIPNetworkErrorBlock)errorBlock

Parameters

messages

An array of ACLIPMessage objects to be deleted.

completedBlock

A block that gets called upon successfully loading the video list. The completeBlock may be called more then once if cached results exist. completedBlock can be nil.

errorBlock

A block that gets called when any error occurs. The error can be either a Foundation network error or an ACLIPNetworkReturnType error. errorBlock can be nil in no error handling is requiried.

Discussion

Deletes the ACLIPMessage objects

The call is asyncronous and either the completedBlock or the errorBlock will be called upon the network connection terminating. The messages are not deleted from the data store until the network connections successfully completes.

Declared In

ACLIPSession.h

– registerAPNSToken:

Register the device to receive push notifications. This should be called inside the application’s “didRegisterForRemoteNotificationsWithDeviceToken” method

func registerAPNSToken(_ deviceToken: NSData!)
- (void)registerAPNSToken:(NSData *)deviceToken

Parameters

deviceToken

The NSData token included in the application’s “didRegisterForRemoteNotificationsWithDeviceToken” method.

Discussion

Register the device to receive push notifications. This should be called inside the application’s “didRegisterForRemoteNotificationsWithDeviceToken” method

Declared In

ACLIPSession.h

– canEncodeVideos

Check for session’s ability to encode videos

func canEncodeVideos() -> Bool
- (BOOL)canEncodeVideos

Return Value

BOOL stating whether or not the session should encode videos.

Discussion

Check for session’s ability to encode videos

Declared In

ACLIPSession.h