1 | <?php |
||
2 | |||
3 | namespace seregazhuk\PinterestBot\Api\Providers; |
||
4 | |||
5 | use seregazhuk\PinterestBot\Helpers\Pagination; |
||
6 | use seregazhuk\PinterestBot\Helpers\UrlBuilder; |
||
7 | use seregazhuk\PinterestBot\Api\Traits\HasRelatedTopics; |
||
8 | use seregazhuk\PinterestBot\Api\Providers\Core\FollowableProvider; |
||
9 | |||
10 | class Topics extends FollowableProvider |
||
11 | { |
||
12 | use HasRelatedTopics; |
||
13 | |||
14 | protected $followUrl = UrlBuilder::RESOURCE_FOLLOW_INTEREST; |
||
15 | protected $unFollowUrl = UrlBuilder::RESOURCE_UNFOLLOW_INTEREST; |
||
16 | |||
17 | protected $entityIdName = 'interest_id'; |
||
18 | |||
19 | /** |
||
20 | * Get category info |
||
21 | * |
||
22 | * @param string $topic |
||
23 | * @return array|bool |
||
24 | */ |
||
25 | public function info($topic) |
||
26 | { |
||
27 | return $this->get(UrlBuilder::RESOURCE_GET_TOPIC, ['interest' => $topic]); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Returns a feed of pins. |
||
32 | * |
||
33 | * @param string $interest |
||
34 | * @param int $limit |
||
35 | * @return Pagination |
||
36 | */ |
||
37 | public function pins($interest, $limit = Pagination::DEFAULT_LIMIT) |
||
38 | { |
||
39 | $data = [ |
||
40 | 'interest' => $interest, |
||
41 | 'pins_only' => false, |
||
42 | ]; |
||
43 | |||
44 | return $this->paginate(UrlBuilder::RESOURCE_GET_TOPIC_FEED, $data, $limit); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Returns an array of trending topics from http://pinterest.com/discover page. Then |
||
49 | * you can use an id of each topic to get trending pins for this topic with |
||
50 | * $bot->pins->explore() method. |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | public function explore() |
||
55 | { |
||
56 | $data = [ |
||
57 | 'aux_fields' => [], |
||
58 | 'offset' => 180, |
||
59 | ]; |
||
60 | |||
61 | return $this->get(UrlBuilder::RESOURCE_EXPLORE_SECTIONS, $data); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
62 | } |
||
63 | } |
||
64 |