Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -20,6 +20,7 @@ use IPS\Content\Item;
|
||||
use IPS\Content\Reportable;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\IPS;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Notification;
|
||||
@@ -229,4 +230,32 @@ class Message extends Comment
|
||||
|
||||
parent::move( $item );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output for API
|
||||
*
|
||||
* @param Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @return array
|
||||
* @apiresponse int id ID number
|
||||
* @apiresponse int item_id The ID number of the item this belongs to
|
||||
* @apiresponse \IPS\Member author Author
|
||||
* @apiresponse datetime date Date
|
||||
* @apiresponse string content The content
|
||||
* @apiresponse string url URL to content
|
||||
*/
|
||||
public function apiOutput( Member|null $authorizedMember = NULL ): array
|
||||
{
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$itemColumn = static::$databaseColumnMap['item'];
|
||||
$return = array(
|
||||
'id' => $this->$idColumn,
|
||||
'item_id' => $this->$itemColumn,
|
||||
'author' => $this->author()->apiOutput( $authorizedMember ),
|
||||
'date' => DateTime::ts( $this->mapped('date') )->rfc3339(),
|
||||
'content' => $this->content(),
|
||||
'url' => (string) $this->url()
|
||||
);
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user