dolibarr 21.0.0-alpha
|
Class for handler Mastodon. More...
Public Member Functions | |
__construct ($authParams) | |
Constructor to set the necessary credentials. | |
fetch ($urlAPI, $maxNb=5, $cacheDelay=60, $cacheDir='', $authParams=[]) | |
Fetch posts from Mastodon API using the access token. | |
normalizeData ($postData) | |
Normalize data of retrieved posts. | |
getPosts () | |
Get the list of retrieved posts. | |
getRedirectUri () | |
Getter for url to redirect. | |
getAccessToken () | |
Getter for access token. | |
getClientId () | |
Getter for client Id. | |
getClientSecret () | |
Getter for secret client. | |
Private Member Functions | |
formatDate ($dateString) | |
Format date for normalize date. | |
Class for handler Mastodon.
Definition at line 32 of file mastodonhandler.class.php.
MastodonHandler::__construct | ( | $authParams | ) |
Constructor to set the necessary credentials.
array | $authParams | parameters for authentication |
Definition at line 70 of file mastodonhandler.class.php.
MastodonHandler::fetch | ( | $urlAPI, | |
$maxNb = 5, | |||
$cacheDelay = 60, | |||
$cacheDir = '', | |||
$authParams = [] ) |
Fetch posts from Mastodon API using the access token.
string | $urlAPI | The URL of the API endpoint |
int | $maxNb | Maximum number of posts to retrieve |
int | $cacheDelay | Cache delay in seconds |
string | $cacheDir | Directory for caching |
array | $authParams | Authentication parameters |
Definition at line 90 of file mastodonhandler.class.php.
References dol_filemtime(), dol_hash(), dol_is_file(), dol_mkdir(), dol_now(), getURLContent(), and normalizeData().
|
private |
Format date for normalize date.
string | $dateString | date with string format |
Definition at line 176 of file mastodonhandler.class.php.
References dol_print_date().
Referenced by normalizeData().
MastodonHandler::getAccessToken | ( | ) |
Getter for access token.
Definition at line 205 of file mastodonhandler.class.php.
MastodonHandler::getClientId | ( | ) |
Getter for client Id.
Definition at line 214 of file mastodonhandler.class.php.
MastodonHandler::getClientSecret | ( | ) |
Getter for secret client.
Definition at line 223 of file mastodonhandler.class.php.
MastodonHandler::getPosts | ( | ) |
Get the list of retrieved posts.
Definition at line 187 of file mastodonhandler.class.php.
MastodonHandler::getRedirectUri | ( | ) |
Getter for url to redirect.
Definition at line 196 of file mastodonhandler.class.php.
MastodonHandler::normalizeData | ( | $postData | ) |
Normalize data of retrieved posts.
array{content?:string,created_at?:string,url?:string,media_attachments?:array<array{url:string}>} | $postData post retrieved |
Definition at line 157 of file mastodonhandler.class.php.
References formatDate().
Referenced by fetch().