27 lines
993 B
C#
27 lines
993 B
C#
namespace BackupPipefy.Infrastructure.Services
|
|
{
|
|
public class PipefyClient
|
|
{
|
|
private readonly HttpClient _httpClient;
|
|
|
|
public PipefyClient(string apiToken)
|
|
{
|
|
_httpClient = new HttpClient();
|
|
_httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
|
|
}
|
|
|
|
public async Task<string> GetCardsAsync(int pipeId, DateTime? lastUpdated = null)
|
|
{
|
|
// Aqui você vai montar sua query GraphQL real
|
|
string query = "{ allCards { edges { node { id updated_at } } } }";
|
|
|
|
var payload = new { query };
|
|
var content = new StringContent(System.Text.Json.JsonSerializer.Serialize(payload), System.Text.Encoding.UTF8, "application/json");
|
|
|
|
var response = await _httpClient.PostAsync("https://api.pipefy.com/graphql", content);
|
|
response.EnsureSuccessStatusCode();
|
|
|
|
return await response.Content.ReadAsStringAsync();
|
|
}
|
|
}
|
|
} |