public final class AsynchronousApi<ParamT extends HalfDuplexParamBase> extends Object
| 构造器和说明 |
|---|
AsynchronousApi()
Create default http client.
|
AsynchronousApi(ClientOptions clientOptions)
Create custom http client
|
| 限定符和类型 | 方法和说明 |
|---|---|
DashScopeResult |
asyncCall(ParamT param,
ServiceOption serviceOption)
Call async interface and return async task info.
|
DashScopeResult |
call(ParamT param,
ServiceOption serviceOption)
Call the server to get the whole result.
|
DashScopeResult |
cancel(DashScopeResult taskInfo,
String apiKey) |
DashScopeResult |
cancel(String taskId,
String apiKey) |
DashScopeResult |
fetch(DashScopeResult taskInfo,
String apiKey) |
DashScopeResult |
fetch(String taskId,
String apiKey)
Get the async task information, if the is completed will return the result, otherwise return
task status.
|
String |
getTaskId(DashScopeResult task) |
DashScopeResult |
list(AsyncTaskListParam param) |
DashScopeResult |
list(String startTime,
String endTime,
String modelName,
String apiKeyId,
String region,
String status,
Integer pageNo,
Integer pageSize) |
DashScopeResult |
wait(DashScopeResult taskInfo,
String apiKey) |
DashScopeResult |
wait(String taskId,
String apiKey)
Wait for async task completed and return task result.
|
public AsynchronousApi()
public AsynchronousApi(ClientOptions clientOptions)
clientOptions - The client option.public DashScopeResult call(ParamT param, ServiceOption serviceOption) throws ApiException, NoApiKeyException
param - The input param, should be the subclass of `Param`.serviceOption - The service option.NoApiKeyException - Can not find api keyApiException - The request failed, possibly due to a network or data error.public DashScopeResult asyncCall(ParamT param, ServiceOption serviceOption) throws ApiException, NoApiKeyException
param - The input param, should be the subclass of `Param`serviceOption - The service option.NoApiKeyException - Can not find api keyApiException - The request failed, possibly due to a network or data error.public DashScopeResult wait(String taskId, String apiKey) throws ApiException, NoApiKeyException
taskId - The async task id.apiKey - The api-key.NoApiKeyException - Can not find api keyApiException - The request failed, possibly due to a network or data error.public DashScopeResult wait(DashScopeResult taskInfo, String apiKey) throws ApiException, NoApiKeyException
public DashScopeResult fetch(String taskId, String apiKey) throws ApiException, NoApiKeyException
taskId - The async task id.apiKey - The api key.NoApiKeyException - Can not find api keyApiException - The request failed, possibly due to a network or data error.public DashScopeResult fetch(DashScopeResult taskInfo, String apiKey) throws ApiException, NoApiKeyException
public DashScopeResult cancel(String taskId, String apiKey) throws ApiException, NoApiKeyException
public DashScopeResult cancel(DashScopeResult taskInfo, String apiKey) throws ApiException, NoApiKeyException
public DashScopeResult list(AsyncTaskListParam param) throws ApiException, NoApiKeyException
public DashScopeResult list(String startTime, String endTime, String modelName, String apiKeyId, String region, String status, Integer pageNo, Integer pageSize) throws ApiException, NoApiKeyException
public String getTaskId(DashScopeResult task)
Copyright © 2023. All rights reserved.