dolibarr 21.0.0-beta
MastodonHandler Class Reference

Class for handler Mastodon. More...

Public Member Functions

 __construct ($authParams)
 Constructor to set the necessary credentials.
 
 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.
 

Detailed Description

Class for handler Mastodon.

Definition at line 32 of file mastodonhandler.class.php.

Constructor & Destructor Documentation

◆ __construct()

MastodonHandler::__construct ( $authParams)

Constructor to set the necessary credentials.

Parameters
array{client_id?:string,client_secret?:string,redirect_uri?:string,access_token?:string}$authParams parameters for authentication

Definition at line 70 of file mastodonhandler.class.php.

Member Function Documentation

◆ formatDate()

MastodonHandler::formatDate ( $dateString)
private

Format date for normalize date.

Parameters
string$dateStringdate with string format
Returns
string return correct format

Definition at line 179 of file mastodonhandler.class.php.

References dol_print_date().

Referenced by normalizeData().

◆ getAccessToken()

MastodonHandler::getAccessToken ( )

Getter for access token.

Returns
string token

Definition at line 208 of file mastodonhandler.class.php.

◆ getClientId()

MastodonHandler::getClientId ( )

Getter for client Id.

Returns
string client Id

Definition at line 217 of file mastodonhandler.class.php.

◆ getClientSecret()

MastodonHandler::getClientSecret ( )

Getter for secret client.

Returns
string secret client

Definition at line 226 of file mastodonhandler.class.php.

◆ getPosts()

MastodonHandler::getPosts ( )

Get the list of retrieved posts.

Returns
array<array{id:string,content:string,created_at:string,url:string,author_name:string,author_avatar?:string}|array{}> Posts fetched from the API

Definition at line 190 of file mastodonhandler.class.php.

◆ getRedirectUri()

MastodonHandler::getRedirectUri ( )

Getter for url to redirect.

Returns
string url

Definition at line 199 of file mastodonhandler.class.php.

◆ normalizeData()

MastodonHandler::normalizeData ( $postData)

Normalize data of retrieved posts.

Parameters
array{content?:string,created_at?:string,url?:string,media_attachments?:array<array{url:string}>}$postData post retrieved
Returns
array{id:string,content:string,created_at:string,url:string,media_url:string}|array{} return array with normalized postData

Definition at line 160 of file mastodonhandler.class.php.

References formatDate().


The documentation for this class was generated from the following file: