Skip to content

Commit c9e17fe

Browse files
kang.zoujackPan-meego
authored andcommitted
feat.add DeleteAttachment
1 parent 633193f commit c9e17fe

File tree

5 files changed

+179
-0
lines changed

5 files changed

+179
-0
lines changed

src/main/java/com/lark/project/service/attachment/AttachmentService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ public interface AttachmentService {
1414
// 附件上传
1515
public SpecialUploadAttachmentResp specialUploadAttachment(SpecialUploadAttachmentReq req, RequestOptions reqOptions) throws Exception;
1616

17+
// 附件删除
18+
public DeleteAttachmentResp deleteAttachment(DeleteAttachmentReq req, RequestOptions reqOptions) throws Exception;
19+
1720
}

src/main/java/com/lark/project/service/attachment/AttachmentServiceImpl.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,27 @@ public SpecialUploadAttachmentResp specialUploadAttachment(SpecialUploadAttachme
104104

105105
return resp;
106106
}
107+
108+
@Override
109+
public DeleteAttachmentResp deleteAttachment(DeleteAttachmentReq req, RequestOptions reqOptions) throws Exception {
110+
if (reqOptions == null) {
111+
reqOptions = new RequestOptions();
112+
}
113+
114+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
115+
, "/open_api/file/delete"
116+
, false
117+
, req);
118+
119+
DeleteAttachmentResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, DeleteAttachmentResp.class);
120+
if (resp == null) {
121+
log.error(Logs.formatReq(req, httpResponse, "/open_api/file/delete"));
122+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
123+
}
124+
125+
resp.setRawResponse(httpResponse);
126+
resp.setRequest(req);
127+
128+
return resp;
129+
}
107130
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.lark.project.service.attachment.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import com.lark.project.core.annotation.Body;
5+
import com.lark.project.core.annotation.Path;
6+
7+
import java.io.File;
8+
import java.util.List;
9+
10+
public class DeleteAttachmentReq {
11+
@Body
12+
private DeleteAttachmentReqBody body;
13+
14+
public DeleteAttachmentReq() {
15+
}
16+
17+
public DeleteAttachmentReq(Builder builder) {
18+
this.body = builder.body;
19+
}
20+
21+
public static Builder newBuilder() {
22+
return new Builder();
23+
}
24+
25+
public DeleteAttachmentReqBody getDeleteAttachmentReqBody() {
26+
return this.body;
27+
}
28+
29+
public void setDeleteAttachmentReqBody(DeleteAttachmentReqBody body) {
30+
this.body = body;
31+
}
32+
33+
public static class Builder {
34+
private DeleteAttachmentReqBody body;
35+
36+
public Builder() {
37+
body = new DeleteAttachmentReqBody();
38+
}
39+
40+
public Builder projectKey(String projectKey) {
41+
this.body.setProjectKey(projectKey);
42+
return this;
43+
}
44+
45+
public Builder workitemID(String workitemID) {
46+
this.body.setWorkitemID(workitemID);
47+
return this;
48+
}
49+
50+
public Builder fieldKey(String fieldKey) {
51+
this.body.setFieldKey(fieldKey);
52+
return this;
53+
}
54+
55+
public Builder fieldAlias(String fieldAlias) {
56+
this.body.setFieldAlias(fieldAlias);
57+
return this;
58+
}
59+
60+
public Builder uuids(List<String> uuids) {
61+
this.body.setUuids(uuids);
62+
return this;
63+
}
64+
65+
public DeleteAttachmentReq build() {
66+
return new DeleteAttachmentReq(this);
67+
}
68+
69+
}
70+
71+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.lark.project.service.attachment.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.io.File;
6+
import java.util.List;
7+
8+
public class DeleteAttachmentReqBody {
9+
10+
@SerializedName("project_key")
11+
private String projectKey;
12+
13+
@SerializedName("work_item_id")
14+
private String workitemID;
15+
16+
@SerializedName("field_key")
17+
private String fieldKey;
18+
19+
@SerializedName("field_alias")
20+
private String fieldAlias;
21+
22+
@SerializedName("uuids")
23+
private List<String> uuids;
24+
25+
public String getProjectKey() {
26+
return projectKey;
27+
}
28+
29+
public void setProjectKey(String projectKey) {
30+
this.projectKey = projectKey;
31+
}
32+
33+
public String getWorkitemID() {
34+
return workitemID;
35+
}
36+
37+
public void setWorkitemID(String workitemID) {
38+
this.workitemID = workitemID;
39+
}
40+
41+
public String getFieldKey() {
42+
return fieldKey;
43+
}
44+
45+
public void setFieldKey(String fieldKey) {
46+
this.fieldKey = fieldKey;
47+
}
48+
49+
public String getFieldAlias() {
50+
return fieldAlias;
51+
}
52+
53+
public void setFieldAlias(String fieldAlias) {
54+
this.fieldAlias = fieldAlias;
55+
}
56+
57+
public List<String> getUuids() {
58+
return uuids;
59+
}
60+
61+
public void setUuids(List<String> uuids) {
62+
this.uuids = uuids;
63+
}
64+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.lark.project.service.attachment.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import com.lark.project.core.response.BaseResponse;
5+
import com.lark.project.service.measure.model.MeasureData;
6+
7+
public class DeleteAttachmentResp extends BaseResponse {
8+
@SerializedName("data")
9+
private Object data;
10+
11+
public Object getData() {
12+
return data;
13+
}
14+
15+
public void setData(Object data) {
16+
this.data = data;
17+
}
18+
}

0 commit comments

Comments
 (0)