queryCustomerAcquisitionQuotas(@Query("link_id") String linkId,
@Query("start_time") Instant startTime,
@Query("end_time") Instant endTime);
+
+ /**
+ * 获取成员多次收消息详情
+ *
+ * 企业和服务商可通过此接口获取成员多次收消息情况,如次数、客户id等信息。
+ *
+ * @param chatKey the chat key
+ * @return the chat info
+ * @since 1.2.9
+ */
+ @POST("externalcontact/customer_acquisition/get_chat_info")
+ Single getChatInfo(@Body ChatKey chatKey);
}
diff --git a/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/InternalCorPayApi.java b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/InternalCorPayApi.java
index e5037cf0..5732f552 100644
--- a/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/InternalCorPayApi.java
+++ b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/InternalCorPayApi.java
@@ -47,7 +47,7 @@ public class InternalCorPayApi {
InternalCorPayApi(String paySecret, String payAgentSecret, SSLManager sslManager, ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
this.paySecret = paySecret;
this.payAgentSecret = payAgentSecret;
- this.mmPayMktTransfersApi = WorkWechatRetrofitFactory.create(sslManager, connectionPool, level)
+ this.mmPayMktTransfersApi = WorkWechatRetrofitFactory.createPayRetrofit(sslManager, connectionPool, level)
.create(MmPayMktTransfersApi.class);
}
diff --git a/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/SmartSheetApi.java b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/SmartSheetApi.java
new file mode 100644
index 00000000..516bee54
--- /dev/null
+++ b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/SmartSheetApi.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.reactive.api;
+
+import cn.felord.domain.GenericResponse;
+import cn.felord.domain.WeComResponse;
+import cn.felord.domain.wedoc.smartsheet.AddOrUpdateFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.AddRecordRequest;
+import cn.felord.domain.wedoc.smartsheet.AddSheetRequest;
+import cn.felord.domain.wedoc.smartsheet.AddViewRequest;
+import cn.felord.domain.wedoc.smartsheet.DelFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.DelRecordRequest;
+import cn.felord.domain.wedoc.smartsheet.DelSheetRequest;
+import cn.felord.domain.wedoc.smartsheet.DelViewRequest;
+import cn.felord.domain.wedoc.smartsheet.QuerySheetRequest;
+import cn.felord.domain.wedoc.smartsheet.RecordResult;
+import cn.felord.domain.wedoc.smartsheet.SheetField;
+import cn.felord.domain.wedoc.smartsheet.SheetViewDetail;
+import cn.felord.domain.wedoc.smartsheet.SheetViewInfo;
+import cn.felord.domain.wedoc.smartsheet.SmartFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartFieldsResponse;
+import cn.felord.domain.wedoc.smartsheet.SmartRecordsRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartRecordsResponse;
+import cn.felord.domain.wedoc.smartsheet.SmartSheetInfo;
+import cn.felord.domain.wedoc.smartsheet.SmartSheetProperties;
+import cn.felord.domain.wedoc.smartsheet.SmartViewRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartViewsResponse;
+import cn.felord.domain.wedoc.smartsheet.UpdateRecordRequest;
+import cn.felord.domain.wedoc.smartsheet.UpdateSheetRequest;
+import cn.felord.domain.wedoc.smartsheet.UpdateViewRequest;
+import io.reactivex.rxjava3.core.Single;
+import retrofit2.http.Body;
+import retrofit2.http.POST;
+
+import java.util.List;
+
+/**
+ * 智能表格操作相关API
+ *
+ * @author dax
+ * @since 2024 /8/30
+ */
+public interface SmartSheetApi {
+
+ /**
+ * 添加子表
+ *
+ * 本接口用于在表格的某个位置添加一个智能表,
+ * 该智能表不存在视图、记录和字段,可以使用 API 在该智能表中添加视图、记录和字段。
+ *
+ * @param request the request
+ * @return the generic response
+ */
+ @POST("wedoc/smartsheet/add_sheet")
+ Single> addSheet(@Body AddSheetRequest request);
+
+ /**
+ * 删除子表
+ *
+ * 本接口用于删除在线表格中的某个智能表。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/delete_sheet")
+ Single deleteSheet(@Body DelSheetRequest request);
+
+ /**
+ * 更新子表
+ *
+ * 本接口用于修改表格中某个子表的标题。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/update_sheet")
+ Single updateSheet(@Body UpdateSheetRequest request);
+
+ /**
+ * 添加视图
+ *
+ * 本接口用于在 Smartsheet 中的某个子表里添加一个新视图。单表最多允许有200个视图。
+ *
+ * @param request the request
+ * @return generic response
+ */
+ @POST("wedoc/smartsheet/add_view")
+ Single> addView(@Body AddViewRequest request);
+
+ /**
+ * 删除视图
+ *
+ * 本接口用于在 smartsheet 中的某个子表里删除若干个视图。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/delete_views")
+ Single deleteViews(@Body DelViewRequest request);
+
+ /**
+ * 更新视图
+ *
+ * 本接口用于在 Smartsheet 中的某个子表里添加一个新视图。
+ *
+ * @param request the request
+ * @return the generic response
+ */
+ @POST("wedoc/smartsheet/update_view")
+ Single> updateView(@Body UpdateViewRequest request);
+
+ /**
+ * 添加字段
+ *
+ * 本接口用于在智能表中的某个子表里添加一列或多列新字段。单表最多允许有150个字段。
+ *
+ * @param request the request
+ * @return the generic response
+ */
+ @POST("wedoc/smartsheet/add_fields")
+ Single>> addFields(@Body AddOrUpdateFieldsRequest request);
+
+ /**
+ * 删除字段
+ *
+ * 本接口用于删除智能表中的某个子表里的一列或多列字段。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/delete_fields")
+ Single deleteFields(@Body DelFieldsRequest request);
+
+ /**
+ * 更新字段
+ *
+ * 本接口用于更新智能中的某个子表里的一个或多个字段的标题和字段属性信息。
+ * 该接口只能更新字段名、字段属性,不能更新字段类型。
+ *
+ * @param request the request
+ * @return the generic response
+ */
+ @POST("wedoc/smartsheet/update_fields")
+ Single>> updateFields(@Body AddOrUpdateFieldsRequest request);
+
+ /**
+ * 添加记录
+ *
+ * 本接口用于在 Smartsheet 中的某个子表里添加一行或多行新记录。单表最多允许有40000行记录。
+ * 不能通过添加记录接口给创建时间、最后编辑时间、创建人和最后编辑人四种类型的字段添加记录。
+ *
+ * @param request the request
+ * @return the generic response
+ */
+ @POST("wedoc/smartsheet/add_records")
+ Single>> addRecords(@Body AddRecordRequest request);
+
+ /**
+ * 删除记录
+ *
+ * 本接口用于删除 Smartsheet 的某个子表中的一行或多行记录。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/delete_records")
+ Single deleteRecords(@Body DelRecordRequest request);
+
+ /**
+ * 更新记录
+ *
+ * 本接口用于更新 Smartsheet 中的某个子表里的一行或多行记录。
+ * 注意:不能通过更新记录接口给创建时间、最后编辑时间、创建人和最后编辑人四种类型的字段更新记录。
+ *
+ * @param request the request
+ * @return the we com response
+ */
+ @POST("wedoc/smartsheet/update_records")
+ Single>> updateRecords(@Body UpdateRecordRequest request);
+
+ /**
+ * 查询子表
+ *
+ * 本接口用于查询一篇在线表格中全部智能表信息。
+ *
+ * @param request the request
+ * @return the sheet
+ */
+ @POST("wedoc/smartsheet/get_sheet")
+ Single>> getSheet(@Body QuerySheetRequest request);
+
+ /**
+ * 查询视图
+ *
+ * 本接口用于获取 Smartsheet 中某个子表里全部视图信息。
+ *
+ * @param request the request
+ * @return the views
+ */
+ @POST("wedoc/smartsheet/get_views")
+ Single getViews(@Body SmartViewRequest request);
+
+ /**
+ * 查询字段
+ *
+ * 本接口用于获取智能表中某个子表下字段信息,
+ * 该接口可以完成下面三种功能:获取全部字段信息、依据字段名获取对应字段、依据字段 ID 获取对应字段信息。
+ *
+ * @param request the request
+ * @return the fields
+ */
+ @POST("wedoc/smartsheet/get_fields")
+ Single getFields(@Body SmartFieldsRequest request);
+
+ /**
+ * 查询记录
+ *
+ * 本接口用于获取 Smartsheet 中某个子表下记录信息,
+ * 该接口可以完成下面三种功能:获取全部记录信息、依据字段名和记录 ID 获取对应记录、对记录进行排序。
+ *
+ * @param request the request
+ * @return the records
+ */
+ @POST("wedoc/smartsheet/get_records")
+ Single getRecords(@Body SmartRecordsRequest request);
+}
diff --git a/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/WedocApi.java b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/WedocApi.java
index 12917d18..c5e34282 100644
--- a/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/WedocApi.java
+++ b/rx-wecom-sdk/src/main/java/cn/felord/reactive/api/WedocApi.java
@@ -51,4 +51,13 @@ public FormApi formApi() {
return workWeChatApiClient.retrofit().create(FormApi.class);
}
+ /**
+ * 智能表格
+ *
+ * @return the smart sheet api
+ */
+ public SmartSheetApi smartSheetApi() {
+ return workWeChatApiClient.retrofit().create(SmartSheetApi.class);
+ }
+
}
diff --git a/samples/spring-boot-sample/pom.xml b/samples/spring-boot-sample/pom.xml
index b4eb98e7..a3737156 100644
--- a/samples/spring-boot-sample/pom.xml
+++ b/samples/spring-boot-sample/pom.xml
@@ -39,7 +39,7 @@
cn.felord
wecom-sdk
- 1.2.9
+ 1.3.0
net.sf.ehcache
diff --git a/samples/spring-boot-sample/src/test/java/cn/felord/wecom/SpringBootWecomSdkTests.java b/samples/spring-boot-sample/src/test/java/cn/felord/wecom/SpringBootWecomSdkTests.java
index 5de934d1..9746652c 100644
--- a/samples/spring-boot-sample/src/test/java/cn/felord/wecom/SpringBootWecomSdkTests.java
+++ b/samples/spring-boot-sample/src/test/java/cn/felord/wecom/SpringBootWecomSdkTests.java
@@ -105,6 +105,10 @@
import cn.felord.domain.webhook.card.UrlJump;
import cn.felord.domain.wedoc.form.AnswerReplyItem;
import cn.felord.domain.wedoc.form.FormAnswerRequest;
+import cn.felord.domain.wedoc.smartsheet.AddRecordRequest;
+import cn.felord.domain.wedoc.smartsheet.RecordResult;
+import cn.felord.domain.wedoc.smartsheet.RecordValues;
+import cn.felord.domain.wedoc.smartsheet.SelectFieldOption;
import cn.felord.domain.wedrive.BufferSource;
import cn.felord.enumeration.AnswerReplyItemType;
import cn.felord.enumeration.ApvRel;
@@ -398,7 +402,7 @@ void newApproval() {
ProcessNode.cc(Collections.singletonList("3804"))
);
- GenericResponse stringGenericResponse = approvalApi.applyEvent(ProcessApplyRequest.approverMode("3958",
+ GenericResponse stringGenericResponse = approvalApi.applyEvent(ProcessApplyRequest.approveMode("3958",
templateId,
nodeList,
templateDetail.getTemplateContent().getControls(),
@@ -409,6 +413,7 @@ void newApproval() {
}
+
/**
* 企业微信发起审批
*/
@@ -508,7 +513,7 @@ void approval() {
* @throws IOException the io exception
*/
@Test
- public void formFiledownload() throws IOException {
+ public void formFileDownload() throws IOException {
// 关联文档功能的自建引用
AgentDetails agentDetailsWithDocAuth = new DefaultAgent("企业ID", "应用密钥,该应用需要关联到文档功能", "应用id");
FormApi formApi = workWeChatApi.wedocApi(agentDetailsWithDocAuth).formApi();
@@ -670,4 +675,46 @@ void callback() {
System.out.println("eventBody = " + eventBody);
}
+
+ /**
+ * 智能表格 添加数据记录 需要先通过API建表格
+ */
+ @Test
+ void smartSheet() {
+ List list = Arrays.asList(
+ // row 1
+ RecordValues.row()
+ .option("性别", Collections.singletonList(SelectFieldOption.selectWithText("男")))
+ .email("电子信箱", "11111@qq.com")
+ .user("姓名", Collections.singletonList("3958"))
+ .dateTime("出生日期", Instant.now())
+ .dateTime("入职日期", Instant.now().minusSeconds(3600000))
+ .number("身高(cm)", 164.5)
+ .currency("薪资(¥)", 1233333.25)
+ .progress("进度", 47.43)
+ .phoneNumber("电话", "13333233333"),
+ // row 2
+ RecordValues.row()
+ .option("性别", Collections.singletonList(SelectFieldOption.selectWithId("0")))
+ .email("电子信箱", "222222@qq.com")
+ .user("姓名", Collections.singletonList("3958"))
+ .dateTime("出生日期", Instant.now())
+ .dateTime("入职日期", Instant.now().minusSeconds(3600000))
+ .number("身高(cm)", 184.5)
+ .currency("薪资(¥)", 23444.25)
+ .progress("进度", 87.23)
+ .phoneNumber("电话", "13333333333")
+ // row more ...
+
+ );
+ String docid = "xxxx";
+ String sheetid = "xxxx";
+ AgentDetails externalAgent = DefaultAgent.of("你的企微企业ID", "关联文档功能的应用密钥", "应用ID");
+ GenericResponse> objectGenericResponse = workWeChatApi.wedocApi(externalAgent)
+ .smartSheetApi()
+ // 以表头名称为基准填充智能表格 也可以换为id
+ .addRecords(AddRecordRequest.byFieldTitle(docid, sheetid, list));
+ Assertions.assertTrue(objectGenericResponse.isSuccessful());
+ }
+
}
diff --git a/wecom-common/pom.xml b/wecom-common/pom.xml
index c5758020..8fae8142 100644
--- a/wecom-common/pom.xml
+++ b/wecom-common/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wecom-common
diff --git a/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java b/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java
index 3e22c5f9..5b27b11c 100644
--- a/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java
+++ b/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java
@@ -27,7 +27,7 @@ public final class WecomUserAgent {
/**
* 版本号
*/
- public static final String VERSION = "1.2.9";
+ public static final String VERSION = "1.3.0";
/**
* UserAgent
*/
diff --git a/wecom-objects/pom.xml b/wecom-objects/pom.xml
index 480cc8d6..12fcee7c 100644
--- a/wecom-objects/pom.xml
+++ b/wecom-objects/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wecom-objects
jar
diff --git a/wecom-objects/src/main/java/cn/felord/callbacks/CallbackCrypto.java b/wecom-objects/src/main/java/cn/felord/callbacks/CallbackCrypto.java
index 294db490..64e29df2 100644
--- a/wecom-objects/src/main/java/cn/felord/callbacks/CallbackCrypto.java
+++ b/wecom-objects/src/main/java/cn/felord/callbacks/CallbackCrypto.java
@@ -32,6 +32,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Objects;
+import java.util.function.Function;
/**
* 提供接收和推送给企业微信消息的加解密接口(UTF8编码的字符串).
@@ -66,9 +67,8 @@ public CallbackCrypto(XmlReader xmlReader, CallbackSettingsService callbackSetti
this.callbackSettingsService = callbackSettingsService;
}
-
/**
- * 将企业微信回复用户的消息加密打包.
+ * 将企业微信回复用户的消息加密打包 JSON格式
*
* - 对要发送的消息进行AES-CBC加密
* - 生成安全签名
@@ -89,7 +89,7 @@ public String encryptJsonMsg(String agentId, String corpId, String replyMsg, Str
}
/**
- * Encrypt xml msg string.
+ * 将企业微信回复用户的消息加密打包 XML格式
*
* @param agentId the agent id
* @param corpId the corp id
@@ -105,7 +105,22 @@ public String encryptXmlMsg(String agentId, String corpId, String replyMsg, Stri
}
/**
- * 检验XML消息的真实性,并且获取解密后的明文,用于消费回调数据,并自动响应POST回调请求.
+ * 检验XML消息的真实性,并且获取解密后的明文,直接返回success
+ *
+ * @param agentId the agent id
+ * @param corpId the corp id
+ * @param msgSignature the msg signature
+ * @param timeStamp the time stamp
+ * @param nonce the nonce
+ * @param xmlBody the xml body
+ * @return the string
+ */
+ public String accept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody) {
+ return this.accept(agentId, corpId, msgSignature, timeStamp, nonce, xmlBody, "success");
+ }
+
+ /**
+ * 检验XML消息的真实性,并且获取解密后的明文,用于消费回调数据,响应体自定义
*
* - 利用收到的密文生成安全签名,进行签名验证
* - 若验证通过,则提取json中的加密消息
@@ -123,26 +138,84 @@ public String encryptXmlMsg(String agentId, String corpId, String replyMsg, Stri
* @return the response
*/
public R accept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody, R response) {
- return this.doAccept(agentId, corpId, msgSignature, timeStamp, nonce, xmlBody, response);
+ return this.doAccept(agentId, corpId, msgSignature, timeStamp, nonce, xmlBody, callbackEventBody -> response);
}
/**
- * Accept string.
+ * 检验XML消息的真实性,并且获取解密后的明文,用于消费回调数据,响应根据回调请求自定义处理
+ *
+ * 响应需要使用{@code encryptXmlMsg}或{@code encryptJsonMsg}进行处理
*
+ * @param the type parameter
* @param agentId the agent id
* @param corpId the corp id
* @param msgSignature the msg signature
* @param timeStamp the time stamp
* @param nonce the nonce
* @param xmlBody the xml body
+ * @param response the response
+ * @return the r
+ */
+ public R accept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody, Function response) {
+ return this.doAccept(agentId, corpId, msgSignature, timeStamp, nonce, xmlBody, response);
+ }
+
+ /**
+ * 解密验签,用于解密XML BODY以及校验回调URL真实性
+ *
+ * @param agentId the agent id
+ * @param corpId the corp id
+ * @param msgSignature the msg signature
+ * @param timeStamp the time stamp
+ * @param nonce the nonce
+ * @param encrypt to encrypt
* @return the string
* @throws WeComException the we com callback exception
*/
- public String accept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody) {
- return this.doAccept(agentId, corpId, msgSignature, timeStamp, nonce, xmlBody, "success");
+ public String decryptMsg(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String encrypt) {
+ CallbackSettings callbackSettings = this.callbackSettingsService.loadAuthentication(agentId, corpId);
+ return decryptMsg(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
+ }
+
+ /**
+ * 校验 receiveid
+ *
+ * @param callbackSettings the callback settings
+ * @param msgSignature the msg signature
+ * @param timeStamp the time stamp
+ * @param nonce the nonce
+ * @param encrypt the encrypt
+ * @return the string
+ */
+ public String decryptMsg(CallbackSettings callbackSettings, String msgSignature, String timeStamp, String nonce, String encrypt) {
+ CallbackDecrypted decrypted = this.doDecryptMsg(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
+ // receiveid不相同的情况
+ if (!Objects.equals(decrypted.getReceiveid(), callbackSettings.getReceiveid())) {
+ throw new WeComException("invalid corpid");
+ }
+ return decrypted.getContent();
+ }
+
+ /**
+ * 不校验 receiveid
+ *
+ * @param callbackSettings the callback settings
+ * @param msgSignature the msg signature
+ * @param timeStamp the time stamp
+ * @param nonce the nonce
+ * @param encrypt the encrypt
+ * @return string callback decrypted
+ */
+ public CallbackDecrypted doDecryptMsg(CallbackSettings callbackSettings, String msgSignature, String timeStamp, String nonce, String encrypt) {
+ String token = callbackSettings.getToken();
+ String signature = Algorithms.sha1Signature(token, timeStamp, nonce, encrypt);
+ if (!Objects.equals(msgSignature, signature)) {
+ throw new WeComException("callback signature not matched");
+ }
+ return this.decrypt(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
}
- private T doAccept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody, T response) {
+ private T doAccept(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String xmlBody, Function response) {
CallbackXmlBody callbackXmlBody = this.readXml(xmlBody, CallbackXmlBody.class);
String encrypt = callbackXmlBody.getEncrypt();
CallbackSettings callbackSettings = this.callbackSettingsService.loadAuthentication(agentId, corpId);
@@ -164,7 +237,7 @@ private T doAccept(String agentId, String corpId, String msgSignature, Strin
this.payCallback(eventBody, callbackSettings);
}
// end 处理支付
- return this.accept(eventBody, response);
+ return this.accept(eventBody, response.apply(eventBody));
}
private void payCallback(CallbackEventBody eventBody, CallbackSettings callbackSettings) {
@@ -196,60 +269,4 @@ private void payCallback(CallbackEventBody eventBody, CallbackSettings callbackS
}
eventBody.setMsgType("event");
}
-
- /**
- * 解密验签,用于解密XML BODY以及校验回调URL真实性
- *
- * @param agentId the agent id
- * @param corpId the corp id
- * @param msgSignature the msg signature
- * @param timeStamp the time stamp
- * @param nonce the nonce
- * @param encrypt to encrypt
- * @return the string
- * @throws WeComException the we com callback exception
- */
- public String decryptMsg(String agentId, String corpId, String msgSignature, String timeStamp, String nonce, String encrypt) {
- CallbackSettings callbackSettings = this.callbackSettingsService.loadAuthentication(agentId, corpId);
- return decryptMsg(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
- }
-
- /**
- * 校验 receiveid
- *
- * @param callbackSettings the callback settings
- * @param msgSignature the msg signature
- * @param timeStamp the time stamp
- * @param nonce the nonce
- * @param encrypt the encrypt
- * @return the string
- */
- public String decryptMsg(CallbackSettings callbackSettings, String msgSignature, String timeStamp, String nonce, String encrypt) {
- CallbackDecrypted decrypted = this.doDecryptMsg(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
- // receiveid不相同的情况
- if (!Objects.equals(decrypted.getReceiveid(), callbackSettings.getReceiveid())) {
- throw new WeComException("invalid corpid");
- }
- return decrypted.getContent();
- }
-
-
- /**
- * 不校验 receiveid
- *
- * @param callbackSettings the callback settings
- * @param msgSignature the msg signature
- * @param timeStamp the time stamp
- * @param nonce the nonce
- * @param encrypt the encrypt
- * @return string
- */
- public CallbackDecrypted doDecryptMsg(CallbackSettings callbackSettings, String msgSignature, String timeStamp, String nonce, String encrypt) {
- String token = callbackSettings.getToken();
- String signature = Algorithms.sha1Signature(token, timeStamp, nonce, encrypt);
- if (!Objects.equals(msgSignature, signature)) {
- throw new WeComException("callback signature not matched");
- }
- return this.decrypt(callbackSettings, msgSignature, timeStamp, nonce, encrypt);
- }
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/GenericResponse.java b/wecom-objects/src/main/java/cn/felord/domain/GenericResponse.java
index a8a7bef6..cda25344 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/GenericResponse.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/GenericResponse.java
@@ -100,6 +100,7 @@ public class GenericResponse extends WeComResponse {
"records",
"agreeinfo",
"properties",
+ "sheet_list",
"lists"
})
private T data;
diff --git a/wecom-objects/src/main/java/cn/felord/domain/approval/ApprovalDetail.java b/wecom-objects/src/main/java/cn/felord/domain/approval/ApprovalDetail.java
index 1362e1c5..330f3d1e 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/approval/ApprovalDetail.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/approval/ApprovalDetail.java
@@ -37,6 +37,8 @@ public class ApprovalDetail {
private String templateId;
private Instant applyTime;
private DeptUserMap applyer;
+ // 批量申请人信息(和applyer字段互斥)
+ private UserId batchApplyer;
private List spRecord;
private List notifyer;
private ApplyData> applyData;
diff --git a/wecom-objects/src/main/java/cn/felord/domain/approval/ProcessApplyRequest.java b/wecom-objects/src/main/java/cn/felord/domain/approval/ProcessApplyRequest.java
index 9487963d..762aa63b 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/approval/ProcessApplyRequest.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/approval/ProcessApplyRequest.java
@@ -45,12 +45,12 @@ public class ProcessApplyRequest extends AbstractApprovalApplyRequest {
* @param summaryList 摘要不超过3行,每行不超过20个字
* @return the approval apply request
*/
- public static ProcessApplyRequest approverMode(String creatorUserid,
- String templateId,
- List nodeList,
- List> controls,
- List extends ContentDataValue> dataValues,
- List summaryList) {
+ public static ProcessApplyRequest approveMode(String creatorUserid,
+ String templateId,
+ List nodeList,
+ List> controls,
+ List extends ContentDataValue> dataValues,
+ List summaryList) {
return new ProcessApplyRequest(creatorUserid,
templateId,
applyData(controls, dataValues),
diff --git a/wecom-objects/src/main/java/cn/felord/domain/callback/Details.java b/wecom-objects/src/main/java/cn/felord/domain/callback/Details.java
index 8341af7d..50343cb2 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/callback/Details.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/callback/Details.java
@@ -40,6 +40,6 @@ public class Details {
@XStreamAlias("SpTime")
private Instant spTime;
@XStreamImplicit(itemFieldName = "Attach")
- private final List attaches;
+ private List attaches;
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/corpgroup/GroupCorpsResponse.java b/wecom-objects/src/main/java/cn/felord/domain/corpgroup/GroupCorpsResponse.java
index e908c0da..7dc156e4 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/corpgroup/GroupCorpsResponse.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/corpgroup/GroupCorpsResponse.java
@@ -16,6 +16,8 @@
package cn.felord.domain.corpgroup;
import cn.felord.domain.WeComResponse;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
import java.util.List;
@@ -25,6 +27,8 @@
* @author dax
* @since 2024/10/12
*/
+@EqualsAndHashCode(callSuper = true)
+@Data
public class GroupCorpsResponse extends WeComResponse {
private Boolean hasMore;
private String nextCursor;
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIds.java b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfo.java
similarity index 83%
rename from wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIds.java
rename to wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfo.java
index 45752347..acee0475 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIds.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfo.java
@@ -17,13 +17,13 @@
import lombok.Data;
-import java.util.Set;
-
/**
* @author dax
- * @since 2021/7/12 16:46
+ * @since 2024/10/17
*/
@Data
-public class CorpTagIds implements CorpTagIterator {
- private final Set tagId;
+public class ChatInfo {
+ private Integer recvMsgCnt;
+ private String LinkId;
+ private String state;
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfoResponse.java b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfoResponse.java
new file mode 100644
index 00000000..ad519bed
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatInfoResponse.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.externalcontact;
+
+import cn.felord.domain.WeComResponse;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author dax
+ * @since 2024/10/17
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ChatInfoResponse extends WeComResponse {
+ private String userid;
+ private String externalUserid;
+ private ChatInfo chatInfo;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/AllCorpTag.java b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatKey.java
similarity index 59%
rename from wecom-objects/src/main/java/cn/felord/domain/externalcontact/AllCorpTag.java
rename to wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatKey.java
index 8da84eba..c51cd364 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/AllCorpTag.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/ChatKey.java
@@ -17,34 +17,30 @@
import lombok.Getter;
-import java.util.Collections;
-import java.util.Set;
-
/**
- * The type All corp tag.
- *
* @author dax
- * @since 2021 /8/13 18:39
+ * @since 2024/10/17
*/
@Getter
-public class AllCorpTag implements CorpTagIterator {
- private final Set groupId;
- private final Set tagId;
+public class ChatKey {
+ private final String chatKey;
/**
- * Instantiates a new All corp tag.
+ * Instantiates a new Chat key.
+ *
+ * @param chatKey the chat key
*/
- public AllCorpTag() {
- this.groupId = Collections.emptySet();
- this.tagId = Collections.emptySet();
+ ChatKey(String chatKey) {
+ this.chatKey = chatKey;
}
/**
- * Query all corp tag.
+ * Of chat key.
*
- * @return the all corp tag
+ * @param chatKey the chat key
+ * @return the chat key
*/
- public static AllCorpTag query() {
- return new AllCorpTag();
+ public static ChatKey of(String chatKey) {
+ return new ChatKey(chatKey);
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagRequest.java b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagRequest.java
new file mode 100644
index 00000000..12996fc7
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagRequest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.externalcontact;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * The type All corp tag.
+ *
+ * @author dax
+ * @since 2021 /8/13 18:39
+ */
+@ToString
+@Getter
+public class CorpTagRequest {
+ private final Set groupId;
+ private final Set tagId;
+
+ /**
+ * Instantiates a new All corp tag.
+ *
+ * @param groupId the group id
+ * @param tagId the tag id
+ */
+ CorpTagRequest(Set groupId, Set tagId) {
+ this.groupId = groupId;
+ this.tagId = tagId;
+ }
+
+ /**
+ * Query all corp tag.
+ *
+ * @return the all corp tag
+ */
+ public static CorpTagRequest all() {
+ return new CorpTagRequest(Collections.emptySet(), Collections.emptySet());
+ }
+
+ /**
+ * Group all corp tag.
+ *
+ * @param groupId the group id
+ * @return the all corp tag
+ */
+ public static CorpTagRequest group(Set groupId) {
+ return new CorpTagRequest(groupId, Collections.emptySet());
+ }
+
+ /**
+ * Tag all corp tag.
+ *
+ * @param tagId the tag id
+ * @return the all corp tag
+ */
+ public static CorpTagRequest tag(Set tagId) {
+ return new CorpTagRequest(Collections.emptySet(), tagId);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/security/FileOptRecordDetail.java b/wecom-objects/src/main/java/cn/felord/domain/security/FileOptRecordDetail.java
index 5cc19c3e..a555076b 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/security/FileOptRecordDetail.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/security/FileOptRecordDetail.java
@@ -40,6 +40,14 @@ public class FileOptRecordDetail {
* 文件操作说明
*/
private String fileInfo;
+ /**
+ * 文件的MD5
+ */
+ private Integer fileSize;
+ /**
+ * 文件大小。单位:字节
+ */
+ private String fileMd5;
/**
* 企业用户账号id,当操作者为企业内部用户时返回该字段
*/
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/doc/CreateDocRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/doc/CreateDocRequest.java
index f734ac36..2db7ea4d 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/doc/CreateDocRequest.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/doc/CreateDocRequest.java
@@ -17,7 +17,8 @@
package cn.felord.domain.wedoc.doc;
import cn.felord.enumeration.DocType;
-import lombok.Data;
+import lombok.Getter;
+import lombok.ToString;
import java.util.List;
@@ -25,9 +26,10 @@
* 新建文档
*
* @author felord
- * @since 2021/10/12 16:53
+ * @since 2021 /10/12 16:53
*/
-@Data
+@ToString
+@Getter
public class CreateDocRequest {
/**
@@ -50,4 +52,69 @@ public class CreateDocRequest {
* 空间spaceid。若指定spaceid,则fatherid也要同时指定
*/
private String spaceid;
+
+ /**
+ * Instantiates a new Create doc request.
+ *
+ * @param docName the doc name
+ * @param docType the doc type
+ */
+ CreateDocRequest(String docName, DocType docType) {
+ this.docName = docName;
+ this.docType = docType;
+ }
+
+ /**
+ * 文档
+ *
+ * @param docName the doc name
+ * @return the create doc request
+ */
+ public static CreateDocRequest doc(String docName) {
+ return new CreateDocRequest(docName, DocType.DOC);
+ }
+
+ /**
+ * 表格
+ *
+ * @param docName the doc name
+ * @return the create doc request
+ */
+ public static CreateDocRequest sheet(String docName) {
+ return new CreateDocRequest(docName, DocType.SHEET);
+ }
+
+ /**
+ * 智能表格
+ *
+ * @param docName the doc name
+ * @return the create doc request
+ */
+ public static CreateDocRequest smartSheet(String docName) {
+ return new CreateDocRequest(docName, DocType.SMART_SHEET);
+ }
+
+ /**
+ * Admin users create doc request.
+ *
+ * @param adminUsers the admin users
+ * @return the create doc request
+ */
+ public CreateDocRequest adminUsers(List adminUsers) {
+ this.adminUsers = adminUsers;
+ return this;
+ }
+
+ /**
+ * Father and space create doc request.
+ *
+ * @param fatherId the father id
+ * @param spaceId the space id
+ * @return the create doc request
+ */
+ public CreateDocRequest fatherAndSpace(String fatherId, String spaceId) {
+ this.fatherid = fatherId;
+ this.spaceid = spaceId;
+ return this;
+ }
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddRecordRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddRecordRequest.java
new file mode 100644
index 00000000..42a34e73
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddRecordRequest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * The type Add record request.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+@ToString
+@Getter
+public class AddRecordRequest {
+ private final String docid;
+ private final String sheetId;
+ private final String keyType;
+ private final List records;
+
+
+ /**
+ * Instantiates a new Add record request.
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param keyType the key type
+ * @param records the records
+ */
+ AddRecordRequest(String docId, String sheetId, String keyType, List records) {
+ this.docid = docId;
+ this.sheetId = sheetId;
+ this.keyType = keyType;
+ this.records = records;
+ }
+
+
+ /**
+ * key用字段标题表示
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param records the records
+ * @return the add record request
+ */
+ public static AddRecordRequest byFieldId(String docId, String sheetId, List records) {
+ return new AddRecordRequest(docId, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_ID", records);
+ }
+
+ /**
+ * key用字段ID表示
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param records the records
+ * @return the add record request
+ */
+ public static AddRecordRequest byFieldTitle(String docId, String sheetId, List records) {
+ return new AddRecordRequest(docId, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_TITLE", records);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddViewRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddViewRequest.java
index a4632c2b..af6cbb98 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddViewRequest.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AddViewRequest.java
@@ -80,9 +80,9 @@ public class AddViewRequest {
* @param viewTitle the view title
* @return the add view request
*/
- public AddViewRequest grid(String docid,
- String sheetId,
- String viewTitle) {
+ public static AddViewRequest grid(String docid,
+ String sheetId,
+ String viewTitle) {
return new AddViewRequest(docid, sheetId, viewTitle, SmartSheetViewType.VIEW_TYPE_GRID);
}
@@ -94,9 +94,9 @@ public AddViewRequest grid(String docid,
* @param viewTitle the view title
* @return add view request
*/
- public AddViewRequest kanban(String docid,
- String sheetId,
- String viewTitle) {
+ public static AddViewRequest kanban(String docid,
+ String sheetId,
+ String viewTitle) {
return new AddViewRequest(docid, sheetId, viewTitle, SmartSheetViewType.VIEW_TYPE_KANBAN);
}
@@ -108,9 +108,9 @@ public AddViewRequest kanban(String docid,
* @param viewTitle the view title
* @return the add view request
*/
- public AddViewRequest gallery(String docid,
- String sheetId,
- String viewTitle) {
+ public static AddViewRequest gallery(String docid,
+ String sheetId,
+ String viewTitle) {
return new AddViewRequest(docid, sheetId, viewTitle, SmartSheetViewType.VIEW_TYPE_GALLERY);
}
@@ -123,10 +123,10 @@ public AddViewRequest gallery(String docid,
* @param propertyGantt the property gantt
* @return the add view request
*/
- public AddViewRequest gantt(String docid,
- String sheetId,
- String viewTitle,
- ViewDateRange propertyGantt) {
+ public static AddViewRequest gantt(String docid,
+ String sheetId,
+ String viewTitle,
+ ViewDateRange propertyGantt) {
return new AddViewRequest(docid, sheetId, viewTitle, SmartSheetViewType.VIEW_TYPE_GANTT, propertyGantt, null);
}
@@ -139,10 +139,10 @@ public AddViewRequest gantt(String docid,
* @param propertyCalendar the property calendar
* @return the add view request
*/
- public AddViewRequest calendar(String docid,
- String sheetId,
- String viewTitle,
- ViewDateRange propertyCalendar) {
+ public static AddViewRequest calendar(String docid,
+ String sheetId,
+ String viewTitle,
+ ViewDateRange propertyCalendar) {
return new AddViewRequest(docid, sheetId, viewTitle, SmartSheetViewType.VIEW_TYPE_CALENDAR, null, propertyCalendar);
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AttachmentSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AttachmentSheetField.java
index 9caf1206..bccfe57a 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AttachmentSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AttachmentSheetField.java
@@ -27,21 +27,35 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class AttachmentSheetField extends SheetField {
private final AttachmentFieldProperty propertyAttachment;
/**
- * Instantiates a new Attachment sheet field.
+ * Create attachment sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param attachmentProperty the attachment property
+ * @return the attachment sheet field
+ */
+ public static AttachmentSheetField create(String fieldTitle,
+ AttachmentFieldProperty attachmentProperty) {
+ return update(null, fieldTitle, attachmentProperty);
+ }
+
+ /**
+ * Update attachment sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyAttachment the property attachment
+ * @param fieldTitle the field title
+ * @param attachmentProperty the attachment property
+ * @return the attachment sheet field
*/
- public AttachmentSheetField(String fieldId, SheetFieldType fieldType, AttachmentFieldProperty propertyAttachment) {
- super(fieldId, fieldType);
- this.propertyAttachment = propertyAttachment;
+ public static AttachmentSheetField update(String fieldId,
+ String fieldTitle,
+ AttachmentFieldProperty attachmentProperty) {
+ return new AttachmentSheetField(fieldId, SheetFieldType.FIELD_TYPE_ATTACHMENT, fieldTitle, attachmentProperty);
}
/**
@@ -50,14 +64,14 @@ public AttachmentSheetField(String fieldId, SheetFieldType fieldType, Attachment
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyAttachment the property attachment
+ * @param attachmentProperty the attachment property
*/
@JsonCreator
- public AttachmentSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_attachment") AttachmentFieldProperty propertyAttachment) {
+ AttachmentSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_attachment") AttachmentFieldProperty attachmentProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyAttachment = propertyAttachment;
+ this.propertyAttachment = attachmentProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AutoNumberSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AutoNumberSheetField.java
index 10a5d46b..ecbfee53 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AutoNumberSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/AutoNumberSheetField.java
@@ -27,21 +27,34 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class AutoNumberSheetField extends SheetField {
private final AutoNumberFieldProperty propertyAutoNumber;
/**
- * Instantiates a new AutoNumber sheet field.
+ * Create auto number sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param autoNumberProperty the auto number property
+ * @return the auto number sheet field
+ */
+ public static AutoNumberSheetField create(String fieldTitle, AutoNumberFieldProperty autoNumberProperty) {
+ return update(null, fieldTitle, autoNumberProperty);
+ }
+
+ /**
+ * Update auto number sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyAutoNumber the property AutoNumber
+ * @param fieldTitle the field title
+ * @param autoNumberProperty the auto number property
+ * @return the auto number sheet field
*/
- public AutoNumberSheetField(String fieldId, SheetFieldType fieldType, AutoNumberFieldProperty propertyAutoNumber) {
- super(fieldId, fieldType);
- this.propertyAutoNumber = propertyAutoNumber;
+ public static AutoNumberSheetField update(String fieldId,
+ String fieldTitle,
+ AutoNumberFieldProperty autoNumberProperty) {
+ return new AutoNumberSheetField(fieldId, SheetFieldType.FIELD_TYPE_ATTACHMENT, fieldTitle, autoNumberProperty);
}
/**
@@ -50,14 +63,14 @@ public AutoNumberSheetField(String fieldId, SheetFieldType fieldType, AutoNumber
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyAutoNumber the property AutoNumber
+ * @param autoNumberProperty the auto number property
*/
@JsonCreator
- public AutoNumberSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_auto_number") AutoNumberFieldProperty propertyAutoNumber) {
+ AutoNumberSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_auto_number") AutoNumberFieldProperty autoNumberProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyAutoNumber = propertyAutoNumber;
+ this.propertyAutoNumber = autoNumberProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellAttachmentValue.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellAttachmentValue.java
new file mode 100644
index 00000000..5f7120fd
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellAttachmentValue.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SheetFileType;
+import lombok.Data;
+
+/**
+ * @author dax
+ * @since 2024/9/2
+ */
+@Data
+public class CellAttachmentValue {
+ private String fileUrl;
+ private String fileExt;
+ private Integer size;
+ private SheetFileType fileType;
+ private String fileId;
+ private String name;
+ // 1 文件夹 2 文件 ?
+ private Integer docType;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellImageValue.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellImageValue.java
new file mode 100644
index 00000000..36968e0d
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellImageValue.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+/**
+ * @author dax
+ * @since 2024/12/23
+ */
+@Data
+public class CellImageValue {
+ private String id;
+ private String title;
+ private String imageUrl;
+ private String width;
+ private String height;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellLocationValue.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellLocationValue.java
new file mode 100644
index 00000000..5f4b9fda
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellLocationValue.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+/**
+ * The type Cell location value.
+ */
+@ToString
+@Getter
+public class CellLocationValue {
+ private final String id;
+ private final String latitude;
+ private final String longitude;
+ private final String title;
+ private final Integer sourceType;
+
+
+ /**
+ * Instantiates a new Cell location value.
+ *
+ * @param id the id
+ * @param latitude the latitude
+ * @param longitude the longitude
+ * @param title the title
+ */
+ public CellLocationValue(String id, String latitude, String longitude, String title) {
+ this(id, latitude, longitude, title, 1);
+ }
+
+ /**
+ * Instantiates a new Cell location value.
+ *
+ * @param id the id
+ * @param latitude the latitude
+ * @param longitude the longitude
+ * @param title the title
+ * @param sourceType the source type
+ */
+ public CellLocationValue(String id, String latitude, String longitude, String title, Integer sourceType) {
+ this.id = id;
+ this.latitude = latitude;
+ this.longitude = longitude;
+ this.title = title;
+ this.sourceType = sourceType;
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellTextValue.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellTextValue.java
new file mode 100644
index 00000000..fee35916
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellTextValue.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import lombok.Getter;
+import lombok.ToString;
+
+/**
+ * The type Cell text value.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+@ToString
+@Getter
+public class CellTextValue {
+ private final String type;
+ private final String text;
+ private final String link;
+
+ /**
+ * Instantiates a new Cell text value.
+ *
+ * @param type the type
+ * @param text the text
+ * @param link the link
+ */
+ @JsonCreator
+ CellTextValue(String type, String text, String link) {
+ this.type = type;
+ this.text = text;
+ this.link = link;
+ }
+
+ /**
+ * Text cell text value.
+ *
+ * @param text the text
+ * @return the cell text value
+ */
+ public static CellTextValue text(String text) {
+ return new CellTextValue("text", text, null);
+ }
+
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUrlValue.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUrlValue.java
new file mode 100644
index 00000000..01e78b72
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUrlValue.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import lombok.Getter;
+import lombok.ToString;
+
+/**
+ * The type Cell url value.
+ *
+ * @author dax
+ * @since 2024 /12/24
+ */
+@ToString
+@Getter
+public class CellUrlValue {
+ private final String type;
+ private final String text;
+ private final String link;
+
+ /**
+ * Instantiates a new Cell url value.
+ *
+ * @param type the type
+ * @param text the text
+ * @param link the link
+ */
+ @JsonCreator
+ CellUrlValue(String type, String text, String link) {
+ this.type = type;
+ this.text = text;
+ this.link = link;
+ }
+
+ /**
+ * Url cell url value.
+ *
+ * @param text the text
+ * @param link the link
+ * @return the cell url value
+ */
+ public static CellUrlValue url(String text, String link) {
+ return new CellUrlValue("url", text, link);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIterator.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUserValue.java
similarity index 81%
rename from wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIterator.java
rename to wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUserValue.java
index f2c7adb0..d998c9c3 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpTagIterator.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CellUserValue.java
@@ -13,11 +13,15 @@
* limitations under the License.
*/
-package cn.felord.domain.externalcontact;
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
/**
* @author dax
- * @since 2021/7/12 16:45
+ * @since 2024/12/24
*/
-public interface CorpTagIterator {
+@Data
+public class CellUserValue {
+ private final String userId;
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CheckboxSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CheckboxSheetField.java
index b0005612..9e8b9c10 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CheckboxSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CheckboxSheetField.java
@@ -27,21 +27,35 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class CheckboxSheetField extends SheetField {
private final CheckboxFieldProperty propertyCheckbox;
/**
- * Instantiates a new Checkbox sheet field.
+ * Create checkbox sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param checkboxProperty the checkbox property
+ * @return the checkbox sheet field
+ */
+ public static CheckboxSheetField create(String fieldTitle,
+ CheckboxFieldProperty checkboxProperty) {
+ return update(null, fieldTitle, checkboxProperty);
+ }
+
+ /**
+ * Update checkbox sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyCheckbox the property checkbox
+ * @param fieldTitle the field title
+ * @param checkboxProperty the checkbox property
+ * @return the checkbox sheet field
*/
- public CheckboxSheetField(String fieldId, SheetFieldType fieldType, CheckboxFieldProperty propertyCheckbox) {
- super(fieldId, fieldType);
- this.propertyCheckbox = propertyCheckbox;
+ public static CheckboxSheetField update(String fieldId,
+ String fieldTitle,
+ CheckboxFieldProperty checkboxProperty) {
+ return new CheckboxSheetField(fieldId, SheetFieldType.FIELD_TYPE_CHECKBOX, fieldTitle, checkboxProperty);
}
/**
@@ -50,14 +64,14 @@ public CheckboxSheetField(String fieldId, SheetFieldType fieldType, CheckboxFiel
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyCheckbox the property checkbox
+ * @param checkboxProperty the checkbox property
*/
@JsonCreator
- public CheckboxSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_checkbox") CheckboxFieldProperty propertyCheckbox) {
+ CheckboxSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_checkbox") CheckboxFieldProperty checkboxProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyCheckbox = propertyCheckbox;
+ this.propertyCheckbox = checkboxProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CreatedTimeSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CreatedTimeSheetField.java
index b043186d..32119a1a 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CreatedTimeSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CreatedTimeSheetField.java
@@ -27,37 +27,48 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class CreatedTimeSheetField extends SheetField {
private final TimeFieldProperty propertyCreatedTime;
/**
- * Instantiates a new CreatedTime sheet field.
+ * Create created time sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param propertyCreatedTime the property created time
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
+ * @return the created time sheet field
*/
- public CreatedTimeSheetField(String fieldId, SheetFieldType fieldType, TimeFieldProperty propertyCreatedTime) {
- super(fieldId, fieldType);
- this.propertyCreatedTime = propertyCreatedTime;
+ public static CreatedTimeSheetField create(String fieldTitle, TimeFieldProperty timeProperty) {
+ return update(null, fieldTitle, timeProperty);
+ }
+
+ /**
+ * Update created time sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
+ * @return the created time sheet field
+ */
+ public static CreatedTimeSheetField update(String fieldId, String fieldTitle, TimeFieldProperty timeProperty) {
+ return new CreatedTimeSheetField(fieldId, SheetFieldType.FIELD_TYPE_CREATED_TIME, fieldTitle, timeProperty);
}
/**
* Instantiates a new Created time sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param fieldTitle the field title
- * @param propertyCreatedTime the property created time
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
*/
@JsonCreator
- public CreatedTimeSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_created_time") TimeFieldProperty propertyCreatedTime) {
+ CreatedTimeSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_created_time") TimeFieldProperty timeProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyCreatedTime = propertyCreatedTime;
+ this.propertyCreatedTime = timeProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CurrencySheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CurrencySheetField.java
index a3a9b16a..dd947807 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CurrencySheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/CurrencySheetField.java
@@ -27,21 +27,32 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class CurrencySheetField extends SheetField {
private final CurrencyFieldProperty propertyCurrency;
/**
- * Instantiates a new Currency sheet field.
+ * Create currency sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param currencyProperty the currency property
+ * @return the currency sheet field
+ */
+ public static CurrencySheetField create(String fieldTitle, CurrencyFieldProperty currencyProperty) {
+ return update(null, fieldTitle, currencyProperty);
+ }
+
+ /**
+ * Update currency sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyCurrency the property Currency
+ * @param fieldTitle the field title
+ * @param currencyProperty the currency property
+ * @return the currency sheet field
*/
- public CurrencySheetField(String fieldId, SheetFieldType fieldType, CurrencyFieldProperty propertyCurrency) {
- super(fieldId, fieldType);
- this.propertyCurrency = propertyCurrency;
+ public static CurrencySheetField update(String fieldId, String fieldTitle, CurrencyFieldProperty currencyProperty) {
+ return new CurrencySheetField(fieldId, SheetFieldType.FIELD_TYPE_CURRENCY, fieldTitle, currencyProperty);
}
/**
@@ -50,14 +61,14 @@ public CurrencySheetField(String fieldId, SheetFieldType fieldType, CurrencyFiel
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyCurrency the property Currency
+ * @param currencyProperty the currency property
*/
@JsonCreator
- public CurrencySheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_currency") CurrencyFieldProperty propertyCurrency) {
+ CurrencySheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_currency") CurrencyFieldProperty currencyProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyCurrency = propertyCurrency;
+ this.propertyCurrency = currencyProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeFieldProperty.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeFieldProperty.java
index 482cba6c..c5aaa31d 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeFieldProperty.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeFieldProperty.java
@@ -30,7 +30,7 @@
@ToString
@Getter
public class DateTimeFieldProperty {
- private final String format;
+ private final DateTimeFieldFormatter format;
private final Boolean autoFill;
/**
@@ -40,8 +40,8 @@ public class DateTimeFieldProperty {
* @param autoFill the auto fill
*/
@JsonCreator
- DateTimeFieldProperty(@JsonProperty("format") String format,
- @JsonProperty("autoFill") Boolean autoFill) {
+ DateTimeFieldProperty(@JsonProperty("format") DateTimeFieldFormatter format,
+ @JsonProperty("auto_fill") Boolean autoFill) {
this.format = format;
this.autoFill = autoFill;
}
@@ -54,6 +54,6 @@ public class DateTimeFieldProperty {
* @return the date time field property
*/
public static DateTimeFieldProperty of(DateTimeFieldFormatter formatter, boolean autoFill) {
- return new DateTimeFieldProperty(formatter.getFormat(), autoFill);
+ return new DateTimeFieldProperty(formatter, autoFill);
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeSheetField.java
index db876a46..59390a86 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DateTimeSheetField.java
@@ -27,21 +27,33 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class DateTimeSheetField extends SheetField {
private final DateTimeFieldProperty propertyDateTime;
+
/**
- * Instantiates a new Date time sheet field.
+ * Create date time sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param dateTimeProperty the date time property
+ * @return the date time sheet field
+ */
+ public static DateTimeSheetField create(String fieldTitle, DateTimeFieldProperty dateTimeProperty) {
+ return update(null, fieldTitle, dateTimeProperty);
+ }
+
+ /**
+ * Update date time sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyDateTime the property date time
+ * @param fieldTitle the field title
+ * @param dateTimeProperty the date time property
+ * @return the date time sheet field
*/
- public DateTimeSheetField(String fieldId, SheetFieldType fieldType, DateTimeFieldProperty propertyDateTime) {
- super(fieldId, fieldType);
- this.propertyDateTime = propertyDateTime;
+ public static DateTimeSheetField update(String fieldId, String fieldTitle, DateTimeFieldProperty dateTimeProperty) {
+ return new DateTimeSheetField(fieldId, SheetFieldType.FIELD_TYPE_DATE_TIME, fieldTitle, dateTimeProperty);
}
/**
@@ -50,14 +62,14 @@ public DateTimeSheetField(String fieldId, SheetFieldType fieldType, DateTimeFiel
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyDateTime the property date time
+ * @param dateTimeProperty the date time property
*/
@JsonCreator
- public DateTimeSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_date_time") DateTimeFieldProperty propertyDateTime) {
+ DateTimeSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_date_time") DateTimeFieldProperty dateTimeProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyDateTime = propertyDateTime;
+ this.propertyDateTime = dateTimeProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DelRecordRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DelRecordRequest.java
new file mode 100644
index 00000000..6a182d5a
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/DelRecordRequest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author dax
+ * @since 2024/12/24
+ */
+@Data
+public class DelRecordRequest {
+ private final String docid;
+ private final String sheetId;
+ private final List recordIds;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/EmailSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/EmailSheetField.java
new file mode 100644
index 00000000..9455b58f
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/EmailSheetField.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SheetFieldType;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The type Text sheet field.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+public class EmailSheetField extends SheetField {
+
+
+ /**
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static EmailSheetField create(String fieldTitle) {
+ return update(null, fieldTitle);
+ }
+
+ /**
+ * Update progress sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static EmailSheetField update(String fieldId, String fieldTitle) {
+ return new EmailSheetField(fieldId, SheetFieldType.FIELD_TYPE_EMAIL, fieldTitle);
+ }
+
+ /**
+ * Instantiates a new Sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ */
+ @JsonCreator
+ EmailSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle) {
+ super(fieldId, fieldType, fieldTitle);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ImageSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ImageSheetField.java
new file mode 100644
index 00000000..66614b45
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ImageSheetField.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SheetFieldType;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The type Text sheet field.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+public class ImageSheetField extends SheetField {
+
+
+ /**
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static ImageSheetField create(String fieldTitle) {
+ return update(null, fieldTitle);
+ }
+
+ /**
+ * Update progress sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static ImageSheetField update(String fieldId, String fieldTitle) {
+ return new ImageSheetField(fieldId, SheetFieldType.FIELD_TYPE_IMAGE, fieldTitle);
+ }
+
+ /**
+ * Instantiates a new Sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ */
+ @JsonCreator
+ ImageSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle) {
+ super(fieldId, fieldType, fieldTitle);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/LocationSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/LocationSheetField.java
index 4c9de92b..8ceb8920 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/LocationSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/LocationSheetField.java
@@ -27,21 +27,32 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class LocationSheetField extends SheetField {
private final LocationFieldProperty propertyLocation;
/**
- * Instantiates a new Location sheet field.
+ * Create location sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param locationProperty the location property
+ * @return the location sheet field
+ */
+ public static LocationSheetField create(String fieldTitle, LocationFieldProperty locationProperty) {
+ return update(null, fieldTitle, locationProperty);
+ }
+
+ /**
+ * Update location sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyLocation the property location
+ * @param fieldTitle the field title
+ * @param locationProperty the location property
+ * @return the location sheet field
*/
- public LocationSheetField(String fieldId, SheetFieldType fieldType, LocationFieldProperty propertyLocation) {
- super(fieldId, fieldType);
- this.propertyLocation = propertyLocation;
+ public static LocationSheetField update(String fieldId, String fieldTitle, LocationFieldProperty locationProperty) {
+ return new LocationSheetField(fieldId, SheetFieldType.FIELD_TYPE_LOCATION, fieldTitle, locationProperty);
}
/**
@@ -50,14 +61,14 @@ public LocationSheetField(String fieldId, SheetFieldType fieldType, LocationFiel
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyLocation the property location
+ * @param locationProperty the location property
*/
@JsonCreator
- public LocationSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_location") LocationFieldProperty propertyLocation) {
+ LocationSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_location") LocationFieldProperty locationProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyLocation = propertyLocation;
+ this.propertyLocation = locationProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ModifiedTimeSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ModifiedTimeSheetField.java
index d693ea93..a160d8e4 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ModifiedTimeSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ModifiedTimeSheetField.java
@@ -27,37 +27,48 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class ModifiedTimeSheetField extends SheetField {
private final TimeFieldProperty propertyModifiedTime;
/**
- * Instantiates a new ModifiedTime sheet field.
+ * Create modified time sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param propertyModifiedTime the property modified time
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
+ * @return the modified time sheet field
*/
- public ModifiedTimeSheetField(String fieldId, SheetFieldType fieldType, TimeFieldProperty propertyModifiedTime) {
- super(fieldId, fieldType);
- this.propertyModifiedTime = propertyModifiedTime;
+ public static ModifiedTimeSheetField create(String fieldTitle, TimeFieldProperty timeProperty) {
+ return update(null, fieldTitle, timeProperty);
+ }
+
+ /**
+ * Of modified time sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
+ * @return the modified time sheet field
+ */
+ public static ModifiedTimeSheetField update(String fieldId, String fieldTitle, TimeFieldProperty timeProperty) {
+ return new ModifiedTimeSheetField(fieldId, SheetFieldType.FIELD_TYPE_MODIFIED_TIME, fieldTitle, timeProperty);
}
/**
* Instantiates a new Modified time sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param fieldTitle the field title
- * @param propertyModifiedTime the property modified time
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ * @param timeProperty the time property
*/
@JsonCreator
- public ModifiedTimeSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_modified_time") TimeFieldProperty propertyModifiedTime) {
+ ModifiedTimeSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_modified_time") TimeFieldProperty timeProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyModifiedTime = propertyModifiedTime;
+ this.propertyModifiedTime = timeProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/NumberSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/NumberSheetField.java
index b66af088..3118d0cf 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/NumberSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/NumberSheetField.java
@@ -27,21 +27,32 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class NumberSheetField extends SheetField {
private final NumberFieldProperty propertyNumber;
/**
- * Instantiates a new Number sheet field.
+ * Create number sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param numberProperty the number property
+ * @return the number sheet field
+ */
+ public static NumberSheetField create(String fieldTitle, NumberFieldProperty numberProperty) {
+ return update(null, fieldTitle, numberProperty);
+ }
+
+ /**
+ * Update number sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyNumber the property number
+ * @param fieldTitle the field title
+ * @param numberProperty the number property
+ * @return the number sheet field
*/
- public NumberSheetField(String fieldId, SheetFieldType fieldType, NumberFieldProperty propertyNumber) {
- super(fieldId, fieldType);
- this.propertyNumber = propertyNumber;
+ public static NumberSheetField update(String fieldId, String fieldTitle, NumberFieldProperty numberProperty) {
+ return new NumberSheetField(fieldId, SheetFieldType.FIELD_TYPE_NUMBER, fieldTitle, numberProperty);
}
/**
@@ -50,14 +61,14 @@ public NumberSheetField(String fieldId, SheetFieldType fieldType, NumberFieldPro
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyNumber the property number
+ * @param numberProperty the number property
*/
@JsonCreator
- public NumberSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_number") NumberFieldProperty propertyNumber) {
+ NumberSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_number") NumberFieldProperty numberProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyNumber = propertyNumber;
+ this.propertyNumber = numberProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/PhoneNumberSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/PhoneNumberSheetField.java
new file mode 100644
index 00000000..8014d983
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/PhoneNumberSheetField.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SheetFieldType;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The type Text sheet field.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+public class PhoneNumberSheetField extends SheetField {
+
+ /**
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static PhoneNumberSheetField create(String fieldTitle) {
+ return update(null, fieldTitle);
+ }
+
+ /**
+ * Update progress sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static PhoneNumberSheetField update(String fieldId, String fieldTitle) {
+ return new PhoneNumberSheetField(fieldId, SheetFieldType.FIELD_TYPE_PHONE_NUMBER, fieldTitle);
+ }
+
+ /**
+ * Instantiates a new Sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ */
+ @JsonCreator
+ PhoneNumberSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle) {
+ super(fieldId, fieldType, fieldTitle);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ProgressSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ProgressSheetField.java
index 99ce8a29..1bba01d6 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ProgressSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ProgressSheetField.java
@@ -27,21 +27,32 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class ProgressSheetField extends SheetField {
private final ProgressFieldProperty propertyProgress;
/**
- * Instantiates a new Progress sheet field.
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param progressProperty the progress property
+ * @return the progress sheet field
+ */
+ public static ProgressSheetField create(String fieldTitle, ProgressFieldProperty progressProperty) {
+ return update(null, fieldTitle, progressProperty);
+ }
+
+ /**
+ * Update progress sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyProgress the property progress
+ * @param fieldTitle the field title
+ * @param progressProperty the progress property
+ * @return the progress sheet field
*/
- public ProgressSheetField(String fieldId, SheetFieldType fieldType, ProgressFieldProperty propertyProgress) {
- super(fieldId, fieldType);
- this.propertyProgress = propertyProgress;
+ public static ProgressSheetField update(String fieldId, String fieldTitle, ProgressFieldProperty progressProperty) {
+ return new ProgressSheetField(fieldId, SheetFieldType.FIELD_TYPE_PROGRESS, fieldTitle, progressProperty);
}
/**
@@ -50,14 +61,14 @@ public ProgressSheetField(String fieldId, SheetFieldType fieldType, ProgressFiel
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyProgress the property progress
+ * @param progressProperty the progress property
*/
@JsonCreator
- public ProgressSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_progress") ProgressFieldProperty propertyProgress) {
+ ProgressSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_progress") ProgressFieldProperty progressProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyProgress = propertyProgress;
+ this.propertyProgress = progressProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/QuerySheetRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/QuerySheetRequest.java
new file mode 100644
index 00000000..06cb4e1b
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/QuerySheetRequest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+@ToString
+@Getter
+public class QuerySheetRequest {
+ private final String docid;
+ private String sheetId;
+ private Boolean needAllTypeSheet;
+
+ public QuerySheetRequest(String docId) {
+ this.docid = docId;
+ }
+
+ public QuerySheetRequest(String docId, String sheetId) {
+ this.docid = docId;
+ this.sheetId = sheetId;
+ }
+
+ public QuerySheetRequest(String docId, Boolean needAllTypeSheet) {
+ this.docid = docId;
+ this.needAllTypeSheet = needAllTypeSheet;
+ }
+
+ public QuerySheetRequest(String docId, String sheetId, Boolean needAllTypeSheet) {
+ this.docid = docId;
+ this.sheetId = sheetId;
+ this.needAllTypeSheet = needAllTypeSheet;
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpGroupIds.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordResult.java
similarity index 78%
rename from wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpGroupIds.java
rename to wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordResult.java
index 28db5f64..16b928ec 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/externalcontact/CorpGroupIds.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordResult.java
@@ -13,17 +13,18 @@
* limitations under the License.
*/
-package cn.felord.domain.externalcontact;
+package cn.felord.domain.wedoc.smartsheet;
import lombok.Data;
-import java.util.Set;
+import java.util.Map;
/**
* @author dax
- * @since 2021/7/12 16:46
+ * @since 2024/12/24
*/
@Data
-public class CorpGroupIds implements CorpTagIterator {
- private final Set groupId;
+public class RecordResult {
+ private String recordId;
+ private Map values;
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordValues.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordValues.java
new file mode 100644
index 00000000..668fa733
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/RecordValues.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 智能表数据行值
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+@ToString
+@Getter
+public class RecordValues {
+
+ private final Map values = new HashMap<>();
+
+ /**
+ * 创建一行数据
+ *
+ * @return the record values
+ */
+ public static RecordValues row() {
+ return new RecordValues();
+ }
+
+ /**
+ * 文本
+ *
+ * @param key the key
+ * @param texts the texts
+ * @return the record values
+ */
+ public RecordValues text(String key, List texts) {
+ this.values.put(key, texts.stream().map(CellTextValue::text).collect(Collectors.toList()));
+ return this;
+ }
+
+ /**
+ * 数字
+ *
+ * @param key the key
+ * @param number the number
+ * @return the record values
+ */
+ public RecordValues number(String key, double number) {
+ this.values.put(key, number);
+ return this;
+ }
+
+ /**
+ * 复选框
+ *
+ * @param key the key
+ * @param checked the checked
+ * @return the record values
+ */
+ public RecordValues checkBox(String key, boolean checked) {
+ this.values.put(key, checked);
+ return this;
+ }
+
+ /**
+ * 日期
+ *
+ * @param key the key
+ * @param dateTime the date time
+ * @return the record values
+ */
+ public RecordValues dateTime(String key, Instant dateTime) {
+ this.values.put(key, String.valueOf(dateTime.toEpochMilli()));
+ return this;
+ }
+
+ /**
+ * 图片
+ *
+ * @param key the key
+ * @param images the images
+ * @return the record values
+ */
+ public RecordValues image(String key, List images) {
+ this.values.put(key, images);
+ return this;
+ }
+
+ /**
+ * 文件
+ *
+ * @param key the key
+ * @param attachment the attachment
+ * @return the record values
+ */
+ public RecordValues attachment(String key, List attachment) {
+ this.values.put(key, attachment);
+ return this;
+ }
+
+ /**
+ * 成员
+ *
+ * @param key the key
+ * @param userIds the user ids
+ * @return the record values
+ */
+ public RecordValues user(String key, List userIds) {
+ this.values.put(key, userIds.stream().map(CellUserValue::new).collect(Collectors.toList()));
+ return this;
+ }
+
+ /**
+ * 链接
+ *
+ * @param key the key
+ * @param urls the urls
+ * @return the record values
+ */
+ public RecordValues url(String key, CellUrlValue urls) {
+ return url(key, Collections.singletonList(urls));
+ }
+
+ /**
+ * 链接
+ *
+ * 数组类型为预留能力,目前只支持展示一个链接,建议只传入一个链接
+ *
+ * @param key the key
+ * @param urls the urls
+ * @return the record values
+ */
+ public RecordValues url(String key, List urls) {
+ this.values.put(key, urls);
+ return this;
+ }
+
+ /**
+ * 单选与多选
+ *
+ * @param key the key
+ * @param options the options
+ * @return the record values
+ */
+ public RecordValues option(String key, List options) {
+ this.values.put(key, options);
+ return this;
+ }
+
+ /**
+ * 进度
+ *
+ * @param key the key
+ * @param percentage the percentage
+ * @return the record values
+ */
+ public RecordValues progress(String key, double percentage) {
+ this.values.put(key, percentage);
+ return this;
+ }
+
+ /**
+ * 电话
+ *
+ * @param key the key
+ * @param phoneNumber the phone number
+ * @return the record values
+ */
+ public RecordValues phoneNumber(String key, String phoneNumber) {
+ this.values.put(key, phoneNumber);
+ return this;
+ }
+
+ /**
+ * 邮箱
+ *
+ * @param key the key
+ * @param email the email
+ * @return the record values
+ */
+ public RecordValues email(String key, String email) {
+ this.values.put(key, email);
+ return this;
+ }
+
+ /**
+ * 地理位置
+ *
+ * @param key the key
+ * @param location the location
+ * @return the record values
+ */
+ public RecordValues location(String key, CellLocationValue location) {
+ this.values.put(key, Collections.singletonList(location));
+ return this;
+ }
+
+ /**
+ * 货币
+ *
+ * @param key the key
+ * @param currency the currency
+ * @return the record values
+ */
+ public RecordValues currency(String key, double currency) {
+ this.values.put(key, currency);
+ return this;
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ReferenceSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ReferenceSheetField.java
index c71b1c0a..0211a80c 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ReferenceSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ReferenceSheetField.java
@@ -27,37 +27,50 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class ReferenceSheetField extends SheetField {
private final ReferenceFieldProperty propertyReference;
+
/**
- * Instantiates a new Reference sheet field.
+ * Create reference sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param referenceProperty the reference property
+ * @return the progress sheet field
+ */
+ public static ReferenceSheetField create(String fieldTitle, ReferenceFieldProperty referenceProperty) {
+ return update(null, fieldTitle, referenceProperty);
+ }
+
+ /**
+ * Update reference sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyReference the property reference
+ * @param fieldTitle the field title
+ * @param referenceProperty the reference property
+ * @return the progress sheet field
*/
- public ReferenceSheetField(String fieldId, SheetFieldType fieldType, ReferenceFieldProperty propertyReference) {
- super(fieldId, fieldType);
- this.propertyReference = propertyReference;
+ public static ReferenceSheetField update(String fieldId, String fieldTitle, ReferenceFieldProperty referenceProperty) {
+ return new ReferenceSheetField(fieldId, SheetFieldType.FIELD_TYPE_REFERENCE, fieldTitle, referenceProperty);
}
+
/**
* Instantiates a new Reference sheet field.
*
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyReference the property reference
+ * @param referenceProperty the reference property
*/
@JsonCreator
- public ReferenceSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_reference") ReferenceFieldProperty propertyReference) {
+ ReferenceSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_reference") ReferenceFieldProperty referenceProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyReference = propertyReference;
+ this.propertyReference = referenceProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldOption.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldOption.java
index 4ad79aef..2b60711e 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldOption.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldOption.java
@@ -32,7 +32,7 @@
public class SelectFieldOption {
private final String id;
private final String text;
- private final Integer style;
+ private final SelectFieldStyle style;
/**
* Instantiates a new Select field option.
@@ -42,22 +42,31 @@ public class SelectFieldOption {
* @param style the style
*/
@JsonCreator
- SelectFieldOption(@JsonProperty("id") String id,
- @JsonProperty("text") String text,
- @JsonProperty("style") Integer style) {
+ public SelectFieldOption(@JsonProperty("id") String id,
+ @JsonProperty("text") String text,
+ @JsonProperty("style") SelectFieldStyle style) {
this.id = id;
this.text = text;
this.style = style;
}
/**
- * Instantiates a new Select field option.
+ * 选择时以ID为准,当选项存在时,通过ID识别选项,当需要新增选项,则不填写此字段
*
- * @param id the id
- * @param text the text
- * @param style the style
+ * @param id the id
+ * @return the select field option
+ */
+ public static SelectFieldOption selectWithId(String id) {
+ return new SelectFieldOption(id, null, null);
+ }
+
+ /**
+ * 要填写的选项内容。新增选项时填写,已经存在时优先匹配已经存在的选项,否则会新增选项
+ *
+ * @param text the text
+ * @return the select field option
*/
- public SelectFieldOption(String id, String text, SelectFieldStyle style) {
- this(id, text, style.getStyle());
+ public static SelectFieldOption selectWithText(String text) {
+ return new SelectFieldOption(null, text, null);
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldProperty.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldProperty.java
index 1e3c9858..3901359b 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldProperty.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectFieldProperty.java
@@ -41,7 +41,7 @@ public class SelectFieldProperty {
* @param options the options
*/
@JsonCreator
- public SelectFieldProperty(@JsonProperty("isQuickAdd") Boolean isQuickAdd,
+ public SelectFieldProperty(@JsonProperty("is_quick_add") Boolean isQuickAdd,
@JsonProperty("options") List options) {
this.isQuickAdd = isQuickAdd;
this.options = options;
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectSheetField.java
index 1b1bd1ee..d6d2112d 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SelectSheetField.java
@@ -27,21 +27,33 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class SelectSheetField extends SheetField {
private final SelectFieldProperty propertySelect;
+
/**
- * Instantiates a new Select sheet field.
+ * Create select sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param selectProperty the select property
+ * @return the progress sheet field
+ */
+ public static SelectSheetField create(String fieldTitle, SelectFieldProperty selectProperty) {
+ return update(null, fieldTitle, selectProperty);
+ }
+
+ /**
+ * Update select sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertySelect the property select
+ * @param fieldTitle the field title
+ * @param selectProperty the select property
+ * @return the progress sheet field
*/
- public SelectSheetField(String fieldId, SheetFieldType fieldType, SelectFieldProperty propertySelect) {
- super(fieldId, fieldType);
- this.propertySelect = propertySelect;
+ public static SelectSheetField update(String fieldId, String fieldTitle, SelectFieldProperty selectProperty) {
+ return new SelectSheetField(fieldId, SheetFieldType.FIELD_TYPE_SELECT, fieldTitle, selectProperty);
}
/**
@@ -50,14 +62,14 @@ public SelectSheetField(String fieldId, SheetFieldType fieldType, SelectFieldPro
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertySelect the property select
+ * @param selectProperty the select property
*/
@JsonCreator
- public SelectSheetField(@JsonProperty("field_id") String fieldId,
+ SelectSheetField(@JsonProperty("field_id") String fieldId,
@JsonProperty("field_type") SheetFieldType fieldType,
@JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_select") SelectFieldProperty propertySelect) {
+ @JsonProperty("property_select") SelectFieldProperty selectProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertySelect = propertySelect;
+ this.propertySelect = selectProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetAuthRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetAuthRequest.java
new file mode 100644
index 00000000..e5e970bb
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetAuthRequest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+import java.util.Set;
+
+/**
+ * The type Sheet auth request.
+ * todo
+ *
+ * @author dax
+ * @since 2024 /12/25
+ */
+@Data
+public class SheetAuthRequest {
+ private final String docid;
+ private final Integer type;
+ private final Set ruleIdList;
+
+ /**
+ * Instantiates a new Sheet auth request.
+ *
+ * @param docid the docid
+ * @param type the type
+ * @param ruleIdList the rule id list
+ */
+ SheetAuthRequest(String docid, Integer type, Set ruleIdList) {
+ this.docid = docid;
+ this.type = type;
+ this.ruleIdList = ruleIdList;
+ }
+
+ /**
+ * 全员权限
+ *
+ * @param docId the doc id
+ * @return the sheet auth request
+ */
+ public static SheetAuthRequest all(String docId) {
+ return new SheetAuthRequest(docId, 1, null);
+ }
+
+ /**
+ * 额外权限
+ *
+ * @param docId the doc id
+ * @param ruleIdList the rule id list
+ * @return the sheet auth request
+ */
+ public static SheetAuthRequest additional(String docId, Set ruleIdList) {
+ return new SheetAuthRequest(docId, 2, ruleIdList);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetField.java
index c77e5e3b..7e884e56 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SheetField.java
@@ -31,13 +31,13 @@
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
- property = "fieldType", visible = true)
+ property = "field_type", visible = true)
@JsonSubTypes({
- @JsonSubTypes.Type(value = SheetField.class, name = "FIELD_TYPE_TEXT"),
+ @JsonSubTypes.Type(value = TextSheetField.class, name = "FIELD_TYPE_TEXT"),
@JsonSubTypes.Type(value = NumberSheetField.class, name = "FIELD_TYPE_NUMBER"),
@JsonSubTypes.Type(value = CurrencySheetField.class, name = "FIELD_TYPE_CHECKBOX"),
@JsonSubTypes.Type(value = DateTimeSheetField.class, name = "FIELD_TYPE_DATE_TIME"),
- @JsonSubTypes.Type(value = SheetField.class, name = "FIELD_TYPE_IMAGE"),
+ @JsonSubTypes.Type(value = ImageSheetField.class, name = "FIELD_TYPE_IMAGE"),
@JsonSubTypes.Type(value = AttachmentSheetField.class, name = "FIELD_TYPE_ATTACHMENT"),
@JsonSubTypes.Type(value = UserSheetField.class, name = "FIELD_TYPE_USER"),
@JsonSubTypes.Type(value = UrlSheetField.class, name = "FIELD_TYPE_URL"),
@@ -47,8 +47,8 @@
@JsonSubTypes.Type(value = CreatedTimeSheetField.class, name = "FIELD_TYPE_CREATED_TIME"),
@JsonSubTypes.Type(value = ModifiedTimeSheetField.class, name = "FIELD_TYPE_MODIFIED_TIME"),
@JsonSubTypes.Type(value = ProgressSheetField.class, name = "FIELD_TYPE_PROGRESS"),
- @JsonSubTypes.Type(value = SheetField.class, name = "FIELD_TYPE_PHONE_NUMBER"),
- @JsonSubTypes.Type(value = SheetField.class, name = "FIELD_TYPE_EMAIL"),
+ @JsonSubTypes.Type(value = PhoneNumberSheetField.class, name = "FIELD_TYPE_PHONE_NUMBER"),
+ @JsonSubTypes.Type(value = EmailSheetField.class, name = "FIELD_TYPE_EMAIL"),
@JsonSubTypes.Type(value = SingleSelectSheetField.class, name = "FIELD_TYPE_SINGLE_SELECT"),
@JsonSubTypes.Type(value = ReferenceSheetField.class, name = "FIELD_TYPE_REFERENCE"),
@JsonSubTypes.Type(value = LocationSheetField.class, name = "FIELD_TYPE_LOCATION"),
@@ -58,21 +58,11 @@
})
@ToString
@Getter
-public class SheetField {
+public abstract class SheetField {
private final String fieldId;
private final SheetFieldType fieldType;
private final String fieldTitle;
- /**
- * Instantiates a new Sheet field.
- *
- * @param fieldId the field id
- * @param fieldType the field type
- */
- public SheetField(String fieldId, SheetFieldType fieldType) {
- this(fieldId, fieldType, null);
- }
-
/**
* Instantiates a new Sheet field.
*
@@ -81,9 +71,9 @@ public SheetField(String fieldId, SheetFieldType fieldType) {
* @param fieldTitle the field title
*/
@JsonCreator
- public SheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle) {
+ SheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle) {
this.fieldId = fieldId;
this.fieldType = fieldType;
this.fieldTitle = fieldTitle;
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SingleSelectSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SingleSelectSheetField.java
index 0f1d8f1c..023eb75d 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SingleSelectSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SingleSelectSheetField.java
@@ -27,37 +27,50 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class SingleSelectSheetField extends SheetField {
private final SelectFieldProperty propertySingleSelect;
+
/**
- * Instantiates a new Single select sheet field.
+ * Create single select sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param selectProperty the select property
+ * @return the progress sheet field
+ */
+ public static SingleSelectSheetField create(String fieldTitle, SelectFieldProperty selectProperty) {
+ return update(null, fieldTitle, selectProperty);
+ }
+
+ /**
+ * Update single select sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param propertySingleSelect the propertySingleSelect
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @param selectProperty the select property
+ * @return the progress sheet field
*/
- public SingleSelectSheetField(String fieldId, SheetFieldType fieldType, SelectFieldProperty propertySingleSelect) {
- super(fieldId, fieldType);
- this.propertySingleSelect = propertySingleSelect;
+ public static SingleSelectSheetField update(String fieldId, String fieldTitle, SelectFieldProperty selectProperty) {
+ return new SingleSelectSheetField(fieldId, SheetFieldType.FIELD_TYPE_SINGLE_SELECT, fieldTitle, selectProperty);
}
+
/**
* Instantiates a new Single select sheet field.
*
- * @param fieldId the field id
- * @param fieldType the field type
- * @param fieldTitle the field title
- * @param propertySingleSelect the propertySingleSelect
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ * @param selectProperty the select property
*/
@JsonCreator
- public SingleSelectSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_single_select") SelectFieldProperty propertySingleSelect) {
+ SingleSelectSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_single_select") SelectFieldProperty selectProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertySingleSelect = propertySingleSelect;
+ this.propertySingleSelect = selectProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsRequest.java
new file mode 100644
index 00000000..14d40d0c
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+import java.util.Set;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@Data
+public class SmartFieldsRequest {
+ private final String docid;
+ private final String sheetId;
+ private String viewId;
+ private Set fieldIds;
+ private Set fieldTitles;
+ private Integer offset;
+ private Integer limit;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsResponse.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsResponse.java
new file mode 100644
index 00000000..7d84cb0d
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartFieldsResponse.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.domain.WeComResponse;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SmartFieldsResponse extends WeComResponse {
+ private Integer total;
+ private List fields;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsRequest.java
new file mode 100644
index 00000000..515144db
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsRequest.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.util.Set;
+
+/**
+ * The type Smart records request.
+ *
+ * @author dax
+ * @since 2024 /12/25
+ */
+@ToString
+@Getter
+public class SmartRecordsRequest {
+ private final String docid;
+ private final String sheetId;
+ private final String keyType;
+ private String viewId;
+ private Set recordIds;
+ private Set fieldIds;
+ private Set fieldTitles;
+ private Integer offset;
+ private Integer limit;
+
+ /**
+ * Instantiates a new Smart records request.
+ *
+ * @param docid the docid
+ * @param sheetId the sheet id
+ * @param keyType the key type
+ */
+ SmartRecordsRequest(String docid, String sheetId, String keyType) {
+ this.docid = docid;
+ this.sheetId = sheetId;
+ this.keyType = keyType;
+ }
+
+ /**
+ * key用字段ID表示
+ *
+ * @param docid the docid
+ * @param sheetId the sheet id
+ * @return the smart records request
+ */
+ public static SmartRecordsRequest byFieldId(String docid, String sheetId) {
+ return new SmartRecordsRequest(docid, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_ID");
+ }
+
+ /**
+ * key用字段标题表示
+ *
+ * @param docid the docid
+ * @param sheetId the sheet id
+ * @return the smart records request
+ */
+ public static SmartRecordsRequest byFieldTitle(String docid, String sheetId) {
+ return new SmartRecordsRequest(docid, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_TITLE");
+ }
+
+ /**
+ * View id smart records request.
+ *
+ * @param viewId the view id
+ * @return the smart records request
+ */
+ public SmartRecordsRequest viewId(String viewId) {
+ this.viewId = viewId;
+ return this;
+ }
+
+ /**
+ * Record ids smart records request.
+ *
+ * @param recordIds the record ids
+ * @return the smart records request
+ */
+ public SmartRecordsRequest recordIds(Set recordIds) {
+ this.recordIds = recordIds;
+ return this;
+ }
+
+ /**
+ * Field ids smart records request.
+ *
+ * @param fieldIds the field ids
+ * @return the smart records request
+ */
+ public SmartRecordsRequest fieldIds(Set fieldIds) {
+ this.fieldIds = fieldIds;
+ return this;
+ }
+
+ /**
+ * Field titles smart records request.
+ *
+ * @param fieldTitles the field titles
+ * @return the smart records request
+ */
+ public SmartRecordsRequest fieldTitles(Set fieldTitles) {
+ this.fieldTitles = fieldTitles;
+ return this;
+ }
+
+ /**
+ * Offset smart records request.
+ *
+ * @param offset the offset
+ * @return the smart records request
+ */
+ public SmartRecordsRequest offset(Integer offset) {
+ this.offset = offset;
+ return this;
+ }
+
+ /**
+ * Limit smart records request.
+ *
+ * @param limit the limit
+ * @return the smart records request
+ */
+ public SmartRecordsRequest limit(Integer limit) {
+ this.limit = limit;
+ return this;
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsResponse.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsResponse.java
new file mode 100644
index 00000000..cec84c1c
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartRecordsResponse.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.domain.WeComResponse;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SmartRecordsResponse extends WeComResponse {
+
+ private Integer total;
+ private Boolean hasMore;
+ private Integer next;
+ private List records;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartSheetInfo.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartSheetInfo.java
new file mode 100644
index 00000000..8c869e13
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartSheetInfo.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SmartSheetType;
+import lombok.Data;
+
+@Data
+public class SmartSheetInfo {
+ private String sheetId;
+ private String title;
+ private Boolean isVisible;
+ private SmartSheetType type;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartView.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartView.java
new file mode 100644
index 00000000..c9fdec3f
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartView.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SmartSheetViewType;
+import lombok.Data;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@Data
+public class SmartView {
+ private String viewId;
+ private String viewTitle;
+ private SmartSheetViewType viewType;
+ private SmartViewProperty property;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewProperty.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewProperty.java
new file mode 100644
index 00000000..60aa19dc
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewProperty.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@Data
+public class SmartViewProperty {
+ private Boolean autoSort;
+ private SortSpec sortSpec;
+ private GroupSpec groupSpec;
+ private FilterSpec filterSpec;
+ private Boolean isFieldStatEnabled;
+ private Map fieldVisibility;
+ private Integer frozenFieldCount;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewRequest.java
new file mode 100644
index 00000000..a625b380
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewRequest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Data;
+
+import java.util.Set;
+
+@Data
+public class SmartViewRequest {
+ private final String sheetId;
+ private final String docid;
+ private Set viewIds;
+ private Integer offset;
+ private Integer limit;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewsResponse.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewsResponse.java
new file mode 100644
index 00000000..a43d4112
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/SmartViewsResponse.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.domain.WeComResponse;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SmartViewsResponse extends WeComResponse {
+
+ private Integer total;
+ private Boolean hasMore;
+ private Integer next;
+ private List views;
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/TextSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/TextSheetField.java
new file mode 100644
index 00000000..1f971167
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/TextSheetField.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import cn.felord.enumeration.SheetFieldType;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The type Text sheet field.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+public class TextSheetField extends SheetField {
+
+
+ /**
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static TextSheetField create(String fieldTitle) {
+ return update(null, fieldTitle);
+ }
+
+ /**
+ * Update progress sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldTitle the field title
+ * @return the progress sheet field
+ */
+ public static TextSheetField update(String fieldId, String fieldTitle) {
+ return new TextSheetField(fieldId, SheetFieldType.FIELD_TYPE_TEXT, fieldTitle);
+ }
+
+ /**
+ * Instantiates a new Sheet field.
+ *
+ * @param fieldId the field id
+ * @param fieldType the field type
+ * @param fieldTitle the field title
+ */
+ @JsonCreator
+ TextSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle) {
+ super(fieldId, fieldType, fieldTitle);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordRequest.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordRequest.java
new file mode 100644
index 00000000..912b81b2
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordRequest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * The type Add record request.
+ *
+ * @author dax
+ * @since 2024 /12/23
+ */
+@ToString
+@Getter
+public class UpdateRecordRequest {
+ private final String docid;
+ private final String sheetId;
+ private final String keyType;
+ private final List records;
+
+
+ /**
+ * Instantiates a new Add record request.
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param keyType the key type
+ * @param records the records
+ */
+ UpdateRecordRequest(String docId, String sheetId, String keyType, List records) {
+ this.docid = docId;
+ this.sheetId = sheetId;
+ this.keyType = keyType;
+ this.records = records;
+ }
+
+
+ /**
+ * key用字段标题表示
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param records the records
+ * @return the add record request
+ */
+ public static UpdateRecordRequest byFieldId(String docId, String sheetId, List records) {
+ return new UpdateRecordRequest(docId, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_ID", records);
+ }
+
+ /**
+ * key用字段 ID 表示
+ *
+ * @param docId the doc id
+ * @param sheetId the sheet id
+ * @param records the records
+ * @return the add record request
+ */
+ public static UpdateRecordRequest byFieldTitle(String docId, String sheetId, List records) {
+ return new UpdateRecordRequest(docId, sheetId, "CELL_VALUE_KEY_TYPE_FIELD_TITLE", records);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordValues.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordValues.java
new file mode 100644
index 00000000..81e33dc6
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UpdateRecordValues.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import lombok.Getter;
+import lombok.ToString;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author dax
+ * @since 2024/12/24
+ */
+@ToString
+@Getter
+public class UpdateRecordValues {
+ private final String recordId;
+ private final Map values = new HashMap<>();
+
+ UpdateRecordValues(String recordId) {
+ this.recordId = recordId;
+ }
+
+ public static UpdateRecordValues updateById(String recordId) {
+ return new UpdateRecordValues(recordId);
+ }
+
+
+ /**
+ * 文本
+ *
+ * @param key the key
+ * @param texts the texts
+ * @return the record values
+ */
+ public UpdateRecordValues text(String key, List texts) {
+ this.values.put(key, texts.stream().map(CellTextValue::text).collect(Collectors.toList()));
+ return this;
+ }
+
+ /**
+ * 数字
+ *
+ * @param key the key
+ * @param number the number
+ * @return the record values
+ */
+ public UpdateRecordValues number(String key, double number) {
+ this.values.put(key, number);
+ return this;
+ }
+
+ /**
+ * 复选框
+ *
+ * @param key the key
+ * @param checked the checked
+ * @return the record values
+ */
+ public UpdateRecordValues checkBox(String key, boolean checked) {
+ this.values.put(key, checked);
+ return this;
+ }
+
+ /**
+ * 日期
+ *
+ * @param key the key
+ * @param dateTime the date time
+ * @return the record values
+ */
+ public UpdateRecordValues dateTime(String key, Instant dateTime) {
+ this.values.put(key, String.valueOf(dateTime.toEpochMilli()));
+ return this;
+ }
+
+ /**
+ * 图片
+ *
+ * @param key the key
+ * @param images the images
+ * @return the record values
+ */
+ public UpdateRecordValues image(String key, List images) {
+ this.values.put(key, images);
+ return this;
+ }
+
+ /**
+ * 文件
+ *
+ * @param key the key
+ * @param attachment the attachment
+ * @return the record values
+ */
+ public UpdateRecordValues attachment(String key, List attachment) {
+ this.values.put(key, attachment);
+ return this;
+ }
+
+ /**
+ * 成员
+ *
+ * @param key the key
+ * @param userIds the user ids
+ * @return the record values
+ */
+ public UpdateRecordValues user(String key, List userIds) {
+ this.values.put(key, userIds.stream().map(CellUserValue::new).collect(Collectors.toList()));
+ return this;
+ }
+
+ /**
+ * 链接
+ *
+ * @param key the key
+ * @param urls the urls
+ * @return the record values
+ */
+ public UpdateRecordValues url(String key, CellUrlValue urls) {
+ return url(key, Collections.singletonList(urls));
+ }
+
+ /**
+ * 链接
+ *
+ * 数组类型为预留能力,目前只支持展示一个链接,建议只传入一个链接
+ *
+ * @param key the key
+ * @param urls the urls
+ * @return the record values
+ */
+ public UpdateRecordValues url(String key, List urls) {
+ this.values.put(key, urls);
+ return this;
+ }
+
+ /**
+ * 单选与多选
+ *
+ * @param key the key
+ * @param options the options
+ * @return the record values
+ */
+ public UpdateRecordValues option(String key, List options) {
+ this.values.put(key, options);
+ return this;
+ }
+
+ /**
+ * 进度
+ *
+ * @param key the key
+ * @param percentage the percentage
+ * @return the record values
+ */
+ public UpdateRecordValues progress(String key, double percentage) {
+ this.values.put(key, percentage);
+ return this;
+ }
+
+ /**
+ * 电话
+ *
+ * @param key the key
+ * @param phoneNumber the phone number
+ * @return the record values
+ */
+ public UpdateRecordValues phoneNumber(String key, String phoneNumber) {
+ this.values.put(key, phoneNumber);
+ return this;
+ }
+
+ /**
+ * 邮箱
+ *
+ * @param key the key
+ * @param email the email
+ * @return the record values
+ */
+ public UpdateRecordValues email(String key, String email) {
+ this.values.put(key, email);
+ return this;
+ }
+
+ /**
+ * 地理位置
+ *
+ * @param key the key
+ * @param location the location
+ * @return the record values
+ */
+ public UpdateRecordValues location(String key, CellLocationValue location) {
+ this.values.put(key, Collections.singletonList(location));
+ return this;
+ }
+
+ /**
+ * 货币
+ *
+ * @param key the key
+ * @param currency the currency
+ * @return the record values
+ */
+ public UpdateRecordValues currency(String key, double currency) {
+ this.values.put(key, currency);
+ return this;
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UrlSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UrlSheetField.java
index 5961c794..a29de95e 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UrlSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UrlSheetField.java
@@ -27,37 +27,49 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class UrlSheetField extends SheetField {
private final UrlFieldProperty propertyUrl;
/**
- * Instantiates a new Url sheet field.
+ * Create url sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param urlProperty the url property
+ * @return the url sheet field
+ */
+ public static UrlSheetField create(String fieldTitle, UrlFieldProperty urlProperty) {
+ return update(null, fieldTitle, urlProperty);
+ }
+
+ /**
+ * Update single select sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyUrl the property url
+ * @param fieldTitle the field title
+ * @param urlProperty the url property
+ * @return the progress sheet field
*/
- public UrlSheetField(String fieldId, SheetFieldType fieldType, UrlFieldProperty propertyUrl) {
- super(fieldId, fieldType);
- this.propertyUrl = propertyUrl;
+ public static UrlSheetField update(String fieldId, String fieldTitle, UrlFieldProperty urlProperty) {
+ return new UrlSheetField(fieldId, SheetFieldType.FIELD_TYPE_URL, fieldTitle, urlProperty);
}
+
/**
* Instantiates a new Url sheet field.
*
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyUrl the property url
+ * @param urlProperty the url property
*/
@JsonCreator
- public UrlSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_url") UrlFieldProperty propertyUrl) {
+ UrlSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_url") UrlFieldProperty urlProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyUrl = propertyUrl;
+ this.propertyUrl = urlProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UserSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UserSheetField.java
index 90a21ebe..f6fff2e7 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UserSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/UserSheetField.java
@@ -27,21 +27,33 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class UserSheetField extends SheetField {
private final UserFieldProperty propertyUser;
+
/**
- * Instantiates a new User sheet field.
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param userProperty the user property
+ * @return the progress sheet field
+ */
+ public static UserSheetField create(String fieldTitle, UserFieldProperty userProperty) {
+ return update(null, fieldTitle, userProperty);
+ }
+
+ /**
+ * Update progress sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyUser the property user
+ * @param fieldTitle the field title
+ * @param userProperty the user property
+ * @return the progress sheet field
*/
- public UserSheetField(String fieldId, SheetFieldType fieldType, UserFieldProperty propertyUser) {
- super(fieldId, fieldType);
- this.propertyUser = propertyUser;
+ public static UserSheetField update(String fieldId, String fieldTitle, UserFieldProperty userProperty) {
+ return new UserSheetField(fieldId, SheetFieldType.FIELD_TYPE_USER, fieldTitle, userProperty);
}
/**
@@ -50,14 +62,14 @@ public UserSheetField(String fieldId, SheetFieldType fieldType, UserFieldPropert
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyUser the property user
+ * @param userProperty the user property
*/
@JsonCreator
- public UserSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_user") UserFieldProperty propertyUser) {
+ UserSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_user") UserFieldProperty userProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyUser = propertyUser;
+ this.propertyUser = userProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ViewRecord.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ViewRecord.java
new file mode 100644
index 00000000..78a1ee1c
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/ViewRecord.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.domain.wedoc.smartsheet;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.ToString;
+
+import java.time.Instant;
+import java.util.Map;
+
+/**
+ * @author dax
+ * @since 2024/12/25
+ */
+@ToString
+@Getter
+public class ViewRecord {
+ private final String recordId;
+ private final Instant createTime;
+ private final Instant updateTime;
+ private final String creatorName;
+ private final String updaterName;
+ private final Map values;
+
+ @JsonCreator
+ ViewRecord(@JsonProperty("record_id") String recordId,
+ @JsonProperty("create_time") long createTime,
+ @JsonProperty("update_time") long updateTime,
+ @JsonProperty("creator_name") String creatorName,
+ @JsonProperty("updater_name") String updaterName,
+ @JsonProperty("values") Map values) {
+ this.recordId = recordId;
+ this.createTime = Instant.ofEpochMilli(createTime);
+ this.updateTime = Instant.ofEpochMilli(updateTime);
+ this.creatorName = creatorName;
+ this.updaterName = updaterName;
+ this.values = values;
+ }
+
+ //todo 需要根据类型写解析方法? getUsers getString getNumber getInstant getOptions
+}
diff --git a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/WwGroupSheetField.java b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/WwGroupSheetField.java
index 1d3a14a2..ea4184be 100644
--- a/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/WwGroupSheetField.java
+++ b/wecom-objects/src/main/java/cn/felord/domain/wedoc/smartsheet/WwGroupSheetField.java
@@ -27,21 +27,33 @@
* @author dax
* @since 2024 /9/5
*/
-@ToString
+@ToString(callSuper = true)
@Getter
public class WwGroupSheetField extends SheetField {
private final WwGroupFieldProperty propertyWwGroup;
+
/**
- * Instantiates a new WwGroup sheet field.
+ * Create progress sheet field.
+ *
+ * @param fieldTitle the field title
+ * @param wwGroupProperty the ww group property
+ * @return the progress sheet field
+ */
+ public static WwGroupSheetField create(String fieldTitle, WwGroupFieldProperty wwGroupProperty) {
+ return update(null, fieldTitle, wwGroupProperty);
+ }
+
+ /**
+ * Update progress sheet field.
*
* @param fieldId the field id
- * @param fieldType the field type
- * @param propertyWwGroup the property WwGroup
+ * @param fieldTitle the field title
+ * @param wwGroupProperty the ww group property
+ * @return the progress sheet field
*/
- public WwGroupSheetField(String fieldId, SheetFieldType fieldType, WwGroupFieldProperty propertyWwGroup) {
- super(fieldId, fieldType);
- this.propertyWwGroup = propertyWwGroup;
+ public static WwGroupSheetField update(String fieldId, String fieldTitle, WwGroupFieldProperty wwGroupProperty) {
+ return new WwGroupSheetField(fieldId, SheetFieldType.FIELD_TYPE_WWGROUP, fieldTitle, wwGroupProperty);
}
/**
@@ -50,14 +62,14 @@ public WwGroupSheetField(String fieldId, SheetFieldType fieldType, WwGroupFieldP
* @param fieldId the field id
* @param fieldType the field type
* @param fieldTitle the field title
- * @param propertyWwGroup the property WwGroup
+ * @param wwGroupProperty the ww group property
*/
@JsonCreator
- public WwGroupSheetField(@JsonProperty("field_id") String fieldId,
- @JsonProperty("field_type") SheetFieldType fieldType,
- @JsonProperty("field_title") String fieldTitle,
- @JsonProperty("property_ww_group") WwGroupFieldProperty propertyWwGroup) {
+ WwGroupSheetField(@JsonProperty("field_id") String fieldId,
+ @JsonProperty("field_type") SheetFieldType fieldType,
+ @JsonProperty("field_title") String fieldTitle,
+ @JsonProperty("property_ww_group") WwGroupFieldProperty wwGroupProperty) {
super(fieldId, fieldType, fieldTitle);
- this.propertyWwGroup = propertyWwGroup;
+ this.propertyWwGroup = wwGroupProperty;
}
}
diff --git a/wecom-objects/src/main/java/cn/felord/enumeration/SheetFileType.java b/wecom-objects/src/main/java/cn/felord/enumeration/SheetFileType.java
new file mode 100644
index 00000000..2950408b
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/enumeration/SheetFileType.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.enumeration;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * 智能表格附件文件类型
+ *
+ * @author dax
+ * @since 2021 /9/8 11:14
+ */
+public enum SheetFileType {
+ /**
+ * 文件夹
+ */
+ FOLDER("Folder"),
+ /**
+ * 微盘文件
+ */
+ WE_DRIVE("Wedrive"),
+ /**
+ * 收集表
+ */
+ FORM("30"),
+ /**
+ * 文档
+ */
+ DOC("50"),
+ /**
+ * 表格
+ */
+ SHEET("51"),
+ /**
+ * Ppt sheet file type.
+ */
+ PPT("52"),
+ /**
+ * 思维导图
+ */
+ MIND_MAPPING("54"),
+ /**
+ * 流程图
+ */
+ FLOW_CHART("55"),
+ /**
+ * 智能表
+ */
+ SMART_SHEET("70");
+
+ private final String type;
+
+ SheetFileType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets type.
+ *
+ * @return the type
+ */
+ @JsonValue
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Deserialize FieldType.
+ *
+ * @param type the type
+ * @return the value type
+ */
+ @JsonCreator
+ public static SheetFileType deserialize(String type) {
+ return Arrays.stream(SheetFileType.values())
+ .filter(valueResult -> Objects.equals(valueResult.type, type))
+ .findFirst()
+ .orElse(null);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/enumeration/SmartSheetType.java b/wecom-objects/src/main/java/cn/felord/enumeration/SmartSheetType.java
new file mode 100644
index 00000000..92ad45dd
--- /dev/null
+++ b/wecom-objects/src/main/java/cn/felord/enumeration/SmartSheetType.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2024. felord.cn
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.felord.enumeration;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * The enum Smart sheet type.
+ *
+ * @author dax
+ * @since 2024 /12/24
+ */
+public enum SmartSheetType {
+ /**
+ * 经营者/法人
+ */
+ DASHBOARD("dashboard"),
+ /**
+ * 经办人
+ */
+ EXTERNAL("external"),
+ /**
+ * Smartsheet smart sheet type.
+ */
+ SMARTSHEET("smartsheet");
+
+ private final String type;
+
+ SmartSheetType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets type.
+ *
+ * @return the type
+ */
+ @JsonValue
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Deserialize smart sheet type.
+ *
+ * @param type the type
+ * @return the smart sheet type
+ */
+ @JsonCreator
+ public static SmartSheetType deserialize(String type) {
+ return Arrays.stream(SmartSheetType.values())
+ .filter(smartSheetType -> Objects.equals(smartSheetType.type, type))
+ .findFirst()
+ .orElse(null);
+ }
+}
diff --git a/wecom-objects/src/main/java/cn/felord/retrofit/TokenInterceptor.java b/wecom-objects/src/main/java/cn/felord/retrofit/TokenInterceptor.java
index 68d30d43..4650af40 100644
--- a/wecom-objects/src/main/java/cn/felord/retrofit/TokenInterceptor.java
+++ b/wecom-objects/src/main/java/cn/felord/retrofit/TokenInterceptor.java
@@ -40,7 +40,9 @@
* @since 2024 /5/22 14:59
*/
public class TokenInterceptor implements Interceptor {
+ private static final String ACCESS_TOKEN_KEY = "access_token";
private static final String INVALID_ACCESS_TOKEN = "42001";
+ private static final String BAD_ACCESS_TOKEN = "40014";
/**
* The constant MAPPER.
*/
@@ -85,6 +87,9 @@ public final Response intercept(@NotNull Chain chain) throws IOException {
response.close();
return doRequest(chain);
}
+ if (Objects.equals(BAD_ACCESS_TOKEN, errorCode)) {
+ throw new WeComException(Integer.valueOf(BAD_ACCESS_TOKEN), "illegal access token");
+ }
} else {
ResponseBody body = response.body();
if (body != null) {
@@ -96,11 +101,16 @@ public final Response intercept(@NotNull Chain chain) throws IOException {
try (Buffer buffer = source.getBuffer().clone()) {
String json = buffer.readUtf8();
WeComResponse weComResponse = MAPPER.readValue(json, WeComResponse.class);
- if (Objects.equals(INVALID_ACCESS_TOKEN, String.valueOf(weComResponse.getErrcode()))) {
+ Integer errcode = weComResponse.getErrcode();
+ String errCodeStr = String.valueOf(errcode);
+ if (Objects.equals(INVALID_ACCESS_TOKEN, errCodeStr)) {
tokenApi.clearToken();
response.close();
return doRequest(chain);
}
+ if (Objects.equals(BAD_ACCESS_TOKEN, errCodeStr)) {
+ throw new WeComException(errcode, "illegal access token");
+ }
}
}
}
@@ -133,7 +143,7 @@ private Response doRequest(Chain chain) throws IOException {
private String determineTokenParam(Class extends TokenApi> tokenApiClazz) {
if (AccessTokenApi.class.isAssignableFrom(tokenApiClazz)) {
- return "access_token";
+ return ACCESS_TOKEN_KEY;
}
throw new WeComException("the api is not supported");
}
diff --git a/wecom-objects/src/main/java/cn/felord/retrofit/WorkWechatRetrofitFactory.java b/wecom-objects/src/main/java/cn/felord/retrofit/WorkWechatRetrofitFactory.java
index f0c903e7..8e4d7cbf 100644
--- a/wecom-objects/src/main/java/cn/felord/retrofit/WorkWechatRetrofitFactory.java
+++ b/wecom-objects/src/main/java/cn/felord/retrofit/WorkWechatRetrofitFactory.java
@@ -32,8 +32,8 @@
* @since 2024/5/21
*/
public final class WorkWechatRetrofitFactory {
- private static final String BASE_URL = "https://qyapi.weixin.qq.com/cgi-bin/";
- private static final String BASE_PAY_URL = "https://api.mch.weixin.qq.com/mmpaymkttransfers/";
+ private static final String BASE_URL = System.getProperty("wecom.base.api.url", "https://qyapi.weixin.qq.com/cgi-bin/");
+ private static final String BASE_PAY_URL = System.getProperty("wecom.base.pay.url", "https://api.mch.weixin.qq.com/mmpaymkttransfers/");
public static final Retrofit RETROFIT_ = new Retrofit.Builder()
.baseUrl(BASE_URL)
.client(okHttpClient(HttpLoggingInterceptor.Level.NONE))
@@ -74,7 +74,7 @@ public static Retrofit create(T tokenApi, ConnectionPool co
* @param level the level
* @return the retrofit
*/
- public static Retrofit create(SSLManager sslManager, ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
+ public static Retrofit createPayRetrofit(SSLManager sslManager, ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
return new Retrofit.Builder()
.baseUrl(BASE_PAY_URL)
.client(okHttpClient(sslManager, connectionPool, level))
diff --git a/wecom-sdk/pom.xml b/wecom-sdk/pom.xml
index 22aa89ab..541b963f 100644
--- a/wecom-sdk/pom.xml
+++ b/wecom-sdk/pom.xml
@@ -7,7 +7,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wecom-sdk
jar
diff --git a/wecom-sdk/src/main/java/cn/felord/api/CorpTagApi.java b/wecom-sdk/src/main/java/cn/felord/api/CorpTagApi.java
index 9f564c7e..3e28972d 100644
--- a/wecom-sdk/src/main/java/cn/felord/api/CorpTagApi.java
+++ b/wecom-sdk/src/main/java/cn/felord/api/CorpTagApi.java
@@ -40,7 +40,7 @@ public interface CorpTagApi {
* @throws WeComException the weComException
*/
@POST("externalcontact/get_corp_tag_list")
- GenericResponse> corpTagList(@Body CorpTagIterator request) throws WeComException;
+ GenericResponse> corpTagList(@Body CorpTagRequest request) throws WeComException;
/**
* 添加企业客户标签
@@ -103,14 +103,14 @@ public interface CorpTagApi {
WeComResponse editStrategyCorpTag(@Body CorpTagStrategyEditRequest request) throws WeComException;
/**
- * 编辑指定规则组下的企业客户标签
+ * 删除指定规则组下的企业客户标签
*
* @param request the request
* @return the generic response
* @throws WeComException the weComException
*/
@POST("externalcontact/del_strategy_tag")
- WeComResponse delStrategyCorpTag(@Body CorpTagIterator request) throws WeComException;
+ WeComResponse delStrategyCorpTag(@Body CorpTagRequest request) throws WeComException;
/**
* 编辑客户企业标签
diff --git a/wecom-sdk/src/main/java/cn/felord/api/CustomerAcquisitionApi.java b/wecom-sdk/src/main/java/cn/felord/api/CustomerAcquisitionApi.java
index cd237101..e738eab2 100644
--- a/wecom-sdk/src/main/java/cn/felord/api/CustomerAcquisitionApi.java
+++ b/wecom-sdk/src/main/java/cn/felord/api/CustomerAcquisitionApi.java
@@ -31,7 +31,7 @@
* 获客助手
*
* @author dax
- * @since 2024/5/30 21:28
+ * @since 2024 /5/30 21:28
*/
public interface CustomerAcquisitionApi {
@@ -119,4 +119,17 @@ public interface CustomerAcquisitionApi {
LinkStatisticResponse queryCustomerAcquisitionQuotas(@Query("link_id") String linkId,
@Query("start_time") Instant startTime,
@Query("end_time") Instant endTime) throws WeComException;
+
+
+ /**
+ * 获取成员多次收消息详情
+ *
+ * 企业和服务商可通过此接口获取成员多次收消息情况,如次数、客户id等信息。
+ *
+ * @param chatKey the chat key
+ * @return the chat info
+ * @throws WeComException the we com exception
+ */
+ @POST("externalcontact/customer_acquisition/get_chat_info")
+ ChatInfoResponse getChatInfo(@Body ChatKey chatKey) throws WeComException;
}
diff --git a/wecom-sdk/src/main/java/cn/felord/api/InternalCorPayApi.java b/wecom-sdk/src/main/java/cn/felord/api/InternalCorPayApi.java
index 64a9f908..ac343c9e 100644
--- a/wecom-sdk/src/main/java/cn/felord/api/InternalCorPayApi.java
+++ b/wecom-sdk/src/main/java/cn/felord/api/InternalCorPayApi.java
@@ -47,7 +47,7 @@ public class InternalCorPayApi {
InternalCorPayApi(String paySecret, String payAgentSecret, SSLManager sslManager, ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
this.paySecret = paySecret;
this.payAgentSecret = payAgentSecret;
- this.mmPayMktTransfersApi = WorkWechatRetrofitFactory.create(sslManager, connectionPool, level)
+ this.mmPayMktTransfersApi = WorkWechatRetrofitFactory.createPayRetrofit(sslManager, connectionPool, level)
.create(MmPayMktTransfersApi.class);
}
diff --git a/wecom-sdk/src/main/java/cn/felord/api/SmartSheetApi.java b/wecom-sdk/src/main/java/cn/felord/api/SmartSheetApi.java
index 12ae030c..92a1730b 100644
--- a/wecom-sdk/src/main/java/cn/felord/api/SmartSheetApi.java
+++ b/wecom-sdk/src/main/java/cn/felord/api/SmartSheetApi.java
@@ -15,18 +15,31 @@
package cn.felord.api;
+import cn.felord.WeComException;
import cn.felord.domain.GenericResponse;
import cn.felord.domain.WeComResponse;
import cn.felord.domain.wedoc.smartsheet.AddOrUpdateFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.AddRecordRequest;
import cn.felord.domain.wedoc.smartsheet.AddSheetRequest;
import cn.felord.domain.wedoc.smartsheet.AddViewRequest;
import cn.felord.domain.wedoc.smartsheet.DelFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.DelRecordRequest;
import cn.felord.domain.wedoc.smartsheet.DelSheetRequest;
import cn.felord.domain.wedoc.smartsheet.DelViewRequest;
+import cn.felord.domain.wedoc.smartsheet.QuerySheetRequest;
+import cn.felord.domain.wedoc.smartsheet.RecordResult;
import cn.felord.domain.wedoc.smartsheet.SheetField;
import cn.felord.domain.wedoc.smartsheet.SheetViewDetail;
import cn.felord.domain.wedoc.smartsheet.SheetViewInfo;
+import cn.felord.domain.wedoc.smartsheet.SmartFieldsRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartFieldsResponse;
+import cn.felord.domain.wedoc.smartsheet.SmartRecordsRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartRecordsResponse;
+import cn.felord.domain.wedoc.smartsheet.SmartSheetInfo;
import cn.felord.domain.wedoc.smartsheet.SmartSheetProperties;
+import cn.felord.domain.wedoc.smartsheet.SmartViewRequest;
+import cn.felord.domain.wedoc.smartsheet.SmartViewsResponse;
+import cn.felord.domain.wedoc.smartsheet.UpdateRecordRequest;
import cn.felord.domain.wedoc.smartsheet.UpdateSheetRequest;
import cn.felord.domain.wedoc.smartsheet.UpdateViewRequest;
import retrofit2.http.Body;
@@ -51,9 +64,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the generic response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/add_sheet")
- GenericResponse addSheet(@Body AddSheetRequest request);
+ GenericResponse addSheet(@Body AddSheetRequest request) throws WeComException;
/**
* 删除子表
@@ -62,9 +76,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the we com response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/delete_sheet")
- WeComResponse deleteSheet(@Body DelSheetRequest request);
+ WeComResponse deleteSheet(@Body DelSheetRequest request) throws WeComException;
/**
* 更新子表
@@ -73,9 +88,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the we com response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/update_sheet")
- WeComResponse updateSheet(@Body UpdateSheetRequest request);
+ WeComResponse updateSheet(@Body UpdateSheetRequest request) throws WeComException;
/**
* 添加视图
@@ -84,9 +100,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return generic response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/add_view")
- GenericResponse addView(@Body AddViewRequest request);
+ GenericResponse addView(@Body AddViewRequest request) throws WeComException;
/**
* 删除视图
@@ -95,9 +112,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the we com response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/delete_views")
- WeComResponse deleteViews(@Body DelViewRequest request);
+ WeComResponse deleteViews(@Body DelViewRequest request) throws WeComException;
/**
* 更新视图
@@ -106,9 +124,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the generic response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/update_view")
- GenericResponse updateView(@Body UpdateViewRequest request);
+ GenericResponse updateView(@Body UpdateViewRequest request) throws WeComException;
/**
* 添加字段
@@ -117,9 +136,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the generic response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/add_fields")
- GenericResponse> addFields(@Body AddOrUpdateFieldsRequest request);
+ GenericResponse> addFields(@Body AddOrUpdateFieldsRequest request) throws WeComException;
/**
* 删除字段
@@ -128,9 +148,10 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the we com response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/delete_fields")
- WeComResponse deleteFields(@Body DelFieldsRequest request);
+ WeComResponse deleteFields(@Body DelFieldsRequest request) throws WeComException;
/**
* 更新字段
@@ -140,7 +161,96 @@ public interface SmartSheetApi {
*
* @param request the request
* @return the generic response
+ * @throws WeComException the we com exception
*/
@POST("wedoc/smartsheet/update_fields")
- GenericResponse> updateFields(@Body AddOrUpdateFieldsRequest request);
+ GenericResponse> updateFields(@Body AddOrUpdateFieldsRequest request) throws WeComException;
+
+ /**
+ * 添加记录
+ *
+ * 本接口用于在 Smartsheet 中的某个子表里添加一行或多行新记录。单表最多允许有40000行记录。
+ * 不能通过添加记录接口给创建时间、最后编辑时间、创建人和最后编辑人四种类型的字段添加记录。
+ *
+ * @param request the request
+ * @return the generic response
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/add_records")
+ GenericResponse> addRecords(@Body AddRecordRequest request) throws WeComException;
+
+ /**
+ * 删除记录
+ *
+ * 本接口用于删除 Smartsheet 的某个子表中的一行或多行记录。
+ *
+ * @param request the request
+ * @return the we com response
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/delete_records")
+ WeComResponse deleteRecords(@Body DelRecordRequest request) throws WeComException;
+
+ /**
+ * 更新记录
+ *
+ * 本接口用于更新 Smartsheet 中的某个子表里的一行或多行记录。
+ * 注意:不能通过更新记录接口给创建时间、最后编辑时间、创建人和最后编辑人四种类型的字段更新记录。
+ *
+ * @param request the request
+ * @return the we com response
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/update_records")
+ GenericResponse> updateRecords(@Body UpdateRecordRequest request) throws WeComException;
+
+ /**
+ * 查询子表
+ *
+ * 本接口用于查询一篇在线表格中全部智能表信息。
+ *
+ * @param request the request
+ * @return the sheet
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/get_sheet")
+ GenericResponse> getSheet(@Body QuerySheetRequest request) throws WeComException;
+
+ /**
+ * 查询视图
+ *
+ * 本接口用于获取 Smartsheet 中某个子表里全部视图信息。
+ *
+ * @param request the request
+ * @return the views
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/get_views")
+ SmartViewsResponse getViews(@Body SmartViewRequest request) throws WeComException;
+
+ /**
+ * 查询字段
+ *
+ * 本接口用于获取智能表中某个子表下字段信息,
+ * 该接口可以完成下面三种功能:获取全部字段信息、依据字段名获取对应字段、依据字段 ID 获取对应字段信息。
+ *
+ * @param request the request
+ * @return the fields
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/get_fields")
+ SmartFieldsResponse getFields(@Body SmartFieldsRequest request) throws WeComException;
+
+ /**
+ * 查询记录
+ *
+ * 本接口用于获取 Smartsheet 中某个子表下记录信息,
+ * 该接口可以完成下面三种功能:获取全部记录信息、依据字段名和记录 ID 获取对应记录、对记录进行排序。
+ *
+ * @param request the request
+ * @return the records
+ * @throws WeComException the we com exception
+ */
+ @POST("wedoc/smartsheet/get_records")
+ SmartRecordsResponse getRecords(@Body SmartRecordsRequest request) throws WeComException;
}
diff --git a/wemp-objects/pom.xml b/wemp-objects/pom.xml
index 8a198dd8..001b5c42 100644
--- a/wemp-objects/pom.xml
+++ b/wemp-objects/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wemp-objects
diff --git a/wemp-sdk/pom.xml b/wemp-sdk/pom.xml
index 6c12b604..444f14c8 100644
--- a/wemp-sdk/pom.xml
+++ b/wemp-sdk/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wemp-sdk
diff --git a/wepay-objects/pom.xml b/wepay-objects/pom.xml
index 7b4870e5..442537ea 100644
--- a/wepay-objects/pom.xml
+++ b/wepay-objects/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wepay-objects
jar
diff --git a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/crypto/WechatPaySigner.java b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/crypto/WechatPaySigner.java
index e6a95c2e..776db39f 100644
--- a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/crypto/WechatPaySigner.java
+++ b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/crypto/WechatPaySigner.java
@@ -16,7 +16,7 @@
package cn.felord.payment.wechat.v3.crypto;
import cn.felord.payment.PayException;
-import cn.felord.payment.wechat.v3.retrofit.HttpHeaders;
+import cn.felord.payment.wechat.v3.retrofit.WechatHttpHeaders;
import cn.felord.utils.AlternativeJdkIdGenerator;
import cn.felord.utils.Base64Utils;
import lombok.SneakyThrows;
@@ -100,10 +100,10 @@ public static String sign(AppMerchant appMerchant, String... orderedComponents)
* @return the boolean
*/
public static boolean verify(Headers responseHeaders, String body, TenpayKey tenpayKey) {
- String wechatpaySignature = Objects.requireNonNull(responseHeaders.get(HttpHeaders.WECHAT_PAY_SIGNATURE.headerName()));
- String wechatpaySignatureType = responseHeaders.get(HttpHeaders.WECHAT_PAY_SIGNATURE_TYPE.headerName());
- String wechatpayTimestamp = responseHeaders.get(HttpHeaders.WECHAT_PAY_TIMESTAMP.headerName());
- String wechatpayNonce = responseHeaders.get(HttpHeaders.WECHAT_PAY_NONCE.headerName());
+ String wechatpaySignature = Objects.requireNonNull(responseHeaders.get(WechatHttpHeaders.WECHAT_PAY_SIGNATURE.headerName()));
+ String wechatpaySignatureType = responseHeaders.get(WechatHttpHeaders.WECHAT_PAY_SIGNATURE_TYPE.headerName());
+ String wechatpayTimestamp = responseHeaders.get(WechatHttpHeaders.WECHAT_PAY_TIMESTAMP.headerName());
+ String wechatpayNonce = responseHeaders.get(WechatHttpHeaders.WECHAT_PAY_NONCE.headerName());
final String message = buildSignMessage(wechatpayTimestamp, wechatpayNonce, body);
AuthType authType = AuthType.fromSignType(wechatpaySignatureType);
try {
diff --git a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/AbstractAuthorizationInterceptor.java b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/AbstractAuthorizationInterceptor.java
index 9b0abb1f..561eca31 100644
--- a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/AbstractAuthorizationInterceptor.java
+++ b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/AbstractAuthorizationInterceptor.java
@@ -53,7 +53,7 @@ public AbstractAuthorizationInterceptor(AppMerchant appMerchant) {
public Response intercept(@NotNull Chain chain) throws IOException {
Request request = chain.request();
Headers headers = request.headers();
- String mediaBody = headers.get(HttpHeaders.META.headerName());
+ String mediaBody = headers.get(WechatHttpHeaders.META.headerName());
String bodyStr = Optional.ofNullable(mediaBody)
.orElseGet(() ->
Optional.ofNullable(request.body())
@@ -62,15 +62,15 @@ public Response intercept(@NotNull Chain chain) throws IOException {
HttpUrl httpUrl = request.url();
String authorization = WechatPaySigner.sign(appMerchant, httpUrl.uri(), request.method(), bodyStr);
Headers.Builder headerBuilder = headers.newBuilder();
- String contentType = HttpHeaders.CONTENT_TYPE.headerName();
+ String contentType = WechatHttpHeaders.CONTENT_TYPE.headerName();
if (Objects.isNull(headers.get(contentType))) {
headerBuilder.set(contentType, APPLICATION_JSON_UTF_8);
}
Request requestWithAuth = request.newBuilder()
.url(httpUrl)
- .header(HttpHeaders.AUTHORIZATION.headerName(), authorization)
- .header(HttpHeaders.USER_AGENT.headerName(), USER_AGENT)
- .header(HttpHeaders.ACCEPT.headerName(), "*/*")
+ .header(WechatHttpHeaders.AUTHORIZATION.headerName(), authorization)
+ .header(WechatHttpHeaders.USER_AGENT.headerName(), USER_AGENT)
+ .header(WechatHttpHeaders.ACCEPT.headerName(), "*/*")
.build();
Response response = chain.proceed(requestWithAuth);
if (!Objects.equals(DOWNLOAD_FILE_PATH, httpUrl.encodedPath())) {
diff --git a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatAuthorizationInterceptor.java b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatAuthorizationInterceptor.java
index 9a5f3bba..d2feafa1 100644
--- a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatAuthorizationInterceptor.java
+++ b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatAuthorizationInterceptor.java
@@ -67,7 +67,7 @@ protected void verifyResponse(Response response) throws PayException {
}
Headers responseHeaders = response.headers();
if (!response.isSuccessful()) {
- String requestId = responseHeaders.get(HttpHeaders.REQUEST_ID.headerName());
+ String requestId = responseHeaders.get(WechatHttpHeaders.REQUEST_ID.headerName());
String errorMessage = " Code: " + response.code() +
"\n Request-ID: " + requestId +
"\n Message: " + response.message() +
@@ -75,10 +75,10 @@ protected void verifyResponse(Response response) throws PayException {
response.close();
throw new PayException(errorMessage);
}
- String serialNumber = responseHeaders.get(HttpHeaders.WECHAT_PAY_SERIAL.headerName());
+ String serialNumber = responseHeaders.get(WechatHttpHeaders.WECHAT_PAY_SERIAL.headerName());
TenpayKey tenpayKey = tenpayCertificateService.getTenpayKey(serialNumber);
if (!WechatPaySigner.verify(responseHeaders, body, tenpayKey)) {
- String requestId = responseHeaders.get(HttpHeaders.REQUEST_ID.headerName());
+ String requestId = responseHeaders.get(WechatHttpHeaders.REQUEST_ID.headerName());
response.close();
throw new PayException("Wechat pay signature verify failed, Request-ID: " + requestId);
}
diff --git a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/HttpHeaders.java b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatHttpHeaders.java
similarity index 96%
rename from wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/HttpHeaders.java
rename to wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatHttpHeaders.java
index 57e9c4ad..580fdc01 100644
--- a/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/HttpHeaders.java
+++ b/wepay-objects/src/main/java/cn/felord/payment/wechat/v3/retrofit/WechatHttpHeaders.java
@@ -21,7 +21,7 @@
* @author dax
* @since 2024/8/4
*/
-public enum HttpHeaders {
+public enum WechatHttpHeaders {
/**
* Content type http headers.
*/
@@ -68,7 +68,7 @@ public enum HttpHeaders {
WECHAT_PAY_NONCE("Wechatpay-Nonce");
private final String headerName;
- HttpHeaders(String headerName) {
+ WechatHttpHeaders(String headerName) {
this.headerName = headerName;
}
diff --git a/wepay-sdk/pom.xml b/wepay-sdk/pom.xml
index 45f242ae..fe1af10e 100644
--- a/wepay-sdk/pom.xml
+++ b/wepay-sdk/pom.xml
@@ -6,7 +6,7 @@
cn.felord
wecom
- 1.2.9
+ 1.3.0
wepay-sdk