|
|
|
@ -25,7 +25,7 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
LarkTableHelper bk = new LarkTableHelper();
|
|
|
|
|
map.put("b", "aaa");
|
|
|
|
|
map.put("a", "aaa");
|
|
|
|
|
LarkTableRequest add = new LarkTableRequest(appId, secret, appToken, tableId,map);
|
|
|
|
|
CreateAppTableRecordRespBody createAppTableRecordRespBody = bk.addTableRecord(add);
|
|
|
|
|
String recordId = createAppTableRecordRespBody.getRecord().getRecordId();
|
|
|
|
@ -58,7 +58,7 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
|
|
|
|
|
public CreateAppTableRecordRespBody addTableRecord(LarkTableRequest request) {
|
|
|
|
|
try {
|
|
|
|
|
return buildClient(request).bitable().appTableRecord()
|
|
|
|
|
CreateAppTableRecordResp createAppTableRecordResp = buildClient(request).bitable().appTableRecord()
|
|
|
|
|
.create(CreateAppTableRecordReq.newBuilder()
|
|
|
|
|
.appToken(request.getAppToken())
|
|
|
|
|
.tableId(request.getAppTable())
|
|
|
|
@ -66,7 +66,12 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
AppTableRecord.newBuilder()
|
|
|
|
|
.fields(request.getBody())
|
|
|
|
|
.build())
|
|
|
|
|
.build()).getData();
|
|
|
|
|
.build());
|
|
|
|
|
if (createAppTableRecordResp.getCode() == 0){
|
|
|
|
|
return createAppTableRecordResp.getData();
|
|
|
|
|
}else {
|
|
|
|
|
throw new RuntimeException(createAppTableRecordResp.getMsg());
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
|
|
}
|
|
|
|
@ -74,13 +79,18 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
|
|
|
|
|
public DeleteAppTableRecordRespBody deleteTableRecord(LarkTableRequest request) {
|
|
|
|
|
try {
|
|
|
|
|
return buildClient(request).bitable().appTableRecord().delete(
|
|
|
|
|
DeleteAppTableRecordResp delete = buildClient(request).bitable().appTableRecord().delete(
|
|
|
|
|
DeleteAppTableRecordReq.newBuilder()
|
|
|
|
|
.appToken(request.getAppToken())
|
|
|
|
|
.tableId(request.getAppTable())
|
|
|
|
|
.recordId(request.getRecord())
|
|
|
|
|
.build()
|
|
|
|
|
).getData();
|
|
|
|
|
);
|
|
|
|
|
if (delete.getCode() == 0){
|
|
|
|
|
return delete.getData();
|
|
|
|
|
}else {
|
|
|
|
|
throw new RuntimeException(delete.getMsg());
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
|
|
}
|
|
|
|
@ -88,7 +98,7 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
|
|
|
|
|
public UpdateAppTableRecordRespBody updateTableRecord(LarkTableRequest request) {
|
|
|
|
|
try {
|
|
|
|
|
return buildClient(request).bitable().appTableRecord().update(
|
|
|
|
|
UpdateAppTableRecordResp update = buildClient(request).bitable().appTableRecord().update(
|
|
|
|
|
UpdateAppTableRecordReq.newBuilder()
|
|
|
|
|
.appToken(request.getAppToken())
|
|
|
|
|
.tableId(request.getAppTable())
|
|
|
|
@ -98,7 +108,12 @@ public class LarkTableHelper extends LarkHelper{
|
|
|
|
|
.fields(request.getBody())
|
|
|
|
|
.build()
|
|
|
|
|
).build()
|
|
|
|
|
).getData();
|
|
|
|
|
);
|
|
|
|
|
if (update.getCode() == 0){
|
|
|
|
|
return update.getData();
|
|
|
|
|
}else {
|
|
|
|
|
throw new RuntimeException(update.getMsg());
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|