Skip to content

feat: add Get-PiHoleQuery, completing the Queries API area - #128

Merged
mikemadeja merged 1 commit into
developfrom
feature/query-log
Sep 29, 2026
Merged

mikemadeja merged 1 commit into
developfrom
feature/query-log

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

  • Adds Get-PiHoleQuery (GET /queries), the raw query log endpoint - distinct from Get-PiHoleStatsQuerySuggestions (/queries/suggestions), which already existed.
  • Supports all of the API's filter parameters: -From/-Until (time range), -Length/-Start/-Cursor (pagination), -Domain/-ClientIp/-ClientName/-Upstream/-Type/-Status/-Reply/-Dnssec (filtering, wildcards supported by the API), and -Disk (on-disk long-term DB vs in-memory).
  • Placed in Public/Metrics/ to match the API's own "Metrics" tag, same as the existing suggestions function - checked that file first to confirm the folder/naming convention before writing this one.

This completes the "Queries" area from the API coverage audit (1 of 1 operation implemented).

Test plan

  • Verified against the real server using the Initialize-PiHoleTestData.ps1 seeding convention already used by every other live-query-dependent test in this suite (found by checking Get-PiHoleStatsQuerySuggestions' test file for the established pattern first, per user request to confirm consistency before shipping).
  • Confirms full field mapping (nested Client/Reply/Ede objects) and domain filtering work correctly against real seeded query data, not just empty-result assertions.
  • Invoke-ScriptAnalyzer clean against the full module.
  • Full non-integration Pester unit suite passes (4/4; unaffected by this change).

🤖 Generated with Claude Code

Adds Get-PiHoleQuery (GET /queries), the raw query log endpoint -
distinct from Get-PiHoleStatsQuerySuggestions (/queries/suggestions),
which already existed. Supports all of the API's filter parameters
(from/until, length/start/cursor for pagination, domain, client IP/
name, upstream, type, status, reply, dnssec, and on-disk vs in-memory).
Placed in Public/Metrics/ to match the API's own "Metrics" tag, same
as the existing suggestions function.

Verified against the real server using the same Initialize-PiHoleTestData.ps1
seeding convention already used by every other live-query-dependent
test in this suite (found by checking Get-PiHoleStatsQuerySuggestions'
test file for the established pattern before writing this one) -
confirms full field mapping (nested Client/Reply/Ede objects) and
domain filtering work correctly with real query data, not just empty
results.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mikemadeja
mikemadeja merged commit d7824b3 into develop Sep 29, 2026
3 checks passed
@mikemadeja mikemadeja mentioned this pull request Sep 29, 2026
1 task done
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