API: First steps to support subscriptions

This commit is contained in:
Michael 2021-08-15 00:30:41 +00:00
commit e28a4265c5
18 changed files with 416 additions and 20 deletions

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1433);
define('DB_UPDATE_VERSION', 1434);
}
return [
@ -1492,6 +1492,29 @@ return [
"PRIMARY" => ["id"]
]
],
"subscription" => [
"comment" => "Push Subscription for the API",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
"application-id" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["application" => "id"], "comment" => ""],
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
"endpoint" => ["type" => "varchar(511)", "comment" => "Endpoint URL"],
"pubkey" => ["type" => "varchar(127)", "comment" => "User agent public key"],
"secret" => ["type" => "varchar(32)", "comment" => "Auth secret"],
"follow" => ["type" => "boolean", "comment" => ""],
"favourite" => ["type" => "boolean", "comment" => ""],
"reblog" => ["type" => "boolean", "comment" => ""],
"mention" => ["type" => "boolean", "comment" => ""],
"poll" => ["type" => "boolean", "comment" => ""],
"follow_request" => ["type" => "boolean", "comment" => ""],
"status" => ["type" => "boolean", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
"application-id_uid" => ["UNIQUE", "application-id", "uid"],
"uid_application-id" => ["uid", "application-id"],
]
],
"userd" => [
"comment" => "Deleted usernames",
"fields" => [

View file

@ -126,7 +126,7 @@ return [
'/polls/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]],
'/push/subscription' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::PUT, R::DELETE]], // not supported
'/push/subscription' => [Module\Api\Mastodon\PushSubscription::class, [R::GET, R::POST, R::PUT, R::DELETE]],
'/reports' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/scheduled_statuses' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET ]],
'/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET, R::PUT, R::DELETE]],