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

Commit 7bff7ed

Browse files
committed
Adding factory method to construct AttachmentsApi.
1 parent bd189a7 commit 7bff7ed

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/SymphonyOSS.RestApiClient/Factories/AgentApiFactory.cs

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ public AgentApiFactory(string baseUrl)
3636
_baseUrl = baseUrl;
3737
}
3838

39+
/// <summary>
40+
/// Constructs an AttachmentsApi instance using the provided session manager
41+
/// for authentication.
42+
/// </summary>
43+
/// <param name="sessionManager">Session manager used for authentication.</param>
44+
/// <param name="apiExecutor">The executor, if none is provided <see cref="RetryStrategyApiExecutor"/>
45+
/// with a <see cref="RefreshTokensRetryStrategy"/> will be used.</param>
46+
/// <returns>The AttachmentsApi instance.</returns>
47+
public AttachmentsApi CreateAttachmentsApi(SessionManager sessionManager, IApiExecutor apiExecutor = null)
48+
{
49+
return Create<AttachmentsApi>(sessionManager, apiExecutor);
50+
}
51+
3952
/// <summary>
4053
/// Constructs a DatafeedApi instance using the provided session manager
4154
/// for authentication.

test/SymphonyOSS.RestApiClient.Tests/AgentApiFactoryTest.cs

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ public AgentApiFactoryTest()
3434
_sessionManager = new SessionManager("https://sessionauth", "https://keyauth", certificateMock.Object);
3535
}
3636

37+
[Fact]
38+
public void EnsureConstructs_an_AttachmentsApi_instance()
39+
{
40+
var agentApiFactory = new AgentApiFactory("https://agent");
41+
var result = agentApiFactory.CreateAttachmentsApi(_sessionManager);
42+
Assert.NotNull(result);
43+
}
44+
3745
[Fact]
3846
public void EnsureConstructs_a_DatafeedApi_instance()
3947
{

0 commit comments

Comments
 (0)