Skip to content

Conversation

@jordanpartridge
Copy link
Contributor

Summary

Implements a comprehensive query builder for GitHub issues with a fluent, chainable API. This closes #20.

Features

State Filtering

  • whereOpen() - Filter for open issues
  • whereClosed() - Filter for closed issues
  • whereState(string $state) - Filter by custom state

Label Filtering

  • whereLabel(string $label) - Filter by single label
  • whereLabels(array $labels) - Filter by multiple labels

Assignee Filtering

  • assignedTo(string $username) - Filter by assignee
  • whereUnassigned() - Filter for unassigned issues

Author Filtering

  • createdBy(string $username) - Filter by issue creator
  • mentioning(string $username) - Filter by mentioned user

Time-Based Filtering

  • createdAfter(string|DateTime $date) - Filter by creation date
  • updatedBefore(string|DateTime $date) - Filter by update date
  • older(int $days) - Convenience method for stale issues

Sorting

  • orderBy(string $field, string $direction) - Sort by any field
  • orderByCreated(string $direction = 'desc') - Sort by creation date
  • orderByUpdated(string $direction = 'desc') - Sort by update date

Pagination

  • perPage(int $perPage) - Set results per page
  • page(int $page) - Set page number

Terminal Methods

  • get(): Collection - Execute and get all results
  • first(): ?Issue - Get first result
  • count(): int - Count results
  • exists(): bool - Check if any results exist

Usage Example

use ConduitUI\Issue\Services\IssueQuery;

$issues = new IssueQuery($connector, 'owner', 'repo');

// Chain multiple filters
$issues
    ->whereOpen()
    ->whereLabels(['bug', 'urgent'])
    ->assignedTo('johndoe')
    ->older(30)
    ->orderByCreated()
    ->perPage(50)
    ->get();

Test Coverage

  • 25 comprehensive test cases covering all methods
  • 100% code coverage for IssueQuery class
  • All quality gates passing (Pint, PHPStan)
  • 391 total tests passing

Architecture Notes

  • Fluent interface - all filter methods return $this
  • Maps to GitHub REST API parameters
  • Client-side filtering for updatedBefore (not supported by GitHub API)
  • Full type safety with PHPDoc annotations

Implements a fluent query builder for filtering and retrieving GitHub issues with chainable methods for state, labels, assignees, authors, time-based filtering, sorting, and pagination.

Features:
- State filtering (whereOpen, whereClosed, whereState)
- Label filtering (whereLabel, whereLabels)
- Assignee filtering (assignedTo, whereUnassigned)
- Author filtering (createdBy, mentioning)
- Time-based filtering (createdAfter, updatedBefore, older)
- Sorting (orderBy, orderByCreated, orderByUpdated)
- Pagination (perPage, page)
- Terminal methods (get, first, count, exists)

All methods are fully tested with 100% code coverage and pass PHPStan analysis.

Closes #20
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Warning

Rate limit exceeded

@jordanpartridge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 7 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e989aa8 and cf8766f.

📒 Files selected for processing (5)
  • src/Services/IssueQuery.php (1 hunks)
  • tests/Helpers.php (1 hunks)
  • tests/Pest.php (1 hunks)
  • tests/Unit/Services/IssueQueryTest.php (1 hunks)
  • tests/Unit/Traits/ManagesIssuesTest.php (0 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/issue-query

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot merged commit 8606f72 into master Dec 19, 2025
2 checks passed
@github-actions github-actions bot deleted the feat/issue-query branch December 19, 2025 05:24
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.

Implement Core IssueQuery Builder with Fluent Filtering API

2 participants