2021-05-28 19:23:28 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Flurl;
|
|
|
|
|
using Flurl.Http;
|
|
|
|
|
|
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.Api
|
|
|
|
|
{
|
|
|
|
|
public static class WechatApiClientExecuteCgibinCustomServiceExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>异步调用 [GET] /cgi-bin/customservice/getkflist 接口。</para>
|
|
|
|
|
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#5 </para>
|
|
|
|
|
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para>
|
2022-07-01 20:08:05 +08:00
|
|
|
|
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%9C%8D%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF </para>
|
2021-05-28 19:23:28 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static async Task<Models.CgibinCustomServiceGetKfListResponse> ExecuteCgibinCustomServiceGetKfListAsync(this WechatApiClient client, Models.CgibinCustomServiceGetKfListRequest 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
|
2021-07-11 00:55:24 +08:00
|
|
|
|
.CreateRequest(request, HttpMethod.Get, "cgi-bin", "customservice", "getkflist")
|
2021-05-28 19:23:28 +08:00
|
|
|
|
.SetQueryParam("access_token", request.AccessToken);
|
|
|
|
|
|
2021-07-11 00:55:24 +08:00
|
|
|
|
return await client.SendRequestWithJsonAsync<Models.CgibinCustomServiceGetKfListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
2021-05-28 19:23:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>异步调用 [GET] /cgi-bin/customservice/getonlinekflist 接口。</para>
|
|
|
|
|
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para>
|
2022-07-01 20:08:05 +08:00
|
|
|
|
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E5%88%97%E8%A1%A8 </para>
|
2021-05-28 19:23:28 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static async Task<Models.CgibinCustomServiceGetOnlineKfListResponse> ExecuteCgibinCustomServiceGetOnlineKfListAsync(this WechatApiClient client, Models.CgibinCustomServiceGetOnlineKfListRequest 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
|
2021-07-11 00:55:24 +08:00
|
|
|
|
.CreateRequest(request, HttpMethod.Get, "cgi-bin", "customservice", "getonlinekflist")
|
2021-05-28 19:23:28 +08:00
|
|
|
|
.SetQueryParam("access_token", request.AccessToken);
|
|
|
|
|
|
2021-07-11 00:55:24 +08:00
|
|
|
|
return await client.SendRequestWithJsonAsync<Models.CgibinCustomServiceGetOnlineKfListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
2021-05-28 19:23:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|