-
Notifications
You must be signed in to change notification settings - Fork 33
PCH Refactor: Refactor the external services #2873
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
Conversation
acicovic
left a comment
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.
As a first step, I've reviewed all edited files (not new ones) and left some comments.
src/rest-api/content-helper/class-endpoint-excerpt-generator.php
Outdated
Show resolved
Hide resolved
# Conflicts: # src/content-helper/dashboard-widget/class-dashboard-widget.php # src/rest-api/content-helper/class-endpoint-excerpt-generator.php
acicovic
left a comment
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.
This is great work! Thank you so much! 🙂
I had lots of DocBlock/whitespace comments, so I addressed them here instead of leaving them as comments. Please check and let me know if you have any observations.
I've left a couple of comments.
FYI, I'm also getting some PHPStan warnings, not related to tests.
------ ------------------------------------------------------
Line src/rest-api/class-base-endpoint.php
------ ------------------------------------------------------
199 Dynamic call to static method
Parsely\REST_API\Base_Endpoint::get_endpoint_name().
------ ------------------------------------------------------
------ ----------------------------------------------------------------------------
Line src/rest-api/stats/trait-related-posts.php (in context of class
Parsely\REST_API\Stats\Endpoint_Post)
------ ----------------------------------------------------------------------------
142 Parameter #1 $callback of function array_map expects (callable(mixed):
mixed)|null, Closure(array): array{image_url: mixed, thumb_url_medium:
mixed, title: mixed, url: string} given.
💡 Type array of parameter #1 $item of passed callable needs to be same or
wider than parameter type mixed of accepting callable.
------ ----------------------------------------------------------------------------
------ ----------------------------------------------------------------------------
Line src/rest-api/stats/trait-related-posts.php (in context of class
Parsely\REST_API\Stats\Endpoint_Related)
------ ----------------------------------------------------------------------------
142 Parameter #1 $callback of function array_map expects (callable(mixed):
mixed)|null, Closure(array): array{image_url: mixed, thumb_url_medium:
mixed, title: mixed, url: string} given.
💡 Type array of parameter #1 $item of passed callable needs to be same or
wider than parameter type mixed of accepting callable.
------ ----------------------------------------------------------------------------
src/services/content-api/endpoints/class-endpoint-analytics-posts.php
Outdated
Show resolved
Hide resolved
acicovic
left a comment
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.
Looks good to me!
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (4)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
* Add new Rest API base classes * Implement the Content Helper API namespace * Add tests for the new REST API classes * Update UI providers to use the new API endpoints * Remove unused code and initializations * Fix sonarcloud issues * Refactor to avoid consts and use getters instead * Fix minor docblock issues per code review * Apply code review suggestions by @acicovic * Rename API parameter `content` to `text` * Add `stats` endpoint * Update the UI to use the new API endpoints * Delete the old endpoints * Add tests * Apply code review suggestions by @acicovic * Add `stats` endpoint * Update the UI to use the new API endpoints * Delete the old endpoints * Add tests * Fix E2E test * Add `settings` endpoints * Update UI to use the new settings API * Add tests * Remove old code * Improve comments and whitespace * class-base-endpoint.php: Fix incorrect whitespace * Endpoints/class-base-endpoint.php: Fix incorrect whitespace * Improve comments and whitespace * Improve comments and whitespace * REST API Refactor: Apply fixes/suggestions from the other PRs (#2812) * Apply suggestions from #2731 * Apply suggestions from #2735 * Add dynamic settings endpoint calls * PCH Refactor: Refactor the external services (#2873) * Implement the new Content API service, and remove old RemoteAPI code * Implement caching mechanism for service endpoints * Implement the Suggestions API service * Address PHPCS & PHPStan errors and warnings * Fix post-merge issues and namespaces * Add condition when validate api credentials returns false. * Address code review feedback * Adjust some DocBlocks and whitespace * Make the services base URL static, and remove the old consts * Fix PHPStan (not including tests) * Fix misplaced `@since` tag --------- Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com> * PCH Refactor: Update integration tests (#2885) * Implement and update integration tests * Adjust some DocBlocks and whitespace * Adjust some DocBlocks and whitespace * Fix tests * Fix leaking tests * Apply code review suggestions * Remove backticks from function summary * Improve code formatting consistency between 2 tests --------- Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com> * Rebuild assets --------- Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
Description
This PR refactors the external services implementation, that are currently two: Parse.ly Content API and Parse.ly Suggestions API.
This PR includes all the new classes, and removes the old classes from the
RemoteAPIdirectory. However, the tests are still not implemented, nor the old tests have been removed. Therefore, there are still failing tests and PHPStan warnings flagging issues within the old tests.Motivation and context
How has this been tested?
Since integration tests weren't yet implemented, I only relied on manual testing on my environment. From those tests, everything seems to be working as expected.