Skip to content

Commit

Permalink
Add project owner to API project read
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero committed Jan 5, 2024
1 parent 1d52e5b commit 4f55f5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions Api/ApiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class ApiConnection
{
private readonly static JsonSerializerSettings _jsonSettings = new() { Converters = { new LiveAlgorithmResultsJsonConverter(), new OrderJsonConverter() } };

/// <summary>
/// Authorized client to use for requests.
/// </summary>
public RestClient Client;
Expand Down
12 changes: 9 additions & 3 deletions Common/Api/Project.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
Expand All @@ -13,8 +13,8 @@
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace QuantConnect.Api
{
Expand Down Expand Up @@ -52,6 +52,12 @@ public class Project : RestResponse
/// </summary>
[JsonProperty(PropertyName = "language")]
public Language Language { get; set; }

/// <summary>
/// The projects owner id
/// </summary>
[JsonProperty(PropertyName = "ownerId")]
public int OwnerId { get; set; }
}

/// <summary>
Expand All @@ -65,4 +71,4 @@ public class ProjectResponse : RestResponse
[JsonProperty(PropertyName = "projects")]
public List<Project> Projects { get; set; }
}
}
}
11 changes: 11 additions & 0 deletions Tests/Api/ProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ namespace QuantConnect.Tests.API
[TestFixture, Explicit("Requires configured api access and available backtest node to run on")]
public class ProjectTests : ApiTestBase
{
[Test]
public void ReadProject()
{
var readProject = ApiClient.ReadProject(16408347);
Assert.IsTrue(readProject.Success);
Assert.AreEqual(1, readProject.Projects.Count);

var project = readProject.Projects[0];
Assert.AreNotEqual(0, project.OwnerId);
}

/// <summary>
/// Test creating and deleting projects with the Api
/// </summary>
Expand Down

0 comments on commit 4f55f5c

Please sign in to comment.