Ajuste de codigo para peticion a url de enpoint de task status
This commit is contained in:
@@ -28,6 +28,8 @@ public class ApiClient : IDisposable
|
||||
private string? _currentRefreshToken;
|
||||
private readonly object _tokenLock = new object();
|
||||
|
||||
private string DominioEFC = Helpers.DominioExpedienteElectronico();
|
||||
|
||||
|
||||
public ApiClient(TimeSpan? timeout = null, int maxRetries = 3, TimeSpan? retryDelay = null)
|
||||
{
|
||||
@@ -57,6 +59,10 @@ public class ApiClient : IDisposable
|
||||
return @"/api/v1/token/refresh/";
|
||||
}
|
||||
|
||||
public string EndpointStatusTask()
|
||||
{
|
||||
return @"/api/v1/tasks/status/";
|
||||
}
|
||||
|
||||
private void SetAuthorizationBearer(string token, string refresh_token)
|
||||
{
|
||||
@@ -277,6 +283,13 @@ public class ApiClient : IDisposable
|
||||
return await SendWithRetriesAsync(() => new HttpRequestMessage(HttpMethod.Get, url));
|
||||
}
|
||||
|
||||
public async Task<string> GetStatusTaskAsync(string taskId)
|
||||
{
|
||||
var apiClient = Globales.ApiClient;
|
||||
string url = DominioEFC + EndpointStatusTask() + $"{taskId}/";
|
||||
return await SendWithRetriesAsync(() => new HttpRequestMessage(HttpMethod.Get, url));
|
||||
}
|
||||
|
||||
public async Task<string> PostJsonAsync(string url, string jsonContent)
|
||||
{
|
||||
using var content = new StringContent(jsonContent, System.Text.Encoding.UTF8, "application/json");
|
||||
|
||||
@@ -498,7 +498,7 @@ namespace EFCDesk.Classes
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
public void MarcarCarpetaProcesada(string ruta, string estado)
|
||||
public void MarcarCarpetaProcesada(string expediente, string estado)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -510,7 +510,7 @@ namespace EFCDesk.Classes
|
||||
|
||||
using (var command = new SQLiteCommand(updateQuery, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@r", ruta);
|
||||
command.Parameters.AddWithValue("@r", expediente);
|
||||
command.Parameters.AddWithValue("@e", estado);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
@@ -545,6 +545,30 @@ namespace EFCDesk.Classes
|
||||
}
|
||||
}
|
||||
|
||||
public void ActaulizarStatusCarpeta(string expediente, string estado)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new SQLiteConnection(_connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string updateQuery = "UPDATE Carpetas SET Estado=@e WHERE Ruta=@r OR Nombre=@r";
|
||||
|
||||
using (var command = new SQLiteCommand(updateQuery, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@r", expediente);
|
||||
command.Parameters.AddWithValue("@e", estado);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public bool EstaArchivoProcesado(string rutaArchivo)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user