mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 05:13:17 +08:00
feat(work): 新增自建应用代开发 ID 转换相关接口
This commit is contained in:
parent
4d9163ded1
commit
0ca361f14b
@ -119,5 +119,25 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinBatchGetResultResponse>(flurlReq, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinBatchGetResultResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/batch/userid_to_openuserid 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95435 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinBatchUserIdToOpenUserIdResponse> ExecuteCgibinBatchUserIdToOpenUserIdAsync(this WechatWorkClient client, Models.CgibinBatchUserIdToOpenUserIdRequest 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", "batch", "userid_to_openuserid")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinBatchUserIdToOpenUserIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1745,5 +1745,49 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactDeleteInterceptRuleResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactDeleteInterceptRuleResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Migration
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/externalcontact/get_new_external_userid 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95327 </para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95435 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinExternalContactGetNewExternalUserIdResponse> ExecuteCgibinExternalContactGetNewExternalUserIdAsync(this WechatWorkClient client, Models.CgibinExternalContactGetNewExternalUserIdRequest 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", "externalcontact", "get_new_external_userid")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGetNewExternalUserIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/externalcontact/groupchat/get_new_external_userid 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95327 </para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95435 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinExternalContactGroupChatGetNewExternalUserIdResponse> ExecuteCgibinExternalContactGroupChatGetNewExternalUserIdAsync(this WechatWorkClient client, Models.CgibinExternalContactGroupChatGetNewExternalUserIdRequest 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", "externalcontact", "groupchat", "get_new_external_userid")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGroupChatGetNewExternalUserIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -657,27 +657,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ExternalContactMigration
|
#region Migration
|
||||||
/// <summary>
|
|
||||||
/// <para>异步调用 [POST] /cgi-bin/externalcontact/get_new_external_userid 接口。</para>
|
|
||||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95327 </para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static async Task<Models.CgibinExternalContactGetNewExternalUserIdResponse> ExecuteCgibinExternalContactGetNewExternalUserIdAsync(this WechatWorkClient client, Models.CgibinExternalContactGetNewExternalUserIdRequest 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", "externalcontact", "get_new_external_userid")
|
|
||||||
.SetQueryParam("access_token", request.AccessToken);
|
|
||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGetNewExternalUserIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>异步调用 [POST] /cgi-bin/service/externalcontact/finish_external_userid_migration 接口。</para>
|
/// <para>异步调用 [POST] /cgi-bin/service/externalcontact/finish_external_userid_migration 接口。</para>
|
||||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95327 </para>
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95327 </para>
|
||||||
@ -717,6 +697,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceExternalContactUnionIdToExternalUserId3rdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinServiceExternalContactUnionIdToExternalUserId3rdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/service/corpid_to_opencorpid 接口。</para>
|
||||||
|
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95435 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinServiceCorpIdToOpenCorpIdResponse> ExecuteCgibinServiceCorpIdToOpenCorpIdAsync(this WechatWorkClient client, Models.CgibinServiceCorpIdToOpenCorpIdRequest 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", "service", "corpid_to_opencorpid")
|
||||||
|
.SetQueryParam("access_token", request.ProviderAccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinServiceCorpIdToOpenCorpIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/batch/userid_to_openuserid 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinBatchUserIdToOpenUserIdRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置成员 ID 列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("userid_list")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
|
||||||
|
public IList<string> UserIdList { get; set; } = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/batch/userid_to_openuserid 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinBatchUserIdToOpenUserIdResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
public static class Types
|
||||||
|
{
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置转换成功的 UserId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||||
|
public string UserId { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置转换成功的 UserId 对应的服务商主体下的密文。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("open_userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("open_userid")]
|
||||||
|
public string OpenUserId { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置转换成功的成员列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("open_userid_list")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("open_userid_list")]
|
||||||
|
public Types.User[] UserList { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置无效的成员 ID 列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("invalid_userid_list")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("invalid_userid_list")]
|
||||||
|
public string[] InvalidUserIdList { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/externalcontact/groupchat/get_new_external_userid 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinExternalContactGroupChatGetNewExternalUserIdRequest : CgibinExternalContactGetNewExternalUserIdRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置客户群 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("chat_id")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("chat_id")]
|
||||||
|
public string GroupChatId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/externalcontact/groupchat/get_new_external_userid 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinExternalContactGroupChatGetNewExternalUserIdResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
public static class Types
|
||||||
|
{
|
||||||
|
public class Result : CgibinExternalContactGetNewExternalUserIdResponse.Types.Result
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置转换结果列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("items")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("items")]
|
||||||
|
public Types.Result[] ResultList { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/service/corpid_to_opencorpid 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinServiceCorpIdToOpenCorpIdRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置服务商 AccessToken。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public string ProviderAccessToken { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置企业 CorpId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
|
public string CorpId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/service/corpid_to_opencorpid 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinServiceCorpIdToOpenCorpIdResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置服务商第主体下的密文 CorpId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("open_corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("open_corpid")]
|
||||||
|
public string OpenCorpId { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"userid_list": ["aaa", "bbb"]
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "",
|
||||||
|
"open_userid_list": [
|
||||||
|
{
|
||||||
|
"userid": "aaa",
|
||||||
|
"open_userid": "xxxxx"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"invalid_userid_list": ["bbb"]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"chat_id": "wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA",
|
||||||
|
"external_userid_list": ["xxxxx", "yyyyyy"]
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"external_userid": "xxxxx",
|
||||||
|
"new_external_userid": "AAAA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"external_userid": "yyyyy",
|
||||||
|
"new_external_userid": "BBBB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"open_corpid": "AAAAAA"
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"corpid": "xxxxx"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user