waifuim
    Preparing search index...

    Class UsersService

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Ban or unban a user.

      Banned users cannot authenticate or use the API. Their existing API keys will be rejected.

      Requires: Admin role.

      Parameters

      • id: number

        The user ID to ban/unban.

      • isBlacklisted: boolean

        Set to true to ban the user, false to unban.

      Returns Promise<PartialUser>

      AuthenticationRequired if authentication is missing.

      ApiError with status 401 if authentication is invalid.

      ApiError with status 403 if insufficient permissions.

      ApiError with status 404 if user not found.

    • Change a user's role.

      Update a user's role to grant or revoke permissions. You cannot change your own role.

      Requires: Admin role.

      Parameters

      • id: number

        The user ID to update.

      • role: UserRole

        The new role.

      Returns Promise<PartialUser>

      AuthenticationRequired if authentication is missing.

      ApiError if invalid role or trying to change own role.

      ApiError with status 401 if authentication is invalid.

      ApiError with status 403 if insufficient permissions.

      ApiError with status 404 if user not found.

    • Get a user by ID.

      Returns minimal user information. Used by moderators for content review.

      Requires: Moderator role or higher.

      Parameters

      • id: number

        User ID

      Returns Promise<PreviewUser>

      AuthenticationRequired if authentication is missing.

      ApiError with status 401 if authentication is invalid.

      ApiError with status 403 if insufficient permissions.

      ApiError with status 404 if user not found.