1 | <?php |
||
9 | class FacebookPosterPost |
||
10 | { |
||
11 | /** @var string */ |
||
12 | protected $content; |
||
13 | |||
14 | /** @object FacebookPosterLink */ |
||
15 | protected $link; |
||
16 | |||
17 | /** @object FacebookPosterImage */ |
||
18 | protected $image; |
||
19 | |||
20 | /** @object FacebookPosterVideo */ |
||
21 | protected $video; |
||
22 | |||
23 | /** @var array */ |
||
24 | protected $params; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $apiEndpoint = 'me/feed'; |
||
30 | |||
31 | 4 | public function __construct($postContent) |
|
35 | |||
36 | /** |
||
37 | * Get Post content. |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | 4 | public function getContent() |
|
45 | |||
46 | /** |
||
47 | * Set facebook post main link. |
||
48 | * |
||
49 | * @param string $link |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | 1 | public function withLink($link) |
|
59 | |||
60 | /** |
||
61 | * Set facebook post image. |
||
62 | * |
||
63 | * @param $imagePath |
||
64 | * @param string $endpoint |
||
65 | * |
||
66 | * @return $this |
||
67 | */ |
||
68 | 1 | public function withImage($imagePath, $endpoint = 'me/photos') |
|
74 | |||
75 | /** |
||
76 | * Set facebook post image. |
||
77 | * |
||
78 | * @param $videoPath |
||
79 | * @param array $data |
||
80 | * @param string $endpoint |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | 1 | public function withVideo($videoPath, $data = [], $endpoint = 'me/videos') |
|
98 | |||
99 | /** |
||
100 | * Schedule the post for a date in the future. |
||
101 | * |
||
102 | * @param string $timestamp UNIX timestamp |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function scheduledFor($timestamp) |
||
113 | |||
114 | /** |
||
115 | * Return Facebook Post api endpoint. |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 4 | public function getApiEndpoint() |
|
123 | |||
124 | /** |
||
125 | * Build Facebook post request body. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 4 | public function getPostBody() |
|
153 | } |
||
154 |