Skip to content

Add user API support and current-user endpoints#144

Merged
isivaselvan merged 1 commit into
next-1.0.0from
feature/User
May 7, 2026
Merged

Add user API support and current-user endpoints#144
isivaselvan merged 1 commit into
next-1.0.0from
feature/User

Conversation

@TanyaSingh369-svg

@TanyaSingh369-svg TanyaSingh369-svg commented May 6, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds support for the Terraform Cloud User API in the Python SDK.

It introduces a Users resource with support for:

Reading a user by ID
Reading the currently authenticated user
Updating the currently authenticated user

Changes

  • Implemented Users.read(user_id) using GET /api/v2/users/{user_id}
  • Added read_current() and update_current() methods
  • Added input validation and integrated Users into TFEClient
  • Updated the User model:
    - handled nullable fields (auth_method, avatar_url, email, unconfirmed_email)
    - added TwoFactor and UserPermissions
    - aligned nullable booleans with the Go SDK
    - added UserUpdateCurrentOptions
  • Parsed API responses into structured models
  • Added unit tests for:
    - read(user_id)
    - invalid ID validation
    - read_current()
    - update_current()
    - nullable field handling
    - two_factor parsing
    - nullable booleans
  • Added an example demonstrating read_current() and optional read(user_id)

Output

Added unit tests covering the new Users.read functionality.

Verified that the new tests pass successfully.

Screenshot 2026-05-06 at 3 15 15 PM ## Run the examples Screenshot 2026-05-06 at 3 16 08 PM

@TanyaSingh369-svg TanyaSingh369-svg requested a review from a team as a code owner May 6, 2026 09:30
@isivaselvan isivaselvan merged commit f6bf013 into next-1.0.0 May 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants