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

Commit a1824c7

Browse files
committed
Add method to construct a UserApi instance.
1 parent e4fe6ce commit a1824c7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/SymphonyOSS.RestApiClient/Factories/PodApiFactory.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ public SystemApi CreateSystemApi(ISessionManager sessionManager, IApiExecutor ap
114114
return Create<SystemApi>(sessionManager, apiExecutor);
115115
}
116116

117+
/// <summary>
118+
/// Constructs a UserApi instance using the provided session manager
119+
/// for authentication.
120+
/// </summary>
121+
/// <param name="sessionManager">Session manager used for authentication.</param>
122+
/// <param name="apiExecutor">The executor, if none is provided <see cref="RetryStrategyApiExecutor"/>
123+
/// with a <see cref="RefreshTokensRetryStrategy"/> will be used.</param>
124+
/// <returns>The UserApi instance.</returns>
125+
public UserApi CreateUserApi(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
126+
{
127+
return Create<UserApi>(sessionManager, apiExecutor);
128+
}
129+
117130
/// <summary>
118131
/// Constructs a UsersApi instance using the provided session manager
119132
/// for authentication.

test/SymphonyOSS.RestApiClient.Tests/PodApiFactoryTest.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public void EnsureConstructs_a_SystemApi_instance()
7474
Assert.NotNull(result);
7575
}
7676

77+
[Fact]
78+
public void EnsureConstructs_a_UserApi_instance()
79+
{
80+
var podApiFactory = new PodApiFactory("https://pod");
81+
var result = podApiFactory.CreateUserApi(_sessionManager);
82+
Assert.NotNull(result);
83+
}
84+
7785
[Fact]
7886
public void EnsureConstructs_a_UsersApi_instance()
7987
{

0 commit comments

Comments
 (0)