mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(wxapi): 新增公众号迁移相关 API 封装
This commit is contained in:
parent
7bf990f0a4
commit
f5c1f2174d
@ -120,5 +120,25 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinClearQuotaResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/changeopenid 接口。</para>
|
||||
/// <para>REF: https://kf.qq.com/faq/1901177NrqMr190117nqYJze.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinChangeOpenIdResponse> ExecuteCgibinChangeOpenIdAsync(this WechatApiClient client, Models.CgibinChangeOpenIdRequest 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", "changeopenid")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinChangeOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/changeopenid 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinChangeOpenIdRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置原帐号的微信 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("from_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("from_appid")]
|
||||
public string FromAppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置需要转换的用户 OpenId 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid_list")]
|
||||
public IList<string> OpenIdList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/changeopenid 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinChangeOpenIdResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置错误信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("err_msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("err_msg")]
|
||||
public string ErrorMessage { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置原用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ori_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ori_openid")]
|
||||
public string OriginalOpenId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置新用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("new_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("new_openid")]
|
||||
public string? NewOpenId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置转换结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result_list")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user