Exemplo n.º 1
0
        /// <summary>
        /// Creates a JIRA rest client using OAuth authentication protocol.
        /// </summary>
        /// <param name="url">Url to the JIRA server.</param>
        /// <param name="consumerKey">The consumer key provided by the Jira application link.</param>
        /// <param name="consumerSecret">The consumer public key in XML format.</param>
        /// <param name="oAuthAccessToken">The access token provided by Jira after the request token has been authorize.</param>
        /// <param name="oAuthTokenSecret">The token secret provided by Jira when asking for a request token.</param>
        /// <param name="oAuthSignatureMethod">The signature method used to generate the request token.</param>
        /// <param name="settings">Settings to configure the rest client.</param>
        /// <returns>Jira object configured to use REST API.</returns>
        public static Jira CreateOAuthRestClient(
            string url,
            string consumerKey,
            string consumerSecret,
            string oAuthAccessToken,
            string oAuthTokenSecret,
            JiraOAuthSignatureMethod oAuthSignatureMethod = JiraOAuthSignatureMethod.RsaSha1,
            JiraRestClientSettings settings = null)
        {
            settings = settings ?? new JiraRestClientSettings();
            var restClient = new JiraOAuthRestClient(
                url,
                consumerKey,
                consumerSecret,
                oAuthAccessToken,
                oAuthTokenSecret,
                oAuthSignatureMethod,
                settings);

            return(CreateRestClient(restClient));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a JIRA rest client.
        /// </summary>
        /// <param name="url">Url to the JIRA server.</param>
        /// <param name="username">Username used to authenticate.</param>
        /// <param name="password">Password used to authenticate.</param>
        /// <param name="settings">Settings to configure the rest client.</param>
        /// <returns>Jira object configured to use REST API.</returns>
        public static Jira CreateRestClient(string url, string username = null, string password = null, JiraRestClientSettings settings = null)
        {
            var services = new ServiceLocator();

            settings = settings ?? new JiraRestClientSettings();
            var jira       = new Jira(services, new JiraCredentials(username, password), settings.Cache);
            var restClient = new JiraRestClient(url, username, password, settings);

            ConfigureDefaultServices(services, jira, restClient);

            return(jira);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a JIRA rest client.
        /// </summary>
        /// <param name="url">Url to the JIRA server.</param>
        /// <param name="username">Username used to authenticate.</param>
        /// <param name="password">Password used to authenticate.</param>
        /// <param name="settings">Settings to configure the rest client.</param>
        /// <returns>Jira object configured to use REST API.</returns>
        public static Jira CreateRestClient(string url, string username = null, string password = null, JiraRestClientSettings settings = null)
        {
            settings = settings ?? new JiraRestClientSettings();
            var restClient = new JiraRestClient(url, username, password, settings);

            return(CreateRestClient(restClient));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a JIRA client configured to use the REST API.
        /// </summary>
        /// <param name="url">Url to the JIRA server.</param>
        /// <param name="username">Username used to authenticate.</param>
        /// <param name="password">Password used to authenticate.</param>
        /// <param name="settings">Settings to configure the rest client.</param>
        /// <returns>Jira object configured to use REST API.</returns>
        public static Jira CreateRestClient(string url, string username = null, string password = null, JiraRestClientSettings settings = null)
        {
            Jira jira    = null;
            var  options = new JiraRestClient.Options()
            {
                Url                = url,
                Username           = username,
                Password           = password,
                RestClientSettings = settings ?? new JiraRestClientSettings(),
                GetCurrentJiraFunc = () => jira
            };

            var restClient = new JiraRestClient(options);

            jira = CreateRestClient(restClient, new JiraCredentials(username, password), options.RestClientSettings.Cache);

            return(jira);
        }