en-US/PSRAW-help.xml
<?xml version="1.0" encoding="utf-8"?>
<helpItems xmlns="http://msh" schema="maml"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Export-RedditApplication</command:name> <command:verb>Export</command:verb> <command:noun>RedditApplication</command:noun> <maml:description><maml:para>Exports a `RedditApplication` object to an XML file. </maml:para> </maml:description> </command:details> <maml:description><maml:para>Allows you to export a `RedditApplication` object to an XML file so that you can later import the object via `Import-RedditApplication`. This allows you to share the same Reddit application between multiple scripts. This function is a wrapper for `Export-Clixml`. </maml:para> <maml:para>User Passwords and Client Secrets stored in the `RedditApplication` object are stored as secure strings and are not visible as plaintext in the export file. This also means that a `RedditApplication` object exported by one user cannot be imported by another user on the same computer nor can it be imported by the same user on a different computer. It can only be imported by the same user on the same computer. </maml:para> <maml:para>The maximum depth will be set on `Export-Clixml`. </maml:para> <maml:para>New `RedditApplication` objects can be created manually or with `New-RedditApplication`. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Export-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="App, RedditApplication"><maml:name>Application</maml:name> <maml:Description><maml:para>The `RedditApplication` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditApplication` object will be stored. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Export-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="App, RedditApplication"><maml:name>Application</maml:name> <maml:Description><maml:para>The `RedditApplication` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditApplication` object will be stored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="App, RedditApplication"><maml:name>Application</maml:name> <maml:Description><maml:para>The `RedditApplication` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditApplication` object will be stored. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditApplication` object will be stored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>RedditApplication</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$Application.ExportPath = 'c:\PSRAW\RedditApplication.xml' $Application | Export-RedditApplication</dev:code> <dev:remarks><maml:para>This example uses the `ExportPath` property on the `RedditApplication` object to determine where to export the application. When a `RedditApplication` object is imported with `Import-RedditApplication`, the `ExportPath` of the object will be set with the path to the file it was imported from. This makes it easy to import, make changes, and then re-export the application. The `ExportPath` property is treated as a `LiteralPath`. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>$Application | Export-RedditApplication -Path 'c:\PSRAW\RedditApplication.xml'</dev:code> <dev:remarks><maml:para>This example uses the `Path` parameter to either override the `ExportPath` property on the `RedditApplication` object or to set export location when an `ExportPath` is not present. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>$Application | Export-RedditApplication -LiteralPath 'c:\PSRAW\RedditApplication[1].xml'</dev:code> <dev:remarks><maml:para>This example uses the `LiteralPath` parameter to either override the `ExportPath` property on the `RedditApplication` object or to set export location with an `ExportPath` is not present. `LiteralPath` does not translate the special characters and instead translates them literally. </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Export-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Export-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Import-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Import-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>New-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/New-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Export-Clixml</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113297</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Export-RedditOAuthToken</command:name> <command:verb>Export</command:verb> <command:noun>RedditOAuthToken</command:noun> <maml:description><maml:para>Exports a `RedditOAuthToken` object to an XML file. </maml:para> </maml:description> </command:details> <maml:description><maml:para>Allows you to export a `RedditOAuthToken` object to an XML file so that you can later import the object via `Import-RedditOAuthToken`. This allows you to share the same Reddit application between multiple scripts. This function is a wrapper for `Export-Clixml`. </maml:para> <maml:para>User Password, Client Secret, Access Token, and Refresh Token stored in the `RedditOAuthToken` object are stored as secure strings and are not visible as plaintext in the export file. This also means that a `RedditOAuthToken` object exported by one user cannot be imported by another user on the same computer nor can it be imported by the same user on a different computer. It can only be imported by the same user on the same computer. </maml:para> <maml:para>The maximum depth will be set on `Export-Clixml`. </maml:para> <maml:para>New `RedditOAuthToken` objects can be created manually or with `Request-RedditOAuthToken`. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Export-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="Token"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken</command:parameterValue> <dev:type><maml:name>RedditOAuthToken</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>Unicode</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditOAuthToken` object will be stored. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Export-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="Token"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken</command:parameterValue> <dev:type><maml:name>RedditOAuthToken</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>Unicode</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditOAuthToken` object will be stored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="Token"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` object to be exported. This will be sent as the `InputObject` parameter to `Export-Clixml`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken</command:parameterValue> <dev:type><maml:name>RedditOAuthToken</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Encoding</maml:name> <maml:Description><maml:para>Specifies the type of encoding for the target file. The acceptable values for this parameter are: - ASCII </maml:para> <maml:para>- UTF8 </maml:para> <maml:para>- UTF7 </maml:para> <maml:para>- UTF32 </maml:para> <maml:para>- Unicode </maml:para> <maml:para>- BigEndianUnicode </maml:para> <maml:para>- Default </maml:para> <maml:para>- OEM </maml:para> <maml:para> </maml:para> <maml:para>The default value is `Unicode`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>Unicode</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditOAuthToken` object will be stored. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the path to the file where the XML representation of the `RedditOAuthToken` object will be stored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>RedditOAuthToken</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$Token.ExportPath = 'c:\PSRAW\RedditOAuthToken.xml' $Token | Export-RedditOAuthToken</dev:code> <dev:remarks><maml:para>This example uses the `ExportPath` property on the `RedditOAuthToken` object to determine where to export the application. When a `RedditOAuthToken` object is imported with `Import-RedditOAuthToken`, the `ExportPath` of the object will be set with the path to the file it was imported from. This makes it easy to import, make changes, and then re-export the application. The `ExportPath` property is treated as a `LiteralPath`. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>$Token | Export-RedditOAuthToken -Path 'c:\PSRAW\RedditOAuthToken.xml'</dev:code> <dev:remarks><maml:para>This example uses the `Path` parameter to either override the `ExportPath` property on the `RedditOAuthToken` object or to set export location when an `ExportPath` is not present. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>$Token | Export-RedditOAuthToken -LiteralPath 'c:\PSRAW\RedditOAuthToken[1].xml'</dev:code> <dev:remarks><maml:para>This example uses the `LiteralPath` parameter to either override the `ExportPath` property on the `RedditOAuthToken` object or to set export location with an `ExportPath` is not present. `LiteralPath` does not translate the special characters and instead translates them literally. </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Export-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Export-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Import-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Import-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Request-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Export-Clixml</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113297</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Get-RedditOAuthScope</command:name> <command:verb>Get</command:verb> <command:noun>RedditOAuthScope</command:noun> <maml:description><maml:para>Retrieve valid Reddit OAuth Scopes. </maml:para> </maml:description> </command:details> <maml:description><maml:para>Retrieve valid OAuth scope IDs, Names, and Descriptions from Reddit. The Scope ID's are required for requesting OAuth Authorization codes </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Get-RedditOAuthScope</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"><maml:name>ApiEndpointUri</maml:name> <maml:Description><maml:para>Optional. URL for the Reddit App Scope definitions. Default: </maml:para> <maml:para>https://www.reddit.com/api/v1/scopes </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[RedditOAuthScope]::GetApiEndpointUri()</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"><maml:name>ApiEndpointUri</maml:name> <maml:Description><maml:para>Optional. URL for the Reddit App Scope definitions. Default: </maml:para> <maml:para>https://www.reddit.com/api/v1/scopes </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[RedditOAuthScope]::GetApiEndpointUri()</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes></command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditOAuthScope</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$RedditOAuthScopes = Get-RedditOAuthScope</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>Get-RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/API</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/API</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/OAuth2</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/OAuth2</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/prefs/apps</maml:linkText> <maml:uri>https://www.reddit.com/prefs/apps</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/wiki/api</maml:linkText> <maml:uri>https://www.reddit.com/wiki/api</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Import-RedditApplication</command:name> <command:verb>Import</command:verb> <command:noun>RedditApplication</command:noun> <maml:description><maml:para>Imports a `RedditApplication` object from an XML file. </maml:para> </maml:description> </command:details> <maml:description><maml:para>Allows you to import a `RedditApplication` object from an XML file that was previously exported via `Export-RedditApplication`. This allows you to share the same Reddit application between multiple scripts. This function is a wrapper for `Import-Clixml`. </maml:para> <maml:para>User Passwords and Client Secrets stored in the `RedditApplication` object are stored as secure strings and are not visible as plaintext in the export file. This also means that a `RedditApplication` object exported by one user cannot be imported by another user on the same computer nor can it be imported by the same user on a different computer. It can only be imported by the same user on the same computer. </maml:para> <maml:para>The maximum depth will be set on `Export-Clixml`. </maml:para> <maml:para>New `RedditApplication` objects can be created manually or with `New-RedditApplication`. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Import-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the XML files. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Import-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the XML files. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the XML files. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the XML files. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>System.String[]</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditApplication</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$Application = Import-RedditApplication -Path 'c:\PSRAW\RedditApplication.xml'</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>$Application = Import-RedditApplication -LiteralPath 'c:\PSRAW\RedditApplication[1].xml'</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Import-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Import-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Export-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Export-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>New-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/New-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Import-Clixml</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113340</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Import-RedditOAuthToken</command:name> <command:verb>Import</command:verb> <command:noun>RedditOAuthToken</command:noun> <maml:description><maml:para>Imports a `RedditOAuthToken` object from an XML file. </maml:para> </maml:description> </command:details> <maml:description><maml:para>Allows you to import a `RedditOAuthToken` object from an XML file that was previously exported via `Export-RedditOAuthToken`. This allows you to share the same Reddit application between multiple scripts. This function is a wrapper for `Import-Clixml`. </maml:para> <maml:para>User Password, Client Secret, Access Token, and Refresh Token stored in the `RedditOAuthToken` object are stored as secure strings and are not visible as plaintext in the export file. This also means that a `RedditOAuthToken` object exported by one user cannot be imported by another user on the same computer nor can it be imported by the same user on a different computer. It can only be imported by the same user on the same computer. </maml:para> <maml:para>The maximum depth will be set on `Export-Clixml`. </maml:para> <maml:para>New `RedditOAuthToken` objects can be created manually or with `Request-RedditOAuthToken`. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Import-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the XML files. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Import-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the XML files. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>LiteralPath</maml:name> <maml:Description><maml:para>Specifies the XML files. Unlike `Path`, the value of the `LiteralPath` parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"><maml:name>Path</maml:name> <maml:Description><maml:para>Specifies the XML files. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type><maml:name>String[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>System.String[]</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditOAuthToken</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$Token = Import-RedditOAuthToken -Path 'c:\PSRAW\RedditOAuthToken.xml'</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>$Token = Import-RedditOAuthToken -LiteralPath 'c:\PSRAW\RedditOAuthToken[1].xml'</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Import-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Import-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Export-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Export-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Request-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Import-Clixml</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113340</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Invoke-RedditRequest</command:name> <command:verb>Invoke</command:verb> <command:noun>RedditRequest</command:noun> <maml:description><maml:para>Performs an authenticated APi request against the Reddit API. </maml:para> </maml:description> </command:details> <maml:description><maml:para>`Invoke-RedditRequest` is the core function of this module. All API requests made to Reddit are done so by calls to `Invoke-RedditRequest`. It can also be used directly in order to obtain raw API responses or to access API functionality that has not yet been provided by this module's wrapper functions. </maml:para> <maml:para>`Invoke-RedditRequest` Requires a `RedditOAuthToken` in order to perform the authenticated API request. To create `RedditOAuthToken` see the help info for `Request-RedditOAuthToken`. </maml:para> <maml:para>`Invoke-RedditRequest` is essentially a wrapper for `Invoke-WebRequest` to ease the burden of authentication, Rate Limit monitoring, and Access Token renewal. </maml:para> <maml:para>`Invoke-RedditRequest` returns a `RedditApiResponse` which contains the `RedditOAuthToken`, The response from the API, and a converted Content Object. The `RedditApiResponse` can then be used to create other module objects or consumed directly. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Invoke-RedditRequest</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="0" aliases="none"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` created by `Request-RedditOAuthToken` used to make OAuth authenticated calls to Reddit's API and track API Rate Limiting. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken</command:parameterValue> <dev:type><maml:name>RedditOAuthToken</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"><maml:name>Uri</maml:name> <maml:Description><maml:para>Specifies the Uniform Resource Identifier (URI) of the Internet resource to which the web request is sent. This is the reddit API endpoint against which to make the authenticated API request. </maml:para> <maml:para>This parameter is required. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>Method</maml:name> <maml:Description><maml:para>Specifies the method used for the web request. Valid values are `Default`, `Delete`, `Get`, `Head`, `Merge`, `Options`, `Patch`, `Post`, `Put`, and `Trace`. </maml:para> </maml:Description> <command:parameterValueGroup><command:parameterValue required="false" variableLength="false">Default</command:parameterValue> <command:parameterValue required="false" variableLength="false">Get</command:parameterValue> <command:parameterValue required="false" variableLength="false">Head</command:parameterValue> <command:parameterValue required="false" variableLength="false">Post</command:parameterValue> <command:parameterValue required="false" variableLength="false">Put</command:parameterValue> <command:parameterValue required="false" variableLength="false">Delete</command:parameterValue> <command:parameterValue required="false" variableLength="false">Trace</command:parameterValue> <command:parameterValue required="false" variableLength="false">Options</command:parameterValue> <command:parameterValue required="false" variableLength="false">Merge</command:parameterValue> <command:parameterValue required="false" variableLength="false">Patch</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">WebRequestMethod</command:parameterValue> <dev:type><maml:name>WebRequestMethod</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="3" aliases="none"><maml:name>Body</maml:name> <maml:Description><maml:para>Specifies the body of the API request. The body is the content of the request that follows the headers. </maml:para> <maml:para>The Body parameter can be used to specify a list of query parameters or specify the content of the response. </maml:para> <maml:para>When the input is a `GET` request and the body is an `IDictionary` (typically, a hash table), the body is added to the URI as query parameters. For other `GET` requests, the body is set as the value of the request body in the standard `name=value` format. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type><maml:name>Object</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="4" aliases="none"><maml:name>Headers</maml:name> <maml:Description><maml:para>Specifies the headers of the web request. Enter a hash table or dictionary. </maml:para> <maml:para>`UserAgent` and `Authorization` will be overwritten. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">IDictionary</command:parameterValue> <dev:type><maml:name>IDictionary</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="5" aliases="none"><maml:name>TimeoutSec</maml:name> <maml:Description><maml:para>Specifies how long the request can be pending before it times out. Enter a value in seconds. The default value, 0, specifies an indefinite time-out. </maml:para> <maml:para>A Domain Name System (DNS) query can take up to 15 seconds to return or time out. If your request contains a host name that requires resolution, and you set TimeoutSec to a value greater than zero, but less than 15 seconds, it can take 15 seconds or more before a WebException is thrown, and your request times out. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type><maml:name>Int32</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="6" aliases="none"><maml:name>ContentType</maml:name> <maml:Description><maml:para>Specifies the content type of the web request. The default is `application/json`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="0" aliases="none"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` created by `Request-RedditOAuthToken` used to make OAuth authenticated calls to Reddit's API and track API Rate Limiting. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken</command:parameterValue> <dev:type><maml:name>RedditOAuthToken</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="3" aliases="none"><maml:name>Body</maml:name> <maml:Description><maml:para>Specifies the body of the API request. The body is the content of the request that follows the headers. </maml:para> <maml:para>The Body parameter can be used to specify a list of query parameters or specify the content of the response. </maml:para> <maml:para>When the input is a `GET` request and the body is an `IDictionary` (typically, a hash table), the body is added to the URI as query parameters. For other `GET` requests, the body is set as the value of the request body in the standard `name=value` format. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type><maml:name>Object</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="6" aliases="none"><maml:name>ContentType</maml:name> <maml:Description><maml:para>Specifies the content type of the web request. The default is `application/json`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="4" aliases="none"><maml:name>Headers</maml:name> <maml:Description><maml:para>Specifies the headers of the web request. Enter a hash table or dictionary. </maml:para> <maml:para>`UserAgent` and `Authorization` will be overwritten. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">IDictionary</command:parameterValue> <dev:type><maml:name>IDictionary</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>Method</maml:name> <maml:Description><maml:para>Specifies the method used for the web request. Valid values are `Default`, `Delete`, `Get`, `Head`, `Merge`, `Options`, `Patch`, `Post`, `Put`, and `Trace`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">WebRequestMethod</command:parameterValue> <dev:type><maml:name>WebRequestMethod</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="5" aliases="none"><maml:name>TimeoutSec</maml:name> <maml:Description><maml:para>Specifies how long the request can be pending before it times out. Enter a value in seconds. The default value, 0, specifies an indefinite time-out. </maml:para> <maml:para>A Domain Name System (DNS) query can take up to 15 seconds to return or time out. If your request contains a host name that requires resolution, and you set TimeoutSec to a value greater than zero, but less than 15 seconds, it can take 15 seconds or more before a WebException is thrown, and your request times out. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type><maml:name>Int32</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"><maml:name>Uri</maml:name> <maml:Description><maml:para>Specifies the Uniform Resource Identifier (URI) of the Internet resource to which the web request is sent. This is the reddit API endpoint against which to make the authenticated API request. </maml:para> <maml:para>This parameter is required. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>RedditOAuthToken</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditApiResponse</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>`Invoke-RedditRequest` uses `Invoke-WebRequest` instead of `Invoke-RestMethod` because Reddit returns Rate Limiting data via response headers. `Invoke-RedditRequest` uses the `UseBasicParsing` parameter when calling `Invoke-WebRequest` so the full DOM will not be available on the `RedditApiResponse` object. </maml:para> <maml:para>`Invoke-RedditRequest` will automatically wait for Rate Limiting to pass. If a Rate Limit is in effect, a warning will be issued by `Invoke-RedditRequest`. Rate Limit periods vary but are generally 8 minutes. If you are suppressing warnings and `Invoke-RedditRequest` takes several minutes to complete, you may be making too many calls to the API in too short a time. You can check the status of your rate limit with the `IsRateLimited()` method on the `RedditOAuthToken` before making calls to `Invoke-RedditRequest`. </maml:para> <maml:para>`Invoke-RedditRequest` will attempt to refresh all expired Access Tokens. If the `RedditOAuthToken` is an `Implicit` token, this will require an interactive session as the user will need to authorize the application via the provided GUI browser. This may also crash some version of Powershell ISE as there is currently a bug where `WinForms` elements causes ISE to freeze. Avoid using `Implicit` tokens and if they are required, make sure `Invoke-RedditRequest` is called from a PowerShell console instead of the ISE. </maml:para> <maml:para>Errors encountered when making the API request will be available in the `Response` property on the the exception object. </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$Token = Import-RedditOAuthToken 'C:\PSRAW\AccessToken.xml' $Uri = 'https://oauth.reddit.com/api/v1/me' $Response = $Token | Invoke-RedditRequest -Uri $Uri</dev:code> <dev:remarks><maml:para>This example demonstrates how to import a `RedditOAuthToken` that was previously exported with `Export-RedditOAuthToken` and then using that token to make an authenticated API request to `https://oauth.reddit.com/api/v1/me` with `Invoke-RedditRequest`. </maml:para> <maml:para>The `RedditOAuthToken` does not need to be refreshed before calling `Invoke-RedditRequest`. `Invoke-RedditRequest` will attempt to refresh expired Access Tokens before making any API calls. </maml:para> <maml:para>This method is similar to what can be done within automation scripts provided that the `RedditOAuthToken` is not an `Implicit` token. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>$ClientCredential = Get-Credential $Scope = Get-RedditOAuthScope $Params = @{ Installed = $True Name = 'PSRAW Example App' Description = 'My Reddit Bot!' ClientCredential = $ClientCredential RedirectUri = 'https://adataum/ouath?' UserAgent = 'windows:PSRAW:v0.0.0.1 (by /u/markekraus)' Scope = $Scope } $RedditApp = New-RedditApplication @Params $Token = $RedditApp | Request-RedditOAuthToken -Code $Uri = 'https://oauth.reddit.com/message/inbox' $Response = $Token | Invoke-RedditRequest -Uri $Uri $Messages = $response.ContentObject.data.children.data</dev:code> <dev:remarks><maml:para>This example demonstrates the entire process from scratch to retrieve messages from the Reddit user's inbox. Firs a `RedditApplication` is created. The `RedditApplication` is the authorized and a `RedditOAuthToken` is created. `Invoke-RedditRequest` is then used to make an authenticated query to `https://oauth.reddit.com/message/inbox`. The resulting response is then parsed into the `$Messages` variable. </maml:para> <maml:para>For automation, the creation of the `RedditApplication` and `RedditOAuthToken` are one time actions done in an interactive shell. The `RedditOAuthToken` is then exported once and then re-imported in the actual automation scripts. But this example is provided to show the entire process un broken. </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Invoke-RedditRequest</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Invoke-RedditRequest</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApiResponse</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApiResponse</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Export-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Export-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Get-RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>New-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/New-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Request-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Update-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Update-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Invoke-WebRequest</maml:linkText> <maml:uri>https://go.microsoft.com/fwlink/?LinkID=217035</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/API</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/API</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/OAuth2</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/OAuth2</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/prefs/apps</maml:linkText> <maml:uri>https://www.reddit.com/prefs/apps</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/wiki/api</maml:linkText> <maml:uri>https://www.reddit.com/wiki/api</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>New-RedditApplication</command:name> <command:verb>New</command:verb> <command:noun>RedditApplication</command:noun> <maml:description><maml:para>Creates a `RedditApplication` object </maml:para> </maml:description> </command:details> <maml:description><maml:para>Creates a RedditApplication (https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication)object containing data used by various cmdltes to define the parameters of the App registered on Reddit. This does not make any calls to Reddit or perform any online lookups. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>New-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ClientInfo"><maml:name>ClientCredential</maml:name> <maml:Description><maml:para>A PScredential object containing the Client ID as the Username and the Client Secret as the password. For 'Installed' Apps which have no Client Secret, the password will be ignored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Description</maml:name> <maml:Description><maml:para>Description of the Reddit App. This is not required or used for anything. It is provided for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>GUID</maml:name> <maml:Description><maml:para>A GUID to identify the application. If one is not provided, a new GUID will be generated. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type><maml:name>Guid</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Installed</maml:name> <maml:Description><maml:para>Use if Reddit App is registered as an Installed App. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AppName"><maml:name>Name</maml:name> <maml:Description><maml:para>Name of the Reddit App. This does not need to match the name registered on Reddit. It is used for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>RedirectUri</maml:name> <maml:Description><maml:para>Redirect URI as registered on Reddit for the App. This must match exactly as entered in the App definition or authentication will fail. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Scope</maml:name> <maml:Description><maml:para>Array of RedditOAuthScope (https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope)'s that this Reddit App requires. You can see the available scopes with [Get-RedditOAuthScope](https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope). </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthScope[]</command:parameterValue> <dev:type><maml:name>RedditOAuthScope[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>UserAgent</maml:name> <maml:Description><maml:para>The User-Agent header that will be used for all Calls to Reddit. This should be in the following format: </maml:para> <maml:para><platform>:<app ID>:<version string> (by /u/<reddit username>) </maml:para> <maml:para>Example: </maml:para> <maml:para>windows:PSRAW:v0.0.0.1 (by /u/markekraus) </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>New-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ClientInfo"><maml:name>ClientCredential</maml:name> <maml:Description><maml:para>A PScredential object containing the Client ID as the Username and the Client Secret as the password. For 'Installed' Apps which have no Client Secret, the password will be ignored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Description</maml:name> <maml:Description><maml:para>Description of the Reddit App. This is not required or used for anything. It is provided for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>GUID</maml:name> <maml:Description><maml:para>A GUID to identify the application. If one is not provided, a new GUID will be generated. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type><maml:name>Guid</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AppName"><maml:name>Name</maml:name> <maml:Description><maml:para>Name of the Reddit App. This does not need to match the name registered on Reddit. It is used for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>RedirectUri</maml:name> <maml:Description><maml:para>Redirect URI as registered on Reddit for the App. This must match exactly as entered in the App definition or authentication will fail. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Scope</maml:name> <maml:Description><maml:para>Array of RedditOAuthScope (https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope)'s that this Reddit App requires. You can see the available scopes with [Get-RedditOAuthScope](https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope). </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthScope[]</command:parameterValue> <dev:type><maml:name>RedditOAuthScope[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Script</maml:name> <maml:Description><maml:para>Use if the Reddit App is registered as a Script. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>UserAgent</maml:name> <maml:Description><maml:para>The User-Agent header that will be used for all Calls to Reddit. This should be in the following format: </maml:para> <maml:para><platform>:<app ID>:<version string> (by /u/<reddit username>) </maml:para> <maml:para>Example: </maml:para> <maml:para>windows:PSRAW:v0.0.0.1 (by /u/markekraus) </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Credential"><maml:name>UserCredential</maml:name> <maml:Description><maml:para>PScredential containing the Reddit Username and Password for the Developer of a Script App. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>New-RedditApplication</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ClientInfo"><maml:name>ClientCredential</maml:name> <maml:Description><maml:para>A PScredential object containing the Client ID as the Username and the Client Secret as the password. For 'Installed' Apps which have no Client Secret, the password will be ignored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Description</maml:name> <maml:Description><maml:para>Description of the Reddit App. This is not required or used for anything. It is provided for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>GUID</maml:name> <maml:Description><maml:para>A GUID to identify the application. If one is not provided, a new GUID will be generated. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type><maml:name>Guid</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AppName"><maml:name>Name</maml:name> <maml:Description><maml:para>Name of the Reddit App. This does not need to match the name registered on Reddit. It is used for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>RedirectUri</maml:name> <maml:Description><maml:para>Redirect URI as registered on Reddit for the App. This must match exactly as entered in the App definition or authentication will fail. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Scope</maml:name> <maml:Description><maml:para>Array of RedditOAuthScope (https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope)'s that this Reddit App requires. You can see the available scopes with [Get-RedditOAuthScope](https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope). </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthScope[]</command:parameterValue> <dev:type><maml:name>RedditOAuthScope[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>UserAgent</maml:name> <maml:Description><maml:para>The User-Agent header that will be used for all Calls to Reddit. This should be in the following format: </maml:para> <maml:para><platform>:<app ID>:<version string> (by /u/<reddit username>) </maml:para> <maml:para>Example: </maml:para> <maml:para>windows:PSRAW:v0.0.0.1 (by /u/markekraus) </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Credential"><maml:name>UserCredential</maml:name> <maml:Description><maml:para>PScredential containing the Reddit Username and Password for the Developer of a Script App. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>WebApp</maml:name> <maml:Description><maml:para>Use if the Reddit App is registered as a WebApp </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ClientInfo"><maml:name>ClientCredential</maml:name> <maml:Description><maml:para>A PScredential object containing the Client ID as the Username and the Client Secret as the password. For 'Installed' Apps which have no Client Secret, the password will be ignored. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Description</maml:name> <maml:Description><maml:para>Description of the Reddit App. This is not required or used for anything. It is provided for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>GUID</maml:name> <maml:Description><maml:para>A GUID to identify the application. If one is not provided, a new GUID will be generated. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type><maml:name>Guid</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Installed</maml:name> <maml:Description><maml:para>Use if Reddit App is registered as an Installed App. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AppName"><maml:name>Name</maml:name> <maml:Description><maml:para>Name of the Reddit App. This does not need to match the name registered on Reddit. It is used for convenient identification and documentation purposes only. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>RedirectUri</maml:name> <maml:Description><maml:para>Redirect URI as registered on Reddit for the App. This must match exactly as entered in the App definition or authentication will fail. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type><maml:name>Uri</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Scope</maml:name> <maml:Description><maml:para>Array of RedditOAuthScope (https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope)'s that this Reddit App requires. You can see the available scopes with [Get-RedditOAuthScope](https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope). </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthScope[]</command:parameterValue> <dev:type><maml:name>RedditOAuthScope[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Script</maml:name> <maml:Description><maml:para>Use if the Reddit App is registered as a Script. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>UserAgent</maml:name> <maml:Description><maml:para>The User-Agent header that will be used for all Calls to Reddit. This should be in the following format: </maml:para> <maml:para><platform>:<app ID>:<version string> (by /u/<reddit username>) </maml:para> <maml:para>Example: </maml:para> <maml:para>windows:PSRAW:v0.0.0.1 (by /u/markekraus) </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Credential"><maml:name>UserCredential</maml:name> <maml:Description><maml:para>PScredential containing the Reddit Username and Password for the Developer of a Script App. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type><maml:name>PSCredential</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>WebApp</maml:name> <maml:Description><maml:para>Use if the Reddit App is registered as a WebApp </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes></command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditApplication</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$ClientCredential = Get-Credential $Scope = Get-RedditOAuthScope | Where-Object {$_.Scope -like '*wiki*'} $Params = @{ WebApp = $True Name = 'Connect-Reddit' Description = 'My Reddit Bot!' ClientCredential = $ClientCredential RedirectUri = 'https://adataum/ouath?' UserAgent = 'windows:connect-reddit:v0.0.0.1 (by /u/markekraus)' Scope = $Scope } $RedditApp = New-RedditApplication @Params</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>$ClientCredential = Get-Credential $UserCredential = Get-Credential $Scope = Get-RedditOAuthScope | Where-Object {$_.Scope -like '*wiki*'} $Params = @{ Script = $True Name = 'Connect-Reddit' Description = 'My Reddit Bot!' ClientCredential = $ClientCredential UserCredential = $UserCredential RedirectUri = 'https://adataum/ouath?' UserAgent = 'windows:connect-reddit:v0.0.0.1 (by /u/markekraus)' Scope = $Scope } $RedditApp = New-RedditApplication @Params</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>$ClientCredential = Get-Credential $Scope = Get-RedditOAuthScope | Where-Object {$_.Scope -like '*wiki*'} $Params = @{ Installed = $True Name = 'PSRAW Example App' Description = 'My Reddit Bot!' ClientCredential = $ClientCredential RedirectUri = 'https://adataum/ouath?' UserAgent = 'windows:PSRAW:v0.0.0.1 (by /u/markekraus)' Scope = $Scope } $RedditApp = New-RedditApplication @Params</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>New-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/New-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Get-RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Get-RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthScope</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthScope</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/API</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/API</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/OAuth2</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/OAuth2</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/prefs/apps</maml:linkText> <maml:uri>https://www.reddit.com/prefs/apps</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/wiki/api</maml:linkText> <maml:uri>https://www.reddit.com/wiki/api</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Request-RedditOAuthToken</command:name> <command:verb>Request</command:verb> <command:noun>RedditOAuthToken</command:noun> <maml:description><maml:para>Requests a OAuth Access Token from Reddit </maml:para> </maml:description> </command:details> <maml:description><maml:para>Requests an OAuth Access Token from Reddit and returns a `RedditOAuthToken` object for the given `RedditApplication`. The OAuth Access Token is used by other functions in this module to make authenticated calls tot he Reddit API. For more information on Reddit's OAuth implementation, see https://github.com/reddit/reddit/wiki/OAuth2 </maml:para> <maml:para>A `RedditApplication` object is required to request a `RedditOAutToken`. Once the token has been issued the `RedditApplication` will be added to the `RedditOAuthToken` object as the `Application` property. for mor information see the `about_RedditOAuthToken` help topic. </maml:para> <maml:para>Reddit provides several different methods for obtaining Access Tokens depending on your needs and required level of access to the API. For more information on each, see the `Client`,`Code`, `Implicit`, `Installed` and `Script` parameter descriptions. For most uses, either `Code` or `Script` will provide the most benefit. </maml:para> <maml:para>`Code` and `Implicit` methods cannot be run in non-interactive sessions as they require logging into reddit through a GUI (provided by this module). For `Code` Access Tokens this only needs to be performed once for more info see the `Code` parameter description. For `Implicit` Access Tokens, this must be done at least once an hour. </maml:para> <maml:para>All `RedditOAuthToken` types will automatically refresh when they expire when consumed by functions in this module. `Implicit` tokens will prompt for credentials through a GUI on every renewal. You can also manually refresh them using `Update-RedditOAuthToken`. </maml:para> <maml:para>> PowerShell ISE Compatibility Issue > > There is currently a bug in some versions of PowerShell ISE that result in the ISE becoming unresponsive when `WinForms` elements are used. This is an upstream bug and cannot be fixed within this module. To work around this, run this command from the PowerShell Console only and not from the ISE when using any of the grant methods which require and interactive session. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Request-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Client</maml:name> <maml:Description><maml:para>Best Used for: Anonymous API access for `WebApp` and `Script` applications </maml:para> <maml:para>The `Client` switch will initiate a `Client_Credentials` grant flow. This Grant type uses only the application's Client ID and Client Secret to request an OAuth Token. This will enable the use of OAuth Based APIs, but since the OAuth Token will not be associated with any user context it will only have "anonymous" access. This is similar to browsing reddit without having a login. You will not be able to send user messages, post comments or submissions, or do anything else that would require an active login session on the web site. </maml:para> <maml:para>`Client` access tokens expire after 60 minutes. When they are "renewed" a new token is requested from scratch. This can be used in automation as it does not require user input. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>`Client` OAuth Access Tokens can only be issued to `Script` and `WebApp` applications as it requires Client Secret. </maml:para> <maml:para>For more information on Reddit's OAuth implementation, see https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Request-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>State</maml:name> <maml:Description><maml:para>The `State` parameter is used by the `Code` and `Implicit` methods for validation. It is optional as the module will verify the state. The default will create a new GUID. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid().toString()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Code</maml:name> <maml:Description><maml:para>Best used for: Automation, bots and long running unattended process when a single application may act on behalf of one or more users or when you do not wish to store or continually transmit reddit user credentials. </maml:para> <maml:para>Offers the best security and flexibility. </maml:para> <maml:para>The `Code` switch will initiate a `Authorization_Code` grant flow. This grant type uses the Client ID and Redirect URI to direct a user to log in on reddit and authorize the application via GUI web browser. Once the user has logged in and authorized the application, reddit will return an authorization code to the Redirect URI. The GUI browser will close and the authorization code is then used along with the client ID and Client Secret to request an Access Token and Refresh Token. The Access Token is valid for 60 minutes and is used to authenticate with the Reddit API. Once the Access Token expires the Refresh Token, Client ID, and Client Secret are used to request a new Access Token. The Refresh Token is valid until the user or application revokes it. </maml:para> <maml:para>This process requires a interactive powershell session. It only needs to be done once. For automation purposes, the initial `Request-RedditOAuthToken` needs to be done from a normal PowerShell console. Once the token has been issued, export it with `Export-RedditOAuthAToken`. The exported token can then be imported in other scripts with `Import-RedditOAuthToken`. The token will automatically update on the next call the API made by functions in this module. </maml:para> <maml:para>`Code` OAuth Access Tokens can only be issued to `Script` and `WebApp` applications as it requires Client Secret. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#authorization </maml:para> <maml:para>> REQUIRES INTERACTIVE SESSION </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Request-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>DeviceID</maml:name> <maml:Description><maml:para>DeviceID is an optional parameter for `Installed` token requests. This is intended to be an semi-permanent ID for the device that is requesting a token. When this is not supplied, a new GUID will be generated. Fore more information see the `Installed` parameter description and https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid().toString()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Installed</maml:name> <maml:Description><maml:para>Best Used for: Anonymous API access for `Installed` applications. </maml:para> <maml:para>The `Installed` option will initiate a `installed_client` grant flow. This will enable the use of OAuth Based APIs, but since the OAuth Token will not be associated with any user context it will only have "anonymous" access. This is similar to browsing reddit without having a login. You will not be able to send user messages, post comments or submissions, or do anything else that would require an active login session on the web site. </maml:para> <maml:para>The token will only be valid for 1 hour and then a new token will be requested. This can be placed in automation as it does not require the user to log in. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>The `Installed` grant flow requires that a Device ID be sent. The `DeviceID` parameter can be used to supply one. the default is to generate a new GUID. That Device ID used should be unique to the device and should be used for all subsequent Access Token requests via the `Installed` method on the same device. This will be set on the `DeviceID` of the returned `RedditOAuthToken` object. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Request-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>State</maml:name> <maml:Description><maml:para>The `State` parameter is used by the `Code` and `Implicit` methods for validation. It is optional as the module will verify the state. The default will create a new GUID. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid().toString()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Implicit</maml:name> <maml:Description><maml:para>Best used for: `Installed` applications that need to act on behalf of the user. </maml:para> <maml:para>The `Implicit` grant flow provides `Installed` applications the ability act in a user context. `Installed` applications do not have Client Secrets so this method allows for requesting an access token from a device that is not under the developer's direct control. The token will be valid for 1 hour and then a new token will need to be authorized. </maml:para> <maml:para>This grant flow requires an Interactive session and cannot be run in non-interactive scripts. The user will be provided a GUI Web Browser to log in to Reddit and authorize the application. The user will need to authorize the application on the next request made to the API after the token expires. </maml:para> <maml:para>The method is provided in the module for completeness, it is not recommended unless you are prepackaging an application that needs to access the Reddit API as a logged in user and the other methods are unavailable. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#authorization-implicit-grant-flow </maml:para> <maml:para>> REQUIRES INTERACTIVE SESSION </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem><maml:name>Request-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Script</maml:name> <maml:Description><maml:para>Best used for: Automation, bots and long running unattended process when a single application may act on behalf of one or more users or when the Application will only act on behalf of the Application Developer and not on behalf of others. </maml:para> <maml:para>The `Script` method can only be used by `Script` applications and can only act on behalf of the Reddit user who registered the application. This method will initiate a `password` grant flow. The user's credentials along with the Client ID and Client Secret are used to request an Access token. The token is valid for 1 hour and then a new token will need to be requested. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>The `Script` method can be used in automation, but, it requires that the reddit username and password be stored in the `RedditApplication` object. The user password is stored in a secure string and when a `RedditApplication` or `RedditOAuthToken` is exported, the password is stored in encrypted form that can only be retrieved by the same user on the same computer where the object was exported. </maml:para> <maml:para>In contrast to the `Code` method, the `Script` method does not require an interactive session at any point provided you have a way to import a `PSCredential` object. The down side is that the developers Client ID, Client Secret, Username, and Password all need to be used and stored. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#retrieving-the-access-token </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"><maml:name>Application</maml:name> <maml:Description><maml:para>`RedditApplication` object created with either `New-RedditApplication` or `Import-RedditApplication`. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditApplication</command:parameterValue> <dev:type><maml:name>RedditApplication</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Client</maml:name> <maml:Description><maml:para>Best Used for: Anonymous API access for `WebApp` and `Script` applications </maml:para> <maml:para>The `Client` switch will initiate a `Client_Credentials` grant flow. This Grant type uses only the application's Client ID and Client Secret to request an OAuth Token. This will enable the use of OAuth Based APIs, but since the OAuth Token will not be associated with any user context it will only have "anonymous" access. This is similar to browsing reddit without having a login. You will not be able to send user messages, post comments or submissions, or do anything else that would require an active login session on the web site. </maml:para> <maml:para>`Client` access tokens expire after 60 minutes. When they are "renewed" a new token is requested from scratch. This can be used in automation as it does not require user input. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>`Client` OAuth Access Tokens can only be issued to `Script` and `WebApp` applications as it requires Client Secret. </maml:para> <maml:para>For more information on Reddit's OAuth implementation, see https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Code</maml:name> <maml:Description><maml:para>Best used for: Automation, bots and long running unattended process when a single application may act on behalf of one or more users or when you do not wish to store or continually transmit reddit user credentials. </maml:para> <maml:para>Offers the best security and flexibility. </maml:para> <maml:para>The `Code` switch will initiate a `Authorization_Code` grant flow. This grant type uses the Client ID and Redirect URI to direct a user to log in on reddit and authorize the application via GUI web browser. Once the user has logged in and authorized the application, reddit will return an authorization code to the Redirect URI. The GUI browser will close and the authorization code is then used along with the client ID and Client Secret to request an Access Token and Refresh Token. The Access Token is valid for 60 minutes and is used to authenticate with the Reddit API. Once the Access Token expires the Refresh Token, Client ID, and Client Secret are used to request a new Access Token. The Refresh Token is valid until the user or application revokes it. </maml:para> <maml:para>This process requires a interactive powershell session. It only needs to be done once. For automation purposes, the initial `Request-RedditOAuthToken` needs to be done from a normal PowerShell console. Once the token has been issued, export it with `Export-RedditOAuthAToken`. The exported token can then be imported in other scripts with `Import-RedditOAuthToken`. The token will automatically update on the next call the API made by functions in this module. </maml:para> <maml:para>`Code` OAuth Access Tokens can only be issued to `Script` and `WebApp` applications as it requires Client Secret. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#authorization </maml:para> <maml:para>> REQUIRES INTERACTIVE SESSION </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>DeviceID</maml:name> <maml:Description><maml:para>DeviceID is an optional parameter for `Installed` token requests. This is intended to be an semi-permanent ID for the device that is requesting a token. When this is not supplied, a new GUID will be generated. Fore more information see the `Installed` parameter description and https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid().toString()</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Implicit</maml:name> <maml:Description><maml:para>Best used for: `Installed` applications that need to act on behalf of the user. </maml:para> <maml:para>The `Implicit` grant flow provides `Installed` applications the ability act in a user context. `Installed` applications do not have Client Secrets so this method allows for requesting an access token from a device that is not under the developer's direct control. The token will be valid for 1 hour and then a new token will need to be authorized. </maml:para> <maml:para>This grant flow requires an Interactive session and cannot be run in non-interactive scripts. The user will be provided a GUI Web Browser to log in to Reddit and authorize the application. The user will need to authorize the application on the next request made to the API after the token expires. </maml:para> <maml:para>The method is provided in the module for completeness, it is not recommended unless you are prepackaging an application that needs to access the Reddit API as a logged in user and the other methods are unavailable. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#authorization-implicit-grant-flow </maml:para> <maml:para>> REQUIRES INTERACTIVE SESSION </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Installed</maml:name> <maml:Description><maml:para>Best Used for: Anonymous API access for `Installed` applications. </maml:para> <maml:para>The `Installed` option will initiate a `installed_client` grant flow. This will enable the use of OAuth Based APIs, but since the OAuth Token will not be associated with any user context it will only have "anonymous" access. This is similar to browsing reddit without having a login. You will not be able to send user messages, post comments or submissions, or do anything else that would require an active login session on the web site. </maml:para> <maml:para>The token will only be valid for 1 hour and then a new token will be requested. This can be placed in automation as it does not require the user to log in. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>The `Installed` grant flow requires that a Device ID be sent. The `DeviceID` parameter can be used to supply one. the default is to generate a new GUID. That Device ID used should be unique to the device and should be used for all subsequent Access Token requests via the `Installed` method on the same device. This will be set on the `DeviceID` of the returned `RedditOAuthToken` object. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Script</maml:name> <maml:Description><maml:para>Best used for: Automation, bots and long running unattended process when a single application may act on behalf of one or more users or when the Application will only act on behalf of the Application Developer and not on behalf of others. </maml:para> <maml:para>The `Script` method can only be used by `Script` applications and can only act on behalf of the Reddit user who registered the application. This method will initiate a `password` grant flow. The user's credentials along with the Client ID and Client Secret are used to request an Access token. The token is valid for 1 hour and then a new token will need to be requested. A new token will automatically be requested on the next API call made by functions in this module after the token has expired. </maml:para> <maml:para>The `Script` method can be used in automation, but, it requires that the reddit username and password be stored in the `RedditApplication` object. The user password is stored in a secure string and when a `RedditApplication` or `RedditOAuthToken` is exported, the password is stored in encrypted form that can only be retrieved by the same user on the same computer where the object was exported. </maml:para> <maml:para>In contrast to the `Code` method, the `Script` method does not require an interactive session at any point provided you have a way to import a `PSCredential` object. The down side is that the developers Client ID, Client Secret, Username, and Password all need to be used and stored. </maml:para> <maml:para>For more information see https://github.com/reddit/reddit/wiki/OAuth2#retrieving-the-access-token </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="2" aliases="none"><maml:name>State</maml:name> <maml:Description><maml:para>The `State` parameter is used by the `Code` and `Implicit` methods for validation. It is optional as the module will verify the state. The default will create a new GUID. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type><maml:name>String</maml:name> <maml:uri /></dev:type> <dev:defaultValue>[guid]::NewGuid().toString()</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>RedditApplication</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditOAuthToken</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>There is currently a bug in some versions of PowerShell ISE that result in the ISE becoming unresponsive when `WinForms` elements are used. This is an upstream bug and cannot be fixed within this module. To work around this, run this command from the PowerShell Console only and not from the ISE when using any of the grant methods which require and interactive session. </maml:para> <maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>PS C:\> $Token = $RedditApp | Request-RedditOAuthToken -Script</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>PS C:\> $Token = $RedditApp | Request-RedditOAuthToken -Code</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title> <dev:code>PS C:\> $Token = $RedditApp | Request-RedditOAuthToken -Installed -DeviceId 'db470a80-da50-4ae1-9bba-24a1a3454392'</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 4 --------------------------</maml:title> <dev:code>PS C:\> $Token = $RedditApp | Request-RedditOAuthToken -Client</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 5 --------------------------</maml:title> <dev:code>PS C:\> $Token = $RedditApp | Request-RedditOAuthToken -Implicit</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 6 --------------------------</maml:title> <dev:code>$ClientCredential = Get-Credential $Scope = Get-RedditOAuthScope | Where-Object {$_.Scope -like '*wiki*'} $Params = @{ WebApp = $True Name = 'Connect-Reddit' Description = 'My Reddit Bot!' ClientCredential = $ClientCredential RedirectUri = 'https://adataum/ouath?' UserAgent = 'windows:connect-reddit:v0.0.0.1 (by /u/markekraus)' Scope = $Scope OutVariable = 'RedditApp' } $Token = New-RedditApplication @Params | Request-RedditOAuthToken -Code</dev:code> <dev:remarks><maml:para>This example demonstrates how to create a `RedditApplication` with `New-RedditApplication` and pass it to `Request-RedditOAuthToken` to obtain a `RedditOAuthToken`. The token will be stored in `$Token` and the application will be stored in `RedditApp`. </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>New-RedditApplication</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/New-RedditApplication</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Update-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Update-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/API</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/API</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/OAuth2</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/OAuth2</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/prefs/apps</maml:linkText> <maml:uri>https://www.reddit.com/prefs/apps</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/wiki/api</maml:linkText> <maml:uri>https://www.reddit.com/wiki/api</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details><command:name>Update-RedditOAuthToken</command:name> <command:verb>Update</command:verb> <command:noun>RedditOAuthToken</command:noun> <maml:description><maml:para>Refresh a `RedditOAuthToken` </maml:para> </maml:description> </command:details> <maml:description><maml:para>When a `RedditOAuthToken` Token has expired, `Update-RedditOAuthToken`can be used to refresh the Access Token. Depending on the grant method used to request the `RedditOAuthToken` with `Request-RedditOAuthToken`, either a refresh will be performed or a new grant flow will be initiated. </maml:para> <maml:para>This function must be run in an interactive session for tokens requested with the `Implicit` grant method. The user will be required to reauthorize the application with the provided GUI browser. All other grant methods can be refreshed with this function in non-interactive sessions. </maml:para> <maml:para>> PowerShell ISE Compatibility Issue > > There is currently a bug in some versions of PowerShell ISE that result in the ISE becoming unresponsive when `WinForms` elements are used. This is an upstream bug and cannot be fixed within this module. To work around this, run this command from the PowerShell Console only and not from the ISE when using `Implicit` tokens. </maml:para> </maml:description> <command:syntax><command:syntaxItem><maml:name>Update-RedditOAuthToken</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="Token"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` containing the Access Token to refresh. Multiple `RedditOAuthToken` objects can be supplied. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken[]</command:parameterValue> <dev:type><maml:name>RedditOAuthToken[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name> <maml:Description><maml:para>By default, this function will ignore any `RedditOAuthToken` which is not yet expired. `-Force` will override that behavior and perform a refresh request. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>PassThru</maml:name> <maml:Description><maml:para>By default, this function does not return any data. The `-PassThru` parameter will place the updated `RedditOAuthToken` into the output stream to either be stored in another variable or placed in the pipeline and consumed by other functions. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="Token"><maml:name>AccessToken</maml:name> <maml:Description><maml:para>The `RedditOAuthToken` containing the Access Token to refresh. Multiple `RedditOAuthToken` objects can be supplied. </maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">RedditOAuthToken[]</command:parameterValue> <dev:type><maml:name>RedditOAuthToken[]</maml:name> <maml:uri /></dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Force</maml:name> <maml:Description><maml:para>By default, this function will ignore any `RedditOAuthToken` which is not yet expired. `-Force` will override that behavior and perform a refresh request. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>PassThru</maml:name> <maml:Description><maml:para>By default, this function does not return any data. The `-PassThru` parameter will place the updated `RedditOAuthToken` into the output stream to either be stored in another variable or placed in the pipeline and consumed by other functions. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name> <maml:Description><maml:para>Prompts you for confirmation before running the cmdlet. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name> <maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run. </maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type><maml:name>SwitchParameter</maml:name> <maml:uri /></dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes><command:inputType><dev:type><maml:name>RedditOAuthToken[]</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues><command:returnValue><dev:type><maml:name>RedditOAuthToken</maml:name> </dev:type> <maml:description><maml:para> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet><maml:alert><maml:para>There is currently a bug in some versions of PowerShell ISE that result in the ISE becoming unresponsive when `WinForms` elements are used. This is an upstream bug and cannot be fixed within this module. To work around this, run this command from the PowerShell Console only and not from the ISE when using `Implicit` tokens. </maml:para> <maml:para>For complete documentation visit https://psraw.readthedocs.io/ (https://psraw.readthedocs.io/)For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see: </maml:para> <maml:para>* https://github.com/reddit/reddit/wiki/API (https://github.com/reddit/reddit/wiki/API)* https://github.com/reddit/reddit/wiki/OAuth2 (https://github.com/reddit/reddit/wiki/OAuth2)* https://www.reddit.com/prefs/apps (https://www.reddit.com/prefs/apps)* https://www.reddit.com/wiki/api (https://www.reddit.com/wiki/api) </maml:para> </maml:alert> </maml:alertSet> <command:examples><command:example><maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>PS C:\> $Token | Update-RedditOAuthToken</dev:code> <dev:remarks><maml:para> </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>PS C:\> $Token | Update-RedditOAuthToken -Force</dev:code> <dev:remarks><maml:para>This example demonstrates using the `-Force` parameter for initiate a token refresh on a token that has not yet expired. </maml:para> </dev:remarks> </command:example> <command:example><maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>PS C:\> $NewExpireDate = $Token | Update-RedditOAuthToken -PassThru | Select-Object -Expand ExpireDate</dev:code> <dev:remarks><maml:para>This example demonstrates using the `-PassThru` parameter to send the updated `RedditOAuthToken` to the pipeline. The `ExpireDate` property is then expanded and stored in `$NewExpireDate`. </maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks><maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/en/latest/Module/Update-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Update-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>about_RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/about_RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>Request-RedditOAuthToken</maml:linkText> <maml:uri>https://psraw.readthedocs.io/en/latest/Module/Request-RedditOAuthToken</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/API</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/API</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://github.com/reddit/reddit/wiki/OAuth2</maml:linkText> <maml:uri>https://github.com/reddit/reddit/wiki/OAuth2</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/prefs/apps</maml:linkText> <maml:uri>https://www.reddit.com/prefs/apps</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://www.reddit.com/wiki/api</maml:linkText> <maml:uri>https://www.reddit.com/wiki/api</maml:uri> </maml:navigationLink> <maml:navigationLink><maml:linkText>https://psraw.readthedocs.io/</maml:linkText> <maml:uri>https://psraw.readthedocs.io/</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |