Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for namePrefix, tags and project filters #54

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

teqm
Copy link
Contributor

@teqm teqm commented Jan 16, 2023

About the changes

Added missing support for feature filters, that is namePrefix, tags and project. According to https://docs.getunleash.io/reference/sdks#server-side-sdk-compatibility-table it's already present in some of the SDKs, so I suppose we can add it here as well. It's nothing "big", but in my experience (with node.js SDK) can be useful.

Important files

Discussion points

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

@teqm Thanks so much for the contribution! It would be nice to get this feature into this SDK. I have some nitpicks here and I need a bit of time to review a bit more carefully but I'd like @rbtcollins to weigh in on the overall approach before I do, since he's much more familiar with this SDK than I am

@sighphyre
Copy link
Member

...but also, Clippy seems to have a few warnings here

Cargo.toml Outdated Show resolved Hide resolved
src/api.rs Outdated Show resolved Hide resolved
src/api.rs Outdated Show resolved Hide resolved
src/api.rs Outdated Show resolved Hide resolved
src/api.rs Outdated
}
}

#[cfg(not(feature = "surf"))]
Copy link
Collaborator

Choose a reason for hiding this comment

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

these parts should be written against the local http client trait, so that both surf and reqwest users gain them. That trait may need tweaking to accomodate your needs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find a "nice" way of implementing it 🤔 I didn't want to polute the trait with the logic of features query, so instead I made it that the query is already present in the url when it's passed to the http layer. wdyt is it fine to do it that way?

Copy link
Collaborator

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

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

I've left some thoughts on the PR.

As of today I haven't looked into these features at all, so I'm at a bit of a loss what this actually offers.

@teqm
Copy link
Contributor Author

teqm commented Mar 9, 2023

As of today I haven't looked into these features at all, so I'm at a bit of a loss what this actually offers.

It adds a convenient way to filter the features - yeah I agree with you that it doesn't bring a lot of value, but if I'm not mistaken the tag filtering isn't possible to implement client side as this information isn't returned from the API.

When it comes to namePrefix and project then those can be done in a different way, namePrefix can be easily checked client side, and project can be limited with API token (you can select to which project(s) you want to give access to). I've added those two only to align with other SDKs (ref https://docs.getunleash.io/reference/sdks#server-side-sdk-compatibility-table).

If you feel like this isn't valuable, feel free to reject the PR - I can handle it 😅

@teqm teqm requested a review from rbtcollins March 9, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants