-
Notifications
You must be signed in to change notification settings - Fork 3
/
Export-BsPage.ps1
45 lines (34 loc) · 1.14 KB
/
Export-BsPage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Function Export-BsPage {
<#
.SYNOPSIS
Export a page to the console
.DESCRIPTION
Export a page to the console, best used with 'Out-File' command to save in the required format
.PARAMETER Id
The identifier of the page
.PARAMETER Format
The format to export as. One of html, pdf, plaintext, markdown
.EXAMPLE
Export-BsPage -Id 1 -Format pdf | Out-File -FilePath ...
.EXAMPLE
Export-BsPage -Id 13 -Format html | Out-File -FilePath ...
.FUNCTIONALITY
GET: pages/{id}/export/html
GET: pages/{id}/export/pdf
GET: pages/{id}/export/plaintext
GET: pages/{id}/export/markdown
.NOTES
For additional information please see my GitHub wiki page
.LINK
https://github.com/My-Random-Thoughts/psPageStack
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[int]$Id,
[Parameter(Mandatory = $true)]
[ValidateSet('html', 'pdf', 'plaintext', 'markdown')]
[string]$Format
)
Write-Output (Invoke-PageStackQuery -UrlFunction "pages/$id/export/$($Format.ToLower())" -RestMethod Get)
}