Skip to content

Commit a223b60

Browse files
Add support for creating, getting and updating users with external_id property (#267)
Co-authored-by: Eric Roberts <ericroberts@gmail.com>
1 parent b2158fa commit a223b60

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/UserManagement.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class UserManagement
3333
*
3434
* @return Resource\User
3535
*/
36+
3637
public function createUser(
3738
$email,
3839
$password = null,
@@ -80,6 +81,24 @@ public function getUser($userId)
8081
return Resource\User::constructFromResponse($response);
8182
}
8283

84+
/**
85+
* Get a User by external ID.
86+
*
87+
* @param string $externalId The external ID of the user.
88+
*
89+
* @throws Exception\WorkOSException
90+
*
91+
* @return Resource\User
92+
*/
93+
public function getUserByExternalId($externalId)
94+
{
95+
$path = "user_management/users/external_id/{$externalId}";
96+
97+
$response = Client::request(Client::METHOD_GET, $path, null, null, true);
98+
99+
return Resource\User::constructFromResponse($response);
100+
}
101+
83102
/**
84103
* Update a User
85104
*

0 commit comments

Comments
 (0)