20231122 - Pronto para finalizar
This commit is contained in:
parent
b238bbe353
commit
412b28eec3
@ -9,6 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
||||
20
Program.cs
20
Program.cs
@ -10,7 +10,6 @@ using Pipefy;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Net.Quic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.UserSecrets;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@ -18,16 +17,19 @@ class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
|
||||
IConfiguration configuration = configurationBuilder.AddUserSecrets<Program>().Build();
|
||||
|
||||
Console.Clear();
|
||||
// URL da API que você deseja chamar
|
||||
string ConnSourcePath = @"C:\Users\contratos\Documents\Giuliano\Pipefy.accdb";
|
||||
string apiUrl = Environment.GetEnvironmentVariable("PIPEFY_API_URL");
|
||||
string PipefyToken = Environment.GetEnvironmentVariable("PIPEFY_API_TOKEN");
|
||||
string PipefyTokenTableID = Environment.GetEnvironmentVariable("PIPEFY_TABLE_ID");
|
||||
string ConnSourcePath = configuration.GetValue<string>("DB_PATH");
|
||||
string apiUrl = configuration.GetValue<string>("PIPEFY_API_URL");
|
||||
string PipefyToken = configuration.GetValue<string>("PIPEFY_API_TOKEN");
|
||||
string PipefyTokenTableID = configuration.GetValue<string>("PIPEFY_TABLE_ID");
|
||||
string PipefyTokenTableIDGestores = configuration.GetValue<string>("PIPEFY_TABLE_ID_GESTORES");
|
||||
|
||||
JArray allRecords = await GetPipefyDataAsync(apiUrl,PipefyToken,PipefyTokenTableID);
|
||||
JArray allGestores = await GetPipefyDataAsync(apiUrl, PipefyToken, "mGCNlqoB");
|
||||
JArray allGestores = await GetPipefyDataAsync(apiUrl, PipefyToken, PipefyTokenTableIDGestores);
|
||||
|
||||
Console.Clear();
|
||||
|
||||
@ -54,7 +56,6 @@ class Program
|
||||
if (recordsMissingInJson.Count != 0)
|
||||
{
|
||||
string strQuery = "{\"query\":\"mutation {\\r\\n ";
|
||||
|
||||
for (int i = 0; i < recordsMissingInJson.Count; i++)
|
||||
{
|
||||
if (i % 49 == 0) { strQuery = "{\"query\":\"mutation {\\r\\n "; }
|
||||
@ -109,7 +110,7 @@ class Program
|
||||
var content = new StringContent(query, null, "application/json");
|
||||
request.Content = content;
|
||||
var response = await httpClient.SendAsync(request);
|
||||
|
||||
var body = JsonConvert.SerializeObject(response.Content);
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
private static async Task<JArray> GetPipefyDataAsync(string apiUrl, string PipefyToken, string PipefyTokenTableID)
|
||||
@ -188,6 +189,7 @@ class Program
|
||||
nome_da_empresa = (string)reader["Nome da empresa"],
|
||||
modalidade = (string)reader["modalidade"],
|
||||
gestores = (string)reader["gestores"],
|
||||
rec_id = ""
|
||||
|
||||
// Adicione outras propriedades conforme necessário
|
||||
};
|
||||
@ -206,6 +208,8 @@ class Program
|
||||
for (int i = 0;i<jsonData.Count;i++)
|
||||
{
|
||||
Pipefy.ClasseEmpresas record = new Pipefy.ClasseEmpresas();
|
||||
record.rec_id = jsonData[i].node.id;
|
||||
|
||||
for (int j = 0;j < jsonData[i].node.record_fields.Length;j++)
|
||||
{
|
||||
switch (jsonData[i].node.record_fields[j].field.id)
|
||||
|
||||
3
data.cs
3
data.cs
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Pipefy
|
||||
{
|
||||
@ -22,6 +23,7 @@ namespace Pipefy
|
||||
|
||||
public class Node
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Record_Fields[] record_fields { get; set; }
|
||||
}
|
||||
public class NodeGestor
|
||||
@ -47,6 +49,7 @@ namespace Pipefy
|
||||
public string ?nome_da_empresa { get; set; }
|
||||
public string ?modalidade { get; set; }
|
||||
public string ?gestores { get; set; }
|
||||
public string rec_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user