1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices; |
4
|
|
|
|
5
|
|
|
use Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface; |
6
|
|
|
use Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\IdentityServiceInterface; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class IdentityService |
10
|
|
|
* @package namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices |
11
|
|
|
*/ |
12
|
|
|
class IdentityService extends BaseService implements IdentityServiceInterface |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Create a identity |
16
|
|
|
* |
17
|
|
|
* @param array $data identity data |
18
|
|
|
* @param string $identityId identity ID |
19
|
|
|
* |
20
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface |
21
|
|
|
*/ |
22
|
3 |
|
public function create(array $data, string $identityId): ResponseInterface |
23
|
|
|
{ |
24
|
3 |
|
return $this->getRequestService() |
25
|
3 |
|
->makePostRequest($this->getRouter()->getShortUrl('users', $identityId, 'identity'), $data); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Update identity details |
30
|
|
|
* |
31
|
|
|
* @param array $data identity data |
32
|
|
|
* @param string $identityId identity ID |
33
|
|
|
* |
34
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface |
35
|
|
|
*/ |
36
|
2 |
|
public function update(array $data, string $identityId): ResponseInterface |
37
|
|
|
{ |
38
|
2 |
|
return $this->getRequestService() |
39
|
2 |
|
->makePatchRequest($this->getRouter()->getShortUrl('users', $identityId, 'identity'), $data); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Replace a identity |
44
|
|
|
* |
45
|
|
|
* @param array $data identity data |
46
|
|
|
* @param string $identityId identity ID |
47
|
|
|
* |
48
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface |
49
|
|
|
*/ |
50
|
2 |
|
public function replace(array $data, string $identityId): ResponseInterface |
51
|
|
|
{ |
52
|
2 |
|
return $this->getRequestService() |
53
|
2 |
|
->makePutRequest($this->getRouter()->getShortUrl('users', $identityId, 'identity'), $data); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get identity details |
58
|
|
|
* |
59
|
|
|
* @param string $identityId identity ID |
60
|
|
|
* |
61
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface |
62
|
|
|
*/ |
63
|
3 |
|
public function get(string $identityId): ResponseInterface |
64
|
|
|
{ |
65
|
3 |
|
return $this->getRequestService() |
66
|
3 |
|
->makeGetRequest($this->getRouter()->getShortUrl('users', $identityId, 'identity')); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Delete an identity |
71
|
|
|
* |
72
|
|
|
* @param string $identityId identity ID |
73
|
|
|
* |
74
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface |
75
|
|
|
*/ |
76
|
3 |
|
public function delete(string $identityId): ResponseInterface |
77
|
|
|
{ |
78
|
3 |
|
return $this->getRequestService() |
79
|
3 |
|
->makeDeleteRequest($this->getRouter()->getShortUrl('users', $identityId, 'identity')); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|