Skip to content

Feature: Implement Update User Details API (POST /api/users/:userId) #66

@MessiasLima

Description

@MessiasLima

Feature: Implement Update User Details API (POST /api/users/:userId)

Background

This feature involves implementing the POST /api/users/:userId endpoint from the Umami API within the umami-kotlin library. This endpoint allows an authenticated user, typically an administrator or the user themselves, to update specific details for a user identified by userId. The request body will contain the fields to be updated.

Implementing this functionality is crucial for providing comprehensive user management capabilities within the umami-kotlin client. It will enable applications to modify user profiles, manage user roles, and update other user-specific information programmatically. This work directly contributes to fulfilling the "Umami API" section of the project roadmap, enhancing user-related functionalities.

Acceptance criteria

  • GIVEN the Umami client is configured with a valid baseUrl and an authenticated user with appropriate permissions (e.g., an administrator, or the user whose ID matches :userId),
    WHEN a request is made to update details for a specific userId with valid new data via a new API method (e.g., umami.users.updateUserDetails(userId, updateData)),
    THEN the client successfully sends a POST request to /api/users/:userId with the update data
    AND the method returns a successful response indicating the user details have been updated.
  • GIVEN the Umami client is configured with a valid baseUrl and an authenticated user,
    WHEN a request is made to update details for a userId for which the authenticated user lacks permissions,
    THEN the client successfully sends a POST request to /api/users/:userId
    AND the method returns an error response (or throws an appropriate UmamiAuthException or UmamiPermissionException) indicating access is denied.
  • GIVEN the Umami client is configured with a valid baseUrl and an authenticated user with permissions,
    WHEN a request is made to update details for a userId that does not exist or with invalid update data (e.g., incorrect format, missing required fields),
    THEN the client successfully sends a POST request to /api/users/:userId
    AND the method returns an error response (or throws an appropriate UmamiNotFoundException or UmamiValidationException) indicating the failure.
  • GIVEN the Umami client is configured,
    WHEN a request is made to update user details and a network or server error occurs during the API call,
    THEN the new API method throws an appropriate exception (e.g., IOException, UmamiApiException).
  • GIVEN the umami-kotlin library is used in a project,
    WHEN a developer initializes the Umami client using Umami.create(),
    THEN the Umami instance exposes a public method (e.g., umami.users.updateUserDetails(userId: String, updateData: UserUpdateRequest)) to interact with the POST /api/users/:userId endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions