Overview

Namespaces

  • Baguette
    • Mastodon
      • Config
      • Entity
      • Grant
      • Service
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
  • Psr
    • Http
      • Message
  • Teto
    • Object

Classes

  • Baguette\Mastodon\Client
  • Baguette\Mastodon\Config\DotEnvStorage
  • Baguette\Mastodon\Entity\Account
  • Baguette\Mastodon\Entity\Application
  • Baguette\Mastodon\Entity\Attachment
  • Baguette\Mastodon\Entity\Card
  • Baguette\Mastodon\Entity\Context
  • Baguette\Mastodon\Entity\Entity
  • Baguette\Mastodon\Entity\Error_
  • Baguette\Mastodon\Entity\Instance
  • Baguette\Mastodon\Entity\Mention
  • Baguette\Mastodon\Entity\Notification
  • Baguette\Mastodon\Entity\Status
  • Baguette\Mastodon\Entity\Tag
  • Baguette\Mastodon\EntityCaster
  • Baguette\Mastodon\Grant\CodeGrant
  • Baguette\Mastodon\Grant\Grant
  • Baguette\Mastodon\Grant\NoopGrant
  • Baguette\Mastodon\Grant\PasswordCredential
  • Baguette\Mastodon\Mastodon
  • Baguette\Mastodon\Requester
  • Baguette\Mastodon\Service\AuthFactory
  • Baguette\Mastodon\Service\Authorization
  • Baguette\Mastodon\Service\Scope
  • Baguette\Mastodon\Service\SessionStorage
  • Baguette\Mastodon\Service\Toot

Interfaces

  • Baguette\Mastodon\Config\Storage

Exceptions

  • Baguette\Mastodon\Service\AuthorizationException

Constants

  • Baguette\Mastodon\Entity\DATETIME_FORMAT

Functions

  • Baguette\Mastodon\authorization
  • Baguette\Mastodon\credential
  • Baguette\Mastodon\Entity\map
  • Baguette\Mastodon\Entity\mapValues
  • Baguette\Mastodon\Entity\toArrayValue
  • Baguette\Mastodon\grant
  • Baguette\Mastodon\http
  • Baguette\Mastodon\request
  • Baguette\Mastodon\scope
  • Baguette\Mastodon\session
  • Baguette\Mastodon\toot
  • Overview
  • Namespace
  • Class
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 
<?php

namespace Baguette\Mastodon\Entity;

/**
 * Status
 *
 * @author    USAMI Kenta <tadsan@zonu.me>
 * @copyright 2017 Baguette HQ
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
 * @see https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#status
 * @property-read int      $id  The ID of the status
 * @property-read string   $uri A Fediverse-unique resource ID
 * @property-read string   $url URL to the status page (can be remote)
 * @property-read Account  $account The Account which posted the status
 * @property-read Attachments[] $media_attachments The Account which posted the status
 * @property-read int|null $in_reply_to_accountid  The ID of the status it replies to
 * @property-read int|null $in_reply_to_id The ID of the account it replies to
 * @property-read Status|null $reblog The reblogged Status
 * @property-read string   $content   Body of the status; this will contain HTML (remote HTML already sanitized)
 * @property-read \DateTimeImmutable $created_at The time the status was created
 * @property-read int    $reblogs_count    The number of reblogs for the status
 * @property-read int    $favourites_count The number of favourites for the status
 * @property-read bool   $reblogged    Whether the authenticated user has reblogged the status
 * @property-read bool   $favourited   Whether the authenticated user has favourited the status
 * @property-read string $sensitive    Whether media attachments should be hidden by default
 * @property-read string $spoiler_text If not empty, warning text that should be displayed before the actual content
 * @property-read string $visibility   One of: public, unlisted, private, direct
 * @property-read Attachment[] $media_attachments An array of Attachments
 * @property-read Mention[]    $mentions An array of Mentions
 * @property-read Tag[]        $tags     An array of Tags
 * @property-read Application  $application Application from which the status was posted
 */
class Status extends Entity
{
    use \Teto\Object\TypedProperty;

    private static $property_types = [
        'id'                => 'int',
        'uri'               => 'string',
        'url'               => 'string',
        'account'           => Account::class,
        'in_reply_to_id'    => '?int',
        'in_reply_to_account_id' => '?int',
        'reblog'            => Status::class,
        'content'           => 'string',
        'created_at'        => \DateTimeImmutable::class,
        'reblogs_count'     => 'int',
        'favourites_count'  => 'int',
        'reblogged'         => 'bool',
        'favourited'        => 'bool',
        'sensitive'         => 'bool',
        'spoiler_text'      => 'string',
        'visibility'        => 'enum',
        'media_attachments' => 'Baguette\Mastodon\Entity\Attachment[]',
        'mentions'          => 'Baguette\Mastodon\Entity\Mention[]',
        'tags'              => 'Baguette\Mastodon\Entity\Tag[]',
        'application'       => Application::class,
    ];

    private static $enum_values = [
        'visibility' => ['direct', 'private', 'unlisted', 'public'],
    ];

    public function __construct(array $properties)
    {
        $this->setProperties(mapValues($properties, [
            'account'           => Account::class,
            'reblog'            => Status::class,
            'created_at'        => \DateTimeImmutable::class,
            'media_attachments' => [Attachment::class],
            'mentions'          => [Mention::class],
            'tags'              => [Tag::class],
            'application'       => Application::class,
        ]));
    }

    /**
     * Returns account data as array
     *
     * @return array
     */
    public function toArray()
    {
        return [
            'id'                => $this->id,
            'uri'               => $this->uri,
            'url'               => $this->url,
            'account'           => toArrayValue($this->account),
            'in_reply_to_id'    => $this->in_reply_to_id,
            'in_reply_to_account_id' => $this->in_reply_to_account_id,
            'reblog'            => toArrayValue($this->reblog),
            'content'           => $this->content,
            'created_at'        => toArrayValue($this->created_at),
            'reblogs_count'     => $this->reblogs_count,
            'favourites_count'  => $this->favourites_count,
            'reblogged'         => $this->reblogged,
            'favourited'        => $this->favourited,
            'sensitive'         => $this->sensitive,
            'spoiler_text'      => $this->spoiler_text,
            'visibility'        => $this->visibility,
            'media_attachments' => toArrayValue($this->media_attachments),
            'mentions'          => toArrayValue($this->mentions),
            'tags'              => toArrayValue($this->tags),
            'application'       => toArrayValue($this->application),
        ];
    }
}
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by ApiGen