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