LCIMConversationQuery

Objective-C

@interface LCIMConversationQuery : NSObject

/*!
 The max count of the query result, default is 10. 
 */
@property (nonatomic, assign) NSInteger limit;

/*!
 The offset of the query, default is 0.
 */
@property (nonatomic, assign) NSInteger skip;

/*!
 Configures cache policy, default is kLCCachePolicyCacheElseNetwork
 */
@property (nonatomic, assign) LCIMCachePolicy cachePolicy;

/*!
 Configures cache time, default is one hour (1 * 60 * 60)
 */
@property (nonatomic, assign) NSTimeInterval cacheMaxAge;

/*!
 * Query conditions.
 */
@property (nonatomic, assign) LCIMConversationQueryOption option;

/*!
 * Build an query that is the OR of the passed in queries.
 * @param queries The list of queries to OR together.
 * @return an query that is the OR of the passed in queries.
 */
+ (nullable instancetype)orQueryWithSubqueries:(NSArray<LCIMConversationQuery *> *)queries;

/*!
 * Build an query that is the AND of the passed in queries.
 * @param queries The list of queries to AND together.
 * @return an query that is the AND of the passed in queries.
 */
+ (nullable instancetype)andQueryWithSubqueries:(NSArray<LCIMConversationQuery *> *)queries;

/*!
 Add a constraint that requires a particular key exists.
 @param key The key that should exist.
 */
- (void)whereKeyExists:(NSString *)key;

/*!
 Add a constraint that requires a key not exist.
 @param key The key that should not exist.
 */
- (void)whereKeyDoesNotExist:(NSString *)key;

/*!
 The value corresponding to key is equal to object,
 or the array corresponding to key contains object.
 */
- (void)whereKey:(NSString *)key equalTo:(id)object;

/*!
 The value corresponding to key is less than object.
 */
- (void)whereKey:(NSString *)key lessThan:(id)object;

/*!
 The value corresponding to key is less than or equal to object.
 */
- (void)whereKey:(NSString *)key lessThanOrEqualTo:(id)object;

/*!
 The value corresponding to key is greater than object.
 */
- (void)whereKey:(NSString *)key greaterThan:(id)object;

/*!
 The value corresponding to key is greater than or equal to object.
 */
- (void)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object;

/*!
 The value corresponding to key is not equal to object,
 or the array corresponding to key does not contain object.
 */
- (void)whereKey:(NSString *)key notEqualTo:(id)object;

/*!
 array contains value corresponding to key,
 or array contains at least one element in the array value corresponding to key.
 */
- (void)whereKey:(NSString *)key containedIn:(NSArray *)array;

/*!
 array does not contain value corresponding to key,
 or the field corresponding to key does not exist.
 */
- (void)whereKey:(NSString *)key notContainedIn:(NSArray *)array;

/*!
 The array corresponding to key contains all elements in array.
 */
- (void)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)array;

/*!
 Near a geopoint. Returned results will be sorted in distances to the geopoint.
 */
- (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint;

/*!
 Near a geopoint. Returned results will be sorted in distances to the geopoint.
 @param maxDistance in miles
 */
- (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinMiles:(double)maxDistance;

/*!
 Near a geopoint. Returned results will be sorted in distances to the geopoint.
 @param maxDistance in kilometers
 */
- (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinKilometers:(double)maxDistance;

/*!
 Near a geopoint. Returned results will be sorted in distances to the geopoint.
 @param maxDistance in radians
 */
- (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinRadians:(double)maxDistance;

/*!
 Within a rectangle.
 @param southwest the lower left corner of the rectangle
 @param northeast the upper right corner of the rectangle
 */
- (void)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(LCGeoPoint *)southwest toNortheast:(LCGeoPoint *)northeast;

/*!
 Matches a regex. This query may have a significant performance impact.
 */
- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex;

/*!
 Matches a regex. This query may have a significant performance impact.
 @param modifiers PCRE regex modifiers such as i and m.
 */
- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(nullable NSString *)modifiers;

/*!
 The string corresponding to key has a substring.
 */
- (void)whereKey:(NSString *)key containsString:(NSString *)substring;

/*!
 The string corresponding to key has a prefix.
 */
- (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefix;

/*!
 The string corresponding to key has a suffix.
 */
- (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffix;

/*!
 The size of the array corresponding to key is equal to count.
 */
- (void)whereKey:(NSString *)key sizeEqualTo:(NSUInteger)count;


/*!
 The ascending order by the value corresponding to key, support for multi-field sorting with comma.
 */
- (void)orderByAscending:(NSString *)key;

/*!
 Adding a ascending order by the value corresponding to key to the order.
 */
- (void)addAscendingOrder:(NSString *)key;

/*!
 The descending order by the value corresponding to key, support for multi-field sorting with comma.
 */
- (void)orderByDescending:(NSString *)key;

/*!
 Adding a descending order by the value corresponding to key to the order.
 @param key 降序的 key
 */
- (void)addDescendingOrder:(NSString *)key;

/*!
 Sort with sortDescriptor.
 @param sortDescriptor NSSortDescriptor object
 */
- (void)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor;

/*!
 Sort with sortDescriptors.
 @param sortDescriptors NSSortDescriptor object array
 */
- (void)orderBySortDescriptors:(NSArray *)sortDescriptors;

/*!
 Queries for an LCIMConversation object based on its conversationId.
 @param callback on returned results
 */
- (void)getConversationById:(NSString *)conversationId
                   callback:(void (^)(LCIMConversation * _Nullable conversation, NSError * _Nullable error))callback;

/*!
 Queries for an array of LCIMConversation objects.
 If limit is unspecified or invalid, it will return 10 results by default.
 @param callback on returned results
 */
- (void)findConversationsWithCallback:(void (^)(NSArray<LCIMConversation *> * _Nullable conversations, NSError * _Nullable error))callback;


/**
 Find temporary conversations from server.

 @param tempConvIds ID array of temporary conversations.
 @param callback Result callback.
 */
- (void)findTemporaryConversationsWith:(NSArray<NSString *> *)tempConvIds
                              callback:(void (^)(NSArray<LCIMTemporaryConversation *> * _Nullable conversations, NSError * _Nullable error))callback;

@end

Swift

class LCIMConversationQuery : NSObject

Undocumented

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) NSInteger limit;

    Swift

    var limit: Int { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) NSInteger skip;

    Swift

    var skip: Int { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) LCIMCachePolicy cachePolicy;

    Swift

    var cachePolicy: LCIMCachePolicy { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval cacheMaxAge;

    Swift

    var cacheMaxAge: TimeInterval { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) LCIMConversationQueryOption option;

    Swift

    var option: LCIMConversationQueryOption { get set }
  • Undocumented

    Declaration

    Objective-C

    + (nullable instancetype)orQueryWithSubqueries:
        (nonnull NSArray<LCIMConversationQuery *> *)queries;

    Swift

    class func orQuery(withSubqueries queries: [LCIMConversationQuery]) -> Self?
  • Undocumented

    Declaration

    Objective-C

    + (nullable instancetype)andQueryWithSubqueries:
        (nonnull NSArray<LCIMConversationQuery *> *)queries;

    Swift

    class func andQuery(withSubqueries queries: [LCIMConversationQuery]) -> Self?
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKeyExists:(nonnull NSString *)key;

    Swift

    func whereKeyExists(_ key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKeyDoesNotExist:(nonnull NSString *)key;

    Swift

    func whereKeyDoesNotExist(_ key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key equalTo:(nonnull id)object;

    Swift

    func whereKey(_ key: String, equalTo object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key lessThan:(nonnull id)object;

    Swift

    func whereKey(_ key: String, lessThan object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key lessThanOrEqualTo:(nonnull id)object;

    Swift

    func whereKey(_ key: String, lessThanOrEqualTo object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key greaterThan:(nonnull id)object;

    Swift

    func whereKey(_ key: String, greaterThan object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        greaterThanOrEqualTo:(nonnull id)object;

    Swift

    func whereKey(_ key: String, greaterThanOrEqualTo object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key notEqualTo:(nonnull id)object;

    Swift

    func whereKey(_ key: String, notEqualTo object: Any)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key containedIn:(nonnull NSArray *)array;

    Swift

    func whereKey(_ key: String, containedIn array: [Any])
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        notContainedIn:(nonnull NSArray *)array;

    Swift

    func whereKey(_ key: String, notContainedIn array: [Any])
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        containsAllObjectsInArray:(nonnull NSArray *)array;

    Swift

    func whereKey(_ key: String, containsAllObjectsIn array: [Any])
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        nearGeoPoint:(nonnull LCGeoPoint *)geopoint;

    Swift

    func whereKey(_ key: String, nearGeoPoint geopoint: LCGeoPoint)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        nearGeoPoint:(nonnull LCGeoPoint *)geopoint
         withinMiles:(double)maxDistance;

    Swift

    func whereKey(_ key: String, nearGeoPoint geopoint: LCGeoPoint, withinMiles maxDistance: Double)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
            nearGeoPoint:(nonnull LCGeoPoint *)geopoint
        withinKilometers:(double)maxDistance;

    Swift

    func whereKey(_ key: String, nearGeoPoint geopoint: LCGeoPoint, withinKilometers maxDistance: Double)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
         nearGeoPoint:(nonnull LCGeoPoint *)geopoint
        withinRadians:(double)maxDistance;

    Swift

    func whereKey(_ key: String, nearGeoPoint geopoint: LCGeoPoint, withinRadians maxDistance: Double)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        withinGeoBoxFromSouthwest:(nonnull LCGeoPoint *)southwest
                      toNortheast:(nonnull LCGeoPoint *)northeast;

    Swift

    func whereKey(_ key: String, withinGeoBoxFromSouthwest southwest: LCGeoPoint, toNortheast northeast: LCGeoPoint)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key matchesRegex:(nonnull NSString *)regex;

    Swift

    func whereKey(_ key: String, matchesRegex regex: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        matchesRegex:(nonnull NSString *)regex
           modifiers:(nullable NSString *)modifiers;

    Swift

    func whereKey(_ key: String, matchesRegex regex: String, modifiers: String?)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key
        containsString:(nonnull NSString *)substring;

    Swift

    func whereKey(_ key: String, contains substring: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key hasPrefix:(nonnull NSString *)prefix;

    Swift

    func whereKey(_ key: String, hasPrefix prefix: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key hasSuffix:(nonnull NSString *)suffix;

    Swift

    func whereKey(_ key: String, hasSuffix suffix: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)whereKey:(nonnull NSString *)key sizeEqualTo:(NSUInteger)count;

    Swift

    func whereKey(_ key: String, sizeEqualTo count: UInt)
  • Undocumented

    Declaration

    Objective-C

    - (void)orderByAscending:(nonnull NSString *)key;

    Swift

    func order(byAscending key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)addAscendingOrder:(nonnull NSString *)key;

    Swift

    func addAscendingOrder(_ key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)orderByDescending:(nonnull NSString *)key;

    Swift

    func order(byDescending key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)addDescendingOrder:(nonnull NSString *)key;

    Swift

    func addDescendingOrder(_ key: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)orderBySortDescriptor:(nonnull NSSortDescriptor *)sortDescriptor;

    Swift

    func order(by sortDescriptor: NSSortDescriptor)
  • Undocumented

    Declaration

    Objective-C

    - (void)orderBySortDescriptors:(nonnull NSArray *)sortDescriptors;

    Swift

    func order(bySortDescriptors sortDescriptors: [Any])
  • Undocumented

    Declaration

    Objective-C

    - (void)getConversationById:(nonnull NSString *)conversationId
                       callback:(nonnull void (^)(LCIMConversation *_Nullable,
                                                  NSError *_Nullable))callback;

    Swift

    func getConversationById(_ conversationId: String, callback: @escaping (LCIMConversation?, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)findConversationsWithCallback:
        (nonnull void (^)(NSArray<LCIMConversation *> *_Nullable,
                          NSError *_Nullable))callback;

    Swift

    func findConversations(callback: @escaping ([LCIMConversation]?, Error?) -> Void)
  • Find temporary conversations from server.

    Declaration

    Objective-C

    - (void)findTemporaryConversationsWith:
                (nonnull NSArray<NSString *> *)tempConvIds
                                  callback:(nonnull void (^)(
                                               NSArray<LCIMTemporaryConversation *>
                                                   *_Nullable,
                                               NSError *_Nullable))callback;

    Swift

    func findTemporaryConversations(with tempConvIds: [String], callback: @escaping ([LCIMTemporaryConversation]?, Error?) -> Void)

    Parameters

    tempConvIds

    ID array of temporary conversations.

    callback

    Result callback.