Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit c2bc7f7

Browse files
committed
Add method to get user details by user ID.
1 parent 2413bbe commit c2bc7f7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/SymphonyOSS.RestApiClient/Api/PodApi/UsersApi.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public UsersApi(IAuthTokens authTokens, Configuration configuration, IApiExecuto
5050
}
5151

5252
/// <summary>
53-
/// Get user information by email address.
53+
/// Get user information by email address (requires user provisioning permission).
5454
/// </summary>
5555
/// <param name="email">Email address of user.</param>
5656
/// <param name="local">If true then a local DB search will be performed and only local
@@ -62,5 +62,19 @@ public User GetUser(string email, bool? local = null)
6262
{
6363
return _apiExecutor.Execute(_usersApi.V1UserGet, email, _authTokens.SessionToken, local);
6464
}
65+
66+
/// <summary>
67+
/// Get user information by user ID.
68+
/// </summary>
69+
/// <param name="userId">ID of user.</param>
70+
/// <param name="local">If true then a local DB search will be performed and only local
71+
/// pod users will be returned. If absent or false then a directory search will be
72+
/// performed and users from other pods who are visible to the calling user will
73+
/// also be returned. Optional.</param>
74+
/// <returns>The user information.</returns>
75+
public UserV2 GetUser(long userId, bool? local = null)
76+
{
77+
return _apiExecutor.Execute(_usersApi.V2UserGet, _authTokens.SessionToken, (long?)userId, (string)null, (string)null, local);
78+
}
6579
}
6680
}

test/SymphonyOSS.RestApiClient.Tests/UsersApiTest.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,13 @@ public void EnsureGetUser_uses_retry_strategy()
4949
_apiExecutorMock.Verify(obj => obj.Execute(It.IsAny<Func<string, string, bool?, User>>(), email, "sessionToken", (bool?) null));
5050
}
5151

52+
[Fact]
53+
public void EnsureGetUser_by_user_id_uses_retry_strategy()
54+
{
55+
const long userId = 12345;
56+
_usersApi.GetUser(userId);
57+
_apiExecutorMock.Verify(obj => obj.Execute(It.IsAny<Func<string, long?, string, string, bool?, UserV2>>(), "sessionToken", userId, (string)null, (string)null, (bool?)null));
58+
}
59+
5260
}
5361
}

0 commit comments

Comments
 (0)