public class APIConfiguration extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
API_BASE_URL |
protected static String |
API_DOMAIN_NAME_CN |
protected static String |
API_DOMAIN_NAME_TW |
static String |
API_NAME_ASR |
static String |
API_NAME_NLI |
static String |
API_NAME_SEG |
static int |
LOCALIZE_OPTION_SIMPLIFIED_CHINESE |
static int |
LOCALIZE_OPTION_TRADITIONAL_CHINESE |
Constructor and Description |
---|
APIConfiguration(String appKey,
String appSecret,
int localizeOption)
Configure to issue OLAMI HTTP API requests.
|
Modifier and Type | Method and Description |
---|---|
protected void |
generateSignature(String apiName) |
String |
getAppKey() |
String |
getAppSecret() |
String |
getBaseRequestURL(String apiName)
Get the base API end point URL for the given API name.
|
String |
getBaseRequestURL(String apiName,
Map<String,String> queryParams)
Get the base API end point URL for the given API name.
|
int |
getLocalizeOption() |
String |
getSdkType() |
String |
getSignature(String apiName)
Get the signature by the given API name and the generated timestamp.
|
long |
getTimestamp(String apiName)
Get the generated timestamp value by the given API name.
|
protected void |
initLocalization(int localizeOption) |
void |
setApiServerDomain(String domain)
Not recommended for use.
|
void |
setSdkType(String type) |
public static final int LOCALIZE_OPTION_SIMPLIFIED_CHINESE
public static final int LOCALIZE_OPTION_TRADITIONAL_CHINESE
public static final String API_NAME_SEG
public static final String API_NAME_NLI
public static final String API_NAME_ASR
protected static final String API_DOMAIN_NAME_CN
protected static final String API_DOMAIN_NAME_TW
protected static final String API_BASE_URL
public APIConfiguration(String appKey, String appSecret, int localizeOption)
appKey
- - The 'APP KEY' you have, provided by OLAMI developer service.appSecret
- - The 'APP SECRET' you have, provided by OLAMI developer service.localizeOption
- - Select the location and language of the OLAMI service you want to use
(0 for Simplified Chinese in China, 1 for Traditional Chinese in Taiwan)public void setSdkType(String type)
type
- - SDK type.public void setApiServerDomain(String domain)
domain
- - API server domain namepublic String getSdkType()
public String getAppKey()
public String getAppSecret()
public int getLocalizeOption()
public long getTimestamp(String apiName)
apiName
- - API name.public String getSignature(String apiName)
apiName
- - API name.public String getBaseRequestURL(String apiName) throws NoSuchAlgorithmException
apiName
- - API name.NoSuchAlgorithmException
- Filed to create signature.public String getBaseRequestURL(String apiName, Map<String,String> queryParams) throws NoSuchAlgorithmException
apiName
- - API name.queryParams
- - Query parameters by name-value collection.NoSuchAlgorithmException
- Filed to create signature.protected void generateSignature(String apiName) throws NoSuchAlgorithmException
NoSuchAlgorithmException
protected void initLocalization(int localizeOption)
Copyright © 2018. All rights reserved.