ZDCUserSearchManager

@interface ZDCUserSearchManager : NSObject

The SearchManager allows you to search for other users within the system.

Recall that user’s are allows to link multiple identities to their account. For example, a user may choose to link all of the following:

  • Facebook
  • LinkedIn
  • GitHub

This makes searching much easier for the user. They can search for friends & colleagus using the social connections in which they already interact. And the search API allows them to limit their search to particular networks (e.g. only seach GitHub).

  • Searches for co-op users who have linked identities which match a given query.

    Declaration

    Objective-C

    - (void)searchForUsersWithQuery:(nonnull NSString *)queryString
                             treeID:(nonnull NSString *)treeID
                        requesterID:(nonnull NSString *)localUserID
                            options:(nullable ZDCSearchOptions *)options
                    completionQueue:(nullable dispatch_queue_t)completionQueue
                       resultsBlock:
                           (nonnull void (^)(ZDCSearchResultStage,
                                             NSArray<ZDCSearchResult *> *_Nullable,
                                             NSError *_Nullable))resultsBlock;

    Swift

    func searchForUsers(withQuery queryString: String, treeID: String, requesterID localUserID: String, options: ZDCSearchOptions?, completionQueue: DispatchQueue?, resultsBlock: @escaping (ZDCSearchResultStage, [ZDCSearchResult]?, Error?) -> Void)

    Parameters

    queryString

    The search query the user typed into the search field.

    treeID

    The treeID to search. Only co-op users who have signed into this app will be included in the search results.

    localUserID

    The localUser to use when sending the request to the server. The localUserID must be valid, and must be a co-op user.

    options

    Allows you optionally specify advanced search options.

    completionQueue

    The queue on which to invoke the resultsBlock. If you specify nil, the main thread will be used.

    resultsBlock

    This closure will be invoked multiple times — once for each ZDCSearchResultStage. When the search has completed, this closure will be invoked one last time with ZDCSearchResultStage_Done.

  • Allows you to clear the search cache. The search cache includes results from previous queries.

    Declaration

    Objective-C

    - (void)flushCache;

    Swift

    func flushCache()