Public/Get-DokuPageList.ps1
function Get-DokuPageList { <# .SYNOPSIS Gets an array of all pages from an instance of DokuWiki. .DESCRIPTION Gets an array of all pages from an instance of DokuWiki. .EXAMPLE PS C:\> $AllPages = Get-DokuPageList .OUTPUTS System.Management.Automation.PSObject[] .NOTES AndyDLP - 2018-05-26 #> [CmdletBinding()] [OutputType([psobject[]])] param () begin { } # begin process { $APIResponse = Invoke-DokuApiCall -MethodName 'dokuwiki.getPagelist' -MethodParameters @() if ($APIResponse.CompletedSuccessfully -eq $true) { $MemberNodes = ($APIResponse.XMLPayloadResponse | Select-Xml -XPath "//struct").Node foreach ($node in $MemberNodes) { $PageObject = New-Object PSObject -Property @{ FullName = (($node.member)[0]).value.string Revision = (($node.member)[1]).value.int LastModified = (($node.member)[2]).value.int Size = (($node.member)[3]).value.int PageName = (((($node.member)[0]).value.string) -split ":")[-1] ParentNamespace = (((($node.member)[0]).value.string) -split ":")[-2] RootNamespace = (((($node.member)[0]).value.string) -split ":")[0] } [array]$AllDokuwikiPages = $AllDokuwikiPages + $PageObject } $AllDokuwikiPages } elseif ($null -eq $APIResponse.ExceptionMessage) { Write-Error "Fault code: $($APIResponse.FaultCode) - Fault string: $($APIResponse.FaultString)" } else { Write-Error "Exception: $($APIResponse.ExceptionMessage)" } } # process end { } # end } |