Skip to content

Commit ee2c4da

Browse files
committed
[UC-3] Add update by custom id endpoint
1 parent 3bcd713 commit ee2c4da

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/Api/UserApi.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
final class UserApi extends AbstractClient implements UserApiInterface
1111
{
12-
const PARENT = 'parent';
13-
const USERS_LIST = 'users_list';
12+
public const PARENT = 'parent';
13+
14+
public const USERS_LIST = 'users_list';
1415

1516
public function findUser(
1617
UserComApiAwareInterface $resource,
@@ -94,4 +95,15 @@ public function mergeUsers(UserComApiAwareInterface $resource, int $parentId, ar
9495
]),
9596
);
9697
}
98+
99+
public function updateUserByCustomId(UserComApiAwareInterface $resource, string $customId, array $data): ?array
100+
{
101+
$url = $this->getApiEndpointUrl($resource, sprintf(self::UPDATE_USER_BY_CUSTOM_ID_ENDPOINT, $customId));
102+
103+
return $this->request(
104+
$url,
105+
Request::METHOD_PUT,
106+
$this->buildOptions($resource, ['json' => $data]),
107+
);
108+
}
97109
}

src/Api/UserApiInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ interface UserApiInterface
1818

1919
public const UPDATE_USER_ENDPOINT = '/users/%s';
2020

21+
public const UPDATE_USER_BY_CUSTOM_ID_ENDPOINT = '/users-by-id/%s';
22+
2123
public const GET_USER_ENDPOINT = '/users/%s';
2224

2325
public const CREATE_USER_ENDPOINT = '/users/';

0 commit comments

Comments
 (0)