mirror of
https://github.com/friendica/friendica
synced 2025-04-25 03:50:12 +00:00
API: added account related endpoints
This commit is contained in:
parent
6511493fdf
commit
5bb5c44bd9
16 changed files with 599 additions and 13 deletions
51
src/Object/Api/Mastodon/ListEntity.php
Normal file
51
src/Object/Api/Mastodon/ListEntity.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Object\Api\Mastodon;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class ListEntity
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/list/
|
||||
*/
|
||||
class ListEntity extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
protected $id;
|
||||
/** @var string */
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Creates an list record
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function __construct(int $id, string $title, string $policy)
|
||||
{
|
||||
$this->id = (string)$id;
|
||||
$this->title = $title;
|
||||
$this->replies_policy = $policy;
|
||||
}
|
||||
}
|
67
src/Object/Api/Mastodon/Preferences.php
Normal file
67
src/Object/Api/Mastodon/Preferences.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Object\Api\Mastodon;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\BaseDataTransferObject;
|
||||
use Friendica\Collection\Api\Mastodon\Fields;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
/**
|
||||
* Class Preferences
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/preferences/
|
||||
*/
|
||||
class Preferences extends BaseDataTransferObject
|
||||
{
|
||||
// /** @var string (Enumerable, oneOf) */
|
||||
// protected $posting_default_visibility;
|
||||
// /** @var bool */
|
||||
// protected $posting_default_sensitive;
|
||||
// /** @var string (ISO 639-1 language two-letter code), or null*/
|
||||
// protected $posting_default_language;
|
||||
// /** @var string (Enumerable, oneOf) */
|
||||
// protected $reading_expand_media;
|
||||
// /** @var bool */
|
||||
// protected $reading_expand_spoilers;
|
||||
|
||||
/**
|
||||
* Creates a preferences record.
|
||||
*
|
||||
* @param BaseURL $baseUrl
|
||||
* @param array $publicContact Full contact table record with uid = 0
|
||||
* @param array $apcontact Optional full apcontact table record
|
||||
* @param array $userContact Optional full contact table record with uid != 0
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function __construct(string $visibility, bool $sensitive, string $language, string $media, bool $spoilers)
|
||||
{
|
||||
$this->{'posting:default:visibility'} = $visibility;
|
||||
$this->{'posting:default:sensitive'} = $sensitive;
|
||||
$this->{'posting:default:language'} = $language;
|
||||
$this->{'reading:expand:media'} = $media;
|
||||
$this->{'reading:expand:spoilers'} = $spoilers;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue