コード例 #1
0
        public static GitHubClient Create(Uri domain, Credentials credentials)
        {
            var networkActivityService = Locator.Current.GetService <INetworkActivityService>();
            var client     = new HttpClientAdapter(CreateMessageHandler);
            var httpClient = new OctokitNetworkClient(client, networkActivityService);

            var connection = new Connection(
                UserAgent,
                domain,
                new InMemoryCredentialStore(credentials),
                httpClient,
                new SimpleJsonSerializer());

            return(new GitHubClient(connection));
        }
コード例 #2
0
        public static GitHubClient Create(Uri domain, Credentials credentials)
        {
            // Decorate the HttpClient
            //IHttpClient httpClient = new HttpClientAdapter();
            //httpClient = new OctokitCacheClient(httpClient);
            var client = new HttpClientAdapter(CreateMessageHandler);
            var httpClient = new OctokitNetworkClient(client, Locator.Current.GetService<INetworkActivityService>());

            var connection = new Connection(
                new ProductHeaderValue("CodeHub"),
                domain,
                new InMemoryCredentialStore(credentials),
                httpClient,
                new SimpleJsonSerializer());
            return new GitHubClient(connection);
        }
コード例 #3
0
        public static GitHubClient Create(Uri domain, Credentials credentials)
        {
            // Decorate the HttpClient
            //IHttpClient httpClient = new HttpClientAdapter();
            //httpClient = new OctokitCacheClient(httpClient);
            var client     = new HttpClientAdapter(CreateMessageHandler);
            var httpClient = new OctokitNetworkClient(client, Locator.Current.GetService <INetworkActivityService>());

            var connection = new Connection(
                new ProductHeaderValue("CodeHub"),
                domain,
                new InMemoryCredentialStore(credentials),
                httpClient,
                new SimpleJsonSerializer());

            return(new GitHubClient(connection));
        }
コード例 #4
0
        public static GitHubClient Create(
            Uri domain,
            Credentials credentials,
            TimeSpan?requestTimeout = null)
        {
            var networkActivityService = Locator.Current.GetService <INetworkActivityService>();
            var client     = new HttpClientAdapter(CreateMessageHandler);
            var httpClient = new OctokitNetworkClient(client, networkActivityService);

            var connection = new Connection(
                UserAgent,
                domain,
                new InMemoryCredentialStore(credentials),
                httpClient,
                new SimpleJsonSerializer());

            var gitHubClient = new GitHubClient(connection);

            gitHubClient.SetRequestTimeout(requestTimeout ?? TimeSpan.FromSeconds(20));
            return(gitHubClient);
        }