RedditOAuthScope
about_RedditOAuthScope
SHORT DESCRIPTION
Describes the RedditOAuthScope Class
LONG DESCRIPTION
The RedditOAuthScope
Class is used to define OAuth Scopes for Reddit's API. All OAuth Access Tokens are limited in what functions they may perform. Scopes for an application define what the application can and cannot do on the API.
RedditOAuthScope
objects can be created manually or you can retrieve all valid scopes with Get-RedditOAuthScope
. RedditOAuthScope
objects appear as properties on RedditApplication
and RedditOAuthToken
objects.
Constructors
RedditOAuthScope()
Initializes an empty RedditOAuthScope
.
[RedditOAuthScope]::new()
RedditOAuthScope(String Scope)
Initializes a RedditOAuthScope
where all members match the provided string.
[RedditOAuthScope]::new([String]$Scope)
RedditOAuthScope(String Scope, String Id, String Name, String Description)
Initializes a RedditOAuthScope
with all the properties.
[RedditOAuthScope]::new([String]$Scope, [String]$Id, [String]$Name, [String]$Description)
Properties
ApiEndpointUri
The ApiEndpointUri
static member is included on all API generated objects. It is a template string for the API End Point to access objects of that class. To get a formatted string to make API calls, use the GetApiEndpointUri()
static method(s).
Name: ApiEndpointUri
Type: String
Hidden: False
Static: True
Description
Longer description of the scope.
Name: Description
Type: String
Hidden: False
Static: False
Id
This ID is provided by reddit to identify the scope. it usually matches the Scope
Name: Id
Type: String
Hidden: False
Static: False
Name
A short descriptive name of the scope
Name: Name
Type: String
Hidden: False
Static: False
Scope
Reddit's API returns a JSON object that contains an array of hashes. The Scope property represents the name of the scope hash. In most cases this matches the Id
. This is the string that is sent to Reddit to request access to a scope.
Name: Scope
Type: String
Hidden: False
Static: False
Methods
_init(String Scope, String Id, String Name, String Description)
The _init
hidden method is used by the constructors to initialize the class. This way class initialization code can be maintained in a single method instead of each individual constructor.
Name: _init
Return Type: Void
Hidden: True
Static: False
Definition: hidden Void _init(String Scope, String Id, String Name, String Description)
GetApiEndpointUri()
The GetApiEndpointUri
static method is included on all API generated objects. It returns a formatted string for the API endpoint that is used to query objects of this class.
Name: GetApiEndpointUri
Return Type: String
Hidden: False
Static: True
Definition: static String GetApiEndpointUri()
ToString()
Creates a string representation of the RedditOAuthScope
object.
Name: ToString
Return Type: String
Hidden: False
Static: False
Definition: String ToString()
EXAMPLES
Creating a Full RedditOAuthScope Object
Import-Module PSRAW
$Scope = [RedditOAuthScope]@{
Scope = 'creddits'
Id = 'creddits'
Name = 'Spend reddit gold creddits'
Description = 'Spend my reddit gold creddits on giving gold to other users.'
}
Simple String Scope
$ReadScope = [RedditOAuthScope]'read'