Repository navigation
feat: add Import-PiHoleTeleporter, completing API coverage - #138
Merged
Merged
Conversation
Adds Import-PiHoleTeleporter (POST /teleporter), the last remaining functional gap in the Pi-hole v6 API. Restores a Teleporter archive (as produced by Get-PiHoleTeleporterDownload), with flat switch parameters (-Config, -DhcpLeases, -Group, -Adlist, -AdlistByGroup, -Domainlist, -DomainlistByGroup, -Client, -ClientByGroup) selecting which items to restore instead of Pi-hole's own nested request shape. Omitting every switch imports everything, matching the API's own default. This overwrites the current configuration, so unlike every other function in the module it prompts for confirmation by default (ConfirmImpact = 'High') rather than only when -Confirm is passed explicitly - pass -Confirm:$false to skip the prompt, or -WhatIf for a dry run. Confirmed two things by hand against a real server that don't match the OpenAPI spec or weren't otherwise obvious: - The response's processed-items array is actually returned under "files", not "processed" as the spec documents. - Pi-hole reloads internally right after any import, briefly refusing connections - the integration tests and the docs example script both settle afterward to avoid a flaky next call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
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
Import-PiHoleTeleporter(POST /teleporter) - the last remaining functional gap in the Pi-hole v6 API, aside from two low-value API self-discovery endpoints (GET /endpoints,GET /docs) already agreed to be out of scopeGet-PiHoleTeleporterDownload) with flat switch parameters (-Config,-DhcpLeases,-Group,-Adlist,-AdlistByGroup,-Domainlist,-DomainlistByGroup,-Client,-ClientByGroup) choosing what to restore, instead of mirroring Pi-hole's own nested request shape. Omitting every switch imports everything, matching the API's own defaultConfirmImpact = 'High') rather than only when-Confirmis passed explicitly - pass-Confirm:$falseto skip the prompt, or-WhatIffor a true dry run (no request is ever sent)Two things confirmed by hand against a real server that don't match the docs
files, notprocessedas the OpenAPI spec documents - the function reads the real fieldTest plan
-WhatIfperforms no request, nonexistent file errors, non-ZIP file content errors (real 400 from the API), bad password errors-WhatIfsends zero requests and a non-interactive call without-Confirm:$falsecorrectly refuses to proceed rather than silently running🤖 Generated with Claude Code