mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-18 17:48:12 +08:00
feat(work): 新增获取企业微信域名 IP 信息接口
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 EVENT.security 事件的数据。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/100080 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class SecurityEvent : WechatWorkEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置变更类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ChangeType")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ChangeType")]
|
||||
[System.Xml.Serialization.XmlElement("ChangeType")]
|
||||
public string ChangeType { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -32,6 +32,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityGetFileOperateRecordResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /cgi-bin/security/get_server_domain_ip 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/93221 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinSecurityGetServerDomainIpResponse> ExecuteCgibinSecurityGetServerDomainIpAsync(this WechatWorkClient client, Models.CgibinSecurityGetServerDomainIpRequest 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.Get, "cgi-bin", "security", "get_server_domain_ip")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityGetServerDomainIpResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#region TrustDevice
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/security/trustdevice/import 接口。</para>
|
||||
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/security/get_server_domain_ip 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinSecurityGetServerDomainIpRequest : WechatWorkRequest
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/security/get_server_domain_ip 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinSecurityGetServerDomainIpResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ServerDomain
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置域名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("domain")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("domain")]
|
||||
public string Domain { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置泛域名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("universal_domian")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("universal_domian")]
|
||||
public string? UniversalDomain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置协议。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("protocol")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("protocol")]
|
||||
public string Protocol { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置端口号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("port")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("port")]
|
||||
public int[] PortList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否必要。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_necessary")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanReadOnlyConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_necessary")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanReadOnlyConverter))]
|
||||
public bool IsNecessary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("description")]
|
||||
public string Description { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class ServerIp
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 IP 地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ip")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ip")]
|
||||
public string Ip { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置协议。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("protocol")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("protocol")]
|
||||
public string Protocol { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置端口号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("port")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("port")]
|
||||
public int[] PortList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否必要。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_necessary")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanReadOnlyConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_necessary")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanReadOnlyConverter))]
|
||||
public bool IsNecessary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置功能描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("description")]
|
||||
public string Description { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置域名列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("domain_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("domain_list")]
|
||||
public Types.ServerDomain[] DomainList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 IP 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ip_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ip_list")]
|
||||
public Types.ServerIp[] IpList { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
<xml>
|
||||
<ToUserName><![CDATA[toUser]]></ToUserName>
|
||||
<FromUserName><![CDATA[sys]]></FromUserName>
|
||||
<CreateTime>1403610513</CreateTime>
|
||||
<MsgType><![CDATA[event]]></MsgType>
|
||||
<Event><![CDATA[security]]></Event>
|
||||
<ChangeType><![CDATA[change_domain_ip]]></ChangeType>
|
||||
</xml>
|
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"domain_list": [
|
||||
{
|
||||
"domain": "i.work.weixin.qq.com",
|
||||
"universal_domian": "work.weixin.qq.com",
|
||||
"protocol": "TCP",
|
||||
"port": [ 443, 80 ],
|
||||
"is_necessary": 1,
|
||||
"description": "企业微信客户端长连接,消息收发等功能;企业微信客户端短连接,登录、拉组织架构等功能"
|
||||
},
|
||||
{
|
||||
"domain": "live.work.weixin.qq.com",
|
||||
"universal_domian": "work.weixin.qq.com",
|
||||
"protocol": "TCP",
|
||||
"port": [ 443, 80 ],
|
||||
"is_necessary": 0,
|
||||
"description": "企业微信客户端长连接,消息收发等功能;企业微信客户端短连接,登录、拉组织架构等功能"
|
||||
}
|
||||
],
|
||||
"ip_list": [
|
||||
{
|
||||
"ip": "115.238.203.109",
|
||||
"protocol": "TCP",
|
||||
"port": [ 443, 80 ],
|
||||
"is_necessary": 0,
|
||||
"description": "企业微信客户端HTTPDNS解析"
|
||||
},
|
||||
{
|
||||
"ip": "115.238.203.110",
|
||||
"protocol": "TCP",
|
||||
"port": [ 443, 80 ],
|
||||
"is_necessary": 1,
|
||||
"description": "企业微信客户端HTTPDNS解析"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user