Skip to content

Commit fc03b09

Browse files
authored
feat: add missing param and fix some issue (#91)
1 parent 9e4dbf1 commit fc03b09

24 files changed

Lines changed: 375 additions & 57 deletions

api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</parent>
4444

4545
<artifactId>coze-api</artifactId>
46-
<version>0.3.0</version>
46+
<version>0.3.1</version>
4747

4848
<scm>
4949
<connection>scm:git:git://github.com/coze-dev/coze-java.git</connection>
@@ -93,7 +93,7 @@
9393
<dependency>
9494
<groupId>org.slf4j</groupId>
9595
<artifactId>slf4j-api</artifactId>
96-
<version>2.0.12</version>
96+
<version>1.7.30</version>
9797
</dependency>
9898

9999
<!-- HTTP Client -->

api/src/main/java/com/coze/openapi/api/CozeAuthAPI.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,18 @@ Single<Response<OAuthToken>> retrieve(
2222
@POST("/api/permission/oauth2/workspace_id/{workspace_id}/device/code")
2323
Single<Response<DeviceAuthResp>> device(
2424
@Path("workspace_id") String workspaceID, @Body DeviceAuthReq req);
25+
26+
@Headers({"Content-Type: application/json"})
27+
@POST("/api/permission/oauth2/account/{account_id}/token")
28+
Single<Response<OAuthToken>> account(
29+
@HeaderMap Map<String, String> headers,
30+
@Path("account_id") String accountID,
31+
@Body GetAccessTokenReq req);
32+
33+
@Headers({"Content-Type: application/json"})
34+
@POST("/api/permission/oauth2/enterprise_id/{enterprise_id}/token")
35+
Single<Response<OAuthToken>> enterprise(
36+
@HeaderMap Map<String, String> headers,
37+
@Path("enterprise_id") String enterpriseID,
38+
@Body GetAccessTokenReq req);
2539
}

api/src/main/java/com/coze/openapi/client/auth/GetAccessTokenReq.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@ public class GetAccessTokenReq extends BaseReq {
4444

4545
@JsonProperty("scope")
4646
private Scope scope;
47+
48+
@JsonProperty("account_id")
49+
private Long accountID;
50+
51+
@JsonProperty("enterprise_id")
52+
private String enterpriseID;
4753
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.coze.openapi.client.auth;
2+
3+
import com.coze.openapi.client.auth.model.SessionContext;
4+
import com.coze.openapi.client.auth.scope.Scope;
5+
6+
import lombok.AllArgsConstructor;
7+
import lombok.Builder;
8+
import lombok.Data;
9+
import lombok.NoArgsConstructor;
10+
11+
@Data
12+
@Builder
13+
@AllArgsConstructor
14+
@NoArgsConstructor
15+
public class GetJWTAccessTokenReq {
16+
private Integer ttl;
17+
private Scope scope;
18+
private String sessionName;
19+
private Long accountID;
20+
private String enterpriseID;
21+
private SessionContext sessionContext;
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.coze.openapi.client.auth.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import lombok.Builder;
6+
import lombok.Data;
7+
8+
@Data
9+
@Builder
10+
public class DeviceInfo {
11+
@JsonProperty("device_id")
12+
private String deviceID;
13+
14+
@JsonProperty("custom_consumer")
15+
private String customConsumer;
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.coze.openapi.client.auth.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
10+
@Data
11+
@Builder
12+
@NoArgsConstructor
13+
@AllArgsConstructor
14+
public class SessionContext {
15+
@JsonProperty("device_info")
16+
private DeviceInfo deviceInfo;
17+
}

api/src/main/java/com/coze/openapi/client/auth/scope/Scope.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.List;
55
import java.util.Map;
66

7+
import com.fasterxml.jackson.annotation.JsonProperty;
78
import com.fasterxml.jackson.core.type.TypeReference;
89
import com.fasterxml.jackson.databind.ObjectMapper;
910

@@ -13,7 +14,10 @@
1314
@Data
1415
@AllArgsConstructor
1516
public class Scope {
17+
@JsonProperty("account_permission")
1618
private ScopeAccountPermission accountPermission;
19+
20+
@JsonProperty("attribute_constraint")
1721
private ScopeAttributeConstraint attributeConstraint;
1822

1923
public Map<String, Object> toMap() {

api/src/main/java/com/coze/openapi/client/auth/scope/ScopeAccountPermission.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import java.util.List;
44

5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
57
import lombok.AllArgsConstructor;
68
import lombok.Data;
79

810
@Data
911
@AllArgsConstructor
1012
public class ScopeAccountPermission {
13+
@JsonProperty("permission_list")
1114
private List<String> permissionList;
1215
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package com.coze.openapi.client.auth.scope;
22

3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
35
import lombok.AllArgsConstructor;
46
import lombok.Data;
57

68
@Data
79
@AllArgsConstructor
810
public class ScopeAttributeConstraint {
11+
@JsonProperty("connector_bot_chat_attribute")
912
private ScopeAttributeConstraintConnectorBotChatAttribute connectorBotChatAttribute;
1013
}

api/src/main/java/com/coze/openapi/client/auth/scope/ScopeAttributeConstraintConnectorBotChatAttribute.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import java.util.List;
44

5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
57
import lombok.AllArgsConstructor;
68
import lombok.Data;
79

810
@AllArgsConstructor
911
@Data
1012
public class ScopeAttributeConstraintConnectorBotChatAttribute {
13+
@JsonProperty("bot_id_list")
1114
private List<String> botIDList;
1215
}

0 commit comments

Comments
 (0)