Add visibility to user's statuses in Mastodon API

- and remove view count object if not user's status
This commit is contained in:
Hank Grabowski 2023-03-20 17:42:08 -04:00
parent 0b1f67f5b3
commit 97585083d9
3 changed files with 68 additions and 8 deletions

View file

@ -45,14 +45,18 @@ class FriendicaExtension extends BaseDataTransferObject
/** @var string|null (Datetime) */
protected $received_at;
/** @var FriendicaDeliveryData */
/** @var FriendicaDeliveryData|null */
protected $delivery_data;
/** @var int */
protected $dislikes_count;
/**
* @var FriendicaVisibility|null
*/
protected $visibility;
/**
* Creates a status count object
* Creates a FriendicaExtension object
*
* @param string $title
* @param string|null $changed_at
@ -60,7 +64,8 @@ class FriendicaExtension extends BaseDataTransferObject
* @param string|null $edited_at
* @param string|null $received_at
* @param int $dislikes_count
* @param FriendicaDeliveryData $delivery_data
* @param FriendicaDeliveryData|null $delivery_data
* @param FriendicaVisibility|null $visibility
*/
public function __construct(
string $title,
@ -68,7 +73,8 @@ class FriendicaExtension extends BaseDataTransferObject
?string $commented_at,
?string $received_at,
int $dislikes_count,
FriendicaDeliveryData $delivery_data
?FriendicaDeliveryData $delivery_data,
?FriendicaVisibility $visibility
) {
$this->title = $title;
$this->changed_at = $changed_at ? DateTimeFormat::utc($changed_at, DateTimeFormat::JSON) : null;
@ -76,6 +82,7 @@ class FriendicaExtension extends BaseDataTransferObject
$this->received_at = $received_at ? DateTimeFormat::utc($received_at, DateTimeFormat::JSON) : null;
$this->delivery_data = $delivery_data;
$this->dislikes_count = $dislikes_count;
$this->visibility = $visibility;
}
/**

View file

@ -0,0 +1,51 @@
<?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\Status;
use Friendica\BaseDataTransferObject;
/**
* Class FriendicaVisibility
*
* Fields for the user's visibility settings on a post if they own that post
*
* @see https://docs.joinmastodon.org/entities/status
*/
class FriendicaVisibility extends BaseDataTransferObject
{
/** @var string|null */
protected $allow_cid;
/** @var string|null */
protected $deny_cid;
/** @var string|null */
protected $allow_gid;
/** @var string|null */
protected $deny_gid;
public function __construct(?string $allow_cid, ?string $deny_cid, ?string $allow_gid, ?string $deny_gid)
{
$this->allow_cid = $allow_cid;
$this->deny_cid = $deny_cid;
$this->allow_gid = $allow_gid;
$this->deny_gid = $deny_gid;
}
}