Ejemplo n.º 1
0
            internal static TRes MakeApiRequest <TReq, TRes>(
                Uri endpoint,
                HttpMethod httpMethod,
                TReq body,
                string actionDescription,
                string apiKey)
            {
                try
                {
                    HttpWebRequest request = CreateWebRequest <TReq>(
                        endpoint, httpMethod, body, apiKey);

                    return(GetResponse <TRes>(request));
                }
                catch (WebException ex)
                {
                    throw WebServiceException.AdaptException(ex, actionDescription, endpoint);
                }
                catch (Exception ex)
                {
                    LogException(
                        actionDescription,
                        ex.Message,
                        ex.StackTrace,
                        endpoint,
                        HttpStatusCode.OK);
                    throw;
                }
            }
Ejemplo n.º 2
0
            internal static void MakeApiRequest(
                Uri endpoint, HttpMethod httpMethod, string actionDescription, string apiKey)
            {
                try
                {
                    HttpWebRequest request = CreateWebRequest(
                        endpoint, httpMethod, apiKey);

                    GetResponse(request);
                }
                catch (WebException ex)
                {
                    throw WebServiceException.AdaptException(ex, actionDescription, endpoint);
                }
                catch (Exception ex)
                {
                    LogException(
                        actionDescription,
                        ex.Message,
                        ex.StackTrace,
                        endpoint,
                        HttpStatusCode.OK);
                    throw;
                }
            }