-
Notifications
You must be signed in to change notification settings - Fork 193
/
Copy pathOrganizationEndpoint.php
64 lines (56 loc) · 1.63 KB
/
OrganizationEndpoint.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Mollie\Api\Endpoints;
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\Resources\Organization;
use Mollie\Api\Resources\OrganizationCollection;
class OrganizationEndpoint extends CollectionEndpointAbstract
{
protected $resourcePath = "organizations";
/**
* @return Organization
*/
protected function getResourceObject()
{
return new Organization($this->client);
}
/**
* Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object.
*
* @param int $count
* @param \stdClass $_links
*
* @return OrganizationCollection
*/
protected function getResourceCollectionObject($count, $_links)
{
return new OrganizationCollection($this->client, $count, $_links);
}
/**
* Retrieve an organization from Mollie.
*
* Will throw a ApiException if the organization id is invalid or the resource cannot be found.
*
* @param string $organizationId
* @param array $parameters
* @return Organization
* @throws ApiException
*/
public function get($organizationId, array $parameters = [])
{
if (empty($organizationId)) {
throw new ApiException("Organization ID is empty.");
}
return parent::rest_read($organizationId, $parameters);
}
/**
* Retrieve the current organization from Mollie.
*
* @param array $parameters
* @return Organization
* @throws ApiException
*/
public function current(array $parameters = [])
{
return parent::rest_read('me', $parameters);
}
}