mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-03-10 00:13:36 +08:00
feat(work): 随官方更新上下游通讯录管理相关接口模型
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|||||||
@@ -71,6 +71,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Corp
|
#region Corp
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/corpgroup/corp/gettoken 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/93359 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinCorpGroupCorpGetTokenResponse> ExecuteCgibinCorpGroupCorpGetTokenAsync(this WechatWorkClient client, Models.CgibinCorpGroupCorpGetTokenRequest 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", "corpgroup", "corp", "gettoken")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpGetTokenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>异步调用 [POST] /cgi-bin/corpgroup/corp/list_app_share_info 接口。</para>
|
/// <para>异步调用 [POST] /cgi-bin/corpgroup/corp/list_app_share_info 接口。</para>
|
||||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/93403 </para>
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/93403 </para>
|
||||||
@@ -95,26 +115,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpListAppShareInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpListAppShareInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// <para>异步调用 [POST] /cgi-bin/corpgroup/corp/gettoken 接口。</para>
|
|
||||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/93359 </para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static async Task<Models.CgibinCorpGroupCorpGetTokenResponse> ExecuteCgibinCorpGroupCorpGetTokenAsync(this WechatWorkClient client, Models.CgibinCorpGroupCorpGetTokenRequest 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", "corpgroup", "corp", "gettoken")
|
|
||||||
.SetQueryParam("access_token", request.AccessToken);
|
|
||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpGetTokenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>异步调用 [GET] /cgi-bin/corpgroup/corp/get_chain_list 接口。</para>
|
/// <para>异步调用 [GET] /cgi-bin/corpgroup/corp/get_chain_list 接口。</para>
|
||||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95315 </para>
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95315 </para>
|
||||||
@@ -214,6 +214,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpRemoveCorpResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpRemoveCorpResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/corpgroup/corp/get_chain_user_custom_id 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/97441 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinCorpGroupCorpGetChainUserCustomIdResponse> ExecuteCgibinCorpGroupCorpGetChainUserCustomIdAsync(this WechatWorkClient client, Models.CgibinCorpGroupCorpGetChainUserCustomIdRequest 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", "corpgroup", "corp", "get_chain_user_custom_id")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinCorpGroupCorpGetChainUserCustomIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Rule
|
#region Rule
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
|||||||
[Newtonsoft.Json.JsonProperty("mobile")]
|
[Newtonsoft.Json.JsonProperty("mobile")]
|
||||||
[System.Text.Json.Serialization.JsonPropertyName("mobile")]
|
[System.Text.Json.Serialization.JsonPropertyName("mobile")]
|
||||||
public string? MobileNumber { get; set; }
|
public string? MobileNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置上下游用户自定义 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("user_custom_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("user_custom_id")]
|
||||||
|
public string? UserCustomId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/corpgroup/corp/get_chain_user_custom_id 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinCorpGroupCorpGetChainUserCustomIdRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置上下游 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("chain_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("chain_id")]
|
||||||
|
public string ChainId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置下级企业 CorpId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
|
public string CorpId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置下级企业成员 UserId
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||||
|
public string UserId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/corpgroup/corp/get_chain_user_custom_id 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinCorpGroupCorpGetChainUserCustomIdResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置上下游用户自定义 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("user_custom_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("user_custom_id")]
|
||||||
|
public string UserCustomId { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>表示 [POST] /cgi-bin/corpgroup/corp/remove_corp 接口的请求。</para>
|
/// <para>表示 [POST] /cgi-bin/corpgroup/corp/remove_corp 接口的请求。</para>
|
||||||
@@ -17,6 +17,13 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonProperty("corpid")]
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
public string CorpId { get; set; } = string.Empty;
|
public string? CorpId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置未加入的企业 CorpId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("pending_corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("pending_corpid")]
|
||||||
|
public string? PendingCorpId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"chain_id": "xxxxxx",
|
"chain_id": "xxxxxx",
|
||||||
"contact_list": [
|
"contact_list": [
|
||||||
{
|
{
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
{
|
{
|
||||||
"name": "张三",
|
"name": "张三",
|
||||||
"identity_type": 1,
|
"identity_type": 1,
|
||||||
"mobile": "13000000001"
|
"mobile": "13000000001",
|
||||||
|
"user_custom_id": "100"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "李四",
|
"name": "李四",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"chain_id": "Chxxxxxx",
|
||||||
|
"corpid": "xxxxx",
|
||||||
|
"userid": "xxxxx"
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"user_custom_id": "1234"
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"chain_id": "xxxx",
|
"chain_id": "xxxx",
|
||||||
"corpid": "xxxxx"
|
"corpid": "xxxxx",
|
||||||
|
"pending_corpid": "xxxx"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user