Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project owner to API project read #7674

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading