Skip to content

Commit 090ffeb

Browse files
Minor ApiConnection improvement (#9173)
1 parent 914d081 commit 090ffeb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Api/Api.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public Api()
8282
/// </summary>
8383
public virtual void Initialize(int userId, string token, string dataFolder)
8484
{
85-
ApiConnection = new ApiConnection(userId, token);
85+
ApiConnection = CreateApiConnection(userId, token);
8686
_dataFolder = dataFolder?.Replace("\\", "/", StringComparison.InvariantCulture);
8787

8888
//Allow proper decoding of orders from the API.
@@ -1472,6 +1472,14 @@ protected bool TryJsonPost<T>(string endpoint, out T result, object payload = nu
14721472
return (apiConnection ?? ApiConnection).TryRequest(request, out result, timeout);
14731473
}
14741474

1475+
/// <summary>
1476+
/// Create the api connection instance to use
1477+
/// </summary>
1478+
protected virtual ApiConnection CreateApiConnection(int userId, string token)
1479+
{
1480+
return new ApiConnection(userId, token);
1481+
}
1482+
14751483
/// <summary>
14761484
/// Helper method that will execute the given api request and throw an exception if it fails
14771485
/// </summary>

0 commit comments

Comments
 (0)