Skip to content
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ target/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

src/main/resources/开发者手册/*
src/main/java/com/lark/project/sample/*
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.larksuite.project</groupId>
<artifactId>oapi-sdk</artifactId>
<version>1.0.24</version>
<version>1.0.25</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.gson.annotations.SerializedName;
import com.lark.project.core.annotation.Body;
import com.lark.project.core.annotation.Path;
import com.lark.project.service.field.model.TeamOption;
import com.lark.project.service.field.model.FieldValue;

import java.util.List;
Expand Down Expand Up @@ -136,6 +137,16 @@ public Builder authorizedRoles(List<String> authorizedRoles) {
return this;
}

public Builder teamOption(TeamOption teamOption) {
this.body.setTeamOption(teamOption);
return this;
}

public Builder numberConfig(UpdateFieldReqBody.NumberConfig numberConfig) {
this.body.setNumberConfig(numberConfig);
return this;
}

public UpdateFieldReq build() {
return new UpdateFieldReq(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.lark.project.service.field.builder;

import com.google.gson.annotations.SerializedName;
import com.lark.project.service.field.model.FieldValue;
import com.lark.project.service.field.model.TeamOption;

import java.util.List;

Expand All @@ -41,6 +41,10 @@ public class UpdateFieldReqBody {
private String helpDescription;
@SerializedName("authorized_roles")
private List<String> authorizedRoles;
@SerializedName("number_config")
private NumberConfig numberConfig;
@SerializedName("team_option")
private TeamOption teamOption;

public String getFieldName() {
return this.fieldName;
Expand Down Expand Up @@ -113,4 +117,86 @@ public List<String> getAuthorizedRoles() {
public void setAuthorizedRoles(List<String> authorizedRoles) {
this.authorizedRoles = authorizedRoles;
}

public TeamOption getTeamOption() {
return this.teamOption;
}

public void setTeamOption(TeamOption teamOption) {
this.teamOption = teamOption;
}

public NumberConfig getNumberConfig() {
return this.numberConfig;
}

public void setNumberConfig(NumberConfig numberConfig) {
this.numberConfig = numberConfig;
}

public static class NumberConfig {
@SerializedName("scaling_ratio")
private String scalingRatio;
@SerializedName("display_digits")
private Integer displayDigits;
@SerializedName("symbol_setting")
private SymbolSetting symbolSetting;

public String getScalingRatio() {
return scalingRatio;
}

public void setScalingRatio(String scalingRatio) {
this.scalingRatio = scalingRatio;
}

public Integer getDisplayDigits() {
return displayDigits;
}

public void setDisplayDigits(Integer displayDigits) {
this.displayDigits = displayDigits;
}

public SymbolSetting getSymbolSetting() {
return symbolSetting;
}

public void setSymbolSetting(SymbolSetting symbolSetting) {
this.symbolSetting = symbolSetting;
}
}

public static class SymbolSetting {
@SerializedName("display")
private String display;
@SerializedName("value")
private String value;
@SerializedName("layout")
private String layout;

public String getDisplay() {
return display;
}

public void setDisplay(String display) {
this.display = display;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public String getLayout() {
return layout;
}

public void setLayout(String layout) {
this.layout = layout;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public interface WorkItemService {
// 更新实际工时
public UpdateWorkingHourRecordResp updateWorkingHourRecord(UpdateWorkingHourRecordReq req, RequestOptions reqOptions) throws Exception;

// 拉机器人入群
public BotJoinChatResp botJoinChat(BotJoinChatReq req, RequestOptions reqOptions) throws Exception;

/**
* 获取工作流详情(WBS)。
*
Expand All @@ -123,14 +126,14 @@ public interface WorkItemService {
/**
* 批量更新工作项。
*
* <p>对应 OpenAPI:{@code POST /open_api/:project_key/work_item/:work_item_type_key/batch_update}</p>
* <p>对应 OpenAPI:{@code POST /open_api/work_item/batch_update}</p>
*/
public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, RequestOptions reqOptions) throws Exception;

/**
* 获取任务结果。
*
* <p>对应 OpenAPI:{@code GET /open_api/:project_key/work_item/:work_item_type_key/:work_item_id/task_result}</p>
* <p>对应 OpenAPI:{@code GET /open_api/task_result}</p>
*/
public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqOptions) throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public UpdateCompoundFieldValueResp updateCompoundFieldValue(UpdateCompoundField
return resp;
}

@Override
// 批量更新工作项。
public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, RequestOptions reqOptions) throws Exception {
if (reqOptions == null) {
reqOptions = new RequestOptions();
Expand All @@ -727,7 +727,11 @@ public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, R
return resp;
}

@Override
/**
* 获取任务结果。
*
* <p>对应 OpenAPI:{@code GET /open_api/task_result}</p>
*/
public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqOptions) throws Exception {
if (reqOptions == null) {
reqOptions = new RequestOptions();
Expand All @@ -749,4 +753,27 @@ public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqO

return resp;
}

// 拉机器人入群
public BotJoinChatResp botJoinChat(BotJoinChatReq req, RequestOptions reqOptions) throws Exception {
if (reqOptions == null) {
reqOptions = new RequestOptions();
}

RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"
, false
, req);

BotJoinChatResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, BotJoinChatResp.class);
if (resp == null) {
log.error(Logs.formatReq(req, httpResponse, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"));
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
}

resp.setRawResponse(httpResponse);
resp.setRequest(req);

return resp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* 批量更新工作项的请求对象。
*
* <p>对应 OpenAPI:{@code POST /open_api/:project_key/work_item/:work_item_type_key/batch_update}</p>
* <p>对应 OpenAPI:{@code POST /open_api/work_item/batch_update}</p>
*/
public class BatchUpdateWorkItemReq {
@Body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import com.google.gson.annotations.SerializedName;
import com.lark.project.core.response.BaseResponse;
import com.lark.project.service.workitem.model.BatchUpdateWorkItemResult;
import com.lark.project.service.workitem.model.WorkItemInfo;

import java.util.List;

/**
* 批量更新工作项的响应对象。
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.lark.project.service.workitem.builder;

import com.google.gson.annotations.SerializedName;
import com.lark.project.core.annotation.Body;
import com.lark.project.core.annotation.Path;

import java.util.List;

public class BotJoinChatReq {

@Path
@SerializedName("project_key")
private String projectKey;

@Path
@SerializedName("work_item_id")
private Long workItemID;

@Body
private BotJoinChatReqBody body;

public BotJoinChatReq() {
}

public BotJoinChatReq(Builder builder) {
this.projectKey = builder.projectKey;
this.workItemID = builder.workItemID;
this.body = builder.body;
}

public static Builder newBuilder() {
return new Builder();
}

public String getProjectKey() {
return projectKey;
}

public void setProjectKey(String projectKey) {
this.projectKey = projectKey;
}

public Long getWorkItemID() {
return workItemID;
}

public void setWorkItemID(Long workItemID) {
this.workItemID = workItemID;
}

public BotJoinChatReqBody getBotJoinChatReqBody() {
return body;
}

public void setBotJoinChatReqBody(BotJoinChatReqBody body) {
this.body = body;
}

public static class Builder {
private String projectKey;
private Long workItemID;
private BotJoinChatReqBody body;

public Builder() {
body = new BotJoinChatReqBody();
}

public Builder projectKey(String projectKey) {
this.projectKey = projectKey;
return this;
}

public Builder workItemID(Long workItemID) {
this.workItemID = workItemID;
return this;
}

public Builder workItemTypeKey(String workItemTypeKey) {
this.body.setWorkItemTypeKey(workItemTypeKey);
return this;
}

public Builder appIds(List<String> appIds) {
this.body.setAppIds(appIds);
return this;
}

public BotJoinChatReq build() {
return new BotJoinChatReq(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.lark.project.service.workitem.builder;

import com.google.gson.annotations.SerializedName;

import java.util.List;

public class BotJoinChatReqBody {

@SerializedName("work_item_type_key")
private String workItemTypeKey;

@SerializedName("app_ids")
private List<String> appIds;

public String getWorkItemTypeKey() {
return workItemTypeKey;
}

public void setWorkItemTypeKey(String workItemTypeKey) {
this.workItemTypeKey = workItemTypeKey;
}

public List<String> getAppIds() {
return appIds;
}

public void setAppIds(List<String> appIds) {
this.appIds = appIds;
}

public static Builder newBuilder() {
return new Builder();
}

public static class Builder {
private String workItemTypeKey;
private List<String> appIds;

public Builder workItemTypeKey(String workItemTypeKey) {
this.workItemTypeKey = workItemTypeKey;
return this;
}

public Builder appIds(List<String> appIds) {
this.appIds = appIds;
return this;
}

public BotJoinChatReqBody build() {
BotJoinChatReqBody body = new BotJoinChatReqBody();
body.setWorkItemTypeKey(workItemTypeKey);
body.setAppIds(appIds);
return body;
}
}
}
Loading
Loading