public async Task<Result> DeleteData(Uri uri, StringContent json, UserAuthenticationEntity userAuthenticationEntity, string language = "ja")
{
using (var httpClient = new HttpClient())
{
try
{
var authenticationManager = new AuthenticationManager();
Result result = new Result(false, "");
if (RefreshTime(userAuthenticationEntity.ExpiresInDate))
{
var tokens = await authenticationManager.RefreshAccessToken(userAuthenticationEntity.RefreshToken);
result.Tokens = tokens.Tokens;
}
httpClient.DefaultRequestHeaders.Add("Accept-Language", language);
httpClient.DefaultRequestHeaders.Add("Origin", "http://psapp.dl.playstation.net");
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userAuthenticationEntity.AccessToken);
var response = await httpClient.DeleteAsync(uri);
var responseContent = await response.Content.ReadAsStringAsync();
result.IsSuccess = response.IsSuccessStatusCode;
result.ResultJson = responseContent;
return result;
}
catch (Exception)
{
return new Result(false, string.Empty);
}
}
}