ActivityPubFollowRequests.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. // {{{ License
  3. // This file is part of GNU social - https://www.gnu.org/software/social
  4. //
  5. // GNU social is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Affero General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // GNU social is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Affero General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  17. // }}}
  18. /**
  19. * ActivityPub's Pending follow requests
  20. *
  21. * @category Plugin
  22. * @package GNUsocial
  23. *
  24. * @author Diogo Cordeiro <diogo@fc.up.pt>
  25. * @author Hugo Sales <hugo@fc.up.pt>
  26. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  27. */
  28. namespace Plugin\ActivityPub\Entity;
  29. class ActivityPubFollowRequests
  30. {
  31. // {{{ Autocode
  32. private int $local_gsactor_id;
  33. private int $remote_gsactor_id;
  34. private int $relation_id;
  35. public function setLocalGsactorId(int $local_gsactor_id): self
  36. {
  37. $this->local_gsactor_id = $local_gsactor_id;
  38. return $this;
  39. }
  40. public function getLocalGsactorId(): int
  41. {
  42. return $this->local_gsactor_id;
  43. }
  44. public function setRemoteGsactorId(int $remote_gsactor_id): self
  45. {
  46. $this->remote_gsactor_id = $remote_gsactor_id;
  47. return $this;
  48. }
  49. public function getRemoteGsactorId(): int
  50. {
  51. return $this->remote_gsactor_id;
  52. }
  53. public function setRelationId(int $relation_id): self
  54. {
  55. $this->relation_id = $relation_id;
  56. return $this;
  57. }
  58. public function getRelationId(): int
  59. {
  60. return $this->relation_id;
  61. }
  62. // }}} Autocode
  63. public static function schemaDef()
  64. {
  65. return [
  66. 'name' => 'activitypub_pending_follow_requests',
  67. 'fields' => [
  68. 'local_gsactor_id' => ['type' => 'int', 'not null' => true],
  69. 'remote_gsactor_id' => ['type' => 'int', 'not null' => true],
  70. 'relation_id' => ['type' => 'serial', 'not null' => true],
  71. ],
  72. 'primary key' => ['relation_id'],
  73. 'foreign keys' => [
  74. 'activitypub_pending_follow_requests_local_gsactor_id_fkey' => ['gsactor', ['local_gsactor_id' => 'id']],
  75. 'activitypub_pending_follow_requests_remote_gsactor_id_fkey' => ['gsactor', ['remote_gsactor_id' => 'id']],
  76. ],
  77. 'indexes' => [
  78. 'activitypub_pending_follow_requests_local_gsactor_id_idx' => ['local_gsactor_id'],
  79. 'activitypub_pending_follow_requests_remote_gsactor_id_idx' => ['remote_gsactor_id'],
  80. ],
  81. ];
  82. }
  83. }