QiscusCore
public class QiscusCore : NSObject
Undocumented
-
Undocumented
Declaration
Swift
public static let shared: QiscusCore -
Undocumented
Declaration
Swift
public static var dataStore: QiscusStorage -
Undocumented
Declaration
Swift
public static var database: QiscusDatabaseManager -
Undocumented
Declaration
Swift
public static var delegate: QiscusCoreDelegate? { get set } -
Undocumented
Declaration
Swift
public static var enableDebugPrint: Bool -
set your app Qiscus APP ID, always set app ID everytime your app lounch. \nAfter login successculy, no need to setup again
Declaration
Swift
public class func setup(WithAppID id: String)Parameters
WithAppIDQiscus SDK App ID
-
Connect to qiscus server
Declaration
Swift
public class func connect(delegate: QiscusConnectionDelegate? = nil) -> BoolParameters
delegateqiscuscore delegate to listen the event
Return Value
true if success connect, please make sure you already login before connect.
-
Setup custom server, when you use Qiscus on premise
Declaration
Swift
public class func set(customServer: URL, realtimeServer: String?, realtimePort port: Int?)Parameters
customServeryour custom server host
realtimeServeryour qiscus realtime host, without port
realtimePortyour qiscus realtime port
-
Get Nonce from SDK server. use when login with JWT
Declaration
Swift
public class func getNonce(completion: @escaping (QNonce?, String?) -> Void)Parameters
completion@escaping with Optional(QNonce) and String Optional(error)
-
SDK Connect with userId and passkey. The handler to be called once the request has finished.
- userKey : user password
Declaration
Swift
public class func login(userID: String, userKey: String, completion: @escaping (UserModel?, String?) -> Void)Parameters
userIDmust be unique per appid, exm: email, phonenumber, udid.
completionThe code to be executed once the request has finished, also give a user object and error.
-
connect with identityToken, after use nonce and JWT
Declaration
Parameters
tokenidentity token from your server, when you implement Nonce or JWT
completionThe code to be executed once the request has finished, also give a user object and error.
-
Disconnect or logout
Declaration
Swift
public static func logout(completion: @escaping (QError?) -> Void)Parameters
completionHandlerThe code to be executed once the request has finished, also give a user object and error.
-
check already logined
Declaration
Swift
public static var isLogined: Bool { get }Return Value
return true if already login
-
Register device token Apns or Pushkit
Declaration
Swift
public func register(deviceToken : String, completion: @escaping (Bool, QError?) -> Void)Parameters
deviceTokendevice token
completionThe code to be executed once the request has finished
-
Remove device token
Declaration
Swift
public func remove(deviceToken : String, completion: @escaping (Bool, QError?) -> Void)Parameters
deviceTokendevice token
completionThe code to be executed once the request has finished
-
Sync comment
Declaration
Swift
public func sync(lastCommentReceivedId id: String = "", order: String = "", limit: Int = 20, completion: @escaping ([CommentModel]?, QError?) -> Void)Parameters
lastCommentReceivedIdlast comment id, to get id you can call QiscusCore.dataStore.getComments().
orderasc
ordesc
only, lowercase. If other than that, it will assumed todesc
limitlimit number of comment by default 20
completionreturn object array of comment and return error if exist
-
get qiscus user from local storage
Declaration
Swift
public static func getProfile() -> UserModel?Return Value
return nil when client not logined, and return object user when already logined
-
Start or stop typing in room,
Declaration
Swift
public func isTyping(_ value: Bool, roomID: String, keepTyping: UInt16? = nil)Parameters
valueset true if user start typing, and false when finish
roomIDroom id where you typing
keepTypingautomatic false after n second
-
Set Online or offline
Declaration
Swift
public func isOnline(_ value: Bool)Parameters
valuetrue if user online and false if offline
-
Get total unreac count by user
Declaration
Swift
public func unreadCount(completion: @escaping (Int, QError?) -> Void)Parameters
completionnumber of unread cout for all room
-
Block Qiscus User
Declaration
Swift
public func blockUser(email: String, completion: @escaping (MemberModel?, QError?) -> Void)Parameters
emailqiscus email user
completionResponse object user and error if exist
-
Unblock Qiscus User
Declaration
Swift
public func unblockUser(email: String, completion: @escaping (MemberModel?, QError?) -> Void)Parameters
emailqiscus email user
completionResponse object user and error if exist
-
Get blocked user
Declaration
Swift
public func listBlocked(page: Int?, limit:Int?, completion: @escaping ([MemberModel]?, QError?) -> Void)Parameters
pagepage for pagination
limitlimit per page
completionResponse array of object user and error if exist
-
Upload to qiscus server
Declaration
Parameters
datadata file to upload
filenamefile Name
onSuccessreturn object file model when success
onErrorreturn QError
progressprogress upload
-
Download
Declaration
Swift
public func download(url: URL, onSuccess: @escaping (URL) -> Void, onProgress: @escaping (Float) -> Void)Parameters
urlurl you want to download
onSuccessresturn local url after success download
onProgressprogress download
-
Undocumented
Declaration
Swift
public func sendMessage(roomID id: String, comment: CommentModel, completion: @escaping (CommentModel?, QError?) -> Void) -
Load Comment by room
Declaration
Swift
public func loadComments(roomID id: String, limit: Int? = nil, completion: @escaping ([CommentModel]?, QError?) -> Void)Parameters
idRoom ID
limitby default set 20, min 0 and max 100
completionResponse new Qiscus Array of Comment Object and error if exist.
-
Load More Message in room
Declaration
Swift
public func loadMore(roomID id: String, lastCommentID commentID: Int, limit: Int? = nil, completion: @escaping ([CommentModel]?, QError?) -> Void)Parameters
roomIDRoom ID
lastCommentIDlast comment id want to load
limitby default set 20, min 0 and max 100
completionResponse new Qiscus Array of Comment Object and error if exist.
-
Delete message by id
Declaration
Swift
public func deleteMessage(uniqueIDs id: [String], type: DeleteType, completion: @escaping ([CommentModel]?, QError?) -> Void)Parameters
uniqueIDcomment unique id
typeforMe or ForEveryone
completionResponse Comments your deleted
-
Delete all message in room
Declaration
Swift
public func deleteAllMessage(roomID: [String], completion: @escaping (QError?) -> Void)Parameters
roomIDarray of room id
completionResponse error if exist
-
Search message
Declaration
Swift
public func searchMessage(keyword: String, roomID: String?, lastCommentId: Int?, completion: @escaping ([CommentModel]?, QError?) -> Void)Parameters
keywordrequired, keyword to search
roomIDoptional, search on specific room by room id
lastCommentIdoptional, will get comments aafter this id
-
Mark Comment as read, include comment before
Declaration
Swift
public func updateCommentRead(roomId: String, lastCommentReadId commentID: String)Parameters
roomIdroom id, where comment cooming
lastCommentReadIdcomment id
-
Mark Comment as received or deliverd, include comment before
Declaration
Swift
public func updateCommentReceive(roomId: String, lastCommentReceivedId commentID: String)Parameters
roomIdroom id, where comment cooming
lastCommentReceivedIdcomment id
-
Get comment status is read or received
Declaration
Swift
public func readReceiptStatus(commentId id: String, completion: @escaping (CommentModel?, QError?) -> Void)Parameters
idcomment id
completionreturn object comment if exist
-
getAllRoom
Declaration
Parameters
completionFirst Completion will return data from local if exis, then return from server with meta data(totalpage,current). Response new Qiscus Room Object and error if exist.
-
Create new Group room
Declaration
Parameters
withNameName of group
participantsarrau of user id/qiscus email
completionResponse Qiscus Room Object and error if exist.
-
update Group or channel
Declaration
Parameters
idroom id, where room type not single. group and channel is approved
namenew room name optional
avatarURLnew room Avatar
optionsString, and JSON string is approved
completionResponse new Qiscus Room Object and error if exist.
-
Update Room
Declaration
Parameters
nameroom name
avatarUrlroom avatar
optionsoptions, string or json string
completionResponse new Qiscus Room Object and error if exist.
-
Add new participant in room(Group)
Declaration
Swift
public func addParticipant(userEmails emails: [String], roomId: String, completion: @escaping ([MemberModel]?, QError?) -> Void)Parameters
userEmailsqiscus user email
roomIdroom id
completionResponse new Qiscus Participant Object and error if exist.
-
remove users from room(Group)
Declaration
Swift
public func removeParticipant(userEmails emails: [String], roomId: String, completion: @escaping (Bool, QError?) -> Void)Parameters
emailsarray qiscus email
roomIdroom id (group)
completionResponse true if success and error if exist
-
get participant by room id
Declaration
Swift
public func getParticipant(roomId: String, completion: @escaping ([MemberModel]?, QError?) -> Void)Parameters
roomIdroom id (group)
completionResponse new Qiscus Participant Object and error if exist.
QiscusCore Class Reference