Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 18b1ce1

Browse files
authored
Merge branch 'master' into enhancement/1591-status-bar-open-PRs
2 parents ae74e33 + 25fae6b commit 18b1ce1

File tree

194 files changed

+8788
-2718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+8788
-2718
lines changed

GitHubVS.sln

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Logging", "src\GitHu
106106
EndProject
107107
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Services.Vssdk", "src\GitHub.Services.Vssdk\GitHub.Services.Vssdk.csproj", "{2D3D2834-33BE-45CA-B3CC-12F853557D7B}"
108108
EndProject
109+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Metrics", "Metrics", "{C2D88962-BD6B-4F11-B914-535B38377962}"
110+
EndProject
111+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetricsServer", "test\MetricsTests\MetricsServer\MetricsServer.csproj", "{14FDEE91-7301-4247-846C-049647BF8E99}"
112+
EndProject
113+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetricsTests", "test\MetricsTests\MetricsTests\MetricsTests.csproj", "{09313E65-7ADB-48C1-AD3A-572020C5BDCB}"
114+
EndProject
109115
Global
110116
GlobalSection(SolutionConfigurationPlatforms) = preSolution
111117
Debug|Any CPU = Debug|Any CPU
@@ -415,6 +421,26 @@ Global
415421
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.Release|Any CPU.Build.0 = Release|Any CPU
416422
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
417423
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
424+
{14FDEE91-7301-4247-846C-049647BF8E99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
425+
{14FDEE91-7301-4247-846C-049647BF8E99}.Debug|Any CPU.Build.0 = Debug|Any CPU
426+
{14FDEE91-7301-4247-846C-049647BF8E99}.DebugCodeAnalysis|Any CPU.ActiveCfg = Debug|Any CPU
427+
{14FDEE91-7301-4247-846C-049647BF8E99}.DebugCodeAnalysis|Any CPU.Build.0 = Debug|Any CPU
428+
{14FDEE91-7301-4247-846C-049647BF8E99}.DebugWithoutVsix|Any CPU.ActiveCfg = Debug|Any CPU
429+
{14FDEE91-7301-4247-846C-049647BF8E99}.DebugWithoutVsix|Any CPU.Build.0 = Debug|Any CPU
430+
{14FDEE91-7301-4247-846C-049647BF8E99}.Release|Any CPU.ActiveCfg = Release|Any CPU
431+
{14FDEE91-7301-4247-846C-049647BF8E99}.Release|Any CPU.Build.0 = Release|Any CPU
432+
{14FDEE91-7301-4247-846C-049647BF8E99}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
433+
{14FDEE91-7301-4247-846C-049647BF8E99}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
434+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
435+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
436+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.DebugCodeAnalysis|Any CPU.ActiveCfg = Debug|Any CPU
437+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.DebugCodeAnalysis|Any CPU.Build.0 = Debug|Any CPU
438+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.DebugWithoutVsix|Any CPU.ActiveCfg = Debug|Any CPU
439+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.DebugWithoutVsix|Any CPU.Build.0 = Debug|Any CPU
440+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
441+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.Release|Any CPU.Build.0 = Release|Any CPU
442+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
443+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
418444
EndGlobalSection
419445
GlobalSection(SolutionProperties) = preSolution
420446
HideSolutionNode = FALSE
@@ -438,5 +464,8 @@ Global
438464
{7B835A7D-CF94-45E8-B191-96F5A4FE26A8} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
439465
{110B206F-8554-4B51-BF86-94DAA32F5E26} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
440466
{17EB676B-BB91-48B5-AA59-C67695C647C2} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
467+
{C2D88962-BD6B-4F11-B914-535B38377962} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
468+
{14FDEE91-7301-4247-846C-049647BF8E99} = {C2D88962-BD6B-4F11-B914-535B38377962}
469+
{09313E65-7ADB-48C1-AD3A-572020C5BDCB} = {C2D88962-BD6B-4F11-B914-535B38377962}
441470
EndGlobalSection
442471
EndGlobal

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ Visit the [Contributor Guidelines](CONTRIBUTING.md) for details on how to contri
9898
Copyright 2015 - 2017 GitHub, Inc.
9999

100100
Licensed under the [MIT License](LICENSE.md)
101+

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2.4.4.{build}'
1+
version: '2.4.99.{build}'
22
skip_tags: true
33
install:
44
- ps: |

lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!*.nupkg
161 KB
Binary file not shown.

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@
4646
</PropertyGroup>
4747
<Import Project="$(SolutionDir)\src\common\signing.props" />
4848
<ItemGroup>
49+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
50+
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
51+
<Private>True</Private>
52+
</Reference>
53+
<Reference Include="Octokit.GraphQL, Version=0.0.2.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
54+
<HintPath>..\..\packages\Octokit.GraphQL.0.0.2-alpha\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
55+
<Private>True</Private>
56+
</Reference>
57+
<Reference Include="Octokit.GraphQL.Core, Version=0.0.2.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
58+
<HintPath>..\..\packages\Octokit.GraphQL.0.0.2-alpha\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
59+
<Private>True</Private>
60+
</Reference>
4961
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
5062
<HintPath>..\..\packages\Serilog.2.5.0\lib\net46\Serilog.dll</HintPath>
5163
<Private>True</Private>
@@ -66,6 +78,9 @@
6678
<Link>ApiClientConfiguration_User.cs</Link>
6779
</Compile>
6880
<Compile Include="ApiClientConfiguration_User.cs" Condition="$(Buildtype) != 'Internal'" />
81+
<Compile Include="GraphQLKeychainCredentialStore.cs" />
82+
<Compile Include="IGraphQLClientFactory.cs" />
83+
<Compile Include="GraphQLClientFactory.cs" />
6984
<Compile Include="IKeychain.cs" />
7085
<Compile Include="ILoginManager.cs" />
7186
<Compile Include="IOAuthCallbackListener.cs" />
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.ComponentModel.Composition;
3+
using System.Threading.Tasks;
4+
using GitHub.Models;
5+
using GitHub.Primitives;
6+
using Octokit.GraphQL;
7+
8+
namespace GitHub.Api
9+
{
10+
/// <summary>
11+
/// Creates GraphQL <see cref="Octokit.GraphQL.IConnection"/>s for querying the
12+
/// GitHub GraphQL API.
13+
/// </summary>
14+
[Export(typeof(IGraphQLClientFactory))]
15+
[PartCreationPolicy(CreationPolicy.Shared)]
16+
public class GraphQLClientFactory : IGraphQLClientFactory
17+
{
18+
readonly IKeychain keychain;
19+
readonly IProgram program;
20+
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="GraphQLClientFactory"/> class.
23+
/// </summary>
24+
/// <param name="keychain">The <see cref="IKeychain"/> to use.</param>
25+
/// <param name="program">The program details.</param>
26+
[ImportingConstructor]
27+
public GraphQLClientFactory(IKeychain keychain, IProgram program)
28+
{
29+
this.keychain = keychain;
30+
this.program = program;
31+
}
32+
33+
/// <inheirtdoc/>
34+
public Task<Octokit.GraphQL.IConnection> CreateConnection(HostAddress address)
35+
{
36+
var credentials = new GraphQLKeychainCredentialStore(keychain, address);
37+
var header = new ProductHeaderValue(program.ProductHeader.Name, program.ProductHeader.Version);
38+
return Task.FromResult<Octokit.GraphQL.IConnection>(new Connection(header, address.GraphQLUri, credentials));
39+
}
40+
}
41+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using GitHub.Extensions;
4+
using GitHub.Primitives;
5+
using Octokit.GraphQL;
6+
7+
namespace GitHub.Api
8+
{
9+
/// <summary>
10+
/// An Octokit.GraphQL credential store that reads from an <see cref="IKeychain"/>.
11+
/// </summary>
12+
public class GraphQLKeychainCredentialStore : ICredentialStore
13+
{
14+
readonly IKeychain keychain;
15+
readonly HostAddress address;
16+
17+
public GraphQLKeychainCredentialStore(IKeychain keychain, HostAddress address)
18+
{
19+
Guard.ArgumentNotNull(keychain, nameof(keychain));
20+
Guard.ArgumentNotNull(address, nameof(keychain));
21+
22+
this.keychain = keychain;
23+
this.address = address;
24+
}
25+
26+
public async Task<string> GetCredentials()
27+
{
28+
var userPass = await keychain.Load(address).ConfigureAwait(false);
29+
return userPass?.Item2;
30+
}
31+
}
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Threading.Tasks;
2+
using GitHub.Primitives;
3+
4+
namespace GitHub.Api
5+
{
6+
/// <summary>
7+
/// Creates GraphQL <see cref="Octokit.GraphQL.IConnection"/>s for querying the
8+
/// GitHub GraphQL API.
9+
/// </summary>
10+
public interface IGraphQLClientFactory
11+
{
12+
/// <summary>
13+
/// Creates a new <see cref="Octokit.GraphQL.IConnection"/>.
14+
/// </summary>
15+
/// <param name="address">The address of the server.</param>
16+
/// <returns>A task returning the created connection.</returns>
17+
Task<Octokit.GraphQL.IConnection> CreateConnection(HostAddress address);
18+
}
19+
}

src/GitHub.Api/packages.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
4+
<package id="Octokit.GraphQL" version="0.0.2-alpha" targetFramework="net461" />
35
<package id="Serilog" version="2.5.0" targetFramework="net461" />
46
</packages>

0 commit comments

Comments
 (0)