Skip to content

feat: implementing project_plan_limits method to get limits from a new internal api endpoint#30

Merged
geekbrother merged 3 commits into
mainfrom
feat/add_internal_api_plan_check
Jul 23, 2025
Merged

feat: implementing project_plan_limits method to get limits from a new internal api endpoint#30
geekbrother merged 3 commits into
mainfrom
feat/add_internal_api_plan_check

Conversation

@geekbrother

@geekbrother geekbrother commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Description

This PR implements a new project_plan_limits method to get limits from the new internal https://api.reown.com endpoint to check the projectId and quota validation.

The full context is in the Slack thread.

How Has This Been Tested?

Tested manually.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@geekbrother geekbrother requested a review from Copilot July 22, 2025 13:50
@geekbrother geekbrother self-assigned this Jul 22, 2025

This comment was marked as outdated.

@geekbrother geekbrother force-pushed the feat/add_internal_api_plan_check branch from 3ecebb1 to 1a9722c Compare July 22, 2025 13:57
@geekbrother geekbrother force-pushed the feat/add_internal_api_plan_check branch from 1a9722c to 27e373a Compare July 23, 2025 09:56
@geekbrother geekbrother requested a review from Copilot July 23, 2025 11:40

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a new project_plan_limits method to integrate with a new internal API endpoint for retrieving project limits and quota validation, expanding from the existing explorer-based project data retrieval.

  • Adds new project_limits and project_data_with_limits methods to the RegistryClient trait
  • Introduces new data structures PlanLimits and ProjectDataWithLimits for handling limit information
  • Refactors the HTTP client to support both explorer and internal API endpoints

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/registry/client.rs Main implementation adding new methods, internal API URL support, and refactoring existing URL building logic
src/project/types/project_data.rs Defines new data structures for plan limits and project data with limits
.github/workflows/ci.yaml Updates toolchain from nightly to stable for formatting check
Comments suppressed due to low confidence (4)

src/registry/client.rs:17

  • [nitpick] The variable name INTERNAL_API_BASE_URI uses URI but the type is Url. For consistency, consider renaming to INTERNAL_API_BASE_URL to match the type and other variable names in the codebase.
static INTERNAL_API_BASE_URI: Lazy<Url> =

src/registry/client.rs:225

  • The new build_internal_api_url function lacks test coverage. Consider adding tests similar to the existing test_build_explorer_url tests to ensure the URL construction works correctly with query parameters.
fn build_internal_api_url(base_url: &Url, project_id: &str) -> Result<Url, url::ParseError> {

src/registry/client.rs:201

  • The new project_limits method lacks test coverage. Consider adding integration tests to verify the method correctly handles valid project IDs, invalid project IDs, and various HTTP response scenarios.
    async fn project_limits(&self, project_id: &str) -> RegistryResult<Option<PlanLimits>> {

src/registry/client.rs:205

  • The new project_data_with_limits method lacks test coverage. Consider adding tests to verify the method correctly combines project data and limits, and handles cases where either request fails.
    async fn project_data_with_limits(

@geekbrother geekbrother marked this pull request as ready for review July 23, 2025 12:21
@geekbrother geekbrother requested a review from xDarksome as a code owner July 23, 2025 12:21
Comment thread .github/workflows/ci.yaml
cmd: fmt
args: -- --check
toolchain: nightly
toolchain: stable

@chris13524 chris13524 Jul 23, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why change this? We typically use nightly formatting which was fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe we moved to the stable in a recent service change. As I remember, the reason to use nightly was an async trait, which is not an issue for a while. btw, blockchain-api uses a stable.

@geekbrother geekbrother merged commit c007202 into main Jul 23, 2025
5 checks passed
@geekbrother geekbrother deleted the feat/add_internal_api_plan_check branch July 23, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants