Пример #1
0
        /*
         * @param string of ServiceDetailsIntermed to publish
         * @returns response provided by Registry as IRestResponse
         */
        public static IRestResponse publish(string serviceName, string description, string APIEndpoint, string numberOfOperands, string operandTypes, int token)
        {
            assignURLtoRestClient();

            //Have to decode API endpoint as it is a URL
            String decodedEndPointURL = Uri.EscapeDataString(APIEndpoint);

            //creating and assigning ServiceDetailsIntermed
            ServiceDetailsIntermed serviceDetails = new ServiceDetailsIntermed();

            serviceDetails.name             = serviceName;
            serviceDetails.description      = description;
            serviceDetails.serviceEndPoint  = decodedEndPointURL;
            serviceDetails.numberOfOperands = numberOfOperands;
            serviceDetails.operandType      = operandTypes;

            //Serializing object to Json String
            string jsonString = JsonConvert.SerializeObject(serviceDetails);

            // Calling GET api/publish/{token}?jsonServiceDescriptionString={jsonServiceDescriptionString}
            RestRequest   request  = new RestRequest($"api/publish/{token}?jsonServiceDescriptionString={jsonString}");
            IRestResponse response = restClient.Get(request);

            return(response);
        }
Пример #2
0
        /*
         * @param APIEndpoint to unpublish
         * @returns response provided by Registry as IRestResponse
         */

        public static IRestResponse unpublish(string APIEndpoint, int token)
        {
            assignURLtoRestClient();

            //Have to decode API endpoint as it is a URL
            String decodedEndPointURL = Uri.EscapeDataString(APIEndpoint);

            ServiceDetailsIntermed serviceDetails = new ServiceDetailsIntermed();

            //assigning endpoint to object
            serviceDetails.serviceEndPoint = decodedEndPointURL;


            //Serialize object to json String
            string jsonString = JsonConvert.SerializeObject(serviceDetails);

            // GET api/unpublish/{token}?serviceEndPointString={serviceEndPointString}
            RestRequest request = new RestRequest($"api/unpublish/{token}?serviceEndPointString={jsonString}");

            IRestResponse response = restClient.Get(request);

            return(response);
        }