Added User API endpoints.
This commit is contained in:
@@ -15,6 +15,7 @@ use Exception;
|
||||
use lasselehtinen\Issuu\Issuu;
|
||||
use lasselehtinen\Issuu\Publications;
|
||||
use OgreIssuu\Api\Publications as ApiPublications;
|
||||
use OgreIssuu\Api\User;
|
||||
|
||||
class Api {
|
||||
use Singleton;
|
||||
@@ -26,6 +27,18 @@ class Api {
|
||||
$this->client = new Issuu(Settings::get('token'));
|
||||
}
|
||||
|
||||
public function get_user():?stdClass {
|
||||
if (!isset($this->client)) return null;
|
||||
|
||||
$user = new User($this->client);
|
||||
try {
|
||||
return $user->getUserProfile();
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_publications(array $args = []):?stdClass {
|
||||
if (!isset($this->client)) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user