diff --git a/.gitignore b/.gitignore index 7660f4211723c96957a41da010792055429cf79f..8e7e285c46341fb60b6cb6baf143a8ff261a6408 100644 --- a/.gitignore +++ b/.gitignore @@ -240,3 +240,5 @@ nunit-UnitTests.xml nunit-TrackingCollectionTests.xml GitHubVS.sln.DotSettings **/generated/*.cs +/src/Gitee.Api/SDKConfig.cs +/src/common/SDKConfig.cs diff --git a/GiteeVS.sln b/GiteeVS.sln index e9328689ecbe526137b4837c745b9cae7352c398..7175ec08ee8e19f8aa55f4236ef6176d00c5fbf9 100644 --- a/GiteeVS.sln +++ b/GiteeVS.sln @@ -13,100 +13,95 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gitee.TeamFoundation.15", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gitee.TeamFoundation.14", "src\Gitee.TeamFoundation.14\Gitee.TeamFoundation.14.csproj", "{161DBF01-1DBF-4B00-8551-C5C00F26720D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gitee.Api", "src\Gitee.Api\Gitee.Api.csproj", "{EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3522A9A9-F12F-4659-AC54-B56E3E8B6C45}" + ProjectSection(SolutionItems) = preProject + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gitee.Api.Sandbox", "src\Gitee.API.Sandbox\Gitee.Api.Sandbox.csproj", "{EA541341-A49F-4B7F-B3BD-DD62B0273633}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gitee.TeamFoundation.16", "src\Gitee.TeamFoundation.16\Gitee.TeamFoundation.16.csproj", "{FF0EACF8-26B9-482B-A1EB-E288456433E6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x86 = Debug|x86 - Publish|Any CPU = Publish|Any CPU - Publish|x86 = Publish|x86 Release|Any CPU = Release|Any CPU Release|x86 = Release|x86 - XamlDesign|Any CPU = XamlDesign|Any CPU - XamlDesign|x86 = XamlDesign|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Debug|x86.ActiveCfg = Debug|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Debug|x86.Build.0 = Debug|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Publish|Any CPU.ActiveCfg = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Publish|Any CPU.Build.0 = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Publish|x86.ActiveCfg = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Publish|x86.Build.0 = Release|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Release|Any CPU.ActiveCfg = Release|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Release|Any CPU.Build.0 = Release|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Release|x86.ActiveCfg = Release|Any CPU {C3150B82-8E79-4FF6-A9FF-E361C108384F}.Release|x86.Build.0 = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.XamlDesign|Any CPU.Build.0 = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.XamlDesign|x86.ActiveCfg = Release|Any CPU - {C3150B82-8E79-4FF6-A9FF-E361C108384F}.XamlDesign|x86.Build.0 = Release|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Debug|Any CPU.Build.0 = Debug|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Debug|x86.ActiveCfg = Debug|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Debug|x86.Build.0 = Debug|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Publish|Any CPU.ActiveCfg = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Publish|Any CPU.Build.0 = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Publish|x86.ActiveCfg = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Publish|x86.Build.0 = Release|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Release|Any CPU.Build.0 = Release|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Release|x86.ActiveCfg = Release|Any CPU {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.Release|x86.Build.0 = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.XamlDesign|Any CPU.Build.0 = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.XamlDesign|x86.ActiveCfg = Release|Any CPU - {11569514-5AE5-4B5B-92A2-F10B0967DE5F}.XamlDesign|x86.Build.0 = Release|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Debug|x86.ActiveCfg = Debug|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Debug|x86.Build.0 = Debug|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Publish|Any CPU.ActiveCfg = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Publish|Any CPU.Build.0 = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Publish|x86.ActiveCfg = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Publish|x86.Build.0 = Release|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Release|Any CPU.ActiveCfg = Release|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Release|Any CPU.Build.0 = Release|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Release|x86.ActiveCfg = Release|Any CPU {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.Release|x86.Build.0 = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.XamlDesign|Any CPU.Build.0 = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.XamlDesign|x86.ActiveCfg = Release|Any CPU - {EC0FA794-798E-4949-A9A1-608E0B5E5EEA}.XamlDesign|x86.Build.0 = Release|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Debug|Any CPU.Build.0 = Debug|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Debug|x86.ActiveCfg = Debug|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Debug|x86.Build.0 = Debug|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Publish|Any CPU.ActiveCfg = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Publish|Any CPU.Build.0 = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Publish|x86.ActiveCfg = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Publish|x86.Build.0 = Release|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Release|Any CPU.ActiveCfg = Release|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Release|Any CPU.Build.0 = Release|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Release|x86.ActiveCfg = Release|Any CPU {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.Release|x86.Build.0 = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.XamlDesign|Any CPU.Build.0 = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.XamlDesign|x86.ActiveCfg = Release|Any CPU - {C7EF7CBE-77AD-41B7-8DDE-C685D63D2EB3}.XamlDesign|x86.Build.0 = Release|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Debug|Any CPU.Build.0 = Debug|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Debug|x86.ActiveCfg = Debug|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Debug|x86.Build.0 = Debug|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Publish|Any CPU.ActiveCfg = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Publish|Any CPU.Build.0 = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Publish|x86.ActiveCfg = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Publish|x86.Build.0 = Release|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|Any CPU.ActiveCfg = Release|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|Any CPU.Build.0 = Release|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|x86.ActiveCfg = Release|Any CPU {161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|x86.Build.0 = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.Build.0 = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|x86.ActiveCfg = Release|Any CPU - {161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|x86.Build.0 = Release|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Debug|x86.ActiveCfg = Debug|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Debug|x86.Build.0 = Debug|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Release|Any CPU.Build.0 = Release|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Release|x86.ActiveCfg = Release|Any CPU + {EC52D2B9-5F3B-42CF-B2FA-4ADE5C2E0502}.Release|x86.Build.0 = Release|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Debug|x86.ActiveCfg = Debug|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Debug|x86.Build.0 = Debug|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Release|Any CPU.Build.0 = Release|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Release|x86.ActiveCfg = Release|Any CPU + {EA541341-A49F-4B7F-B3BD-DD62B0273633}.Release|x86.Build.0 = Release|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Debug|x86.Build.0 = Debug|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Release|Any CPU.Build.0 = Release|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Release|x86.ActiveCfg = Release|Any CPU + {FF0EACF8-26B9-482B-A1EB-E288456433E6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {03C67658-820F-4339-88ED-659973E8414E} + EndGlobalSection EndGlobal diff --git a/ResetEnvironment.cmd b/ResetEnvironment.cmd index f476088111450b3fdaf39454a1d26502ce8b95b6..429301210cb0c5acef24c06982f1cd0b4b5fb5a0 100644 --- a/ResetEnvironment.cmd +++ b/ResetEnvironment.cmd @@ -1,11 +1,23 @@ -rd /S /Q %~dp0build - -rd /S /Q %LocalAppData%\Microsoft\VisualStudio\14.0Exp -rd /S /Q %LocalAppData%\Microsoft\VisualStudio\Exp -reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp /f -reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp_Config /f -reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp_Remote /f -"E:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Tools\Bin\CreateExpInstance.exe" /Reset /VSInstance=14.0 /RootSuffix=Exp - -REM wait for 1 second, so you can see what's happing +rd /S /Q %~dp0build + +rd /S /Q %LocalAppData%\Microsoft\VisualStudio\14.0Exp +rd /S /Q %LocalAppData%\Microsoft\VisualStudio\Exp +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp /f +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp_Config /f +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0Exp_Remote /f +"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Tools\Bin\CreateExpInstance.exe" /Reset /VSInstance=14.0 /RootSuffix=Exp + + + +rd /S /Q %LocalAppData%\Microsoft\VisualStudio\15.0Exp +rd /S /Q %LocalAppData%\Microsoft\VisualStudio\15.0*Exp +rd /S /Q %LocalAppData%\Microsoft\VisualStudio\Exp +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\15.0Exp /f +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\15.0Exp_Config /f +reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\15.0Exp_Remote /f +"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VSSDK\VisualStudioIntegration\Tools\Bin\CreateExpInstance.exe" /Reset /VSInstance=15.0 /RootSuffix=Exp + + + +REM wait for 1 second, so you can see what's happing timeout 2 > NUL \ No newline at end of file diff --git a/lib/15.0/Microsoft.TeamFoundation.Client.dll b/lib/15.0/Microsoft.TeamFoundation.Client.dll index ee233792c5b2b595ced0caf2712c278c1a8d7c32..ff4164ee7fdc7deae0ebb502e15f581f491b9c93 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Client.dll and b/lib/15.0/Microsoft.TeamFoundation.Client.dll differ diff --git a/lib/15.0/Microsoft.TeamFoundation.Common.dll b/lib/15.0/Microsoft.TeamFoundation.Common.dll index 9e4091ac0fe89f8433562d2d7c5f34a411bd69f6..7ab1fb2525f432a263656196b79d1b8d91597675 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Common.dll and b/lib/15.0/Microsoft.TeamFoundation.Common.dll differ diff --git a/lib/15.0/Microsoft.TeamFoundation.Controls.dll b/lib/15.0/Microsoft.TeamFoundation.Controls.dll index 6b8ee7aec39aa81ce55a03072c72df4baf946ed5..65d4237f55d790970d496e9308f5ce16cc8a5e78 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Controls.dll and b/lib/15.0/Microsoft.TeamFoundation.Controls.dll differ diff --git a/lib/15.0/Microsoft.TeamFoundation.Git.Client.dll b/lib/15.0/Microsoft.TeamFoundation.Git.Client.dll index 2c7389f68543fec9ff7c3e4c16155f6ea70397d6..f77b7d6a56d826336213516bf75439171d661bcc 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Git.Client.dll and b/lib/15.0/Microsoft.TeamFoundation.Git.Client.dll differ diff --git a/lib/15.0/Microsoft.TeamFoundation.Git.Controls.dll b/lib/15.0/Microsoft.TeamFoundation.Git.Controls.dll index e8977019f47a5c317424c2c37016944bf813573f..d077a0816c3ceb43bbfa417f5413052c3e9eb752 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Git.Controls.dll and b/lib/15.0/Microsoft.TeamFoundation.Git.Controls.dll differ diff --git a/lib/15.0/Microsoft.TeamFoundation.Git.Provider.dll b/lib/15.0/Microsoft.TeamFoundation.Git.Provider.dll index ec45978843571c66d9e41fe59057544b4b23f15b..f8908bf6220d0af9dcca1dab39d6b34998134092 100644 Binary files a/lib/15.0/Microsoft.TeamFoundation.Git.Provider.dll and b/lib/15.0/Microsoft.TeamFoundation.Git.Provider.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Client.dll b/lib/16.0/Microsoft.TeamFoundation.Client.dll new file mode 100644 index 0000000000000000000000000000000000000000..2280436cf0a3acfacb4fcd8acb6d8496ef3b8144 Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Client.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Common.dll b/lib/16.0/Microsoft.TeamFoundation.Common.dll new file mode 100644 index 0000000000000000000000000000000000000000..5f964743757470afe1adc54169e286b2603af2c7 Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Common.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Controls.dll b/lib/16.0/Microsoft.TeamFoundation.Controls.dll new file mode 100644 index 0000000000000000000000000000000000000000..598e9fe14aaf8ae244b9d1def12d7e7fbb148430 Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Controls.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Git.Client.dll b/lib/16.0/Microsoft.TeamFoundation.Git.Client.dll new file mode 100644 index 0000000000000000000000000000000000000000..917f58f4ae6b75316137f412cf7c6937a6ad9503 Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Git.Client.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Git.Controls.dll b/lib/16.0/Microsoft.TeamFoundation.Git.Controls.dll new file mode 100644 index 0000000000000000000000000000000000000000..bda68a21dff024a31f663cd7fba4d42fabc0224c Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Git.Controls.dll differ diff --git a/lib/16.0/Microsoft.TeamFoundation.Git.Provider.dll b/lib/16.0/Microsoft.TeamFoundation.Git.Provider.dll new file mode 100644 index 0000000000000000000000000000000000000000..0ccb6da2e7ee007800f69636ce455228e374d086 Binary files /dev/null and b/lib/16.0/Microsoft.TeamFoundation.Git.Provider.dll differ diff --git a/src/Gitee.API.Sandbox/Gitee.Api.Sandbox.csproj b/src/Gitee.API.Sandbox/Gitee.Api.Sandbox.csproj new file mode 100644 index 0000000000000000000000000000000000000000..71f6710e0bc789a1ec97b98c0c50e4d010b1c4a3 --- /dev/null +++ b/src/Gitee.API.Sandbox/Gitee.Api.Sandbox.csproj @@ -0,0 +1,16 @@ + + + + Exe + netcoreapp2.2 + + + + + + + + + + + diff --git a/src/Gitee.API.Sandbox/Program.cs b/src/Gitee.API.Sandbox/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..83b88f45e3da73ccc931a97b7cf99ff7cf615888 --- /dev/null +++ b/src/Gitee.API.Sandbox/Program.cs @@ -0,0 +1,33 @@ +using Gitee.Api; +using System; +using System.Threading.Tasks; + +namespace Gitee.API.Sandbox +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + Task.Run(async () => + { + try + { + SDK.client_id = SdkConfig.client_id; + SDK.client_secret = SdkConfig.client_secret; + var client = await SDK.LoginAsync(SdkConfig.username,SdkConfig.password); + var user = await client.GetUserAsync(); + var poject = await client.GetReposAsync(1,20); + // await client.CreateRepoAsync("test" + DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString(), true); + await client.CreateRepoAsync("testpublic1122211" , "", false); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + }).Wait(); + + + } + } +} diff --git a/src/Gitee.Api.Test/Gitee.Api.Test.csproj b/src/Gitee.Api.Test/Gitee.Api.Test.csproj new file mode 100644 index 0000000000000000000000000000000000000000..442ca4940a8c050a04da75b7ddd723d93399d64a --- /dev/null +++ b/src/Gitee.Api.Test/Gitee.Api.Test.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp2.2 + + false + + + + + + + + + diff --git a/src/Gitee.Api.Test/UnitTest1.cs b/src/Gitee.Api.Test/UnitTest1.cs new file mode 100644 index 0000000000000000000000000000000000000000..883eae4c5eab456ac5ee5d073b1cae92ca3854df --- /dev/null +++ b/src/Gitee.Api.Test/UnitTest1.cs @@ -0,0 +1,13 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Gitee.Api.Test +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/src/Gitee.Api/ApiPartials.cs b/src/Gitee.Api/ApiPartials.cs new file mode 100644 index 0000000000000000000000000000000000000000..d3a833857144613e2b8320094add4da5267aad81 --- /dev/null +++ b/src/Gitee.Api/ApiPartials.cs @@ -0,0 +1,31816 @@ +//---------------------- +// +// Generated using the NSwag toolchain v12.0.14.0 (NJsonSchema v9.13.18.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// +//---------------------- +using System; +namespace Gitee.Api +{ + #pragma warning disable + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "12.0.14.0 (NJsonSchema v9.13.18.0 (Newtonsoft.Json v11.0.0.0))")] + public partial class Client + { + private string _baseUrl = "gitee.com/api"; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public Client(System.Net.Http.HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new System.Lazy(() => + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + }); + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// 获取所有分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo) + { + return GetV5ReposOwnerRepoBranchesAsync(access_token, owner, repo, System.Threading.CancellationToken.None); + } + + /// 获取所有分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/branches?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 创建分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 起点名称, 默认:master + /// 新创建的分支名称 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PostV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, string refs, string branch_name) + { + return PostV5ReposOwnerRepoBranchesAsync(access_token, owner, repo, refs, branch_name, System.Threading.CancellationToken.None); + } + + /// 创建分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 起点名称, 默认:master + /// 新创建的分支名称 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PostV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, string refs, string branch_name, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/branches"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (refs == null) + throw new System.ArgumentNullException("refs"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(refs, System.Globalization.CultureInfo.InvariantCulture)), "refs"); + } + if (branch_name == null) + throw new System.ArgumentNullException("branch_name"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(branch_name, System.Globalization.CultureInfo.InvariantCulture)), "branch_name"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "201") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CompleteBranch); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CompleteBranch); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取单个分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoBranchesBranchAsync(string access_token, string owner, string repo, string branch) + { + return GetV5ReposOwnerRepoBranchesBranchAsync(access_token, owner, repo, branch, System.Threading.CancellationToken.None); + } + + /// 获取单个分支 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoBranchesBranchAsync(string access_token, string owner, string repo, string branch, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (branch == null) + throw new System.ArgumentNullException("branch"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{branch}", System.Uri.EscapeDataString(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CompleteBranch); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CompleteBranch); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 设置分支保护 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PutV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch) + { + return PutV5ReposOwnerRepoBranchesBranchProtectionAsync(access_token, owner, repo, branch, System.Threading.CancellationToken.None); + } + + /// 设置分支保护 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PutV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (branch == null) + throw new System.ArgumentNullException("branch"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}/protection"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{branch}", System.Uri.EscapeDataString(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CompleteBranch); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CompleteBranch); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 取消保护分支的设置 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 取消保护分支的设置 + /// A server side error occurred. + public System.Threading.Tasks.Task DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch) + { + return DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(access_token, owner, repo, branch, System.Threading.CancellationToken.None); + } + + /// 取消保护分支的设置 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支名称 + /// 取消保护分支的设置 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (branch == null) + throw new System.ArgumentNullException("branch"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}/protection?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{branch}", System.Uri.EscapeDataString(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "204") + { + return; + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 仓库的所有提交 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 提交起始的SHA值或者分支名. 默认: 仓库的默认分支 + /// 包含该文件的提交 + /// 提交作者的邮箱或个性域名(username/login) + /// 提交的起始时间,时间格式为 ISO 8601 + /// 提交的最后时间,时间格式为 ISO 8601 + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoCommitsAsync(string access_token, string owner, string repo, string sha, string path, string author, string since, string until, int? page, int? per_page) + { + return GetV5ReposOwnerRepoCommitsAsync(access_token, owner, repo, sha, path, author, since, until, page, per_page, System.Threading.CancellationToken.None); + } + + /// 仓库的所有提交 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 提交起始的SHA值或者分支名. 默认: 仓库的默认分支 + /// 包含该文件的提交 + /// 提交作者的邮箱或个性域名(username/login) + /// 提交的起始时间,时间格式为 ISO 8601 + /// 提交的最后时间,时间格式为 ISO 8601 + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoCommitsAsync(string access_token, string owner, string repo, string sha, string path, string author, string since, string until, int? page, int? per_page, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/commits?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sha != null) + { + urlBuilder_.Append("sha=").Append(System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (path != null) + { + urlBuilder_.Append("path=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (author != null) + { + urlBuilder_.Append("author=").Append(System.Uri.EscapeDataString(ConvertToString(author, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (since != null) + { + urlBuilder_.Append("since=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (until != null) + { + urlBuilder_.Append("until=").Append(System.Uri.EscapeDataString(ConvertToString(until, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (page != null) + { + urlBuilder_.Append("page=").Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (per_page != null) + { + urlBuilder_.Append("per_page=").Append(System.Uri.EscapeDataString(ConvertToString(per_page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 仓库的某个提交 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 提交的SHA值或者分支名 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoCommitsShaAsync(string access_token, string owner, string repo, string sha) + { + return GetV5ReposOwnerRepoCommitsShaAsync(access_token, owner, repo, sha, System.Threading.CancellationToken.None); + } + + /// 仓库的某个提交 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 提交的SHA值或者分支名 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoCommitsShaAsync(string access_token, string owner, string repo, string sha, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (sha == null) + throw new System.ArgumentNullException("sha"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/commits/{sha}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{sha}", System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(RepoCommit); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(RepoCommit); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 两个Commits之间对比的版本差异 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Commit提交的SHA值或者分支名作为对比起点 + /// Commit提交的SHA值或者分支名作为对比终点 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoCompareBaseHeadAsync(string access_token, string owner, string repo, string @base, string head) + { + return GetV5ReposOwnerRepoCompareBaseHeadAsync(access_token, owner, repo, @base, head, System.Threading.CancellationToken.None); + } + + /// 两个Commits之间对比的版本差异 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Commit提交的SHA值或者分支名作为对比起点 + /// Commit提交的SHA值或者分支名作为对比终点 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoCompareBaseHeadAsync(string access_token, string owner, string repo, string @base, string head, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (@base == null) + throw new System.ArgumentNullException("@base"); + + if (head == null) + throw new System.ArgumentNullException("head"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/compare/{base}...{head}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{base}", System.Uri.EscapeDataString(ConvertToString(@base, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{head}", System.Uri.EscapeDataString(ConvertToString(head, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Compare); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Compare); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库已部署的公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, int? page, int? per_page) + { + return GetV5ReposOwnerRepoKeysAsync(access_token, owner, repo, page, per_page, System.Threading.CancellationToken.None); + } + + /// 获取仓库已部署的公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, int? page, int? per_page, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (page != null) + { + urlBuilder_.Append("page=").Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (per_page != null) + { + urlBuilder_.Append("per_page=").Append(System.Uri.EscapeDataString(ConvertToString(per_page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 为仓库添加公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥内容 + /// 公钥名称 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PostV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, string key, string title) + { + return PostV5ReposOwnerRepoKeysAsync(access_token, owner, repo, key, title, System.Threading.CancellationToken.None); + } + + /// 为仓库添加公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥内容 + /// 公钥名称 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PostV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, string key, string title, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (key == null) + throw new System.ArgumentNullException("key"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture)), "key"); + } + if (title == null) + throw new System.ArgumentNullException("title"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(title, System.Globalization.CultureInfo.InvariantCulture)), "title"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "201") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(SSHKey); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(SSHKey); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库可部署的公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoKeysAvailableAsync(string access_token, string owner, string repo, int? page, int? per_page) + { + return GetV5ReposOwnerRepoKeysAvailableAsync(access_token, owner, repo, page, per_page, System.Threading.CancellationToken.None); + } + + /// 获取仓库可部署的公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoKeysAvailableAsync(string access_token, string owner, string repo, int? page, int? per_page, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys/available?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (page != null) + { + urlBuilder_.Append("page=").Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (per_page != null) + { + urlBuilder_.Append("per_page=").Append(System.Uri.EscapeDataString(ConvertToString(per_page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 启用仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 已启用 + /// A server side error occurred. + public System.Threading.Tasks.Task PutV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id) + { + return PutV5ReposOwnerRepoKeysEnableIdAsync(access_token, owner, repo, id, System.Threading.CancellationToken.None); + } + + /// 启用仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 已启用 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PutV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys/enable/{id}"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "204") + { + return; + } + else + if (status_ == "403") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("\u6ca1\u6709\u542f\u7528\u6743\u9650", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 停用仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 已停用 + /// A server side error occurred. + public System.Threading.Tasks.Task DeleteV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id) + { + return DeleteV5ReposOwnerRepoKeysEnableIdAsync(access_token, owner, repo, id, System.Threading.CancellationToken.None); + } + + /// 停用仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 已停用 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task DeleteV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys/enable/{id}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "204") + { + return; + } + else + if (status_ == "404") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("\u6ca1\u6709\u76f8\u5173\u516c\u94a5", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库的单个公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id) + { + return GetV5ReposOwnerRepoKeysIdAsync(access_token, owner, repo, id, System.Threading.CancellationToken.None); + } + + /// 获取仓库的单个公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys/{id}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(SSHKey); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(SSHKey); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 删除一个仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 删除一个仓库公钥 + /// A server side error occurred. + public System.Threading.Tasks.Task DeleteV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id) + { + return DeleteV5ReposOwnerRepoKeysIdAsync(access_token, owner, repo, id, System.Threading.CancellationToken.None); + } + + /// 删除一个仓库公钥 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 公钥 ID + /// 删除一个仓库公钥 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task DeleteV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/keys/{id}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "204") + { + return; + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库README + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支、tag或commit。默认: 仓库的默认分支(通常是master) + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoReadmeAsync(string access_token, string owner, string repo, string @ref) + { + return GetV5ReposOwnerRepoReadmeAsync(access_token, owner, repo, @ref, System.Threading.CancellationToken.None); + } + + /// 获取仓库README + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 分支、tag或commit。默认: 仓库的默认分支(通常是master) + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoReadmeAsync(string access_token, string owner, string repo, string @ref, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/readme?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (@ref != null) + { + urlBuilder_.Append("ref=").Append(System.Uri.EscapeDataString(ConvertToString(@ref, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Content); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Content); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库具体路径下的内容 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 分支、tag或commit。默认: 仓库的默认分支(通常是master) + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoContentsPath(string access_token, string owner, string repo, string path, string @ref) + { + return GetV5ReposOwnerRepoContentsPathAsync(access_token, owner, repo, path, @ref, System.Threading.CancellationToken.None); + } + + /// 获取仓库具体路径下的内容 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 分支、tag或commit。默认: 仓库的默认分支(通常是master) + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string @ref, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/contents(/{path})?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{path}", System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (@ref != null) + { + urlBuilder_.Append("ref=").Append(System.Uri.EscapeDataString(ConvertToString(@ref, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 新建文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件内容, 要用 base64 编码 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PostV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string content, string message, string branch, string committername, string committeremail, string authorname, string authoremail) + { + return PostV5ReposOwnerRepoContentsPathAsync(access_token, owner, repo, path, content, message, branch, committername, committeremail, authorname, authoremail, System.Threading.CancellationToken.None); + } + + /// 新建文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件内容, 要用 base64 编码 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PostV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string content, string message, string branch, string committername, string committeremail, string authorname, string authoremail, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/contents/{path}"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{path}", System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (content == null) + throw new System.ArgumentNullException("content"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(content, System.Globalization.CultureInfo.InvariantCulture)), "content"); + } + if (message == null) + throw new System.ArgumentNullException("message"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(message, System.Globalization.CultureInfo.InvariantCulture)), "message"); + } + if (branch != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture)), "branch"); + } + if (committername != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(committername, System.Globalization.CultureInfo.InvariantCulture)), "committer[name]"); + } + if (committeremail != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(committeremail, System.Globalization.CultureInfo.InvariantCulture)), "committer[email]"); + } + if (authorname != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(authorname, System.Globalization.CultureInfo.InvariantCulture)), "author[name]"); + } + if (authoremail != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(authoremail, System.Globalization.CultureInfo.InvariantCulture)), "author[email]"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "201") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CommitContent); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CommitContent); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 更新文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件内容, 要用 base64 编码 + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PutV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string content, string sha, string message, string branch, string committername, string committeremail, string authorname, string authoremail) + { + return PutV5ReposOwnerRepoContentsPathAsync(access_token, owner, repo, path, content, sha, message, branch, committername, committeremail, authorname, authoremail, System.Threading.CancellationToken.None); + } + + /// 更新文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件内容, 要用 base64 编码 + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PutV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string content, string sha, string message, string branch, string committername, string committeremail, string authorname, string authoremail, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/contents/{path}"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{path}", System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (content == null) + throw new System.ArgumentNullException("content"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(content, System.Globalization.CultureInfo.InvariantCulture)), "content"); + } + if (sha == null) + throw new System.ArgumentNullException("sha"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture)), "sha"); + } + if (message == null) + throw new System.ArgumentNullException("message"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(message, System.Globalization.CultureInfo.InvariantCulture)), "message"); + } + if (branch != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture)), "branch"); + } + if (committername != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(committername, System.Globalization.CultureInfo.InvariantCulture)), "committer[name]"); + } + if (committeremail != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(committeremail, System.Globalization.CultureInfo.InvariantCulture)), "committer[email]"); + } + if (authorname != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(authorname, System.Globalization.CultureInfo.InvariantCulture)), "author[name]"); + } + if (authoremail != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(authoremail, System.Globalization.CultureInfo.InvariantCulture)), "author[email]"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CommitContent); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CommitContent); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 删除文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task DeleteV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string sha, string message, string branch, string committername, string committeremail, string authorname, string authoremail) + { + return DeleteV5ReposOwnerRepoContentsPathAsync(access_token, owner, repo, path, sha, message, branch, committername, committeremail, authorname, authoremail, System.Threading.CancellationToken.None); + } + + /// 删除文件 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的路径 + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 提交信息 + /// 分支名称。默认为仓库对默认分支 + /// Committer的名字,默认为当前用户的名字 + /// Committer的邮箱,默认为当前用户的邮箱 + /// Author的名字,默认为当前用户的名字 + /// Author的邮箱,默认为当前用户的邮箱 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task DeleteV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string sha, string message, string branch, string committername, string committeremail, string authorname, string authoremail, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + if (sha == null) + throw new System.ArgumentNullException("sha"); + + if (message == null) + throw new System.ArgumentNullException("message"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/contents/{path}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{path}", System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Append("sha=").Append(System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append("message=").Append(System.Uri.EscapeDataString(ConvertToString(message, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (branch != null) + { + urlBuilder_.Append("branch=").Append(System.Uri.EscapeDataString(ConvertToString(branch, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (committername != null) + { + urlBuilder_.Append("committer[name]=").Append(System.Uri.EscapeDataString(ConvertToString(committername, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (committeremail != null) + { + urlBuilder_.Append("committer[email]=").Append(System.Uri.EscapeDataString(ConvertToString(committeremail, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (authorname != null) + { + urlBuilder_.Append("author[name]=").Append(System.Uri.EscapeDataString(ConvertToString(authorname, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (authoremail != null) + { + urlBuilder_.Append("author[email]=").Append(System.Uri.EscapeDataString(ConvertToString(authoremail, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(CommitContent); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(CommitContent); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取文件Blob + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoGitBlobsShaAsync(string access_token, string owner, string repo, string sha) + { + return GetV5ReposOwnerRepoGitBlobsShaAsync(access_token, owner, repo, sha, System.Threading.CancellationToken.None); + } + + /// 获取文件Blob + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 文件的 Blob SHA,可通过 [获取仓库具体路径下的内容] API 获取 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoGitBlobsShaAsync(string access_token, string owner, string repo, string sha, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (sha == null) + throw new System.ArgumentNullException("sha"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/git/blobs/{sha}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{sha}", System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Blob); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ == "404") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("\u6ca1\u6709\u76f8\u5173\u6570\u636e", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Blob); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取目录Tree(不支持跨域) + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 可以是分支名(如master)、Commit或者目录Tree的SHA值 + /// 赋值为1递归获取目录 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoGitTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive) + { + return GetV5ReposOwnerRepoGitTreesShaAsync(access_token, owner, repo, sha, recursive, System.Threading.CancellationToken.None); + } + + /// 获取目录Tree(不支持跨域) + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 可以是分支名(如master)、Commit或者目录Tree的SHA值 + /// 赋值为1递归获取目录 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoGitTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (sha == null) + throw new System.ArgumentNullException("sha"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/git/trees/{sha}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{sha}", System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (recursive != null) + { + urlBuilder_.Append("recursive=").Append(System.Uri.EscapeDataString(ConvertToString(recursive, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Tree); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ == "404") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("\u6ca1\u6709\u76f8\u5173\u6570\u636e", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ == "422") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("SHA\u503c\u5fc5\u987b\u4e3aCommit\u6216Tree\u7684", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Tree); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取目录Tree(支持跨域) + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 可以是分支名(如master)、Commit或者目录Tree的SHA值 + /// 赋值为1递归获取目录 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoGitGiteeTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive) + { + return GetV5ReposOwnerRepoGitGiteeTreesShaAsync(access_token, owner, repo, sha, recursive, System.Threading.CancellationToken.None); + } + + /// 获取目录Tree(支持跨域) + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 可以是分支名(如master)、Commit或者目录Tree的SHA值 + /// 赋值为1递归获取目录 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoGitGiteeTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (sha == null) + throw new System.ArgumentNullException("sha"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/git/gitee/trees/{sha}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{sha}", System.Uri.EscapeDataString(ConvertToString(sha, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (recursive != null) + { + urlBuilder_.Append("recursive=").Append(System.Uri.EscapeDataString(ConvertToString(recursive, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Tree); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ == "404") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("\u6ca1\u6709\u76f8\u5173\u6570\u636e", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ == "422") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("SHA\u503c\u5fc5\u987b\u4e3aCommit\u6216Tree\u7684", (int)response_.StatusCode, responseData_, headers_, null); + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Tree); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 仓库的所有Issues + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue的状态: open(开启的), closed(关闭的), rejected(拒绝的)。 默认: open + /// 用逗号分开的标签。如: bug,performance + /// 排序依据: 创建时间(created),更新时间(updated_at)。默认: created_at + /// 排序方式: 升序(asc),降序(desc)。默认: desc + /// 起始的更新时间,要求时间格式为 ISO 8601 + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 计划开始时间,格式:20181006T173008+80-20181007T173008+80(区间),或者 -20181007T173008+80(小于20181007T173008+80),或者 20181006T173008+80-(大于20181006T173008+80),要求时间格式为20181006T173008+80 + /// 计划截止时间,格式同上 + /// 任务创建时间,格式同上 + /// 任务完成时间,即任务最后一次转为已完成状态的时间点。格式同上 + /// 根据里程碑标题。none为没里程碑的,*为所有带里程碑的 + /// 用户的username。 none为没指派者, *为所有带有指派者的 + /// 创建Issues的用户username + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoIssuesAsync(string access_token, string owner, string repo, State? state, string labels, Sort? sort, Direction? direction, string since, int? page, int? per_page, string schedule, string deadline, string created_at, string finished_at, string milestone, string assignee, string creator) + { + return GetV5ReposOwnerRepoIssuesAsync(access_token, owner, repo, state, labels, sort, direction, since, page, per_page, schedule, deadline, created_at, finished_at, milestone, assignee, creator, System.Threading.CancellationToken.None); + } + + /// 仓库的所有Issues + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue的状态: open(开启的), closed(关闭的), rejected(拒绝的)。 默认: open + /// 用逗号分开的标签。如: bug,performance + /// 排序依据: 创建时间(created),更新时间(updated_at)。默认: created_at + /// 排序方式: 升序(asc),降序(desc)。默认: desc + /// 起始的更新时间,要求时间格式为 ISO 8601 + /// 当前的页码 + /// 每页的数量,最大为 100 + /// 计划开始时间,格式:20181006T173008+80-20181007T173008+80(区间),或者 -20181007T173008+80(小于20181007T173008+80),或者 20181006T173008+80-(大于20181006T173008+80),要求时间格式为20181006T173008+80 + /// 计划截止时间,格式同上 + /// 任务创建时间,格式同上 + /// 任务完成时间,即任务最后一次转为已完成状态的时间点。格式同上 + /// 根据里程碑标题。none为没里程碑的,*为所有带里程碑的 + /// 用户的username。 none为没指派者, *为所有带有指派者的 + /// 创建Issues的用户username + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoIssuesAsync(string access_token, string owner, string repo, State? state, string labels, Sort? sort, Direction? direction, string since, int? page, int? per_page, string schedule, string deadline, string created_at, string finished_at, string milestone, string assignee, string creator, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/issues?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (state != null) + { + urlBuilder_.Append("state=").Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (labels != null) + { + urlBuilder_.Append("labels=").Append(System.Uri.EscapeDataString(ConvertToString(labels, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append("sort=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (direction != null) + { + urlBuilder_.Append("direction=").Append(System.Uri.EscapeDataString(ConvertToString(direction, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (since != null) + { + urlBuilder_.Append("since=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (page != null) + { + urlBuilder_.Append("page=").Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (per_page != null) + { + urlBuilder_.Append("per_page=").Append(System.Uri.EscapeDataString(ConvertToString(per_page, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (schedule != null) + { + urlBuilder_.Append("schedule=").Append(System.Uri.EscapeDataString(ConvertToString(schedule, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (deadline != null) + { + urlBuilder_.Append("deadline=").Append(System.Uri.EscapeDataString(ConvertToString(deadline, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (created_at != null) + { + urlBuilder_.Append("created_at=").Append(System.Uri.EscapeDataString(ConvertToString(created_at, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (finished_at != null) + { + urlBuilder_.Append("finished_at=").Append(System.Uri.EscapeDataString(ConvertToString(finished_at, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (milestone != null) + { + urlBuilder_.Append("milestone=").Append(System.Uri.EscapeDataString(ConvertToString(milestone, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (assignee != null) + { + urlBuilder_.Append("assignee=").Append(System.Uri.EscapeDataString(ConvertToString(assignee, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (creator != null) + { + urlBuilder_.Append("creator=").Append(System.Uri.EscapeDataString(ConvertToString(creator, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 仓库的某个Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue 编号(区分大小写,无需添加 # 号) + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task GetV5ReposOwnerRepoIssuesNumberAsync(string access_token, string owner, string repo, string number) + { + return GetV5ReposOwnerRepoIssuesNumberAsync(access_token, owner, repo, number, System.Threading.CancellationToken.None); + } + + /// 仓库的某个Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue 编号(区分大小写,无需添加 # 号) + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task GetV5ReposOwnerRepoIssuesNumberAsync(string access_token, string owner, string repo, string number, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + if (number == null) + throw new System.ArgumentNullException("number"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/issues/{number}?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{number}", System.Uri.EscapeDataString(ConvertToString(number, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Issue); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Issue); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 创建Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue标题 + /// 企业自定义任务类型,非企业默认任务类型为“任务” + /// Issue描述 + /// Issue负责人的username + /// 里程碑序号 + /// 用逗号分开的标签。如: bug,performance + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PostV5ReposOwnerIssuesAsync(string access_token, string owner, string repo, string title, string issue_type, string body, string assignee, int? milestone, string labels) + { + return PostV5ReposOwnerIssuesAsync(access_token, owner, repo, title, issue_type, body, assignee, milestone, labels, System.Threading.CancellationToken.None); + } + + /// 创建Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue标题 + /// 企业自定义任务类型,非企业默认任务类型为“任务” + /// Issue描述 + /// Issue负责人的username + /// 里程碑序号 + /// 用逗号分开的标签。如: bug,performance + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PostV5ReposOwnerIssuesAsync(string access_token, string owner, string repo, string title, string issue_type, string body, string assignee, int? milestone, string labels, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/issues"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (repo != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture)), "repo"); + } + if (title == null) + throw new System.ArgumentNullException("title"); + else + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(title, System.Globalization.CultureInfo.InvariantCulture)), "title"); + } + if (issue_type != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(issue_type, System.Globalization.CultureInfo.InvariantCulture)), "issue_type"); + } + if (body != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(body, System.Globalization.CultureInfo.InvariantCulture)), "body"); + } + if (assignee != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(assignee, System.Globalization.CultureInfo.InvariantCulture)), "assignee"); + } + if (milestone != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(milestone, System.Globalization.CultureInfo.InvariantCulture)), "milestone"); + } + if (labels != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(labels, System.Globalization.CultureInfo.InvariantCulture)), "labels"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "201") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Issue); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Issue); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 更新Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue标题 + /// Issue 编号(区分大小写,无需添加 # 号) + /// Issue 状态,open(开启的)、closed(关闭的) + /// Issue描述 + /// Issue负责人的username + /// 里程碑序号 + /// 用逗号分开的标签。如: bug,performance + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task PatchV5ReposOwnerIssuesNumberAsync(string access_token, string owner, string repo, string title, string number, State2? state, string body, string assignee, int? milestone, string labels) + { + return PatchV5ReposOwnerIssuesNumberAsync(access_token, owner, repo, title, number, state, body, assignee, milestone, labels, System.Threading.CancellationToken.None); + } + + /// 更新Issue + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue标题 + /// Issue 编号(区分大小写,无需添加 # 号) + /// Issue 状态,open(开启的)、closed(关闭的) + /// Issue描述 + /// Issue负责人的username + /// 里程碑序号 + /// 用逗号分开的标签。如: bug,performance + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task PatchV5ReposOwnerIssuesNumberAsync(string access_token, string owner, string repo, string title, string number, State2? state, string body, string assignee, int? milestone, string labels, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (number == null) + throw new System.ArgumentNullException("number"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/issues/{number}"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{number}", System.Uri.EscapeDataString(ConvertToString(number, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var boundary_ = System.Guid.NewGuid().ToString(); + var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + if (access_token != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture)), "access_token"); + } + if (repo != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture)), "repo"); + } + if (title != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(title, System.Globalization.CultureInfo.InvariantCulture)), "title"); + } + if (state != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture)), "state"); + } + if (body != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(body, System.Globalization.CultureInfo.InvariantCulture)), "body"); + } + if (assignee != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(assignee, System.Globalization.CultureInfo.InvariantCulture)), "assignee"); + } + if (milestone != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(milestone, System.Globalization.CultureInfo.InvariantCulture)), "milestone"); + } + if (labels != null) + { + content_.Add(new System.Net.Http.StringContent(ConvertToString(labels, System.Globalization.CultureInfo.InvariantCulture)), "labels"); + } + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PATCH"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(Issue); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(Issue); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取某个Issue下的操作日志 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue 编号(区分大小写,无需添加 # 号) + /// 按递增(asc)或递减(desc)排序,默认:递减 + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerIssuesNumberOperateLogsAsync(string access_token, string owner, string repo, string number, Sort2? sort) + { + return GetV5ReposOwnerIssuesNumberOperateLogsAsync(access_token, owner, repo, number, sort, System.Threading.CancellationToken.None); + } + + /// 获取某个Issue下的操作日志 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// Issue 编号(区分大小写,无需添加 # 号) + /// 按递增(asc)或递减(desc)排序,默认:递减 + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerIssuesNumberOperateLogsAsync(string access_token, string owner, string repo, string number, Sort2? sort, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (number == null) + throw new System.ArgumentNullException("number"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/issues/{number}/operate_logs?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{number}", System.Uri.EscapeDataString(ConvertToString(number, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (repo != null) + { + urlBuilder_.Append("repo=").Append(System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (sort != null) + { + urlBuilder_.Append("sort=").Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection); + try + { + result_ = Newtonsoft.Json.JsonConvert.DeserializeObject>(responseData_, _settings.Value); + return result_; + } + catch (System.Exception exception_) + { + throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); + } + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(System.Collections.Generic.ICollection); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// 获取仓库所有任务标签 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 返回格式 + /// A server side error occurred. + public System.Threading.Tasks.Task> GetV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo) + { + return GetV5ReposOwnerRepoLabelsAsync(access_token, owner, repo, System.Threading.CancellationToken.None); + } + + /// 获取仓库所有任务标签 + /// 用户授权码 + /// 仓库所属个性域名(企业、组织或个人的地址path) + /// 仓库路径(path) + /// 返回格式 + /// A server side error occurred. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + public async System.Threading.Tasks.Task> GetV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo, System.Threading.CancellationToken cancellationToken) + { + if (owner == null) + throw new System.ArgumentNullException("owner"); + + if (repo == null) + throw new System.ArgumentNullException("repo"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/v5/repos/{owner}/{repo}/labels?"); + urlBuilder_.Replace("{owner}", System.Uri.EscapeDataString(ConvertToString(owner, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{repo}", System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))); + if (access_token != null) + { + urlBuilder_.Append("access_token=").Append(System.Uri.EscapeDataString(ConvertToString(access_token, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = default(System.Collections.Generic.ICollection