Example #1
0
        /*
         * Service Publishing input details are given(the endpoint to unpublish)
         * This function is where the interaction between the RegistryAccess class
         * The deserialization to display the response provided by the Registry
         * Display the Status of the service invocation
         *
         */

        static void unpublishService()
        {
            IRestResponse response;

            Models.StatusDetailsIntermed status = new Models.StatusDetailsIntermed();

            Console.Clear();
            string APIEndpoint;

            Console.WriteLine("\n----------Publish Service----------\n");

            Console.Write("\nEnter Service Endpoint  :");
            APIEndpoint = Console.ReadLine();

            //Fetching response
            response = Models.RegistryAccess.unpublish(APIEndpoint, Program.token);

            //De-serialize response to StatusDetailsIntermed object
            status = JsonConvert.DeserializeObject <Models.StatusDetailsIntermed>(response.Content);

            Console.WriteLine($"Status : {status.Status}");
            Console.WriteLine($"Reason : {status.Reason}");

            Console.ReadLine();
        }
Example #2
0
        /*
         * Service Publishing input details are given
         * This function is where the interaction between the RegistryAccess class
         * The deserialization to display the response provided by the Registry
         * Display the Status of the service invocation
         *
         */
        static void publishService()
        {
            IRestResponse response;

            Models.StatusDetailsIntermed status = new Models.StatusDetailsIntermed();

            Console.Clear();
            string serviceName, description, APIEndpoint, numberOfOperands, operandTypes;

            Console.WriteLine("\n----------Publish Service----------\n");

            Console.Write("\nEnter Service name  :");
            serviceName = Console.ReadLine();

            Console.Write("\nEnter description :");
            description = Console.ReadLine();

            Console.Write("\nEnter API endpoint :");
            APIEndpoint = Console.ReadLine();

            Console.Write("\nEnter number of operands :");
            numberOfOperands = Console.ReadLine();

            Console.Write("\nEnter operand types:");
            operandTypes = Console.ReadLine();

            //calling static Registry.publish()
            response = Models.RegistryAccess.publish(serviceName, description, APIEndpoint, numberOfOperands, operandTypes, Program.token);


            //De-serialize response
            status = JsonConvert.DeserializeObject <Models.StatusDetailsIntermed>(response.Content);

            Console.WriteLine($"Status : {status.Status}");
            Console.WriteLine($"Reason : {status.Reason}");

            Console.ReadLine();
        }