Example #1
0
        public BaseService()
        {
            const string host = "";
            const string apiKey = "";

            RedmineService = new RedmineManager(host, apiKey);
        }
Example #2
0
 public void Should_Connect_With_Api_Key()
 {
     var a = new RedmineManager(Helper.Uri, Helper.ApiKey);
     var currentUser = a.GetCurrentUser();
     Assert.NotNull(currentUser);
     Assert.True(currentUser.ApiKey.Equals(Helper.ApiKey),"api keys not equals.");
 }
Example #3
0
 public void Should_Connect_With_Username_And_Password()
 {
     var a = new RedmineManager(Helper.Uri, Helper.Username, Helper.Password);
     var currentUser = a.GetCurrentUser();
     Assert.NotNull(currentUser);
     Assert.True(currentUser.Login.Equals(Helper.Username), "usernames not equals.");
 }
        public ProjectManagerGateway(RedmineSettings redmineSettings)
        {
            Require.NotNull(redmineSettings, nameof(redmineSettings));

            _redmineSettings = redmineSettings;
            _redmineManager = new RedmineManager(redmineSettings.RedmineHost, redmineSettings.ApiKey);
        }
        public bool Create()
        {
            try
            {
                RedmineManager manager = new RedmineManager(Configuration.RedmineHost,
                    Configuration.RedmineUser, Configuration.RedminePassword);

                //Create a issue.
                var newIssue = new Issue
                {
                    Subject = Title,
                    Description = Description,
                    Project = new IdentifiableName() { Id = ProjectId },
                    Tracker = new IdentifiableName() { Id = TrackerId }
                };

                User thisuser = (from u in manager.GetObjectList<User>(new System.Collections.Specialized.NameValueCollection())
                                 where u.Login == Configuration.RedmineUser
                                 select u).FirstOrDefault();
                if (thisuser != null)
                    newIssue.AssignedTo = new IdentifiableName() { Id = thisuser.Id };

                manager.CreateObject(newIssue);
            }
            catch { return false; }
            return true;
        }
Example #6
0
        private static bool GetCredentialsIfNeeded(Configuration configuration)
        {
            if (configuration.OpenTickets)
            {
                // Get use name and password
                Console.Write("Redmine Username: "******"Redmine password: ");
                _password = Console.ReadLine();

                _redmineManager = new RedmineManager(configuration.RedmineUrl, _user, _password);
                try
                {
                    _redmineManager.GetCurrentUser();
                    return true;
                }
                catch (RedmineException)
                {
                    return false;
                }
            }

            return true;
        }
		public RedmineSettings()
		{
			buffer = RedmineDataBuffer.Read();
			if (buffer == null) {
				//means no settings where saved until now...
				buffer = new RedmineDataBuffer();
			}
			manager = null;
		}
Example #8
0
 public Client(string login, string password, string host)
 {
     this.login = login;
     this.password = password;
     this.host = host;
     manager = new RedmineManager(host, login, password);
     cacheissue = this.GetTotalIssue();
     totalissue = this.GetTotalIssue();
     totalproject = this.GetTotalProject();
     projects = this.GetProjects();
     _instance = this;
 }
Example #9
0
        public static Dictionary<string, int> GetProjects()
        {
            RedmineManager manager = new RedmineManager(Configuration.RedmineHost,
                Configuration.RedmineUser, Configuration.RedminePassword);
            Dictionary<string, int> Projects = new Dictionary<string, int>();

            foreach (Project proj in manager.GetObjectList<Project>(new NameValueCollection()))
            {
                Projects.Add(proj.Name, proj.Id);
            }
            return Projects;
        }
Example #10
0
        public static Dictionary<string, int> GetTrackers()
        {
            RedmineManager manager = new RedmineManager(Configuration.RedmineHost,
                Configuration.RedmineUser, Configuration.RedminePassword);
            Dictionary<string, int> Trackers = new Dictionary<string, int>();

            foreach (Tracker track in manager.GetObjectList<Tracker>(new NameValueCollection()))
            {
                Trackers.Add(track.Name, track.Id);
            }
            return Trackers;
        }
		private RedmineManager getManager() {
			if (manager == null) {
				try {
					manager = new RedmineManager(buffer.host, buffer.apikey);
					System.Net.ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
				} catch (Redmine.Net.Api.RedmineException e) {
					MessageBox.Show(e.Message,"Connection Error.");
					manager = null;
				}
			}
			return manager;			
		}
Example #12
0
        public static void ConnectRMServer(RMConnectCmdletBase cmdlet)
        {
//            Redmine.Net.Api.RedmineWebClient client =
//                new RedmineWebClient();
//            client.
                
            string host = "";
            string apiKey = "";

            var manager = new RedmineManager(host, apiKey);

//            var parameters = new NameValueCollection {{"status_id", "*"}};
//            foreach (var issue in manager.GetObjectList<Issue>(parameters))
//            {
//                Console.WriteLine("#{0}: {1}", issue.Id, issue.Subject);
//            }
//
//            //Create a issue.
//            var newIssue = new Issue { Subject = "test", Project = new IdentifiableName{Id =  1}};
//            manager.CreateObject(newIssue);
        }
Example #13
0
        private void AddToList(RedmineManager manager)
        {
            var textData = textBox.Text;

            foreach (var issue in list)
            {
                var s = issue.Tracker.ToString();
                s = s.Remove(0, 3);

                string vParsed = "";
                var v = issue.FixedVersion;

                if (v != null)
                    vParsed = v.ToString().Remove(0, 3);

                if (string.IsNullOrWhiteSpace(textData))
                    listBox.Items.Add("#" + issue.Id + ": " + s + " - " + issue.Subject + " " + vParsed);
                else
                    if (vParsed.Contains(textData))
                    listBox.Items.Add("#" + issue.Id + ": " + s + " - " + issue.Subject + " " + vParsed);
            }
        }
Example #14
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            JasonInformations info = new JasonInformations();

            var manager = new RedmineManager(info.host, textBoxUser.Text, passwordBox.Password);
            var parameters = new NameValueCollection { { "status_id", "*" }, { "limit", "100" } };

            try
            {
                var test = manager.GetObjectList<Issue>(parameters).ToList();
                MainWindow win2 = new MainWindow();
                win2.manager = manager;
                win2.subject = info.subject;
                win2.list = test;
                win2.info = info.destinatari;
                win2.Show();
                this.Close();
            }
            catch (Exception )
            {
                labelErrore.Visibility = Visibility.Visible;
                this.Show();
            }
        }
Example #15
0
 public BaseService(string host, string apiKey)
 {
     RedmineService = new RedmineManager(host, apiKey);
 }
Example #16
0
 private Boolean connectRedmine(String url)
 {
     try
     {
         var parameters = new NameValueCollection { { "name", "*" } };
         redmine = new RedmineManager(url, parser.apiKey);
         redmine.GetObjectList<Project>(parameters);
         return true;
     }
     catch (RedmineException error)
     {
         Console.WriteLine(error);
         return false;
     }
 }
Example #17
0
 /// <summary>
 /// Uploads the file asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="data">The data.</param>
 /// <param name="fileName"></param>
 /// <returns></returns>
 public static Task <Upload> UploadFileAsync(this RedmineManager redmineManager, byte[] data)
 {
     return(delegate { return redmineManager.UploadFile(data); });
 }
Example #18
0
 private void SetMimeTypeJSON()
 {
     redmineManager = new RedmineManager(uri, apiKey, MimeFormat.json);
 }
        private void LoadLoggerData()
        {
            _manager = new RedmineManager(Settings.HostUrl, Settings.UserApiKey); //, MimeFormat.xml, true, CultureInfo.GetCultureInfo("es-MX"));

            _manager.DownloadCompleted += ManagerDownloadCompleted;

            BusyOperations++;
            _manager.GetCurrentUserAsync();
        }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RedmineManagerInstance"/> class.
 /// </summary>
 /// <param name="address">
 /// The host address.
 /// </param>
 /// <param name="apiKey">
 /// The api key.
 /// </param>
 /// <param name="limit">the limit to use</param>
 public RedmineManagerInstance(string address, string apiKey, int limit = 100)
 {
     this._redmineApi          = new RedmineManager(address, apiKey);
     this._redmineApi.PageSize = 50;
     this.Limit = limit;
 }
Example #21
0
 /// <summary>
 /// Adds the user to group asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="groupId">The group identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public static Task AddUserToGroupAsync(this RedmineManager redmineManager, int groupId, int userId)
 {
     return(delegate { redmineManager.AddUserToGroup(groupId, userId); });
 }
Example #22
0
 /// <summary>
 /// Gets all wiki pages asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <returns></returns>
 public static Task <IList <WikiPage> > GetAllWikiPagesAsync(this RedmineManager redmineManager,
                                                             NameValueCollection parameters, string projectId)
 {
     return(delegate { return redmineManager.GetAllWikiPages(projectId); });
 }
Example #23
0
 /// <summary>
 /// Gets the wiki page asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="pageName">Name of the page.</param>
 /// <param name="version">The version.</param>
 /// <returns></returns>
 public static Task <WikiPage> GetWikiPageAsync(this RedmineManager redmineManager, string projectId,
                                                NameValueCollection parameters, string pageName, uint version = 0)
 {
     return(delegate { return redmineManager.GetWikiPage(projectId, parameters, pageName, version); });
 }
Example #24
0
 /// <summary>
 /// Deletes the wiki page asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="pageName">Name of the page.</param>
 /// <returns></returns>
 public static Task DeleteWikiPageAsync(this RedmineManager redmineManager, string projectId, string pageName)
 {
     return(delegate { redmineManager.DeleteWikiPage(projectId, pageName); });
 }
Example #25
0
 /// <summary>
 /// Creates the or update wiki page asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="pageName">Name of the page.</param>
 /// <param name="wikiPage">The wiki page.</param>
 /// <returns></returns>
 public static Task <WikiPage> CreateOrUpdateWikiPageAsync(this RedmineManager redmineManager, string projectId,
                                                           string pageName, WikiPage wikiPage)
 {
     return(delegate { return redmineManager.CreateOrUpdateWikiPage(projectId, pageName, wikiPage); });
 }
Example #26
0
 /// <summary>
 /// Gets the current user asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <User> GetCurrentUserAsync(this RedmineManager redmineManager,
                                               NameValueCollection parameters = null)
 {
     return(delegate { return redmineManager.GetCurrentUser(parameters); });
 }
Example #27
0
 /// <summary>
 /// Downloads the file asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="address">The address.</param>
 /// <returns></returns>
 public static Task <byte[]> DownloadFileAsync(this RedmineManager redmineManager, string address)
 {
     return(delegate { return redmineManager.DownloadFile(address); });
 }
Example #28
0
 /// <summary>
 /// Adds the watcher to issue asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="issueId">The issue identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public static Task AddWatcherToIssueAsync(this RedmineManager redmineManager, int issueId, int userId)
 {
     return(delegate { redmineManager.AddWatcherToIssue(issueId, userId); });
 }
Example #29
0
 /// <summary>
 /// Removes the user from group asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="groupId">The group identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public static Task RemoveUserFromGroupAsync(this RedmineManager redmineManager, int groupId, int userId)
 {
     return(delegate { redmineManager.RemoveUserFromGroup(groupId, userId); });
 }
Example #30
0
 public RedmineRepository(string host, string login, string password)
 {
     _rm = new RedmineManager(host, login, password);
 }
 /// <summary>
 /// Deletes the wiki page asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="pageName">Name of the page.</param>
 /// <returns></returns>
 public static Task DeleteWikiPageAsync(this RedmineManager redmineManager, string projectId, string pageName)
 {
     return(Task.Factory.StartNew(() => redmineManager.DeleteWikiPage(projectId, pageName), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default));
 }
Example #32
0
 public RedmineRepository(string host, string apiKey)
 {
     _rm = new RedmineManager(host, apiKey);
 }
Example #33
0
 private void SetMimeTypeJSON()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey, MimeFormat.json);
 }
 private void SetMimeTypeXML()
 {
     RedmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey);
 }
 public void Initialize()
 {
     var uri = ConfigurationManager.AppSettings["uri"];
     var apiKey = ConfigurationManager.AppSettings["apiKey"];
     redmineManager = new RedmineManager(uri, apiKey);
 }
Example #36
0
 private void SetMimeTypeJSON()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey, MimeFormat.json);
 }
        public void RedmineUser_ShouldCompareUsers()
        {
            RedmineManager redmineSecondManager;

            #if JSON
                redmineSecondManager = new RedmineManager(uri, apiKey, MimeFormat.xml);
            #else
                redmineSecondManager = new RedmineManager(uri, apiKey, MimeFormat.json);
            #endif

            User user = redmineManager.GetObject<User>(userId, new NameValueCollection { { "include", "groups,memberships" } });
            User secondUser = redmineSecondManager.GetObject<User>(userId, new NameValueCollection { { "include", "groups,memberships" } });

            Assert.IsTrue(user.Equals(secondUser));
        }
Example #38
0
 private void SetMimeTypeXML()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey, MimeFormat.xml);
 }
Example #39
0
 public BaseService(string host, string login, string password)
 {
     RedmineService = new RedmineManager(host, login, password);
 }
        /// <summary>
        ///     Gets all wiki pages asynchronous.
        /// </summary>
        /// <param name="redmineManager">The redmine manager.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="projectId">The project identifier.</param>
        /// <returns></returns>
        public static async Task <List <WikiPage> > GetAllWikiPagesAsync(this RedmineManager redmineManager, NameValueCollection parameters, string projectId)
        {
            var uri = UrlHelper.GetWikisUrl(redmineManager, projectId);

            return(await WebApiAsyncHelper.ExecuteDownloadList <WikiPage>(redmineManager, uri, "GetAllWikiPagesAsync", parameters).ConfigureAwait(false));
        }
Example #41
0
 /// <summary>
 /// Removes the watcher from issue asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="issueId">The issue identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public static Task RemoveWatcherFromIssueAsync(this RedmineManager redmineManager, int issueId, int userId)
 {
     return(delegate { redmineManager.RemoveWatcherFromIssue(issueId, userId); });
 }
 /// <summary>
 ///     Removes an user from a group. This method does not block the calling thread.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="groupId">The group id.</param>
 /// <param name="userId">The user id.</param>
 /// <returns></returns>
 public static async Task DeleteUserFromGroupAsync(this RedmineManager redmineManager, int groupId, int userId)
 {
     var uri = UrlHelper.GetRemoveUserFromGroupUrl(redmineManager, groupId, userId);
     await WebApiAsyncHelper.ExecuteUpload(redmineManager, uri, HttpVerbs.DELETE, string.Empty, "DeleteUserFromGroupAsync").ConfigureAwait(false);
 }
Example #43
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="redmineConfiguration"></param>
 public RedmineLogWriter(RedmineConfiguration redmineConfiguration)
 {
     this._redmineConfiguration = redmineConfiguration;
     this._redmineManager = new RedmineManager(this._redmineConfiguration.HostAddress, this._redmineConfiguration.ApiKey);
 }
 /// <summary>
 ///     Removes the watcher asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="issueId">The issue identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public static async Task RemoveWatcherAsync(this RedmineManager redmineManager, int issueId, int userId)
 {
     var uri = UrlHelper.GetRemoveWatcherUrl(redmineManager, issueId, userId);
     await WebApiAsyncHelper.ExecuteUpload(redmineManager, uri, HttpVerbs.DELETE, string.Empty, "RemoveWatcherAsync").ConfigureAwait(false);
 }
		public void resetConnection() {
			manager = null;			
		}
 /// <summary>
 /// Gets the current user asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <User> GetCurrentUserAsync(this RedmineManager redmineManager, NameValueCollection parameters = null)
 {
     return(Task.Factory.StartNew(() => redmineManager.GetCurrentUser(parameters), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default));
 }
 public RedmineServices(string host, string apiKey)
 {
     manager = new RedmineManager(host, apiKey);
 }
 /// <summary>
 ///     Creates a new Redmine object. This method does not block the calling thread.
 /// </summary>
 /// <typeparam name="T">The type of object to create.</typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="obj">The object to create.</param>
 /// <returns></returns>
 public static async Task <T> CreateObjectAsync <T>(this RedmineManager redmineManager, T obj)
     where T : class, new()
 {
     return(await CreateObjectAsync(redmineManager, obj, null).ConfigureAwait(false));
 }
 /// <summary>
 /// Gets the wiki page asynchronous.
 /// </summary>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="pageName">Name of the page.</param>
 /// <param name="version">The version.</param>
 /// <returns></returns>
 public static Task <WikiPage> GetWikiPageAsync(this RedmineManager redmineManager, string projectId, NameValueCollection parameters, string pageName, uint version = 0)
 {
     return(Task.Factory.StartNew(() => redmineManager.GetWikiPage(projectId, parameters, pageName, version), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default));
 }
Example #50
0
 /// <summary>
 /// Updates the object asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="obj">The object.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <returns></returns>
 public static Task UpdateObjectAsync <T>(this RedmineManager redmineManager, string id, T obj,
                                          string projectId = null) where T : class, new()
 {
     return(delegate { redmineManager.UpdateObject(id, obj, projectId); });
 }
Example #51
0
 private void SetMimeTypeXml()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey);
 }
Example #52
0
 /// <summary>
 /// Gets the objects asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <List <T> > GetObjectsAsync <T>(this RedmineManager redmineManager,
                                                    NameValueCollection parameters) where T : class, new()
 {
     return(delegate { return redmineManager.GetObjects <T>(parameters); });
 }
Example #53
0
 public void Initialize()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey);
 }
Example #54
0
 /// <summary>
 /// Creates the object asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="obj">The object.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <returns></returns>
 public static Task <T> CreateObjectAsync <T>(this RedmineManager redmineManager, T obj, string ownerId)
     where T : class, new()
 {
     return(delegate { return redmineManager.CreateObject(obj, ownerId); });
 }
Example #55
0
 private void SetMimeTypeXML()
 {
     redmineManager = new RedmineManager(Helper.Uri, Helper.ApiKey, MimeFormat.xml);
 }
Example #56
0
 /// <summary>
 /// Creates the object asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="obj">The object.</param>
 /// <returns></returns>
 public static Task <T> CreateObjectAsync <T>(this RedmineManager redmineManager, T obj) where T : class, new()
 {
     return(CreateObjectAsync(redmineManager, obj, null));
 }
Example #57
0
 private void SetMimeTypeXML()
 {
     redmineManager = new RedmineManager(uri, apiKey, MimeFormat.xml);
 }
 private void SetMimeTypeXML()
 {
     redmineManager = new RedmineManager(uri, apiKey);
 }
        /// <summary>
        ///     Gets the paginated objects asynchronous.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="redmineManager">The redmine manager.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public static async Task <PaginatedObjects <T> > GetPaginatedObjectsAsync <T>(this RedmineManager redmineManager,
                                                                                      NameValueCollection parameters)
            where T : class, new()
        {
            var uri = UrlHelper.GetListUrl <T>(redmineManager, parameters);

            return(await WebApiAsyncHelper.ExecuteDownloadPaginatedList <T>(redmineManager, uri, "GetPaginatedObjectsAsync", parameters).ConfigureAwait(false));
        }
Example #60
0
 /// <summary>
 /// Deletes the object asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task DeleteObjectAsync <T>(this RedmineManager redmineManager, string id,
                                          NameValueCollection parameters) where T : class, new()
 {
     return(delegate { redmineManager.DeleteObject <T>(id); });
 }