🆕 #2665【企业微信】增加微盘文件权限相关接口

This commit is contained in:
0katekate0
2022-05-26 16:10:44 +08:00
committed by GitHub
parent f83c55c010
commit 403d9c58ea
6 changed files with 101 additions and 1 deletions

View File

@@ -249,6 +249,36 @@ public interface WxCpOaWeDriveService {
*/
WxCpBaseResp fileAclDel(@NonNull WxCpFileAclDelRequest request) throws WxErrorException;
/**
* 分享设置
* 该接口用于文件的分享设置。
* <p>
* 请求方式POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_setting?access_token=ACCESS_TOKEN
*
* @param userId
* @param fileId
* @param authScope
* @param auth
* @return
* @throws WxErrorException
*/
WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException;
/**
* 获取分享链接
* 该接口用于获取文件的分享链接。
* <p>
* 请求方式POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_share?access_token=ACCESS_TOKEN
*
* @param userId
* @param fileId
* @return
* @throws WxErrorException
*/
WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException;
/**
* 文件信息
* 该接口用于获取指定文件的信息。

View File

@@ -167,6 +167,30 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
return WxCpBaseResp.fromJson(responseContent);
}
@Override
public WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SETTING);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("userid", userId);
jsonObject.addProperty("fileid", fileId);
jsonObject.addProperty("auth_scope", authScope);
if (auth != null) {
jsonObject.addProperty("auth", auth);
}
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpBaseResp.fromJson(responseContent);
}
@Override
public WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SHARE);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("userid", userId);
jsonObject.addProperty("fileid", fileId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpFileShare.fromJson(responseContent);
}
@Override
public WxCpFileInfo fileInfo(@NonNull String userId, @NonNull String fileId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_INFO);