Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internalize ProductHeaderValue #406

Merged
merged 5 commits into from
Feb 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/BlobClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit;
using Octokit.Tests.Integration;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/BranchesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
3 changes: 1 addition & 2 deletions Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/CommitsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Tests.Integration;
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/FollowersClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Octokit;
Expand Down
3 changes: 1 addition & 2 deletions Octokit.Tests.Integration/Clients/GistsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/IssuesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
Expand Down
4 changes: 0 additions & 4 deletions Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/ReferencesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Helpers;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/TreeClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests.Integration/Clients/UsersClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq;
using System.Net;
using System.Net.Http.Headers;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Octokit;
using Octokit.Reactive;
using System;
using System.Net.Http.Headers;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Tests.Integration;
Expand Down
1 change: 0 additions & 1 deletion Octokit/GitHubClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using Octokit.Internal;

namespace Octokit
Expand Down
58 changes: 58 additions & 0 deletions Octokit/Http/ProductHeaderValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace Octokit
{
public class ProductHeaderValue
{
ProductHeaderValue() { }

public ProductHeaderValue(string name)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This curly brace is so far from his homies. Maybe remove that newline up there so he can be closer.


public ProductHeaderValue(string name, string value)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name, value);
}

System.Net.Http.Headers.ProductHeaderValue _productHeaderValue;

public string Name
{
get { return _productHeaderValue.Name; }
}

public string Version
{
get { return _productHeaderValue.Version; }
}

public override bool Equals(object obj)
{
return _productHeaderValue.Equals(obj);
}

public override int GetHashCode()
{
return _productHeaderValue.GetHashCode();
}

public override string ToString()
{
return _productHeaderValue.ToString();
}

public static ProductHeaderValue Parse(string input)
{
return new ProductHeaderValue { _productHeaderValue = System.Net.Http.Headers.ProductHeaderValue.Parse(input) };
}

public static bool TryParse(string input,
out ProductHeaderValue parsedValue)
{
System.Net.Http.Headers.ProductHeaderValue value;
var result = System.Net.Http.Headers.ProductHeaderValue.TryParse(input, out value);
parsedValue = result ? Parse(input) : null;
return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another lonely curly brase.

}
}
1 change: 1 addition & 0 deletions Octokit/Octokit-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
1 change: 1 addition & 0 deletions Octokit/Octokit-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Request\NewGist.cs" />
<Compile Include="Models\Request\GistUpdate.cs" />
<Compile Include="Models\Request\GistRequest.cs" />
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit-Monotouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Request\GistUpdate.cs" />
<Compile Include="Models\Request\GistRequest.cs" />
<Compile Include="Models\Request\NewGist.cs" />
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit-netcore45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
Expand Down
1 change: 1 addition & 0 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Compile Include="Exceptions\PrivateRepositoryQuotaExceededException.cs" />
<Compile Include="Exceptions\RepositoryExistsException.cs" />
<Compile Include="Helpers\ApiErrorExtensions.cs" />
<Compile Include="Http\ProductHeaderValue.cs" />
<Compile Include="Models\Response\DeploymentStatus.cs" />
<Compile Include="Clients\DeploymentStatusClient.cs" />
<Compile Include="Clients\IDeploymentStatusClient.cs" />
Expand Down
1 change: 0 additions & 1 deletion clean-up-after-tests/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Octokit;
Expand Down