From adfb50198ecc8293133e45b44ed9eefd2853cdd1 Mon Sep 17 00:00:00 2001 From: Haacked Date: Fri, 4 Oct 2013 10:01:20 -0700 Subject: [PATCH] Applying our private member naming convention Just trying to make @half-ogre happy --- .../Clients/ObservableAuthorizationsClient.cs | 14 ++++---- .../Clients/ObservableAutoCompleteClient.cs | 6 ++-- .../Clients/ObservableOrganizationsClient.cs | 10 +++--- .../Clients/ObservableRepositoriesClient.cs | 14 ++++---- .../Clients/ObservableSshKeysClient.cs | 16 +++++----- .../Clients/ObservableUsersClient.cs | 2 +- Octokit/ApiExtensions.cs | 4 --- Octokit/Clients/AutoCompleteClient.cs | 7 ++-- Octokit/Http/ApiConnection.cs | 6 ++-- Octokit/Http/ApiInfo.cs | 4 +-- Octokit/Http/ApiInfoParser.cs | 8 ++--- Octokit/Http/Connection.cs | 32 +++++++++---------- Octokit/Http/InMemoryCredentialStore.cs | 10 +++--- Octokit/Http/ReadOnlyPagedCollection.cs | 14 ++++---- 14 files changed, 71 insertions(+), 76 deletions(-) diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs index b22e0b5e..ec8047a9 100644 --- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs @@ -7,42 +7,42 @@ namespace Octokit.Reactive.Clients { public class ObservableAuthorizationsClient : IObservableAuthorizationsClient { - readonly IAuthorizationsClient client; + readonly IAuthorizationsClient _client; public ObservableAuthorizationsClient(IAuthorizationsClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable> GetAll() { - return client.GetAll().ToObservable(); + return _client.GetAll().ToObservable(); } public IObservable Get(int id) { - return client.Get(id).ToObservable(); + return _client.Get(id).ToObservable(); } public IObservable Update(int id, AuthorizationUpdate authorization) { Ensure.ArgumentNotNull(authorization, "authorization"); - return client.Update(id, authorization).ToObservable(); + return _client.Update(id, authorization).ToObservable(); } public IObservable Create(AuthorizationUpdate authorization) { Ensure.ArgumentNotNull(authorization, "authorization"); - return client.Create(authorization).ToObservable(); + return _client.Create(authorization).ToObservable(); } public IObservable Delete(int id) { - return client.Delete(id).ToObservable(); + return _client.Delete(id).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs b/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs index 0cf25d9d..b5928e70 100644 --- a/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs +++ b/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs @@ -6,18 +6,18 @@ namespace Octokit.Reactive.Clients { public class ObservableAutoCompleteClient : IObservableAutoCompleteClient { - readonly IAutoCompleteClient client; + readonly IAutoCompleteClient _client; public ObservableAutoCompleteClient(IAutoCompleteClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable> GetEmojis() { - return client.GetEmojis().ToObservable(); + return _client.GetEmojis().ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs index 3c81cc64..603ce86e 100644 --- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs @@ -6,32 +6,32 @@ namespace Octokit.Reactive.Clients { public class ObservableOrganizationsClient : IObservableOrganizationsClient { - readonly IOrganizationsClient client; + readonly IOrganizationsClient _client; public ObservableOrganizationsClient(IOrganizationsClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); - return client.Get(org).ToObservable(); + return _client.Get(org).ToObservable(); } public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } public IObservable> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return client.GetAll(user).ToObservable(); + return _client.GetAll(user).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index ffa04059..6cb4f752 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -6,13 +6,13 @@ namespace Octokit.Reactive.Clients { public class ObservableRepositoriesClient : IObservableRepositoriesClient { - readonly IRepositoriesClient client; + readonly IRepositoriesClient _client; public ObservableRepositoriesClient(IRepositoriesClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(string owner, string name) @@ -20,26 +20,26 @@ namespace Octokit.Reactive.Clients Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return client.Get(owner, name).ToObservable(); + return _client.Get(owner, name).ToObservable(); } public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } public IObservable> GetAllForUser(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); - return client.GetAllForUser(login).ToObservable(); + return _client.GetAllForUser(login).ToObservable(); } public IObservable> GetAllForOrg(string organization) { Ensure.ArgumentNotNullOrEmptyString(organization, "organization"); - return client.GetAllForOrg(organization).ToObservable(); + return _client.GetAllForOrg(organization).ToObservable(); } public IObservable GetReadme(string owner, string name) @@ -47,7 +47,7 @@ namespace Octokit.Reactive.Clients Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return client.GetReadme(owner, name).ToObservable(); + return _client.GetReadme(owner, name).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs index e5f0528d..f49dcfc9 100644 --- a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs +++ b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs @@ -7,49 +7,49 @@ namespace Octokit.Reactive.Clients { public class ObservableSshKeysClient : IObservableSshKeysClient { - readonly ISshKeysClient client; + readonly ISshKeysClient _client; public ObservableSshKeysClient(ISshKeysClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(int id) { - return client.Get(id).ToObservable(); + return _client.Get(id).ToObservable(); } public IObservable> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return client.GetAll(user).ToObservable(); + return _client.GetAll(user).ToObservable(); } public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } public IObservable Create(SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); - return client.Create(key).ToObservable(); + return _client.Create(key).ToObservable(); } public IObservable Update(int id, SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); - return client.Update(id, key).ToObservable(); + return _client.Update(id, key).ToObservable(); } public IObservable Delete(int id) { - return client.Delete(id).ToObservable(); + return _client.Delete(id).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableUsersClient.cs b/Octokit.Reactive/Clients/ObservableUsersClient.cs index e14c2f6c..700fdbb1 100644 --- a/Octokit.Reactive/Clients/ObservableUsersClient.cs +++ b/Octokit.Reactive/Clients/ObservableUsersClient.cs @@ -11,7 +11,7 @@ namespace Octokit.Reactive.Clients { Ensure.ArgumentNotNull(client, "client"); - this._client = client; + _client = client; } public IObservable Get(string login) diff --git a/Octokit/ApiExtensions.cs b/Octokit/ApiExtensions.cs index d813a203..41e1845f 100644 --- a/Octokit/ApiExtensions.cs +++ b/Octokit/ApiExtensions.cs @@ -1,8 +1,4 @@ using System; -using System.Globalization; -using System.Linq; -using System.Collections.Generic; -using System.Reflection; using System.Threading.Tasks; using Octokit.Http; diff --git a/Octokit/Clients/AutoCompleteClient.cs b/Octokit/Clients/AutoCompleteClient.cs index 01e13cd2..0b5430a7 100644 --- a/Octokit/Clients/AutoCompleteClient.cs +++ b/Octokit/Clients/AutoCompleteClient.cs @@ -12,18 +12,19 @@ namespace Octokit.Clients /// public class AutoCompleteClient : IAutoCompleteClient { - readonly IConnection connection; + readonly IConnection _connection; public AutoCompleteClient(IConnection connection) { Ensure.ArgumentNotNull(connection, "connection"); - this.connection = connection; + + _connection = connection; } public async Task> GetEmojis() { var endpoint = new Uri("/emojis", UriKind.Relative); - var response = await connection.GetAsync>(endpoint, null); + var response = await _connection.GetAsync>(endpoint, null); return new ReadOnlyDictionary( response.BodyAsObject.ToDictionary(kvp => kvp.Key, kvp => new Uri(kvp.Value))); } diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs index 2492b07c..26d7aab6 100644 --- a/Octokit/Http/ApiConnection.cs +++ b/Octokit/Http/ApiConnection.cs @@ -8,7 +8,7 @@ namespace Octokit.Http { public class ApiConnection : IApiConnection { - readonly IApiPagination pagination; + readonly IApiPagination _pagination; public ApiConnection(IConnection connection) : this(connection, new ApiPagination()) { @@ -20,7 +20,7 @@ namespace Octokit.Http Ensure.ArgumentNotNull(pagination, "pagination"); Connection = connection; - this.pagination = pagination; + _pagination = pagination; } protected IConnection Connection { get; private set; } @@ -52,7 +52,7 @@ namespace Octokit.Http { Ensure.ArgumentNotNull(endpoint, "endpoint"); - return await pagination.GetAllPages(async () => await GetPage(endpoint, parameters)); + return await _pagination.GetAllPages(async () => await GetPage(endpoint, parameters)); } public async Task Create(Uri endpoint, object data) diff --git a/Octokit/Http/ApiInfo.cs b/Octokit/Http/ApiInfo.cs index ab0f065c..1fcdbd36 100644 --- a/Octokit/Http/ApiInfo.cs +++ b/Octokit/Http/ApiInfo.cs @@ -10,8 +10,8 @@ namespace Octokit.Http public class ApiInfo { public ApiInfo(IDictionary links, - IList oauthScopes, - IList acceptedOauthScopes, + IEnumerable oauthScopes, + IEnumerable acceptedOauthScopes, string etag, int rateLimit, int rateLimitRemaining) diff --git a/Octokit/Http/ApiInfoParser.cs b/Octokit/Http/ApiInfoParser.cs index c457fe19..38e89157 100644 --- a/Octokit/Http/ApiInfoParser.cs +++ b/Octokit/Http/ApiInfoParser.cs @@ -16,8 +16,8 @@ namespace Octokit.Http #endif - readonly Regex linkRelRegex = new Regex("rel=\"(next|prev|first|last)\"", regexOptions); - readonly Regex linkUriRegex = new Regex("<(.+)>", regexOptions); + readonly Regex _linkRelRegex = new Regex("rel=\"(next|prev|first|last)\"", regexOptions); + readonly Regex _linkUriRegex = new Regex("<(.+)>", regexOptions); public void ParseApiHttpHeaders(IResponse response) { @@ -69,10 +69,10 @@ namespace Octokit.Http var links = response.Headers["Link"].Split(','); foreach (var link in links) { - var relMatch = linkRelRegex.Match(link); + var relMatch = _linkRelRegex.Match(link); if (!relMatch.Success || relMatch.Groups.Count != 2) break; - var uriMatch = linkUriRegex.Match(link); + var uriMatch = _linkUriRegex.Match(link); if (!uriMatch.Success || uriMatch.Groups.Count != 2) break; httpLinks.Add(relMatch.Groups[1].Value, new Uri(uriMatch.Groups[1].Value)); diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index e76c9fe5..007b3e8b 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -16,10 +16,10 @@ namespace Octokit.Http static readonly Uri defaultGitHubApiUrl = new Uri("https://api.github.com/"); static readonly ICredentialStore anonymousCredentials = new InMemoryCredentialStore(Credentials.Anonymous); - readonly Authenticator authenticator; - readonly IHttpClient httpClient; - readonly JsonHttpPipeline jsonPipeline; - readonly ApiInfoParser apiInfoParser; + readonly Authenticator _authenticator; + readonly IHttpClient _httpClient; + readonly JsonHttpPipeline _jsonPipeline; + readonly ApiInfoParser _apiInfoParser; public Connection(string userAgent) : this(userAgent, defaultGitHubApiUrl, anonymousCredentials) { @@ -64,10 +64,10 @@ namespace Octokit.Http UserAgent = userAgent; BaseAddress = baseAddress; - authenticator = new Authenticator(credentialStore); - this.httpClient = httpClient; - jsonPipeline = new JsonHttpPipeline(); - apiInfoParser = new ApiInfoParser(); + _authenticator = new Authenticator(credentialStore); + _httpClient = httpClient; + _jsonPipeline = new JsonHttpPipeline(); + _apiInfoParser = new ApiInfoParser(); } public async Task> GetAsync(Uri endpoint, IDictionary parameters) @@ -131,7 +131,7 @@ namespace Octokit.Http request.Headers[header.Key] = header.Value; } var response = await RunRequest(request); - jsonPipeline.DeserializeResponse(response); + _jsonPipeline.DeserializeResponse(response); return response; } @@ -172,7 +172,7 @@ namespace Octokit.Http public ICredentialStore CredentialStore { - get { return authenticator.CredentialStore; } + get { return _authenticator.CredentialStore; } } public Credentials Credentials @@ -182,7 +182,7 @@ namespace Octokit.Http set { Ensure.ArgumentNotNull(value, "value"); - authenticator.CredentialStore = new InMemoryCredentialStore(value); + _authenticator.CredentialStore = new InMemoryCredentialStore(value); } } @@ -194,9 +194,9 @@ namespace Octokit.Http async Task> Run(IRequest request) { - jsonPipeline.SerializeRequest(request); + _jsonPipeline.SerializeRequest(request); var response = await RunRequest(request); - jsonPipeline.DeserializeResponse(response); + _jsonPipeline.DeserializeResponse(response); return response; } @@ -204,9 +204,9 @@ namespace Octokit.Http async Task> RunRequest(IRequest request) { request.Headers.Add("User-Agent", UserAgent); - authenticator.Apply(request); - var response = await httpClient.Send(request); - apiInfoParser.ParseApiHttpHeaders(response); + _authenticator.Apply(request); + var response = await _httpClient.Send(request); + _apiInfoParser.ParseApiHttpHeaders(response); HandleErrors(response); return response; } diff --git a/Octokit/Http/InMemoryCredentialStore.cs b/Octokit/Http/InMemoryCredentialStore.cs index 78a433c5..622a3196 100644 --- a/Octokit/Http/InMemoryCredentialStore.cs +++ b/Octokit/Http/InMemoryCredentialStore.cs @@ -1,21 +1,19 @@ -using System.Threading.Tasks; - -namespace Octokit.Http +namespace Octokit.Http { public class InMemoryCredentialStore : ICredentialStore { - readonly Credentials credentials; + readonly Credentials _credentials; public InMemoryCredentialStore(Credentials credentials) { Ensure.ArgumentNotNull(credentials, "credentials"); - this.credentials = credentials; + _credentials = credentials; } public Credentials GetCredentials() { - return credentials; + return _credentials; } } } \ No newline at end of file diff --git a/Octokit/Http/ReadOnlyPagedCollection.cs b/Octokit/Http/ReadOnlyPagedCollection.cs index 37e23ff4..e631767b 100644 --- a/Octokit/Http/ReadOnlyPagedCollection.cs +++ b/Octokit/Http/ReadOnlyPagedCollection.cs @@ -6,8 +6,8 @@ namespace Octokit.Http { public class ReadOnlyPagedCollection : ReadOnlyCollection, IReadOnlyPagedCollection { - readonly IConnection connection; - readonly ApiInfo info; + readonly IConnection _connection; + readonly ApiInfo _info; public ReadOnlyPagedCollection(IResponse> response, IConnection connection) : base(response != null ? response.BodyAsObject : null) @@ -15,17 +15,17 @@ namespace Octokit.Http Ensure.ArgumentNotNull(response, "response"); Ensure.ArgumentNotNull(connection, "connection"); - this.connection = connection; - info = response.ApiInfo; + _connection = connection; + _info = response.ApiInfo; } public async Task> GetNextPage() { - var nextPageUrl = info.GetNextPageUrl(); + var nextPageUrl = _info.GetNextPageUrl(); if (nextPageUrl == null) return null; - var response = await connection.GetAsync>(nextPageUrl, null); - return new ReadOnlyPagedCollection(response, connection); + var response = await _connection.GetAsync>(nextPageUrl, null); + return new ReadOnlyPagedCollection(response, _connection); } } }