Completed
Pull Request — master (#39)
by
unknown
01:30
created

ReactionModel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A saveReaction() 0 4 1
A deleteReaction() 0 4 1
1
<?php
2
/**
3
 * This Driver is based entirely on official documentation of the Mattermost Web
4
 * Services API and you can extend it by following the directives of the documentation.
5
 *
6
 * For the full copyright and license information, please read the LICENSE.txt
7
 * file that was distributed with this source code. For the full list of
8
 * contributors, visit https://github.com/gnello/php-mattermost-driver/contributors
9
 *
10
 * God bless this mess.
11
 *
12
 * @author Bruno Spyckerelle <[email protected]>
13
 * @link https://api.mattermost.com/
14
 */
15
16
namespace Gnello\Mattermost\Models;
17
18
use Psr\Http\Message\ResponseInterface;
19
20
/**
21
 * Class ReactionModel
22
 *
23
 * @package Gnello\Mattermost\Models
24
 */
25
class ReactionModel extends AbstractModel
26
{
27
    /**
28
     * @var string
29
     */
30
    public static $endpoint = '/reactions';
31
32
    /**
33
     * @param array $requestOptions
34
     * @return ResponseInterface
35
     */
36
    public function saveReaction(array $requestOptions)
37
    {
38
        return $this->client->post(self::$endpoint, $requestOptions);
39
    }
40
41
    /**
42
     * @param $userId
43
     * @param $postId
44
     * @param $emojiName
45
     * @return ResponseInterface
46
     */
47
    public function deleteReaction($userId, $postId, $emojiName)
48
    {
49
        return $this->client->delete(UserModel::$endpoint . '/' . $userId . PostModel::$endpoint . '/' . $postId . self::$endpoint . '/' . $emojiName);
50
    }
51
}
52