diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteComponentTcbExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteComponentTcbExtensions.cs index a7edf127..d857bc3b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteComponentTcbExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteComponentTcbExtensions.cs @@ -33,7 +33,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api } /// - /// 异步调用 [POST] /componenttcb/modifyenv 接口。 + /// 异步调用 [POST] /tcb/modifyenv 接口。 /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/modifyenv.html /// /// @@ -46,7 +46,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api if (request is null) throw new ArgumentNullException(nameof(request)); IFlurlRequest flurlReq = client - .CreateRequest(request, HttpMethod.Post, "componenttcb", "modifyenv") + .CreateRequest(request, HttpMethod.Post, "tcb", "modifyenv") .SetQueryParam("access_token", request.ComponentAccessToken); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); @@ -112,5 +112,170 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion + + #region SCF + /// + /// 异步调用 [POST] /componenttcb/batchuploadscf 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/batchuploadscf.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbBatchUploadSCFAsync(this WechatApiClient client, Models.ComponentTcbBatchUploadSCFRequest 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, "componenttcb", "batchuploadscf") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/batchuploadscfcode 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/batchUploadSCFCode.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbBatchUploadSCFCodeAsync(this WechatApiClient client, Models.ComponentTcbBatchUploadSCFCodeRequest 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, "componenttcb", "batchuploadscfcode") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/updatescfconfig 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/updatescfconfig.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbUploadSCFConfigAsync(this WechatApiClient client, Models.ComponentTcbUploadSCFConfigRequest 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, "componenttcb", "updatescfconfig") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/deletescf 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/deletescf.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbDeleteSCFConfigAsync(this WechatApiClient client, Models.ComponentTcbDeleteSCFConfigRequest 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, "componenttcb", "deletescf") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/getscflist 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/getscflist.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbGetSCFListAsync(this WechatApiClient client, Models.ComponentTcbGetSCFListRequest 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, "componenttcb", "getscflist") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/gettriggers 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/getTriggers.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbGetTriggersAsync(this WechatApiClient client, Models.ComponentTcbGetTriggersRequest 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, "componenttcb", "gettriggers") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /componenttcb/batchupdatetriggers 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/batchupdatetriggers.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbBatchUpdateTriggersAsync(this WechatApiClient client, Models.ComponentTcbBatchUpdateTriggersRequest 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, "componenttcb", "batchupdatetriggers") + .SetQueryParam("access_token", request.ComponentAccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /tcb/invokecloudfunction 接口。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/batch/batchupdatetriggers.html + /// + /// + /// + /// + /// + public static async Task ExecuteComponentTcbInvokeCloudFunctionAsync(this WechatApiClient client, Models.ComponentTcbInvokeCloudFunctionRequest 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, "tcb", "invokecloudfunction") + .SetQueryParam("access_token", request.ComponentAccessToken) + .SetQueryParam("env", request.EnvironmentId) + .SetQueryParam("name", request.FunctionName); + + using var httpContent = new StringContent(request.Data ?? string.Empty, Encoding.UTF8); + return await client.SendRequestAsync(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken); + } + #endregion } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentRequest.cs index b03d1e6e..5a68d3b2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentRequest.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace SKIT.FlurlHttpClient.Wechat.Api.Models { /// - /// 表示 [POST] /componenttcb/modifyenv 接口的请求。 + /// 表示 [POST] /tcb/modifyenv 接口的请求。 /// public class ComponentTcbModifyEnvironmentRequest : WechatApiRequest { diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentResponse.cs index ee0c862f..aa993133 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/Environment/ComponentTcbModifyEnvironmentResponse.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace SKIT.FlurlHttpClient.Wechat.Api.Models { /// - /// 表示 [POST] /componenttcb/modifyenv 接口的响应。 + /// 表示 [POST] /tcb/modifyenv 接口的响应。 /// public class ComponentTcbModifyEnvironmentResponse : WechatApiResponse { diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersRequest.cs new file mode 100644 index 00000000..78e5b07c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersRequest.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchupdatetriggers 接口的请求。 + /// + public class ComponentTcbBatchUpdateTriggersRequest : WechatApiRequest + { + public static class Types + { + public class Trigger + { + /// + /// 获取或设置触发器名称。 + /// + [Newtonsoft.Json.JsonProperty("trigger_name")] + [System.Text.Json.Serialization.JsonPropertyName("trigger_name")] + public string TriggerName { get; set; } = string.Empty; + + /// + /// 获取或设置触发器触发周期。 + /// + [Newtonsoft.Json.JsonProperty("config")] + [System.Text.Json.Serialization.JsonPropertyName("config")] + public string Config { get; set; } = string.Empty; + + /// + /// 获取或设置触发器类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + } + } + + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("funcname")] + [System.Text.Json.Serialization.JsonPropertyName("funcname")] + public string FunctionName { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("envs")] + [System.Text.Json.Serialization.JsonPropertyName("envs")] + public IList EnvironmentIdList { get; set; } = new List(); + + /// + /// 获取或设置触发器信息。 + /// + [Newtonsoft.Json.JsonProperty("triggers")] + [System.Text.Json.Serialization.JsonPropertyName("triggers")] + public IList Trigger { get; set; } = new List(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersResponse.cs new file mode 100644 index 00000000..e93ed396 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUpdateTriggersResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchupdatetriggers 接口的响应。 + /// + public class ComponentTcbBatchUpdateTriggersResponse : WechatApiResponse + { + public static class Types + { + public class Failure : ComponentTcbBatchUploadSCFResponse.Types.Failure + { + } + } + + /// + /// 获取或设置失败项列表。 + /// + [Newtonsoft.Json.JsonProperty("err_list")] + [System.Text.Json.Serialization.JsonPropertyName("err_list")] + public Types.Failure[]? FailureList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeRequest.cs new file mode 100644 index 00000000..fc23d7b5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeRequest.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchuploadscfcode 接口的请求。 + /// + public class ComponentTcbBatchUploadSCFCodeRequest : WechatApiRequest + { + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("functionname")] + [System.Text.Json.Serialization.JsonPropertyName("functionname")] + public string FunctionName { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("envs")] + [System.Text.Json.Serialization.JsonPropertyName("envs")] + public IList EnvironmentIdList { get; set; } = new List(); + + /// + /// 获取或设置包含函数代码文件的 zip 格式文件(需经过 Base64 编码)。 + /// + [Newtonsoft.Json.JsonProperty("zipfile")] + [System.Text.Json.Serialization.JsonPropertyName("zipfile")] + public string EncodingZipFile { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeResponse.cs new file mode 100644 index 00000000..d1ae9d52 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFCodeResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchuploadscfcode 接口的响应。 + /// + public class ComponentTcbBatchUploadSCFCodeResponse : WechatApiResponse + { + public static class Types + { + public class Failure : ComponentTcbBatchUploadSCFResponse.Types.Failure + { + } + } + + /// + /// 获取或设置失败项列表。 + /// + [Newtonsoft.Json.JsonProperty("fail_env_list")] + [System.Text.Json.Serialization.JsonPropertyName("fail_env_list")] + public Types.Failure[]? FailureList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFRequest.cs new file mode 100644 index 00000000..77172677 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFRequest.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchuploadscf 接口的请求。 + /// + public class ComponentTcbBatchUploadSCFRequest : WechatApiRequest + { + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("functionname")] + [System.Text.Json.Serialization.JsonPropertyName("functionname")] + public string FunctionName { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("envs")] + [System.Text.Json.Serialization.JsonPropertyName("envs")] + public IList EnvironmentIdList { get; set; } = new List(); + + /// + /// 获取或设置包含函数代码文件的 zip 格式文件(需经过 Base64 编码)。 + /// + [Newtonsoft.Json.JsonProperty("zipfile")] + [System.Text.Json.Serialization.JsonPropertyName("zipfile")] + public string EncodingZipFile { get; set; } = string.Empty; + + /// + /// 获取或设置 VPC 唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("vpcid")] + [System.Text.Json.Serialization.JsonPropertyName("vpcid")] + public string? VPCId { get; set; } + + /// + /// 获取或设置子网 ID。 + /// + [Newtonsoft.Json.JsonProperty("subnetid")] + [System.Text.Json.Serialization.JsonPropertyName("subnetid")] + public string? SubnetId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFResponse.cs new file mode 100644 index 00000000..ece7a307 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbBatchUploadSCFResponse.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/batchuploadscf 接口的响应。 + /// + public class ComponentTcbBatchUploadSCFResponse : WechatApiResponse + { + public static class Types + { + public class Failure + { + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonProperty("env")] + [System.Text.Json.Serialization.JsonPropertyName("env")] + public string EnvironmentId { get; set; } = default!; + + /// + /// 获取或设置错误描述。 + /// + [Newtonsoft.Json.JsonProperty("errmsg")] + [System.Text.Json.Serialization.JsonPropertyName("errmsg")] + public string? ErrorMessage { get; set; } + } + } + + /// + /// 获取或设置失败项列表。 + /// + [Newtonsoft.Json.JsonProperty("fail_env_list")] + [System.Text.Json.Serialization.JsonPropertyName("fail_env_list")] + public Types.Failure[]? FailureList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigRequest.cs new file mode 100644 index 00000000..2be9e3ea --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigRequest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/deletescf 接口的请求。 + /// + public class ComponentTcbDeleteSCFConfigRequest : WechatApiRequest + { + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonProperty("env")] + [System.Text.Json.Serialization.JsonPropertyName("env")] + public string EnvironmentId { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("functionname")] + [System.Text.Json.Serialization.JsonPropertyName("functionname")] + public string FunctionName { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigResponse.cs new file mode 100644 index 00000000..221d4bf5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbDeleteSCFConfigResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/deletescf 接口的响应。 + /// + public class ComponentTcbDeleteSCFConfigResponse : WechatApiResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListRequest.cs new file mode 100644 index 00000000..2b92092f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListRequest.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/getscflist 接口的请求。 + /// + public class ComponentTcbGetSCFListRequest : WechatApiRequest + { + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonProperty("env")] + [System.Text.Json.Serialization.JsonPropertyName("env")] + public string EnvironmentId { get; set; } = string.Empty; + + /// + /// 获取或设置分页起始位置。 + /// + [Newtonsoft.Json.JsonProperty("offset")] + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int? Offset { get; set; } + + /// + /// 获取或设置分页每页数量。 + /// + [Newtonsoft.Json.JsonProperty("limit")] + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int? Limit { get; set; } + + /// + /// 获取或设置搜索关键词。 + /// + [Newtonsoft.Json.JsonProperty("searchkey")] + [System.Text.Json.Serialization.JsonPropertyName("searchkey")] + public string? SearchKey { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListResponse.cs new file mode 100644 index 00000000..b9bfedf5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetSCFListResponse.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/getscflist 接口的响应。 + /// + public class ComponentTcbGetSCFListResponse : WechatApiResponse + { + public static class Types + { + public class Function + { + public static class Types + { + public class StatusReason + { + /// + /// 获取或设置错误码。 + /// + [Newtonsoft.Json.JsonProperty("errcode")] + [System.Text.Json.Serialization.JsonPropertyName("errcode")] + public string ErrorCode { get; set; } = default!; + + /// + /// 获取或设置错误描述。 + /// + [Newtonsoft.Json.JsonProperty("errmsg")] + [System.Text.Json.Serialization.JsonPropertyName("errmsg")] + public string ErrorMessage { get; set; } = default!; + } + } + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string FunctionName { get; set; } = default!; + + /// + /// 获取或设置运行时。 + /// + [Newtonsoft.Json.JsonProperty("runtime")] + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public string Runtime { get; set; } = default!; + + /// + /// 获取或设置函数状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置状态原因列表。 + /// + [Newtonsoft.Json.JsonProperty("status_reason")] + [System.Text.Json.Serialization.JsonPropertyName("status_reason")] + public Types.StatusReason[] StatusReasonList { get; set; } = default!; + + /// + /// 获取或设置修改时间。 + /// + [Newtonsoft.Json.JsonProperty("mod_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("mod_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))] + public DateTimeOffset UpdateTime { get; set; } = default!; + + /// + /// 获取或设置创建时间。 + /// + [Newtonsoft.Json.JsonProperty("add_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("add_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))] + public DateTimeOffset CreateTime { get; set; } = default!; + } + } + + /// + /// 获取或设置云函数列表。 + /// + [Newtonsoft.Json.JsonProperty("functions")] + [System.Text.Json.Serialization.JsonPropertyName("functions")] + public Types.Function[] FunctionList { get; set; } = default!; + + /// + /// 获取或设置云函数总数量。 + /// + [Newtonsoft.Json.JsonProperty("total_count")] + [System.Text.Json.Serialization.JsonPropertyName("total_count")] + public int TotalCount { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersRequest.cs new file mode 100644 index 00000000..606a625a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersRequest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/gettriggers 接口的请求。 + /// + public class ComponentTcbGetTriggersRequest : WechatApiRequest + { + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonProperty("env")] + [System.Text.Json.Serialization.JsonPropertyName("env")] + public string EnvironmentId { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("funcname")] + [System.Text.Json.Serialization.JsonPropertyName("funcname")] + public string FunctionName { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersResponse.cs new file mode 100644 index 00000000..8e10d4f5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbGetTriggersResponse.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/gettriggers 接口的响应。 + /// + public class ComponentTcbGetTriggersResponse : WechatApiResponse + { + public static class Types + { + public class Trigger + { + /// + /// 获取或设置触发器名称。 + /// + [Newtonsoft.Json.JsonProperty("trigger_name")] + [System.Text.Json.Serialization.JsonPropertyName("trigger_name")] + public string TriggerName { get; set; } = default!; + + /// + /// 获取或设置触发器触发周期。 + /// + [Newtonsoft.Json.JsonProperty("config")] + [System.Text.Json.Serialization.JsonPropertyName("config")] + public string Config { get; set; } = default!; + + /// + /// 获取或设置触发器类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; + } + } + + /// + /// 获取或设置触发器列表。 + /// + [Newtonsoft.Json.JsonProperty("triggers")] + [System.Text.Json.Serialization.JsonPropertyName("triggers")] + public Types.Trigger[] TriggerList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionRequest.cs new file mode 100644 index 00000000..dd1fe0f6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionRequest.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /tcb/invokecloudfunction 接口的请求。 + /// + public class ComponentTcbInvokeCloudFunctionRequest : WechatApiRequest + { + public static class Types + { + public class Trigger + { + /// + /// 获取或设置触发器名称。 + /// + [Newtonsoft.Json.JsonProperty("trigger_name")] + [System.Text.Json.Serialization.JsonPropertyName("trigger_name")] + public string TriggerName { get; set; } = string.Empty; + + /// + /// 获取或设置触发器触发周期。 + /// + [Newtonsoft.Json.JsonProperty("config")] + [System.Text.Json.Serialization.JsonPropertyName("config")] + public string Config { get; set; } = string.Empty; + + /// + /// 获取或设置触发器类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + } + } + + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string EnvironmentId { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string FunctionName { get; set; } = string.Empty; + + /// + /// 获取或设置函数传入参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? Data { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionResponse.cs new file mode 100644 index 00000000..0f1778aa --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbInvokeCloudFunctionResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /tcb/invokecloudfunction 接口的响应。 + /// + public class ComponentTcbInvokeCloudFunctionResponse : WechatApiResponse + { + /// + /// 获取或设置函数返回结果。 + /// + [Newtonsoft.Json.JsonProperty("resp_data")] + [System.Text.Json.Serialization.JsonPropertyName("resp_data")] + public string? Data { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigRequest.cs new file mode 100644 index 00000000..853e7f06 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigRequest.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/updatescfconfig 接口的请求。 + /// + public class ComponentTcbUploadSCFConfigRequest : WechatApiRequest + { + public static class Types + { + public class EnvironmentVariable + { + /// + /// 获取或设置键。 + /// + [Newtonsoft.Json.JsonProperty("key")] + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string Key { get; set; } = string.Empty; + + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } = string.Empty; + } + + public class PublicNetConfig + { + /// + /// 获取或公网访问状态。 + /// + [Newtonsoft.Json.JsonProperty("public_net_status")] + [System.Text.Json.Serialization.JsonPropertyName("public_net_status")] + public string PublicNetStatus { get; set; } = string.Empty; + + /// + /// 获取或 EIP 状态。 + /// + [Newtonsoft.Json.JsonProperty("eip_status")] + [System.Text.Json.Serialization.JsonPropertyName("eip_status")] + public string EIPStatus { get; set; } = string.Empty; + } + + public class VPCConfig + { + /// + /// 获取或设置 VPC 唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("vpcid")] + [System.Text.Json.Serialization.JsonPropertyName("vpcid")] + public string VPCId { get; set; } = string.Empty; + + /// + /// 获取或设置子网 ID。 + /// + [Newtonsoft.Json.JsonProperty("subnetid")] + [System.Text.Json.Serialization.JsonPropertyName("subnetid")] + public string SubnetId { get; set; } = string.Empty; + } + } + + /// + /// 获取或设置第三方平台 AccessToken。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ComponentAccessToken { get; set; } = string.Empty; + + /// + /// 获取或设置环境 ID。 + /// + [Newtonsoft.Json.JsonProperty("env")] + [System.Text.Json.Serialization.JsonPropertyName("env")] + public string EnvironmentId { get; set; } = string.Empty; + + /// + /// 获取或设置函数名。 + /// + [Newtonsoft.Json.JsonProperty("functionname")] + [System.Text.Json.Serialization.JsonPropertyName("functionname")] + public string FunctionName { get; set; } = string.Empty; + + /// + /// 获取或设置内存大小(单位:MB)。 + /// + [Newtonsoft.Json.JsonProperty("memorysize")] + [System.Text.Json.Serialization.JsonPropertyName("memorysize")] + public int? FunctionMemorySize { get; set; } + + /// + /// 获取或设置超时时间(单位:秒))。 + /// + [Newtonsoft.Json.JsonProperty("timeout")] + [System.Text.Json.Serialization.JsonPropertyName("timeout")] + public int? FunctionTimeout { get; set; } + + /// + /// 获取或设置环境变量列表。 + /// + [Newtonsoft.Json.JsonProperty("environment_variables")] + [System.Text.Json.Serialization.JsonPropertyName("environment_variables")] + public List? EnvironmentVariableList { get; set; } + + /// + /// 获取或设置公网访问配置信息。 + /// + [Newtonsoft.Json.JsonProperty("public_net_config")] + [System.Text.Json.Serialization.JsonPropertyName("public_net_config")] + public Types.PublicNetConfig? PublicNetConfig { get; set; } + + /// + /// 获取或设置私有网络配置信息。 + /// + [Newtonsoft.Json.JsonProperty("vpc_config")] + [System.Text.Json.Serialization.JsonPropertyName("vpc_config")] + public Types.VPCConfig? VPCConfig { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigResponse.cs new file mode 100644 index 00000000..b5101c2e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/ComponentTcb/SCF/ComponentTcbUploadSCFConfigResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /componenttcb/updatescfconfig 接口的响应。 + /// + public class ComponentTcbUploadSCFConfigResponse : WechatApiResponse + { + } +}