Skip to content

Misc. small changes #57

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

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

Misc. small changes #57

wants to merge 6 commits into from

Conversation

b4D8
Copy link
Contributor

@b4D8 b4D8 commented May 20, 2025

  • feat(sse): add SseErrorOf type alias
  • feat: let endpoint argument be any type that impl reqwest::IntoUrl (closes Allow endpoint to be any type that implements IntoUrl #53)
    • moved request to RestClient trait for IMHO better separation of concerns
    • moved execute to Execute trait for better type inference
  • chore: simplify qparams parsing
  • fix: ensure credentials do not leak secrets in logs through fmt::Debug impl

b4D8 added 3 commits May 21, 2025 09:31
…loses #53)

   * move request method to `RestClient` trait for better separation of concerns
   * move execute method to `Execute` trait for better type inference
type Error;

fn request<T, U>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are breaking the abi with this modification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I'd like to propose this breaking change to API because IMHO request is better placed in the REST interface, as it's a shorthand for the implementation of the Method specific methods

pub consumer_key: String,
pub consumer_secret: String,
#[derive(Clone, PartialEq, Eq)]
pub struct Signer<T = String> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the idea behind adding a generic type which is defaulting to the current type? To me, this is over-engineered, please keep it simple stupid

Copy link
Contributor Author

@b4D8 b4D8 May 23, 2025

Choose a reason for hiding this comment

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

I think it actually makes things easier and also prevents many intermediate allocations, since we most handle static string slices and types with internal string slice representations (Method, Url). I pushed things further in #58 by removing the trait altogether and letting the implementation always work on string slices directly which drastically simplifies it all, IMHO

urlencoding::encode(&self.consumer_secret),
urlencoding::encode(&self.secret)
urlencoding::encode(self.consumer_secret.as_ref()),
urlencoding::encode(self.secret.as_ref())
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between the two version? To me, it is easier to read with the previous version

Copy link
Contributor Author

@b4D8 b4D8 May 23, 2025

Choose a reason for hiding this comment

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

With String with have ops::Deref<Target = str> but with the proposed change we are generic on T: AsRef<str> which is a broader and must use the method explicitly

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.

Allow endpoint to be any type that implements IntoUrl
2 participants