Skip to content

feat: complete the Info API area (10 new functions) - #112

Merged
mikemadeja merged 1 commit into
developfrom
feature/pihole-info-functions
Sep 25, 2026
Merged

mikemadeja merged 1 commit into
developfrom
feature/pihole-info-functions

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

Implements the remaining "FTL information" endpoints, closing 10 of the original 54 missing API operations - the largest single-category gap after this PR is Domains (8) and Clients (7).

  • Get-PiHoleInfoClient (/info/client) - info about the requesting client
  • Get-PiHoleInfoLogin (/info/login) - login page info
  • Get-PiHoleInfoSystem (/info/system) - uptime, memory, CPU
  • Get-PiHoleInfoFtl (/info/ftl) - gravity/group/list counts, dnsmasq metrics
  • Get-PiHoleInfoSensors (/info/sensors) - temperature sensors
  • Get-PiHoleInfoDatabase (/info/database) - long-term DB file/query stats
  • Get-PiHoleInfoVersion (/info/version) - Core/Web/FTL/Docker versions
  • Get-PiHoleInfoMetrics (/info/metrics) - live DNS/DHCP metrics
  • Get-PiHoleInfoMessageCount (/info/messages/count)
  • Remove-PiHoleInfoMessage (/info/messages/{id}) - supports comma-separated multiple IDs per the API

Design note: Get-PiHoleInfoClient and Get-PiHoleInfoLogin intentionally have no -Password parameter and never call Request-PiHoleAuth. The live API spec marks both with security: [], and this was confirmed against the real server (both work with zero auth headers) - makes sense given their purpose, since login-page info has to be available before you're logged in.

Also fixed while in the area: Get-PiHoleInfoDatabase's earliest_timestamp/earliest_timestamp_disk return $null (not epoch 1970) when the API sends 0, since the spec documents 0.0 as "no queries stored yet" - same zero-guard pattern already used for Get-PiHoleList's DateUpdated. And Get-PiHoleInfoMessage had the same stray break bug fixed elsewhere in the module, plus was missing a real .DESCRIPTION/.EXAMPLE.

Test plan

  • Invoke-ScriptAnalyzer -Path .\PiHoleShell -Recurse - clean
  • Verified all 10 new functions against a real Pi-hole v6 server: formatted output, -RawOutput, and (where applicable) bad-password/not-found error handling
  • New integration test files for all 10 functions - 33 tests total across the FTLInformation folder, all passing
  • Full non-integration suite passes with no regressions (143 tests)
  • Regenerated README.md

🤖 Generated with Claude Code

Implements the remaining "FTL information" endpoints, closing 10 of the
original 54 missing API operations:

- Get-PiHoleInfoClient (/info/client) - info about the requesting client
- Get-PiHoleInfoLogin (/info/login) - login page info
- Get-PiHoleInfoSystem (/info/system) - uptime, memory, CPU
- Get-PiHoleInfoFtl (/info/ftl) - gravity/group/list counts, dnsmasq metrics
- Get-PiHoleInfoSensors (/info/sensors) - temperature sensors
- Get-PiHoleInfoDatabase (/info/database) - long-term DB file/query stats
- Get-PiHoleInfoVersion (/info/version) - Core/Web/FTL/Docker versions
- Get-PiHoleInfoMetrics (/info/metrics) - live DNS/DHCP metrics
- Get-PiHoleInfoMessageCount (/info/messages/count)
- Remove-PiHoleInfoMessage (/info/messages/{id}) - supports comma-separated
  multiple IDs per the API

Get-PiHoleInfoClient and Get-PiHoleInfoLogin intentionally have no
-Password parameter and never call Request-PiHoleAuth: the live API spec
marks both with `security: []`, and this was confirmed against the real
server (both work with zero auth headers). This makes sense given their
purpose - info needed to render the login page has to be available before
you're logged in.

Get-PiHoleInfoDatabase's earliest_timestamp/earliest_timestamp_disk are
returned as $null (not epoch 1970) when the API sends 0, since the spec
documents 0.0 as meaning "no queries stored yet" - the same zero-guard
pattern already used for Get-PiHoleList's DateUpdated.

Also fixed Get-PiHoleInfoMessage while in the area: it had the same stray
break in its catch block fixed elsewhere in the module (silently aborts
the calling script on error), and was missing a real .DESCRIPTION/.EXAMPLE.

Verified all 10 new functions against a real Pi-hole v6 server: formatted
output, RawOutput, and (where applicable) bad-password/not-found error
handling. Added dedicated integration test files (33 tests total across
the FTLInformation folder). README regenerated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mikemadeja
mikemadeja merged commit b477900 into develop Sep 25, 2026
3 checks passed
@mikemadeja mikemadeja mentioned this pull request Sep 25, 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