Přeskočit na hlavní obsah

User Management Operations

The Mattermost API Client provides several user-related operations through its UsersApi class.

Token Management​

Create personal access tokens for users with descriptions. These tokens can be used for API authentication.

Password Management​

Update user passwords with proper validation:

  • Requires current password (unless bypassed)
  • Validates new password isn't empty
  • Handles password change requests securely

Technické informace​

createToken()​

  • Parameters:
  • string $userId: Mattermost user ID
  • string $description: Token description
  • Returns: Token object
  • Throws:
  • ClientExceptionInterface for HTTP errors
  • JsonException for JSON parsing errors
  • ApiException for Mattermost API errors

updateUserPassword()​

  • Parameters:
  • string $userId: Mattermost user ID
  • string $currentPassword: Current password (optional for admin)
  • string $newPassword: New password
  • Returns: Operation status
  • Throws:
  • InvalidArgumentException for invalid inputs
  • ClientExceptionInterface for HTTP errors
  • JsonException for JSON parsing errors
  • ApiException for Mattermost API errors

The Token model represents token data with getters for all fields.