mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 01:58:14 +08:00
feat(work): 新增获取已服务的外部联系人接口
This commit is contained in:
@@ -345,6 +345,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinExternalContactToServiceExternalUserIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/externalcontact/contact_list 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99434 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExternalContactContactListResponse> ExecuteCgibinExternalContactContactListAsync(this WechatWorkClient client, Models.CgibinExternalContactContactListRequest 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
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "externalcontact", "contact_list")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinExternalContactContactListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#region ContactWay
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/externalcontact/add_contact_way 接口。</para>
|
||||
|
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/externalcontact/contact_list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExternalContactContactListRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("limit")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页游标。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("cursor")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("cursor")]
|
||||
public string? Cursor { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/externalcontact/contact_list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExternalContactContactListResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ExternalContact
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置外部联系人 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("external_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("external_userid")]
|
||||
public string? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置外部联系人临时 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("tmp_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("tmp_openid")]
|
||||
public string? TempOpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置外部联系人名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置添加此外部联系人的企业成员账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("follow_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("follow_userid")]
|
||||
public string? FollowUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置所在客户群的 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("chat_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("chat_id")]
|
||||
public string? GroupChatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置所在客户群的群名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("chat_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("chat_name")]
|
||||
public string? GroupChatName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置添加时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("add_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("add_time")]
|
||||
public long AddTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否标记为客户。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_customer")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_customer")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanConverter))]
|
||||
public bool IsCustomer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置外部联系人列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("info_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("info_list")]
|
||||
public Types.ExternalContact[] ExternalContactList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页游标。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("next_cursor")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("next_cursor")]
|
||||
public string? NextCursor { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"cursor": "CURSOR",
|
||||
"limit": 1000
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"info_list": [
|
||||
{
|
||||
"is_customer": false,
|
||||
"name": "***开",
|
||||
"tmp_openid": "TMP_ID",
|
||||
"follow_userid": "USER_ID",
|
||||
"chat_name": "外联群1",
|
||||
"add_time": 1694418699
|
||||
},
|
||||
{
|
||||
"is_customer": true,
|
||||
"tmp_openid": "TMP_ID",
|
||||
"external_userid": "woAJ2GCAAAXtWyujaWJHDDGi0mACHAAA",
|
||||
"follow_userid": "USER_ID",
|
||||
"add_time": 1694418699
|
||||
},
|
||||
{
|
||||
"is_customer": true,
|
||||
"tmp_openid": "TMP_ID",
|
||||
"external_userid": "woAJ2GCAAAXtWyujaWJHDDGi0mACHAAA",
|
||||
"chat_id": "CHATID",
|
||||
"add_time": 1694418699
|
||||
},
|
||||
{
|
||||
"is_customer": false,
|
||||
"tmp_openid": "TMP_ID",
|
||||
"name": "***开",
|
||||
"follow_userid": "USER_ID",
|
||||
"add_time": 1694418699
|
||||
}
|
||||
],
|
||||
"next_cursor": "NEXT_CURSOR"
|
||||
}
|
Reference in New Issue
Block a user