-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathUsersManager.php
More file actions
55 lines (50 loc) · 2.12 KB
/
Copy pathUsersManager.php
File metadata and controls
55 lines (50 loc) · 2.12 KB
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
<?php
namespace SimpleSquid\Vend\Actions;
use SimpleSquid\Vend\Resources\TwoDotZero\User;
use SimpleSquid\Vend\Resources\TwoDotZero\UserCollection;
class UsersManager
{
use ManagesResources;
/**
* Get a single user.
* Returns a single user with the requested ID.
*
* @param string $id Valid user ID.
*
* @return User
* @throws \SimpleSquid\Vend\Exceptions\AuthorisationException
* @throws \SimpleSquid\Vend\Exceptions\BadRequestException
* @throws \SimpleSquid\Vend\Exceptions\NotFoundException
* @throws \SimpleSquid\Vend\Exceptions\RateLimitException
* @throws \SimpleSquid\Vend\Exceptions\RequestException
* @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException
* @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException
* @throws \SimpleSquid\Vend\Exceptions\UnknownException
*/
public function find(string $id): User
{
return $this->single(User::class, "2.0/users/$id");
}
/**
* List users.
* Returns a paginated list of users.
*
* @param int|null $page_size The maximum number of items to be returned in the response.
* @param int|null $after The lower limit for the version numbers to be included in the response.
* @param int|null $before The upper limit for the version numbers to be included in the response.
*
* @return UserCollection
* @throws \SimpleSquid\Vend\Exceptions\AuthorisationException
* @throws \SimpleSquid\Vend\Exceptions\BadRequestException
* @throws \SimpleSquid\Vend\Exceptions\NotFoundException
* @throws \SimpleSquid\Vend\Exceptions\RateLimitException
* @throws \SimpleSquid\Vend\Exceptions\RequestException
* @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException
* @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException
* @throws \SimpleSquid\Vend\Exceptions\UnknownException
*/
public function get(int $page_size = null, int $after = null, int $before = null): UserCollection
{
return $this->collection(UserCollection::class, '2.0/users', compact('after', 'before', 'page_size'));
}
}