mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(work): 新增企业邮箱功能设置相关接口
This commit is contained in:
parent
d740f89db6
commit
7dd592b5f3
@ -222,6 +222,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Account
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/exmail/account/act_email 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95512 </para>
|
||||
@ -241,5 +242,48 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExmailAccountActiveEmailResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UserOption
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/exmail/useroption/get 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95513 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExmailUserOptionGetResponse> ExecuteCgibinExmailUserOptionGetAsync(this WechatWorkClient client, Models.CgibinExmailUserOptionGetRequest 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
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "exmail", "useroption", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExmailUserOptionGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/exmail/useroption/update 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95513 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExmailUserOptionUpdateResponse> ExecuteCgibinExmailUserOptionUpdateAsync(this WechatWorkClient client, Models.CgibinExmailUserOptionUpdateRequest 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
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "exmail", "useroption", "update")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExmailUserOptionUpdateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/exmail/useroption/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExmailUserOptionGetRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置成员账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置属性类型列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public IList<int> TypeList { get; set; } = new List<int>();
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/exmail/useroption/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExmailUserOptionGetResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class UserOptionList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("list")]
|
||||
public UserOptionItem[] Items { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class UserOptionItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置属性类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置属性值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("value")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("value")]
|
||||
public string Value { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("option")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("option")]
|
||||
public Types.UserOptionList UserOptionList { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/exmail/useroption/update 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExmailUserOptionUpdateRequest : WechatWorkRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class UserOptionList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("list")]
|
||||
public IList<UserOptionItem> Items { get; set; } = new List<UserOptionItem>();
|
||||
}
|
||||
|
||||
public class UserOptionItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置属性类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置属性值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("value")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("value")]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置成员账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能设置列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("option")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("option")]
|
||||
public Types.UserOptionList UserOptionList { get; set; } = new Types.UserOptionList();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/exmail/useroption/update 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExmailUserOptionUpdateResponse : WechatWorkResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"userid": "zhangsan",
|
||||
"type": [1, 2, 3]
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"option": {
|
||||
"list": [
|
||||
{
|
||||
"type": 1,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"type": 2,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"type": 3,
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"userid": "zhangsan",
|
||||
"option": {
|
||||
"list": [
|
||||
{
|
||||
"type": 1,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"type": 2,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"type": 3,
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok"
|
||||
}
|
Loading…
Reference in New Issue
Block a user