package com.gs.dingtalk.dto;
|
|
public enum ApiResponseCode {
|
SUCCESS("408", "请求成功", true),
|
|
INVALID_SIGNATURE("400", "签名不正确", false),
|
TOKEN_EXPIRED("401", "token过期", false),
|
USER_NOT_FOUND("402", "用户不存在", false),
|
REQUEST_TOO_FREQUENT("403", "请求太频繁", false),
|
API_NOT_FOUND("404", "接口不存在", false),
|
USER_EXPIRED("405", "用户到期", false),
|
USER_DISABLED("406", "用户被禁用", false),
|
NO_ACCESS("407", "没有接口访问权限", false),
|
PARAMETER_ERROR("409", "参数出错", false),
|
APP_ID_NOT_SENT("410", "appId未发送", false),
|
BODY_PARAMETER_ERROR("412", "body参数不正确", false),
|
CUSTOM_STRING_TOO_LONG("413", "自定义字符串ext太长", false),
|
BUSINESS_PARAMETER_ERROR("414", "业务请求参数出错", false),
|
BUSINESS_DATA_NOT_FOUND("415", "请求的业务数据不存在", false);
|
|
private final String code;
|
private final String description;
|
private final Boolean flag;
|
|
ApiResponseCode(String code, String description, Boolean flag) {
|
this.code = code;
|
this.description = description;
|
this.flag = flag;
|
}
|
|
public static ApiResponseCode fromCode(String code) {
|
for (ApiResponseCode responseCode : values()) {
|
if (responseCode.getCode().equals(code)) {
|
return responseCode;
|
}
|
}
|
return null; // Or throw an exception if preferred
|
}
|
|
public String getCode() {
|
return code;
|
}
|
|
public String getDescription() {
|
return description;
|
}
|
|
public Boolean getFlag() {
|
return flag;
|
}
|
}
|