Completed
Push — master ( 7f6918...fb7822 )
by Matthew
02:21
created

Agent::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Matt
5
 * Date: 20/04/2016
6
 * Time: 2:32 PM
7
 */
8
9
namespace Freshdesk\Resources;
10
11
use Freshdesk\Api;
12
use Freshdesk\Exceptions\AccessDeniedException;
13
use Freshdesk\Exceptions\ApiException;
14
use Freshdesk\Exceptions\ConflictingStateException;
15
use Freshdesk\Exceptions\MethodNotAllowedException;
16
use Freshdesk\Exceptions\NotFoundException;
17
use Freshdesk\Exceptions\RateLimitExceededException;
18
use Freshdesk\Exceptions\UnsupportedAcceptHeaderException;
19
use Freshdesk\Exceptions\UnsupportedContentTypeException;
20
use Freshdesk\Exceptions\ValidationException;
21
22
/**
23
 * Agent resources
24
 *
25
 * @package Freshdesk\Resources
26
 */
27
class Agent extends AbstractResource
28
{
29
30
    /**
31
     * The resource endpoint
32
     *
33
     * @var string
34
     */
35
    protected $endpoint = '/agents';
36
37
    /**
38
     *
39
     * Get a list of all agents
40
     *
41
     * @param array|null $query
42
     * @return mixed|null
43
     * @throws ApiException
44
     * @throws ConflictingStateException
45
     * @throws RateLimitExceededException
46
     * @throws UnsupportedContentTypeException
47
     */
48
    public function all(array $query = null)
49
    {
50
        $this->api->request('GET', $this->endpoint(), null, $query);
51
    }
52
53
    /**
54
     *
55
     * Get an agent by id
56
     *
57
     * @param int $id
58
     * @param array|null $query
59
     * @return array|null
60
     * @throws AccessDeniedException
61
     * @throws ApiException
62
     * @throws ConflictingStateException
63
     * @throws MethodNotAllowedException
64
     * @throws NotFoundException
65
     * @throws RateLimitExceededException
66
     * @throws UnsupportedAcceptHeaderException
67
     * @throws UnsupportedContentTypeException
68
     * @throws ValidationException
69
     */
70
    public function view($id, array $query = null)
71
    {
72
        $this->api->request('GET', $this->endpoint($id), null, $query);
73
    }
74
75
    /**
76
     *
77
     * Get the currently authenticated agent
78
     *
79
     * @param array|null $query
80
     * @return array|null
81
     * @throws AccessDeniedException
82
     * @throws ApiException
83
     * @throws ConflictingStateException
84
     * @throws MethodNotAllowedException
85
     * @throws NotFoundException
86
     * @throws RateLimitExceededException
87
     * @throws UnsupportedAcceptHeaderException
88
     * @throws UnsupportedContentTypeException
89
     * @throws ValidationException
90
     */
91
    public function current(array $query = null)
92
    {
93
        $this->api->request('GET', $this->endpoint('me'), null, $query);
94
    }
95
96
}