tencent cloud

Tencent Cloud Super App as a Service

Searching Mini Programs

Download
Focus Mode
Font Size
Last updated: 2025-02-24 19:34:38
The mini program SDK provides an API for searching mini programs online by keywords and categories.
Note:
The firstType and secondType parameters are used to specify the primary category and secondary category for the mini programs to be searched.
The completion parameter is used to obtain the search results of the mini programs.
// Search the mini program

// @param name - Keywords in the search name
// @param completion - Search results
- (void)searchAppletsWithName:(NSString *)name
completion:(void (^)(NSArray<TMFAppletSearchInfo *> * _Nullable, NSError * _Nullable))completion;

// Search the mini program

// @param name - Keywords in the search name
// @param firstType - Primary category name
// @param secondType - Secondary category name
// @param completion - Search results
- (void)searchAppletsWithName:(NSString * _Nullable )name
firstType:(NSString * _Nullable)firstType
secondType:(NSString * _Nullable)secondType
completion:(void (^)(NSArray<TMFAppletSearchInfo *> * _Nullable, NSError * _Nullable))completion;

Search by keyword

Example:
[[TMFMiniAppSDKManager sharedInstance] searchAppletsWithName:searchString completion:^(NSArray<TMFAppletSearchInfo *> * _Nonnull result, NSError * _Nonnull aError) {
if (error) {
// Search failed, or the list is empty
} else {
// Search successful, list is not empty
}
}];

Search by a single category

Example:
[[TMFMiniAppSDKManager sharedInstance] searchAppletsWithName:nil firstType:@"firstType" secondType:nil completion:^(NSArray<TMFAppletSearchInfo *> * _Nullable info, NSError * _Nullable error) {
if (error) {
// Search failed, or the list is empty
} else {
// Search successful, list is not empty
}
}];

Search by dual categories

Note:
The result will be the intersection of the two categories.
Example:
[[TMFMiniAppSDKManager sharedInstance] searchAppletsWithName:nil firstType:@"firstType" secondType:@"secondType" completion:^(NSArray<TMFAppletSearchInfo *> * _Nullable info, NSError * _Nullable error) {
if (error) {
// Search failed, or the list is empty
} else {
// Search successful, list is not empty
}
}];


Specify search scope

Note:
You can specify a search for mini programs and mini games, or only mini programs or mini games.
/**
Type, i.e., mini programs or mini games
- TMAAppTypeApp: Mini programs
- TMAAppTypeGame: Mini games
*/

typedef NS_ENUM(int32_t, TMASearchAppType) {
TMASearchAppTypeAll = 0,
TMASearchAppTypeApp = 1,
TMASearchAppTypeGame = 2,
};

// Search the mini program

// @param name - Keywords in the search name
// @param searchType - Search scope, i.e., mini programs or mini games
// @param firstType - Primary category name
// @param secondType - Secondary category name
// @param completion - Search results
- (void)searchAppletsWithName:(NSString * _Nullable )name
searchType:(TMASearchAppType)searchType
firstType:(NSString * _Nullable)firstType
secondType:(NSString * _Nullable)secondType
completion:(void (^)(NSArray<TMFAppletSearchInfo *> * _Nullable, NSError * _Nullable))completion;
// Gets the mini program category information

// @param existMnpOnly - Whether to return only mini program results
// @param searchType - Search scope, i.e., mini programs or mini games
// @param completion - The search results by category
- (void)getTypeInfoExistMnpOnly:(BOOL)existMnpOnly
searchType:(TMASearchAppType)searchType

WithCompletion:(void (^)(NSArray<nsdictionary><nsstring *,nsarray *> *> * _Nullable, NSError * _Nullable))completion;




Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback