田工版本初次提交

This commit is contained in:
2025-12-11 14:13:27 +08:00
parent ab6e620f8e
commit fe7f5313bc
146 changed files with 86546 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="RestSharp" Version="113.0.0" />
</ItemGroup>
</Project>

77
ConsoleApp10/Program.cs Normal file
View File

@@ -0,0 +1,77 @@
using Newtonsoft.Json;
using RestSharp;
namespace ConsoleApp10
{
public class Root
{
public int code { get; set; }
public string message { get; set; }
public Data data { get; set; }
}
public class Data
{
public Table table { get; set; }
}
public class Table
{
public string table_id { get; set; }
public string name { get; set; }
public string alias { get; set; }
public string space_id { get; set; }
public string created_on { get; set; }
public List<dynamic> fields { get; set; }
}
//public class Field
//{
// public string? field_id { get; set; }
// public string? name { get; set; }
// public string? alias { get; set; }
// public string? field_type { get; set; }
// public string? data_type { get; set; }
// public object? from_relation_field { get; set; }
// public bool? required { get; set; }
// public string? description { get; set; }
// public object? config { get; set; }
//}
internal class Program
{
private static readonly string baseUrl = "https://api.huoban.com/";
private static readonly string API_Key = "FIQBLpReK6nAJ0CzYOxmNgKtEpa0cApctanSZyGW";
private static readonly string Space_Id = "4000000007643308";
private static readonly string Table_Id = "2100000061683453";
static void Main(string[] args)
{
// 创建 REST 客户端
var options = new RestClientOptions(baseUrl);
var client = new RestClient(options);
// 创建请求
var request = new RestRequest($"openapi/v1/table/{Table_Id}", Method.Post);
// 添加授权头
request.AddHeader("Open-Authorization", $"Bearer {API_Key}");
request.AddHeader("Content-Type", "application/json");
// 执行请求
var response = client.Execute(request);
Root USA = JsonConvert.DeserializeObject<Root>(response.Content);
var llls = USA.data.table.fields;
foreach (dynamic item in llls)
{
Console.WriteLine(item.name);
Console.WriteLine(item.field_id);
}
Console.ReadLine();
Console.WriteLine("Hello, World!");
Console.WriteLine("Hello, World!");
}
}
}