using System; using System.Collections.Generic; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; using Flurl; using Flurl.Http; namespace SKIT.FlurlHttpClient.Wechat.Work { public static class WechatWorkClientExecuteCgibinHealthExtensions { /// /// 异步调用 [POST] /cgi-bin/health/get_health_report_stat 接口。 /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93676 /// /// /// /// /// public static async Task ExecuteCgibinHealthGetHealthReportStatisticsAsync(this WechatWorkClient client, Models.CgibinHealthGetHealthReportStatisticsRequest 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", "health", "get_health_report_stat") .SetQueryParam("access_token", request.AccessToken); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// /// 异步调用 [POST] /cgi-bin/health/get_report_jobids 接口。 /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93677 /// /// /// /// /// public static async Task ExecuteCgibinHealthGetReportJobIdsAsync(this WechatWorkClient client, Models.CgibinHealthGetReportJobIdsRequest 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", "health", "get_report_jobids") .SetQueryParam("access_token", request.AccessToken); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// /// 异步调用 [POST] /cgi-bin/health/get_report_job_info 接口。 /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93678 /// /// /// /// /// public static async Task ExecuteCgibinHealthGetReportJobInfoAsync(this WechatWorkClient client, Models.CgibinHealthGetReportJobInfoRequest 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", "health", "get_report_job_info") .SetQueryParam("access_token", request.AccessToken); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// /// 异步调用 [POST] /cgi-bin/health/get_report_answer 接口。 /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93679 /// /// /// /// /// public static async Task ExecuteCgibinHealthGetReportAnswerAsync(this WechatWorkClient client, Models.CgibinHealthGetReportAnswerRequest 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", "health", "get_report_answer") .SetQueryParam("access_token", request.AccessToken); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } } }