{"_id":"@egman1/youtrack-rest-client","name":"@egman1/youtrack-rest-client","dist-tags":{"latest":"1.6.0"},"versions":{"1.6.0":{"name":"@egman1/youtrack-rest-client","version":"1.6.0","description":"Client library for accessing the youtrack REST api","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"mocha -r ts-node/register test/**/*.ts","dev":"watch 'npm run build' src","prepare":"npm run build","prepublishOnly":"npm run test","postversion":"git push && git push --tags","update-changelog":"auto-changelog --unreleased --hide-credit -l 99 --ignore-commit-pattern \"update changelog\"","version":"auto-changelog -p --hide-credit -l 99 --ignore-commit-pattern \"update changelog\" && git add CHANGELOG.md"},"repository":{"type":"git","url":"git+https://github.com/egman1/youtrack-rest-client.git"},"keywords":["youtrack","rest api","jetbrains","sdk","client","typescript","issue tracking"],"author":{"name":"Shane Hofstetter"},"license":"ISC","bugs":{"url":"https://github.com/egman1/youtrack-rest-client/issues"},"homepage":"https://github.com/egman1/youtrack-rest-client#readme","dependencies":{"@types/request":"^2.48.0","@types/request-promise":"^4.1.42","@types/string-template":"^1.0.2","axios":"^1.2.1","axios-mock-adapter":"^1.21.2","string-template":"^1.0.0"},"devDependencies":{"@types/mocha":"^10.0.1","@types/node":"^18.11.13","@types/sinon":"^5.0.5","auto-changelog":"^2.4.0","chai":"^4.2.0","mocha":"^10.1.0","sinon":"^7.1.1","ts-node":"^10.9.1","typescript":"^4.9.4","watch":"^1.0.2"},"gitHead":"47a477ac1e4183205c9ea8a8acd2afde2c2191c9","_id":"@egman1/youtrack-rest-client@1.6.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-Lz4/BQ4S5rhsQYuURoMRqg7F7yaKD2HVh/sIsIRdqYP8aRlPcJ39xAVRHkBCsrs7FAKkDcOuOurexGAsLvPBPg==","shasum":"51fe71998bb8fb4c0eff5175d048ce6205248650","tarball":"https://registry.npmjs.org/@egman1/youtrack-rest-client/-/youtrack-rest-client-1.6.0.tgz","fileCount":67,"unpackedSize":58661,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBEdw7d5duRzIIiW20ZR3XtrP4zuJAnpu/tiAUf5KleVAiEAyyHvF1hpSvYQFH2EVOaI9qy05aTjemAWlXo4HmhKnsg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyEAuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmnA/+Kw5S8ooXhs2cG82pZsy2xN8DxAczS/CbmJVsHPoPH3FuI4LC\r\nfQFwxoPIadGZnBwCCbPw162PbotRvWUfcz/jf0RIQHZprHZqARD3LmVvnSeI\r\n6nClqsL3C+U0Te7pn/sCauHCfv3A8c+ly9ThARUEDMa7WKzm/EvJQU36wYKt\r\nYFDmpHdOeJur3bQHnAq7oYStwkUVQaalxDB7YrJVUNMJhh+KBmbHj38rZqgx\r\nAJVGKAg7gz1qBnw7AmKC8p06RaKrZxuesrYHW1XaAFPoWAVfmArXNmKvO8wP\r\naM8XAfRqa+vdghrXu3Zj35Gdzsu4M/pBxtSAU+OziBbyBjqCLxv5gi+YPF+0\r\nMMjC8aUOGoootq9NIBcldJdnCrH1OvCkg1hExp7mGyTInvLkOZMm+4zPbfos\r\nj85ZBFsbpc8TGKS21cOAGB2ODe4oSPANXVBv5zh6Yfcz3omFmEHkDgJjFugk\r\nc1y1QfoLjrTMtrUecQswhPlMOCR1zgpmXqGymMZGq8aXYZPnm/6Bacc5pYEe\r\nirvCxhUU8NceiI3uPKxfkfjohB+XWjvJmhxPT4TYaLhQ6Mc181XJf6+lxi4C\r\nP+lPvFZ7wgCmGu+/wqnMcodcBYdhi1Onm3DNAlT0/esSKlKcmsjLSjX5qvPq\r\nXtl8FPRxvr47fkqzOnAWcQC4idGbgx9zFHc=\r\n=/rfy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"egman1","email":"troschand@mail.ru"},"directories":{},"maintainers":[{"name":"egman1","email":"troschand@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/youtrack-rest-client_1.6.0_1674068013952_0.8610858927049647"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-18T18:53:33.883Z","1.6.0":"2023-01-18T18:53:34.096Z","modified":"2023-01-18T18:53:34.239Z"},"maintainers":[{"name":"egman1","email":"troschand@mail.ru"}],"description":"Client library for accessing the youtrack REST api","homepage":"https://github.com/egman1/youtrack-rest-client#readme","keywords":["youtrack","rest api","jetbrains","sdk","client","typescript","issue tracking"],"repository":{"type":"git","url":"git+https://github.com/egman1/youtrack-rest-client.git"},"author":{"name":"Shane Hofstetter"},"bugs":{"url":"https://github.com/egman1/youtrack-rest-client/issues"},"license":"ISC","readme":"![logo](https://user-images.githubusercontent.com/13404717/59300590-da2b6600-8c8f-11e9-82b2-ab3dc856ffdb.jpeg)\r\n\r\n# youtrack-rest-client\r\nClient library for the [youtrack rest api](https://www.jetbrains.com/help/youtrack/standalone/youtrack-rest-api-reference.html)\r\n\r\n[![📦 Build & Test](https://github.com/shanehofstetter/youtrack-rest-client/actions/workflows/test.yml/badge.svg)](https://github.com/shanehofstetter/youtrack-rest-client/actions/workflows/test.yml)\r\n[![Maintainability](https://api.codeclimate.com/v1/badges/52753e2150c5097069ac/maintainability)](https://codeclimate.com/github/shanehofstetter/youtrack-rest-client/maintainability)\r\n[![npm](https://img.shields.io/npm/v/youtrack-rest-client.svg)](https://www.npmjs.com/package/youtrack-rest-client)\r\n![NpmLicense](https://img.shields.io/npm/l/youtrack-rest-client.svg)\r\n\r\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?business=PB26QWEQQ3RE4&no_recurring=0&item_name=Support+my+open+source+work+on+github+%E2%9D%A4%EF%B8%8F&currency_code=USD)\r\n\r\n## Install\r\n```\r\nnpm install youtrack-rest-client\r\n```\r\n```\r\nyarn add youtrack-rest-client\r\n```\r\n\r\n\r\n## Usage\r\n\r\n### Authentication\r\n\r\n**With your permanent token (see [Manage-Permanent-Token](https://www.jetbrains.com/help/youtrack/incloud/Manage-Permanent-Token.html)):**\r\n```typescript\r\nimport {Youtrack} from \"youtrack-rest-client\";\r\n\r\nconst config = {\r\n    baseUrl: \"http://example.myjetbrains.com\", \r\n    token: \"perm:your-token\"\r\n};\r\nconst youtrack = new Youtrack(config);\r\n```\r\n\r\n**With username/password**  \r\nThe current REST API does not support logging in with username/password anymore, if you require this you need to use the legacy REST API ([youtrack-rest-client version 0.3.x](https://github.com/shanehofstetter/youtrack-rest-client/releases/tag/v0.3.2)).\r\n\r\n### [Users](https://www.jetbrains.com/help/youtrack/incloud/api-entity-User.html)\r\n\r\n```typescript\r\n\r\n// get the current user\r\nyoutrack.users.current().then((user: User) => {\r\n    console.log({user});\r\n});\r\n\r\n// get all users\r\nyoutrack.users.all().then((users: ReducedUser[]) => {\r\n    console.log({users});\r\n});\r\n\r\n// get a user by id\r\nyoutrack.users.byId('1-1').then((user: User) => {\r\n    console.log({user});\r\n});\r\n\r\n```\r\n\r\n\r\n### [Projects](https://www.jetbrains.com/help/youtrack/incloud/api-entity-Project.html)\r\n```typescript\r\n\r\n// get all projects\r\nyoutrack.projects.all().then((projects: ReducedProject[]) => {\r\n    console.dir(projects);\r\n});\r\n\r\n// get a project by its id\r\nyoutrack.projects.byId('0-0').then((project: Project) => {\r\n    console.dir(project);\r\n});\r\n\r\n```\r\n\r\n### [Issues](https://www.jetbrains.com/help/youtrack/incloud/api-entity-Issue.html)\r\n\r\n```typescript\r\n// search/list issues\r\nyoutrack.issues.search('project: T1').then((issues: ReducedIssue[]) => {\r\n    console.log({issues});\r\n});\r\n```\r\n\r\n```typescript\r\n// get issue by id\r\nyoutrack.issues.byId('T1-2').then((issue: Issue) => {\r\n    console.log({issue});\r\n});\r\n```\r\n\r\n```typescript\r\n// delete an issue\r\nyoutrack.issues.delete('2-2').then(() => {\r\n    console.log('issue deleted');\r\n});\r\n```\r\n\r\n```typescript\r\n// create a new issue\r\nyoutrack.issues.create({\r\n    summary: 'lorem ipsum',\r\n    description: 'created using rest api',\r\n    project: {\r\n        id: '0-0'\r\n    }\r\n}).then(issue => {\r\n    console.log({issue});\r\n});\r\n```\r\n\r\n```typescript\r\n// update an issue\r\nyoutrack.issues.update({\r\n    id: 'T1-2',\r\n    summary: \"updated summary\"\r\n}).then(issue => {\r\n    console.log({issue});\r\n});\r\n```\r\n\r\n### [Commands](https://www.jetbrains.com/help/youtrack/incloud/api-entity-CommandList.html)\r\n\r\n```typescript\r\n// execute command for issue(s) (internal id is used)\r\nyoutrack.issues.executeCommand({\r\n    query: 'for me',\r\n    issues: [\r\n        {\r\n            id: '2-6'\r\n        }\r\n    ]\r\n}).then(response => {\r\n    console.log({response});\r\n});\r\n```\r\n\r\n```typescript\r\n// execute command for issue(s) and add a comment\r\nyoutrack.issues.executeCommand({\r\n    query: 'for me',\r\n    comment: 'gonna solve this real quick',\r\n    issues: [\r\n        {\r\n            id: '2-6'\r\n        }\r\n    ]\r\n}).then(response => {\r\n    console.log({response});\r\n});\r\n```\r\n\r\n### [WorkItems (Time-Tracking)](https://www.jetbrains.com/help/youtrack/incloud/api-entity-IssueWorkItem.html)\r\n\r\n```typescript\r\n// get the configured workitem types for the project\r\nyoutrack.projects.getWorkItemTypes('0-0').then((workItemTypes: WorkItemType[]) => {\r\n    console.log({workItemTypes});\r\n});\r\n```\r\n\r\n```typescript\r\n// list the workitems of a project\r\nyoutrack.workItems.all('T1-2').then((workItems: WorkItem[]) => {\r\n    console.log({workItems});\r\n});\r\n```\r\n\r\n```typescript\r\n// add new workitem to project\r\nyoutrack.workItems.create('T1-2', {\r\n    duration: {\r\n        presentation: '30m'\r\n    },\r\n    text: 'fixed bug',\r\n    type: {\r\n        name: 'Development',\r\n        id: '77-0'\r\n    }\r\n}).then(workItem => {\r\n    console.log({workItem});\r\n});\r\n```\r\n\r\n```typescript\r\n// update workitem\r\nyoutrack.workItems.update('T1-2', {\r\n    id: '116-3',\r\n    duration: {\r\n        presentation: '45m'\r\n    }\r\n}).then(workItem => {\r\n    console.log({workItem});\r\n});\r\n```\r\n\r\n```typescript\r\n// delete work item\r\nyoutrack.workItems.delete('T1-2', '116-3').then(() => {\r\n    console.log('workitem deleted.');\r\n});\r\n```\r\n\r\n### [Issue Comments](https://www.jetbrains.com/help/youtrack/incloud/api-entity-IssueComment.html)\r\n\r\n```typescript\r\n// list comments of an issue\r\nyoutrack.comments.all('T1-2').then((comments: IssueComment[]) => {\r\n    console.log({comments});\r\n});\r\n```\r\n\r\n```typescript\r\n// add comment to issue\r\nyoutrack.comments.create('T1-2', {\r\n    text: 'issue comment'\r\n}).then(comment => {\r\n    console.log({comment});\r\n});\r\n```\r\n\r\n```typescript\r\n// update comment\r\nyoutrack.comments.update('T1-2', {\r\n    id: '4-1',\r\n    text: 'updated issue comment'\r\n}).then(comment => {\r\n    console.log({comment});\r\n});\r\n```\r\n\r\n```typescript\r\n// delete a comment\r\nyoutrack.comments.delete('T1-2', '4-1').then(() => {\r\n    console.log('comment deleted.');\r\n});\r\n```\r\n\r\n### [Issue Tags](https://www.jetbrains.com/help/youtrack/incloud/api-entity-IssueTag.html)\r\n```typescript\r\n\r\n// get all tags\r\nyoutrack.tags.all().then((tags: IssueTag[]) => {\r\n    console.log({tags});\r\n});\r\n\r\n// get tag by id\r\nyoutrack.tags.byId('6-0').then((tag: IssueTag) => {\r\n    console.log({tag});\r\n});\r\n```\r\n\r\n### [Issue Links](https://www.jetbrains.com/help/youtrack/incloud/api-entity-IssueLink.html)\r\n```typescript\r\n\r\n// get issue links of issue\r\nyoutrack.issues.byId('P1-1').then((issue: Issue) => {\r\n    console.log({links: issue.links});\r\n});\r\n\r\n// update issue link(s)\r\nyoutrack.issues.update({\r\n    id: 'P1-1',\r\n    links: [\r\n            {\r\n                issues: [\r\n                    {\r\n                        id: '2-3'\r\n                    }\r\n                ],\r\n                id: '92-1s',\r\n            }\r\n        ]\r\n}).then((issue: Issue) => {\r\n    console.log({links: issue.links});\r\n});\r\n```\r\n\r\n### [Agiles](https://www.jetbrains.com/help/youtrack/incloud/api-entity-Agile.html)\r\n```typescript\r\n\r\n// get all agile boards\r\nyoutrack.agiles.all().then((agiles: ReducedAgile[]) => {\r\n    console.log({agiles});\r\n});\r\n\r\n// get specific agile board by id\r\nyoutrack.agiles.byId('104-0').then((agile: Agile) => {\r\n    console.log({agile});\r\n});\r\n\r\n// create new agile board\r\nyoutrack.agiles.create({\r\n    name: '19-15',\r\n    projects: [{ id: '0-0' }]\r\n}).then((agile: Agile) => {\r\n    console.log({agile});\r\n});\r\n\r\n// delete an agile board \r\nyoutrack.agiles.delete('104-1').then(() => {\r\n    console.log('agile deleted.');\r\n});\r\n\r\n// update an agile board\r\nyoutrack.agiles.update({ id: '104-0', projects: [{ id: '0-0' }] }).then((agile: Agile) => {\r\n    console.log({agile});\r\n});\r\n```\r\n\r\n### [Sprints](https://www.jetbrains.com/help/youtrack/incloud/api-entity-Sprint.html)\r\n\r\n```typescript\r\n\r\nconst agileId = '104-0';\r\n\r\n// get all sprints of an agile board\r\nyoutrack.sprints.all(agileId).then((sprints: ReducedSprint[]) => {\r\n    console.log({sprints});\r\n});\r\n\r\n// get agile sprint by id\r\nyoutrack.sprints.byId(agileId, '105-0').then((sprint: Sprint) => {\r\n    console.log({sprint});\r\n});\r\n\r\n// create new sprint\r\nyoutrack.sprints.create(agileId, { name: 'my sprint' }).then((sprint: Sprint) => {\r\n    console.log({sprint});\r\n});\r\n\r\n// update a sprint\r\nyoutrack.sprints.update(agileId, { id: '105-3', name: 'my sprint 3' }).then((sprint: Sprint) => {\r\n    console.log({sprint});\r\n});\r\n\r\n// delete a sprint\r\nyoutrack.sprints.delete(agileId, '105-2').then(() => {\r\n    console.log('sprint deleted.');\r\n});\r\n\r\n```\r\n\r\n## Contributing\r\n\r\nIf you encounter any missing features or bugs, you're welcome to open an Issue! PRs are welcome too ;-)\r\n\r\n1. Fork it ( https://github.com/shanehofstetter/youtrack-rest-client/fork )\r\n2. Create your feature branch (git checkout -b my-new-feature)\r\n3. Commit your changes (git commit -am 'Add some feature')\r\n4. Push to the branch (git push origin my-new-feature)\r\n5. Create a new Pull Request\r\n","readmeFilename":"README.md"}