mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 10:08:20 +08:00
feat(work): 新增批量设置应用在用户工作台展示的数据接口
This commit is contained in:
@@ -243,6 +243,33 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinAgentSetWorkbenchDataResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/agent/batch_set_workbench_data 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/92535 ]]> <br/>
|
||||
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/94620 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinAgentBatchSetWorkbenchDataResponse> ExecuteCgibinAgentBatchSetWorkbenchDataAsync(this WechatWorkClient client, Models.CgibinAgentBatchSetWorkbenchDataRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (request.AgentId is null)
|
||||
request.AgentId = client.Credentials.AgentId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "agent", "batch_set_workbench_data")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinAgentBatchSetWorkbenchDataResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,91 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/agent/batch_set_workbench_data 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinAgentBatchSetWorkbenchDataRequest : WechatWorkRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class KeyDataTemplate : CgibinAgentSetWorkbenchDataRequest.Types.KeyDataTemplate
|
||||
{
|
||||
}
|
||||
|
||||
public class ImageTemplate : CgibinAgentSetWorkbenchDataRequest.Types.ImageTemplate
|
||||
{
|
||||
}
|
||||
|
||||
public class WebviewTemplate : CgibinAgentSetWorkbenchDataRequest.Types.WebviewTemplate
|
||||
{
|
||||
}
|
||||
|
||||
public class ListTemplate : CgibinAgentSetWorkbenchDataRequest.Types.ListTemplate
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模版类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关键数据型模版数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("keydata")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("keydata")]
|
||||
public Types.KeyDataTemplate? KeyDataTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图片型模版数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("image")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("image")]
|
||||
public Types.ImageTemplate? ImageTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置列表型模版数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("list")]
|
||||
public Types.ListTemplate? ListTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置网页型模版数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("webview")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("webview")]
|
||||
public Types.WebviewTemplate? WebviewTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置应用 ID。如果不指定将使用构造 <see cref="WechatWorkClient"/> 时的 <see cref="WechatWorkClientOptions.AgentId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("agentid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("agentid")]
|
||||
public int? AgentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("userid_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
|
||||
public IList<string> UserIdList { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户设置的数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/agent/batch_set_workbench_data 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinAgentBatchSetWorkbenchDataResponse : WechatWorkResponse
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"agentid": 1000005,
|
||||
"userid_list": [ "userid1", "userid2" ],
|
||||
"data": {
|
||||
"type": "keydata",
|
||||
"keydata": {
|
||||
"items": [
|
||||
{
|
||||
"key": "待审批",
|
||||
"data": "0",
|
||||
"jump_url": "http://www.qq.com",
|
||||
"pagepath": "pages/index"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user