mirror of
https://github.com/friendica/friendica
synced 2025-04-26 09:50:15 +00:00
Merge branch 'develop' into dislike-for-mastodon-endpoints
This commit is contained in:
commit
9c9abd4400
13 changed files with 696 additions and 2 deletions
|
@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
|
|||
/**
|
||||
* Class Instance
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/api/entities/#instance
|
||||
* @see https://docs.joinmastodon.org/entities/V1_Instance/
|
||||
*/
|
||||
class Instance extends BaseDataTransferObject
|
||||
{
|
||||
|
|
108
src/Object/Api/Mastodon/InstanceV2.php
Normal file
108
src/Object/Api/Mastodon/InstanceV2.php
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Configuration;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Contact;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\FriendicaExtensions;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Registrations;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Thumbnail;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Usage;
|
||||
|
||||
/**
|
||||
* Class Instance
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class InstanceV2 extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
protected $domain;
|
||||
/** @var string */
|
||||
protected $title;
|
||||
/** @var string */
|
||||
protected $version;
|
||||
/** @var string */
|
||||
protected $source_url;
|
||||
/** @var string */
|
||||
protected $description;
|
||||
/** @var Usage */
|
||||
protected $usage;
|
||||
/** @var Thumbnail */
|
||||
protected $thumbnail;
|
||||
/** @var array */
|
||||
protected $languages;
|
||||
/** @var Configuration */
|
||||
protected $configuration;
|
||||
/** @var Registrations */
|
||||
protected $registrations;
|
||||
/** @var Contact */
|
||||
protected $contact;
|
||||
/** @var array */
|
||||
protected $rules = [];
|
||||
/** @var FriendicaExtensions */
|
||||
protected $friendica;
|
||||
|
||||
/**
|
||||
* @param string $domain
|
||||
* @param string $title
|
||||
* @param $version
|
||||
* @param string $description
|
||||
* @param Usage $usage
|
||||
* @param Thumbnail $thumbnail
|
||||
* @param array $languages
|
||||
* @param Configuration $configuration
|
||||
* @param Registrations $registrations
|
||||
* @param Contact $contact
|
||||
* @param FriendicaExtensions $friendica_extensions
|
||||
* @param array $rules
|
||||
*/
|
||||
public function __construct(
|
||||
string $domain,
|
||||
string $title,
|
||||
string $version,
|
||||
string $description,
|
||||
Usage $usage,
|
||||
Thumbnail $thumbnail,
|
||||
array $languages,
|
||||
Configuration $configuration,
|
||||
Registrations $registrations,
|
||||
Contact $contact,
|
||||
FriendicaExtensions $friendica_extensions,
|
||||
array $rules
|
||||
) {
|
||||
$this->domain = $domain;
|
||||
$this->title = $title;
|
||||
$this->version = $version;
|
||||
$this->source_url = null; //not supported yet
|
||||
$this->description = $description;
|
||||
$this->usage = $usage;
|
||||
$this->thumbnail = $thumbnail;
|
||||
$this->languages = $languages;
|
||||
$this->configuration = $configuration;
|
||||
$this->registrations = $registrations;
|
||||
$this->contact = $contact;
|
||||
$this->rules = $rules;
|
||||
$this->friendica = $friendica_extensions;
|
||||
}
|
||||
}
|
54
src/Object/Api/Mastodon/InstanceV2/Configuration.php
Normal file
54
src/Object/Api/Mastodon/InstanceV2/Configuration.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Configuration
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Configuration extends BaseDataTransferObject
|
||||
{
|
||||
/** @var StatusesConfig */
|
||||
protected $statuses;
|
||||
/** @var MediaAttachmentsConfig */
|
||||
protected $media_attachments;
|
||||
/** @var int */
|
||||
protected $image_size_limit;
|
||||
|
||||
/**
|
||||
* @param StatusesConfig $statuses
|
||||
* @param MediaAttachmentsConfig $media_attachments
|
||||
* @param int $image_size_limit
|
||||
*/
|
||||
public function __construct(
|
||||
StatusesConfig $statuses,
|
||||
MediaAttachmentsConfig $media_attachments,
|
||||
int $image_size_limit
|
||||
) {
|
||||
$this->statuses = $statuses;
|
||||
$this->media_attachments = $media_attachments;
|
||||
$this->image_size_limit = $image_size_limit;
|
||||
}
|
||||
}
|
49
src/Object/Api/Mastodon/InstanceV2/Contact.php
Normal file
49
src/Object/Api/Mastodon/InstanceV2/Contact.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
use Friendica\Object\Api\Mastodon\Account;
|
||||
|
||||
/**
|
||||
* Class Contact
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Contact extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
protected $email;
|
||||
/** @var Account|null */
|
||||
protected $account = null;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
* @param Account $account
|
||||
*/
|
||||
public function __construct(string $email, Account $account)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->account = $account;
|
||||
}
|
||||
}
|
53
src/Object/Api/Mastodon/InstanceV2/FriendicaExtensions.php
Normal file
53
src/Object/Api/Mastodon/InstanceV2/FriendicaExtensions.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class FriendicaExtensions
|
||||
*
|
||||
* Friendica specific additional fields on the Instance V2 object
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class FriendicaExtensions extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
protected $version;
|
||||
/** @var string */
|
||||
protected $codename;
|
||||
/** @var int */
|
||||
protected $db_version;
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
* @param string $codename
|
||||
* @param int $db_version
|
||||
*/
|
||||
public function __construct(string $version, string $codename, int $db_version)
|
||||
{
|
||||
$this->version = $version;
|
||||
$this->codename = $codename;
|
||||
$this->db_version = $db_version;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class MediaAttachmentsConfig
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class MediaAttachmentsConfig extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string[] */
|
||||
protected $supported_mime_types;
|
||||
|
||||
/**
|
||||
* @param array $supported_mime_types
|
||||
*/
|
||||
public function __construct(array $supported_mime_types)
|
||||
{
|
||||
$this->supported_mime_types = $supported_mime_types;
|
||||
}
|
||||
}
|
47
src/Object/Api/Mastodon/InstanceV2/Registrations.php
Normal file
47
src/Object/Api/Mastodon/InstanceV2/Registrations.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Registrations
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Registrations extends BaseDataTransferObject
|
||||
{
|
||||
/** @var bool */
|
||||
protected $enabled;
|
||||
/** @var bool */
|
||||
protected $approval_required;
|
||||
|
||||
/**
|
||||
* @param bool $enabled
|
||||
* @param bool $approval_required
|
||||
*/
|
||||
public function __construct(bool $enabled, bool $approval_required)
|
||||
{
|
||||
$this->enabled = $enabled;
|
||||
$this->approval_required = $approval_required;
|
||||
}
|
||||
}
|
43
src/Object/Api/Mastodon/InstanceV2/StatusesConfig.php
Normal file
43
src/Object/Api/Mastodon/InstanceV2/StatusesConfig.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class StatusConfig
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class StatusesConfig extends BaseDataTransferObject
|
||||
{
|
||||
/** @var int */
|
||||
protected $max_characters = 0;
|
||||
|
||||
/**
|
||||
* @param int $max_characters
|
||||
*/
|
||||
public function __construct(int $max_characters)
|
||||
{
|
||||
$this->max_characters = $max_characters;
|
||||
}
|
||||
}
|
43
src/Object/Api/Mastodon/InstanceV2/Thumbnail.php
Normal file
43
src/Object/Api/Mastodon/InstanceV2/Thumbnail.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Thumbnail
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Thumbnail extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string (URL) */
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*/
|
||||
public function __construct(string $url)
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
}
|
43
src/Object/Api/Mastodon/InstanceV2/Usage.php
Normal file
43
src/Object/Api/Mastodon/InstanceV2/Usage.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Usage
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Usage extends BaseDataTransferObject
|
||||
{
|
||||
/** @var UserStats */
|
||||
protected $users;
|
||||
|
||||
/**
|
||||
* @param UserStats $users
|
||||
*/
|
||||
public function __construct(UserStats $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
}
|
43
src/Object/Api/Mastodon/InstanceV2/UserStats.php
Normal file
43
src/Object/Api/Mastodon/InstanceV2/UserStats.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, 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\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class UserStats
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class UserStats extends BaseDataTransferObject
|
||||
{
|
||||
/** @var int */
|
||||
protected $active_monthly = 0;
|
||||
|
||||
/**
|
||||
* @param $active_monthly
|
||||
*/
|
||||
public function __construct($active_monthly)
|
||||
{
|
||||
$this->active_monthly = $active_monthly;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue