diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java index ad2dc635f..8c3efbc1a 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java @@ -9,7 +9,7 @@ import java.util.List; /** * 企业微信微盘相关接口. - * https://developer.work.weixin.qq.com/document/path/93654 + * ... * * @author Wang_Wong created on 2022-04-22 */ @@ -20,7 +20,7 @@ public interface WxCpOaWeDriveService { * 该接口用于在微盘内新建空间,可以指定人创建空间。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_create?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 新建空间对应请求参数 * @return spaceid (空间id) @@ -33,7 +33,7 @@ public interface WxCpOaWeDriveService { * 该接口用于重命名已有空间,接收userid参数,以空间管理员身份来重命名。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_rename?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 重命名空间的请求参数 * @return wx cp base resp @@ -46,7 +46,7 @@ public interface WxCpOaWeDriveService { * 该接口用于解散已有空间,需要以空间管理员身份来解散。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_dismiss?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param userId the user id * @param spaceId the space id @@ -60,7 +60,7 @@ public interface WxCpOaWeDriveService { * 该接口用于获取空间成员列表、信息、权限等信息。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_info?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param userId the user id * @param spaceId the space id @@ -74,7 +74,7 @@ public interface WxCpOaWeDriveService { * 该接口用于对指定空间添加成员/部门,可一次性添加多个。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_acl_add?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 添加成员/部门请求参数 * @return wx cp base resp @@ -87,7 +87,7 @@ public interface WxCpOaWeDriveService { * 该接口用于对指定空间移除成员/部门,操作者需要有移除权限。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_acl_del?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 移除成员/部门请求参数 * @return wx cp base resp @@ -100,7 +100,7 @@ public interface WxCpOaWeDriveService { * 该接口用于修改空间权限,需要传入userid,修改权限范围继承传入用户的权限范围。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_setting?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 权限管理请求参数 * @return wx cp base resp @@ -113,7 +113,7 @@ public interface WxCpOaWeDriveService { * 该接口用于获取空间邀请分享链接。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_share?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param userId the user id * @param spaceId the space id @@ -127,7 +127,7 @@ public interface WxCpOaWeDriveService { * 该接口用于获取指定地址下的文件列表。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_list?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 获取文件列表请求参数 * @return wx cp file list @@ -140,7 +140,7 @@ public interface WxCpOaWeDriveService { * 该接口用于向微盘中的指定位置上传文件。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_upload?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 上传文件请求参数 * @return wx cp file upload @@ -153,54 +153,58 @@ public interface WxCpOaWeDriveService { * 该接口用于下载文件,请求的userid需有下载权限。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_download?access_token=ACCESS_TOKEN + * 请求地址: ... * - * @param userId the user id - * @param fileId the file id - * @return wx cp file download + * @param fileId 文件fileid(只支持下载普通文件,不支持下载文件夹或微文档) + * @param selectedTicket 微盘和文件选择器jsapi返回的selectedTicket。若填此参数,则不需要填fileid。 + * @return { + * "errcode": 0, + * "errmsg": "ok", + * "download_url": "DOWNLOAD_URL", + * "cookie_name": "COOKIE_NAME", + * "cookie_value": "COOKIE_VALUE" + * } * @throws WxErrorException the wx error exception */ - WxCpFileDownload fileDownload(@NonNull String userId, @NonNull String fileId) throws WxErrorException; + WxCpFileDownload fileDownload( String fileId, String selectedTicket) throws WxErrorException; /** * 重命名文件 * 该接口用于对指定文件进行重命名。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_rename?access_token=ACCESS_TOKEN + * 请求地址: ... * - * @param userId the user id * @param fileId the file id * @param newName the new name * @return wx cp file rename * @throws WxErrorException the wx error exception */ - WxCpFileRename fileRename(@NonNull String userId, @NonNull String fileId, @NonNull String newName) throws WxErrorException; + WxCpFileRename fileRename(@NonNull String fileId, @NonNull String newName) throws WxErrorException; /** - * 新建文件/微文档 - * 该接口用于在微盘指定位置新建文件、微文档。 + * 新建文件夹/文档 + * 该接口用于在微盘指定位置新建文件夹、文档(更多文档接口能力可见文档API接口说明)。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_create?access_token=ACCESS_TOKEN + * 请求地址: ... * - * @param userId 操作者userid * @param spaceId 空间spaceid * @param fatherId 父目录fileid, 在根目录时为空间spaceid - * @param fileType 文件类型, 1:文件夹 3:微文档(文档) 4:微文档(表格) - * @param fileName 文件名字 + * @param fileType 文件类型, 1:文件夹 3:文档(文档) 4:文档(表格) + * @param fileName 文件名字(注意:文件名最多填255个字符, 英文算1个, 汉字算2个) * @return wx cp file create * @throws WxErrorException the wx error exception */ - WxCpFileCreate fileCreate(@NonNull String userId, @NonNull String spaceId, - @NonNull String fatherId, @NonNull Integer fileType, @NonNull String fileName) throws WxErrorException; + WxCpFileCreate fileCreate(@NonNull String spaceId, @NonNull String fatherId, @NonNull Integer fileType, + @NonNull String fileName) throws WxErrorException; /** * 移动文件 * 该接口用于将文件移动到指定位置。 *
* 请求方式:POST(HTTPS) - * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_move?access_token=ACCESS_TOKEN + * 请求地址: ... * * @param request 移动文件的请求参数 * @return wx cp file move @@ -213,21 +217,33 @@ public interface WxCpOaWeDriveService { * 该接口用于删除指定文件。 *
* 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_delete?access_token=ACCESS_TOKEN
+ * 请求地址: ...
*
- * @param userId 操作者userid
- * @param fileId 文件fileid列表
+ * @param fileIds 文件fileid列表
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
- WxCpBaseResp fileDelete(@NonNull String userId, @NonNull List
+ * 请求方式:POST(HTTPS)
+ * 请求地址: ...
+ *
+ * @param fileId the file id
+ * @return wx cp file info
+ * @throws WxErrorException the wx error exception
+ */
+ WxCpFileInfo fileInfo(@NonNull String fileId) throws WxErrorException;
/**
* 新增指定人
* 该接口用于对指定文件添加指定人/部门。
*
* 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_acl_add?access_token=ACCESS_TOKEN
+ * 请求地址: ...
*
* @param request 新增指定人请求参数
* @return wx cp base resp
@@ -240,7 +256,7 @@ public interface WxCpOaWeDriveService {
* 该接口用于删除指定文件的指定人/部门。
*
* 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_acl_del?access_token=ACCESS_TOKEN
+ * 请求地址: ...
*
* @param request 请求参数
* @return wx cp base resp
@@ -253,7 +269,7 @@ public interface WxCpOaWeDriveService {
* 该接口用于文件的分享设置。
*
* 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_setting?access_token=ACCESS_TOKEN
+ * 请求地址: ...
*
* @param userId the user id
* @param fileId the file id
@@ -269,7 +285,7 @@ public interface WxCpOaWeDriveService {
* 该接口用于获取文件的分享链接。
*
* 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_share?access_token=ACCESS_TOKEN
+ * 请求地址: ...
*
* @param userId the user id
* @param fileId the file id
@@ -278,18 +294,4 @@ public interface WxCpOaWeDriveService {
*/
WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException;
- /**
- * 文件信息
- * 该接口用于获取指定文件的信息。
- *
- * 请求方式:POST(HTTPS)
- * 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_info?access_token=ACCESS_TOKEN
- *
- * @param userId the user id
- * @param fileId the file id
- * @return wx cp file info
- * @throws WxErrorException the wx error exception
- */
- WxCpFileInfo fileInfo(@NonNull String userId, @NonNull String fileId) throws WxErrorException;
-
}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
index 979e86e55..597851aae 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
@@ -114,10 +114,9 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpFileRename fileRename(@NonNull String userId, @NonNull String fileId, @NonNull String newName) throws WxErrorException {
+ public WxCpFileRename fileRename(@NonNull String fileId, @NonNull String newName) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_RENAME);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("fileid", fileId);
jsonObject.addProperty("new_name", newName);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
@@ -125,11 +124,10 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpFileCreate fileCreate(@NonNull String userId, @NonNull String spaceId, @NonNull String fatherId,
+ public WxCpFileCreate fileCreate(@NonNull String spaceId, @NonNull String fatherId,
@NonNull Integer fileType, @NonNull String fileName) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_CREATE);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("spaceid", spaceId);
jsonObject.addProperty("fatherid", fatherId);
jsonObject.addProperty("file_type", fileType);
@@ -146,9 +144,9 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpBaseResp fileDelete(@NonNull String userId, @NonNull List