feat: implementing project_plan_limits method to get limits from a new internal api endpoint#30
Conversation
3ecebb1 to
1a9722c
Compare
1a9722c to
27e373a
Compare
There was a problem hiding this comment.
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_limitsandproject_data_with_limitsmethods to the RegistryClient trait - Introduces new data structures
PlanLimitsandProjectDataWithLimitsfor 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_URIusesURIbut the type isUrl. For consistency, consider renaming toINTERNAL_API_BASE_URLto 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_urlfunction lacks test coverage. Consider adding tests similar to the existingtest_build_explorer_urltests 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_limitsmethod 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_limitsmethod 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(
| cmd: fmt | ||
| args: -- --check | ||
| toolchain: nightly | ||
| toolchain: stable |
There was a problem hiding this comment.
Why change this? We typically use nightly formatting which was fine
There was a problem hiding this comment.
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.
Description
This PR implements a new
project_plan_limitsmethod to get limits from the new internalhttps://api.reown.comendpoint to check the projectId and quota validation.The full context is in the Slack thread.
How Has This Been Tested?
Tested manually.
Due Diligence