mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2614 【企业微信】新增微盘空间管理的相关接口
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import lombok.NonNull;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.oa.wedrive.WxCpSpaceCreateData;
|
||||
import me.chanjar.weixin.cp.bean.oa.wedrive.WxCpSpaceCreateRequest;
|
||||
|
||||
/**
|
||||
* 企业微信微盘相关接口.
|
||||
* https://developer.work.weixin.qq.com/document/path/93654
|
||||
*
|
||||
* @author <a href="https://github.com/0katekate0">Wang_Wong</a>
|
||||
* @date 2022-04-22
|
||||
*/
|
||||
public interface WxCpOaWeDriveService {
|
||||
|
||||
/**
|
||||
* 新建空间
|
||||
* 该接口用于在微盘内新建空间,可以指定人创建空间。
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_create?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param request 新建空间对应请求参数
|
||||
* @return spaceid(空间id)
|
||||
*
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpSpaceCreateData spaceCreate(@NonNull WxCpSpaceCreateRequest request) throws WxErrorException;
|
||||
|
||||
}
|
||||
@@ -414,6 +414,13 @@ public interface WxCpService extends WxService {
|
||||
*/
|
||||
WxCpOaAgentService getOaAgentService();
|
||||
|
||||
/**
|
||||
* 获取OA效率工具 微盘的服务类对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxCpOaWeDriveService getOaWeDriveService();
|
||||
|
||||
/**
|
||||
* 获取会话存档相关接口的服务类对象
|
||||
*
|
||||
|
||||
@@ -51,6 +51,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
|
||||
private WxCpOaService oaService = new WxCpOaServiceImpl(this);
|
||||
private WxCpLivingService livingService = new WxCpLivingServiceImpl(this);
|
||||
private WxCpOaAgentService oaAgentService = new WxCpOaAgentServiceImpl(this);
|
||||
private WxCpOaWeDriveService oaWeDriveService = new WxCpOaWeDriveServiceImpl(this);
|
||||
private WxCpMsgAuditService msgAuditService = new WxCpMsgAuditServiceImpl(this);
|
||||
private WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl(this);
|
||||
private WxCpExternalContactService externalContactService = new WxCpExternalContactServiceImpl(this);
|
||||
@@ -502,6 +503,11 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
|
||||
return oaAgentService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpOaWeDriveService getOaWeDriveService() {
|
||||
return oaWeDriveService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpMsgAuditService getMsgAuditService() {
|
||||
return msgAuditService;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.WxCpOaWeDriveService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.oa.wedrive.WxCpSpaceCreateData;
|
||||
import me.chanjar.weixin.cp.bean.oa.wedrive.WxCpSpaceCreateRequest;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.SPACE_CREATE;
|
||||
|
||||
/**
|
||||
* 企业微信微盘接口实现类.
|
||||
*
|
||||
* @author Wang_Wong
|
||||
* @date 2022-04-22
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
|
||||
private final WxCpService cpService;
|
||||
|
||||
@Override
|
||||
public WxCpSpaceCreateData spaceCreate(@NonNull WxCpSpaceCreateRequest request) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_CREATE);
|
||||
String responseContent = this.cpService.post(apiUrl, request.toJson());
|
||||
return WxCpSpaceCreateData.fromJson(responseContent);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user