I've released a new open source project named MantisSharp, a simple .NET client for working with the recently introduced REST API for Mantis Bug Tracker.
The library is just getting started and is missing various functions (hello documentation!) but it seems to be usable - as well as the WinForms sample browser that I was using for development testing, I also tested it in an ASP.NET MVC application, both locally and then remotely using the development version of cyotek.com.
It's probably not ready for prime time, I need to add docs, samples and finally get serious about using await/async, plus get a .NET Standard build done. But I think it's getting off to a good start.
The GitHub repository can be found at https://github.com/cyotek/MantisSharp - the readme has lots of extra details so I'm not going to repeat it here.
Why create this library?
Originally I wanted to use the MantisBT REST API to automatically generate the product roadmaps on cyotek.com - currently these are manual, and looking at the last modification dates on the content entries shows the latest update was in 2015. Ouch. As I've been properly planning releases in our MantisBT instance, it made sense to use that data. However, I don't want to open access (anonymous or otherwise) to the MantisBT instance itself, hence deciding to use the new API they added recently.
I wasn't planning create a full blown library, I thought I'd just load the JSON into a dynamic
and grab what I needed that way. But that untyped code offended me so much (and oddly enough there didn't seem to be another client out there from a very brief check of NuGet) that in the end it was inevitable.
Assuming more than just me uses this library I'd love to hear your feedback.
Getting Started
As well as the source, you can grab precompiled binaries via a NuGet package
Install-Package MantisSharp -Pre
The package includes builds for .NET 3.5, 4.0, 4.5 and 4.6. 4.7 will follow when I pave my machine and get the Creators Update, .NET Standard will follow as soon as I actually add it as a target and resolve any API issues.
Then just create an instance of the MantisClient
, passing the base URI where your MantisBT installation is hosted, along with an API key. Also note that by default the REST API is disabled and needs to be explicitly switched on for external access. (There's a wiki page which tells you how).
MantisClient client = new MantisClient("YOUR_MANTIS_URI", "YOUR_API_KEY"); // list all projects foreach (Project project in client.GetProjects()) { Console.WriteLine(project.Name); } // list all issues foreach (Issue issue in client.GetIssues()) { Console.WriteLine(issue.Summary); } // list issues for a single project var issues = client.GetIssues(4); // or pass in a Project reference // get a single issue Issue issue = client.GetIssue(52);
Known Issues
There's still outstanding work to do, some of which is detailed in the readme. I also haven't done much testing yet, and our MantisBT database is currently quite small, so I don't know how the library will perform under bigger databases.
Examples
All content Copyright (c) by Cyotek Ltd or its respective writers. Permission to reproduce news and web log entries and other RSS feed content in unmodified form without notice is granted provided they are not used to endorse or promote any products or opinions (other than what was expressed by the author) and without taking them out of context. Written permission from the copyright owner must be obtained for everything else.
Original URL of this content is https://www.cyotek.com/blog/announcing-mantissharp-a-net-client-for-using-the-mantisbt-rest-api?source=rss.