예제 #1
0
 public static async Task <T> PostApiWithoutAuthentication <T>(string urlService, string endpoint, string contentRequest)
 {
     try
     {
         //Create and Load Http Client
         HttpClient client = LoadHttpClient.GetHttpClient(urlService: urlService);
         //Post Request
         return(await PostApiRequest <T>(client, endpoint, contentRequest));
     }
     catch (Exception ex)
     {
         throw ex;//return error
     }
 }
예제 #2
0
        public static async Task <T> PostApiWithAuthentication <T>(string urlService, string endpoint, string contentRequest, string username, string password)
        {
            try
            {
                //Create and Load Http Client
                HttpClient client = await LoadHttpClient.GetHttpClientWithToken(urlService : urlService, username : username, password : password);

                //Post Request
                return(await PostApiRequest <T>(client, endpoint, contentRequest));
            }
            catch (Exception ex)
            {
                throw ex;//return error
            }
        }
예제 #3
0
 public AuthenticationRequest(string urlService)
 {
     _client = LoadHttpClient.GetHttpClient(urlService);
 }