diff --git a/.npmignore b/.npmignore index bf40d27..ed7e5f9 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,5 @@ node_modules -src \ No newline at end of file +src +.github +.gitignore +tsconfig.json \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 05977f5..847d377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/README.md b/README.md index aa65be4..d1d7df7 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -22,14 +12,30 @@ 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) @@ -37,7 +43,10 @@ const redmine = new Redmine('https://redmine-hostname.com:3000', { * 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({ @@ -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 diff --git a/package.json b/package.json index 69e7c82..f197a96 100644 --- a/package.json +++ b/package.json @@ -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",