The mini program SDK provides an online search API for mini programs. This API allows you to search for mini programs by keywords and categories.
API description:
Note:
The 'SearchOptions' parameter is used to specify the keywords and category information for the mini program search;
The 'MiniCallback' parameter is used to retrieve the search results of the mini program.
public static void searchMiniApp(SearchOptions searchOptions, MiniCallback<List<MiniApp>> callback)
Searching mini program by keyword
Sample code:
SearchOptions searchOptions = new SearchOptions("yourkeyword");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
}else{
}
}
});
Searching by single category
Sample code:
SearchOptions searchOptions = new SearchOptions("","category name","");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
}else{
}
}
});
Searching by dual category
Note:
The results of a dual category search are the intersection of the two categories.
Sample code:
SearchOptions searchOptions = new SearchOptions("","category name","category name 2");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
}else{
}
}
});
Searching by keyword and category
Note:
When both keyword and category are set as search parameters, the results will be the intersection of the keyword and category.
Sample code:
SearchOptions searchOptions = new SearchOptions("keyword","category name","category name 2");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
}else{
}
}
});
Was this page helpful?