UsersApi
extends ManagementSupport
in package
Users within the client's tenant, and the administrative side of their second factor and lockout state.
The users namespace handle (CONTRACT.md §27.2), reached as
$client->management()->users(). Every method here goes through the one shared ManagementTransport, so §3 CSRF, the §4 cookie jar, the §5 tenant header, §6 TLS, §16 retry
and §19 telemetry apply without this class doing anything to opt in (§27.8).
Table of Contents
Methods
- __construct() : mixed
- create() : UserResponse
- `POST /api/v1/users`
- delete() : void
- `DELETE /api/v1/users/{user_id}`
- deleteMfaMethod() : void
- `DELETE /api/v1/users/{user_id}/mfa-methods/{method_id}`
- forTenant() : static
- A COPY of this handle scoped to `$tenantId` (§27.4 rule 3). See {@see self::inOrg()} for why it copies.
- get() : UserResponse
- `GET /api/v1/users/{user_id}`
- inOrg() : static
- A COPY of this handle scoped to `$orgId` (§27.4 rule 3).
- listItems() : Page<string|int, UserResponse>
- `GET /api/v1/users`
- listMfaMethods() : array<int, MfaMethodResponse>
- `GET /api/v1/users/{user_id}/mfa-methods`
- listRoles() : array<int, RoleAssignment>
- `GET /api/v1/users/{user_id}/roles`
- resetMfa() : void
- `POST /api/v1/users/{user_id}/reset-mfa`
- unlock() : UserResponse
- `POST /api/v1/users/{user_id}/unlock`
- update() : UserResponse
- `PUT /api/v1/users/{user_id}`
Methods
__construct()
public
__construct(ManagementTransport $transport[, NamespaceScope $scope = new NamespaceScope() ][, string|null $clientOrgId = null ][, string|null $clientTenantId = null ]) : mixed
Parameters
- $transport : ManagementTransport
-
The one wire path (§27.8).
- $scope : NamespaceScope = new NamespaceScope()
-
Per-handle
{org_id}/{tenant_id}overrides. - $clientOrgId : string|null = null
-
The client's own organization id, or
null. - $clientTenantId : string|null = null
-
The client's own tenant id, or
null.
create()
`POST /api/v1/users`
public
create(CreateUserRequest $body) : UserResponse
POST /api/v1/users.
Parameters
- $body : CreateUserRequest
-
the request body
Return values
UserResponsedelete()
`DELETE /api/v1/users/{user_id}`
public
delete(string $userId) : void
DELETE /api/v1/users/{user_id}.
Returns nothing; the server answers with an empty body.
NOT idempotent (§27.4 rule 6): deleting something already deleted raises NotFoundError rather than succeeding quietly.
Parameters
- $userId : string
-
the
{user_id}path parameter
deleteMfaMethod()
`DELETE /api/v1/users/{user_id}/mfa-methods/{method_id}`
public
deleteMfaMethod(string $userId, string $methodId) : void
DELETE /api/v1/users/{user_id}/mfa-methods/{method_id}.
Returns nothing; the server answers with an empty body.
NOT idempotent (§27.4 rule 6): deleting something already deleted raises NotFoundError rather than succeeding quietly.
Parameters
- $userId : string
-
the
{user_id}path parameter - $methodId : string
-
the
{method_id}path parameter
forTenant()
A COPY of this handle scoped to `$tenantId` (§27.4 rule 3). See {@see self::inOrg()} for why it copies.
public
forTenant(string $tenantId) : static
Parameters
- $tenantId : string
Return values
staticget()
`GET /api/v1/users/{user_id}`
public
get(string $userId) : UserResponse
GET /api/v1/users/{user_id}.
Parameters
- $userId : string
-
the
{user_id}path parameter
Return values
UserResponseinOrg()
A COPY of this handle scoped to `$orgId` (§27.4 rule 3).
public
inOrg(string $orgId) : static
Returns a new handle rather than mutating this one. An administrator holding a handle to their own organization should not find it repointed at someone else's because an unrelated code path re-scoped a shared object — and on a management surface that failure mode writes to the wrong tenant rather than merely reading from it.
Parameters
- $orgId : string
Return values
staticlistItems()
`GET /api/v1/users`
public
listItems([PageRequest|null $page = null ]) : Page<string|int, UserResponse>
GET /api/v1/users.
Returns ONE page. Page::$total is the server's count across all pages and is not
count($page) — see §27.4 rule 4.
Parameters
- $page : PageRequest|null = null
-
which page to fetch; defaults to the first
Return values
Page<string|int, UserResponse>listMfaMethods()
`GET /api/v1/users/{user_id}/mfa-methods`
public
listMfaMethods(string $userId) : array<int, MfaMethodResponse>
GET /api/v1/users/{user_id}/mfa-methods.
Returns the server's complete list. This endpoint is NOT paginated, so the result is a
plain list and never a Page (§27.4 rule 4).
Parameters
- $userId : string
-
the
{user_id}path parameter
Return values
array<int, MfaMethodResponse>listRoles()
`GET /api/v1/users/{user_id}/roles`
public
listRoles(string $userId) : array<int, RoleAssignment>
GET /api/v1/users/{user_id}/roles.
Returns the server's complete list. This endpoint is NOT paginated, so the result is a
plain list and never a Page (§27.4 rule 4).
Parameters
- $userId : string
-
the
{user_id}path parameter
Return values
array<int, RoleAssignment>resetMfa()
`POST /api/v1/users/{user_id}/reset-mfa`
public
resetMfa(string $userId) : void
POST /api/v1/users/{user_id}/reset-mfa.
Returns nothing; the server answers with an empty body.
Parameters
- $userId : string
-
the
{user_id}path parameter
unlock()
`POST /api/v1/users/{user_id}/unlock`
public
unlock(string $userId) : UserResponse
POST /api/v1/users/{user_id}/unlock.
Parameters
- $userId : string
-
the
{user_id}path parameter
Return values
UserResponseupdate()
`PUT /api/v1/users/{user_id}`
public
update(string $userId, UpdateUserRequest $body) : UserResponse
PUT /api/v1/users/{user_id}.
Parameters
- $userId : string
-
the
{user_id}path parameter - $body : UpdateUserRequest
-
the request body