Ejemplo n.º 1
0
        /// <summary>
        /// Create Request Configuration
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        private static HttpRequestMessage CreateRequestConfig(string url, BaseParameter param, HttpMethod method)
        {
#if NET45
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
#endif
            var authorization = UizaConfiguration.GetAuthorization();
            if (string.IsNullOrWhiteSpace(authorization))
            {
                ThrowConfigurationError();
            }

            var apiUrl = $"{UizaConfiguration.ApiBase}/{Constants.DEFAULT_API_ROUTE}/{url}".FormatUrl();

            var request = RenderRequest(method, apiUrl, param);
            request.Headers.Add("Authorization", UizaConfiguration.GetAuthorization());

            return(request);
        }
Ejemplo n.º 2
0
 private static void Main(string[] args)
 {
     try
     {
         UizaConfiguration.SetupUiza(new UizaConfigOptions
         {
             Authorization = "uap-b2a3e6307dcf421a8a455825c01de914-3ada3aa3",
             AppId         = "b2a3e6307dcf421a8a455825c01de914"
         });
         //TestEntity();
         //TestCategory();
         //TestStorage();
         //TestCallback();
         //TestLive();
         TestUser();
         Console.ReadLine();
     }
     catch (UizaException ex)
     {
         var result = ex.UizaInnerException.Error;
         Console.WriteLine(ex.Message);
         Console.ReadLine();
     }
 }