
com.aliyun.dingtalkai_interaction_1_0.Client Maven / Gradle / Ivy
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dingtalkai_interaction_1_0;
import com.aliyun.tea.*;
import com.aliyun.dingtalkai_interaction_1_0.models.*;
public class Client extends com.aliyun.teaopenapi.Client {
public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
super(config);
com.aliyun.gateway.dingtalk.Client gatewayClient = new com.aliyun.gateway.dingtalk.Client();
this._spi = gatewayClient;
this._endpointRule = "";
if (com.aliyun.teautil.Common.empty(_endpoint)) {
this._endpoint = "api.dingtalk.com";
}
}
/**
* summary :
* 在主动模式下完结会话框
*
* @param request FinishRequest
* @param headers FinishHeaders
* @param runtime runtime options for this request RuntimeOptions
* @return FinishResponse
*/
public FinishResponse finishWithOptions(FinishRequest request, FinishHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.conversationToken)) {
body.put("conversationToken", request.conversationToken);
}
java.util.Map realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "Finish"),
new TeaPair("version", "aiInteraction_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/aiInteraction/finish"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new FinishResponse());
}
/**
* summary :
* 在主动模式下完结会话框
*
* @param request FinishRequest
* @return FinishResponse
*/
public FinishResponse finish(FinishRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
FinishHeaders headers = new FinishHeaders();
return this.finishWithOptions(request, headers, runtime);
}
/**
* summary :
* 在主动模式下准备会话框
*
* @param request PrepareRequest
* @param headers PrepareHeaders
* @param runtime runtime options for this request RuntimeOptions
* @return PrepareResponse
*/
public PrepareResponse prepareWithOptions(PrepareRequest request, PrepareHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.content)) {
body.put("content", request.content);
}
if (!com.aliyun.teautil.Common.isUnset(request.contentType)) {
body.put("contentType", request.contentType);
}
if (!com.aliyun.teautil.Common.isUnset(request.openConversationId)) {
body.put("openConversationId", request.openConversationId);
}
if (!com.aliyun.teautil.Common.isUnset(request.unionId)) {
body.put("unionId", request.unionId);
}
java.util.Map realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "Prepare"),
new TeaPair("version", "aiInteraction_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/aiInteraction/prepare"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new PrepareResponse());
}
/**
* summary :
* 在主动模式下准备会话框
*
* @param request PrepareRequest
* @return PrepareResponse
*/
public PrepareResponse prepare(PrepareRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
PrepareHeaders headers = new PrepareHeaders();
return this.prepareWithOptions(request, headers, runtime);
}
/**
* summary :
* 在回复模式下更新会话框
*
* @param request ReplyRequest
* @param headers ReplyHeaders
* @param runtime runtime options for this request RuntimeOptions
* @return ReplyResponse
*/
public ReplyResponse replyWithOptions(ReplyRequest request, ReplyHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.content)) {
body.put("content", request.content);
}
if (!com.aliyun.teautil.Common.isUnset(request.contentType)) {
body.put("contentType", request.contentType);
}
if (!com.aliyun.teautil.Common.isUnset(request.conversationToken)) {
body.put("conversationToken", request.conversationToken);
}
java.util.Map realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "Reply"),
new TeaPair("version", "aiInteraction_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/aiInteraction/reply"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new ReplyResponse());
}
/**
* summary :
* 在回复模式下更新会话框
*
* @param request ReplyRequest
* @return ReplyResponse
*/
public ReplyResponse reply(ReplyRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
ReplyHeaders headers = new ReplyHeaders();
return this.replyWithOptions(request, headers, runtime);
}
/**
* summary :
* 直接发送消息
*
* @param request SendRequest
* @param headers SendHeaders
* @param runtime runtime options for this request RuntimeOptions
* @return SendResponse
*/
public SendResponse sendWithOptions(SendRequest request, SendHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.content)) {
body.put("content", request.content);
}
if (!com.aliyun.teautil.Common.isUnset(request.contentType)) {
body.put("contentType", request.contentType);
}
if (!com.aliyun.teautil.Common.isUnset(request.openConversationId)) {
body.put("openConversationId", request.openConversationId);
}
if (!com.aliyun.teautil.Common.isUnset(request.unionId)) {
body.put("unionId", request.unionId);
}
java.util.Map realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "Send"),
new TeaPair("version", "aiInteraction_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/aiInteraction/send"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new SendResponse());
}
/**
* summary :
* 直接发送消息
*
* @param request SendRequest
* @return SendResponse
*/
public SendResponse send(SendRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
SendHeaders headers = new SendHeaders();
return this.sendWithOptions(request, headers, runtime);
}
/**
* summary :
* 在主动模式下更新会话框
*
* @param request UpdateRequest
* @param headers UpdateHeaders
* @param runtime runtime options for this request RuntimeOptions
* @return UpdateResponse
*/
public UpdateResponse updateWithOptions(UpdateRequest request, UpdateHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.content)) {
body.put("content", request.content);
}
if (!com.aliyun.teautil.Common.isUnset(request.contentType)) {
body.put("contentType", request.contentType);
}
if (!com.aliyun.teautil.Common.isUnset(request.conversationToken)) {
body.put("conversationToken", request.conversationToken);
}
java.util.Map realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "Update"),
new TeaPair("version", "aiInteraction_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/aiInteraction/update"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new UpdateResponse());
}
/**
* summary :
* 在主动模式下更新会话框
*
* @param request UpdateRequest
* @return UpdateResponse
*/
public UpdateResponse update(UpdateRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
UpdateHeaders headers = new UpdateHeaders();
return this.updateWithOptions(request, headers, runtime);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy