-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow searching with company slug #37
Allow searching with company slug #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments and variable names should probably suggest that fetching by the slug is also possible. Otherwise, it all seems to be okay. 👍
@ShawnCZek what's your opinion on renaming that |
@iDiegoNL I was rather thinking of something like |
Interesting, but if someone needs to read the documentation in order to fully understand what a variable can be & means, it's not a good name in my opinion :) |
@iDiegoNL I was just thinking ahead of the possibility of adding another "key" for the search. |
@ShawnCZek That is true indeed, could get messy if we were to add more "searchable properties". Good shout 😆 With "adding another", do you mean adding a |
@iDiegoNL Just renaming the variable and modifying the documentation to mention both the options. |
@ShawnCZek above suggestion has been implemented 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is all looking great now. Thank you for this pull request!
Currently, it already is a possibility to search by company slug in the API. E.g.
https://api.truckersmp.com/v2/vtc/phoenix
. However, because of the type declarations in this package code, this wasn't an option here yet.This PR resolves that issue, including a test that checks the functionality with a company slug.
Sadly, because this package isn't PHP ^8.0, declaring the property types as
int|string
wasn't possible. However, declaring them as a string shouldn't be a problem because of type juggling. And they are declared asstring|int
in the DocBlocks.This should all work as expected, with both slugs and integer IDs, but let me know if there is any feedback.