diff --git a/SKIT.FlurlHttpClient.Wechat.sln b/SKIT.FlurlHttpClient.Wechat.sln index 81801f64..c3f4ef22 100644 --- a/SKIT.FlurlHttpClient.Wechat.sln +++ b/SKIT.FlurlHttpClient.Wechat.sln @@ -16,12 +16,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SKIT.FlurlHttpClient.Wechat EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SKIT.FlurlHttpClient.Wechat.TenpayV3", "src\SKIT.FlurlHttpClient.Wechat.TenpayV3\SKIT.FlurlHttpClient.Wechat.TenpayV3.csproj", "{6FE502D4-C43D-49C9-9E57-D1EE566FD1C3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SKIT.FlurlHttpClient.Wechat.Work", "src\SKIT.FlurlHttpClient.Wechat.Work\SKIT.FlurlHttpClient.Wechat.Work.csproj", "{CDD123E6-2622-4368-BAEE-8B95F05F1AB2}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C95AF531-CF44-44AA-AC90-F4DF9F941674}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SKIT.FlurlHttpClient.Wechat.Api.UnitTests", "test\SKIT.FlurlHttpClient.Wechat.Api.UnitTests\SKIT.FlurlHttpClient.Wechat.Api.UnitTests.csproj", "{0C87A7D9-26EA-4821-AF3F-6D28B3006B24}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests", "test\SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests\SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests.csproj", "{5ECE2E7A-9AE8-49BF-902D-41A7756C3E78}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SKIT.FlurlHttpClient.Wechat.Work.UnitTests", "test\SKIT.FlurlHttpClient.Wechat.Work.UnitTests\SKIT.FlurlHttpClient.Wechat.Work.UnitTests.csproj", "{DBF84F66-1436-4599-93AB-7C16A3A2C3A4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,6 +52,14 @@ Global {5ECE2E7A-9AE8-49BF-902D-41A7756C3E78}.Debug|Any CPU.Build.0 = Debug|Any CPU {5ECE2E7A-9AE8-49BF-902D-41A7756C3E78}.Release|Any CPU.ActiveCfg = Release|Any CPU {5ECE2E7A-9AE8-49BF-902D-41A7756C3E78}.Release|Any CPU.Build.0 = Release|Any CPU + {CDD123E6-2622-4368-BAEE-8B95F05F1AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CDD123E6-2622-4368-BAEE-8B95F05F1AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CDD123E6-2622-4368-BAEE-8B95F05F1AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CDD123E6-2622-4368-BAEE-8B95F05F1AB2}.Release|Any CPU.Build.0 = Release|Any CPU + {DBF84F66-1436-4599-93AB-7C16A3A2C3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DBF84F66-1436-4599-93AB-7C16A3A2C3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DBF84F66-1436-4599-93AB-7C16A3A2C3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DBF84F66-1436-4599-93AB-7C16A3A2C3A4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -58,6 +70,8 @@ Global {6FE502D4-C43D-49C9-9E57-D1EE566FD1C3} = {3E34ADB9-1F52-4C96-9A42-DE782DE1AAA3} {0C87A7D9-26EA-4821-AF3F-6D28B3006B24} = {C95AF531-CF44-44AA-AC90-F4DF9F941674} {5ECE2E7A-9AE8-49BF-902D-41A7756C3E78} = {C95AF531-CF44-44AA-AC90-F4DF9F941674} + {CDD123E6-2622-4368-BAEE-8B95F05F1AB2} = {3E34ADB9-1F52-4C96-9A42-DE782DE1AAA3} + {DBF84F66-1436-4599-93AB-7C16A3A2C3A4} = {C95AF531-CF44-44AA-AC90-F4DF9F941674} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F08ED64E-2517-4B51-A4BE-D33D56CC7B39} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/Internal/FlurlHttpRequestOptionsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/Internal/FlurlHttpRequestOptionsExtensions.cs new file mode 100644 index 00000000..86fc8737 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/Internal/FlurlHttpRequestOptionsExtensions.cs @@ -0,0 +1,21 @@ +using System; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + internal static class FlurlHttpRequestOptionsExtensions + { + public static IFlurlRequest SetOptions(this IFlurlRequest request, WechatWorkRequest options) + { + if (request == null) throw new ArgumentNullException(nameof(request)); + if (options == null) throw new ArgumentNullException(nameof(options)); + + if (options.Timeout.HasValue) + { + request.WithTimeout(TimeSpan.FromMilliseconds(options.Timeout.Value)); + } + + return request; + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinAgentExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinAgentExtensions.cs new file mode 100644 index 00000000..8b426e21 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinAgentExtensions.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinAgentExtensions + { + /// + /// 异步调用 [GET] /cgi-bin/agent/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90227 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentGetAsync(this WechatWorkClient client, Models.CgibinAgentGetRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Get, "cgi-bin", "agent", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("agentid", request.AgentId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/agent/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90227 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentListAsync(this WechatWorkClient client, Models.CgibinAgentListRequest 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(HttpMethod.Get, "cgi-bin", "agent", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/agent/set 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90228 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentSetAsync(this WechatWorkClient client, Models.CgibinAgentSetRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "agent", "set") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + #region Workbench + /// + /// 异步调用 [POST] /cgi-bin/agent/set_workbench_template 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92535 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentSetWorkbenchTemplateAsync(this WechatWorkClient client, Models.CgibinAgentSetWorkbenchTemplateRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "agent", "set_workbench_template") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/agent/get_workbench_template 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92535 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentGetWorkbenchTemplateAsync(this WechatWorkClient client, Models.CgibinAgentGetWorkbenchTemplateRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "agent", "get_workbench_template") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/agent/set_workbench_data 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92535 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinAgentSetWorkbenchDataAsync(this WechatWorkClient client, Models.CgibinAgentSetWorkbenchDataRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "agent", "set_workbench_data") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinBatchExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinBatchExtensions.cs new file mode 100644 index 00000000..18d41d4b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinBatchExtensions.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinBatchExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/batch/invite 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90975 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinBatchInviteAsync(this WechatWorkClient client, Models.CgibinBatchInviteRequest 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(HttpMethod.Post, "cgi-bin", "batch", "invite") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/batch/syncuser 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90980 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinBatchSyncUserAsync(this WechatWorkClient client, Models.CgibinBatchSyncUserRequest 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(HttpMethod.Post, "cgi-bin", "batch", "syncuser") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/batch/replaceuser 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90981 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinBatchReplaceUserAsync(this WechatWorkClient client, Models.CgibinBatchReplaceUserRequest 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(HttpMethod.Post, "cgi-bin", "batch", "replaceuser") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/batch/replaceparty 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90981 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinBatchReplaceDepartmentAsync(this WechatWorkClient client, Models.CgibinBatchReplaceDepartmentRequest 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(HttpMethod.Post, "cgi-bin", "batch", "replaceparty") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/batch/getresult 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90983 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinBatchGetResultAsync(this WechatWorkClient client, Models.CgibinBatchGetResultRequest 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(HttpMethod.Get, "cgi-bin", "batch", "getresult") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("jobid", request.JobId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpExtensions.cs new file mode 100644 index 00000000..ba343e44 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpExtensions.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinCorpExtensions + { + /// + /// 异步调用 [GET] /cgi-bin/corp/get_join_qrcode 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/91039 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinCorpGetJoinQrcodeAsync(this WechatWorkClient client, Models.CgibinCorpGetJoinQrcodeRequest 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(HttpMethod.Get, "cgi-bin", "corp", "get_join_qrcode") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + if (request.SizeType.HasValue) + flurlReq.SetQueryParam("size_type", request.SizeType.Value); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpGroupExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpGroupExtensions.cs new file mode 100644 index 00000000..9c679574 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCorpGroupExtensions.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinCorpGroupExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/corpgroup/corp/list_app_share_info 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93403 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinCorpGroupCropListAppShareInfoAsync(this WechatWorkClient client, Models.CgibinCorpGroupCropListAppShareInfoRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "corpgroup", "corp", "list_app_share_info") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/corpgroup/corp/gettoken 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93359 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinCorpGroupCropGetTokenAsync(this WechatWorkClient client, Models.CgibinCorpGroupCropGetTokenRequest 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(HttpMethod.Post, "cgi-bin", "corpgroup", "corp", "gettoken") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinDepartmentExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinDepartmentExtensions.cs new file mode 100644 index 00000000..b5ba6384 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinDepartmentExtensions.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinDepartmentExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/department/create 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90205 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinDepartmentCreateAsync(this WechatWorkClient client, Models.CgibinDepartmentCreateRequest 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(HttpMethod.Post, "cgi-bin", "department", "create") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/department/update 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90206 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinDepartmentUpdateAsync(this WechatWorkClient client, Models.CgibinDepartmentUpdateRequest 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(HttpMethod.Post, "cgi-bin", "department", "update") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/department/delete 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90206 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinDepartmentDeleteAsync(this WechatWorkClient client, Models.CgibinDepartmentDeleteRequest 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(HttpMethod.Get, "cgi-bin", "department", "delete") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("id", request.DepartmentId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/department/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90208 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinDepartmentListAsync(this WechatWorkClient client, Models.CgibinDepartmentListRequest 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(HttpMethod.Get, "cgi-bin", "department", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + if (request.ParentDepartmentId.HasValue) + flurlReq.SetQueryParam("id", request.ParentDepartmentId.Value); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExtensions.cs new file mode 100644 index 00000000..f3148511 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExtensions.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinExtensions + { + /// + /// 异步调用 [GET] /cgi-bin/gettoken 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/91039 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinGetTokenAsync(this WechatWorkClient client, Models.CgibinGetTokenRequest 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(HttpMethod.Get, "cgi-bin", "token") + .SetOptions(request) + .SetQueryParam("corpid", client.CorpId) + .SetQueryParam("corpsecret", client.AgentSecret); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/get_api_domain_ip 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92520 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinGetApiDomainIpAsync(this WechatWorkClient client, Models.CgibinGetApiDomainIpRequest 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(HttpMethod.Get, "cgi-bin", "get_api_domain_ip") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs new file mode 100644 index 00000000..edbdaa61 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinExternalContactExtensions.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinExternalContactExtensions + { + /// + /// 异步调用 [GET] /cgi-bin/externalcontact/get_follow_user_list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92571 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetFollowUserListAsync(this WechatWorkClient client, Models.CgibinExternalContactGetFollowUserListRequest 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(HttpMethod.Get, "cgi-bin", "externalcontact", "get_follow_user_list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/close_temp_chat 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92572 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactCloseTempChatAsync(this WechatWorkClient client, Models.CgibinExternalContactCloseTempChatRequest 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(HttpMethod.Post, "cgi-bin", "externalcontact", "close_temp_chat") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + #region ContactWay + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/add_contact_way 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92572 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactAddContactWayAsync(this WechatWorkClient client, Models.CgibinExternalContactAddContactWayRequest 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(HttpMethod.Post, "cgi-bin", "externalcontact", "add_contact_way") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/get_contact_way 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92572 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactGetContactWayAsync(this WechatWorkClient client, Models.CgibinExternalContactGetContactWayRequest 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(HttpMethod.Post, "cgi-bin", "externalcontact", "get_contact_way") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/update_contact_way 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92572 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactUpdateContactWayAsync(this WechatWorkClient client, Models.CgibinExternalContactUpdateContactWayRequest 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(HttpMethod.Post, "cgi-bin", "externalcontact", "update_contact_way") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/externalcontact/del_contact_way 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92572 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinExternalContactDeleteContactWayAsync(this WechatWorkClient client, Models.CgibinExternalContactDeleteContactWayRequest 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(HttpMethod.Post, "cgi-bin", "externalcontact", "del_contact_way") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinLinkedCorpExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinLinkedCorpExtensions.cs new file mode 100644 index 00000000..6dead049 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinLinkedCorpExtensions.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinLinkedCorpExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/linkedcorp/agent/get_perm_list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93172 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinLinkedCorpAgentGetPermissionListAsync(this WechatWorkClient client, Models.CgibinLinkedCorpAgentGetPermissionListRequest 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(HttpMethod.Post, "cgi-bin", "linkedcorp", "agent", "get_perm_list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/linkedcorp/user/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93171 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinLinkedCorpUserGetAsync(this WechatWorkClient client, Models.CgibinLinkedCorpUserGetRequest 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(HttpMethod.Post, "cgi-bin", "linkedcorp", "user", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/linkedcorp/user/simplelist 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93168 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinLinkedCorpUserSimpleListAsync(this WechatWorkClient client, Models.CgibinLinkedCorpUserSimpleListRequest 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(HttpMethod.Post, "cgi-bin", "linkedcorp", "user", "simplelist") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/linkedcorp/user/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93169 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinLinkedCorpUserListAsync(this WechatWorkClient client, Models.CgibinLinkedCorpUserListRequest 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(HttpMethod.Post, "cgi-bin", "linkedcorp", "user", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/linkedcorp/department/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93170 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinLinkedCorpDepartmentListAsync(this WechatWorkClient client, Models.CgibinLinkedCorpDepartmentListRequest 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(HttpMethod.Post, "cgi-bin", "linkedcorp", "department", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMediaExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMediaExtensions.cs new file mode 100644 index 00000000..31504c53 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMediaExtensions.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinMediaExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/media/upload 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90253 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMediaUploadAsync(this WechatWorkClient client, Models.CgibinMediaUploadRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (string.IsNullOrEmpty(request.FileName)) + { + string ext = ""; + if ("image".Equals(request.Type)) + ext = ".png"; + else if ("voice".Equals(request.Type)) + ext = ".mp3"; + else if ("video".Equals(request.Type)) + ext = ".mp4"; + + request.FileName = Guid.NewGuid().ToString("N").ToLower() + ext; + } + + if (string.IsNullOrEmpty(request.FileContentType)) + { + if (request.FileName!.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/jpeg"; + else if (request.FileName!.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/jpeg"; + else if (request.FileName!.EndsWith(".png", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/png"; + else if (request.FileName!.EndsWith(".gif", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/gif"; + else if (request.FileName!.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "audio/mpeg"; + else if (request.FileName!.EndsWith(".amr", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "audio/amr"; + else if (request.FileName!.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "video/mp4"; + else + request.FileContentType = "application/octet-stream"; + } + + string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x"); + using var fileContent = new ByteArrayContent(request.FileBytes ?? new byte[0]); + using var httpContent = new MultipartFormDataContent(boundary); + httpContent.Add(fileContent, "\"media\"", "\"" + request.FileName + "\""); + httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); + fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType); + fileContent.Headers.ContentLength = request.FileBytes?.Length; + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "media", "upload") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("type", request.Type); + + return await client.SendRequestAsync(flurlReq, content: httpContent, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/media/uploadimg 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90256 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMediaUploadImageAsync(this WechatWorkClient client, Models.CgibinMediaUploadImageRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (string.IsNullOrEmpty(request.FileName)) + request.FileName = Guid.NewGuid().ToString("N").ToLower() + ".png"; + + if (string.IsNullOrEmpty(request.FileContentType)) + { + if (request.FileName!.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/jpeg"; + else if (request.FileName!.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase)) + request.FileContentType = "image/jpeg"; + else + request.FileContentType = "image/png"; + } + + string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x"); + using var fileContent = new ByteArrayContent(request.FileBytes ?? new byte[0]); + using var httpContent = new MultipartFormDataContent(boundary); + httpContent.Add(fileContent, "\"media\"", "\"" + request.FileName + "\""); + httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); + fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType); + fileContent.Headers.ContentLength = request.FileBytes?.Length; + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "media", "uploadimg") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestAsync(flurlReq, content: httpContent, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/media/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90254 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMediaGetAsync(this WechatWorkClient client, Models.CgibinMediaGetRequest 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(HttpMethod.Get, "cgi-bin", "media", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("media_id", request.MediaId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/media/get/jssdk 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90255 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMediaGetJssdkAsync(this WechatWorkClient client, Models.CgibinMediaGetJssdkRequest 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(HttpMethod.Get, "cgi-bin", "media", "get", "jssdk") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("media_id", request.MediaId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMenuExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMenuExtensions.cs new file mode 100644 index 00000000..69bb6b41 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMenuExtensions.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinMenuExtensions + { + /// + /// 异步调用 [GET] /cgi-bin/menu/create 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90231 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMenuCreateAsync(this WechatWorkClient client, Models.CgibinMenuCreateRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Post, "cgi-bin", "menu", "create") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("agentid", request.AgentId); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/menu/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90232 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMenuGetAsync(this WechatWorkClient client, Models.CgibinMenuGetRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Get, "cgi-bin", "menu", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("agentid", request.AgentId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/menu/delete 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90233 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMenuDeleteAsync(this WechatWorkClient client, Models.CgibinMenuDeleteRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (!request.AgentId.HasValue) + request.AgentId = client.AgentId; + + IFlurlRequest flurlReq = client + .CreateRequest(HttpMethod.Get, "cgi-bin", "menu", "delete") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("agentid", request.AgentId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMiniProgramExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMiniProgramExtensions.cs new file mode 100644 index 00000000..692f284f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinMiniProgramExtensions.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinMiniProgramExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/miniprogram/transfer_session 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/93403 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinMiniProgramTransferSessionAsync(this WechatWorkClient client, Models.CgibinMiniProgramTransferSessionRequest 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(HttpMethod.Post, "cgi-bin", "miniprogram", "transfer_session") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinTagExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinTagExtensions.cs new file mode 100644 index 00000000..3c0a5b90 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinTagExtensions.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinTagExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/tag/create 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90210 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagCreateAsync(this WechatWorkClient client, Models.CgibinTagCreateRequest 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(HttpMethod.Post, "cgi-bin", "tag", "create") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/tag/update 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90211 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagUpdateAsync(this WechatWorkClient client, Models.CgibinTagUpdateRequest 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(HttpMethod.Post, "cgi-bin", "tag", "update") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/tag/delete 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90212 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagDeleteAsync(this WechatWorkClient client, Models.CgibinTagDeleteRequest 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(HttpMethod.Get, "cgi-bin", "tag", "delete") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("tagid", request.TagId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/tag/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90216 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagListAsync(this WechatWorkClient client, Models.CgibinTagListRequest 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(HttpMethod.Get, "cgi-bin", "tag", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/tag/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90213 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagGetAsync(this WechatWorkClient client, Models.CgibinTagGetRequest 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(HttpMethod.Get, "cgi-bin", "tag", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("tagid", request.TagId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + #region TagUser + /// + /// 异步调用 [POST] /cgi-bin/tag/addtagusers 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90214 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagAddTagUsersAsync(this WechatWorkClient client, Models.CgibinTagAddTagUsersRequest 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(HttpMethod.Post, "cgi-bin", "tag", "addtagusers") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/tag/deltagusers 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90215 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinTagDeleteTagUsersAsync(this WechatWorkClient client, Models.CgibinTagDeleteTagUsersRequest 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(HttpMethod.Post, "cgi-bin", "tag", "deltagusers") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinUserExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinUserExtensions.cs new file mode 100644 index 00000000..884d2b4b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinUserExtensions.cs @@ -0,0 +1,279 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.Work +{ + public static class WechatWorkClientExecuteCgibinUserExtensions + { + /// + /// 异步调用 [POST] /cgi-bin/user/create 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90195 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserCreateAsync(this WechatWorkClient client, Models.CgibinUserCreateRequest 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(HttpMethod.Post, "cgi-bin", "user", "create") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/get 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90196 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserGetAsync(this WechatWorkClient client, Models.CgibinUserGetRequest 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(HttpMethod.Get, "cgi-bin", "user", "get") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("userid", request.UserId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/user/update 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90197 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserUpdateAsync(this WechatWorkClient client, Models.CgibinUserUpdateRequest 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(HttpMethod.Post, "cgi-bin", "user", "update") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/delete 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90198 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserDeleteAsync(this WechatWorkClient client, Models.CgibinUserDeleteRequest 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(HttpMethod.Get, "cgi-bin", "user", "delete") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("userid", request.UserId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/user/batchdelete 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90199 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserBatchDeleteAsync(this WechatWorkClient client, Models.CgibinUserBatchDeleteRequest 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(HttpMethod.Post, "cgi-bin", "user", "batchdelete") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/simplelist 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90200 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserSimpleListAsync(this WechatWorkClient client, Models.CgibinUserSimpleListRequest 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(HttpMethod.Get, "cgi-bin", "user", "simplelist") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("department_id", request.DepartmentId); + + if (request.RequireFetchChild.HasValue) + flurlReq.SetQueryParam("fetch_child", request.RequireFetchChild.Value ? 1 : 0); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/list 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90201 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserListAsync(this WechatWorkClient client, Models.CgibinUserListRequest 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(HttpMethod.Get, "cgi-bin", "user", "list") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("department_id", request.DepartmentId); + + if (request.RequireFetchChild.HasValue) + flurlReq.SetQueryParam("fetch_child", request.RequireFetchChild.Value ? 1 : 0); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/user/convert_to_openid 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90202 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserConvertToOpenIdAsync(this WechatWorkClient client, Models.CgibinUserConvertToOpenIdRequest 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(HttpMethod.Post, "cgi-bin", "user", "convert_to_openid") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/user/convert_to_userid 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90202 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserConvertToUserIdAsync(this WechatWorkClient client, Models.CgibinUserConvertToUserIdRequest 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(HttpMethod.Post, "cgi-bin", "user", "convert_to_userid") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/authsucc 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90203 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserAuthSuccessAsync(this WechatWorkClient client, Models.CgibinUserAuthSuccessRequest 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(HttpMethod.Get, "cgi-bin", "user", "authsucc") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("userid", request.UserId); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /cgi-bin/user/getuserinfo 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/91023 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/91437 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserGetUserInfoAsync(this WechatWorkClient client, Models.CgibinUserGetUserInfoRequest 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(HttpMethod.Get, "cgi-bin", "user", "getuserinfo") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken) + .SetQueryParam("code", request.Code); + + return await client.SendRequestAsync(flurlReq, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/user/get_active_stat 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92714 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinUserGetActiveStatAsync(this WechatWorkClient client, Models.CgibinUserGetActiveStatRequest 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(HttpMethod.Post, "cgi-bin", "user", "get_active_stat") + .SetOptions(request) + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpRequest.cs new file mode 100644 index 00000000..937bf31b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/get_api_domain_ip 接口的请求。 + /// + public class CgibinGetApiDomainIpRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpResponse.cs new file mode 100644 index 00000000..26e9ed99 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetApiDomainIpResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/get_api_domain_ip 接口的响应。 + /// + public class CgibinGetApiDomainIpResponse : WechatWorkResponse + { + /// + /// 获取或设置企业微信服务器 IP 地址列表。 + /// + [Newtonsoft.Json.JsonProperty("ip_list")] + [System.Text.Json.Serialization.JsonPropertyName("ip_list")] + public string[] IPList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenRequest.cs new file mode 100644 index 00000000..7fe2fdb6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/gettoken 接口的请求。 + /// + public class CgibinGetTokenRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenResponse.cs new file mode 100644 index 00000000..93d990bd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/Cgibin/CgibinGetTokenResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/gettoken 接口的响应。 + /// + public class CgibinGetTokenResponse : WechatWorkResponse + { + /// + /// 获取或设置凭证。 + /// + [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/Models/CgibinAgent/CgibinAgentGetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentGetRequest.cs new file mode 100644 index 00000000..f386ae3a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentGetRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/agent/get 接口的请求。 + /// + public class CgibinAgentGetRequest : WechatWorkRequest + { + /// + /// 获取或设置应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public int? AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentGetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentGetResponse.cs new file mode 100644 index 00000000..b9be4ea8 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentGetResponse.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/agent/get 接口的响应。 + /// + public class CgibinAgentGetResponse : WechatWorkResponse + { + public static class Types + { + public class AllowedUser + { + public static class Types + { + public class User + { + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = default!; + } + } + + /// + /// 获取或设置成员列表。 + /// + [Newtonsoft.Json.JsonProperty("user")] + [System.Text.Json.Serialization.JsonPropertyName("user")] + public Types.User[] UserList { get; set; } = default!; + } + + public class AllowedDepartment + { + /// + /// 获取或设置部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("partyid")] + [System.Text.Json.Serialization.JsonPropertyName("partyid")] + public int[] DepartmentIdList { get; set; } = default!; + } + + public class AllowedTag + { + /// + /// 获取或设置标签 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("tagid")] + [System.Text.Json.Serialization.JsonPropertyName("tagid")] + public int[] TagIdList { get; set; } = default!; + } + } + + /// + /// 获取或设置应用 ID。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int AgentId { get; set; } + + /// + /// 获取或设置应用名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; + + /// + /// 获取或设置应用方形头像 URL。 + /// + [Newtonsoft.Json.JsonProperty("square_logo_url")] + [System.Text.Json.Serialization.JsonPropertyName("square_logo_url")] + public string SquareLogoUrl { get; set; } = default!; + + /// + /// 获取或设置应用详情。 + /// + [Newtonsoft.Json.JsonProperty("description")] + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } = default!; + + /// + /// 获取或设置可见人员范围信息。 + /// + [Newtonsoft.Json.JsonProperty("allow_userinfos")] + [System.Text.Json.Serialization.JsonPropertyName("allow_userinfos")] + public Types.AllowedUser AllowedUser { get; set; } = default!; + + /// + /// 获取或设置可见部门范围信息。 + /// + [Newtonsoft.Json.JsonProperty("allow_partys")] + [System.Text.Json.Serialization.JsonPropertyName("allow_partys")] + public Types.AllowedDepartment AllowedDepartment { get; set; } = default!; + + /// + /// 获取或设置可见标签范围信息。 + /// + [Newtonsoft.Json.JsonProperty("allow_tags")] + [System.Text.Json.Serialization.JsonPropertyName("allow_tags")] + public Types.AllowedTag AllowedTag { get; set; } = default!; + + /// + /// 获取或设置是否被停用。 + /// + [Newtonsoft.Json.JsonProperty("close")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("close")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedBooleanConverter))] + public bool IsClosed { get; set; } + + /// + /// 获取或设置是否上报用户地理位置。 + /// + [Newtonsoft.Json.JsonProperty("report_location_flag")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("report_location_flag")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedBooleanConverter))] + public bool IsReportLocation { get; set; } + + /// + /// 获取或设置是否上报用户进入事件。 + /// + [Newtonsoft.Json.JsonProperty("isreportenter")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("isreportenter")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedBooleanConverter))] + public bool IsReportEnter { get; set; } + + /// + /// 获取或设置可信域名。 + /// + [Newtonsoft.Json.JsonProperty("redirect_domain")] + [System.Text.Json.Serialization.JsonPropertyName("redirect_domain")] + public string? RedirectDomain { get; set; } + + /// + /// 获取或设置应用主页。 + /// + [Newtonsoft.Json.JsonProperty("home_url")] + [System.Text.Json.Serialization.JsonPropertyName("home_url")] + public string? HomeUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListRequest.cs new file mode 100644 index 00000000..c8ac872b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/agent/list 接口的请求。 + /// + public class CgibinAgentListRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListResponse.cs new file mode 100644 index 00000000..0a7251b6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentListResponse.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/agent/list 接口的响应。 + /// + public class CgibinAgentListResponse : WechatWorkResponse + { + public static class Types + { + public class Agent + { + /// + /// 获取或设置应用 ID。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int AgentId { get; set; } + + /// + /// 获取或设置应用名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; + + /// + /// 获取或设置应用方形头像 URL。 + /// + [Newtonsoft.Json.JsonProperty("square_logo_url")] + [System.Text.Json.Serialization.JsonPropertyName("square_logo_url")] + public string SquareLogoUrl { get; set; } = default!; + } + } + + /// + /// 获取或设置应用列表。 + /// + [Newtonsoft.Json.JsonProperty("agentlist")] + [System.Text.Json.Serialization.JsonPropertyName("agentlist")] + public Types.Agent[] AgentList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetRequest.cs new file mode 100644 index 00000000..235509e4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetRequest.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set 接口的请求。 + /// + public class CgibinAgentSetRequest : WechatWorkRequest + { + /// + /// 获取或设置应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int? AgentId { get; set; } + + /// + /// 获取或设置应用名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置头像 LogoMediaId。 + /// + [Newtonsoft.Json.JsonProperty("logo_mediaid")] + [System.Text.Json.Serialization.JsonPropertyName("logo_mediaid")] + public string? LogoMediaId { get; set; } + + /// + /// 获取或设置应用详情。 + /// + [Newtonsoft.Json.JsonProperty("description")] + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// 获取或设置是否上报用户地理位置。 + /// + [Newtonsoft.Json.JsonProperty("report_location_flag")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("report_location_flag")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedNullableBooleanConverter))] + public bool? IsReportLocation { get; set; } + + /// + /// 获取或设置是否上报用户进入事件。 + /// + [Newtonsoft.Json.JsonProperty("isreportenter")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("isreportenter")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedNullableBooleanConverter))] + public bool? IsReportEnter { get; set; } + + /// + /// 获取或设置可信域名。 + /// + [Newtonsoft.Json.JsonProperty("redirect_domain")] + [System.Text.Json.Serialization.JsonPropertyName("redirect_domain")] + public string? RedirectDomain { get; set; } + + /// + /// 获取或设置应用主页。 + /// + [Newtonsoft.Json.JsonProperty("home_url")] + [System.Text.Json.Serialization.JsonPropertyName("home_url")] + public string? HomeUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetResponse.cs new file mode 100644 index 00000000..212daee9 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/CgibinAgentSetResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set 接口的响应。 + /// + public class CgibinAgentSetResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateRequest.cs new file mode 100644 index 00000000..fbe5bd4b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/get_workbench_template 接口的请求。 + /// + public class CgibinAgentGetWorkbenchTemplateRequest : WechatWorkRequest + { + /// + /// 获取或设置应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int? AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateResponse.cs new file mode 100644 index 00000000..eb8566d0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentGetWorkbenchTemplateResponse.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/get_workbench_template 接口的响应。 + /// + public class CgibinAgentGetWorkbenchTemplateResponse : WechatWorkResponse + { + public static class Types + { + public class KeyDataTemplate + { + public static class Types + { + public class KeyDataItem + { + /// + /// 获取或设置关键数据名称。 + /// + [Newtonsoft.Json.JsonProperty("key")] + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// 获取或设置关键数据。 + /// + [Newtonsoft.Json.JsonProperty("data")] + [System.Text.Json.Serialization.JsonPropertyName("data")] + public string Data { get; set; } = default!; + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + } + + /// + /// 获取或设置关键数据项。 + /// + [Newtonsoft.Json.JsonProperty("items")] + [System.Text.Json.Serialization.JsonPropertyName("items")] + public Types.KeyDataItem[] Items { get; set; } = default!; + } + + public class ImageTemplate + { + /// + /// 获取或设置图片 Url。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + + public class WebviewTemplate + { + /// + /// 获取或设置渲染展示 Url。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + + public class ListTemplate + { + public static class Types + { + public class ListItem + { + /// + /// 获取或设置列表显示文字。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string Title { get; set; } = default!; + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + } + + /// + /// 获取或设置列表项。 + /// + [Newtonsoft.Json.JsonProperty("items")] + [System.Text.Json.Serialization.JsonPropertyName("items")] + public Types.ListItem[] Items { get; set; } = default!; + } + } + + /// + /// 获取或设置模版类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; + + /// + /// 获取或设置关键数据型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("keydata")] + [System.Text.Json.Serialization.JsonPropertyName("keydata")] + public Types.KeyDataTemplate? KeyDataTemplate { get; set; } + + /// + /// 获取或设置图片型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("image")] + [System.Text.Json.Serialization.JsonPropertyName("image")] + public Types.ImageTemplate? ImageTemplate { get; set; } + + /// + /// 获取或设置列表型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("list")] + [System.Text.Json.Serialization.JsonPropertyName("list")] + public Types.ListTemplate? ListTemplate { get; set; } + + /// + /// 获取或设置网页型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("webview")] + [System.Text.Json.Serialization.JsonPropertyName("webview")] + public Types.WebviewTemplate? WebviewTemplate { get; set; } + + /// + /// 获取或设置是否覆盖用户工作台的数据。 + /// + [Newtonsoft.Json.JsonProperty("replace_user_data")] + [System.Text.Json.Serialization.JsonPropertyName("replace_user_data")] + public bool IsReplaceUserData { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataRequest.cs new file mode 100644 index 00000000..47152588 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataRequest.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set_workbench_data 接口的请求。 + /// + public class CgibinAgentSetWorkbenchDataRequest : WechatWorkRequest + { + public static class Types + { + public class KeyDataTemplate : CgibinAgentSetWorkbenchTemplateRequest.Types.KeyDataTemplate + { + } + + public class ImageTemplate : CgibinAgentSetWorkbenchTemplateRequest.Types.ImageTemplate + { + } + + public class WebviewTemplate : CgibinAgentSetWorkbenchTemplateRequest.Types.WebviewTemplate + { + } + + public class ListTemplate : CgibinAgentSetWorkbenchTemplateRequest.Types.ListTemplate + { + } + } + + /// + /// 获取或设置应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int? AgentId { get; set; } + + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = string.Empty; + + /// + /// 获取或设置模版类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + + /// + /// 获取或设置关键数据型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("keydata")] + [System.Text.Json.Serialization.JsonPropertyName("keydata")] + public Types.KeyDataTemplate? KeyDataTemplate { get; set; } + + /// + /// 获取或设置图片型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("image")] + [System.Text.Json.Serialization.JsonPropertyName("image")] + public Types.ImageTemplate? ImageTemplate { get; set; } + + /// + /// 获取或设置列表型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("list")] + [System.Text.Json.Serialization.JsonPropertyName("list")] + public Types.ListTemplate? ListTemplate { get; set; } + + /// + /// 获取或设置网页型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("webview")] + [System.Text.Json.Serialization.JsonPropertyName("webview")] + public Types.WebviewTemplate? WebviewTemplate { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataResponse.cs new file mode 100644 index 00000000..dd06fce9 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchDataResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set_workbench_data 接口的响应。 + /// + public class CgibinAgentSetWorkbenchDataResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateRequest.cs new file mode 100644 index 00000000..ab94d00a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateRequest.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set_workbench_template 接口的请求。 + /// + public class CgibinAgentSetWorkbenchTemplateRequest : WechatWorkRequest + { + public static class Types + { + public class KeyDataTemplate + { + public static class Types + { + public class KeyDataItem + { + /// + /// 获取或设置关键数据名称。 + /// + [Newtonsoft.Json.JsonProperty("key")] + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// 获取或设置关键数据。 + /// + [Newtonsoft.Json.JsonProperty("data")] + [System.Text.Json.Serialization.JsonPropertyName("data")] + public string Data { get; set; } = string.Empty; + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + } + + /// + /// 获取或设置关键数据项。 + /// + [Newtonsoft.Json.JsonProperty("items")] + [System.Text.Json.Serialization.JsonPropertyName("items")] + public IList Items { get; set; } = new List(); + } + + public class ImageTemplate + { + /// + /// 获取或设置图片 Url。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + + public class WebviewTemplate + { + /// + /// 获取或设置渲染展示 Url。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + + public class ListTemplate + { + public static class Types + { + public class ListItem + { + /// + /// 获取或设置列表显示文字。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string Title { get; set; } = string.Empty; + + /// + /// 获取或设置点击跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("jump_url")] + [System.Text.Json.Serialization.JsonPropertyName("jump_url")] + public string? JumpUrl { get; set; } + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + } + } + + /// + /// 获取或设置列表项。 + /// + [Newtonsoft.Json.JsonProperty("items")] + [System.Text.Json.Serialization.JsonPropertyName("items")] + public IList Items { get; set; } = new List(); + } + } + + /// + /// 获取或设置应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int? AgentId { get; set; } + + /// + /// 获取或设置模版类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + + /// + /// 获取或设置关键数据型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("keydata")] + [System.Text.Json.Serialization.JsonPropertyName("keydata")] + public Types.KeyDataTemplate? KeyDataTemplate { get; set; } + + /// + /// 获取或设置图片型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("image")] + [System.Text.Json.Serialization.JsonPropertyName("image")] + public Types.ImageTemplate? ImageTemplate { get; set; } + + /// + /// 获取或设置列表型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("list")] + [System.Text.Json.Serialization.JsonPropertyName("list")] + public Types.ListTemplate? ListTemplate { get; set; } + + /// + /// 获取或设置网页型模版数据。 + /// + [Newtonsoft.Json.JsonProperty("webview")] + [System.Text.Json.Serialization.JsonPropertyName("webview")] + public Types.WebviewTemplate? WebviewTemplate { get; set; } + + /// + /// 获取或设置是否覆盖用户工作台的数据。 + /// + [Newtonsoft.Json.JsonProperty("replace_user_data")] + [System.Text.Json.Serialization.JsonPropertyName("replace_user_data")] + public bool? IsReplaceUserData { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateResponse.cs new file mode 100644 index 00000000..d9f512f7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinAgent/Workbench/CgibinAgentSetWorkbenchTemplateResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/agent/set_workbench_template 接口的响应。 + /// + public class CgibinAgentSetWorkbenchTemplateResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultRequest.cs new file mode 100644 index 00000000..6acb503b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/batch/getresult 接口的请求。 + /// + public class CgibinBatchGetResultRequest : WechatWorkRequest + { + /// + /// 获取或设置异步任务 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string JobId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultResponse.cs new file mode 100644 index 00000000..88133338 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchGetResultResponse.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/batch/getresult 接口的响应。 + /// + public class CgibinBatchGetResultResponse : WechatWorkResponse + { + public static class Types + { + public class Result + { + /// + /// 获取或设置错误码。 + /// + [Newtonsoft.Json.JsonProperty("errcode")] + [System.Text.Json.Serialization.JsonPropertyName("errcode")] + public int ErrorCode { get; set; } + + /// + /// 获取或设置错误信息。 + /// + [Newtonsoft.Json.JsonProperty("errmsg")] + [System.Text.Json.Serialization.JsonPropertyName("errmsg")] + public string? ErrorMessage { get; set; } + + /// + /// 获取或设置操作类型。 + /// + [Newtonsoft.Json.JsonProperty("action")] + [System.Text.Json.Serialization.JsonPropertyName("action")] + public int? Action { get; set; } + + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string? UserId { get; set; } + + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("partyid")] + [System.Text.Json.Serialization.JsonPropertyName("partyid")] + public int? DepartmentId { get; set; } + } + } + + /// + /// 获取或设置任务类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; + + /// + /// 获取或设置任务状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public int Status { get; set; } + + /// + /// 获取或设置任务运行总条数。 + /// + [Newtonsoft.Json.JsonProperty("total")] + [System.Text.Json.Serialization.JsonPropertyName("total")] + public int TotalCount { get; set; } + + /// + /// 获取或设置目前运行百分比。 + /// + [Newtonsoft.Json.JsonProperty("percentage")] + [System.Text.Json.Serialization.JsonPropertyName("percentage")] + public int Percentage { get; set; } + + /// + /// 获取或设置处理结果列表。 + /// + [Newtonsoft.Json.JsonProperty("result")] + [System.Text.Json.Serialization.JsonPropertyName("result")] + public Types.Result[] ResultList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteRequest.cs new file mode 100644 index 00000000..5e6140af --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteRequest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/invite 接口的请求。 + /// + public class CgibinBatchInviteRequest : WechatWorkRequest + { + /// + /// 获取或设置成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("user")] + [System.Text.Json.Serialization.JsonPropertyName("user")] + public IList? UserIdList { get; set; } + + /// + /// 获取或设置部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("party")] + [System.Text.Json.Serialization.JsonPropertyName("party")] + public IList? DepartmentIdList { get; set; } + + /// + /// 获取或设置标签 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("tag")] + [System.Text.Json.Serialization.JsonPropertyName("tag")] + public IList? TagIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteResponse.cs new file mode 100644 index 00000000..7147c9f0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchInviteResponse.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/invite 接口的响应。 + /// + public class CgibinBatchInviteResponse : WechatWorkResponse + { + /// + /// 获取或设置非法成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("invaliduser")] + [System.Text.Json.Serialization.JsonPropertyName("invaliduser")] + public string[]? InvalidUserIdList { get; set; } + + /// + /// 获取或设置非法部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("invalidparty")] + [System.Text.Json.Serialization.JsonPropertyName("invalidparty")] + public int[]? InvalidDepartmentIdList { get; set; } + + /// + /// 获取或设置非法标签 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("invalidtag")] + [System.Text.Json.Serialization.JsonPropertyName("invalidtag")] + public int[]? InvalidTagIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentRequest.cs new file mode 100644 index 00000000..de9f8624 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentRequest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/replaceparty 接口的请求。 + /// + public class CgibinBatchReplaceDepartmentRequest : WechatWorkRequest + { + public static class Types + { + public class Callback : CgibinBatchSyncUserRequest.Types.Callback + { + } + } + + /// + /// 获取或设置 CSV 文件 MediaId。 + /// + [Newtonsoft.Json.JsonProperty("media_id")] + [System.Text.Json.Serialization.JsonPropertyName("media_id")] + public string MediaId { get; set; } = string.Empty; + + /// + /// 获取或设置回调信息。 + /// + [Newtonsoft.Json.JsonProperty("callback")] + [System.Text.Json.Serialization.JsonPropertyName("callback")] + public Types.Callback? Callback { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentResponse.cs new file mode 100644 index 00000000..b7bd74b2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceDepartmentResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/replaceparty 接口的响应。 + /// + public class CgibinBatchReplaceDepartmentResponse : WechatWorkResponse + { + /// + /// 获取或设置异步任务 ID。 + /// + [Newtonsoft.Json.JsonProperty("jobid")] + [System.Text.Json.Serialization.JsonPropertyName("jobid")] + public string JobId { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserRequest.cs new file mode 100644 index 00000000..90d55461 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/replaceuser 接口的请求。 + /// + public class CgibinBatchReplaceUserRequest : CgibinBatchSyncUserRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserResponse.cs new file mode 100644 index 00000000..1c352f82 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchReplaceUserResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/replaceuser 接口的响应。 + /// + public class CgibinBatchReplaceUserResponse : CgibinBatchSyncUserResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserRequest.cs new file mode 100644 index 00000000..4a3559a4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserRequest.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/syncuser 接口的请求。 + /// + public class CgibinBatchSyncUserRequest : WechatWorkRequest + { + public static class Types + { + public class Callback + { + /// + /// 获取或设置回调通知地址。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string NotifyUrl { get; set; } = string.Empty; + + /// + /// 获取或设置用于生成签名的 Token。 + /// + [Newtonsoft.Json.JsonProperty("token")] + [System.Text.Json.Serialization.JsonPropertyName("token")] + public string Token { get; set; } = string.Empty; + + /// + /// 获取或设置经过 Base64 编码的 AES 密钥。 + /// + [Newtonsoft.Json.JsonProperty("encodingaeskey")] + [System.Text.Json.Serialization.JsonPropertyName("encodingaeskey")] + public string EncodingAesKey { get; set; } = string.Empty; + } + } + + /// + /// 获取或设置 CSV 文件 MediaId。 + /// + [Newtonsoft.Json.JsonProperty("media_id")] + [System.Text.Json.Serialization.JsonPropertyName("media_id")] + public string MediaId { get; set; } = string.Empty; + + /// + /// 获取或设置是否邀请成员。 + /// + [Newtonsoft.Json.JsonProperty("to_invite")] + [System.Text.Json.Serialization.JsonPropertyName("to_invite")] + public bool? RequireInvite { get; set; } + + /// + /// 获取或设置回调信息。 + /// + [Newtonsoft.Json.JsonProperty("callback")] + [System.Text.Json.Serialization.JsonPropertyName("callback")] + public Types.Callback? Callback { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserResponse.cs new file mode 100644 index 00000000..a00c9de2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinBatch/CgibinBatchSyncUserResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/batch/syncuser 接口的响应。 + /// + public class CgibinBatchSyncUserResponse : WechatWorkResponse + { + /// + /// 获取或设置异步任务 ID。 + /// + [Newtonsoft.Json.JsonProperty("jobid")] + [System.Text.Json.Serialization.JsonPropertyName("jobid")] + public string JobId { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeRequest.cs new file mode 100644 index 00000000..68ac9491 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/corp/get_join_qrcode 接口的请求。 + /// + public class CgibinCorpGetJoinQrcodeRequest : WechatWorkRequest + { + /// + /// 获取或设置二维码尺寸类型。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public int? SizeType { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeResponse.cs new file mode 100644 index 00000000..6c03c12d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorp/CgibinCorpGetJoinQrcodeResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/corp/get_join_qrcode 接口的响应。 + /// + public class CgibinCorpGetJoinQrcodeResponse : WechatWorkResponse + { + /// + /// 获取或设置二维码 URL。 + /// + [Newtonsoft.Json.JsonProperty("join_qrcode")] + [System.Text.Json.Serialization.JsonPropertyName("join_qrcode")] + public string QrcodeUrl { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenRequest.cs new file mode 100644 index 00000000..f4785876 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenRequest.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/corpgroup/corp/gettoken 接口的请求。 + /// + public class CgibinCorpGroupCropGetTokenRequest : WechatWorkRequest + { + /// + /// 获取或设置下级企业 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corpid")] + [System.Text.Json.Serialization.JsonPropertyName("corpid")] + public string CorpId { get; set; } = string.Empty; + + /// + /// 获取或设置下级企业应用 ID。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenResponse.cs new file mode 100644 index 00000000..59046168 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropGetTokenResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/corpgroup/corp/gettoken 接口的响应。 + /// + public class CgibinCorpGroupCropGetTokenResponse : WechatWorkResponse + { + /// + /// 获取或设置下级企业 AccessToken。 + /// + [Newtonsoft.Json.JsonProperty("access_token")] + [System.Text.Json.Serialization.JsonPropertyName("access_token")] + public string AccessToken { get; set; } = default!; + + /// + /// 获取或设置下级企业 AccessToken 有效时间(单位:秒)。 + /// + [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/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoRequest.cs new file mode 100644 index 00000000..35a8e626 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/corpgroup/corp/list_app_share_info 接口的请求。 + /// + public class CgibinCorpGroupCropListAppShareInfoRequest : WechatWorkRequest + { + /// + /// 获取或设置上级企业应用 ID。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int? AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoResponse.cs new file mode 100644 index 00000000..14c7ab7d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCorpGroup/CgibinCorpGroupCropListAppShareInfoResponse.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/corpgroup/corp/list_app_share_info 接口的响应。 + /// + public class CgibinCorpGroupCropListAppShareInfoResponse : WechatWorkResponse + { + public static class Types + { + public class Agent + { + /// + /// 获取或设置下级企业 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corpid")] + [System.Text.Json.Serialization.JsonPropertyName("corpid")] + public string CorpId { get; set; } = default!; + + /// + /// 获取或设置下级企业名称。 + /// + [Newtonsoft.Json.JsonProperty("corp_name")] + [System.Text.Json.Serialization.JsonPropertyName("corp_name")] + public string CorpName { get; set; } = default!; + + /// + /// 获取或设置下级企业应用 ID。 + /// + [Newtonsoft.Json.JsonProperty("agentid")] + [System.Text.Json.Serialization.JsonPropertyName("agentid")] + public int AgentId { get; set; } + } + } + + /// + /// 获取或设置下级企业应用列表。 + /// + [Newtonsoft.Json.JsonProperty("corp_list")] + [System.Text.Json.Serialization.JsonPropertyName("corp_list")] + public Types.Agent[] AgentList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateRequest.cs new file mode 100644 index 00000000..aec8f32e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateRequest.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/department/create 接口的请求。 + /// + public class CgibinDepartmentCreateRequest : WechatWorkRequest + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? DepartmentId { get; set; } + + /// + /// 获取或设置部门名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 获取或设置部门英文名称。 + /// + [Newtonsoft.Json.JsonProperty("name_en")] + [System.Text.Json.Serialization.JsonPropertyName("name_en")] + public string? EnglishName { get; set; } + + /// + /// 获取或设置上级部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("parentid")] + [System.Text.Json.Serialization.JsonPropertyName("parentid")] + public int? ParentDepartmentId { get; set; } + + /// + /// 获取或设置在上级部门中的次序值。 + /// + [Newtonsoft.Json.JsonProperty("order")] + [System.Text.Json.Serialization.JsonPropertyName("order")] + public int? DepartmentOrder { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateResponse.cs new file mode 100644 index 00000000..b4861a42 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentCreateResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/department/create 接口的响应。 + /// + public class CgibinDepartmentCreateResponse : WechatWorkResponse + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int DepartmentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteRequest.cs new file mode 100644 index 00000000..0a926549 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/department/delete 接口的请求。 + /// + public class CgibinDepartmentDeleteRequest : WechatWorkRequest + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public int DepartmentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteResponse.cs new file mode 100644 index 00000000..cefb89e2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentDeleteResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/department/delete 接口的响应。 + /// + public class CgibinDepartmentDeleteResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListRequest.cs new file mode 100644 index 00000000..0709c42f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/department/list 接口的请求。 + /// + public class CgibinDepartmentListRequest : WechatWorkRequest + { + /// + /// 获取或设置指定上级部门 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public int? ParentDepartmentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListResponse.cs new file mode 100644 index 00000000..71841011 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentListResponse.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/department/list 接口的响应。 + /// + public class CgibinDepartmentListResponse : WechatWorkResponse + { + public static class Types + { + public class Department + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int DepartmentId { get; set; } + + /// + /// 获取或设置部门名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置部门英文名称。 + /// + [Newtonsoft.Json.JsonProperty("name_en")] + [System.Text.Json.Serialization.JsonPropertyName("name_en")] + public string? EnglishName { get; set; } + + /// + /// 获取或设置上级部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("parentid")] + [System.Text.Json.Serialization.JsonPropertyName("parentid")] + public int ParentDepartmentId { get; set; } + + /// + /// 获取或设置在上级部门中的次序值。 + /// + [Newtonsoft.Json.JsonProperty("order")] + [System.Text.Json.Serialization.JsonPropertyName("order")] + public int DepartmentOrder { get; set; } + } + } + + /// + /// 获取或设置部门列表。 + /// + [Newtonsoft.Json.JsonProperty("department")] + [System.Text.Json.Serialization.JsonPropertyName("department")] + public Types.Department[] DepartmentList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateRequest.cs new file mode 100644 index 00000000..758b3d4a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateRequest.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/department/update 接口的请求。 + /// + public class CgibinDepartmentUpdateRequest : WechatWorkRequest + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int DepartmentId { get; set; } + + /// + /// 获取或设置部门名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置部门英文名称。 + /// + [Newtonsoft.Json.JsonProperty("name_en")] + [System.Text.Json.Serialization.JsonPropertyName("name_en")] + public string? EnglishName { get; set; } + + /// + /// 获取或设置上级部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("parentid")] + [System.Text.Json.Serialization.JsonPropertyName("parentid")] + public int? ParentDepartmentId { get; set; } + + /// + /// 获取或设置在上级部门中的次序值。 + /// + [Newtonsoft.Json.JsonProperty("order")] + [System.Text.Json.Serialization.JsonPropertyName("order")] + public int? DepartmentOrder { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateResponse.cs new file mode 100644 index 00000000..83668d7d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinDepartment/CgibinDepartmentUpdateResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/department/update 接口的响应。 + /// + public class CgibinDepartmentUpdateResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatRequest.cs new file mode 100644 index 00000000..8210690e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatRequest.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/close_temp_chat 接口的请求。 + /// + public class CgibinExternalContactCloseTempChatRequest : WechatWorkRequest + { + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = string.Empty; + + /// + /// 获取或设置外部联系人账号。 + /// + [Newtonsoft.Json.JsonProperty("external_userid")] + [System.Text.Json.Serialization.JsonPropertyName("external_userid")] + public string ExternalUserId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatResponse.cs new file mode 100644 index 00000000..f96b5ebc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactCloseTempChatResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/close_temp_chat 接口的响应。 + /// + public class CgibinExternalContactCloseTempChatResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListRequest.cs new file mode 100644 index 00000000..1ca8d06a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/externalcontact/get_follow_user_list 接口的请求。 + /// + public class CgibinExternalContactGetFollowUserListRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListResponse.cs new file mode 100644 index 00000000..ef802bee --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/CgibinExternalContactGetFollowUserListResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/externalcontact/get_follow_user_list 接口的响应。 + /// + public class CgibinExternalContactGetFollowUserListResponse : WechatWorkResponse + { + /// + /// 获取或设置配置了客户联系功能的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("follow_user")] + [System.Text.Json.Serialization.JsonPropertyName("follow_user")] + public string[] FollowUserIdList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayRequest.cs new file mode 100644 index 00000000..404879c2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayRequest.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/add_contact_way 接口的请求。 + /// + public class CgibinExternalContactAddContactWayRequest : WechatWorkRequest + { + public static class Types + { + public class Conclusion + { + public static class Types + { + public class Text + { + /// + /// 获取或设置文本内容。 + /// + [Newtonsoft.Json.JsonProperty("content")] + [System.Text.Json.Serialization.JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; + } + + public class Image + { + /// + /// 获取或设置图片 MediaId。 + /// + [Newtonsoft.Json.JsonProperty("media_id")] + [System.Text.Json.Serialization.JsonPropertyName("media_id")] + public string MediaId { get; set; } = string.Empty; + } + + public class Link + { + /// + /// 获取或设置图文消息 URL。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } = string.Empty; + + /// + /// 获取或设置图文消息标题。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 获取或设置图文消息描述。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + + /// + /// 获取或设置图文消息封面 URL。 + /// + [Newtonsoft.Json.JsonProperty("picurl")] + [System.Text.Json.Serialization.JsonPropertyName("picurl")] + public string? PictureUrl { get; set; } + } + + public class MiniProgram + { + /// + /// 获取或设置小程序 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string AppId { get; set; } = string.Empty; + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("page")] + [System.Text.Json.Serialization.JsonPropertyName("page")] + public string PagePath { get; set; } = string.Empty; + + /// + /// 获取或设置小程序标题。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 获取或设置小程序缩略图 MediaId。 + /// + [Newtonsoft.Json.JsonProperty("pic_media_id")] + [System.Text.Json.Serialization.JsonPropertyName("pic_media_id")] + public string? PictureMediaId { get; set; } + } + } + + /// + /// 获取或设置文本类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("text")] + [System.Text.Json.Serialization.JsonPropertyName("text")] + public Types.Text? Text { get; set; } + + /// + /// 获取或设置图片类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("image")] + [System.Text.Json.Serialization.JsonPropertyName("image")] + public Types.Image? Image { get; set; } + + /// + /// 获取或设置链接类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("link")] + [System.Text.Json.Serialization.JsonPropertyName("link")] + public Types.Link? Link { get; set; } + + /// + /// 获取或设置小程序类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("miniprogram")] + [System.Text.Json.Serialization.JsonPropertyName("miniprogram")] + public Types.MiniProgram? MiniProgram { get; set; } + } + } + + /// + /// 获取或设置联系方式类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public int Type { get; set; } + + /// + /// 获取或设置场景。 + /// + [Newtonsoft.Json.JsonProperty("scene")] + [System.Text.Json.Serialization.JsonPropertyName("scene")] + public int Scene { get; set; } + + /// + /// 获取或设置控件样式。 + /// + [Newtonsoft.Json.JsonProperty("style")] + [System.Text.Json.Serialization.JsonPropertyName("style")] + public int? Style { get; set; } + + /// + /// 获取或设置备注信息。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool? IsSkipVerify { get; set; } + + /// + /// 获取或设置企业自定义的渠道参数。 + /// + [Newtonsoft.Json.JsonProperty("state")] + [System.Text.Json.Serialization.JsonPropertyName("state")] + public string? State { get; set; } + + /// + /// 获取或设置使用该联系方式的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("user")] + [System.Text.Json.Serialization.JsonPropertyName("user")] + public IList? UserIdList { get; set; } + + /// + /// 获取或设置使用该联系方式的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("party")] + [System.Text.Json.Serialization.JsonPropertyName("party")] + public IList? DepartmentIdList { get; set; } + + /// + /// 获取或设置是否临时会话模式。 + /// + [Newtonsoft.Json.JsonProperty("is_temp")] + [System.Text.Json.Serialization.JsonPropertyName("is_temp")] + public bool? IsTemp { get; set; } + + /// + /// 获取或设置临时会话二维码有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("expires_in")] + public int? TempQrcodeExpiresIn { get; set; } + + /// + /// 获取或设置临时会话有效期有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("chat_expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("chat_expires_in")] + public int? TempChatExpiresIn { get; set; } + + /// + /// 获取或设置可进行临时会话的客户 UnionId。 + /// + [Newtonsoft.Json.JsonProperty("unionid")] + [System.Text.Json.Serialization.JsonPropertyName("unionid")] + public string? UnionId { get; set; } + + /// + /// 获取或设置结束语信息。 + /// + [Newtonsoft.Json.JsonProperty("conclusions")] + [System.Text.Json.Serialization.JsonPropertyName("conclusions")] + public Types.Conclusion? Conclusions { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayResponse.cs new file mode 100644 index 00000000..7d841d5a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactAddContactWayResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/add_contact_way 接口的响应。 + /// + public class CgibinExternalContactAddContactWayResponse : WechatWorkResponse + { + /// + /// 获取或设置配置 ID。 + /// + [Newtonsoft.Json.JsonProperty("config_id")] + [System.Text.Json.Serialization.JsonPropertyName("config_id")] + public string ConfigId { get; set; } = default!; + + /// + /// 获取或设置联系我的二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("qr_code")] + [System.Text.Json.Serialization.JsonPropertyName("qr_code")] + public string? QrcodeUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayRequest.cs new file mode 100644 index 00000000..f15b04e3 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/del_contact_way 接口的请求。 + /// + public class CgibinExternalContactDeleteContactWayRequest : WechatWorkRequest + { + /// + /// 获取或设置配置 ID。 + /// + [Newtonsoft.Json.JsonProperty("config_id")] + [System.Text.Json.Serialization.JsonPropertyName("config_id")] + public string ConfigId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayResponse.cs new file mode 100644 index 00000000..23bb2738 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactDeleteContactWayResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/del_contact_way 接口的响应。 + /// + public class CgibinExternalContactDeleteContactWayResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayRequest.cs new file mode 100644 index 00000000..8d9c2609 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/get_contact_way 接口的请求。 + /// + public class CgibinExternalContactGetContactWayRequest : WechatWorkRequest + { + /// + /// 获取或设置配置 ID。 + /// + [Newtonsoft.Json.JsonProperty("config_id")] + [System.Text.Json.Serialization.JsonPropertyName("config_id")] + public string ConfigId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayResponse.cs new file mode 100644 index 00000000..6b74e92d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactGetContactWayResponse.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/get_contact_way 接口的响应。 + /// + public class CgibinExternalContactGetContactWayResponse : WechatWorkResponse + { + public static class Types + { + public class ContactWay + { + public static class Types + { + public class Conclusion + { + public static class Types + { + public class Text + { + /// + /// 获取或设置文本内容。 + /// + [Newtonsoft.Json.JsonProperty("content")] + [System.Text.Json.Serialization.JsonPropertyName("content")] + public string Content { get; set; } = default!; + } + + public class Image + { + /// + /// 获取或设置图片 URL。 + /// + [Newtonsoft.Json.JsonProperty("pic_url")] + [System.Text.Json.Serialization.JsonPropertyName("pic_url")] + public string PictureUrl { get; set; } = default!; + } + + public class Link + { + /// + /// 获取或设置图文消息 URL。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } = default!; + + /// + /// 获取或设置图文消息标题。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 获取或设置图文消息描述。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + + /// + /// 获取或设置图文消息封面 URL。 + /// + [Newtonsoft.Json.JsonProperty("picurl")] + [System.Text.Json.Serialization.JsonPropertyName("picurl")] + public string? PictureUrl { get; set; } + } + + public class MiniProgram + { + /// + /// 获取或设置小程序 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string AppId { get; set; } = default!; + + /// + /// 获取或设置小程序页面路径。 + /// + [Newtonsoft.Json.JsonProperty("page")] + [System.Text.Json.Serialization.JsonPropertyName("page")] + public string PagePath { get; set; } = default!; + + /// + /// 获取或设置小程序标题。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string? Title { get; set; } + + /// + /// 获取或设置小程序缩略图 MediaId。 + /// + [Newtonsoft.Json.JsonProperty("pic_media_id")] + [System.Text.Json.Serialization.JsonPropertyName("pic_media_id")] + public string? PictureMediaId { get; set; } + } + } + + /// + /// 获取或设置文本类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("text")] + [System.Text.Json.Serialization.JsonPropertyName("text")] + public Types.Text? Text { get; set; } + + /// + /// 获取或设置图片类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("image")] + [System.Text.Json.Serialization.JsonPropertyName("image")] + public Types.Image? Image { get; set; } + + /// + /// 获取或设置链接类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("link")] + [System.Text.Json.Serialization.JsonPropertyName("link")] + public Types.Link? Link { get; set; } + + /// + /// 获取或设置小程序类型结束语。 + /// + [Newtonsoft.Json.JsonProperty("miniprogram")] + [System.Text.Json.Serialization.JsonPropertyName("miniprogram")] + public Types.MiniProgram? MiniProgram { get; set; } + } + } + + /// + /// 获取或设置配置 ID。 + /// + [Newtonsoft.Json.JsonProperty("config_id")] + [System.Text.Json.Serialization.JsonPropertyName("config_id")] + public string ConfigId { get; set; } = default!; + + /// + /// 获取或设置联系方式类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public int Type { get; set; } + + /// + /// 获取或设置场景。 + /// + [Newtonsoft.Json.JsonProperty("scene")] + [System.Text.Json.Serialization.JsonPropertyName("scene")] + public int Scene { get; set; } + + /// + /// 获取或设置控件样式。 + /// + [Newtonsoft.Json.JsonProperty("style")] + [System.Text.Json.Serialization.JsonPropertyName("style")] + public int Style { get; set; } + + /// + /// 获取或设置备注信息。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string Remark { get; set; } = default!; + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool IsSkipVerify { get; set; } = default!; + + /// + /// 获取或设置企业自定义的渠道参数。 + /// + [Newtonsoft.Json.JsonProperty("state")] + [System.Text.Json.Serialization.JsonPropertyName("state")] + public string State { get; set; } = default!; + + /// + /// 获取或设置联系我的二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("qr_code")] + [System.Text.Json.Serialization.JsonPropertyName("qr_code")] + public string? QrcodeUrl { get; set; } + + /// + /// 获取或设置使用该联系方式的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("user")] + [System.Text.Json.Serialization.JsonPropertyName("user")] + public string[]? UserIdList { get; set; } + + /// + /// 获取或设置使用该联系方式的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("party")] + [System.Text.Json.Serialization.JsonPropertyName("party")] + public int[]? DepartmentIdList { get; set; } + + /// + /// 获取或设置是否临时会话模式。 + /// + [Newtonsoft.Json.JsonProperty("is_temp")] + [System.Text.Json.Serialization.JsonPropertyName("is_temp")] + public bool IsTemp { get; set; } = default!; + + /// + /// 获取或设置临时会话二维码有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("expires_in")] + public int? TempQrcodeExpiresIn { get; set; } + + /// + /// 获取或设置临时会话有效期有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("chat_expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("chat_expires_in")] + public int? TempChatExpiresIn { get; set; } + + /// + /// 获取或设置可进行临时会话的客户 UnionId。 + /// + [Newtonsoft.Json.JsonProperty("unionid")] + [System.Text.Json.Serialization.JsonPropertyName("unionid")] + public string? UnionId { get; set; } + + /// + /// 获取或设置结束语信息。 + /// + [Newtonsoft.Json.JsonProperty("conclusions")] + [System.Text.Json.Serialization.JsonPropertyName("conclusions")] + public Types.Conclusion Conclusions { get; set; } = default!; + } + } + + /// + /// 获取或设置联系方式信息。 + /// + [Newtonsoft.Json.JsonProperty("contact_way")] + [System.Text.Json.Serialization.JsonPropertyName("contact_way")] + public Types.ContactWay? ContactWay { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayRequest.cs new file mode 100644 index 00000000..8508386d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayRequest.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/update_contact_way 接口的请求。 + /// + public class CgibinExternalContactUpdateContactWayRequest : WechatWorkRequest + { + public static class Types + { + public class Conclusion : CgibinExternalContactAddContactWayRequest.Types.Conclusion + { + } + } + + /// + /// 获取或设置配置 ID。 + /// + [Newtonsoft.Json.JsonProperty("config_id")] + [System.Text.Json.Serialization.JsonPropertyName("config_id")] + public string ConfigId { get; set; } = string.Empty; + + /// + /// 获取或设置控件样式。 + /// + [Newtonsoft.Json.JsonProperty("style")] + [System.Text.Json.Serialization.JsonPropertyName("style")] + public int? Style { get; set; } + + /// + /// 获取或设置备注信息。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置是否无需验证。 + /// + [Newtonsoft.Json.JsonProperty("skip_verify")] + [System.Text.Json.Serialization.JsonPropertyName("skip_verify")] + public bool? IsSkipVerify { get; set; } + + /// + /// 获取或设置企业自定义的渠道参数。 + /// + [Newtonsoft.Json.JsonProperty("state")] + [System.Text.Json.Serialization.JsonPropertyName("state")] + public string? State { get; set; } + + /// + /// 获取或设置使用该联系方式的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("user")] + [System.Text.Json.Serialization.JsonPropertyName("user")] + public IList? UserIdList { get; set; } + + /// + /// 获取或设置使用该联系方式的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("party")] + [System.Text.Json.Serialization.JsonPropertyName("party")] + public IList? DepartmentIdList { get; set; } + + /// + /// 获取或设置是否临时会话模式。 + /// + [Newtonsoft.Json.JsonProperty("is_temp")] + [System.Text.Json.Serialization.JsonPropertyName("is_temp")] + public bool? IsTemp { get; set; } + + /// + /// 获取或设置临时会话二维码有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("expires_in")] + public int? TempQrcodeExpiresIn { get; set; } + + /// + /// 获取或设置临时会话有效期有效期(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("chat_expires_in")] + [System.Text.Json.Serialization.JsonPropertyName("chat_expires_in")] + public int? TempChatExpiresIn { get; set; } + + /// + /// 获取或设置可进行临时会话的客户 UnionId。 + /// + [Newtonsoft.Json.JsonProperty("unionid")] + [System.Text.Json.Serialization.JsonPropertyName("unionid")] + public string? UnionId { get; set; } + + /// + /// 获取或设置结束语信息。 + /// + [Newtonsoft.Json.JsonProperty("conclusions")] + [System.Text.Json.Serialization.JsonPropertyName("conclusions")] + public Types.Conclusion? Conclusions { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayResponse.cs new file mode 100644 index 00000000..d0fc555c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinExternalContact/ContactWay/CgibinExternalContactUpdateContactWayResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/externalcontact/update_contact_way 接口的响应。 + /// + public class CgibinExternalContactUpdateContactWayResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListRequest.cs new file mode 100644 index 00000000..382703cd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/agent/get_perm_list 接口的请求。 + /// + public class CgibinLinkedCorpAgentGetPermissionListRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListResponse.cs new file mode 100644 index 00000000..7b36d027 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpAgentGetPermissionListResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/agent/get_perm_list 接口的响应。 + /// + public class CgibinLinkedCorpAgentGetPermissionListResponse : WechatWorkResponse + { + /// + /// 获取或设置可见的互联企业成员账号(格式:"CorpId/UserId")列表。 + /// + [Newtonsoft.Json.JsonProperty("userids")] + [System.Text.Json.Serialization.JsonPropertyName("userids")] + public string[]? CorpUserIdList { get; set; } + + /// + /// 获取或设置可见的互联企业部门 ID(格式:"LinkedId/DepartmentId")列表。 + /// + [Newtonsoft.Json.JsonProperty("department_ids")] + [System.Text.Json.Serialization.JsonPropertyName("department_ids")] + public string[]? LinkedDepartmentIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListRequest.cs new file mode 100644 index 00000000..1e990f8d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/department/list 接口的请求。 + /// + public class CgibinLinkedCorpDepartmentListRequest : WechatWorkRequest + { + /// + /// 获取或设置互联企业部门 ID(格式:"LinkedId/DepartmentId")。 + /// + [Newtonsoft.Json.JsonProperty("department_id")] + [System.Text.Json.Serialization.JsonPropertyName("department_id")] + public string LinkedDepartmentId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListResponse.cs new file mode 100644 index 00000000..c1066b40 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpDepartmentListResponse.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/department/list 接口的响应。 + /// + public class CgibinLinkedCorpDepartmentListResponse : WechatWorkResponse + { + public static class Types + { + public class LinkedDepartment + { + /// + /// 获取或设置部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("department_id")] + [System.Text.Json.Serialization.JsonPropertyName("department_id")] + public int DepartmentId { get; set; } + + /// + /// 获取或设置部门名称。 + /// + [Newtonsoft.Json.JsonProperty("department_name")] + [System.Text.Json.Serialization.JsonPropertyName("department_name")] + public string? Name { get; set; } + + /// + /// 获取或设置上级部门 ID。 + /// + [Newtonsoft.Json.JsonProperty("parentid")] + [System.Text.Json.Serialization.JsonPropertyName("parentid")] + public int ParentDepartmentId { get; set; } + + /// + /// 获取或设置在上级部门中的次序值。 + /// + [Newtonsoft.Json.JsonProperty("order")] + [System.Text.Json.Serialization.JsonPropertyName("order")] + public int DepartmentOrder { get; set; } + } + } + + /// + /// 获取或设置互联企业部门列表。 + /// + [Newtonsoft.Json.JsonProperty("department_list")] + [System.Text.Json.Serialization.JsonPropertyName("department_list")] + public Types.LinkedDepartment[] LinkedDepartmentList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetRequest.cs new file mode 100644 index 00000000..c3f59610 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/get 接口的请求。 + /// + public class CgibinLinkedCorpUserGetRequest : WechatWorkRequest + { + /// + /// 获取或设置互联企业成员账号(格式:"CorpId/UserId")。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string CorpUserId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetResponse.cs new file mode 100644 index 00000000..21341c6c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserGetResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/get 接口的响应。 + /// + public class CgibinLinkedCorpUserGetResponse : WechatWorkResponse + { + public static class Types + { + public class CorpUser : CgibinLinkedCorpUserListResponse.Types.CorpUser + { + } + } + + /// + /// 获取或设置互联企业成员信息。 + /// + [Newtonsoft.Json.JsonProperty("user_info")] + [System.Text.Json.Serialization.JsonPropertyName("user_info")] + public Types.CorpUser CorpUser { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListRequest.cs new file mode 100644 index 00000000..86d69f37 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/list 接口的请求。 + /// + public class CgibinLinkedCorpUserListRequest : CgibinLinkedCorpUserSimpleListRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListResponse.cs new file mode 100644 index 00000000..e5f10f1b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserListResponse.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/list 接口的响应。 + /// + public class CgibinLinkedCorpUserListResponse : WechatWorkResponse + { + public static class Types + { + public class CorpUser + { + public static class Types + { + public class ExtendedAttribute : CgibinUserGetResponse.Types.ExtendedAttribute + { + } + } + + /// + /// 获取或设置所属企业 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corpid")] + [System.Text.Json.Serialization.JsonPropertyName("corpid")] + public string CorpId { get; set; } = default!; + + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = default!; + + /// + /// 获取或设置成员名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置手机号码。 + /// + [Newtonsoft.Json.JsonProperty("mobile")] + [System.Text.Json.Serialization.JsonPropertyName("mobile")] + public string? MobileNumber { get; set; } + + /// + /// 获取或设置座机号码。 + /// + [Newtonsoft.Json.JsonProperty("telephone")] + [System.Text.Json.Serialization.JsonPropertyName("telephone")] + public string? TeleNumber { get; set; } + + /// + /// 获取或设置邮箱。 + /// + [Newtonsoft.Json.JsonProperty("email")] + [System.Text.Json.Serialization.JsonPropertyName("email")] + public string? Email { get; set; } + + /// + /// 获取或设置职务。 + /// + [Newtonsoft.Json.JsonProperty("position")] + [System.Text.Json.Serialization.JsonPropertyName("position")] + public string? Position { get; set; } + + /// + /// 获取或设置互联企业部门 ID(格式:"LinkedId/DepartmentId")列表。 + /// + [Newtonsoft.Json.JsonProperty("department")] + [System.Text.Json.Serialization.JsonPropertyName("department")] + public string[]? LinkedDepartmentIdList { get; set; } + + /// + /// 获取或设置自定义字段信息。 + /// + [Newtonsoft.Json.JsonProperty("extattr")] + [System.Text.Json.Serialization.JsonPropertyName("extattr")] + public Types.ExtendedAttribute? ExtendedAttribute { get; set; } + } + } + + /// + /// 获取或设置互联企业成员列表。 + /// + [Newtonsoft.Json.JsonProperty("userlist")] + [System.Text.Json.Serialization.JsonPropertyName("userlist")] + public Types.CorpUser[] CorpUserList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListRequest.cs new file mode 100644 index 00000000..d86e4d6a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListRequest.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/simplelist 接口的请求。 + /// + public class CgibinLinkedCorpUserSimpleListRequest : WechatWorkRequest + { + /// + /// 获取或设置互联企业部门 ID(格式:"LinkedId/DepartmentId")。 + /// + [Newtonsoft.Json.JsonProperty("department_id")] + [System.Text.Json.Serialization.JsonPropertyName("department_id")] + public string LinkedDepartmentId { get; set; } = string.Empty; + + /// + /// 获取或设置是否递归获取子部门成员。 + /// + [Newtonsoft.Json.JsonProperty("fetch_child")] + [System.Text.Json.Serialization.JsonPropertyName("fetch_child")] + public bool? RequireFetchChild { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListResponse.cs new file mode 100644 index 00000000..3fb6c80f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinLinkedCorp/CgibinLinkedCorpUserSimpleListResponse.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/linkedcorp/user/simplelist 接口的响应。 + /// + public class CgibinLinkedCorpUserSimpleListResponse : WechatWorkResponse + { + public static class Types + { + public class CorpUser + { + /// + /// 获取或设置所属企业 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corpid")] + [System.Text.Json.Serialization.JsonPropertyName("corpid")] + public string CorpId { get; set; } = default!; + + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = default!; + + /// + /// 获取或设置成员名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置互联企业部门 ID(格式:"LinkedId/DepartmentId")列表。 + /// + [Newtonsoft.Json.JsonProperty("department")] + [System.Text.Json.Serialization.JsonPropertyName("department")] + public string[]? LinkedDepartmentIdList { get; set; } + } + } + + /// + /// 获取或设置互联企业成员列表。 + /// + [Newtonsoft.Json.JsonProperty("userlist")] + [System.Text.Json.Serialization.JsonPropertyName("userlist")] + public Types.CorpUser[] CorpUserList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkRequest.cs new file mode 100644 index 00000000..85a616c7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/media/get/jssdk 接口的请求。 + /// + public class CgibinMediaGetJssdkRequest : WechatWorkRequest + { + /// + /// 获取或设置媒体文件标识。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string MediaId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkResponse.cs new file mode 100644 index 00000000..5e5efe96 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetJssdkResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/media/get/jssdk 接口的响应。 + /// + public class CgibinMediaGetJssdkResponse : WechatWorkResponse + { + public override bool IsSuccessful() + { + return base.IsSuccessful() && RawBytes?.Length > 0; + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetRequest.cs new file mode 100644 index 00000000..b076f6c0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/media/get 接口的请求。 + /// + public class CgibinMediaGetRequest : WechatWorkRequest + { + /// + /// 获取或设置媒体文件标识。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string MediaId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetResponse.cs new file mode 100644 index 00000000..260f0f38 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaGetResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/media/get 接口的响应。 + /// + public class CgibinMediaGetResponse : WechatWorkResponse + { + public override bool IsSuccessful() + { + return base.IsSuccessful() && RawBytes?.Length > 0; + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageRequest.cs new file mode 100644 index 00000000..0057447f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageRequest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/media/uploadimg 接口的请求。 + /// + public class CgibinMediaUploadImageRequest : WechatWorkRequest + { + /// + /// 获取或设置图片文件字节数组。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public byte[] FileBytes { get; set; } = new byte[0]; + + /// + /// 获取或设置图片文件名。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? FileName { get; set; } + + /// + /// 获取或设置图片文件 Conent-Type。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? FileContentType { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageResponse.cs new file mode 100644 index 00000000..9a6a33dd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadImageResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/media/uploadimg 接口的响应。 + /// + public class CgibinMediaUploadImageResponse : WechatWorkResponse + { + /// + /// 获取或设置图片 URL。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadRequest.cs new file mode 100644 index 00000000..93f68098 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadRequest.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/media/upload 接口的请求。 + /// + public class CgibinMediaUploadRequest : WechatWorkRequest + { + /// + /// 获取或设置媒体文件类型。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string Type { get; set; } = string.Empty; + + /// + /// 获取或设置文件字节数组。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public byte[] FileBytes { get; set; } = new byte[0]; + + /// + /// 获取或设置文件名。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? FileName { get; set; } + + /// + /// 获取或设置文件 Conent-Type。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string? FileContentType { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadResponse.cs new file mode 100644 index 00000000..e88bc617 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMedia/CgibinMediaUploadResponse.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/media/upload 接口的响应。 + /// + public class CgibinMediaUploadResponse : WechatWorkResponse + { + /// + /// 获取或设置媒体文件类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; + + /// + /// 获取或设置媒体文件标识。 + /// + [Newtonsoft.Json.JsonProperty("media_id")] + [System.Text.Json.Serialization.JsonPropertyName("media_id")] + public string MediaId { get; set; } = default!; + + /// + /// 获取或设置媒体文件上传时间戳。 + /// + [Newtonsoft.Json.JsonProperty("created_at")] + [System.Text.Json.Serialization.JsonPropertyName("created_at")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long CreateTimestamp { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMenu/CgibinMenuCreateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMenu/CgibinMenuCreateRequest.cs new file mode 100644 index 00000000..5bed8674 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinMenu/CgibinMenuCreateRequest.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/menu/create 接口的请求。 + /// + public class CgibinMenuCreateRequest : WechatWorkRequest + { + public static class Types + { + public class Button + { + /// + /// 获取或设置菜单的响应动作类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + + /// + /// 获取或设置菜单名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 获取或设置菜单 KEY 值。 + /// + [Newtonsoft.Json.JsonProperty("key")] + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// 获取或设置网页链接。 + /// + [Newtonsoft.Json.JsonProperty("url")] + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// 获取或设置小程序的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string? MiniProgramAppId { get; set; } + + /// + /// 获取或设置小程序的页面路径。 + /// + [Newtonsoft.Json.JsonProperty("pagepath")] + [System.Text.Json.Serialization.JsonPropertyName("pagepath")] + public string? MiniProgramPagePath { get; set; } + + /// + /// 获取或设置子菜单列表。 + /// + [Newtonsoft.Json.JsonProperty("sub_button")] + [System.Text.Json.Serialization.JsonPropertyName("sub_button")] + public IList