feat: add Get-PiHoleQuery, completing the Queries API area - #128
Merged
Merged
Conversation
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]>
1 task done
This file contains hidden or 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
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.
Summary
Get-PiHoleQuery(GET /queries), the raw query log endpoint - distinct fromGet-PiHoleStatsQuerySuggestions(/queries/suggestions), which already existed.-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).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
Initialize-PiHoleTestData.ps1seeding convention already used by every other live-query-dependent test in this suite (found by checkingGet-PiHoleStatsQuerySuggestions' test file for the established pattern first, per user request to confirm consistency before shipping).Client/Reply/Edeobjects) and domain filtering work correctly against real seeded query data, not just empty-result assertions.Invoke-ScriptAnalyzerclean against the full module.🤖 Generated with Claude Code