Skip to content

feat: add project features - #31

Merged
lukaisailovic merged 4 commits into
mainfrom
feat/project-features
Aug 14, 2025
Merged

feat: add project features#31
lukaisailovic merged 4 commits into
mainfrom
feat/project-features

Conversation

@lukaisailovic

@lukaisailovic lukaisailovic commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Description

Add new project_data_with method that allows for the querying of the additional data along with the base project data.

 async fn project_data_with(
        &self,
        request: ProjectDataRequest<'_>,
    ) -> RegistryResult<Option<ProjectDataResponse>>;
}

Currently, supported additional data are limits and features

pub struct ProjectDataRequest<'a> {
    pub id: &'a str,
    pub include_limits: bool,
    pub include_features: bool,
}

Resolves # (issue)

How Has This Been Tested?

Due Diligence

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

@lukaisailovic lukaisailovic self-assigned this Aug 14, 2025

@xDarksome xDarksome left a comment

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.

Adding more of these ProjectDataWith* is weird. Next time consider introducing ProjectDataWith struct where each of these additional pieces of data are either Option or serde(default). Then you can specify which ones you want to query in the fn arguments.

struct ProjectDataWithQuery<'a> {
    id: &'a str,
    include_limits: bool,
    include_features: bool,
}

trait RegistryClient {
    fn project_data_with(&self, query: ProjectDataWithQuery<'_>) -> RegistryResult<Option<ProjectDataWith>>;
}

Or, considering that we are doing multiple network calls either way, we could put those query fns on ProjectData itself.

struct ProjectData {
    ...
}

impl ProjectData {
   async fn features(&self) -> RegistryResult<Vec<Feature>> {
        todo!()
   }

   async fn limits(&self) -> RegistryResult<Limits> {
       todo!()
   }
}

@lukaisailovic

Copy link
Copy Markdown
Contributor Author

@xDarksome Good point. I was a bit lazy, wanted to do it asap.

I like the idea of doing it in ProjectData however, it currently doesn't have the access to the RegistryClient so you would either have to pass it as a param or we would need to put it in the struct. Not a fan of either of those.

Went with the first approach, just used different naming for the query.

Please give it another look when you can and lmk wdyt 🙏

@xDarksome xDarksome left a comment

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.

Looks good

Comment thread src/project/types/project_data.rs Outdated
Comment thread src/project/types/project_data.rs Outdated
Comment thread src/registry/client.rs
@lukaisailovic
lukaisailovic enabled auto-merge (squash) August 14, 2025 13:32
@lukaisailovic

Copy link
Copy Markdown
Contributor Author

@xDarksome PR checks need to be updated in the settings. ci / Checks vs Checks

@xDarksome
xDarksome self-requested a review August 14, 2025 13:40

@xDarksome xDarksome left a comment

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.

Checks should be fixed now

@lukaisailovic
lukaisailovic merged commit 273a936 into main Aug 14, 2025
5 checks passed
@lukaisailovic
lukaisailovic deleted the feat/project-features branch August 14, 2025 13:44
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.

2 participants