コード例 #1
0
        /// <summary>
        /// Build the OAuthFlow instance.
        /// </summary>
        /// <returns> the OAuthFlow instance </returns>
        /// <exception cref="System.InvalidOperationException"> if ClientId, ClientSecret or RedirectURL isn't set yet. </exception>
        public virtual OAuthFlow Build()
        {
            if (httpClient == null)
            {
                httpClient = new DefaultHttpClient();
            }

            if (tokenURL == null)
            {
                tokenURL = DEFAULT_TOKEN_URL;
            }

            if (authorizationURL == null)
            {
                authorizationURL = DEFAULT_AUTHORIZATION_URL;
            }

            if (jsonSerializer == null)
            {
                jsonSerializer = new JsonNetSerializer();
            }

            if (clientId == null || clientSecret == null || redirectURL == null)
            {
                throw new InvalidOperationException();
            }

            return(new OAuthFlowImpl(clientId, clientSecret, redirectURL, authorizationURL, tokenURL, httpClient, jsonSerializer));
        }
コード例 #2
0
        /// <summary>
        /// Set the HttpClient.
        /// </summary>
        /// <param name="httpClient"> the HttpClient </param>
        /// <returns> the OAuthFlowBuilder </returns>
        public virtual OAuthFlowBuilder SetHttpClient(HttpClient httpClient)
        {
            Util.ThrowIfNull(httpClient);

            this.httpClient = httpClient;
            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Set the HttpClient.
        /// </summary>
        /// <param name="httpClient"> the HttpClient </param>
        /// <returns> the OAuthFlowBuilder </returns>
        public virtual OAuthFlowBuilder SetHttpClient(HttpClient httpClient)
        {
            Util.ThrowIfNull(httpClient);

            this.httpClient = httpClient;
            return this;
        }
コード例 #4
0
        /// <summary>
        /// Build the OAuthFlow instance.
        /// </summary>
        /// <returns> the OAuthFlow instance </returns>
        /// <exception cref="System.InvalidOperationException"> if ClientId, ClientSecret or RedirectURL isn't set yet. </exception>
        public virtual OAuthFlow Build()
        {
            if (httpClient == null)
            {
                httpClient = new DefaultHttpClient();
            }

            if (tokenURL == null)
            {
                tokenURL = DEFAULT_TOKEN_URL;
            }

            if (authorizationURL == null)
            {
                authorizationURL = DEFAULT_AUTHORIZATION_URL;
            }

            if (jsonSerializer == null)
            {
                jsonSerializer = new JsonNetSerializer();
            }

            if (clientId == null || clientSecret == null || redirectURL == null)
            {
                throw new InvalidOperationException();
            }

            return new OAuthFlowImpl(clientId, clientSecret, redirectURL, authorizationURL, tokenURL, httpClient, jsonSerializer);
        }