feat(work): 新增智能表格自动化创建的群聊相关接口
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeLint / Lint (push) Has been cancelled

This commit is contained in:
Fu Diwei
2025-07-23 16:02:04 +08:00
parent dbcccd77fe
commit 8ca323bdac
14 changed files with 270 additions and 6 deletions

View File

@@ -726,6 +726,77 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetDeleteRecordsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#region SmartSheet/GroupChat
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/groupchat/list 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/100989 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetGroupChatListResponse> ExecuteCgibinWedocSmartSheetGroupChatListAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetGroupChatListRequest 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", "groupchat", "list")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetGroupChatListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/groupchat/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101028 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetGroupChatGetResponse> ExecuteCgibinWedocSmartSheetGroupChatGetAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetGroupChatGetRequest 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", "groupchat", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetGroupChatGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedoc/smartsheet/groupchat/update 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/101029 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedocSmartSheetGroupChatUpdateResponse> ExecuteCgibinWedocSmartSheetGroupChatUpdateAsync(this WechatWorkClient client, Models.CgibinWedocSmartSheetGroupChatUpdateRequest 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", "groupchat", "update")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinWedocSmartSheetGroupChatUpdateResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#endregion
#region SpreadSheet

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/groupchat/get 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetGroupChatGetRequest : 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("chat_id")]
[System.Text.Json.Serialization.JsonPropertyName("chat_id")]
public string GroupChatId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/groupchat/get 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetGroupChatGetResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置群聊名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置群主成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("owner")]
[System.Text.Json.Serialization.JsonPropertyName("owner")]
public string OwnerUserId { get; set; } = default!;
/// <summary>
/// 获取或设置群成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_list")]
[System.Text.Json.Serialization.JsonPropertyName("user_list")]
public string[] UserIdList { get; set; } = default!;
}
}

View File

@@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/groupchat/list 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetGroupChatListRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置文档 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("docid")]
[System.Text.Json.Serialization.JsonPropertyName("docid")]
public string DocumentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页游标。
/// </summary>
[Newtonsoft.Json.JsonProperty("cursor")]
[System.Text.Json.Serialization.JsonPropertyName("cursor")]
public string? Cursor { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int? Limit { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/groupchat/list 接口的响应。</para>
/// </summary>
public class CgibinWedocSmartSheetGroupChatListResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置群聊 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("chat_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("chat_id_list")]
public string[] GroupChatIdList { get; set; } = default!;
/// <summary>
/// 获取或设置分页游标。
/// </summary>
[Newtonsoft.Json.JsonProperty("next_cursor")]
[System.Text.Json.Serialization.JsonPropertyName("next_cursor")]
public string? NextCursor { get; set; }
/// <summary>
/// 获取或设置是否还有更多数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("has_more")]
[System.Text.Json.Serialization.JsonPropertyName("has_more")]
public bool HasMore { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedoc/smartsheet/groupchat/update 接口的请求。</para>
/// </summary>
public class CgibinWedocSmartSheetGroupChatUpdateRequest : 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("chat_id")]
[System.Text.Json.Serialization.JsonPropertyName("chat_id")]
public string GroupChatId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置新的群主成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("owner")]
[System.Text.Json.Serialization.JsonPropertyName("owner")]
public string? OwnerUserId { get; set; }
/// <summary>
/// 获取或设置添加的群成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("add_user_list")]
[System.Text.Json.Serialization.JsonPropertyName("add_user_list")]
public IList<string>? AddedUserIdList { get; set; }
/// <summary>
/// 获取或设置移除的群成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("del_user_list")]
[System.Text.Json.Serialization.JsonPropertyName("del_user_list")]
public IList<string>? DeletedUserIdList { get; set; }
}
}

View File

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

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/file_list 接口的请求。</para>
@@ -27,11 +27,11 @@
public int SortType { get; set; }
/// <summary>
/// 获取或设置分页起始位置
/// 获取或设置分页游标
/// </summary>
[Newtonsoft.Json.JsonProperty("start")]
[System.Text.Json.Serialization.JsonPropertyName("start")]
public int Offset { get; set; }
public int Cursor { get; set; }
/// <summary>
/// 获取或设置分页每页数量。

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/file_list 接口的响应。</para>
@@ -120,10 +120,10 @@
public bool HasMore { get; set; }
/// <summary>
/// 获取或设置翻页标记
/// 获取或设置分页游标
/// </summary>
[Newtonsoft.Json.JsonProperty("next_start")]
[System.Text.Json.Serialization.JsonPropertyName("next_start")]
public int? NextStart { get; set; }
public int? NextCursor { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
{
"errcode": 0,
"errmsg": "ok",
"name": "NAME",
"owner": "userid2",
"user_list": [ "userid1", "userid2", "userid3" ]
}

View File

@@ -0,0 +1,5 @@
{
"docid": "DOCID",
"cursor": "CURSOR",
"limit": 2
}

View File

@@ -0,0 +1,7 @@
{
"errcode": 0,
"errmsg": "ok",
"has_more": true,
"next_cursor": "GNIJIGEO",
"chat_id_list": [ "chatid1", "chatid2" ]
}

View File

@@ -0,0 +1,7 @@
{
"docid": "DOCID",
"chat_id": "CHATID",
"owner": "userid",
"add_user_list": [ "userid1", "userid2", "userid3" ],
"del_user_list": [ "userid3", "userid4" ]
}