QNGroupsRepository
public class QNGroupsRepository
Provides methods to retrieve all groups or by its identifier
-
Delegate to receive groups events
Declaration
Swift
public weak var delegate: QNGroupsDelegate? { get set }
-
Creates a new group
Declaration
Swift
public func createGroup(named: String, identified: String?, result: @escaping (Result<QNGroupRepository, ResourceError>) -> Void)
Parameters
named
Name use as alias
identified
Group identifier, if empty server will create one
result
Result with the Group
-
Deletes a group
Declaration
Swift
public func delete(group: QNGroupRepository, result: @escaping (Result<Void, ResourceError>) -> Void)
Parameters
group
Group to be deleted
result
Result success when operation is completed
-
Current user leaves all groups where he/she is participating
Declaration
Swift
public func leavesAllGroups(result: @escaping (Result<Void, ResourceError>) -> Void)
Parameters
task
Result success when operation is completed
-
Fetch all groups
Declaration
Swift
public func groups(userIsParticipating: Bool = true, fromCache: Bool = true, result: @escaping (Result<[QNGroupRepository], ResourceError>) -> Void)
Parameters
userIsParticipating
Set true to fetch only groups where user is participating
fromCache
Retrieve from cache or server; true by default
result
Result with Group
-
Fetch a group with a specific groupId
Declaration
Swift
public func group(with groupId: String, fromCache: Bool = true, result: @escaping (Result<QNGroupRepository, ResourceError>) -> Void)
Parameters
groupId
The groupId to fetch
fromCache
Retrieve from cache or server; true by default
result
Result with the Group