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

Authentication Rewrite #70

Merged
merged 43 commits into from
Jun 16, 2024
Merged

Authentication Rewrite #70

merged 43 commits into from
Jun 16, 2024

Conversation

isFakeAccount
Copy link
Owner

  • Redesigns the architecture for authentication and HTTP requests.
  • Improve pagination for all endpoints using pagination.
  • Improves typing in the project.
  • Fixes docstring now that docstrfmt can format :raises: properly.
  • Removes types from docstring because they were redundant.

- Refactors Authenticator and RequestBuilder class such that Authenticator utilizes the RequestBuilder class for HTTP requests. RequestBuilder also follows single responsibility principle better.
- Now Authentication will now throw HTTPError instead will use the PSNAWPExceptions
- Adds a few more custom exceptions and now ClientError subclass PSNAWPClientError
- Reformats with Contributing Document
- Makes the refresh token expiry more flexible. Now users can decide when it should trigger and what callback should be triggered.
- Fixes a circular import
- Removes the refresh token warn logic because of added complexity. It makes more sense for user to do it now that there are methods to get what the want.
- Changes param name from default_headers to common_headers to be more clear
- Removes create_logger function from __init__.py file in utils
- Add logic in header to call methods that will fetch new refresh token whether from
- Fixes the OAuth Method and makes it closer to Android App version
- Adds new params to Authorization method as well to bring it closer to how app behaves
- Renames auth_properties to better name and add TypeDict to make it more robust
- Changes the check to is None Check for explicitness
Removes unnecessary variable
Remove "Content-Type" key from RequestBuilderHeaders dictionary in request_builder.py.
- FIxes a bug in authenticator where the Authorization wasn't added to kwargs if it didn't have header key
- Some minor formatting
- Separates out licenses into several files to it is easier to see all licenses.
- Also, github was having some issue with several licenses being in one file.
- Updates docstformat
- Updates VSCode project settings for docstring
- Updates docstring to correct format
- Adds docstring to missing methods
…object creation and builder class.

- Splits the TrophyGroupSummary into TrophyGroupSummary and EarnedTrophyGroupSummary.
- Improves the object creation. Instead of everything happening in private function the responsibility is split.
- Fixed docstring and improvements in typing by using Generic typing
- Added a description for EarnedTrophyGroupSummary class.
- Refactored TrophySummary class to use dataclass instead of attrs
- Updated method signature in TrophySummary class to accept Authenticator object for API requests
- Fixes docstring
Removes redundant type hints in Pagination Iterator
Imported trophy-related models in the trophies package to the init file for easier access and organization.
- Added a new method to fetch the next page of trophy titles efficiently.
- Updated constructor parameters for better clarity and flexibility.
- Enhanced methods to retrieve trophy titles with pagination support.
@isFakeAccount isFakeAccount marked this pull request as draft June 3, 2024 05:13
- Added TYPE_CHECKING import for conditional type hinting
- Moved types imports RequestBuilderHeaders and RequestOptions to TYPE_CHECKING
- Updated type import statements for better readability and maintainability.
- Added import for TrophySet in trophies/__init__.py
- Updated import statements in trophy_group.py to include TYPE_CHECKING
- Fixed  TrophyGroupsSummaryBuilder typing issue
- Added `TYPE_CHECKING` condition for improved type hints.
- Updated import statements in trophy_summary.py and trophy_titles.py to enhance code clarity.
Added a note in the docstring to specify responsibilities for implementing `fetch_next_page` method.
- Added docstrings to classes and methods for better documentation.
- Renamed a class from TitleStatsListing to TitleStatsIterator.
- Introduced TYPE_CHECKING for improved type hinting.
Removed total_items_count and rarest_trophies fields. Refactored TrophyTitles to TrophyTitleIterator for clarity and consistency in handling trophy data retrieval.
- Refactored the Trophy class to use dataclass
- Added a new class TrophyWithProgress inheriting from Trophy
- Implemented PaginationIterator for iterating over trophies with platform-specific handling
Updated the class name from EarnedTrophyGroupSummary to TrophyGroupSummaryWithProgress for clearer representation and functionality.
Changed the order of TrophyGroup imports to maintain consistency in the code structure.
- Refactors User class to use new Classes and Methods like from Trophy and Authentication.
- Updated typing imports and method signatures in the User class to use TYPE_CHECKING and Self.
- Refactored method parameters and return types for better consistency.
Changed workflow to trigger on push events to the master branch and when PRs are ready for review or closed.
@isFakeAccount isFakeAccount marked this pull request as ready for review June 16, 2024 23:10
@isFakeAccount isFakeAccount merged commit 7f14203 into master Jun 16, 2024
14 of 15 checks passed
@isFakeAccount isFakeAccount linked an issue Jun 17, 2024 that may be closed by this pull request
@isFakeAccount isFakeAccount deleted the authentication_rewrite branch June 17, 2024 23:11
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.

search question
1 participant