Skip to content

Commit 4f55f5c

Browse files
Add project owner to API project read
1 parent 1d52e5b commit 4f55f5c

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Api/ApiConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class ApiConnection
3030
{
3131
private readonly static JsonSerializerSettings _jsonSettings = new() { Converters = { new LiveAlgorithmResultsJsonConverter(), new OrderJsonConverter() } };
3232

33+
/// <summary>
3334
/// Authorized client to use for requests.
3435
/// </summary>
3536
public RestClient Client;

Common/Api/Project.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
44
*
@@ -13,8 +13,8 @@
1313
* limitations under the License.
1414
*/
1515
using System;
16-
using System.Collections.Generic;
1716
using Newtonsoft.Json;
17+
using System.Collections.Generic;
1818

1919
namespace QuantConnect.Api
2020
{
@@ -52,6 +52,12 @@ public class Project : RestResponse
5252
/// </summary>
5353
[JsonProperty(PropertyName = "language")]
5454
public Language Language { get; set; }
55+
56+
/// <summary>
57+
/// The projects owner id
58+
/// </summary>
59+
[JsonProperty(PropertyName = "ownerId")]
60+
public int OwnerId { get; set; }
5561
}
5662

5763
/// <summary>
@@ -65,4 +71,4 @@ public class ProjectResponse : RestResponse
6571
[JsonProperty(PropertyName = "projects")]
6672
public List<Project> Projects { get; set; }
6773
}
68-
}
74+
}

Tests/Api/ProjectTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ namespace QuantConnect.Tests.API
2929
[TestFixture, Explicit("Requires configured api access and available backtest node to run on")]
3030
public class ProjectTests : ApiTestBase
3131
{
32+
[Test]
33+
public void ReadProject()
34+
{
35+
var readProject = ApiClient.ReadProject(16408347);
36+
Assert.IsTrue(readProject.Success);
37+
Assert.AreEqual(1, readProject.Projects.Count);
38+
39+
var project = readProject.Projects[0];
40+
Assert.AreNotEqual(0, project.OwnerId);
41+
}
42+
3243
/// <summary>
3344
/// Test creating and deleting projects with the Api
3445
/// </summary>

0 commit comments

Comments
 (0)