Gitee.Api by maikebing

<PackageReference Include="Gitee.Api" Version="1.0.0" />

.NET API 847,872 bytes

 Client

public class Client
using Newtonsoft.Json; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Runtime.Serialization; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Gitee.Api { [GeneratedCode("NSwag", "12.0.14.0 (NJsonSchema v9.13.18.0 (Newtonsoft.Json v11.0.0.0))")] public class Client { private string _baseUrl = "gitee.com/api"; private HttpClient _httpClient; private Lazy<JsonSerializerSettings> _settings; public string BaseUrl { get { return _baseUrl; } set { _baseUrl = value; } } protected JsonSerializerSettings JsonSerializerSettings => _settings.Value; public Client(HttpClient httpClient) { _httpClient = httpClient; _settings = new Lazy<JsonSerializerSettings>(() => new JsonSerializerSettings()); } public Task<ICollection<Branch>> GetV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo) { return GetV5ReposOwnerRepoBranchesAsync(access_token, owner, repo, CancellationToken.None); } public async Task<ICollection<Branch>> GetV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/branches?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Branch>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<CompleteBranch> PostV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, string refs, string branch_name) { return PostV5ReposOwnerRepoBranchesAsync(access_token, owner, repo, refs, branch_name, CancellationToken.None); } public async Task<CompleteBranch> PostV5ReposOwnerRepoBranchesAsync(string access_token, string owner, string repo, string refs, string branch_name, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/branches"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (refs == null) throw new ArgumentNullException("refs"); multipartFormDataContent.Add(new StringContent(ConvertToString(refs, CultureInfo.InvariantCulture)), "refs"); if (branch_name != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(branch_name, CultureInfo.InvariantCulture)), "branch_name"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CompleteBranch>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("branch_name"); } } public Task<CompleteBranch> GetV5ReposOwnerRepoBranchesBranchAsync(string access_token, string owner, string repo, string branch) { return GetV5ReposOwnerRepoBranchesBranchAsync(access_token, owner, repo, branch, CancellationToken.None); } public async Task<CompleteBranch> GetV5ReposOwnerRepoBranchesBranchAsync(string access_token, string owner, string repo, string branch, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (branch == null) throw new ArgumentNullException("branch"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{branch}", Uri.EscapeDataString(ConvertToString(branch, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CompleteBranch>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<CompleteBranch> PutV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch) { return PutV5ReposOwnerRepoBranchesBranchProtectionAsync(access_token, owner, repo, branch, CancellationToken.None); } public async Task<CompleteBranch> PutV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (branch == null) throw new ArgumentNullException("branch"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}/protection"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{branch}", Uri.EscapeDataString(ConvertToString(branch, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CompleteBranch>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch) { return DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(access_token, owner, repo, branch, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoBranchesBranchProtectionAsync(string access_token, string owner, string repo, string branch, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (branch == null) throw new ArgumentNullException("branch"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/branches/{branch}/protection?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{branch}", Uri.EscapeDataString(ConvertToString(branch, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<ICollection<RepoCommit>> 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, CancellationToken.None); } public async Task<ICollection<RepoCommit>> GetV5ReposOwnerRepoCommitsAsync(string access_token, string owner, string repo, string sha, string path, string author, string since, string until, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/commits?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (sha != null) stringBuilder.Append("sha=").Append(Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))).Append("&"); if (path != null) stringBuilder.Append("path=").Append(Uri.EscapeDataString(ConvertToString(path, CultureInfo.InvariantCulture))).Append("&"); if (author != null) stringBuilder.Append("author=").Append(Uri.EscapeDataString(ConvertToString(author, CultureInfo.InvariantCulture))).Append("&"); if (since != null) stringBuilder.Append("since=").Append(Uri.EscapeDataString(ConvertToString(since, CultureInfo.InvariantCulture))).Append("&"); if (until != null) stringBuilder.Append("until=").Append(Uri.EscapeDataString(ConvertToString(until, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<RepoCommit>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<RepoCommit> GetV5ReposOwnerRepoCommitsShaAsync(string access_token, string owner, string repo, string sha) { return GetV5ReposOwnerRepoCommitsShaAsync(access_token, owner, repo, sha, CancellationToken.None); } public async Task<RepoCommit> GetV5ReposOwnerRepoCommitsShaAsync(string access_token, string owner, string repo, string sha, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (sha == null) throw new ArgumentNullException("sha"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/commits/{sha}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{sha}", Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<RepoCommit>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Compare> GetV5ReposOwnerRepoCompareBaseHeadAsync(string access_token, string owner, string repo, string base, string head) { return GetV5ReposOwnerRepoCompareBaseHeadAsync(access_token, owner, repo, base, head, CancellationToken.None); } public async Task<Compare> GetV5ReposOwnerRepoCompareBaseHeadAsync(string access_token, string owner, string repo, string base, string head, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (base == null) throw new ArgumentNullException("@base"); if (head == null) throw new ArgumentNullException("head"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/compare/{base}...{head}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{base}", Uri.EscapeDataString(ConvertToString(base, CultureInfo.InvariantCulture))); stringBuilder.Replace("{head}", Uri.EscapeDataString(ConvertToString(head, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Compare>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<SSHKey>> GetV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, int? page, int? per_page) { return GetV5ReposOwnerRepoKeysAsync(access_token, owner, repo, page, per_page, CancellationToken.None); } public async Task<ICollection<SSHKey>> GetV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<SSHKey>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<SSHKey> PostV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, string key, string title) { return PostV5ReposOwnerRepoKeysAsync(access_token, owner, repo, key, title, CancellationToken.None); } public async Task<SSHKey> PostV5ReposOwnerRepoKeysAsync(string access_token, string owner, string repo, string key, string title, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (key == null) throw new ArgumentNullException("key"); multipartFormDataContent.Add(new StringContent(ConvertToString(key, CultureInfo.InvariantCulture)), "key"); if (title != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(title, CultureInfo.InvariantCulture)), "title"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<SSHKey>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("title"); } } public Task<ICollection<SSHKeyBasic>> GetV5ReposOwnerRepoKeysAvailableAsync(string access_token, string owner, string repo, int? page, int? per_page) { return GetV5ReposOwnerRepoKeysAvailableAsync(access_token, owner, repo, page, per_page, CancellationToken.None); } public async Task<ICollection<SSHKeyBasic>> GetV5ReposOwnerRepoKeysAvailableAsync(string access_token, string owner, string repo, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys/available?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<SSHKeyBasic>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task PutV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id) { return PutV5ReposOwnerRepoKeysEnableIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task PutV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys/enable/{id}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PUT"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "204") return; if (a == "403") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有启用权限", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id) { return DeleteV5ReposOwnerRepoKeysEnableIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoKeysEnableIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys/enable/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关公钥", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<SSHKey> GetV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id) { return GetV5ReposOwnerRepoKeysIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task<SSHKey> GetV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<SSHKey>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id) { return DeleteV5ReposOwnerRepoKeysIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoKeysIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/keys/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<Content> GetV5ReposOwnerRepoReadmeAsync(string access_token, string owner, string repo, string ref) { return GetV5ReposOwnerRepoReadmeAsync(access_token, owner, repo, ref, CancellationToken.None); } public async Task<Content> GetV5ReposOwnerRepoReadmeAsync(string access_token, string owner, string repo, string ref, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/readme?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (ref != null) stringBuilder.Append("ref=").Append(Uri.EscapeDataString(ConvertToString(ref, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Content>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<Content>> GetV5ReposOwnerRepoContentsPath(string access_token, string owner, string repo, string path, string ref) { return GetV5ReposOwnerRepoContentsPathAsync(access_token, owner, repo, path, ref, CancellationToken.None); } public async Task<ICollection<Content>> GetV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string ref, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (path == null) throw new ArgumentNullException("path"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/contents(/{path})?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{path}", Uri.EscapeDataString(ConvertToString(path, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (ref != null) stringBuilder.Append("ref=").Append(Uri.EscapeDataString(ConvertToString(ref, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Content>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<CommitContent> 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, CancellationToken.None); } public async Task<CommitContent> PostV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string content, string message, string branch, string committername, string committeremail, string authorname, string authoremail, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (path == null) throw new ArgumentNullException("path"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/contents/{path}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{path}", Uri.EscapeDataString(ConvertToString(path, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (content == null) throw new ArgumentNullException("content"); multipartFormDataContent.Add(new StringContent(ConvertToString(content, CultureInfo.InvariantCulture)), "content"); if (message != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(message, CultureInfo.InvariantCulture)), "message"); if (branch != null) multipartFormDataContent.Add(new StringContent(ConvertToString(branch, CultureInfo.InvariantCulture)), "branch"); if (committername != null) multipartFormDataContent.Add(new StringContent(ConvertToString(committername, CultureInfo.InvariantCulture)), "committer[name]"); if (committeremail != null) multipartFormDataContent.Add(new StringContent(ConvertToString(committeremail, CultureInfo.InvariantCulture)), "committer[email]"); if (authorname != null) multipartFormDataContent.Add(new StringContent(ConvertToString(authorname, CultureInfo.InvariantCulture)), "author[name]"); if (authoremail != null) multipartFormDataContent.Add(new StringContent(ConvertToString(authoremail, CultureInfo.InvariantCulture)), "author[email]"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CommitContent>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("message"); } } public Task<CommitContent> 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, CancellationToken.None); } public async Task<CommitContent> 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, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (path == null) throw new ArgumentNullException("path"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/contents/{path}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{path}", Uri.EscapeDataString(ConvertToString(path, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (content == null) throw new ArgumentNullException("content"); multipartFormDataContent.Add(new StringContent(ConvertToString(content, CultureInfo.InvariantCulture)), "content"); if (sha == null) throw new ArgumentNullException("sha"); multipartFormDataContent.Add(new StringContent(ConvertToString(sha, CultureInfo.InvariantCulture)), "sha"); if (message != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(message, CultureInfo.InvariantCulture)), "message"); if (branch != null) multipartFormDataContent.Add(new StringContent(ConvertToString(branch, CultureInfo.InvariantCulture)), "branch"); if (committername != null) multipartFormDataContent.Add(new StringContent(ConvertToString(committername, CultureInfo.InvariantCulture)), "committer[name]"); if (committeremail != null) multipartFormDataContent.Add(new StringContent(ConvertToString(committeremail, CultureInfo.InvariantCulture)), "committer[email]"); if (authorname != null) multipartFormDataContent.Add(new StringContent(ConvertToString(authorname, CultureInfo.InvariantCulture)), "author[name]"); if (authoremail != null) multipartFormDataContent.Add(new StringContent(ConvertToString(authoremail, CultureInfo.InvariantCulture)), "author[email]"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CommitContent>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("message"); } } public Task<CommitContent> 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, CancellationToken.None); } public async Task<CommitContent> DeleteV5ReposOwnerRepoContentsPathAsync(string access_token, string owner, string repo, string path, string sha, string message, string branch, string committername, string committeremail, string authorname, string authoremail, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (path == null) throw new ArgumentNullException("path"); if (sha == null) throw new ArgumentNullException("sha"); if (message == null) throw new ArgumentNullException("message"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/contents/{path}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{path}", Uri.EscapeDataString(ConvertToString(path, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); stringBuilder.Append("sha=").Append(Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))).Append("&"); stringBuilder.Append("message=").Append(Uri.EscapeDataString(ConvertToString(message, CultureInfo.InvariantCulture))).Append("&"); if (branch != null) stringBuilder.Append("branch=").Append(Uri.EscapeDataString(ConvertToString(branch, CultureInfo.InvariantCulture))).Append("&"); if (committername != null) stringBuilder.Append("committer[name]=").Append(Uri.EscapeDataString(ConvertToString(committername, CultureInfo.InvariantCulture))).Append("&"); if (committeremail != null) stringBuilder.Append("committer[email]=").Append(Uri.EscapeDataString(ConvertToString(committeremail, CultureInfo.InvariantCulture))).Append("&"); if (authorname != null) stringBuilder.Append("author[name]=").Append(Uri.EscapeDataString(ConvertToString(authorname, CultureInfo.InvariantCulture))).Append("&"); if (authoremail != null) stringBuilder.Append("author[email]=").Append(Uri.EscapeDataString(ConvertToString(authoremail, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<CommitContent>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Blob> GetV5ReposOwnerRepoGitBlobsShaAsync(string access_token, string owner, string repo, string sha) { return GetV5ReposOwnerRepoGitBlobsShaAsync(access_token, owner, repo, sha, CancellationToken.None); } public async Task<Blob> GetV5ReposOwnerRepoGitBlobsShaAsync(string access_token, string owner, string repo, string sha, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (sha == null) throw new ArgumentNullException("sha"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/git/blobs/{sha}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{sha}", Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Blob>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Tree> GetV5ReposOwnerRepoGitTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive) { return GetV5ReposOwnerRepoGitTreesShaAsync(access_token, owner, repo, sha, recursive, CancellationToken.None); } public async Task<Tree> GetV5ReposOwnerRepoGitTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (sha == null) throw new ArgumentNullException("sha"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/git/trees/{sha}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{sha}", Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (recursive.HasValue) stringBuilder.Append("recursive=").Append(Uri.EscapeDataString(ConvertToString(recursive, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Tree>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a == "422") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "SHA值必须为Commit或Tree的", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Tree> GetV5ReposOwnerRepoGitGiteeTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive) { return GetV5ReposOwnerRepoGitGiteeTreesShaAsync(access_token, owner, repo, sha, recursive, CancellationToken.None); } public async Task<Tree> GetV5ReposOwnerRepoGitGiteeTreesShaAsync(string access_token, string owner, string repo, string sha, int? recursive, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (sha == null) throw new ArgumentNullException("sha"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/git/gitee/trees/{sha}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{sha}", Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (recursive.HasValue) stringBuilder.Append("recursive=").Append(Uri.EscapeDataString(ConvertToString(recursive, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Tree>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a == "422") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "SHA值必须为Commit或Tree的", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<Issue>> 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, CancellationToken.None); } public async Task<ICollection<Issue>> 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, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (state.HasValue) stringBuilder.Append("state=").Append(Uri.EscapeDataString(ConvertToString(state, CultureInfo.InvariantCulture))).Append("&"); if (labels != null) stringBuilder.Append("labels=").Append(Uri.EscapeDataString(ConvertToString(labels, CultureInfo.InvariantCulture))).Append("&"); if (sort.HasValue) stringBuilder.Append("sort=").Append(Uri.EscapeDataString(ConvertToString(sort, CultureInfo.InvariantCulture))).Append("&"); if (direction.HasValue) stringBuilder.Append("direction=").Append(Uri.EscapeDataString(ConvertToString(direction, CultureInfo.InvariantCulture))).Append("&"); if (since != null) stringBuilder.Append("since=").Append(Uri.EscapeDataString(ConvertToString(since, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); if (schedule != null) stringBuilder.Append("schedule=").Append(Uri.EscapeDataString(ConvertToString(schedule, CultureInfo.InvariantCulture))).Append("&"); if (deadline != null) stringBuilder.Append("deadline=").Append(Uri.EscapeDataString(ConvertToString(deadline, CultureInfo.InvariantCulture))).Append("&"); if (created_at != null) stringBuilder.Append("created_at=").Append(Uri.EscapeDataString(ConvertToString(created_at, CultureInfo.InvariantCulture))).Append("&"); if (finished_at != null) stringBuilder.Append("finished_at=").Append(Uri.EscapeDataString(ConvertToString(finished_at, CultureInfo.InvariantCulture))).Append("&"); if (milestone != null) stringBuilder.Append("milestone=").Append(Uri.EscapeDataString(ConvertToString(milestone, CultureInfo.InvariantCulture))).Append("&"); if (assignee != null) stringBuilder.Append("assignee=").Append(Uri.EscapeDataString(ConvertToString(assignee, CultureInfo.InvariantCulture))).Append("&"); if (creator != null) stringBuilder.Append("creator=").Append(Uri.EscapeDataString(ConvertToString(creator, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Issue>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Issue> GetV5ReposOwnerRepoIssuesNumberAsync(string access_token, string owner, string repo, string number) { return GetV5ReposOwnerRepoIssuesNumberAsync(access_token, owner, repo, number, CancellationToken.None); } public async Task<Issue> GetV5ReposOwnerRepoIssuesNumberAsync(string access_token, string owner, string repo, string number, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Issue>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Issue> 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, CancellationToken.None); } public async Task<Issue> PostV5ReposOwnerIssuesAsync(string access_token, string owner, string repo, string title, string issue_type, string body, string assignee, int? milestone, string labels, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/issues"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (repo != null) multipartFormDataContent.Add(new StringContent(ConvertToString(repo, CultureInfo.InvariantCulture)), "repo"); if (title != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(title, CultureInfo.InvariantCulture)), "title"); if (issue_type != null) multipartFormDataContent.Add(new StringContent(ConvertToString(issue_type, CultureInfo.InvariantCulture)), "issue_type"); if (body != null) multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); if (assignee != null) multipartFormDataContent.Add(new StringContent(ConvertToString(assignee, CultureInfo.InvariantCulture)), "assignee"); if (milestone.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(milestone, CultureInfo.InvariantCulture)), "milestone"); if (labels != null) multipartFormDataContent.Add(new StringContent(ConvertToString(labels, CultureInfo.InvariantCulture)), "labels"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Issue>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("title"); } } public Task<Issue> 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, CancellationToken.None); } public async Task<Issue> PatchV5ReposOwnerIssuesNumberAsync(string access_token, string owner, string repo, string title, string number, State2? state, string body, string assignee, int? milestone, string labels, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/issues/{number}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (repo != null) multipartFormDataContent.Add(new StringContent(ConvertToString(repo, CultureInfo.InvariantCulture)), "repo"); if (title != null) multipartFormDataContent.Add(new StringContent(ConvertToString(title, CultureInfo.InvariantCulture)), "title"); if (state.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(state, CultureInfo.InvariantCulture)), "state"); if (body != null) multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); if (assignee != null) multipartFormDataContent.Add(new StringContent(ConvertToString(assignee, CultureInfo.InvariantCulture)), "assignee"); if (milestone.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(milestone, CultureInfo.InvariantCulture)), "milestone"); if (labels != null) multipartFormDataContent.Add(new StringContent(ConvertToString(labels, CultureInfo.InvariantCulture)), "labels"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PATCH"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Issue>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<OperateLog>> GetV5ReposOwnerIssuesNumberOperateLogsAsync(string access_token, string owner, string repo, string number, Sort2? sort) { return GetV5ReposOwnerIssuesNumberOperateLogsAsync(access_token, owner, repo, number, sort, CancellationToken.None); } public async Task<ICollection<OperateLog>> GetV5ReposOwnerIssuesNumberOperateLogsAsync(string access_token, string owner, string repo, string number, Sort2? sort, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/issues/{number}/operate_logs?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (repo != null) stringBuilder.Append("repo=").Append(Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))).Append("&"); if (sort.HasValue) stringBuilder.Append("sort=").Append(Uri.EscapeDataString(ConvertToString(sort, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<OperateLog>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<Label>> GetV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo) { return GetV5ReposOwnerRepoLabelsAsync(access_token, owner, repo, CancellationToken.None); } public async Task<ICollection<Label>> GetV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/labels?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Label>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Label> PostV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo, string name, string color) { return PostV5ReposOwnerRepoLabelsAsync(access_token, owner, repo, name, color, CancellationToken.None); } public async Task<Label> PostV5ReposOwnerRepoLabelsAsync(string access_token, string owner, string repo, string name, string color, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/labels"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (name == null) throw new ArgumentNullException("name"); multipartFormDataContent.Add(new StringContent(ConvertToString(name, CultureInfo.InvariantCulture)), "name"); if (color != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(color, CultureInfo.InvariantCulture)), "color"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Label>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("color"); } } public Task<Label> GetV5ReposOwnerRepoLabelsNameAsync(string access_token, string owner, string repo, string name) { return GetV5ReposOwnerRepoLabelsNameAsync(access_token, owner, repo, name, CancellationToken.None); } public async Task<Label> GetV5ReposOwnerRepoLabelsNameAsync(string access_token, string owner, string repo, string name, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (name == null) throw new ArgumentNullException("name"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/labels/{name}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{name}", Uri.EscapeDataString(ConvertToString(name, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Label>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoLabelsNameAsync(string access_token, string owner, string repo, string name) { return DeleteV5ReposOwnerRepoLabelsNameAsync(access_token, owner, repo, name, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoLabelsNameAsync(string access_token, string owner, string repo, string name, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (name == null) throw new ArgumentNullException("name"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/labels/{name}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{name}", Uri.EscapeDataString(ConvertToString(name, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<Label> PatchV5ReposOwnerRepoLabelsOriginalNameAsync(string access_token, string owner, string repo, string original_name, string name, string color) { return PatchV5ReposOwnerRepoLabelsOriginalNameAsync(access_token, owner, repo, original_name, name, color, CancellationToken.None); } public async Task<Label> PatchV5ReposOwnerRepoLabelsOriginalNameAsync(string access_token, string owner, string repo, string original_name, string name, string color, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (original_name == null) throw new ArgumentNullException("original_name"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/labels/{original_name}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{original_name}", Uri.EscapeDataString(ConvertToString(original_name, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (name != null) multipartFormDataContent.Add(new StringContent(ConvertToString(name, CultureInfo.InvariantCulture)), "name"); if (color != null) multipartFormDataContent.Add(new StringContent(ConvertToString(color, CultureInfo.InvariantCulture)), "color"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PATCH"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Label>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<ICollection<Label>> GetV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number) { return GetV5ReposOwnerRepoIssuesNumberLabelsAsync(access_token, owner, repo, number, CancellationToken.None); } public async Task<ICollection<Label>> GetV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/labels?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Label>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Label> PostV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, IEnumerable<string> body) { return PostV5ReposOwnerRepoIssuesNumberLabelsAsync(access_token, owner, repo, number, body, CancellationToken.None); } public async Task<Label> PostV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, IEnumerable<string> body, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/labels"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { StringContent stringContent = new StringContent(JsonConvert.SerializeObject(body, _settings.Value)); stringContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); request_.Content = stringContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Label>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Label> PutV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, IEnumerable<string> body) { return PutV5ReposOwnerRepoIssuesNumberLabelsAsync(access_token, owner, repo, number, body, CancellationToken.None); } public async Task<Label> PutV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, IEnumerable<string> body, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/labels"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { StringContent stringContent = new StringContent(JsonConvert.SerializeObject(body, _settings.Value)); stringContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); request_.Content = stringContent; request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Label>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number) { return DeleteV5ReposOwnerRepoIssuesNumberLabelsAsync(access_token, owner, repo, number, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoIssuesNumberLabelsAsync(string access_token, string owner, string repo, string number, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/labels?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task DeleteV5ReposOwnerRepoIssuesNumberLabelsNameAsync(string access_token, string owner, string repo, string number, string name) { return DeleteV5ReposOwnerRepoIssuesNumberLabelsNameAsync(access_token, owner, repo, number, name, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoIssuesNumberLabelsNameAsync(string access_token, string owner, string repo, string number, string name, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); if (name == null) throw new ArgumentNullException("name"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/labels/{name}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); stringBuilder.Replace("{name}", Uri.EscapeDataString(ConvertToString(name, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<ICollection<Milestone>> GetV5ReposOwnerRepoMilestonesAsync(string access_token, string owner, string repo, State3? state, Sort3? sort, string direction, int? page, int? per_page) { return GetV5ReposOwnerRepoMilestonesAsync(access_token, owner, repo, state, sort, direction, page, per_page, CancellationToken.None); } public async Task<ICollection<Milestone>> GetV5ReposOwnerRepoMilestonesAsync(string access_token, string owner, string repo, State3? state, Sort3? sort, string direction, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/milestones?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (state.HasValue) stringBuilder.Append("state=").Append(Uri.EscapeDataString(ConvertToString(state, CultureInfo.InvariantCulture))).Append("&"); if (sort.HasValue) stringBuilder.Append("sort=").Append(Uri.EscapeDataString(ConvertToString(sort, CultureInfo.InvariantCulture))).Append("&"); if (direction != null) stringBuilder.Append("direction=").Append(Uri.EscapeDataString(ConvertToString(direction, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<ICollection<Milestone>>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Milestone> PostV5ReposOwnerRepoMilestonesAsync(string access_token, string owner, string repo, string title, State4? state, string description, string due_on) { return PostV5ReposOwnerRepoMilestonesAsync(access_token, owner, repo, title, state, description, due_on, CancellationToken.None); } public async Task<Milestone> PostV5ReposOwnerRepoMilestonesAsync(string access_token, string owner, string repo, string title, State4? state, string description, string due_on, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/milestones"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (title == null) throw new ArgumentNullException("title"); multipartFormDataContent.Add(new StringContent(ConvertToString(title, CultureInfo.InvariantCulture)), "title"); if (state.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(state, CultureInfo.InvariantCulture)), "state"); if (description != null) multipartFormDataContent.Add(new StringContent(ConvertToString(description, CultureInfo.InvariantCulture)), "description"); if (due_on != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(due_on, CultureInfo.InvariantCulture)), "due_on"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Milestone>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("due_on"); } } public Task<Milestone> GetV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number) { return GetV5ReposOwnerRepoMilestonesNumberAsync(access_token, owner, repo, number, CancellationToken.None); } public async Task<Milestone> GetV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/milestones/{number}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Milestone>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Milestone> PatchV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number, string title, State5? state, string description, string due_on) { return PatchV5ReposOwnerRepoMilestonesNumberAsync(access_token, owner, repo, number, title, state, description, due_on, CancellationToken.None); } public async Task<Milestone> PatchV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number, string title, State5? state, string description, string due_on, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/milestones/{number}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (title == null) throw new ArgumentNullException("title"); multipartFormDataContent.Add(new StringContent(ConvertToString(title, CultureInfo.InvariantCulture)), "title"); if (state.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(state, CultureInfo.InvariantCulture)), "state"); if (description != null) multipartFormDataContent.Add(new StringContent(ConvertToString(description, CultureInfo.InvariantCulture)), "description"); if (due_on != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(due_on, CultureInfo.InvariantCulture)), "due_on"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PATCH"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Milestone>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("due_on"); } } public Task DeleteV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number) { return DeleteV5ReposOwnerRepoMilestonesNumberAsync(access_token, owner, repo, number, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoMilestonesNumberAsync(string access_token, string owner, string repo, int number, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/milestones/{number}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task GetV5ReposOwnerRepoLicenseAsync(string access_token, string owner, string repo) { return GetV5ReposOwnerRepoLicenseAsync(access_token, owner, repo, CancellationToken.None); } public async Task GetV5ReposOwnerRepoLicenseAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/license?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") return; if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<Note> GetV5ReposOwnerRepoCommentsAsync(string access_token, string owner, string repo, int? page, int? per_page) { return GetV5ReposOwnerRepoCommentsAsync(access_token, owner, repo, page, per_page, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoCommentsAsync(string access_token, string owner, string repo, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/comments?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> GetV5ReposOwnerRepoCommitsRefCommentsAsync(string access_token, string owner, string repo, string ref, int? page, int? per_page) { return GetV5ReposOwnerRepoCommitsRefCommentsAsync(access_token, owner, repo, ref, page, per_page, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoCommitsRefCommentsAsync(string access_token, string owner, string repo, string ref, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (ref == null) throw new ArgumentNullException("@ref"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/commits/{ref}/comments?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{ref}", Uri.EscapeDataString(ConvertToString(ref, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> GetV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id) { return GetV5ReposOwnerRepoCommentsIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/comments/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> PatchV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id, string body) { return PatchV5ReposOwnerRepoCommentsIdAsync(access_token, owner, repo, id, body, CancellationToken.None); } public async Task<Note> PatchV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id, string body, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/comments/{id}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (body != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PATCH"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("body"); } } public Task DeleteV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id) { return DeleteV5ReposOwnerRepoCommentsIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoCommentsIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/comments/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<Note> PostV5ReposOwnerRepoCommitsShaCommentsAsync(string access_token, string owner, string repo, string sha, string body, string path, int? position) { return PostV5ReposOwnerRepoCommitsShaCommentsAsync(access_token, owner, repo, sha, body, path, position, CancellationToken.None); } public async Task<Note> PostV5ReposOwnerRepoCommitsShaCommentsAsync(string access_token, string owner, string repo, string sha, string body, string path, int? position, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (sha == null) throw new ArgumentNullException("sha"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/commits/{sha}/comments"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{sha}", Uri.EscapeDataString(ConvertToString(sha, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (body != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); if (path != null) multipartFormDataContent.Add(new StringContent(ConvertToString(path, CultureInfo.InvariantCulture)), "path"); if (position.HasValue) multipartFormDataContent.Add(new StringContent(ConvertToString(position, CultureInfo.InvariantCulture)), "position"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("body"); } } public Task<Note> GetV5ReposOwnerRepoIssuesCommentsAsync(string access_token, string owner, string repo, Sort4? sort, Direction2? direction, string since, int? page, int? per_page) { return GetV5ReposOwnerRepoIssuesCommentsAsync(access_token, owner, repo, sort, direction, since, page, per_page, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoIssuesCommentsAsync(string access_token, string owner, string repo, Sort4? sort, Direction2? direction, string since, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/comments?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (sort.HasValue) stringBuilder.Append("sort=").Append(Uri.EscapeDataString(ConvertToString(sort, CultureInfo.InvariantCulture))).Append("&"); if (direction.HasValue) stringBuilder.Append("direction=").Append(Uri.EscapeDataString(ConvertToString(direction, CultureInfo.InvariantCulture))).Append("&"); if (since != null) stringBuilder.Append("since=").Append(Uri.EscapeDataString(ConvertToString(since, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> GetV5ReposOwnerRepoIssuesNumberCommentsAsync(string access_token, string owner, string repo, string number, string since, int? page, int? per_page) { return GetV5ReposOwnerRepoIssuesNumberCommentsAsync(access_token, owner, repo, number, since, page, per_page, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoIssuesNumberCommentsAsync(string access_token, string owner, string repo, string number, string since, int? page, int? per_page, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/comments?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); if (since != null) stringBuilder.Append("since=").Append(Uri.EscapeDataString(ConvertToString(since, CultureInfo.InvariantCulture))).Append("&"); if (page.HasValue) stringBuilder.Append("page=").Append(Uri.EscapeDataString(ConvertToString(page, CultureInfo.InvariantCulture))).Append("&"); if (per_page.HasValue) stringBuilder.Append("per_page=").Append(Uri.EscapeDataString(ConvertToString(per_page, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> PostV5ReposOwnerRepoIssuesNumberCommentsAsync(string access_token, string owner, string repo, string number, string body) { return PostV5ReposOwnerRepoIssuesNumberCommentsAsync(access_token, owner, repo, number, body, CancellationToken.None); } public async Task<Note> PostV5ReposOwnerRepoIssuesNumberCommentsAsync(string access_token, string owner, string repo, string number, string body, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); if (number == null) throw new ArgumentNullException("number"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/{number}/comments"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{number}", Uri.EscapeDataString(ConvertToString(number, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (body != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("body"); } } public Task<Note> GetV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id) { return GetV5ReposOwnerRepoIssuesCommentsIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task<Note> GetV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/comments/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a == "404") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "没有相关数据", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Note> PatchV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id, string body) { return PatchV5ReposOwnerRepoIssuesCommentsIdAsync(access_token, owner, repo, id, body, CancellationToken.None); } public async Task<Note> PatchV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id, string body, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/comments/{id}"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); if (body != null) { multipartFormDataContent.Add(new StringContent(ConvertToString(body, CultureInfo.InvariantCulture)), "body"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("PATCH"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "200") { string text2 = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Note>(text2, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text2, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } throw new ArgumentNullException("body"); } } public Task DeleteV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id) { return DeleteV5ReposOwnerRepoIssuesCommentsIdAsync(access_token, owner, repo, id, CancellationToken.None); } public async Task DeleteV5ReposOwnerRepoIssuesCommentsIdAsync(string access_token, string owner, string repo, int id, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/issues/comments/{id}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("DELETE"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "204") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task GetV5ReposOwnerRepoPagesAsync(string access_token, string owner, string repo) { return GetV5ReposOwnerRepoPagesAsync(access_token, owner, repo, CancellationToken.None); } public async Task GetV5ReposOwnerRepoPagesAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/pages?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task PostV5ReposOwnerRepoPagesBuildsAsync(string access_token, string owner, string repo) { return PostV5ReposOwnerRepoPagesBuildsAsync(access_token, owner, repo, CancellationToken.None); } public async Task PostV5ReposOwnerRepoPagesBuildsAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}/pages/builds"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { string text = Guid.NewGuid().ToString(); MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(text); multipartFormDataContent.Headers.Remove("Content-Type"); multipartFormDataContent.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + text); if (access_token != null) multipartFormDataContent.Add(new StringContent(ConvertToString(access_token, CultureInfo.InvariantCulture)), "access_token"); request_.Content = multipartFormDataContent; request_.Method = new HttpMethod("POST"); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } string a = ((int)response_.StatusCode).ToString(); if (a == "201") return; if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); } finally { response_?.Dispose(); } } } public Task<Project> GetV5ReposOwnerRepoAsync(string access_token, string owner, string repo) { return GetV5ReposOwnerRepoAsync(access_token, owner, repo, CancellationToken.None); } public async Task<Project> GetV5ReposOwnerRepoAsync(string access_token, string owner, string repo, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd(new char[1] { '/' }) : "").Append("/v5/repos/{owner}/{repo}?"); stringBuilder.Replace("{owner}", Uri.EscapeDataString(ConvertToString(owner, CultureInfo.InvariantCulture))); stringBuilder.Replace("{repo}", Uri.EscapeDataString(ConvertToString(repo, CultureInfo.InvariantCulture))); if (access_token != null) stringBuilder.Append("access_token=").Append(Uri.EscapeDataString(ConvertToString(access_token, CultureInfo.InvariantCulture))).Append("&"); int num = stringBuilder.Length--; HttpClient httpClient = _httpClient; using (HttpRequestMessage request_ = new HttpRequestMessage()) { request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); string uriString = stringBuilder.ToString(); request_.RequestUri = new Uri(uriString, UriKind.RelativeOrAbsolute); HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers) { headers_[header.Key] = header.Value; } } num = (int)response_.StatusCode; string a = num.ToString(); if (a == "200") { string text = (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null; try { return JsonConvert.DeserializeObject<Project>(text, _settings.Value); } catch (Exception innerException) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, text, headers_, innerException); } } if (a != "200" && a != "204") throw new SwaggerException(response: (response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(false)) : null, message: "The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", statusCode: (int)response_.StatusCode, headers: headers_, innerException: null); return null; } finally { response_?.Dispose(); } } } public Task<Project> PatchV5ReposOwnerRepoAsync(string access_token, string owner, string repo, string name, string description, string homepage, bool? has_issues, bool? has_wiki, bool? private, string default_branch) { return PatchV5ReposOwnerRepoAsync(access_token, owner, repo, name, description, homepage, has_issues, has_wiki, private, default_branch, CancellationToken.None); } public async Task<Project> PatchV5ReposOwnerRepoAsync(string access_token, string owner, string repo, string name, string description, string homepage, bool? has_issues, bool? has_wiki, bool? private, string default_branch, CancellationToken cancellationToken) { if (owner == null) throw new ArgumentNullException("owner"); if (repo == null) throw new ArgumentNullException("repo");