Added User API endpoints.

This commit is contained in:
dcooperdalrymple
2024-09-12 17:30:01 -05:00
parent aab8db5400
commit d2ff1e0303
3 changed files with 71 additions and 0 deletions

View File

@@ -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;