1 | <?php |
||
13 | class Boards extends FollowableProvider |
||
14 | { |
||
15 | use CanBeDeleted, Searchable, SendsMessages, ResolvesCurrentUsername; |
||
16 | |||
17 | const BOARD_PRIVACY_PUBLIC = 'public'; |
||
18 | const BOARD_PRIVACY_PRIVATE = 'secret'; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $loginRequiredFor = [ |
||
24 | 'my', |
||
25 | 'send', |
||
26 | 'delete', |
||
27 | 'create', |
||
28 | 'follow', |
||
29 | 'invites', |
||
30 | 'unFollow', |
||
31 | ]; |
||
32 | |||
33 | protected $searchScope = 'boards'; |
||
34 | protected $entityIdName = 'board_id'; |
||
35 | protected $followersFor = 'board_id'; |
||
36 | |||
37 | protected $followUrl = UrlBuilder::RESOURCE_FOLLOW_BOARD; |
||
38 | protected $unFollowUrl = UrlBuilder::RESOURCE_UNFOLLOW_BOARD; |
||
39 | protected $deleteUrl = UrlBuilder::RESOURCE_DELETE_BOARD; |
||
40 | protected $followersUrl = UrlBuilder::RESOURCE_BOARD_FOLLOWERS; |
||
41 | |||
42 | protected $messageEntityName = 'board'; |
||
43 | |||
44 | /** |
||
45 | * Get boards for user by username. |
||
46 | * |
||
47 | * @param string $username |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | public function forUser($username) |
||
62 | |||
63 | /** |
||
64 | * Get boards for current logged in user. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function forMe() |
||
76 | |||
77 | /** |
||
78 | * Get info about user's board. |
||
79 | * |
||
80 | * @param string $username |
||
81 | * @param string $board |
||
82 | * |
||
83 | * @return array|bool |
||
84 | */ |
||
85 | public function info($username, $board) |
||
95 | |||
96 | /** |
||
97 | * @param string $board |
||
98 | * @return string |
||
99 | */ |
||
100 | protected function formatBoardName($board) |
||
104 | |||
105 | /** |
||
106 | * Get pins from board by boardId. |
||
107 | * |
||
108 | * @param int $boardId |
||
109 | * @param int $limit |
||
110 | * |
||
111 | * @return Pagination |
||
112 | */ |
||
113 | public function pins($boardId, $limit = Pagination::DEFAULT_LIMIT) |
||
121 | |||
122 | /** |
||
123 | * Update board info. Gets boardId and an associative array as params. Available keys of the array are: |
||
124 | * 'name', 'category', 'description', 'privacy'. |
||
125 | * |
||
126 | * - 'privacy' can be 'public' or 'secret'. 'public' by default. |
||
127 | * - 'category' is 'other' by default. |
||
128 | * |
||
129 | * @param $boardId |
||
130 | * @param $attributes |
||
131 | * @return mixed |
||
132 | */ |
||
133 | public function update($boardId, $attributes) |
||
144 | |||
145 | /** |
||
146 | * Create a new board. |
||
147 | * |
||
148 | * @param string $name |
||
149 | * @param string $description |
||
150 | * @param string $privacy Can be 'public' or 'secret'. 'public' by default. |
||
151 | * |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function create($name, $description, $privacy = self::BOARD_PRIVACY_PUBLIC) |
||
164 | |||
165 | /** |
||
166 | * Create a new board. |
||
167 | * |
||
168 | * @codeCoverageIgnore |
||
169 | * @param string $name |
||
170 | * @param string $description |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | public function createPrivate($name, $description) |
||
178 | |||
179 | /** |
||
180 | * Returns title suggestions for pin. |
||
181 | * |
||
182 | * @param string $pinId |
||
183 | * @return array|bool |
||
184 | */ |
||
185 | public function titleSuggestionsFor($pinId) |
||
189 | |||
190 | /** |
||
191 | * Get boards invites |
||
192 | * @return array |
||
193 | */ |
||
194 | public function invites() |
||
198 | } |
||
199 |