API: Some more apps are now supported

This commit is contained in:
Michael 2021-06-10 19:10:33 +00:00
parent 328788abe9
commit 945f482ba3
5 changed files with 18 additions and 9 deletions

View file

@ -46,7 +46,7 @@ class Conversation extends BaseDataTransferObject
public function __construct(string $id, array $accounts, bool $unread, \Friendica\Object\Api\Mastodon\Status $last_status)
{
$this->id = $id;
$this->id = (string)$id;
$this->accounts = $accounts;
$this->unread = $unread;
$this->last_status = $last_status;

View file

@ -39,6 +39,8 @@ class Instance extends BaseDataTransferObject
/** @var string */
protected $title;
/** @var string */
protected $short_description;
/** @var string */
protected $description;
/** @var string */
protected $email;
@ -58,8 +60,12 @@ class Instance extends BaseDataTransferObject
protected $registrations;
/** @var bool */
protected $approval_required;
/** @var bool */
protected $invites_enabled;
/** @var Account|null */
protected $contact_account = null;
/** @var array */
protected $rules = [];
/**
* Creates an instance record
@ -77,7 +83,7 @@ class Instance extends BaseDataTransferObject
$instance = new Instance();
$instance->uri = $baseUrl->get();
$instance->title = DI::config()->get('config', 'sitename');
$instance->description = DI::config()->get('config', 'info');
$instance->short_description = $instance->description = DI::config()->get('config', 'info');
$instance->email = DI::config()->get('config', 'admin_email');
$instance->version = FRIENDICA_VERSION;
$instance->urls = null; // Not supported
@ -87,6 +93,7 @@ class Instance extends BaseDataTransferObject
$instance->max_toot_chars = (int)DI::config()->get('config', 'api_import_size', DI::config()->get('config', 'max_import_size'));
$instance->registrations = ($register_policy != Register::CLOSED);
$instance->approval_required = ($register_policy == Register::APPROVE);
$instance->invites_enabled = false;
$instance->contact_account = [];
if (!empty(DI::config()->get('config', 'admin_email'))) {

View file

@ -50,7 +50,7 @@ class Mention extends BaseDataTransferObject
*/
public function __construct(BaseURL $baseUrl, array $tag, array $contact)
{
$this->id = $contact['id'] ?? 0;
$this->id = (string)($contact['id'] ?? 0);
$this->username = $tag['name'];
$this->url = $tag['url'];
@ -59,6 +59,8 @@ class Mention extends BaseDataTransferObject
strpos($contact['url'], $baseUrl->get() . '/') === 0 ?
$contact['nick'] :
$contact['addr'];
$this->username = $contact['nick'];
} else {
$this->acct = '';
}

View file

@ -79,7 +79,7 @@ class Relationship extends BaseDataTransferObject
*/
public function __construct(int $contactId, array $contactRecord = [], bool $blocked = false, bool $muted = false)
{
$this->id = $contactId;
$this->id = (string)$contactId;
$this->following = false;
$this->requested = false;
$this->endorsed = false;