dolibarr 21.0.0-alpha
FediverseParser Class Reference

Class to parse Fediverse files. More...

Public Member Functions

 __construct ($platform)
 Constructor.
 
 parser ($urlAPI, $maxNb=5, $cacheDelay=60, $cacheDir='')
 Parse Fediverse API to retrieve posts.
 
 getPosts ()
 Get the list of retrieved posts.
 
 getLastFetchDate ()
 Get the last fetch date.
 

Detailed Description

Class to parse Fediverse files.

Definition at line 31 of file fediverseparser.class.php.

Constructor & Destructor Documentation

◆ __construct()

FediverseParser::__construct ( $platform)

Constructor.

Parameters
string$platformname of social network

Definition at line 53 of file fediverseparser.class.php.

Member Function Documentation

◆ getLastFetchDate()

FediverseParser::getLastFetchDate ( )

Get the last fetch date.

Returns
int|string Timestamp of the last successful fetch.

Definition at line 100 of file fediverseparser.class.php.

◆ getPosts()

FediverseParser::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 90 of file fediverseparser.class.php.

◆ parser()

FediverseParser::parser ( $urlAPI,
$maxNb = 5,
$cacheDelay = 60,
$cacheDir = '' )

Parse Fediverse API to retrieve posts.

Parameters
string$urlAPIURL of the Fediverse API.
int$maxNbMaximum number of posts to retrieve (default is 5).
int$cacheDelayNumber of seconds to use cached data (0 to disable caching).
string$cacheDirDirectory to store cached data.
Returns
int Status code: <0 if error, >0 if success.

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


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