Applet Information Management
This module is mainly to get some Api introduction for applet information.
1.Search for applets
To search for the applet, two steps are required.
- ensure that this server information is configured when the SDK is initialised.
- call this search interface to search for applets
API
/**
* :: Search for applets
*
* @param searchAppletRequest request body
* @param callback Request result callback
*/
fun searchApplet(
searchAppletRequest: SearchAppletRequest,
callback: FinCallback<SearchAppletResponse>
)SearchAppletRequest Description.
/**
* :: Search for applet request entity classes
*
* @param apiServer Server address
* @param text Search content
*/
data class SearchAppletRequest(var apiServer: String,
var text: String)SearchAppletResponse Description.
/**
Subscribe to DeepL Pro to edit this document.
Visit www.DeepL.com/profor more information.
* :: Search for applet return entity classes
*
* @param list A collection of searched applets
* @param total Number of applets searched
*/
data class SearchAppletResponse(
val list: List<AppletInfo>? ,
val total: Int
)
/**
* The applet information entity class returned by the search applet
*
* @param appId applet id
* @param appName applet name
* @param desc applet description information
* @param highLights highlight font
* @param logo applet logo
* @param organName Business name
* @param pageUrl Path to the page searched by the applet
* @param showText Show content
*/
data class AppletInfo(
val appId: String?
val appName: String?
val desc: String?
val highLights: List<HighLight>? ,
val logo: String?
val organName: String?
val pageUrl: String?
val showText: String?
)
/**
* Highlighted fonts
*
* @param key key of the highlighted font
* @param value value of the highlighted font
*/
data class HighLight(
val key: String?
val value: String?
)Example of a call to #### :::: tabs ::: tab "Kotlin"
FinAppClient.appletApiManager.searchApplet(
SearchAppletRequest("ServiceLocationAddress", "SearchContent"),
object : FinCallback<SearchAppletResponse> {
override fun onSuccess(result: SearchAppletResponse?) {
// Search successful
}
override fun onError(code: Int, error: String?) {
// Search failed
}
override fun onProgress(status: Int, info: String?) {
}
}):::
::: tab "Java"
FinAppClient.INSTANCE.getAppletApiManager().searchApplet(
new SearchAppletRequest("ServerAddress", "SearchContent"),
new FinCallback< SearchAppletResponse>() {
@Override
public void onSuccess(SearchAppletResponse result) {
// Search successful
}
@Override
public void onError(int code, String error) {
// Search failed
}
@Override
public void onProgress(int status, String info) {
}
});::: ::::
2.Get applet object information
API
/**
* Get information about the applet
*/
fun getAppletInfo(appId: String): FinAppInfo?Example of a call to #### :::: tabs ::: tab "Kotlin"
val appInfo = FinAppClient.appletApiManager.getAppletInfo("appId"):::
::: tab "Java"
FinAppInfo appInfo = FinAppClient.INSTANCE.getAppletApiManager().
getAppletInfo("appId");::: ::::
Related field descriptions
| Field Name | Description |
|---|---|
| appId | applet id |
| codeId | applet code package ID |
| userId | applet developer id |
| appAvatar | Applet avatar |
| appTitle | applet title |
| appDescription | applet description |
| appPath | applet path |
| appVersion | applet version number |
| appVersionDescription | Applet version description |
| sequence | applet sequence |
| isGrayVersion | isGrayVersion |
| appThumbnail | applet thumbnail |
| groupId | Organization ID |
| groupName | Name of organization to which you belong |
| appType | applet type |
| createdBy | applet developers |
| createdTime | applet creation time |
| startParams | startParams |
| info | Extended information |
| fromAppId | the applet's source applet id If applet A opens applet B by calling navigateToMiniProgram, then for applet B, fromAppId is the appId of applet A |
| finStoreConfig | Applet Marketplace Configuration Information |
| frameworkVersion | Base library version number |
| url | applet download address |
| md5 | Small Packet MD5 |
| cryptInfo | Applet Encryption Information |
3.Get the applet's current WebView information
3.1 Get the URL of the current webView
The URL corresponding to the H5 will only be returned if the current page is loading an H5.
FinAppClient.appletApiManager.getCurrentWebViewURL(
object : FinCallback<String> {
override fun onSuccess(result: String?) {
toast("url:$result")
}
override fun onError(code: Int, error: String?) {
}
override fun onProgress(status: Int, info: String?) {
}
})3.2 Get the UserAgent of the current webView
FinAppClient.appletApiManager.getCurrentWebViewUserAgent(
object : FinCallback<String> {
override fun onSuccess(result: String?) {
toast("userAgent:$result")
}
override fun onError(code: Int, error: String?) {
}
override fun onProgress(status: Int, info: String?) {
}
})4.Get a screenshot of the applet page
API
/**
* Get a screenshot of the applet page
*
* @param appId applet id
* @param callback applet page screenshot callback
*/
fun captureAppletPicture(appId: String, callback: FinCallback<Bitmap?>)Example of a call to #### :::: tabs ::: tab "Kotlin"
FinAppClient.appletApiManager.captureAppletPicture(
"appId",
object : FinCallback<Bitmap?> {
override fun onSuccess(result: Bitmap?) {
Log.d(TAG, "Get screenshot of applet page successfully :
$result")
}
override fun onError(code: Int, error: String?) {
Log.e(TAG, "Failed to get screenshot of applet page :
$code, $error")
}
override fun onProgress(status: Int, info: String?) {
}
}):::
::: tab "Java"
FinAppClient.INSTANCE.getAppletApiManager().captureAppletPicture(
"appId",
new FinCallback< Bitmap>() {
@Override
public void onSuccess(Bitmap result) {
Log.d(TAG, "Get screenshot of applet page
successfully:" + bitmap);
}
@Override
public void onError(int code, String error) {
Log.e(TAG, "Failed to get screenshot of applet page: "
+ code + ", " + error);
}
@Override
public void onProgress(int status, String info) {
}
});::: ::::
5.Get used applets
5.1 Get the used specified applet
API
/**
* Get the used applets for the specified applet id
*
* @param appId applet id
*/
fun getUsedApplet(appId: String): FinApplet?Example of a call to ##### :::: tabs ::: tab "Kotlin"
val finApplet = FinAppClient.appletApiManager.getUsedApplet("appId"):::
::: tab "Java"
FinApplet finApplet = FinAppClient.INSTANCE.getAppletApiManager().
getUsedApplet("appId");::: ::::
5.2 Getting a list of used applets
API
/**
* Get all used applets
*/
fun getUsedApplets(): List<FinApplet>Example of a call to ##### :::: tabs ::: tab "Kotlin"
val usedApplets = FinAppClient.appletApiManager.getUsedApplets():::
::: tab "Java"
List< FinApplet> usedApplets = FinAppClient.INSTANCE.
getAppletApiManager().getUsedApplets();::: ::::
5.3 Determining whether an applet is used
API
/**
* :: Determine if it is a used applet
*/
fun isUsedApplet(appId: String): BooleanExample of a call to #### :::: tabs ::: tab "Kotlin"
val isUsedApplet = FinAppClient.appletApiManager.isUsedApplet("appId"):::
::: tab "Java"
boolean isUsedApplet = FinAppClient.INSTANCE.getAppletApiManager().
isUsedApplet("appId");::: ::::
6.Get the id of the current applet
API
/**
* Get the id of the current applet
*/
fun getCurrentAppletId(): String?Example of a call to #### :::: tabs ::: tab "Kotlin"
val currentAppletId =
FinAppClient.appletApiManager.getCurrentAppletId():::
::: tab "Java"
String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().
getCurrentAppletId();::: ::::
7.Convert Phiz applet QR code information to PhizClip applet
The use scenario of this API is that when an applet is on both Phiz and PhizClip services, it can be associated with a Phiz applet on the PhizClip platform.The online version of the QR code on the PhizClip platform can then be opened either by scanning the code with Phiz or by scanning the code with the PhizClip Assistant or other APPs that have integrated the PhizClip Applet SDK.
The process is to first scan the QR code, get the QR code content, then call the interface to get the PhizClip applet id, and finally call the API to open the applet.
API
/**
* Parsing applet information based on Phiz QrCode information
*
* @param qrCode QR code information
* @param apiServer The server address of the application marketplace
where the applet is hosted
* @param callback Result callback
*/
fun parseAppletInfoFromWXQrCode(
qrCode: String,
apiServer: String,
callback: FinSimpleCallback<ParsedAppletInfo?>
)The structure of ParsedAppletInfo is as follows.
/**
* The applet information entity class returned by parsing applet
information based on Phiz QrCode information
*
* @param appId applet id
*/
data class ParsedAppletInfo(
val appId: String?
)Example of a call to #### :::: tabs ::: tab "Kotlin"
FinAppClient.appletApiManager.parseAppletInfoFromWXQrCode(
qrCode,
apiServer,
object : FinSimpleCallback<ParsedAppletInfo?>() {
override fun onSuccess(result: ParsedAppletInfo?) {
Log.d(TAG, "parse onSuccess result : ${result.toString()}")
}
override fun onError(code: Int, error: String?) {
Log.d(TAG, "parse onError code : $code, error : $error")
}
}):::
::: tab "Java"
FinAppClient.INSTANCE.getAppletApiManager().
parseAppletInfoFromWXQrCode(
qrCode,
apiServer,
new FinSimpleCallback< ParsedAppletInfo>() {
@Override
public void onSuccess(ParsedAppletInfo result) {
Log.d(TAG, "parse onSuccess result : " + result.toString());
}
@Override
public void onError(int code, @org.jetbrains.annotations.
Nullable String error) {
Log.d(TAG, "parse onError code : " + code + ", error :" + error);
}
}
);::: ::::