feat(work): 新增获客助手相关接口

This commit is contained in:
Fu Diwei 2023-05-24 10:08:49 +08:00
parent ac11bced93
commit dba8b17145
28 changed files with 1084 additions and 416 deletions

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
{
/// <summary>
/// <para>表示 INFO.approve_special_auth 事件的数据。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/98959 </para>
/// </summary>
public class ApproveSpecialAuthEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable
{
/// <summary>
/// 获取或设置权限类型。
/// </summary>
[System.Xml.Serialization.XmlElement("AuthType")]
public string AuthType { get; set; } = default!;
}
}

View File

@ -0,0 +1,51 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/create_link 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionCreateLinkRequest : WechatWorkRequest
{
public static class Types
{
public class Range
{
/// <summary>
/// 获取或设置使用范围的成员 UserId 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_list")]
[System.Text.Json.Serialization.JsonPropertyName("user_list")]
public IList<string>? UserIdList { get; set; }
/// <summary>
/// 获取或设置使用范围的部门 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("department_list")]
[System.Text.Json.Serialization.JsonPropertyName("department_list")]
public IList<long>? DepartmentId { get; set; }
}
}
/// <summary>
/// 获取或设置获客链接名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_name")]
[System.Text.Json.Serialization.JsonPropertyName("link_name")]
public string LinkName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置使用范围信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("range")]
[System.Text.Json.Serialization.JsonPropertyName("range")]
public Types.Range? Range { get; set; }
/// <summary>
/// 获取或设置是否无需验证。
/// </summary>
[Newtonsoft.Json.JsonProperty("skip_verify")]
[System.Text.Json.Serialization.JsonPropertyName("skip_verify")]
public bool? IsSkipVerify { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/create_link 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionCreateLinkResponse : WechatWorkResponse
{
public static class Types
{
public class Link : CgibinExternalContactCustomerAcquisitionGetResponse.Types.Link
{
}
}
/// <summary>
/// 获取或设置获客链接信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("link")]
[System.Text.Json.Serialization.JsonPropertyName("link")]
public Types.Link Link { get; set; } = default!;
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/customer 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionCustomerRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置获客链接 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id")]
[System.Text.Json.Serialization.JsonPropertyName("link_id")]
public string LinkId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("cursor")]
[System.Text.Json.Serialization.JsonPropertyName("cursor")]
public string? Cursor { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int? Limit { get; set; }
}
}

View File

@ -0,0 +1,56 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/customer 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionCustomerResponse : WechatWorkResponse
{
public static class Types
{
public class Customer
{
/// <summary>
/// 获取或设置客户外部联系人账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("external_userid")]
[System.Text.Json.Serialization.JsonPropertyName("external_userid")]
public string ExternalUserId { get; set; } = default!;
/// <summary>
/// 获取或设置跟进人用户成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid")]
[System.Text.Json.Serialization.JsonPropertyName("userid")]
public string? UserId { get; set; }
/// <summary>
/// 获取或设置会话状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("chat_status")]
[System.Text.Json.Serialization.JsonPropertyName("chat_status")]
public int ChatStatus { get; set; }
/// <summary>
/// 获取或设置自定义渠道参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("state")]
[System.Text.Json.Serialization.JsonPropertyName("state")]
public string? State { get; set; }
}
}
/// <summary>
/// 获取或设置客户列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("customer_list")]
[System.Text.Json.Serialization.JsonPropertyName("customer_list")]
public Types.Customer[] CustomerList { get; set; } = default!;
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("next_cursor")]
[System.Text.Json.Serialization.JsonPropertyName("next_cursor")]
public string? NextCursor { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/delete_link 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionDeleteLinkRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置获客链接 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id")]
[System.Text.Json.Serialization.JsonPropertyName("link_id")]
public string LinkId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/delete_link 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionDeleteLinkResponse : WechatWorkResponse
{
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/get 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionGetRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置获客链接 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id")]
[System.Text.Json.Serialization.JsonPropertyName("link_id")]
public string LinkId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,80 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/get 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionGetResponse : WechatWorkResponse
{
public static class Types
{
public class Link
{
/// <summary>
/// 获取或设置获客链接 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id")]
[System.Text.Json.Serialization.JsonPropertyName("link_id")]
public string LinkId { get; set; } = default!;
/// <summary>
/// 获取或设置获客链接名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_name")]
[System.Text.Json.Serialization.JsonPropertyName("link_name")]
public string LinkName { get; set; } = default!;
/// <summary>
/// 获取或设置 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("url")]
[System.Text.Json.Serialization.JsonPropertyName("url")]
public string Url { get; set; } = default!;
/// <summary>
/// 获取或设置创建时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
public long CreateTimestamp { get; set; }
}
public class Range
{
/// <summary>
/// 获取或设置使用范围的成员 UserId 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_list")]
[System.Text.Json.Serialization.JsonPropertyName("user_list")]
public string[]? UserIdList { get; set; }
/// <summary>
/// 获取或设置使用范围的部门 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("department_list")]
[System.Text.Json.Serialization.JsonPropertyName("department_list")]
public long[]? DepartmentId { get; set; }
}
}
/// <summary>
/// 获取或设置获客链接信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("link")]
[System.Text.Json.Serialization.JsonPropertyName("link")]
public Types.Link Link { get; set; } = default!;
/// <summary>
/// 获取或设置使用范围信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("range")]
[System.Text.Json.Serialization.JsonPropertyName("range")]
public Types.Range Range { get; set; } = default!;
/// <summary>
/// 获取或设置是否无需验证。
/// </summary>
[Newtonsoft.Json.JsonProperty("skip_verify")]
[System.Text.Json.Serialization.JsonPropertyName("skip_verify")]
public bool IsSkipVerify { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/list_link 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionListLinkRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("cursor")]
[System.Text.Json.Serialization.JsonPropertyName("cursor")]
public string? Cursor { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int? Limit { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/list_link 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionListLinkResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置获客链接 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("link_id_list")]
public string[] LinkIdList { get; set; } = default!;
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("next_cursor")]
[System.Text.Json.Serialization.JsonPropertyName("next_cursor")]
public string? NextCursor { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition_quota 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionQuotaRequest : WechatWorkRequest
{
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition_quota 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionQuotaResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置累计使用量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total")]
[System.Text.Json.Serialization.JsonPropertyName("total")]
public int Total { get; set; }
/// <summary>
/// 获取或设置剩余使用量。
/// </summary>
[Newtonsoft.Json.JsonProperty("balance")]
[System.Text.Json.Serialization.JsonPropertyName("balance")]
public int Balance { get; set; }
}
}

View File

@ -0,0 +1,45 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/update_link 接口的请求。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionUpdateLinkRequest : WechatWorkRequest
{
public static class Types
{
public class Range : CgibinExternalContactCustomerAcquisitionCreateLinkRequest.Types.Range
{
}
}
/// <summary>
/// 获取或设置获客链 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_id")]
[System.Text.Json.Serialization.JsonPropertyName("link_id")]
public string LinkId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置获客链接名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("link_name")]
[System.Text.Json.Serialization.JsonPropertyName("link_name")]
public string? LinkName { get; set; }
/// <summary>
/// 获取或设置使用范围信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("range")]
[System.Text.Json.Serialization.JsonPropertyName("range")]
public Types.Range? Range { get; set; }
/// <summary>
/// 获取或设置是否无需验证。
/// </summary>
[Newtonsoft.Json.JsonProperty("skip_verify")]
[System.Text.Json.Serialization.JsonPropertyName("skip_verify")]
public bool? IsSkipVerify { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/customer_acquisition/update_link 接口的响应。</para>
/// </summary>
public class CgibinExternalContactCustomerAcquisitionUpdateLinkResponse : WechatWorkResponse
{
}
}

View File

@ -0,0 +1,7 @@
<xml>
<SuiteId><![CDATA[ww4asffe99e54c0f4c]]></SuiteId>
<AuthCorpId><![CDATA[wxf8b4f85f3a794e77]]></AuthCorpId>
<InfoType><![CDATA[approve_special_auth]]></InfoType>
<TimeStamp>1403610513</TimeStamp>
<AuthType><![CDATA[customer_acquisition]]></ChangeType>
</xml>

View File

@ -0,0 +1,8 @@
{
"link_name": "获客链接1号",
"range": {
"user_list": [ "zhangsan", "lisi" ],
"department_list": [ 2, 3 ]
},
"skip_verify": true
}

View File

@ -0,0 +1,10 @@
{
"errcode": 0,
"errmsg": "ok",
"link": {
"link_id": "LINK_ID",
"link_name": "获客链接1号",
"url": "URL",
"create_time": 1667232000
}
}

View File

@ -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"
}

View File

@ -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
}

View File

@ -0,0 +1,10 @@
{
"errcode": 0,
"errmsg": "ok",
"link_id_list": [
"LINK_ID_AAA",
"LINK_ID_BBB",
"LINK_ID_CCC"
],
"next_cursor": "CURSOR"
}

View File

@ -0,0 +1,9 @@
{
"link_id": "LINK_ID",
"link_name": "获客链接1号",
"range": {
"user_list": [ "zhangsan", "lisi" ],
"department_list": [ 2, 3 ]
},
"skip_verify": true
}