Giter Club home page Giter Club logo

mantisbtrestapiclient's Introduction

MantisBT REST API Client

This class library implements a C# client of the MantisBT REST API (last stable version 2.21.0), allowing to use any Mantis functionality from a C# program. Mantis data are mapped throught DTO classes written in a POCO style.

The library is almost complete and ready to use. It is totally free/open source/modifiable/redistribuable (see MIT licence)

The following operations are mapping the MantisBT REST API services:

  • ConfigGet

    supplementary usefull methods can be found in MantisHTTPClient:

    • GetConfigStringOption
    • GetConfigEnumOption
    • GetConfigEnum
      • where T can be ConfigPriority,ConfigSeverity,ConfigReproductibility
    • GetConfigEnumOption
      • where T can be ConfigPriorities,ConfigSeverities,ConfigReproductibilities
  • IssueAdd

  • IssueGet

  • IssueDelete

  • ProjectGet

  • LangGet

  • UserGetMe

  • UserAdd

  • UserDelete

Asynchronous methods are also provided for use with async / await C# keywords. For that just ad ASync after method names

The C# client has been generated using the NSwag toolchain v12.2.5.0 (NJsonSchema v9.13.37.0 (Newtonsoft.JSon v11.0.0.0))

Get more info at http://NSwag.org

The client can be generated using the NSwag project file nswag.1.1.1.nswag, which is an enhanced version of this which is given with MantisBT

The library is provided as a Visual Studio project for .NET Standard 2.0, however a project targeting .NET Framework can also target this library.

You can recompile the source code in a class library project targeting .NET Framework 4.7, build Any CPU for instance if don't wish to be linked to the .NET Standard runtime support (it is integrated in .NET Framework since version 4.7.2, in older versions the VS compiler add extra DLLs for support).

Sample usage

First instantiate a client from the factory, providing your own HTTP client, then call an operation of the api:

HTTPClient httpClient = new HTTPClient();
MantisBTRestAPIClient.MantisHTTPClient client = MantisHTTPClientFactory.New(
    "MantisURL"                        // eg. http://host/mantisbt/api/rest/
    "MantisBTRestAPISecurityToken",
    httpClient
);
UserMeResponse user = client.UserGetMe();         // call the MantisBT REST API

About MantisBT

MantisBT is an open source issue tracker that provides a delicate balance between simplicity and power. Users are able to get started in minutes and start managing their projects while collaborating with their teammates and clients effectively.

Get more info at https://www.mantisbt.org

About MantisBT REST API settings

The REST API is enabled by default. A Swagger sandbox and documentation for REST API is available at /api/rest/swagger/ below the MantisBT root.

Get more info at https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html/admin.config.api.html

For the sandbox to work, MantisBT must be hosted at the root folder of the host. For example: http://mantishost/ rather http://host/mantisbt. If that is not the case, then create a host alias to map it as such or edit swagger.json to change basePath to include the mantisbt folder name.

mantisbtrestapiclient's People

Contributors

franck-gaspoz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kegfire 00mjk

mantisbtrestapiclient's Issues

Retrieving issues does not work

Consider the following code:

HttpClient hc = new HttpClient();
MantisHTTPClient client = MantisHTTPClientFactory.New("http://.../api/rest/", "...token...", hc);
var result = client.IssueGet(123);
var issue = result.Issues;

With my MantisBT 2.18 install an exception is thrown at the "IssueGet" line. It says that deserialization fails. I found out that CreateIssueResponse.Issues of type Issue does not match the actual structure in the response, where there is a list of issues. I removed the NuGet package, downloaded the source from here and tried to change that property type to List<Issue> as well as to change the access to var issue = result.Issues[0];. This worked for me.

Is this library maintained any more? Just wondering, because the last activity is 2 years ago. Maybe the structure of the REST response changed meanwhile. It would be great to give this library an update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.