Exemplo n.º 1
0
        private static 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>());

            var files = new List<string>() {"../test/pedro.dyf", "../test/RootNode.dyf"};
            var request = new PackageVersionUpload(nv, files);
            Console.WriteLine(request.RequestBody.AsJson());
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Attempt to upload PackageVersionUpload
 /// </summary>
 /// <param name="pkgVersUpload"> The PackageUpload object - the payload </param>
 public void Publish(PackageVersionUpload pkgVersUpload)
 {
     ThreadStart start = () =>
         {
             try
             {
                 ResponseWithContentBody<PackageHeader> ret =
                     Client.ExecuteAndDeserializeWithContent<PackageHeader>(pkgVersUpload);
                 dynSettings.Bench.Dispatcher.BeginInvoke((Action) (() =>
                     {
                         dynSettings.Controller.DynamoViewModel.Log(ret.message);
                         SavePackageHeader(ret.content);
                     }));
             }
             catch
             {
                 dynSettings.Bench.Dispatcher.BeginInvoke(
                     (Action) (() => dynSettings.Controller.DynamoViewModel.Log("Failed to publish package.")));
             }
         };
     new Thread(start).Start();
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Create a PackageVersionUpload object from the given data
        /// </summary>
        /// <param name="funDef"> The function definition for the user-defined node </param>
        /// <param name="packageHeader"> The PackageHeader object </param>
        /// <param name="version"> The version, specified in X.Y.Z form</param>
        /// <param name="description"> A description of the user-defined node </param>
        /// <param name="keywords"> Keywords to describe the user-defined node </param>
        /// <param name="license"> A license string (e.g. "MIT") </param>
        /// <param name="group"> The "group" for the package (e.g. DynamoTutorial) </param>
        /// <returns>Returns null if it fails to get the xmlDoc, otherwise a valid PackageVersionUpload  </returns>
        public PackageVersionUpload GetPackageVersionUpload(FunctionDefinition funDef, PackageHeader packageHeader,
                                                            string version,
                                                            string description, List<string> keywords, string license,
                                                            string group)
        {
            // var group = ((FuncWorkspace) funDef.Workspace).Category;
            string name = funDef.Workspace.Name;
            var xml = dynWorkspaceModel.GetXmlDocFromWorkspace(funDef.Workspace, false);
            if (xml == null) return null;
            var contents = xml.OuterXml;
            string engineVersion = "0.1.0"; //nope
            string engineMetadata = "FunctionDefinitionGuid:" + funDef.FunctionId.ToString();

            var pkg = new PackageVersionUpload(name, version, description, keywords, contents, "dynamo",
                                                engineVersion,
                                                engineMetadata);
            return pkg;
        }