src/Stratis.FederatedSidechains.AdminDashboard/Rest/ApiRequester.cs
/// <summary>
/// Make a HTTP request to a specified node
/// </summary>
/// <param name="endpoint">HTTP node endpoint</param>
/// <param name="path">URL</param>
/// <returns>An ApiResponse object</returns>
Make a HTTP request to a specified node
Make a HTTP request to a specified node
public static async Task<ApiResponse> GetRequestAsync(string endpoint, string path)
        {
            var restClient = new RestClient(string.Concat(endpoint, path));
            var restRequest = new RestRequest(Method.GET);
            IRestResponse restResponse = await restClient.ExecuteTaskAsync(restRequest);
            return new ApiResponse
            {
                IsSuccess = restResponse.StatusCode.Equals(HttpStatusCode.OK),
                Content = JsonConvert.DeserializeObject(restResponse.Content)
            };
        }
public static async Task < ApiResponse > GetRequestAsync ( string endpoint , string path ) { var restClient = new RestClient ( string . Concat ( endpoint , path ) ) ; var restRequest = new RestRequest ( Method . GET ) ; IRestResponse restResponse = await restClient . ExecuteTaskAsync ( restRequest ) ; return new ApiResponse { IsSuccess = restResponse . StatusCode . Equals ( HttpStatusCode . OK ) , Content = JsonConvert . DeserializeObject ( restResponse . Content ) } ; }
Make a HTTP request to a specified node
Make a HTTP request to a specified node
An ApiResponse object
An ApiResponse object
endpoint
string
HTTP node endpoint
HTTP node endpoint
path
string
None