Skip to content

Commit

Permalink
Update docs & npm improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Gawryl authored and Jacqbus committed Feb 4, 2021
1 parent e31a4dc commit 09778ab
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 21 deletions.
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
src
src
.github
.gitignore
tsconfig.json
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# 0.2.0 (2021-01-19)
# 0.3.0 (2021-02-04)

## Features:

- [#9](https://github.com/Jacqbus/redmine-ts/issues/9) Username/password authentication added. Additionally it is no longer required to provide an authentication method (this allows for sending inquiries about publicly available resources)
- [#10](https://github.com/Jacqbus/redmine-ts/issues/10) User Impersonation feature added
- [#11](https://github.com/Jacqbus/redmine-ts/issues/11) All types are now available for import

## Bugfix

- [#12](https://github.com/Jacqbus/redmine-ts/issues/12) Updated error handling

## Improvements
- [#8](https://github.com/Jacqbus/redmine-ts/issues/8) `done_ratio`, `start_date` and `due_date` parameters are available in create/update issue methods
- [#13](https://github.com/Jacqbus/redmine-ts/issues/13) Redundant files removed from npm, documentation updated

# 0.2.3 (2021-01-20)

- Fixed npm pipeline.

# 0.2.1 - 0.2.2 (2021-01-20)

- ❗ BROKEN VERSIONS - DO NOT USE ❗

# 0.2.0 (2021-01-20)

- Add changelog
- Add required `Content-Type': 'application/json`
Expand Down
67 changes: 49 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

redmine-ts is Redmine REST API client written using TypeScript and using [Axios](https://www.npmjs.com/package/axios) for making requests.. It supports 100% of [Redmine's API features](https://www.redmine.org/projects/redmine/wiki/rest_api).

## Limitations:

- The current version only supports JSON format (implementation of XML versions is not planned)
- `apiKey` is the only authentication method right now

## Known problems:

1. The parameter `cf_x` in the `listIssues` method ([API ref](https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues)) was not included, so TypeScript reports an error. Currently, to work around this problem, please use `@ts-ignore`
2. `Search` method - Since [official documentation](https://www.redmine.org/projects/redmine/wiki/Rest_Search) are not completed yet, only `limit` and `offset` parameters are available.

# Installation

```
Expand All @@ -22,22 +12,41 @@ npm install --save redmine-ts

```javascript
const fs = require('fs');
import {Redmine} from 'redmine-ts';
import {Redmine, RedmineTS} from 'redmine-ts';

// Initialization (with all available parameters)
const redmine = new Redmine('https://redmine-hostname.com:3000', {
// RedmineTS namespace can be used! (version 0.3.0+)
const redmineConfig: RedmineTS.Config = {
/**
* apiKey (required) Redmine API key
* apiKey (optional) Redmine API key
*/
apiKey: 'abcdef0123456789abcdef0123456789',

/**
* username (optional) Redmine username (login)
*/
username: 'api-user',

/**
* password (optional) Redmine password
*/
password: 'mySuperSecretPassword&TwoZero21',

/**
* impersonateUser (optional) Impersonate user login
* See more: https://www.redmine.org/projects/redmine/wiki/rest_api#User-Impersonation
*/
impersonateUser: 'secondUser',

/**
* maxUploadSize (optional) Maximum size of sent files in bytes. Default value: 5242880 (5MB)
* Note that it's only changes the maxBodyLength parameter of axios.
* Max upload size accepted by Redmine needs to be setted by administrator in settings!
*/
maxUploadSize: 5242880
});
};

// Initialization
const redmine = new Redmine('https://redmine-hostname.com:3000', redmineConfig);

// Example 1: List 5 issues
redmine.listIssues({
Expand Down Expand Up @@ -66,11 +75,33 @@ redmine.uploadFile(fileContent).then(res => {
})
```

# Planned improvements
# Authentication

redmine-ts supports authentication using an API key as well as login/password. However, providing an authentication is not required - this allows for sending inquiries about publicly available resources.

If three parameters are given: API key, login and password, the API key always takes precedence. Additionally, the library does not attempt to automatically log in with the login/password in case of an incorrect API key

# Additional

## Limitations:

- The current version only supports JSON format (implementation of XML versions is not planned)

- ~~`apiKey` is the only authentication method right now~~ Since version `0.3.0` both authentication methods are available 😊

## Known problems:

- ❗ Please use version `0.2.3` or above. Previous versions are broken by wrong pipeline configuration

- The parameter `cf_x` in the `listIssues` method ([API ref](https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues)) was not included, so TypeScript reports an error. Currently, to work around this problem, please use `@ts-ignore` ([Issue #20](https://github.com/Jacqbus/redmine-ts/issues/20))

- `Search` method - Since [official documentation](https://www.redmine.org/projects/redmine/wiki/Rest_Search) are not completed yet, only `limit` and `offset` parameters are available ([Issue #19](https://github.com/Jacqbus/redmine-ts/issues/19))

## Planned improvements

- Add support for username/password authentication
- Add support for [User-Impersonation](https://www.redmine.org/projects/redmine/wiki/rest_api#User-Impersonation)
- ✔️ ~~Add support for username/password authentication~~ available from verion `0.3.0`

- ✔️ ~~Add support for [User-Impersonation](https://www.redmine.org/projects/redmine/wiki/rest_api#User-Impersonation)~~ available from verion `0.3.0`

# License

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redmine-ts",
"version": "0.2.3",
"version": "0.3.0",
"description": "Redmine REST API client written using TypeScript",
"author": "Jakub Gawryl",
"license": "MIT",
Expand Down

0 comments on commit 09778ab

Please sign in to comment.