com.dingtalk.baymax.framework.sdk.mercury.chain.CustomizedChain Maven / Gradle / Ivy
package com.dingtalk.baymax.framework.sdk.mercury.chain;
import com.alibaba.fastjson.annotation.JSONField;
import com.dingtalk.baymax.framework.sdk.mercury.card.SendCardReq;
import com.dingtalk.baymax.framework.sdk.mercury.card.UpdateCardReq;
import com.dingtalk.baymax.framework.sdk.mercury.card.UpdateCardStreamVarReq;
import com.dingtalk.baymax.framework.sdk.mercury.constant.ApiVersion;
import com.dingtalk.baymax.framework.sdk.mercury.constant.Constants;
import com.dingtalk.baymax.framework.sdk.mercury.runtime.Runtime;
import java.util.Arrays;
import java.util.List;
/**
* @Author xiaoyan
* @Date 2023-05-30 20:07:08
*/
public abstract class CustomizedChain extends Chain {
public transient final String version = ApiVersion.MERCURY.getVersion();
private transient Runtime runtime;
@JSONField(serialize = false)
@Override
public List getInputKeys() {
return Arrays.asList(Constants.CONV_USER_IN_MSG_KEY);
}
@JSONField(serialize = false)
@Override
public List getOutputKeys() {
return Arrays.asList(Constants.CONV_USER_OUT_MSG_KEY);
}
public final Object getScenarioContext(String key) {
return this.runtime.getScenarioContext(key);
}
public final Object getExecuteContext(String key) {
return this.runtime.getExecuteContext(key);
}
public void setRuntime(Runtime runtime) {
this.runtime = runtime;
}
public String sendCard(SendCardReq req) {
return runtime.sendCard(req, interactive);
}
public String updateCard(UpdateCardReq req) {
return runtime.updateCard(req);
}
public boolean updateCardStreamVar(UpdateCardStreamVarReq req) {
return runtime.updateCardStreamVar(req);
}
}