feat(work): 新增智能表格内容编组相关接口

This commit is contained in:
Fu Diwei
2025-11-26 10:11:48 +08:00
parent e2b90ac941
commit 5c48ed6e99
16 changed files with 488 additions and 0 deletions

View File

@@ -727,6 +727,98 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetDeleteRecordsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/get_field_groups 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101103 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetGetFieldGroupsResponse> ExecuteCgibinWedocSmartSheetGetFieldGroupsAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetGetFieldGroupsRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "wedoc", "smartsheet", "get_field_groups")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetGetFieldGroupsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/add_field_group 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101100 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetAddFieldGroupResponse> ExecuteCgibinWedocSmartSheetAddFieldGroupAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetAddFieldGroupRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "wedoc", "smartsheet", "add_field_group")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetAddFieldGroupResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/update_field_group 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101101 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetUpdateFieldGroupResponse> ExecuteCgibinWedocSmartSheetUpdateFieldGroupAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetUpdateFieldGroupRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "wedoc", "smartsheet", "update_field_group")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetUpdateFieldGroupResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/delete_field_groups 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101102 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetDeleteFieldGroupsResponse> ExecuteCgibinWedocSmartSheetDeleteFieldGroupsAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetDeleteFieldGroupsRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "wedoc", "smartsheet", "delete_field_groups")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetDeleteFieldGroupsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#region SmartSheet/GroupChat
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/groupchat/list 接口。</para>

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/add_field_group 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetAddFieldGroupRequest : WechatWorkRequest
{
public static class Types
{
public class Field
{
/// <summary>
/// 获取或设置字段 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_id")]
[System.Text.Json.Serialization.JsonPropertyName("field_id")]
public string FieldId { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置文档 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("docid")]
[System.Text.Json.Serialization.JsonPropertyName("docid")]
public string DocumentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子表 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sheet_id")]
[System.Text.Json.Serialization.JsonPropertyName("sheet_id")]
public string SheetId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置编组名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置字段列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("children")]
[System.Text.Json.Serialization.JsonPropertyName("children")]
public IList<Types.Field>? FieldList { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/add_field_group 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetAddFieldGroupResponse : WechatWorkResponse
{
public static class Types
{
public class FieldGroup : CgibinWedocSmartSheetGetFieldGroupsResponse.Types.FieldGroup
{
}
}
/// <summary>
/// 获取或设置编组信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_group")]
[System.Text.Json.Serialization.JsonPropertyName("field_group")]
public Types.FieldGroup FieldGroup { get; set; } = default!;
}
}

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/delete_field_groups 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetDeleteFieldGroupsRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置文档 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("docid")]
[System.Text.Json.Serialization.JsonPropertyName("docid")]
public string DocumentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子表 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sheet_id")]
[System.Text.Json.Serialization.JsonPropertyName("sheet_id")]
public string SheetId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置编组 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_group_ids")]
[System.Text.Json.Serialization.JsonPropertyName("field_group_ids")]
public IList<string> FieldGroupIdList { get; set; } = new List<string>();
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/delete_field_groups 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetDeleteFieldGroupsResponse : WechatWorkResponse
{
}
}

View File

@@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/get_field_groups 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetGetFieldGroupsRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置文档 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("docid")]
[System.Text.Json.Serialization.JsonPropertyName("docid")]
public string DocumentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子表 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sheet_id")]
[System.Text.Json.Serialization.JsonPropertyName("sheet_id")]
public string SheetId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int? Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int? Limit { get; set; }
}
}

View File

@@ -0,0 +1,76 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/get_field_groups 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetGetFieldGroupsResponse : WechatWorkResponse
{
public static class Types
{
public class FieldGroup
{
public static class Types
{
public class Field
{
/// <summary>
/// 获取或设置字段 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_id")]
[System.Text.Json.Serialization.JsonPropertyName("field_id")]
public string FieldId { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置编组 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_group_id")]
[System.Text.Json.Serialization.JsonPropertyName("field_group_id")]
public string FieldGroupId { get; set; } = default!;
/// <summary>
/// 获取或设置编组名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置字段列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("children")]
[System.Text.Json.Serialization.JsonPropertyName("children")]
public Types.Field[] FieldList { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置编组列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_groups")]
[System.Text.Json.Serialization.JsonPropertyName("field_groups")]
public Types.FieldGroup[] FieldGroupList { get; set; } = default!;
/// <summary>
/// 获取或设置总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total")]
[System.Text.Json.Serialization.JsonPropertyName("total")]
public int TotalCount { get; set; }
/// <summary>
/// 获取或设置是否还有更多数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("has_more")]
[System.Text.Json.Serialization.JsonPropertyName("has_more")]
public bool HasMore { get; set; }
/// <summary>
/// 获取或设置下一页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("next")]
[System.Text.Json.Serialization.JsonPropertyName("next")]
public int? NextOffset { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/update_field_group 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetUpdateFieldGroupRequest : WechatWorkRequest
{
public static class Types
{
public class Field
{
/// <summary>
/// 获取或设置字段 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_id")]
[System.Text.Json.Serialization.JsonPropertyName("field_id")]
public string FieldId { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置文档 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("docid")]
[System.Text.Json.Serialization.JsonPropertyName("docid")]
public string DocumentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子表 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sheet_id")]
[System.Text.Json.Serialization.JsonPropertyName("sheet_id")]
public string SheetId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置编组 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_group_id")]
[System.Text.Json.Serialization.JsonPropertyName("field_group_id")]
public string FieldGroupId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置编组名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置字段列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("children")]
[System.Text.Json.Serialization.JsonPropertyName("children")]
public IList<Types.Field>? FieldList { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/update_field_group 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetUpdateFieldGroupResponse : WechatWorkResponse
{
public static class Types
{
public class FieldGroup : CgibinWedocSmartSheetAddFieldGroupResponse.Types.FieldGroup
{
}
}
/// <summary>
/// 获取或设置编组信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("field_group")]
[System.Text.Json.Serialization.JsonPropertyName("field_group")]
public Types.FieldGroup FieldGroup { get; set; } = default!;
}
}