Skip to content

[4.x] Add the search API methods and deprecate the legacy search methods - #97

Open
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-search-api
Open

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-search-api

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

Package\Search only wrapped the legacy search API (/legacy/issues/search/…, /legacy/repos/search/…, /legacy/user/search/…, /legacy/user/email/…), which GitHub has removed, so every call fails. There were no wrappers for the current search endpoints.

  • New methods for the search API: getCode(), getCommits(), getIssues() (issues and pull requests), getLabels(), getRepositories(), getTopics() and getUsers(), each taking the search query in GitHub's syntax plus sort/order and paging where the endpoint supports them. The query string is built with http_build_query(…, PHP_QUERY_RFC3986), because Joomla\Uri\Uri does not encode the query values it renders; this works with any version of joomla/uri.
  • issues(), repositories(), users() and email() are deprecated with a runtime deprecation (removal in 5.0; adds symfony/deprecation-contracts ^2|^3), pointing to the new methods. email() has no replacement.
  • issues() checked $state against ['open', 'close'] while its exception asked for "open" or "closed"; it now accepts closed.

Method names: get…() was chosen because issues(), repositories() and users() are taken by the legacy methods until 5.0. If you prefer other names (e.g. issuesAndPullRequests()), say so before merging.

Testing Instructions

SearchTest::testSearchMethods (data provider, one case per endpoint) asserts the request URL including the encoded query; testIssuesClosed covers the state fix; the legacy tests expect the deprecation. They fail before the change.

Documentation Changes Required

docs/overview.md: new "Search" section. #66's packages.md "Search" section lists only the legacy methods and says code and commit search are not implemented; it needs updating when the second of the two is merged. The 5.x removal of the legacy methods follows with the other 5.0 removals.

🤖 Generated with Claude Code

Search only wrapped the legacy search API (/legacy/...), which GitHub
has removed, so every method failed. Add getCode(), getCommits(),
getIssues(), getLabels(), getRepositories(), getTopics() and getUsers()
for the /search/* endpoints, with the query encoded according to
RFC 3986. Deprecate the legacy methods, and let issues() accept the
"closed" state its error message asks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant