1<?php
2/**
3 * @package     Joomla.Platform
4 * @subpackage  Facebook
5 *
6 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
7 * @license     GNU General Public License version 2 or later; see LICENSE
8 */
9
10defined('JPATH_PLATFORM') or die();
11
12/**
13 * Facebook API Video class for the Joomla Platform.
14 *
15 * @link        http://developers.facebook.com/docs/reference/api/video/
16 * @since       3.2.0
17 * @deprecated  4.0  Use the `joomla/facebook` package via Composer instead
18 */
19class JFacebookVideo extends JFacebookObject
20{
21	/**
22	 * Method to get a video. Requires authentication and user_videos or friends_videos permission for private videos.
23	 *
24	 * @param   string  $video  The video id.
25	 *
26	 * @return  mixed   The decoded JSON response or false if the client is not authenticated.
27	 *
28	 * @since   3.2.0
29	 */
30	public function getVideo($video)
31	{
32		return $this->get($video);
33	}
34
35	/**
36	 * Method to get a video's comments. Requires authentication and user_videos or friends_videos permission for private videos.
37	 *
38	 * @param   string   $video   The video id.
39	 * @param   integer  $limit   The number of objects per page.
40	 * @param   integer  $offset  The object's number on the page.
41	 * @param   string   $until   A unix timestamp or any date accepted by strtotime.
42	 * @param   string   $since   A unix timestamp or any date accepted by strtotime.
43	 *
44	 * @return  mixed   The decoded JSON response or false if the client is not authenticated.
45	 *
46	 * @since   3.2.0
47	 */
48	public function getComments($video, $limit=0, $offset=0, $until=null, $since=null)
49	{
50		return $this->getConnection($video, 'comments', '', $limit, $offset, $until, $since);
51	}
52
53	/**
54	 * Method to comment on a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
55	 *
56	 * @param   string  $video    The video id.
57	 * @param   string  $message  The comment's text.
58	 *
59	 * @return  mixed   The decoded JSON response or false if the client is not authenticated.
60	 *
61	 * @since   3.2.0
62	 */
63	public function createComment($video, $message)
64	{
65		// Set POST request parameters.
66		$data = array();
67		$data['message'] = $message;
68
69		return $this->createConnection($video, 'comments', $data);
70	}
71
72	/**
73	 * Method to delete a comment. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
74	 *
75	 * @param   string  $comment  The comment's id.
76	 *
77	 * @return  boolean Returns true if successful, and false otherwise.
78	 *
79	 * @since   3.2.0
80	 */
81	public function deleteComment($comment)
82	{
83		return $this->deleteConnection($comment);
84	}
85
86	/**
87	 * Method to get video's likes. Requires authentication and user_videos or friends_videos permission for private videos.
88	 *
89	 * @param   string   $video   The video id.
90	 * @param   integer  $limit   The number of objects per page.
91	 * @param   integer  $offset  The object's number on the page.
92	 * @param   string   $until   A unix timestamp or any date accepted by strtotime.
93	 * @param   string   $since   A unix timestamp or any date accepted by strtotime.
94	 *
95	 * @return  mixed   The decoded JSON response or false if the client is not authenticated.
96	 *
97	 * @since   3.2.0
98	 */
99	public function getLikes($video, $limit=0, $offset=0, $until=null, $since=null)
100	{
101		return $this->getConnection($video, 'likes', '', $limit, $offset, $until, $since);
102	}
103
104	/**
105	 * Method to like a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
106	 *
107	 * @param   string  $video  The video id.
108	 *
109	 * @return  boolean Returns true if successful, and false otherwise.
110	 *
111	 * @since   3.2.0
112	 */
113	public function createLike($video)
114	{
115		return $this->createConnection($video, 'likes');
116	}
117
118	/**
119	 * Method to unlike a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
120	 *
121	 * @param   string  $video  The video id.
122	 *
123	 * @return  boolean Returns true if successful, and false otherwise.
124	 *
125	 * @since   3.2.0
126	 */
127	public function deleteLike($video)
128	{
129		return $this->deleteConnection($video, 'likes');
130	}
131
132	/**
133	 * Method to get the album-sized view of the video. Requires authentication and user_videos or friends_videos permission for private photos.
134	 *
135	 * @param   string  $video  The video id.
136	 *
137	 * @return  string  URL of the picture.
138	 *
139	 * @since   3.2.0
140	 */
141	public function getPicture($video)
142	{
143		return $this->getConnection($video, 'picture');
144	}
145}
146