Fix PowerShell rendering, changelog

This commit is contained in:
Philipp Heckel 2022-06-27 12:21:11 -04:00
parent 50a830c360
commit f134bc6dcd
2 changed files with 30 additions and 24 deletions

View file

@ -885,7 +885,7 @@ is the only required one:
``` powershell ``` powershell
$uri = "https://ntfy.sh" $uri = "https://ntfy.sh"
$body = @{ $body = @{
topic = "powershell" topic = "mytopic"
title = "Low disk space alert" title = "Low disk space alert"
message = "Disk space is low at 5.1 GB" message = "Disk space is low at 5.1 GB"
priority = 4 priority = 4
@ -1731,6 +1731,9 @@ And the same example using [JSON publishing](#publish-as-json):
=== "PowerShell" === "PowerShell"
``` powershell ``` powershell
# Powershell requires the 'Depth' argument to equal 3 here to expand 'Extras',
# otherwise it will read System.Collections.Hashtable in the returned JSON
$uri = "https://ntfy.sh" $uri = "https://ntfy.sh"
$body = @{ $body = @{
topic = "wifey" topic = "wifey"
@ -1745,9 +1748,6 @@ And the same example using [JSON publishing](#publish-as-json):
} }
} }
) )
# Powershell requires the 'Depth' argument to equal 3 here to expand 'Extras', otherwise it will read System.Collections.Hashtable in the returned json
} | ConvertTo-Json -Depth 3 } | ConvertTo-Json -Depth 3
Invoke-RestMethod -Method 'Post' -Uri $uri -Body $body -ContentType "application/json" -UseBasicParsing Invoke-RestMethod -Method 'Post' -Uri $uri -Body $body -ContentType "application/json" -UseBasicParsing
``` ```
@ -2002,6 +2002,9 @@ And the same example using [JSON publishing](#publish-as-json):
=== "PowerShell" === "PowerShell"
``` powershell ``` powershell
# Powershell requires the 'Depth' argument to equal 3 here to expand 'headers',
# otherwise it will read System.Collections.Hashtable in the returned JSON
$uri = "https://ntfy.sh" $uri = "https://ntfy.sh"
$body = @{ $body = @{
topic = "myhome" topic = "myhome"
@ -2018,7 +2021,6 @@ And the same example using [JSON publishing](#publish-as-json):
body = '{"action": "close"}' body = '{"action": "close"}'
} }
) )
# Powershell requires the 'Depth' argument to equal 3 here to expand 'headers', otherwise it will read System.Collections.Hashtable in the returned json
} | ConvertTo-Json -Depth 3 } | ConvertTo-Json -Depth 3
Invoke-RestMethod -Method 'Post' -Uri $uri -Body $body -ContentType "application/json" -UseBasicParsing Invoke-RestMethod -Method 'Post' -Uri $uri -Body $body -ContentType "application/json" -UseBasicParsing
``` ```

View file

@ -32,6 +32,10 @@ Thank you to [@wunter8](https://github.com/wunter8) for proactively picking up s
* `ntfy user` commands don't work with `auth_file` but works with `auth-file` ([#344](https://github.com/binwiederhier/ntfy/issues/344), thanks to [@Histalek](https://github.com/Histalek) for reporting) * `ntfy user` commands don't work with `auth_file` but works with `auth-file` ([#344](https://github.com/binwiederhier/ntfy/issues/344), thanks to [@Histalek](https://github.com/Histalek) for reporting)
**Documentation:**
* Fix some PowerShell publish docs ([#345](https://github.com/binwiederhier/ntfy/pull/345), thanks to [@noahpeltier](https://github.com/noahpeltier))
--> -->
## ntfy server v1.27.2 ## ntfy server v1.27.2