Skip to content

Commit

Permalink
Fixed an error I caused, added better help
Browse files Browse the repository at this point in the history
  • Loading branch information
1RedOne committed Sep 17, 2015
1 parent d4e52e9 commit a36c15f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
3 changes: 1 addition & 2 deletions PSReddit.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ ModuleVersion = '1.0'
GUID = '3dede632-fde4-4cc6-85df-9f5cfd6cd124'

# Author of this module
Author = 'Tobin Jones'
Author = 'Stephen Owen'
Author = 'Tobin Jones', 'Stephen Owen'

# Copyright statement for this module
Copyright = 'Licensed under the MIT license'
Expand Down
17 changes: 13 additions & 4 deletions PSReddit.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,24 @@
{
#Import the config
$password = Import-Clixml -Path $configDir -ErrorAction STOP | ConvertTo-SecureString
$refreshToken = Import-Clixml -Path $refreshToken -ErrorAction STOP | ConvertTo-SecureString

}
catch {
Write-Warning "Corrupt Password file found, rerun with -Force to fix this"
BREAK
}

Try
{
#Import the config

$refreshToken = Import-Clixml -Path $refreshToken -ErrorAction STOP | ConvertTo-SecureString
}
catch {
Write-Warning "Corrupt refresh token file found, rerun with -Force to fix this"
}

Get-DecryptedValue -inputObj $password -name PSReddit_accessToken
Get-DecryptedValue -inputObj $refreshToken -name PSReddit_refreshToken
if ($password){Get-DecryptedValue -inputObj $password -name PSReddit_accessToken}
if($refreshToken){Get-DecryptedValue -inputObj $refreshToken -name PSReddit_refreshToken}



Expand Down
34 changes: 33 additions & 1 deletion Public/Connect-RedditAccount.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
Function Connect-RedditAccount {
<#
.Synopsis
Use this cmdlet to connect to your Reddit account from PowerShell
.DESCRIPTION
Use this cmdlet to connect to your Reddit account from PowerShell.You'll first need to register for an Register for a Reddit API account here, https://www.reddit.com/prefs/apps, and choose a Script based Application.
Make note of your ClientSecret, ClientID and RedirectURI (which can be anything). This cmdlet displays a login window to allow a user to provision access to their account by means of oAuth.
The permissions requested are: identity, history, mysubreddits, read, report, save, submit
.EXAMPLE
Connect-RedditAccount -ClientID $ClientID -ClientSecret $ClientSecret -RedirectURI $RedirectURI
.EXAMPLE
Another example of how to use this cmdlet
.INPUTS
Inputs to this cmdlet (if any)
.OUTPUTS
Output from this cmdlet (if any)
.NOTES
You'll first need to register for an Register for a Reddit API account here, https://www.reddit.com/prefs/apps, and choose a Script based Application. Make note of your ClientSecret, ClientID and RedirectURI (which can be anything).
.COMPONENT
The component this cmdlet belongs to
.ROLE
The role this cmdlet belongs to
.FUNCTIONALITY
The functionality that best describes this cmdlet
.LINK
https://www.reddit.com/dev/api
For Reference for the API
https://github.com/1RedOne/PSReddit/
The project homepage on GitHub
#>
Function Connect-RedditAccount {
[CmdletBinding()]
param(
$ClientSecret,
Expand Down

0 comments on commit a36c15f

Please sign in to comment.