mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 02:29:40 +08:00
feat(wxapi): 新增使用 AppSecret 重置 API 调用次数接口
This commit is contained in:
@@ -37,6 +37,36 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinClearQuotaResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/clear_quota/v2 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/doc/offiaccount/openApi/clearQuotaByAppSecret.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinClearQuotaV2Response> ExecuteCgibinClearQuotaV2Async(this WechatApiClient client, Models.CgibinClearQuotaV2Request request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (request.AppId is null)
|
||||
request.AppId = client.Credentials.AppId;
|
||||
|
||||
if (request.AppSecret is null)
|
||||
request.AppSecret = client.Credentials.AppSecret;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "clear_quota")
|
||||
.SetQueryParam("appid", request.AppId)
|
||||
.SetQueryParam("appsecret", request.AppSecret);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinClearQuotaV2Response>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/openapi/quota/get 接口。</para>
|
||||
/// <para>
|
||||
|
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/clear_quota/v2 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinClearQuotaV2Request : WechatApiRequest, IInferable<CgibinClearQuotaV2Request, CgibinClearQuotaV2Response>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatApiClient"/> 时的 <see cref="WechatApiClientOptions.AppId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string? AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppSecret。如果不指定将使用构造 <see cref="WechatApiClient"/> 时的 <see cref="WechatApiClientOptions.AppSecret"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appsecret")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appsecret")]
|
||||
public string? AppSecret { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/clear_quota/v2 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinClearQuotaV2Response : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user