Public Member Functions | |
__construct (string $username=null) | |
getExpires () | |
getScope () | |
getToken () | |
getTokenType () | |
getUsername () | |
isValid () | |
fromJson (string $json) | |
toJson () | |
![]() | |
__construct (array $args=null) | |
_getSnuzeId () | |
_getSnuzeClass () | |
_ident () | |
Private Attributes | |
$username = null | |
$token = null | |
$expires = 0 | |
$scope = null | |
$tokenType = null | |
Additional Inherited Members | |
![]() | |
debug (string $message, bool $echo=false) | |
info (string $message, bool $echo=false) | |
warning (string $message, bool $echo=false) | |
error (string $message, bool $echo=false) | |
![]() | |
$_snuzeId = null | |
$_snuzeClass = null | |
An AccessToken represents the authentication information needed to interact with many Reddit API endpoints.
This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun @sha unc.c omhttps://shaunc.com/ Repository: https://github.com/snuze/snuze/ Documentation: https://snuze.shaunc.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
snuze\Reddit\AccessToken::__construct | ( | string | $username = null | ) |
Constructor.
string | $username | The Reddit username for this access token |
snuze\Reddit\AccessToken::fromJson | ( | string | $json | ) |
Given the raw JSON response to an API request for an access token, populate and return this AccessToken object.
string | $json | The raw JSON response from Reddit's API server |
Implements snuze\Interfaces\Jsonable.
snuze\Reddit\AccessToken::getExpires | ( | ) |
Get the unix epoch timestamp at which this token expires
snuze\Reddit\AccessToken::getScope | ( | ) |
Get the scope of this token e.g. '*' or 'read'
snuze\Reddit\AccessToken::getToken | ( | ) |
Return the raw access token string, if one has been set.
snuze\Reddit\AccessToken::getTokenType | ( | ) |
Get the type of token e.g. 'bearer'
snuze\Reddit\AccessToken::getUsername | ( | ) |
Get the Reddit account username this token was assigned to
snuze\Reddit\AccessToken::isValid | ( | ) |
Return whether or not this AccessToken object contains an unexpired token.
snuze\Reddit\AccessToken::toJson | ( | ) |
Returns a JSON-formatted string representing this token's properties. Ideally, this should match Reddit's own data structure for returning access tokens from the API. (Reddit doesn't return the username.)
Implements snuze\Interfaces\Jsonable.