User

User client module.

peak.resources.users.get_client(session=None)

Returns a User client, If no session is provided, a default session is used.

Parameters:

session (Optional[Session]) – A Session Object. Default is None.

Returns:

The user client object.

Return type:

User

class peak.resources.users.User(session=None)

Client class for interacting with users resource.

Parameters:

session (Session) –

check_permissions(feature_actions)

Check if the user has the specified permissions for the given features or subfeatures.

Parameters:

feature_actions (Dict[str, str]) – A dictionary where keys are feature paths (e.g., “PRICING.GUARDRAILS”) and values are actions (e.g., “read” or “write”).

Returns:

A dictionary where keys are the same feature paths and values are booleans

indicating whether the user has the specified action permission for that feature.

Return type:

Dict[str, bool]

Raises:
  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • NotFoundException – The given feature does not exist.

  • UnprocessableEntityException – The server was unable to process the request.

  • InternalServerErrorException – The server failed to process the request.