コード例 #1
0
ファイル: Client.cs プロジェクト: nmirceac/apiTools
        public static ApiClientTools.Response doPostRequest(string endpoint, Dictionary <string, string> endpointParams = null, ExpandoObject data = null)
        {
            ApiClientTools.Request request = new ApiClientTools.Request();
            request.endpointUrl    = endpoint;
            request.endpointParams = endpointParams;
            request.payloadData    = data;
            request.method         = System.Net.Http.HttpMethod.Post;

            HttpClient client   = new HttpClient(getHttpHandler());
            var        response = client.SendAsync(request.getHttpRequest()).Result;

            ApiClientTools.Response apiClientToolsResponse = ApiClientTools.Response.processResponse(request, response);
            return(apiClientToolsResponse);
        }
コード例 #2
0
ファイル: Client.cs プロジェクト: nmirceac/JokesTutorial
        public static async Task <ApiClientTools.Response> doGetRequest(string endpoint, Dictionary <string, string> endpointParams = null, Dictionary <string, string> endpointData = null)
        {
            ApiClientTools.Request request = new ApiClientTools.Request();
            request.endpointUrl     = endpoint;
            request.endpointParams  = endpointParams;
            request.endpointUrlData = endpointData;
            request.method          = System.Net.Http.HttpMethod.Get;

            HttpClient client   = new HttpClient();
            var        response = await client.SendAsync(request.getHttpRequest());

            ApiClientTools.Response apiClientToolsResponse = ApiClientTools.Response.processResponse(request, response);
            return(apiClientToolsResponse);
        }