All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.oauth.model.v202010.BrmKeepAliveRequest Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.oauth.model.v202010;

import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.constant.OauthConstant;
import com.dahuatech.icc.oauth.exception.BusinessException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.oauth.model.v202010.oSDK.OauthParamConstant;
import com.dahuatech.icc.util.StringUtils;

/**
 * 保活请求,需鉴权
 *
 * @author 232676
 * @since 1.0.0 2020-10-24 20:59:11
 */
public class BrmKeepAliveRequest extends AbstractIccRequest {
  /** 终端类型 ,1 web 2 client 3 app */
  private Integer clientType;
  /** 用户登录magicId */
  private String magicId;

  public BrmKeepAliveRequest() throws ClientException {
    super(OauthConstant.brmUrl(OauthConstant.BRM_URL_KEEP_ALIVE_POST), Method.POST);
  }

  public BrmKeepAliveRequest(HttpConfigInfo httpConfigInfo) throws ClientException {
    super(OauthConstant.brmUrl(httpConfigInfo,OauthConstant.BRM_URL_KEEP_ALIVE_POST), Method.POST);
  }

  @Override
  public Class getResponseClass() {
    return BrmKeepAliveResponse.class;
  }

  public int getClientType() {
    return clientType;
  }

  public void setClientType(int clientType) {
    this.clientType = clientType;
    putBodyParameter("clientType", clientType);
  }

  public String getMagicId() {
    return magicId;
  }

  public void setMagicId(String magicId) {
    this.magicId = magicId;
    putBodyParameter("magicId", magicId);
  }

    public void businessValid() {
        if(clientType == null){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "clientType");
        }
        if(StringUtils.isEmpty(magicId)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "magicId");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy