VOSearchAgent
@protocol VOSearchAgent <NSObject>
General search protocol for asynchronous string-based searches.
-
Contains information relating to the number of total results available as well as the number of results fetched and their relative positions.
Declaration
Objective-C
@property (readonly, nonatomic) NSDictionary *_Nullable currentPaginationMetadata;
Swift
var currentPaginationMetadata: [AnyHashable : Any]? { get }
-
Searches on a string and returns with a list of results
Declaration
Objective-C
- (void)searchWithTerm:(nonnull NSString *)searchText onSuccess:(void (^_Nullable)(NSArray<VOImageMedia *> *_Nullable)) successHandler onFailure:(void (^_Nullable)(NSError *_Nullable))failureHandler;
Swift
func search(withTerm searchText: String, onSuccess successHandler: (([VOImageMedia]?) -> Void)?, onFailure failureHandler: ((Error?) -> Void)? = nil)
Parameters
searchText
- the string to search on
successHandler
- completion block called when the search was successful
failureHandler
- completion block called when the search failed
-
Searches on a string and an offset and returns with a list of results
Declaration
Objective-C
- (void)searchWithTerm:(nonnull NSString *)searchText fromOffset:(NSInteger)offset onSuccess:(void (^_Nullable)(NSArray<VOImageMedia *> *_Nullable)) successHandler onFailure:(void (^_Nullable)(NSError *_Nullable))failureHandler;
Swift
func search(withTerm searchText: String, fromOffset offset: Int, onSuccess successHandler: (([VOImageMedia]?) -> Void)?, onFailure failureHandler: ((Error?) -> Void)? = nil)
Parameters
searchText
- the string to search on
offset
- an offset value to allow paging
successHandler
- completion block called when the search was successful
failureHandler
- completion block called when the search failed
-
Retrieves start index information from pagination metadata to set up paging.
Declaration
Objective-C
- (NSInteger)getStartIndexFromPaginationMetadata;
Swift
func getStartIndexFromPaginationMetadata() -> Int
-
Retrieves disclaimer text for a specific
VOSearchAgent
.Declaration
Objective-C
- (nonnull NSString *)getDisclaimerText;
Swift
optional func getDisclaimerText() -> String
-
Retrieves disclaimer image for a specific
VOSearchAgent
.Declaration
Objective-C
- (nonnull UIImage *)getDisclaimerImage;
Swift
optional func getDisclaimerImage() -> UIImage