diff --git a/src/GregClient/Requests/PackageVersionUploadRequestBody.cs b/src/GregClient/Requests/PackageVersionUploadRequestBody.cs index 83dbc2a..a18c9e2 100644 --- a/src/GregClient/Requests/PackageVersionUploadRequestBody.cs +++ b/src/GregClient/Requests/PackageVersionUploadRequestBody.cs @@ -12,6 +12,55 @@ public PackageVersionUploadRequestBody() } + /// + /// Constructor which can be used to set hostDependencies + /// + /// Package name + /// Package version + /// Package description + /// Package keywords for quick identification + /// Package content description + /// Package engine name, usually is set to Dynamo + /// Package engine version, usually is set to use Dynamo version + /// + /// + /// Package dependencies + /// + /// + /// boolean flag indicating if the package contains binaries + /// + /// external programs this package depends on.Copyright Holder's name + /// Year the copyright was put into effect. + public PackageVersionUploadRequestBody(string name, string version, string description, + IEnumerable keywords, + string contents, string engine, string engineVersion, + string metadata, string group, IEnumerable dependencies, + string siteUrl, string repositoryUrl, bool containsBinaries, + IEnumerable nodeLibraryNames, IEnumerable 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; + } /// /// Constructor which can be used to set hostDependencies @@ -33,6 +82,7 @@ public PackageVersionUploadRequestBody() /// external programs this package depends on.Copyright Holder's name /// Year the copyright was put into effect. + [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 keywords, string contents, string engine, string engineVersion, @@ -82,5 +132,7 @@ public PackageVersionUploadRequestBody(string name, string version, string descr public IEnumerable 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; } } } \ No newline at end of file diff --git a/src/GregClientTests/GregClientTests.cs b/src/GregClientTests/GregClientTests.cs index 480fac5..7a1d7d9 100644 --- a/src/GregClientTests/GregClientTests.cs +++ b/src/GregClientTests/GregClientTests.cs @@ -56,11 +56,11 @@ public void UploadDynamoPackageVersionTest() var keywords = new List() { "neat", "ok" }; var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group", new List() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "", - false, new List(), new List(), "Dynamo Team", "2021"); + false, new List(), new List(), "Dynamo Team", "2021","",""); var files = new List() { "../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()); } @@ -70,11 +70,11 @@ public void UploadDynamoPackageWithHostDependencyTest() var keywords = new List() { "Civil" }; var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group", new List() { new PackageDependency("Ram", "0.1.0"), new PackageDependency("Ian", "0.1.0") }, "", "", - false, new List(), new List() { "Civil3D" }, "Dynamo Team", "2021"); + false, new List(), new List() { "Civil3D" }, "Dynamo Team", "2021", "", ""); var files = new List() { "../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()); } @@ -83,7 +83,7 @@ public void UploadDynamoPackageVersionWithFilesTest() { var keywords = new List() { "neat", "ok" }; var nv = new PackageVersionUploadRequestBody("Third .NET Package", "2.1.0", "", keywords, "contents", "dynamo", "0.1.0", "metadata", "group", - new List() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "", false, new List(), new List(), "", ""); + new List() { new PackageDependency("peter", "0.1.0"), new PackageDependency("stephen", "0.1.0") }, "", "", false, new List(), new List(), "", "", "", ""); var files = new List() {Assembly.GetExecutingAssembly().Location };