-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
[BSS-31] New Request Mechanism #9
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shahmal1yev
force-pushed
the
bss-31
branch
5 times, most recently
from
September 10, 2024 14:49
1620e2c
to
2043139
Compare
- Implemented `Request` class under the `Atproto\HTTP` namespace with methods to manage URL, path, method, headers, parameters, and query parameters. - Added flexibility in setting and retrieving values for headers, parameters, and query parameters. - Provided encoding for headers and parameters as arrays or JSON. - Created `RequestTest` class under `Tests\Unit\HTTP` to ensure proper functionality: - Added tests for setting and retrieving values via the methods. - Verified instance return consistency when setting values. - Tested encoding output for headers, parameters, and query parameters.
- Introduced a new `RequestContract` interface to define the contract for HTTP request handling. - Updated the `Request` class to implement `RequestContract` and conform to the interface requirements. - Adjusted the `RequestTest` unit test to assert that `Request` implements `RequestContract` for better type consistency and interface-driven design.
- Created a new `APIRequestContract` interface that extends `RequestContract` for building API-specific requests. - Added a `build()` method to `APIRequestContract` to ensure that implementations can return a fully constructed `RequestContract`.
- Deprecated the `GetProfile` class in `src/API/App/Bsky/Actor/GetProfile.php`. - Updated the `RequestContract` to provide stricter method signatures for `url` and introduced the `origin` method. - Introduced `MissingProvidedFieldException` to handle cases where required fields are missing. - Created `APIRequest` base class in `src/HTTP/API/APIRequest.php`, which defines default headers and origin for API requests. - Re-implemented the `GetProfile` request using the new `APIRequest` abstraction, adding validation for the `actor` field and building query parameters dynamically. - Refined the `Request` class to handle URL construction based on origin, path, and query parameters, while adding the `origin` method. - Added reflection support for tests, making it easier to manipulate private properties in `tests/Supports/Reflection.php`. - Added unit tests for `GetProfile` to validate proper behavior, including checking that the `actor` method sets the correct data.
…Exception::__construct() has invalid type Atproto\Exceptions\Http\Throwable.
- Deprecate CreateRecord and UploadBlob classes in Com/Atrproto/Repo - Add new CreateRecord and UploadBlob classes in HTTP/API/Requests/Com/Atproto/Repo - Update RequestContract interface to allow non-string parameter values - Refactor Request class to accommodate non-string parameter values - Improve error handling and parameter validation in new classes - Add deprecation notices and trigger warnings in legacy classes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement and test the new request mechanism framework and integrate it into the system.
Objectives:
Key Tasks:
Success Criteria: