-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from akirk/break-out/status
Add basic status entities
- Loading branch information
Showing
4 changed files
with
576 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Application entity. | ||
* | ||
* This contains the Application entity. | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
|
||
namespace Enable_Mastodon_Apps\Entity; | ||
|
||
/** | ||
* This is the class that implements the Application entity. | ||
* | ||
* @since 0.7.0 | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
class Application extends Entity { | ||
protected $_types = array( | ||
'name' => 'string', | ||
'client_id' => 'string', | ||
'client_secret' => 'string', | ||
|
||
'website' => 'string?', | ||
); | ||
|
||
/** | ||
* The name of the application. | ||
* | ||
* @var string | ||
*/ | ||
public string $name = ''; | ||
|
||
/** | ||
* Client ID key, to be used for obtaining OAuth tokens. | ||
* | ||
* @var string | ||
*/ | ||
public string $client_id = ''; | ||
|
||
/** | ||
* Client secret key, to be used for obtaining OAuth tokens. | ||
* | ||
* @var string | ||
*/ | ||
public string $client_secret = ''; | ||
|
||
/** | ||
* The website associated with your application. | ||
* | ||
* @var null|string | ||
*/ | ||
public ?string $website = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
/** | ||
* Poll entity. | ||
* | ||
* This contains the Poll entity. | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
|
||
namespace Enable_Mastodon_Apps\Entity; | ||
|
||
/** | ||
* This is the class that implements the Poll entity. | ||
* | ||
* @since 0.7.0 | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
class Poll extends Entity { | ||
protected $_types = array( | ||
'id' => 'string', | ||
|
||
'expires_at' => 'string?', | ||
|
||
'expired' => 'bool', | ||
'multiple' => 'bool', | ||
'voted' => 'bool', | ||
|
||
'votes_count' => 'int', | ||
|
||
'voters_count' => 'int?', | ||
|
||
'options' => 'array', | ||
'emojis' => 'array', | ||
'own_votes' => 'array', | ||
); | ||
|
||
/** | ||
* The ID of the poll in the database | ||
* | ||
* @var string | ||
*/ | ||
public string $id; | ||
|
||
/** | ||
* When the poll ends. | ||
* | ||
* @var null|string | ||
*/ | ||
public ?string $expires_at; | ||
|
||
/** | ||
* Is the poll currently expired? | ||
* | ||
* @var bool | ||
*/ | ||
public bool $expired; | ||
|
||
/** | ||
* Does the poll allow multiple-choice answers? | ||
* | ||
* @var bool | ||
*/ | ||
public bool $multiple; | ||
|
||
/** | ||
* How many votes have been received. | ||
* | ||
* @var int | ||
*/ | ||
public int $votes_count; | ||
|
||
/** | ||
* How many unique accounts have voted on a multiple-choice poll. | ||
* TODO: validate whether null is only returned if $multiple is false | ||
* | ||
* @var null|int | ||
*/ | ||
public ?int $voters_count = 0; | ||
|
||
/** | ||
* Possible answers for the poll. | ||
* TODO: implement as list of Poll_Option objects | ||
* | ||
* @var array | ||
*/ | ||
public array $options; | ||
|
||
/** | ||
* Custom emoji to be used for rendering poll options. | ||
* TODO: implement as list of CustomEmoji objects | ||
* | ||
* @var array | ||
*/ | ||
public array $emojis; | ||
|
||
/** | ||
* When called with a user token, has the authorized user voted? | ||
* | ||
* @var bool | ||
*/ | ||
public bool $voted = false; | ||
|
||
/** | ||
* When called with a user token, which options has the authorized user chosen? | ||
* TODO: validate if all items are integers | ||
* | ||
* @var int[] | ||
*/ | ||
public array $own_votes = array(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?php | ||
/** | ||
* Preview Card entity. | ||
* | ||
* This contains the Preview Card entity. | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
|
||
namespace Enable_Mastodon_Apps\Entity; | ||
|
||
/** | ||
* This is the class that implements the Preview Card entity. | ||
* | ||
* @since 0.7.0 | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
class Preview_Card extends Entity { | ||
protected $_types = array( | ||
'url' => 'string', | ||
'title' => 'string', | ||
'description' => 'string', | ||
'type' => 'string', | ||
'author_name' => 'string', | ||
'author_url' => 'string', | ||
'provider_name' => 'string', | ||
'provider_url' => 'string', | ||
'html' => 'string', | ||
'embed_url' => 'string', | ||
|
||
'blurhash' => 'string?', | ||
'image' => 'string?', | ||
|
||
'width' => 'int', | ||
'height' => 'int', | ||
); | ||
|
||
/** | ||
* Location of linked resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $url; | ||
|
||
/** | ||
* Title of linked resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $title; | ||
|
||
/** | ||
* Description of preview. | ||
* | ||
* @var string | ||
*/ | ||
public string $description; | ||
|
||
/** | ||
* The type of the preview card. | ||
* | ||
* @var string | ||
*/ | ||
public string $type; | ||
|
||
/** | ||
* The author of the original resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $author_name; | ||
|
||
/** | ||
* A link to the author of the original resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $author_url; | ||
|
||
/** | ||
* The provider of the original resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $provider_name; | ||
|
||
/** | ||
* A link to the provider of the original resource. | ||
* | ||
* @var string | ||
*/ | ||
public string $provider_url; | ||
|
||
/** | ||
* HTML to be used for generating the preview card. | ||
* | ||
* @var string | ||
*/ | ||
public string $html; | ||
|
||
/** | ||
* Used for photo embeds, instead of custom html. | ||
* | ||
* @var string | ||
*/ | ||
public string $embed_url; | ||
|
||
/** | ||
* A hash for generating colorful preview thumbnails when media has not been | ||
* downloaded yet. | ||
* | ||
* @var null|string | ||
*/ | ||
public ?string $blurhash = null; | ||
|
||
/** | ||
* Preview thumbnail. | ||
* | ||
* @var null|string | ||
*/ | ||
public ?string $image = null; | ||
|
||
/** | ||
* Width of preview, in pixels. | ||
* | ||
* @var int | ||
*/ | ||
public int $width; | ||
|
||
/** | ||
* Height of preview, in pixels. | ||
* | ||
* @var int | ||
*/ | ||
public int $height; | ||
} |
Oops, something went wrong.