🆕 #1950 【企业微信】第三方应用增加获取应用的管理员列表的接口

This commit is contained in:
huangxm129 2020-12-29 13:38:13 +08:00 committed by GitHub
parent 0af608f119
commit a8232f6c91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package me.chanjar.weixin.cp.bean;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.util.List;
/**
* 应用的管理员
* @author huangxiaoming
*/
@Data
public class WxCpTpAdmin extends WxCpBaseResp {
private static final long serialVersionUID = -5028321625140879571L;
@SerializedName("admin")
private List<Admin> admin;
@Getter
@Setter
public static class Admin {
@SerializedName("userid")
private String userId;
@SerializedName("auth_type")
private Integer authType;
public String toJson() {
return WxGsonBuilder.create().toJson(this);
}
}
public static WxCpTpAdmin fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpTpAdmin.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}

View File

@ -156,6 +156,8 @@ public final class WxCpApiPathConsts {
public static final String CONTACT_SEARCH = "/cgi-bin/service/contact/search";
public static final String GET_ADMIN_LIST = "/cgi-bin/service/get_admin_list";
}
@UtilityClass

View File

@ -387,4 +387,15 @@ public interface WxCpTpService {
* @param wxCpTpUserService the set user service
*/
void setWxCpTpUserService(WxCpTpUserService wxCpTpUserService);
/**
* 获取应用的管理员列表
* @param authCorpId
* @param agentId
* @return
*/
WxCpTpAdmin getAdminList(String authCorpId,Integer agentId) throws WxErrorException;
}

View File

@ -476,4 +476,14 @@ public abstract class BaseWxCpTpServiceImpl<H, P> implements WxCpTpService, Requ
public void setWxCpTpUserService(WxCpTpUserService wxCpTpUserService) {
this.wxCpTpUserService = wxCpTpUserService;
}
@Override
public WxCpTpAdmin getAdminList(String authCorpId,Integer agentId) throws WxErrorException{
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("auth_corpid", authCorpId);
jsonObject.addProperty("agentid", agentId);
String result = post(configStorage.getApiUrl(GET_ADMIN_LIST), jsonObject.toString());
return WxCpTpAdmin.fromJson(result);
}
}