Skip to content

Commit

Permalink
🆕 #1950 【企业微信】第三方应用增加获取应用的管理员列表的接口
Browse files Browse the repository at this point in the history
  • Loading branch information
huangxm129 authored Dec 29, 2020
1 parent 0af608f commit a8232f6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ public static class Tp {


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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;



}
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,14 @@ public void setWxCpTpOAService(WxCpTpOAService wxCpTpOAService) {
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);
}

}

0 comments on commit a8232f6

Please sign in to comment.