Skip to content

Conversation

hanzeINGH
Copy link
Contributor

No description provided.

hanzeINGH added 2 commits July 2, 2025 11:33
Change-Id: I389c6a1d9f3d3ee5915f1783edc08942d4c633f8
Change-Id: I6f1ccdb994ef25c975a985cc27736b36b8998451
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

This update introduces comprehensive support for commerce benefits, connectors, and variable management in the Coze API Java client. It adds new API interfaces, service layers, and data models for benefit limitations, bill download tasks, connectors, and variables. The core CozeAPI is extended to expose new services. Example usage classes demonstrate CRUD operations for these new features. Additional changes include enhancements to authentication, event handling, pagination, and minor bug fixes.

Changes

File(s) / Path(s) Change Summary
.../api/CommerceBenefitBillAPI.java
.../api/CommerceBenefitLimitationAPI.java
.../api/ConnectorAPI.java
.../api/VariablesAPI.java
New Retrofit API interfaces for benefit bills, limitations, connectors, and variables.
.../client/commerce/benefit/bill/*.java
.../client/commerce/benefit/bill/model/BillTaskInfo.java
New data models for bill download task requests, responses, and info.
.../client/commerce/benefit/common/*.java New value classes for benefit entity type, status, type, and active mode.
.../client/commerce/benefit/limitation/*.java
.../client/commerce/benefit/limitation/model/BenefitInfo.java
New data models for benefit limitation requests, responses, and info.
.../client/common/BaseReq.java Added customerToken field (ignored in JSON) for custom authentication.
.../client/common/pagination/PageNumBasedPaginator.java
.../TokenBasedPaginator.java
Exception handling improved: now rethrows original exceptions directly.
.../client/connectors/InstallConnectorReq.java
.../InstallConnectorResp.java
New request/response models for connector installation.
.../client/variables/*.java
.../client/variables/model/VariableValue.java
New request/response models for variable retrieval and update.
.../client/websocket/event/EventType.java Added new event constant: CONVERSATION_AUDIO_SENTENCE_START.
.../client/websocket/event/downstream/ConversationAudioSentenceStartEvent.java New event class for incremental audio sentence start.
.../client/websocket/event/model/ChatUpdateEventData.java
.../TurnDetection.java
Moved asrConfig field from TurnDetection to ChatUpdateEventData.
.../service/auth/JWTOAuth.java Null check added for ttl in getRefreshBefore() to prevent NPE.
.../service/auth/OAuthClient.java Increased OkHttp connection pool size and keep-alive duration.
.../service/service/AuthenticationInterceptor.java Authorization header now uses customerToken from request if present.
.../service/service/CozeAPI.java Added new services: CommerceService, VariablesService, ConnectorService and related accessors.
.../service/service/commerce/CommerceService.java New service class for commerce features, delegates to BenefitService.
.../service/service/commerce/benefits/BenefitService.java
.../BillService.java
.../LimitationService.java
New services for benefit bill and limitation management, with paginated list/create/update methods.
.../service/service/connector/ConnectorService.java New service for connector installation.
.../service/service/variable/VariablesService.java New service for variable retrieval and update.
.../service/service/websocket/chat/WebsocketsChatCallbackHandler.java
.../WebsocketsChatClient.java
Added support and handler for new audio sentence start event.
example/commerce/benefit/bill/CrudExample.java
example/commerce/benefit/limitations/CrudExample.java
New example classes demonstrating CRUD operations for benefit bills and limitations.
example/example_utils/Utils.java New utility class for constructing a configured CozeAPI instance.
example/variables/VariableExample.java New example demonstrating variable update and retrieval.
api/pom.xml
example/pom.xml
Version bump from 0.3.3 to 0.4.0.

Sequence Diagram(s)

sequenceDiagram
    participant ClientApp
    participant CozeAPI
    participant CommerceService
    participant BenefitService
    participant LimitationService
    participant BillService
    participant CommerceBenefitLimitationAPI
    participant CommerceBenefitBillAPI

    ClientApp->>CozeAPI: commerces()
    CozeAPI->>CommerceService: return instance
    ClientApp->>CommerceService: benefits()
    CommerceService->>BenefitService: return instance

    %% Create Benefit Limitation
    ClientApp->>BenefitService: limitations().create(req)
    BenefitService->>LimitationService: create(req)
    LimitationService->>CommerceBenefitLimitationAPI: create(req)
    CommerceBenefitLimitationAPI-->>LimitationService: BaseResponse<CreateBenefitLimitationResp>
    LimitationService-->>BenefitService: CreateBenefitLimitationResp
    BenefitService-->>ClientApp: CreateBenefitLimitationResp

    %% List Bill Download Tasks
    ClientApp->>BenefitService: bills().list(req)
    BenefitService->>BillService: list(req)
    BillService->>CommerceBenefitBillAPI: list(params)
    CommerceBenefitBillAPI-->>BillService: BaseResponse<ListBillDownloadTaskResp>
    BillService-->>BenefitService: PageResp<BillTaskInfo>
    BenefitService-->>ClientApp: PageResp<BillTaskInfo>
Loading
sequenceDiagram
    participant ClientApp
    participant CozeAPI
    participant VariablesService
    participant VariablesAPI

    ClientApp->>CozeAPI: variables()
    CozeAPI->>VariablesService: return instance

    %% Update Variable
    ClientApp->>VariablesService: update(UpdateVariableReq)
    VariablesService->>VariablesAPI: update(UpdateVariableReq, UpdateVariableReq)
    VariablesAPI-->>VariablesService: BaseResponse<UpdateVariableResp>
    VariablesService-->>ClientApp: UpdateVariableResp

    %% Retrieve Variable
    ClientApp->>VariablesService: retrieve(RetrieveVariableReq)
    VariablesService->>VariablesAPI: retrieve(params)
    VariablesAPI-->>VariablesService: BaseResponse<RetrieveVariableResp>
    VariablesService-->>ClientApp: RetrieveVariableResp
Loading
sequenceDiagram
    participant ClientApp
    participant CozeAPI
    participant ConnectorService
    participant ConnectorAPI

    ClientApp->>CozeAPI: connectors()
    CozeAPI->>ConnectorService: return instance

    ClientApp->>ConnectorService: install(InstallConnectorReq)
    ConnectorService->>ConnectorAPI: install(connectorId, req, req)
    ConnectorAPI-->>ConnectorService: BaseResponse<InstallConnectorResp>
    ConnectorService-->>ClientApp: InstallConnectorResp
Loading

Poem

🐇
New features hop into view,
Benefits, bills, and connectors too!
Variables managed with care,
Events for audio fill the air.
Pagination flows,
Auth now knows,
CozeAPI’s garden continues to grow!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31ad473 and 9a594f7.

📒 Files selected for processing (2)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/websocket/event/downstream/ConversationAudioSentenceStartEvent.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationReq.java
  • api/src/main/java/com/coze/openapi/client/websocket/event/downstream/ConversationAudioSentenceStartEvent.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test (Java 8 on macOS)
  • GitHub Check: test (Java 11 on macOS)
  • GitHub Check: test (Java 17 on Windows)
  • GitHub Check: test (Java 11 on Windows)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 20

🧹 Nitpick comments (14)
api/src/main/java/com/coze/openapi/client/variables/model/VariableEntity.java (1)

10-26: Add missing Jackson annotation for consistency.

Consider adding @JsonIgnoreProperties(ignoreUnknown = true) annotation to maintain consistency with other model classes in the codebase and provide resilience against unknown JSON properties.

Apply this diff:

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
 @Data
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class VariableEntity {
api/src/main/java/com/coze/openapi/client/variables/RetrieveVariablesResp.java (1)

15-23: Consider adding @JsonInclude to keep payloads lean

Serializing null fields increases payload size with no benefit. All other response DTOs appear to use @JsonInclude(JsonInclude.Include.NON_NULL) – worth adding here for consistency and smaller responses.

 @Data
 @SuperBuilder
 @NoArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_NULL)
 @EqualsAndHashCode(callSuper = true)
 @ToString(callSuper = true)
 public class RetrieveVariablesResp extends BaseResp {
api/src/main/java/com/coze/openapi/service/service/commerce/CommerceService.java (2)

6-8: Field name mis-represents its type

benefitAPI actually holds a BenefitService, not an API interface. Renaming to benefitService (or simply benefits) avoids confusion when reading code that already differentiates “API” vs “Service”.

-  private final BenefitService benefitAPI;
+  private final BenefitService benefitService;

9-16: Expose immutable dependency or add getters only when needed

CommerceService exposes BenefitService via a trivial accessor. If no extra behaviour is planned here, consider inlining BenefitService into the parent façade (or marking the field public final) to remove an unnecessary layer.

api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskResp.java (1)

20-28: Optional: default empty list to avoid NPEs

Downstream callers often iterate over taskInfos; returning null forces null-checks. Initialise with Collections.emptyList() or annotate with @Builder.Default to provide a safe default.

api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1)

5-6: Consider using a proper enum if only predefined values are expected.

If this class will only have predefined constants like ACTIVE_MODE_ABSOLUTE_TIME, consider using a standard Java enum instead of this pattern.

-public class ActiveMode {
-  public static final ActiveMode ACTIVE_MODE_ABSOLUTE_TIME = new ActiveMode("absolute_time");
+public enum ActiveMode {
+  ABSOLUTE_TIME("absolute_time");
+
+  private final String value;
+
+  ActiveMode(String value) {
+    this.value = value;
+  }
+
+  @JsonValue
+  public String getValue() {
+    return value;
+  }
+}
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (1)

25-29: Consider adding validation for pagination parameters.

The pagination parameters (pageNum and pageSize) should be validated to ensure they contain reasonable values. Consider adding validation annotations or validation logic in the service layer.

   @JsonProperty("page_num")
+  @Min(value = 1, message = "Page number must be greater than 0")
   private Integer pageNum;

   @JsonProperty("page_size")  
+  @Min(value = 1, message = "Page size must be greater than 0")
+  @Max(value = 100, message = "Page size must not exceed 100")
   private Integer pageSize;

Note: You'll need to add the appropriate validation dependency and import javax.validation.constraints.*.

api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitStatus.java (1)

8-9: Fix incorrect comment for BENEFIT_STATUS_FROZEN.

The comment "The server is processing the conversation" doesn't match the frozen benefit status context and appears to be copied from elsewhere.

-  /** The server is processing the conversation. */
+  /** The benefit is frozen and not currently active. */
   public static final BenefitStatus BENEFIT_STATUS_FROZEN = new BenefitStatus("frozen");
api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BenefitService.java (1)

6-24: LGTM! Clean facade pattern implementation.

The service facade correctly composes the limitation and bill services, providing a clean interface for benefit-related operations. The constructor and accessor methods are implemented correctly.

Consider renaming the fields to better reflect that they hold Service instances rather than API instances:

- private final LimitationService limitationAPI;
- private final BillService billAPI;
+ private final LimitationService limitationService;
+ private final BillService billService;

And update the constructor accordingly:

- this.limitationAPI = new LimitationService(limitationAPI);
- this.billAPI = new BillService(billAPI);
+ this.limitationService = new LimitationService(limitationAPI);
+ this.billService = new BillService(billAPI);
api/src/main/java/com/coze/openapi/client/connectors/bots/AuditReq.java (1)

22-23: Fix field naming convention to follow Java standards.

The fields BotID and ConnectorID should follow camelCase convention.

Apply this diff to fix the naming:

-  @JsonIgnore private String BotID;
-  @JsonIgnore private String ConnectorID;
+  @JsonIgnore private String botID;
+  @JsonIgnore private String connectorID;
example/src/main/java/example/variables/VariableExample.java (1)

20-38: Add error handling around API calls.

The example should handle potential exceptions from API calls to demonstrate proper usage patterns.

Consider wrapping API calls with try-catch:

+    try {
       UpdateVariablesResp resp =
           coze.variables()
               .update(
                   UpdateVariablesReq.builder()
                       .connectorUID(uid)
                       .botID(botID)
                       .data(
                           Collections.singletonList(
                               VariableEntity.builder().keyword("key").value("value").build()))
                       .build());
       System.out.println(resp);

       RetrieveVariablesResp retrieveResp =
           coze.variables()
               .retrieve(RetrieveVariablesReq.builder().connectorUID(uid).botID(botID).build());
       System.out.println(retrieveResp);
+    } catch (Exception e) {
+      System.err.println("API call failed: " + e.getMessage());
+      e.printStackTrace();
+    } finally {
       coze.shutdownExecutor();
+    }
example/src/main/java/example/commerce/benefit/bill/CrudExample.java (2)

40-40: Fix variable naming convention.

Variable name should follow camelCase convention.

- BillTaskInfo BillTaskInfo = liter.next();
+ BillTaskInfo billTaskInfo = liter.next();

And update the corresponding print statement:

- System.out.println(BillTaskInfo);
+ System.out.println(billTaskInfo);

49-50: Consider using dynamic timestamps for better example flexibility.

The hardcoded timestamps make this example less useful for demonstration purposes.

Consider using relative timestamps:

+ long now = System.currentTimeMillis() / 1000;
+ long startTime = now - (30 * 24 * 60 * 60); // 30 days ago
+ long endTime = now;
CreateBillDownloadTaskReq req =
-   CreateBillDownloadTaskReq.builder().startedAt(1743004800).endedAt(1745424000).build();
+   CreateBillDownloadTaskReq.builder().startedAt(startTime).endedAt(endTime).build();
api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java (1)

12-16: Fix field naming convention.

Field name should follow camelCase convention.

- private final VariablesAPI VariablesAPI;
+ private final VariablesAPI variablesAPI;

- public VariablesService(VariablesAPI VariablesAPI) {
-   this.VariablesAPI = VariablesAPI;
+ public VariablesService(VariablesAPI variablesAPI) {
+   this.variablesAPI = variablesAPI;

Also update the method implementations:

    return Utils.execute(
-           VariablesAPI.retrieve(
+           variablesAPI.retrieve(
                req.getAppID(),
                req.getBotID(),
                req.getConnectorID(),
                req.getConnectorUID(),
                keywords,
                req))
        .getData();

- return Utils.execute(VariablesAPI.update(req, req)).getData();
+ return Utils.execute(variablesAPI.update(req, req)).getData();
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b243e69 and 70cfde2.

📒 Files selected for processing (55)
  • api/src/main/java/com/coze/openapi/api/CommerceBenefitBillAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/api/CommerceBenefitLimitationAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/api/ConnectorAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/api/ConnectorBotAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/api/VariablesAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitStatus.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/CreateBenefitLimitationReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/CreateBenefitLimitationResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/model/BenefitInfo.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/common/pagination/PageNumBasedPaginator.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/common/pagination/TokenBasedPaginator.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/connectors/InstallConnectorReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/connectors/InstallConnectorResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/connectors/bots/AuditReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/connectors/bots/AuditResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/connectors/bots/model/AuditStatus.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariablesReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariablesResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/model/VariableEntity.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/websocket/event/EventType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/websocket/event/downstream/ConversationAudioSentenceStartEvent.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/websocket/event/model/ChatUpdateEventData.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/websocket/event/model/TurnDetection.java (0 hunks)
  • api/src/main/java/com/coze/openapi/service/auth/JWTOAuth.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/auth/OAuthClient.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/AuthenticationInterceptor.java (2 hunks)
  • api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (8 hunks)
  • api/src/main/java/com/coze/openapi/service/service/commerce/CommerceService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BenefitService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BillService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/commerce/benefits/LimitationService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/connector/ConnectorBotService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/websocket/chat/WebsocketsChatCallbackHandler.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/websocket/chat/WebsocketsChatClient.java (1 hunks)
  • example/src/main/java/example/commerce/benefit/bill/CrudExample.java (1 hunks)
  • example/src/main/java/example/commerce/benefit/limitations/CrudExample.java (1 hunks)
  • example/src/main/java/example/example_utils/Utils.java (1 hunks)
  • example/src/main/java/example/variables/VariableExample.java (1 hunks)
💤 Files with no reviewable changes (1)
  • api/src/main/java/com/coze/openapi/client/websocket/event/model/TurnDetection.java
🧰 Additional context used
🧬 Code Graph Analysis (17)
api/src/main/java/com/coze/openapi/service/service/websocket/chat/WebsocketsChatClient.java (1)
api/src/main/java/com/coze/openapi/client/websocket/event/EventType.java (1)
  • EventType (3-94)
api/src/main/java/com/coze/openapi/service/service/commerce/CommerceService.java (1)
api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BenefitService.java (1)
  • BenefitService (6-24)
api/src/main/java/com/coze/openapi/client/connectors/bots/AuditResp.java (2)
api/src/main/java/com/coze/openapi/client/connectors/InstallConnectorResp.java (1)
  • Data (12-18)
api/src/main/java/com/coze/openapi/client/connectors/bots/AuditReq.java (1)
  • Data (15-30)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskResp.java (4)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1)
  • BillTaskInfo (5-10)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskResp.java (1)
  • Data (13-21)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (1)
  • Data (15-30)
api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)
  • Data (9-17)
api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (2)
example/src/main/java/example/example_utils/Utils.java (1)
  • Utils (12-61)
api/src/main/java/com/coze/openapi/service/service/connector/ConnectorBotService.java (1)
  • ConnectorBotService (8-20)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (4)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskResp.java (1)
  • Data (16-28)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskResp.java (1)
  • Data (13-21)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskReq.java (1)
  • Data (13-25)
api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)
  • Data (9-17)
api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationResp.java (1)
api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/model/BenefitInfo.java (1)
  • Data (13-38)
example/src/main/java/example/example_utils/Utils.java (2)
api/src/main/java/com/coze/openapi/service/auth/JWTOAuthClient.java (1)
  • JWTOAuthClient (17-177)
api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (1)
  • CozeAPI (38-313)
api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationReq.java (4)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitStatus.java (1)
  • BenefitStatus (5-21)
api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/CreateBenefitLimitationReq.java (1)
  • Data (15-30)
api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)
  • Data (9-17)
api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/model/BenefitInfo.java (1)
  • Data (13-38)
api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java (1)
example/src/main/java/example/example_utils/Utils.java (1)
  • Utils (12-61)
example/src/main/java/example/commerce/benefit/bill/CrudExample.java (4)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1)
  • BillTaskInfo (5-10)
api/src/main/java/com/coze/openapi/service/auth/TokenAuth.java (1)
  • TokenAuth (3-13)
api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (1)
  • CozeAPI (38-313)
example/src/main/java/example/commerce/benefit/limitations/CrudExample.java (1)
  • CrudExample (17-91)
api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesReq.java (1)
api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)
  • Data (9-17)
api/src/main/java/com/coze/openapi/api/CommerceBenefitBillAPI.java (1)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1)
  • BillTaskInfo (5-10)
example/src/main/java/example/commerce/benefit/limitations/CrudExample.java (5)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1)
  • ActiveMode (5-18)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (1)
  • BenefitEntityType (5-27)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitType.java (1)
  • BenefitType (5-18)
api/src/main/java/com/coze/openapi/service/auth/TokenAuth.java (1)
  • TokenAuth (3-13)
api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (1)
  • CozeAPI (38-313)
api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (3)
api/src/main/java/com/coze/openapi/service/service/commerce/CommerceService.java (1)
  • CommerceService (6-17)
api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (1)
  • ConnectorService (9-26)
api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java (1)
  • VariablesService (10-38)
api/src/main/java/com/coze/openapi/service/service/commerce/benefits/LimitationService.java (1)
example/src/main/java/example/example_utils/Utils.java (1)
  • Utils (12-61)
api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BillService.java (2)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1)
  • BillTaskInfo (5-10)
example/src/main/java/example/example_utils/Utils.java (1)
  • Utils (12-61)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test (Java 17 on Windows)
  • GitHub Check: test (Java 11 on Windows)
🔇 Additional comments (49)
api/src/main/java/com/coze/openapi/client/websocket/event/EventType.java (1)

92-93: LGTM: Event type constant follows established pattern

The new event type constant is correctly defined and follows the same naming convention and structure as other event types in the class.

api/src/main/java/com/coze/openapi/service/service/websocket/chat/WebsocketsChatClient.java (1)

189-193: LGTM: Event handler follows established pattern

The new event handler case is implemented consistently with all other event handlers in the switch statement, maintaining the same deserialization and callback invocation pattern.

api/src/main/java/com/coze/openapi/client/websocket/event/model/ChatUpdateEventData.java (1)

28-29: AsrConfig field addition verified

All checks confirm that AsrConfig is defined in the same package as ChatUpdateEventData and no leftover references to TurnDetection.asrConfig remain:

• AsrConfig.java exists at api/src/main/java/com/coze/openapi/client/websocket/event/model/AsrConfig.java
• Both classes share the package com.coze.openapi.client.websocket.event.model, so no import is needed
• No occurrences of TurnDetection.asrConfig, getAsrConfig, or setAsrConfig were found elsewhere

No further action required.

api/src/main/java/com/coze/openapi/service/service/websocket/chat/WebsocketsChatCallbackHandler.java (1)

83-85: LGTM: Callback method follows established pattern

The new callback method is implemented consistently with all other callback methods in the class, maintaining the same signature pattern and empty default implementation.

api/src/main/java/com/coze/openapi/client/websocket/event/downstream/ConversationAudioSentenceStartEvent.java (1)

10-34: LGTM: Well-structured event class following best practices

The event class is excellently implemented with:

  • Proper inheritance from BaseEvent
  • Correct Lombok annotations including callSuper = true for equals/hashCode
  • Appropriate Jackson annotations for JSON mapping
  • Consistent event type constant usage
  • Clean nested Data class structure

The implementation follows established patterns and maintains consistency with other event classes in the system.

api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)

16-16: LGTM! Clean implementation for per-request authentication.

The addition of the customerToken field with @JsonIgnore annotation is well-designed for request-level authentication overrides. The field properly follows encapsulation principles and integrates cleanly with the authentication interceptor.

api/src/main/java/com/coze/openapi/client/common/pagination/TokenBasedPaginator.java (1)

32-32: Good improvement to exception handling.

Rethrowing the original exception directly preserves valuable debugging information and maintains the original exception type. This is better than wrapping in a generic RuntimeException and aligns with the similar change in PageNumBasedPaginator.

api/src/main/java/com/coze/openapi/client/common/pagination/PageNumBasedPaginator.java (1)

34-34: Consistent exception handling improvement.

This change mirrors the improvement in TokenBasedPaginator by preserving original exception details. The consistent approach across both paginator classes enhances debuggability and maintains clean exception propagation.

api/src/main/java/com/coze/openapi/service/auth/OAuthClient.java (1)

357-357: Good optimization for connection management.

The increased connection pool size (5→10) and extended keep-alive duration (1s→5min) are sensible optimizations that support the expanded API services. These settings should improve performance by reducing connection overhead while maintaining reasonable resource usage.

api/src/main/java/com/coze/openapi/service/auth/JWTOAuth.java (1)

59-61: Excellent null safety improvement.

Adding the null check for ttl prevents potential NullPointerExceptions and provides a sensible default behavior. This defensive programming approach enhances the robustness of token TTL handling.

api/src/main/java/com/coze/openapi/client/connectors/bots/AuditResp.java (1)

12-18: LGTM! Follows established response class patterns.

The implementation correctly follows the established pattern for response classes in the codebase, with proper Lombok annotations and Jackson configuration. The empty class body is appropriate since audit responses typically don't require additional fields beyond those inherited from BaseResp.

api/src/main/java/com/coze/openapi/client/connectors/InstallConnectorResp.java (1)

12-18: LGTM! Consistent with established response class patterns.

The implementation correctly follows the same pattern used throughout the codebase for response DTOs, with appropriate Lombok and Jackson annotations. The empty class body is standard for simple response types that only need the common fields from BaseResp.

api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskReq.java (1)

13-25: LGTM! Well-structured request class with proper timestamp handling.

The implementation correctly:

  • Uses proper Lombok annotations for boilerplate code generation
  • Maps Java camelCase fields to JSON snake_case properties
  • Uses long type for timestamp fields which is appropriate
  • Includes proper JSON serialization configuration
api/src/main/java/com/coze/openapi/client/connectors/InstallConnectorReq.java (1)

17-23: Clarify where connectorID is supplied

connectorID is @JsonIgnore, so the only place it can go is a path or query parameter. Ensure the Retrofit method actually passes this field (e.g., @Path("connectorId") String connectorId). If not, the install call will drop the connector identifier and 404.

api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesResp.java (1)

11-16: LGTM! Proper implementation following established patterns.

The class correctly uses Lombok annotations for inheritance scenarios with @SuperBuilder and callSuper = true in equality and toString methods. The empty body is appropriate for a marker response type.

api/src/main/java/com/coze/openapi/api/ConnectorBotAPI.java (1)

11-19: LGTM! Proper Retrofit API interface implementation.

The interface correctly uses Retrofit annotations with proper HTTP method, path parameters, request body, and response type. The @tag parameter for BaseReq follows the established pattern for request metadata.

api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/CreateBenefitLimitationReq.java (1)

1-30: LGTM! Well-structured request DTO class.

The class follows Java best practices with proper Lombok annotations, Jackson JSON serialization configuration, and correct inheritance handling. The field naming and JSON property mapping are consistent with REST API conventions.

api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationResp.java (1)

1-16: LGTM! Proper empty response class implementation.

This follows the common pattern of extending BaseResp without additional fields. All annotations are correctly configured for inheritance and JSON serialization.

api/src/main/java/com/coze/openapi/service/service/AuthenticationInterceptor.java (1)

22-46: LGTM! Enhanced authentication logic with customer token support.

The implementation properly handles both customer tokens and fallback to default authentication. The logic flow is clear and maintains backward compatibility for requests without BaseReq tags or customer tokens.

api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/model/BenefitInfo.java (1)

1-38: LGTM! Well-designed model class with appropriate field types.

The class properly models benefit information with suitable data types, correct Lombok annotations, and consistent Jackson JSON property mapping. The use of enum types for structured fields enhances type safety.

api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitStatus.java (1)

5-21: LGTM! Proper type-safe enum pattern implementation.

The class correctly implements the type-safe enum pattern with appropriate use of @JsonValue for serialization. The constants are well-named and the overall structure is sound.

api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskResp.java (1)

1-21: LGTM! Clean and consistent response class implementation.

The class follows established patterns with appropriate Lombok annotations and JSON serialization configuration. The structure is simple and correct for a response wrapper.

api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/ListBenefitLimitationResp.java (1)

16-31: LGTM! Well-structured paginated response class.

The class correctly implements pagination fields and uses appropriate JSON property mappings. The field types and annotations are all suitable for the intended purpose.

api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/CreateBenefitLimitationResp.java (1)

14-23: LGTM! Consistent response class implementation.

The class follows the established pattern with proper JSON property mapping and standard annotations. The implementation is clean and correct.

api/src/main/java/com/coze/openapi/api/ConnectorAPI.java (1)

11-18: LGTM! Clean and well-structured API interface.

The Retrofit interface follows best practices with proper annotations, clear parameter naming, and consistent return type patterns.

api/src/main/java/com/coze/openapi/client/connectors/bots/AuditReq.java (1)

15-30: LGTM! Well-structured request class with proper annotations.

The class correctly extends BaseReq, uses appropriate Lombok and Jackson annotations, and properly separates JSON-serialized fields from internal-only fields.

api/src/main/java/com/coze/openapi/client/variables/RetrieveVariablesReq.java (1)

13-34: LGTM! Well-structured request class with proper field separation.

The class correctly uses Lombok and Jackson annotations, and appropriately separates JSON-serialized fields from internal processing fields like keywords.

example/src/main/java/example/variables/VariableExample.java (1)

14-39: LGTM! Good example demonstrating the variables API usage.

The example clearly demonstrates both update and retrieve operations for variables, and properly cleans up resources with shutdownExecutor().

api/src/main/java/com/coze/openapi/api/VariablesAPI.java (1)

12-27: LGTM! Well-designed Retrofit API interface.

The interface follows Retrofit conventions correctly with proper HTTP method annotations, content-type headers, and parameter mappings. The method signatures are consistent and provide good flexibility for variables management operations.

api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (1)

9-26: LGTM! Well-structured service class following established patterns.

The service correctly implements the wrapper pattern around the API interfaces, provides clean method signatures, and follows the established conventions for dependency injection and response handling.

api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesReq.java (2)

12-35: LGTM! Well-designed request class with proper Lombok usage.

The class correctly extends BaseReq, uses appropriate Lombok annotations for inheritance, and provides proper JSON property mappings. The use of @NonNull annotations enhances null safety.


24-26: ConnectorID default “1024” is consistent across the codebase

We’ve verified that the default value "1024" appears in both UpdateVariablesReq.java and RetrieveVariablesReq.java, is referenced in the WorkflowRunHistory documentation, and is used in example code (BotPublishExample). This matches the intended API behavior and requires no change.

• api/src/main/java/com/coze/openapi/client/variables/UpdateVariablesReq.java
• api/src/main/java/com/coze/openapi/client/variables/RetrieveVariablesReq.java
• api/src/main/java/com/coze/openapi/client/workflows/run/model/WorkflowRunHistory.java
• example/src/main/java/example/bot/BotPublishExample.java

api/src/main/java/com/coze/openapi/api/CommerceBenefitLimitationAPI.java (1)

21-42: LGTM!

The interface is well-structured with appropriate HTTP method annotations, consistent headers, and proper parameter handling. The method signatures follow Retrofit conventions correctly.

api/src/main/java/com/coze/openapi/service/service/commerce/benefits/LimitationService.java (4)

17-22: LGTM! Clean implementation of create method.

The create method correctly executes the API call, extracts the response data, sets the log ID, and returns the response object.


24-27: LGTM! Proper implementation of update method.

The update method correctly passes the benefit ID as a path parameter and builds the response with the log ID.


29-54: LGTM! Well-structured pagination implementation.

The list method properly:

  • Sets a default page size of 20 when not provided
  • Uses TokenBasedPaginator for token-based pagination
  • Builds the PageResp with all necessary pagination metadata

The implementation follows good pagination practices.


56-92: LGTM! Comprehensive page fetcher implementation.

The getLimitationPageFetcher method:

  • Properly handles enum value extraction for filtering parameters
  • Passes all required parameters to the API call
  • Correctly maps the API response to PageResponse

The null-safe enum value extraction is a good defensive programming practice.

api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BillService.java (2)

20-26: LGTM! Clean implementation of create method.

The create method correctly executes the API call and builds the response with both the bill task info and log ID.


28-51: LGTM! Well-structured pagination implementation.

The list method properly uses PageNumBasedPaginator for number-based pagination and builds the PageResp with all necessary metadata.

example/src/main/java/example/commerce/benefit/limitations/CrudExample.java (4)

18-35: LGTM! Clean API client initialization.

The main method properly initializes the CozeAPI client with token authentication and demonstrates the list operation after a brief delay.


37-53: LGTM! Good demonstration of pagination usage.

The list method effectively demonstrates:

  • Building a request with filtering and page size
  • Using the pagination iterator
  • Counting and displaying results

This is a clear example for users of the API.


78-83: LGTM! Clean update method implementation.

The update method demonstrates a straightforward update operation with proper parameter passing.


85-90: LGTM! Secure random string generation.

The generateRandomString method uses SecureRandom and URL-safe Base64 encoding, which is appropriate for generating secure random identifiers.

api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (6)

16-16: LGTM! Clean import additions for new services.

The new imports for CommerceService, ConnectorService, and VariablesService are appropriately placed and organized.

Also applies to: 18-18, 23-23


53-55: LGTM! Proper field declarations for new services.

The new private final fields follow the established pattern and naming conventions of the class.


70-73: LGTM! Constructor properly updated for new services.

The constructor parameters and field assignments are correctly added, maintaining consistency with the existing pattern.

Also applies to: 87-89


132-142: LGTM! Clean accessor methods for new services.

The new public accessor methods follow the established naming pattern and provide appropriate access to the new service instances.


234-241: LGTM! Proper service instantiation in build method.

The new services are correctly instantiated with their required API dependencies and properly passed to the CozeAPI constructor.

Also applies to: 255-258


295-295: Significant connection pool configuration change - verify performance impact.

The connection pool configuration has been changed from 5 connections with 1-second keep-alive to 10 connections with 5-minute keep-alive. This is a substantial change that could impact:

  • Memory usage (more persistent connections)
  • Connection reuse efficiency (longer keep-alive)
  • Concurrent request handling (more connections)

Please verify this change aligns with expected usage patterns and doesn't cause resource issues in production environments. Consider documenting the rationale for this change.

Change-Id: Ia895e00199aecfeee1134cebee888ab66b52844f
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

hanzeINGH added 2 commits July 2, 2025 16:01
Change-Id: I4fa8812c86e0fa0d1e9b1e2a857629ca78dd332a
Change-Id: If1366b346d05c8d3cd4a1f13d440f2c3c32cea5b
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1)

8-26: Past review suggestions have been successfully addressed.

The class now properly implements the suggested improvements from the previous review:

  • ✅ Null validation added to constructor
  • ✅ equals(), hashCode(), and toString() methods provided via Lombok @DaTa
  • ✅ Immutable design with final field

The implementation follows good practices for a type-safe enumeration pattern with proper JSON serialization support.

api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1)

12-22: Great improvements! Consider adding the remaining annotations from previous feedback.

The class implementation has been significantly improved since the previous review - all the critical issues have been addressed:

  • ✅ Lombok annotations added for boilerplate code
  • ✅ Jackson annotations added for JSON serialization
  • ✅ Incomplete commented line removed

However, the previous review also suggested two additional annotations that could enhance robustness:

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Builder;

+@Builder
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
+@JsonIgnoreProperties(ignoreUnknown = true)
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class BillTaskInfo {
🧹 Nitpick comments (1)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1)

8-9: Remove redundant @EqualsAndHashCode annotation.

The @EqualsAndHashCode annotation is redundant since @Data already includes equals() and hashCode() generation.

 @Data
-@EqualsAndHashCode
 public class ActiveMode {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70cfde2 and dd8b4d8.

📒 Files selected for processing (11)
  • api/pom.xml (1 hunks)
  • api/src/main/java/com/coze/openapi/api/CommerceBenefitBillAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/model/VariableEntity.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BillService.java (1 hunks)
  • example/pom.xml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • example/pom.xml
  • api/pom.xml
🚧 Files skipped from review as they are similar to previous changes (7)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java
  • api/src/main/java/com/coze/openapi/client/variables/model/VariableEntity.java
  • api/src/main/java/com/coze/openapi/service/service/commerce/benefits/BillService.java
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java
  • api/src/main/java/com/coze/openapi/api/CommerceBenefitBillAPI.java
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitType.java
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/limitation/UpdateBenefitLimitationReq.java
🧰 Additional context used
🧬 Code Graph Analysis (1)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/model/BillTaskInfo.java (5)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskReq.java (1)
  • Data (12-28)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskResp.java (1)
  • Data (13-21)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/ListBillDownloadTaskResp.java (1)
  • Data (16-28)
api/src/main/java/com/coze/openapi/client/commerce/benefit/bill/CreateBillDownloadTaskReq.java (1)
  • Data (13-25)
api/src/main/java/com/coze/openapi/client/common/BaseReq.java (1)
  • Data (9-17)
🔇 Additional comments (1)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/ActiveMode.java (1)

15-20: Constructor implementation looks good.

The null validation in the constructor properly addresses the previous review feedback and prevents invalid state creation.

@chyroc chyroc added the feature label Jul 2, 2025
hanzeINGH added 4 commits July 2, 2025 16:37
Change-Id: I74b0f1dad2dc11c26c6bc5844c3eccca10d0419e
Change-Id: I7e8d2647b7c43fd9063a64652da60a658aac34b6
Change-Id: I7bf01187cf253a300c6e33d6e2658b818c09396c
Change-Id: Idd77f710edee96dfa3e988000024b1c9db3c627e
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (2)
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (2)

29-43: Previous feedback has been addressed - JSON deserialization support added.

The @JsonCreator method has been properly implemented to handle JSON deserialization, addressing the previous bot review comment.


7-8: Enterprise prefix added as requested.

The enterprise prefix has been added to the JSON values as requested in previous reviews.

Also applies to: 10-11

🧹 Nitpick comments (2)
api/src/main/java/com/coze/openapi/client/variables/UpdateVariableReq.java (2)

24-26: Consider extracting magic number to a constant

The default value "1024" for connectorID appears to be a magic number without context about what it represents.

Consider defining this as a constant to improve maintainability:

+  public static final String DEFAULT_CONNECTOR_ID = "1024";
+  
   @JsonProperty("connector_id")
   @Builder.Default
-  private String connectorID = "1024";
+  private String connectorID = DEFAULT_CONNECTOR_ID;

Alternatively, add a comment explaining what this value represents.


28-34: Consider using validation annotations for better runtime validation

The @NonNull annotation from Lombok only provides compile-time null checks in generated constructors. For a request object that may be validated at runtime, consider using validation annotations.

Consider adding validation annotations:

+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotEmpty;

-  @NonNull
+  @NotNull
   @JsonProperty("connector_uid")
   private String connectorUID;

-  @NonNull
+  @NotNull
+  @NotEmpty
   @JsonProperty("data")
   private List<VariableValue> data;

This provides better integration with validation frameworks and clearer intent for API consumers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd8b4d8 and ac1bc62.

📒 Files selected for processing (14)
  • api/pom.xml (1 hunks)
  • api/src/main/java/com/coze/openapi/api/VariablesAPI.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariableReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariableResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/UpdateVariableReq.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/UpdateVariableResp.java (1 hunks)
  • api/src/main/java/com/coze/openapi/client/variables/model/VariableValue.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/CozeAPI.java (8 hunks)
  • api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (1 hunks)
  • api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java (1 hunks)
  • api/src/main/resources/version.properties (1 hunks)
  • example/pom.xml (1 hunks)
  • example/src/main/java/example/variables/VariableExample.java (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • api/src/main/resources/version.properties
  • api/pom.xml
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariableResp.java
  • api/src/main/java/com/coze/openapi/client/variables/UpdateVariableResp.java
  • api/src/main/java/com/coze/openapi/client/variables/model/VariableValue.java
  • api/src/main/java/com/coze/openapi/client/variables/RetrieveVariableReq.java
🚧 Files skipped from review as they are similar to previous changes (5)
  • example/pom.xml
  • example/src/main/java/example/variables/VariableExample.java
  • api/src/main/java/com/coze/openapi/service/service/variable/VariablesService.java
  • api/src/main/java/com/coze/openapi/api/VariablesAPI.java
  • api/src/main/java/com/coze/openapi/service/service/CozeAPI.java
🧰 Additional context used
🧬 Code Graph Analysis (1)
api/src/main/java/com/coze/openapi/service/service/connector/ConnectorService.java (1)
example/src/main/java/example/example_utils/Utils.java (1)
  • Utils (12-61)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test (Java 17 on Windows)
  • GitHub Check: test (Java 11 on Windows)
  • GitHub Check: test (Java 8 on macOS)
🔇 Additional comments (3)
api/src/main/java/com/coze/openapi/client/variables/UpdateVariableReq.java (2)

1-11: LGTM - Clean imports and package structure

The package structure and imports are well-organized and appropriate for the functionality.


12-17: Well-structured Lombok annotations with proper inheritance handling

The Lombok annotations are correctly configured for a class that extends BaseReq:

  • @SuperBuilder is appropriate for inheritance scenarios
  • callSuper = true for @EqualsAndHashCode and @ToString ensures proper inheritance behavior
  • The combination provides clean boilerplate code generation
api/src/main/java/com/coze/openapi/client/commerce/benefit/common/BenefitEntityType.java (1)

29-42: LGTM - Well-implemented JSON deserialization logic.

The @JsonCreator method correctly handles both predefined constants and unknown values by creating new instances when no match is found. This provides good flexibility for API evolution.

hanzeINGH added 3 commits July 4, 2025 15:24
Change-Id: I4ff0fed099b3e4cd1b4afb81ed93adf651b68786
Change-Id: Ic7eba053d54a4a33d59a2b57448b2dc58c1502c4
Change-Id: Ib7154e0d9e039d165146167507bacf82c617dbad
hanzeINGH added 3 commits July 4, 2025 16:05
Change-Id: Iee3fbcb20b6af85b03e32b4c4280cf8a32b0164f
Change-Id: I09a5c72d9c551b10b66cf8aa317c9185295847ba
…at/apply_interface

Change-Id: I0ad06788cf21f579071025593c4582b635196612
@JsonInclude(JsonInclude.Include.NON_NULL)
@EqualsAndHashCode(callSuper = true)
public class ListBenefitLimitationReq extends BaseReq {
@JsonProperty("entity_id")
Copy link
Contributor

@chyroc chyroc Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

entity_type

@AllArgsConstructor
public static class Data {
@JsonProperty("content")
private String content;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text

Change-Id: I5ec35aad6500f350823f7a226e7c4a5ab72aaac5
@chyroc chyroc changed the title feat: apply interface feat: Add some api Jul 8, 2025
@chyroc chyroc merged commit 803c7a4 into coze-dev:main Jul 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants