diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Extensions/WechatWorkSpecialApiClientExecuteSpecialExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Extensions/WechatWorkSpecialApiClientExecuteSpecialExtensions.cs deleted file mode 100644 index 2640fb8e..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Extensions/WechatWorkSpecialApiClientExecuteSpecialExtensions.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Flurl.Http; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - public static class WechatWorkSpecialApiClientExecuteSpecialExtensions - { - /// - /// 异步调用 [POST] /spec/gettoken 接口。 - /// - /// REF:
- /// - ///
- ///
- /// - /// - /// - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public static async Task ExecuteSpecialGetTokenAsync(this WechatWorkSpecialApiClient client, Models.SpecialGetTokenRequest 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, "spec", "gettoken") - .WithHeader("auth-corpid", null); - - return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); - } - - /// - /// 异步调用 [POST] /spec/list_job 接口。 - /// - /// REF:
- /// - ///
- ///
- /// - /// - /// - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public static async Task ExecuteSpecialListJobAsync(this WechatWorkSpecialApiClient client, Models.SpecialListJobRequest 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, "spec", "list_job") - .WithHeader("auth-corpid", null) - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); - } - - /// - /// 异步调用 [POST] /spec/exec_and_report_job 接口。 - /// - /// REF:
- /// - ///
- ///
- /// - /// - /// - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public static async Task ExecuteSpecialExecuteAndReportJobAsync(this WechatWorkSpecialApiClient client, Models.SpecialExecuteAndReportJobRequest 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, "spec", "exec_and_report_job") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); - } - - /// - /// 异步调用 [POST] /spec/fetch_msg 接口。 - /// - /// REF:
- /// - ///
- ///
- /// - /// - /// - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public static async Task ExecuteSpecialFetchMessageAsync(this WechatWorkSpecialApiClient client, Models.SpecialFetchMessageRequest 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, "spec", "fetch_msg") - .SetQueryParam("access_token", request.AccessToken); - - return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); - } - - /// - /// 异步调用 [GET] /spec/download_media 接口。 - /// - /// REF:
- /// - ///
- ///
- /// - /// - /// - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public static async Task ExecuteSpecialDownloadMediaAsync(this WechatWorkSpecialApiClient client, Models.SpecialDownloadMediaRequest 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, "spec", "download_media") - .SetQueryParam("access_token", request.AccessToken) - .SetQueryParam("media_id", request.MediaId); - - return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Interceptors/WechatWorkSpecialApiRequestSigningInterceptor.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Interceptors/WechatWorkSpecialApiRequestSigningInterceptor.cs deleted file mode 100644 index a9b662e4..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Interceptors/WechatWorkSpecialApiRequestSigningInterceptor.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Flurl.Http; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Interceptors -{ - using SKIT.FlurlHttpClient; - using SKIT.FlurlHttpClient.Internal; - using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi; - - internal class WechatWorkSpecialApiRequestSigningInterceptor : HttpInterceptor - { - private readonly string _secret; - - public WechatWorkSpecialApiRequestSigningInterceptor(string secret) - { - _secret = secret; - } - - public override async Task BeforeCallAsync(HttpInterceptorContext context, CancellationToken cancellationToken = default) - { - if (context is null) throw new ArgumentNullException(nameof(context)); - if (context.FlurlCall.Completed) throw new WechatWorkSpecialApiException("Failed to sign request. This interceptor must be called before request completed."); - - string method = context.FlurlCall.HttpRequestMessage.Method.ToString().ToUpper(); - string path = context.FlurlCall.HttpRequestMessage.RequestUri?.AbsolutePath ?? string.Empty; - string query = context.FlurlCall.HttpRequestMessage.RequestUri?.Query?.TrimStart('?') ?? string.Empty; - string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); - string nonce = Guid.NewGuid().ToString("N"); - string authCorpId = context.FlurlCall.Request.Headers.GetAll("auth-corpid").FirstOrDefault() ?? string.Empty; - string body = string.Empty; - - if (context.FlurlCall.HttpRequestMessage?.Content is not null) - { - if (method != "GET") - { - HttpContent httpContent = context.FlurlCall.HttpRequestMessage.Content; - body = await _AsyncEx.RunTaskWithCancellationTokenAsync(httpContent.ReadAsStringAsync(), cancellationToken).ConfigureAwait(false); - } - } - - StringBuilder signData = new StringBuilder(); - signData.Append(!string.IsNullOrEmpty(authCorpId) ? $"auth-corpid={authCorpId}\n" : string.Empty); - signData.Append($"body-md5={Utilities.MD5Utility.Hash(body).Value!.ToLower()}\n"); - signData.Append($"timestamp={timestamp}\n"); - signData.Append($"method={method}\n"); - signData.Append($"nonce={nonce}\n"); - signData.Append($"url={path}\n"); - signData.Append(!string.IsNullOrEmpty(query) ? $"query={query}\n" : string.Empty); - signData.Append("\n"); - string sign; - - try - { - sign = Utilities.HMACUtility.HashWithSHA256(_secret, signData.ToString()).Value!.ToLower(); - } - catch (Exception ex) - { - throw new WechatWorkSpecialApiException("Failed to sign request. Please see the inner exception for more details.", ex); - } - - context.FlurlCall.Request.WithHeader("nonce", nonce); - context.FlurlCall.Request.WithHeader("timestamp", timestamp); - context.FlurlCall.Request.WithHeader("signature", sign); - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaRequest.cs deleted file mode 100644 index 8477b05c..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaRequest.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [GET] /spec/download_media 接口的请求。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialDownloadMediaRequest : WechatWorkSpecialApiRequest - { - /// - /// 获取或设置素材 ID。 - /// - [Newtonsoft.Json.JsonIgnore] - [System.Text.Json.Serialization.JsonIgnore] - public string MediaId { get; set; } = string.Empty; - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaResponse.cs deleted file mode 100644 index 182e3a05..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialDownloadMediaResponse.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [GET] /spec/download_media 接口的响应。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialDownloadMediaResponse : WechatWorkSpecialApiResponse - { - public override bool IsSuccessful() - { - return base.IsSuccessful() && GetRawHeaders().ContainsKey("Content-Disposition"); - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobRequest.cs deleted file mode 100644 index d0f515b2..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobRequest.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/exec_and_report_job 接口的请求。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialExecuteAndReportJobRequest : WechatWorkSpecialApiRequest - { - public static class Types - { - public class Result - { - /// - /// 获取或设置任务类型。 - /// - [Newtonsoft.Json.JsonProperty("job_type")] - [System.Text.Json.Serialization.JsonPropertyName("job_type")] - public string JobType { get; set; } = string.Empty; - - /// - /// 获取或设置任务结果数据。 - /// - [Newtonsoft.Json.JsonProperty("data")] - [System.Text.Json.Serialization.JsonPropertyName("data")] - public string? DataString { get; set; } - } - } - - /// - /// 获取或设置任务 ID。 - /// - [Newtonsoft.Json.JsonProperty("jobid")] - [System.Text.Json.Serialization.JsonPropertyName("jobid")] - public string JobId { get; set; } = string.Empty; - - /// - /// 获取或设置任务状态。 - /// - [Newtonsoft.Json.JsonProperty("status")] - [System.Text.Json.Serialization.JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// 获取或设置任务进度(单位:百分数)。 - /// - [Newtonsoft.Json.JsonProperty("progress")] - [System.Text.Json.Serialization.JsonPropertyName("progress")] - public int? Progress { get; set; } - - /// - /// 获取或设置结果信息。 - /// - [Newtonsoft.Json.JsonProperty("result")] - [System.Text.Json.Serialization.JsonPropertyName("result")] - public Types.Result? Result { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobResponse.cs deleted file mode 100644 index 304a5b40..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialExecuteAndReportJobResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/exec_and_report_job 接口的响应。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialExecuteAndReportJobResponse : WechatWorkSpecialApiResponse - { - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageRequest.cs deleted file mode 100644 index 56798bbd..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageRequest.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/fetch_msg 接口的请求。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialFetchMessageRequest : WechatWorkSpecialApiRequest - { - /// - /// 获取或设置任务 ID。 - /// - [Newtonsoft.Json.JsonProperty("jobid")] - [System.Text.Json.Serialization.JsonPropertyName("jobid")] - public string JobId { 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/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageResponse.cs deleted file mode 100644 index d917a6f6..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialFetchMessageResponse.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/fetch_msg 接口的响应。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialFetchMessageResponse : WechatWorkSpecialApiResponse - { - public static class Types - { - public class Message - { - public static class Types - { - public class Sender - { - /// - /// 获取或设置身份类型。 - /// - [Newtonsoft.Json.JsonProperty("type")] - [System.Text.Json.Serialization.JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// 获取或设置 ID。 - /// - [Newtonsoft.Json.JsonProperty("id")] - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - } - - public class Receiver : Sender - { - } - } - - /// - /// 获取或设置消息 ID。 - /// - [Newtonsoft.Json.JsonProperty("msgid")] - [System.Text.Json.Serialization.JsonPropertyName("msgid")] - public string MessageId { get; set; } = default!; - - /// - /// 获取或设置消息类型。 - /// - [Newtonsoft.Json.JsonProperty("msgtype")] - [System.Text.Json.Serialization.JsonPropertyName("msgtype")] - public int MessageType { get; set; } - - /// - /// 获取或设置发送者信息。 - /// - [Newtonsoft.Json.JsonProperty("sender")] - [System.Text.Json.Serialization.JsonPropertyName("sender")] - public Types.Sender Sender { get; set; } = default!; - - /// - /// 获取或设置接收者列表。 - /// - [Newtonsoft.Json.JsonProperty("receiver_list")] - [System.Text.Json.Serialization.JsonPropertyName("receiver_list")] - public Types.Receiver[]? ReceiverList { get; set; } - - /// - /// 获取或设置群 ID。 - /// - [Newtonsoft.Json.JsonProperty("chatid")] - [System.Text.Json.Serialization.JsonPropertyName("chatid")] - public string? GroupChatId { get; set; } - - /// - /// 获取或设置发送时间戳。 - /// - [Newtonsoft.Json.JsonProperty("send_time")] - [System.Text.Json.Serialization.JsonPropertyName("send_time")] - public long SendTimestamp { get; set; } - - /// - /// 获取或设置是否被撤回。 - /// - [Newtonsoft.Json.JsonProperty("is_recalled")] - [System.Text.Json.Serialization.JsonPropertyName("is_recalled")] - public bool IsRecalled { get; set; } - - /// - /// 获取或设置扩展字段。 - /// - [Newtonsoft.Json.JsonExtensionData] - [System.Text.Json.Serialization.JsonExtensionData] - public IDictionary? ExtendedData { get; set; } - } - } - - /// - /// 获取或设置消息列表。 - /// - [Newtonsoft.Json.JsonProperty("msg_list")] - [System.Text.Json.Serialization.JsonPropertyName("msg_list")] - public Types.Message[] MessageList { get; set; } = default!; - - /// - /// 获取或设置分页游标。 - /// - [Newtonsoft.Json.JsonProperty("next_cursor")] - [System.Text.Json.Serialization.JsonPropertyName("next_cursor")] - public string? NextCursor { get; set; } - - /// - /// 获取或设置是否还有更多数据。 - /// - [Newtonsoft.Json.JsonProperty("has_more")] - [System.Text.Json.Serialization.JsonPropertyName("has_more")] - public bool HasMore { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenRequest.cs deleted file mode 100644 index b2f5125c..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenRequest.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/gettoken 接口的请求。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialGetTokenRequest : WechatWorkSpecialApiRequest - { - /// - /// 获取或设置服务商 CorpId。如果不指定将使用构造 时的 参数。 - /// - [Newtonsoft.Json.JsonProperty("model_id")] - [System.Text.Json.Serialization.JsonPropertyName("model_id")] - public string? CorpId { get; set; } - - /// - /// 获取或设置数据分析专区 Secret。如果不指定将使用构造 时的 参数。 - /// - [Newtonsoft.Json.JsonProperty("secret")] - [System.Text.Json.Serialization.JsonPropertyName("secret")] - public string? Secret { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenResponse.cs deleted file mode 100644 index 32398659..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialGetTokenResponse.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/gettoken 接口的响应。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialGetTokenResponse : WechatWorkSpecialApiResponse - { - /// - /// 获取或设置数据分析专区接口凭证。 - /// - [Newtonsoft.Json.JsonProperty("access_token")] - [System.Text.Json.Serialization.JsonPropertyName("access_token")] - public string AccessToken { get; set; } = default!; - - /// - /// 获取或设置接口凭证有效期(单位:秒)。 - /// - [Newtonsoft.Json.JsonProperty("expires_in")] - [System.Text.Json.Serialization.JsonPropertyName("expires_in")] - public int ExpiresIn { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialListJobRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialListJobRequest.cs deleted file mode 100644 index 0f36bc02..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialListJobRequest.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/list_job 接口的请求。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialListJobRequest : WechatWorkSpecialApiRequest - { - /// - /// 获取或设置分页游标。 - /// - [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/ExtendedSDK/SpecialApi/Models/SpecialListJobResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialListJobResponse.cs deleted file mode 100644 index 9cc21819..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Models/SpecialListJobResponse.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models -{ - /// - /// 表示 [POST] /spec/list_job 接口的响应。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public class SpecialListJobResponse : WechatWorkSpecialApiResponse - { - public static class Types - { - public class Job - { - /// - /// 获取或设置任务 ID。 - /// - [Newtonsoft.Json.JsonProperty("jobid")] - [System.Text.Json.Serialization.JsonPropertyName("jobid")] - public string JobId { get; set; } = default!; - - /// - /// 获取或设置授权方 CorpId。 - /// - [Newtonsoft.Json.JsonProperty("auth_corpid")] - [System.Text.Json.Serialization.JsonPropertyName("auth_corpid")] - public string AuthorizerCorpId { get; set; } = default!; - - /// - /// 获取或设置自定义数据。 - /// - [Newtonsoft.Json.JsonProperty("custom_data")] - [System.Text.Json.Serialization.JsonPropertyName("custom_data")] - public string? CustomData { get; set; } - - /// - /// 获取或设置创建时间戳。 - /// - [Newtonsoft.Json.JsonProperty("create_time")] - [System.Text.Json.Serialization.JsonPropertyName("create_time")] - public long CreateTimestamp { get; set; } - } - } - - /// - /// 获取或设置任务列表。 - /// - [Newtonsoft.Json.JsonProperty("job_list")] - [System.Text.Json.Serialization.JsonPropertyName("job_list")] - public Types.Job[] JobList { get; set; } = default!; - - /// - /// 获取或设置分页游标。 - /// - [Newtonsoft.Json.JsonProperty("next_cursor")] - [System.Text.Json.Serialization.JsonPropertyName("next_cursor")] - public string? NextCursor { get; set; } - - /// - /// 获取或设置是否还有更多数据。 - /// - [Newtonsoft.Json.JsonProperty("has_more")] - [System.Text.Json.Serialization.JsonPropertyName("has_more")] - public bool HasMore { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Settings/Credentials.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Settings/Credentials.cs deleted file mode 100644 index 1e620274..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/Settings/Credentials.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Settings -{ - public sealed class Credentials - { - /// - /// 初始化客户端时 的副本。 - /// - public string ProviderCorpId { get; } - - /// - /// 初始化客户端时 的副本。 - /// - public string SpecialSecret { get; } - - /// - /// 初始化客户端时 的副本。 - /// - public string SignSecret { get; } - - internal Credentials(WechatWorkSpecialApiClientOptions options) - { - if (options is null) throw new ArgumentNullException(nameof(options)); - - ProviderCorpId = options.ProviderCorpId; - SpecialSecret = options.SpecialSecret; - SignSecret = options.SignSecret; - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClient.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClient.cs deleted file mode 100644 index e6275a6c..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClient.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Flurl.Http; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 一个企业微信数据分析专区 API HTTP 客户端。 - /// - [Obsolete("相关接口或字段于 2024-06-06 下线。")] - public sealed class WechatWorkSpecialApiClient : CommonClientBase, ICommonClient - { - /// - /// 获取当前客户端使用的企业微信数据分析专区凭证。 - /// - public Settings.Credentials Credentials { get; } - - /// - /// 用指定的配置项初始化 类的新实例。 - /// - /// 配置项。 - public WechatWorkSpecialApiClient(WechatWorkSpecialApiClientOptions options) - : this(options, null) - { - } - - /// - /// - /// - /// - /// - /// - internal WechatWorkSpecialApiClient(WechatWorkSpecialApiClientOptions options, HttpClient? httpClient, bool disposeClient = true) - : base(httpClient, disposeClient) - { - if (options is null) throw new ArgumentNullException(nameof(options)); - - Credentials = new Settings.Credentials(options); - - FlurlClient.BaseUrl = options.Endpoint ?? WechatWorkSpecialApiEndpoints.DEFAULT; - FlurlClient.WithTimeout(options.Timeout <= 0 ? Timeout.InfiniteTimeSpan : TimeSpan.FromMilliseconds(options.Timeout)); - - Interceptors.Add(new Interceptors.WechatWorkSpecialApiRequestSigningInterceptor(options.SignSecret)); - } - - /// - /// 使用当前客户端生成一个新的 对象。 - /// - /// - /// - /// - /// - public IFlurlRequest CreateFlurlRequest(WechatWorkSpecialApiRequest request, HttpMethod httpMethod, params object[] urlSegments) - { - IFlurlRequest flurlRequest = base.CreateFlurlRequest(request, httpMethod, urlSegments); - - if (request.AuthorizerCorpId is not null) - { - flurlRequest.WithHeader("auth-corpid", request.AuthorizerCorpId); - } - - return flurlRequest; - } - - /// - /// 异步发起请求。 - /// - /// - /// - /// - /// - /// - public async Task SendFlurlRequestAsJsonAsync(IFlurlRequest flurlRequest, object? data = null, CancellationToken cancellationToken = default) - where T : WechatWorkSpecialApiResponse, new() - { - if (flurlRequest is null) throw new ArgumentNullException(nameof(flurlRequest)); - - bool isSimpleRequest = data is null || - flurlRequest.Verb == HttpMethod.Get || - flurlRequest.Verb == HttpMethod.Head || - flurlRequest.Verb == HttpMethod.Options; - using IFlurlResponse flurlResponse = isSimpleRequest ? - await base.SendFlurlRequestAsync(flurlRequest, null, cancellationToken).ConfigureAwait(false) : - await base.SendFlurlRequestAsJsonAsync(flurlRequest, data, cancellationToken).ConfigureAwait(false); - return await WrapFlurlResponseAsJsonAsync(flurlResponse, cancellationToken).ConfigureAwait(false); - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClientOptions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClientOptions.cs deleted file mode 100644 index fb2e3e61..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiClientOptions.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 一个用于构造 时使用的配置项。 - /// - public class WechatWorkSpecialApiClientOptions - { - /// - /// 获取或设置请求超时时间(单位:毫秒)。 - /// 默认值:30000 - /// - public int Timeout { get; set; } = 30 * 1000; - - /// - /// 获取或设置企业微信数据分析专区 API 入口点。 - /// 默认值: - /// - public string Endpoint { get; set; } = WechatWorkSpecialApiEndpoints.DEFAULT; - - /// - /// 获取或设置企业微信服务商 CorpId。 - /// - public string ProviderCorpId { get; set; } = default!; - - /// - /// 获取或设置企业微信数据分析专区 Secret 。 - /// - public string SpecialSecret { get; set; } = default!; - - /// - /// 获取或设置企业微信数据分析专区签名密钥。 - /// - public string SignSecret { get; set; } = default!; - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiEndpoints.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiEndpoints.cs deleted file mode 100644 index d81ed1e9..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiEndpoints.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 企业微信数据分析专区 API 接口域名。 - /// - public static class WechatWorkSpecialApiEndpoints - { - /// - /// 默认域名。 - /// - public const string DEFAULT = "https://specapi.weixin.qq.com"; - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiException.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiException.cs deleted file mode 100644 index f4bd7327..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiException.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 当调用企业微信数据分析专区 API 出错时引发的异常。 - /// - public class WechatWorkSpecialApiException : WechatWorkException - { - /// - public WechatWorkSpecialApiException() - { - } - - /// - public WechatWorkSpecialApiException(string message) - : base(message) - { - } - - /// - public WechatWorkSpecialApiException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiRequest.cs deleted file mode 100644 index 6967f4ce..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiRequest.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 表示企业微信数据分析专区 API 请求的基类。 - /// - public abstract class WechatWorkSpecialApiRequest : CommonRequestBase, ICommonRequest - { - /// - /// 获取或设置企业微信数据分析专区的 AccessToken。 - /// - [Newtonsoft.Json.JsonIgnore] - [System.Text.Json.Serialization.JsonIgnore] - public virtual string? AccessToken { get; set; } - - /// - /// 获取或设置授权方的 CorpId。 - /// - [Newtonsoft.Json.JsonIgnore] - [System.Text.Json.Serialization.JsonIgnore] - public virtual string? AuthorizerCorpId { get; set; } - } -} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiResponse.cs deleted file mode 100644 index a489562d..00000000 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/ExtendedSDK/SpecialApi/WechatWorkSpecialApiResponse.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi -{ - /// - /// 表示企业微信数据分析专区 API 响应的基类。 - /// - public abstract class WechatWorkSpecialApiResponse : CommonResponseBase, ICommonResponse - { - /// - /// 获取企业微信数据分析专区 API 返回的错误码。 - /// - [Newtonsoft.Json.JsonProperty("errcode")] - [System.Text.Json.Serialization.JsonPropertyName("errcode")] - public virtual int ErrorCode { get; set; } - - /// - /// 获取企业微信数据分析专区 API 返回的错误描述。 - /// - [Newtonsoft.Json.JsonProperty("errmsg")] - [System.Text.Json.Serialization.JsonPropertyName("errmsg")] - public virtual string? ErrorMessage { get; set; } - - /// - /// 获取一个值,该值指示调用企业微信数据分析专区 API 是否成功。 - /// - ///(即 HTTP 状态码为 200,且 值为 0) - /// - /// - /// - public override bool IsSuccessful() - { - return GetRawStatus() == 200 && ErrorCode == 0; - } - } -} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/IMPORTANT_CodeAnalyzeTests.cs b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/IMPORTANT_CodeAnalyzeTests.cs index fb5b8f6f..8cd26d37 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/IMPORTANT_CodeAnalyzeTests.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/IMPORTANT_CodeAnalyzeTests.cs @@ -6,8 +6,6 @@ using Xunit; namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests { - using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi; - public class CodeAnalyzeTests { [Fact(DisplayName = "代码质量分析")] @@ -58,21 +56,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.UnitTests }; new SourceFileAnalyzer(options).AssertNoIssues(); })); - - Assert.Null(Record.Exception(() => - { - var options = new TypeDeclarationAnalyzerOptions() - { - SdkAssembly = Assembly.GetAssembly(typeof(WechatWorkSpecialApiClient))!, - SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models", - SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi.Models", - SdkExecutingExtensionDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.SpecialApi", - ThrowOnNotFoundRequestModelTypes = true, - ThrowOnNotFoundResponseModelTypes = true, - ThrowOnNotFoundExecutingExtensionTypes = true - }; - new TypeDeclarationAnalyzer(options).AssertNoIssues(); - })); } } }