diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/ApproveSpecialAuthEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/ApproveSpecialAuthEvent.cs new file mode 100644 index 00000000..94578396 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/ApproveSpecialAuthEvent.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 INFO.approve_special_auth 事件的数据。 + /// REF: https://developer.work.weixin.qq.com/document/path/98959 + /// + public class ApproveSpecialAuthEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置权限类型。 + /// + [System.Xml.Serialization.XmlElement("AuthType")] + public string AuthType { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs index a90316c6..61e6fc59 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs @@ -475,89 +475,374 @@ namespace SKIT.FlurlHttpClient.Wechat.Work } #endregion - #region Transfer + #region CustomerAcquisition /// - /// 异步调用 [POST] /cgi-bin/externalcontact/transfer_customer 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/92125 - /// REF: https://developer.work.weixin.qq.com/document/path/94096 + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/list_link 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97297 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactTransferCustomerAsync(this WechatWorkClient client, Models.CgibinExternalContactTransferCustomerRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionListLinkAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionListLinkRequest 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", "transfer_customer") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "customer_acquisition", "list_link") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/transfer_result 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/94088 - /// REF: https://developer.work.weixin.qq.com/document/path/94097 + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/get 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97297 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactTransferResultAsync(this WechatWorkClient client, Models.CgibinExternalContactTransferResultRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionGetAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionGetRequest 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", "transfer_result") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "customer_acquisition", "get") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/resigned/transfer_customer 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/94081 - /// REF: https://developer.work.weixin.qq.com/document/path/94100 + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/create_link 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97297 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactResignedTransferCustomerAsync(this WechatWorkClient client, Models.CgibinExternalContactResignedTransferCustomerRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionCreateLinkAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionCreateLinkRequest 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", "resigned", "transfer_customer") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "customer_acquisition", "create_link") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/resigned/transfer_result 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/94082 - /// REF: https://developer.work.weixin.qq.com/document/path/94101 + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/update_link 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97297 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactResignedTransferResultAsync(this WechatWorkClient client, Models.CgibinExternalContactResignedTransferResultRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionUpdateLinkAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionUpdateLinkRequest 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", "resigned", "transfer_result") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "customer_acquisition", "update_link") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/delete_link 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97297 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionDeleteLinkAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionDeleteLinkRequest 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", "customer_acquisition", "delete_link") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition/customer 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97298 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionCustomerAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionCustomerRequest 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", "customer_acquisition", "customer") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_acquisition_quota 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97375 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerAcquisitionQuotaAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerAcquisitionQuotaRequest 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", "customer_acquisition_quota") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + + #region CustomerStrategy + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/list 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyListAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyListRequest 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", "customer_strategy", "list") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/get 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyGetAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyGetRequest 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", "customer_strategy", "get") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/get_range 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyGetRangeAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyGetRangeRequest 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", "customer_strategy", "get_range") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/create 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyCreateAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyCreateRequest 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", "customer_strategy", "create") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/edit 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyEditAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyEditRequest 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", "customer_strategy", "edit") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/del 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCustomerStrategyDeleteAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyDeleteRequest 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", "customer_strategy", "del") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + + #region InterceptRule + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/add_intercept_rule 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95097 + /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactAddInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactAddInterceptRuleRequest 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", "add_intercept_rule") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/externalcontact/get_intercept_rule_list 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95097 + /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetInterceptRuleListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetInterceptRuleListRequest 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.Get, "cgi-bin", "externalcontact", "get_intercept_rule_list") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/get_intercept_rule 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95097 + /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactGetInterceptRuleRequest 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_intercept_rule") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/update_intercept_rule 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95097 + /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactUpdateInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactUpdateInterceptRuleRequest 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", "update_intercept_rule") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/del_intercept_rule 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95097 + /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactDeleteInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactDeleteInterceptRuleRequest 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", "del_intercept_rule") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion @@ -772,175 +1057,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Work #endregion #endregion - #region Moment - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_list 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/93333 - /// REF: https://developer.work.weixin.qq.com/document/path/93443 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentListRequest 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_moment_list") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/add_moment_task 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95094 - /// REF: https://developer.work.weixin.qq.com/document/path/95095 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactAddMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactAddMomentTaskRequest 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", "add_moment_task") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/cancel_moment_task 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/97612 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactCancelMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactCancelMomentTaskRequest 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", "cancel_moment_task") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_task 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/93333 - /// REF: https://developer.work.weixin.qq.com/document/path/93443 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentTaskRequest 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_moment_task") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_task_result 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95094 - /// REF: https://developer.work.weixin.qq.com/document/path/95095 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentTaskResultAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentTaskResultRequest 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_moment_task_result") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_customer_list 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/93333 - /// REF: https://developer.work.weixin.qq.com/document/path/93443 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentCustomerListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentCustomerListRequest 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_moment_customer_list") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_send_result 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/93333 - /// REF: https://developer.work.weixin.qq.com/document/path/93443 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentSendResultAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentSendResultRequest 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_moment_send_result") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_comments 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/93333 - /// REF: https://developer.work.weixin.qq.com/document/path/93443 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetMomentCommentsAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentCommentsRequest 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_moment_comments") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - #endregion - #region GroupMessage /// /// 异步调用 [POST] /cgi-bin/externalcontact/add_msg_template 接口。 @@ -1201,276 +1317,220 @@ namespace SKIT.FlurlHttpClient.Wechat.Work } #endregion - #region Subscribe + #region Migration /// - /// 异步调用 [GET] /cgi-bin/externalcontact/get_subscribe_qr_code 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/92320 - /// REF: https://developer.work.weixin.qq.com/document/path/92197 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_new_external_userid 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95327 + /// REF: https://developer.work.weixin.qq.com/document/path/95435 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactGetSubscribeQrcodeAsync(this WechatWorkClient client, Models.CgibinExternalContactGetSubscribeQrcodeRequest request, CancellationToken cancellationToken = default) + public static async Task 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.Get, "cgi-bin", "externalcontact", "get_subscribe_qr_code") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_new_external_userid") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/set_subscribe_mode 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/92318 - /// REF: https://developer.work.weixin.qq.com/document/path/92290 + /// 异步调用 [POST] /cgi-bin/externalcontact/groupchat/get_new_external_userid 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95327 + /// REF: https://developer.work.weixin.qq.com/document/path/95435 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactSetSubscribeModeAsync(this WechatWorkClient client, Models.CgibinExternalContactSetSubscribeModeRequest request, CancellationToken cancellationToken = default) + public static async Task 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", "set_subscribe_mode") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "groupchat", "get_new_external_userid") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [GET] /cgi-bin/externalcontact/get_subscribe_mode 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/92318 - /// REF: https://developer.work.weixin.qq.com/document/path/92290 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetSubscribeModeAsync(this WechatWorkClient client, Models.CgibinExternalContactGetSubscribeModeRequest 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.Get, "cgi-bin", "externalcontact", "get_subscribe_mode") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion - #region CustomerStrategy + #region Moment /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/list 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_list 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/93333 + /// REF: https://developer.work.weixin.qq.com/document/path/93443 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyListAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyListRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetMomentListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentListRequest 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", "customer_strategy", "list") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_moment_list") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/get 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/add_moment_task 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95094 + /// REF: https://developer.work.weixin.qq.com/document/path/95095 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyGetAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyGetRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactAddMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactAddMomentTaskRequest 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", "customer_strategy", "get") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "add_moment_task") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/get_range 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/cancel_moment_task 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/97612 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyGetRangeAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyGetRangeRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactCancelMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactCancelMomentTaskRequest 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", "customer_strategy", "get_range") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "cancel_moment_task") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/create 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_task 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/93333 + /// REF: https://developer.work.weixin.qq.com/document/path/93443 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyCreateAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyCreateRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetMomentTaskAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentTaskRequest 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", "customer_strategy", "create") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_moment_task") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/edit 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_task_result 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/95094 + /// REF: https://developer.work.weixin.qq.com/document/path/95095 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyEditAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyEditRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetMomentTaskResultAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentTaskResultRequest 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", "customer_strategy", "edit") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_moment_task_result") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/customer_strategy/del 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94883 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_customer_list 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/93333 + /// REF: https://developer.work.weixin.qq.com/document/path/93443 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactCustomerStrategyDeleteAsync(this WechatWorkClient client, Models.CgibinExternalContactCustomerStrategyDeleteRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetMomentCustomerListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentCustomerListRequest 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", "customer_strategy", "del") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_moment_customer_list") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_send_result 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/93333 + /// REF: https://developer.work.weixin.qq.com/document/path/93443 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetMomentSendResultAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentSendResultRequest 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_moment_send_result") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/get_moment_comments 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/93333 + /// REF: https://developer.work.weixin.qq.com/document/path/93443 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetMomentCommentsAsync(this WechatWorkClient client, Models.CgibinExternalContactGetMomentCommentsRequest 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_moment_comments") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion - #region StrategyTag - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_strategy_tag_list 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactGetStrategyTagListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetStrategyTagListRequest 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_strategy_tag_list") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/add_strategy_tag 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactAddStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactAddStrategyTagRequest 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", "add_strategy_tag") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/edit_strategy_tag 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactEditStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactEditStrategyTagRequest 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", "edit_strategy_tag") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/del_strategy_tag 接口。 - /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactDeleteStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactDeleteStrategyTagRequest 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", "del_strategy_tag") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - #endregion - - #region CustomerStrategy + #region MomentStrategy /// /// 异步调用 [POST] /cgi-bin/externalcontact/moment_strategy/list 接口。 /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94890 @@ -1699,154 +1759,236 @@ namespace SKIT.FlurlHttpClient.Wechat.Work } #endregion - #region InterceptRule + #region Subscribe /// - /// 异步调用 [POST] /cgi-bin/externalcontact/add_intercept_rule 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95097 - /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// 异步调用 [GET] /cgi-bin/externalcontact/get_subscribe_qr_code 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/92320 + /// REF: https://developer.work.weixin.qq.com/document/path/92197 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactAddInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactAddInterceptRuleRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetSubscribeQrcodeAsync(this WechatWorkClient client, Models.CgibinExternalContactGetSubscribeQrcodeRequest 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", "add_intercept_rule") + .CreateRequest(request, HttpMethod.Get, "cgi-bin", "externalcontact", "get_subscribe_qr_code") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); } /// - /// 异步调用 [GET] /cgi-bin/externalcontact/get_intercept_rule_list 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95097 - /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// 异步调用 [POST] /cgi-bin/externalcontact/set_subscribe_mode 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/92318 + /// REF: https://developer.work.weixin.qq.com/document/path/92290 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactGetInterceptRuleListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetInterceptRuleListRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactSetSubscribeModeAsync(this WechatWorkClient client, Models.CgibinExternalContactSetSubscribeModeRequest 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.Get, "cgi-bin", "externalcontact", "get_intercept_rule_list") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "set_subscribe_mode") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_intercept_rule 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95097 - /// REF: https://developer.work.weixin.qq.com/document/path/95130 + /// 异步调用 [GET] /cgi-bin/externalcontact/get_subscribe_mode 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/92318 + /// REF: https://developer.work.weixin.qq.com/document/path/92290 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactGetInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactGetInterceptRuleRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetSubscribeModeAsync(this WechatWorkClient client, Models.CgibinExternalContactGetSubscribeModeRequest 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_intercept_rule") + .CreateRequest(request, HttpMethod.Get, "cgi-bin", "externalcontact", "get_subscribe_mode") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/update_intercept_rule 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95097 - /// REF: https://developer.work.weixin.qq.com/document/path/95130 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactUpdateInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactUpdateInterceptRuleRequest 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", "update_intercept_rule") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); - } - - /// - /// 异步调用 [POST] /cgi-bin/externalcontact/del_intercept_rule 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95097 - /// REF: https://developer.work.weixin.qq.com/document/path/95130 - /// - /// - /// - /// - /// - public static async Task ExecuteCgibinExternalContactDeleteInterceptRuleAsync(this WechatWorkClient client, Models.CgibinExternalContactDeleteInterceptRuleRequest 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", "del_intercept_rule") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); } #endregion - #region Migration + #region StrategyTag /// - /// 异步调用 [POST] /cgi-bin/externalcontact/get_new_external_userid 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95327 - /// REF: https://developer.work.weixin.qq.com/document/path/95435 + /// 异步调用 [POST] /cgi-bin/externalcontact/get_strategy_tag_list 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactGetNewExternalUserIdAsync(this WechatWorkClient client, Models.CgibinExternalContactGetNewExternalUserIdRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactGetStrategyTagListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetStrategyTagListRequest 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") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "get_strategy_tag_list") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } /// - /// 异步调用 [POST] /cgi-bin/externalcontact/groupchat/get_new_external_userid 接口。 - /// REF: https://developer.work.weixin.qq.com/document/path/95327 - /// REF: https://developer.work.weixin.qq.com/document/path/95435 + /// 异步调用 [POST] /cgi-bin/externalcontact/add_strategy_tag 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 /// /// /// /// /// - public static async Task ExecuteCgibinExternalContactGroupChatGetNewExternalUserIdAsync(this WechatWorkClient client, Models.CgibinExternalContactGroupChatGetNewExternalUserIdRequest request, CancellationToken cancellationToken = default) + public static async Task ExecuteCgibinExternalContactAddStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactAddStrategyTagRequest 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") + .CreateRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "add_strategy_tag") .SetQueryParam("access_token", request.AccessToken); - return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/edit_strategy_tag 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactEditStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactEditStrategyTagRequest 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", "edit_strategy_tag") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/del_strategy_tag 接口。 + /// REF: https://work.weixin.qq.com/api/doc/90000/90135/94882 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactDeleteStrategyTagAsync(this WechatWorkClient client, Models.CgibinExternalContactDeleteStrategyTagRequest 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", "del_strategy_tag") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + + #region Transfer + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/transfer_customer 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/92125 + /// REF: https://developer.work.weixin.qq.com/document/path/94096 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactTransferCustomerAsync(this WechatWorkClient client, Models.CgibinExternalContactTransferCustomerRequest 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", "transfer_customer") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/transfer_result 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/94088 + /// REF: https://developer.work.weixin.qq.com/document/path/94097 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactTransferResultAsync(this WechatWorkClient client, Models.CgibinExternalContactTransferResultRequest 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", "transfer_result") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/resigned/transfer_customer 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/94081 + /// REF: https://developer.work.weixin.qq.com/document/path/94100 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactResignedTransferCustomerAsync(this WechatWorkClient client, Models.CgibinExternalContactResignedTransferCustomerRequest 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", "resigned", "transfer_customer") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/resigned/transfer_result 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/94082 + /// REF: https://developer.work.weixin.qq.com/document/path/94101 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactResignedTransferResultAsync(this WechatWorkClient client, Models.CgibinExternalContactResignedTransferResultRequest 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", "resigned", "transfer_result") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.cs new file mode 100644 index 00000000..64670a87 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/create_link 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionCreateLinkRequest : WechatWorkRequest + { + public static class Types + { + public class Range + { + /// + /// 获取或设置使用范围的成员 UserId 列表。 + /// + [Newtonsoft.Json.JsonProperty("user_list")] + [System.Text.Json.Serialization.JsonPropertyName("user_list")] + public IList? UserIdList { get; set; } + + /// + /// 获取或设置使用范围的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("department_list")] + [System.Text.Json.Serialization.JsonPropertyName("department_list")] + public IList? DepartmentId { get; set; } + } + } + + /// + /// 获取或设置获客链接名称。 + /// + [Newtonsoft.Json.JsonProperty("link_name")] + [System.Text.Json.Serialization.JsonPropertyName("link_name")] + public string LinkName { get; set; } = string.Empty; + + /// + /// 获取或设置使用范围信息。 + /// + [Newtonsoft.Json.JsonProperty("range")] + [System.Text.Json.Serialization.JsonPropertyName("range")] + public Types.Range? Range { get; set; } + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool? IsSkipVerify { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.cs new file mode 100644 index 00000000..83eb820d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/create_link 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionCreateLinkResponse : WechatWorkResponse + { + public static class Types + { + public class Link : CgibinExternalContactCustomerAcquisitionGetResponse.Types.Link + { + } + } + + /// + /// 获取或设置获客链接信息。 + /// + [Newtonsoft.Json.JsonProperty("link")] + [System.Text.Json.Serialization.JsonPropertyName("link")] + public Types.Link Link { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.cs new file mode 100644 index 00000000..a7600acc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/customer 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionCustomerRequest : WechatWorkRequest + { + /// + /// 获取或设置获客链接 ID。 + /// + [Newtonsoft.Json.JsonProperty("link_id")] + [System.Text.Json.Serialization.JsonPropertyName("link_id")] + public string LinkId { get; set; } = string.Empty; + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("cursor")] + [System.Text.Json.Serialization.JsonPropertyName("cursor")] + public string? Cursor { get; set; } + + /// + /// 获取或设置分页每页数量。 + /// + [Newtonsoft.Json.JsonProperty("limit")] + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int? Limit { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.cs new file mode 100644 index 00000000..9a607521 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.cs @@ -0,0 +1,56 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/customer 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionCustomerResponse : WechatWorkResponse + { + public static class Types + { + public class Customer + { + /// + /// 获取或设置客户外部联系人账号。 + /// + [Newtonsoft.Json.JsonProperty("external_userid")] + [System.Text.Json.Serialization.JsonPropertyName("external_userid")] + public string ExternalUserId { get; set; } = default!; + + /// + /// 获取或设置跟进人用户成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string? UserId { get; set; } + + /// + /// 获取或设置会话状态。 + /// + [Newtonsoft.Json.JsonProperty("chat_status")] + [System.Text.Json.Serialization.JsonPropertyName("chat_status")] + public int ChatStatus { get; set; } + + /// + /// 获取或设置自定义渠道参数。 + /// + [Newtonsoft.Json.JsonProperty("state")] + [System.Text.Json.Serialization.JsonPropertyName("state")] + public string? State { get; set; } + } + } + + /// + /// 获取或设置客户列表。 + /// + [Newtonsoft.Json.JsonProperty("customer_list")] + [System.Text.Json.Serialization.JsonPropertyName("customer_list")] + public Types.Customer[] CustomerList { get; set; } = default!; + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("next_cursor")] + [System.Text.Json.Serialization.JsonPropertyName("next_cursor")] + public string? NextCursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.cs new file mode 100644 index 00000000..e7e42901 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/delete_link 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionDeleteLinkRequest : WechatWorkRequest + { + /// + /// 获取或设置获客链接 ID。 + /// + [Newtonsoft.Json.JsonProperty("link_id")] + [System.Text.Json.Serialization.JsonPropertyName("link_id")] + public string LinkId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkResponse.cs new file mode 100644 index 00000000..1de9cb7f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/delete_link 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionDeleteLinkResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.cs new file mode 100644 index 00000000..17f4f3dc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/get 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionGetRequest : WechatWorkRequest + { + /// + /// 获取或设置获客链接 ID。 + /// + [Newtonsoft.Json.JsonProperty("link_id")] + [System.Text.Json.Serialization.JsonPropertyName("link_id")] + public string LinkId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.cs new file mode 100644 index 00000000..76ea9c52 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.cs @@ -0,0 +1,80 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/get 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionGetResponse : WechatWorkResponse + { + public static class Types + { + public class Link + { + /// + /// 获取或设置获客链接 ID。 + /// + [Newtonsoft.Json.JsonProperty("link_id")] + [System.Text.Json.Serialization.JsonPropertyName("link_id")] + public string LinkId { get; set; } = default!; + + /// + /// 获取或设置获客链接名称。 + /// + [Newtonsoft.Json.JsonProperty("link_name")] + [System.Text.Json.Serialization.JsonPropertyName("link_name")] + public string LinkName { get; set; } = default!; + + /// + /// 获取或设置 URL。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } = default!; + + /// + /// 获取或设置创建时间戳。 + /// + [Newtonsoft.Json.JsonProperty("create_time")] + [System.Text.Json.Serialization.JsonPropertyName("create_time")] + public long CreateTimestamp { get; set; } + } + + public class Range + { + /// + /// 获取或设置使用范围的成员 UserId 列表。 + /// + [Newtonsoft.Json.JsonProperty("user_list")] + [System.Text.Json.Serialization.JsonPropertyName("user_list")] + public string[]? UserIdList { get; set; } + + /// + /// 获取或设置使用范围的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("department_list")] + [System.Text.Json.Serialization.JsonPropertyName("department_list")] + public long[]? DepartmentId { get; set; } + } + } + + /// + /// 获取或设置获客链接信息。 + /// + [Newtonsoft.Json.JsonProperty("link")] + [System.Text.Json.Serialization.JsonPropertyName("link")] + public Types.Link Link { get; set; } = default!; + + /// + /// 获取或设置使用范围信息。 + /// + [Newtonsoft.Json.JsonProperty("range")] + [System.Text.Json.Serialization.JsonPropertyName("range")] + public Types.Range Range { get; set; } = default!; + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool IsSkipVerify { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.cs new file mode 100644 index 00000000..6371073c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/list_link 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionListLinkRequest : WechatWorkRequest + { + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("cursor")] + [System.Text.Json.Serialization.JsonPropertyName("cursor")] + public string? Cursor { get; set; } + + /// + /// 获取或设置分页每页数量。 + /// + [Newtonsoft.Json.JsonProperty("limit")] + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int? Limit { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.cs new file mode 100644 index 00000000..16283285 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/list_link 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionListLinkResponse : WechatWorkResponse + { + /// + /// 获取或设置获客链接 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("link_id_list")] + [System.Text.Json.Serialization.JsonPropertyName("link_id_list")] + public string[] LinkIdList { get; set; } = default!; + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("next_cursor")] + [System.Text.Json.Serialization.JsonPropertyName("next_cursor")] + public string? NextCursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaRequest.cs new file mode 100644 index 00000000..3ee0fc5e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaRequest.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition_quota 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionQuotaRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.cs new file mode 100644 index 00000000..c21919ac --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition_quota 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionQuotaResponse : WechatWorkResponse + { + /// + /// 获取或设置累计使用量。 + /// + [Newtonsoft.Json.JsonProperty("total")] + [System.Text.Json.Serialization.JsonPropertyName("total")] + public int Total { get; set; } + + /// + /// 获取或设置剩余使用量。 + /// + [Newtonsoft.Json.JsonProperty("balance")] + [System.Text.Json.Serialization.JsonPropertyName("balance")] + public int Balance { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.cs new file mode 100644 index 00000000..76f8c657 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/update_link 接口的请求。 + /// + public class CgibinExternalContactCustomerAcquisitionUpdateLinkRequest : WechatWorkRequest + { + public static class Types + { + public class Range : CgibinExternalContactCustomerAcquisitionCreateLinkRequest.Types.Range + { + } + } + + /// + /// 获取或设置获客链 ID。 + /// + [Newtonsoft.Json.JsonProperty("link_id")] + [System.Text.Json.Serialization.JsonPropertyName("link_id")] + public string LinkId { get; set; } = string.Empty; + + /// + /// 获取或设置获客链接名称。 + /// + [Newtonsoft.Json.JsonProperty("link_name")] + [System.Text.Json.Serialization.JsonPropertyName("link_name")] + public string? LinkName { get; set; } + + /// + /// 获取或设置使用范围信息。 + /// + [Newtonsoft.Json.JsonProperty("range")] + [System.Text.Json.Serialization.JsonPropertyName("range")] + public Types.Range? Range { get; set; } + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool? IsSkipVerify { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkResponse.cs new file mode 100644 index 00000000..dc052a98 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/customer_acquisition/update_link 接口的响应。 + /// + public class CgibinExternalContactCustomerAcquisitionUpdateLinkResponse : WechatWorkResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/ApproveSpecialAuthEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/ApproveSpecialAuthEvent.xml new file mode 100644 index 00000000..afc2fab3 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/ApproveSpecialAuthEvent.xml @@ -0,0 +1,7 @@ + + + + + 1403610513 + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.json new file mode 100644 index 00000000..8be51a4f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkRequest.json @@ -0,0 +1,8 @@ +{ + "link_name": "获客链接1号", + "range": { + "user_list": [ "zhangsan", "lisi" ], + "department_list": [ 2, 3 ] + }, + "skip_verify": true +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.json new file mode 100644 index 00000000..2f715a4c --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCreateLinkResponse.json @@ -0,0 +1,10 @@ +{ + "errcode": 0, + "errmsg": "ok", + "link": { + "link_id": "LINK_ID", + "link_name": "获客链接1号", + "url": "URL", + "create_time": 1667232000 + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.json new file mode 100644 index 00000000..a1290ce8 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerRequest.json @@ -0,0 +1,5 @@ +{ + "link_id": "LINK_ID", + "limit": 1000, + "cursor": "CURSOR" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.json new file mode 100644 index 00000000..5cb0dcef --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionCustomerResponse.json @@ -0,0 +1,25 @@ +{ + "errcode": 0, + "errmsg": "ok", + "customer_list": [ + { + "external_userid": "woAJ2GCAAAXtWyujaWJHDDGi0mACAAA", + "userid": "zhangsan", + "chat_status": 0, + "state": "CHANNEL_A" + }, + { + "external_userid": "woAJ2GCAAAXtWyujaWJHDDGi0mACAAA", + "userid": "lisi", + "chat_status": 0, + "state": "CHANNEL_B" + }, + { + "external_userid": "woAJ2GCAAAXtWyujaWJHDDGi0mBCBBB", + "userid": "rocky", + "chat_status": 1, + "state": "CHANNEL_A" + } + ], + "next_cursor": "CURSOR" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.json new file mode 100644 index 00000000..e09a0f37 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionDeleteLinkRequest.json @@ -0,0 +1,3 @@ +{ + "link_id": "LINK_ID" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.json new file mode 100644 index 00000000..2a2b4f91 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetRequest.json @@ -0,0 +1,3 @@ +{ + "link_id": "LINK_ID_AAA" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.json new file mode 100644 index 00000000..aa5590d1 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionGetResponse.json @@ -0,0 +1,15 @@ +{ + "errcode": 0, + "errmsg": "ok", + "link": { + "link_id": "LINK_ID_AAA", + "link_name": "LINK_NAME", + "url": "work.weixin.qq.com/ca/xxxxxx", + "create_time": 1672502400 + }, + "range": { + "user_list": [ "rocky", "sam" ], + "department_list": [ 1 ] + }, + "skip_verify": true +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.json new file mode 100644 index 00000000..345b3eb9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkRequest.json @@ -0,0 +1,4 @@ +{ + "limit": 100, + "cursor": "CURSOR" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.json new file mode 100644 index 00000000..bff88430 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionListLinkResponse.json @@ -0,0 +1,10 @@ +{ + "errcode": 0, + "errmsg": "ok", + "link_id_list": [ + "LINK_ID_AAA", + "LINK_ID_BBB", + "LINK_ID_CCC" + ], + "next_cursor": "CURSOR" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.json new file mode 100644 index 00000000..f8c34e7a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionQuotaResponse.json @@ -0,0 +1,6 @@ +{ + "errcode": 0, + "errmsg": "ok", + "total": 1000, + "balance": 500 +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.json new file mode 100644 index 00000000..a9b126af --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinExternalContact/CustomerAcquisition/CgibinExternalContactCustomerAcquisitionUpdateLinkRequest.json @@ -0,0 +1,9 @@ +{ + "link_id": "LINK_ID", + "link_name": "获客链接1号", + "range": { + "user_list": [ "zhangsan", "lisi" ], + "department_list": [ 2, 3 ] + }, + "skip_verify": true +}