Skip to content

Conversation

@tothandras
Copy link
Contributor

@tothandras tothandras commented Jun 12, 2025

Summary by CodeRabbit

  • New Features

    • Added ability to retrieve customer access information.
    • Introduced advanced event listing with filtering and pagination.
    • Added management of plan addons, including listing, creating, updating, and deleting addons.
    • Enabled deletion of scheduled subscriptions.
  • Improvements

    • Enhanced consistency and clarity of parameter naming across several methods.
    • Standardized request parameter handling for plans and events APIs.

@tothandras tothandras requested a review from hekike June 12, 2025 17:06
@tothandras tothandras requested a review from a team as a code owner June 12, 2025 17:06
@tothandras tothandras added the release-note/feature Release note: Exciting New Features label Jun 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

📝 Walkthrough

Walkthrough

The changes introduce new methods and classes to the API client, enhancing support for customer access retrieval, event listing with improved filtering, plan addon management, and subscription deletion. Method signatures are updated for clarity and consistency, and a new PlanAddons class is added to modularize plan addon operations.

Changes

File(s) Change Summary
.../client/customers.ts Added getAccess method to Customers class for retrieving customer access information.
.../client/events.ts Renamed list method parameter for clarity, updated request parameter structure, and added new listV2 method.
.../client/plans.ts Added PlanAddons class for plan addon CRUD operations; updated Plans class with new property and methods.
.../client/subscriptions.ts Added delete method to Subscriptions class for deleting scheduled subscriptions.
✨ 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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
Contributor

@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

🧹 Nitpick comments (6)
api/client/javascript/src/client/customers.ts (1)

131-136: JSDoc param description is outdated

The JSDoc block still refers to @param signal, but the actual parameter is options. Update the comment to avoid confusion.

- * @param options - Optional request options
+ * @param options - Optional request options
api/client/javascript/src/client/subscriptions.ts (2)

173-179: Align JSDoc parameter name with implementation

The JSDoc tag says @param subscriptionId, yet the method argument is called subscriptionId. That’s correct, but the preceding comment * Delete subscription mentions “Only scheduled subscriptions can be deleted.”
Consider clarifying that restriction in the tag, and explicitly documenting that the method returns the deleted subscription (or void) once the backend is consistent.


180-195: Method name delete may clash with built-in operator

delete is allowed as a method name, but it can be visually confusing with the JS delete operator and makes stack-traces harder to grep. If you have the freedom to change the public surface, consider renaming to remove or destroy for clarity.

No functional bug, only readability.

api/client/javascript/src/client/events.ts (1)

53-70: Duplicated request-building logic – extract a helper

list and listV2 are identical except for the path. Consider a small private helper to DRY the code and keep later maintenance cheaper.

private async _list(path: string, params?: Record<string, unknown>, options?: RequestOptions) {
  const resp = await this.client.GET(path, {
    params: params ? { query: params } : undefined,
    ...options,
  })
  return transformResponse(resp)
}

Then list and listV2 become one-liners.

api/client/javascript/src/client/plans.ts (2)

16-20: Expose addons as readonly

addons is an accessor to a utility object – callers shouldn’t replace it. Marking it readonly signals intent and prevents accidental reassignment:

-  public addons: PlanAddons
+  public readonly addons: PlanAddons

238-254: High duplication across CRUD methods

create, get, update, delete all follow the same request/response pattern differing only by HTTP verb & path. Extracting a private helper (similar to the earlier Events suggestion) would centralise error handling and keep signatures succinct.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 191a594 and d3e0350.

📒 Files selected for processing (4)
  • api/client/javascript/src/client/customers.ts (1 hunks)
  • api/client/javascript/src/client/events.ts (1 hunks)
  • api/client/javascript/src/client/plans.ts (6 hunks)
  • api/client/javascript/src/client/subscriptions.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: CI
  • GitHub Check: Quickstart
  • GitHub Check: E2E
  • GitHub Check: Commit hooks
  • GitHub Check: Developer environment
  • GitHub Check: Lint
  • GitHub Check: Test
  • GitHub Check: Migration Checks
  • GitHub Check: Build
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
api/client/javascript/src/client/events.ts (1)

35-52: Passing undefined query params

When params is undefined, the call builds { query: undefined }. Depending on the fetch-client implementation this might serialise as ?undefined or omit the query string. Defensive guard keeps the wire clean:

-      params: { query: params },
+      params: params ? { query: params } : undefined,
api/client/javascript/src/client/plans.ts (1)

168-182: Guard against undefined query params in listing

Same as with the Events client: if params is not provided we risk emitting ?undefined. Consider:

-      params: {
-        path: { planId },
-        query: params,
-      },
+      params: params
+        ? { path: { planId }, query: params }
+        : { path: { planId } },

@tothandras tothandras enabled auto-merge (squash) June 12, 2025 17:13
@tothandras tothandras merged commit 1b87dc1 into main Jun 12, 2025
27 checks passed
@tothandras tothandras deleted the feat/js-client-methods branch June 12, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/feature Release note: Exciting New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants