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

DYN-7413 Add release notes URL and compatibility matrix properties to Package Version Header #111

Merged
merged 3 commits into from
Sep 13, 2024
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
52 changes: 52 additions & 0 deletions src/GregClient/Requests/PackageVersionUploadRequestBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,55 @@ public PackageVersionUploadRequestBody()

}

/// <summary>
/// Constructor which can be used to set hostDependencies
/// </summary>
/// <param name="name">Package name</param>
/// <param name="version">Package version</param>
/// <param name="description">Package description</param>
/// <param name="keywords">Package keywords for quick identification</param>
/// <param name="contents">Package content description</param>
/// <param name="engine">Package engine name, usually is set to Dynamo</param>
/// <param name="engineVersion">Package engine version, usually is set to use Dynamo version</param>
/// <param name="metadata"></param>
/// <param name="group"></param>
/// <param name="dependencies">Package dependencies</param>
/// <param name="siteUrl"></param>
/// <param name="repositoryUrl"></param>
/// <param name="containsBinaries">boolean flag indicating if the package contains binaries</param>
/// <param name="nodeLibraryNames"></param>
/// <param name="hostDependencies"> external programs this package depends on.</param
/// <param name="copyright_holder">Copyright Holder's name</param>
/// <param name="copyright_year">Year the copyright was put into effect.</param>
public PackageVersionUploadRequestBody(string name, string version, string description,
IEnumerable<string> keywords,
string contents, string engine, string engineVersion,
string metadata, string group, IEnumerable<PackageDependency> dependencies,
string siteUrl, string repositoryUrl, bool containsBinaries,
IEnumerable<string> nodeLibraryNames, IEnumerable<string> hostDependencies,
string copyright_holder, string copyright_year, string compatibility_matrix, string releaseNotesUrl)

{
this.host_dependencies = hostDependencies;
this.copyright_holder = copyright_holder;
this.copyright_year = copyright_year;
this.name = name;
this.version = version;
this.description = description;
this.dependencies = dependencies;
this.keywords = keywords;
this.contents = contents;
this.engine = engine;
this.group = group;
this.engine_version = engineVersion;
this.engine_metadata = metadata;
this.site_url = siteUrl;
this.repository_url = repositoryUrl;
this.contains_binaries = containsBinaries;
this.node_libraries = nodeLibraryNames;
this.compatibility_matrix = compatibility_matrix;
this.releaseNotesUrl = releaseNotesUrl;
}

/// <summary>
/// Constructor which can be used to set hostDependencies
Expand All @@ -33,6 +82,7 @@ public PackageVersionUploadRequestBody()
/// <param name="hostDependencies"> external programs this package depends on.</param
/// <param name="copyright_holder">Copyright Holder's name</param>
/// <param name="copyright_year">Year the copyright was put into effect.</param>
[Obsolete("This constructor may not initiate all the properties and will be removed in a future release of PackageManagerClient.")]
public PackageVersionUploadRequestBody(string name, string version, string description,
IEnumerable<string> keywords,
string contents, string engine, string engineVersion,
Expand Down Expand Up @@ -82,5 +132,7 @@ public PackageVersionUploadRequestBody(string name, string version, string descr
public IEnumerable<string> node_libraries { get; set; }
public string copyright_holder { get; set; }
public string copyright_year { get; set; }
public string compatibility_matrix { get; set; }
public string releaseNotesUrl { get; set; }
}
}
10 changes: 5 additions & 5 deletions src/GregClientTests/GregClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public void UploadDynamoPackageVersionTest()
var keywords = new List<string>() { "neat", "ok" };
var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group",
new List<PackageDependency>() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "",
false, new List<String>(), new List<String>(), "Dynamo Team", "2021");
false, new List<String>(), new List<String>(), "Dynamo Team", "2021","","");

var files = new List<string>() { "../test/pedro.dyf", "../test/RootNode.dyf" };
var request = new PackageVersionUpload(nv, files);
Assert.That(request.RequestBody.AsJson().Equals("{\"file_hash\":null,\"name\":\"Third .NET Package\",\"version\":\"2.1.0\",\"description\":\"\",\"group\":\"group\",\"keywords\":[\"neat\",\"ok\"],\"dependencies\":[{\"name\":\"peter\",\"version\":\"0.1.0\"},{\"name\":\"stephen\",\"version\":\"0.1.0\"}],\"host_dependencies\":[],\"contents\":\"contents\",\"engine_version\":\"0.1.0\",\"engine\":\"dynamo\",\"engine_metadata\":\"metadata\",\"site_url\":\"\",\"repository_url\":\"\",\"contains_binaries\":false,\"node_libraries\":[],\"copyright_holder\":\"Dynamo Team\",\"copyright_year\":\"2021\"}"));
Assert.That(request.RequestBody.AsJson().Equals("{\"file_hash\":null,\"name\":\"Third .NET Package\",\"version\":\"2.1.0\",\"description\":\"\",\"group\":\"group\",\"keywords\":[\"neat\",\"ok\"],\"dependencies\":[{\"name\":\"peter\",\"version\":\"0.1.0\"},{\"name\":\"stephen\",\"version\":\"0.1.0\"}],\"host_dependencies\":[],\"contents\":\"contents\",\"engine_version\":\"0.1.0\",\"engine\":\"dynamo\",\"engine_metadata\":\"metadata\",\"site_url\":\"\",\"repository_url\":\"\",\"contains_binaries\":false,\"node_libraries\":[],\"copyright_holder\":\"Dynamo Team\",\"copyright_year\":\"2021\",\"compatibility_matrix\":\"\",\"releaseNotesUrl\":\"\"}"));
Console.WriteLine(request.RequestBody.AsJson());
}

Expand All @@ -70,11 +70,11 @@ public void UploadDynamoPackageWithHostDependencyTest()
var keywords = new List<string>() { "Civil" };
var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group",
new List<PackageDependency>() { new PackageDependency("Ram", "0.1.0"), new PackageDependency("Ian", "0.1.0") }, "", "",
false, new List<String>(), new List<String>() { "Civil3D" }, "Dynamo Team", "2021");
false, new List<String>(), new List<String>() { "Civil3D" }, "Dynamo Team", "2021", "", "");

var files = new List<string>() { "../test/pedro.dyf", "../test/RootNode.dyf" };
var request = new PackageVersionUpload(nv, files);
Assert.That(request.RequestBody.AsJson().Equals("{\"file_hash\":null,\"name\":\"Third .NET Package\",\"version\":\"2.1.0\",\"description\":\"\",\"group\":\"group\",\"keywords\":[\"Civil\"],\"dependencies\":[{\"name\":\"Ram\",\"version\":\"0.1.0\"},{\"name\":\"Ian\",\"version\":\"0.1.0\"}],\"host_dependencies\":[\"Civil3D\"],\"contents\":\"contents\",\"engine_version\":\"0.1.0\",\"engine\":\"dynamo\",\"engine_metadata\":\"metadata\",\"site_url\":\"\",\"repository_url\":\"\",\"contains_binaries\":false,\"node_libraries\":[],\"copyright_holder\":\"Dynamo Team\",\"copyright_year\":\"2021\"}"));
Assert.That(request.RequestBody.AsJson().Equals("{\"file_hash\":null,\"name\":\"Third .NET Package\",\"version\":\"2.1.0\",\"description\":\"\",\"group\":\"group\",\"keywords\":[\"Civil\"],\"dependencies\":[{\"name\":\"Ram\",\"version\":\"0.1.0\"},{\"name\":\"Ian\",\"version\":\"0.1.0\"}],\"host_dependencies\":[\"Civil3D\"],\"contents\":\"contents\",\"engine_version\":\"0.1.0\",\"engine\":\"dynamo\",\"engine_metadata\":\"metadata\",\"site_url\":\"\",\"repository_url\":\"\",\"contains_binaries\":false,\"node_libraries\":[],\"copyright_holder\":\"Dynamo Team\",\"copyright_year\":\"2021\",\"compatibility_matrix\":\"\",\"releaseNotesUrl\":\"\"}"));
Console.WriteLine(request.RequestBody.AsJson());
}

Expand All @@ -83,7 +83,7 @@ public void UploadDynamoPackageVersionWithFilesTest()
{
var keywords = new List<string>() { "neat", "ok" };
var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group",
new List<PackageDependency>() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "", false, new List<String>(), new List<String>(), "", "");
new List<PackageDependency>() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "", false, new List<String>(), new List<String>(), "", "", "", "");

var files = new List<string>() {Assembly.GetExecutingAssembly().Location };

Expand Down