{"id":21731770,"url":"https://github.com/evref-bl/jira-pharo-api","last_synced_at":"2025-03-20T23:43:19.826Z","repository":{"id":196480779,"uuid":"696145924","full_name":"Evref-BL/Jira-Pharo-API","owner":"Evref-BL","description":"Analyze data from Jira","archived":false,"fork":false,"pushed_at":"2025-03-17T14:15:31.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-17T14:28:20.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Evref-BL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-25T07:19:48.000Z","updated_at":"2025-03-17T14:15:36.000Z","dependencies_parsed_at":"2024-09-06T18:13:23.439Z","dependency_job_id":"f5f9cc08-3d28-415f-b486-fe5f309078fc","html_url":"https://github.com/Evref-BL/Jira-Pharo-API","commit_stats":null,"previous_names":["evref-bl/jira-pharo-api"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evref-BL%2FJira-Pharo-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evref-BL%2FJira-Pharo-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evref-BL%2FJira-Pharo-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evref-BL%2FJira-Pharo-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Evref-BL","download_url":"https://codeload.github.com/Evref-BL/Jira-Pharo-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244711938,"owners_count":20497417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T04:27:21.213Z","updated_at":"2025-03-20T23:43:19.804Z","avatar_url":"https://github.com/Evref-BL.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jira-Pharo-API\n\n[![Continuous](https://github.com/Evref-BL/Jira-Pharo-API/actions/workflows/continuous.yml/badge.svg)](https://github.com/Evref-BL/Jira-Pharo-API/actions/workflows/continuous.yml)\n[![Coverage Status](https://coveralls.io/repos/github/Evref-BL/Jira-Pharo-API/badge.svg?branch=main)](https://coveralls.io/github/Evref-BL/Jira-Pharo-API?branch=main)\n\nThis is a client for the [Jira REST API](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#about).\n\n## Installation \n\n```st\nMetacello new\n  githubUser: 'Evref-BL' project: 'Jira-Pharo-API' commitish: 'main' path: 'src';\n  baseline: 'JiraPharoAPI';\n  load\n```\n\n## Connect the API to Jira\n\nThe first step before querying is to connect to the Jira API.\n\nOn the official atlassian Jira, perform the following script:\n\n```smalltalk\njpAPI := JiraPharoAPI new.\njpAPI endpoint: '\u003cyour endpoint\u003e'.\njpAPI basePath: '\u003cbasePath\u003e/rest/api/latest/'.\njpAPI beHttps.\n\njpAPI user: '\u003cYour usernam (can be email)\u003e'.\njpAPI apiToken: '\u003cYour apiToken\u003e'.\n```\n\nIf you still have a olf self-hosted Jira, you might want to use the following script.\n\n```smalltalk\njpAPI := JiraPharoAPI new.\njpAPI endpoint: '\u003cyour endpoint\u003e'.\njpAPI basePath: '\u003cbasePath\u003e/rest/api/latest/'.\njpAPI beHttps.\njpAPI bearerToken: '\u003cYour personal token\u003e'.\n```\n\n## Example with Moose\n\nThis project comes with an integration to the Moose environment.\nIt comes with a specific importer for this purpose that simply the data analysis.\n\n### Import the issues assigned to a user in moose\n\n```st\njpImporter := JiraPharoImporter new\n  model: JPModel new;\n  api: jpAPI;\n  yourself.\n\njpImporter importAllIssuesOf: '\u003cemail of user\u003e'.\njpImporter model\n```\n\n## Example API only\n\n### Get information about one issue\n\n```smalltalk\njpAPI issue: '\u003cissue name\u003e'.\n```\n\n### Search issue API\n\nWe define the API to search issues using the [JQL](https://confluence.atlassian.com/x/egORLQ) query language of Atlassian.\nWe propose here some example but you can do a lot more.\n\n#### Get all issues of a project after a date\n\n```smalltalk\nissues := OrderedCollection new.\ntmp := jpAPI searchIssueWithExpand: nil fields: {'*navigable' . 'created'} fieldsByKeys: nil jql: 'project = \u003cprojectName\u003e and created \u003e ''2023-01-01''' maxResults: 100 startAt: 0.\n\nissues addAll: tmp issues.\n[tmp issues isNotEmpty ] whileTrue: [ \n\n  tmp := jpAPI searchIssueWithExpand: nil fields: {'*navigable' . 'created'} fieldsByKeys: nil jql: 'project = \u003cprojectName\u003e and created \u003e ''2023-01-01''' maxResults: 100 startAt: issues size.\n  issues addAll: tmp issues.\n].\n\nallJiraIssues := issues\n```\n\n#### Search all issues assigned to a user\n\n```smalltalk\nissues := OrderedCollection new.\ntmp := jpAPI searchIssueWithExpand: nil fields: {'*navigable' . 'created'} fieldsByKeys: nil jql: 'assignee = \"user.name@email.fr\"' maxResults: 100 startAt: 0.\n\nissues addAll: tmp issues.\n[tmp issues isNotEmpty ] whileTrue: [ \n\n  tmp := jpAPI searchIssueWithExpand: nil fields: {'*navigable' . 'created'} fieldsByKeys: nil jql: 'assignee = \"user.name@email.fr\"' maxResults: 100 startAt: issues size.\n  issues addAll: tmp issues.\n].\n\nallJiraIssues := issues\n```\n\n#### Compute average time spent on jira issues by month for a user\n\n```smalltalk\nuser := '\u003cusername/email\u003e'.\njqlQuery := String streamContents: [ :stream |\n\tstream \u003c\u003c 'assignee = \"'.\n\tstream \u003c\u003c user.\n\tstream \u003c\u003c '\"'\n\t ].\n\nissues := OrderedCollection new.\ntmp := jpAPI searchIssueWithExpand: nil fields: {'*all'} fieldsByKeys: nil jql: jqlQuery maxResults: 100 startAt: 0.\n\nissues addAll: tmp issues.\n[tmp issues isNotEmpty ] whileTrue: [ \n\n\ttmp := jpAPI searchIssueWithExpand: nil fields: {'*all'} fieldsByKeys: nil jql: jqlQuery maxResults: 100 startAt:  issues size.\n  issues addAll: tmp issues.\n].\n\nallJiraIssues := issues.\n\njiraWithTime := allJiraIssues reject: [ :jiraIssue | jiraIssue timespent isNil ].\ngrouped := jiraWithTime groupedBy: [ :jiraIssue | jiraIssue created month ].\ncomputedMean := OrderedDictionary new.\ngrouped keysDo: [ :key | computedMean at: key put: ((grouped at: key) sum: #timespent) / (grouped at: key) size ].\n\n\"To get a visualization\"\nc := RSCompositeChart new.\nc add: (RSBarPlot new y: (computedMean values collect: #asSeconds)).\nc horizontalTick fromNames: computedMean orderedKeys;\n\tuseDiagonalLabel.\nc verticalTick labelConversion: [ :v | v seconds ].\nc xlabel: 'Month'.\nc ylabel: 'Time spent'.\nc title: 'Mean time spend by dev on jira issue'.\nc\n```\n\nAnother option is to assign a jira ticket to the first month work has been log on it\n\n```smalltalk\njiraWithTime := allJiraIssues reject: [ :jiraIssue | jiraIssue timespent isNil ].\ngrouped := jiraWithTime groupedBy: [ :jiraIssue | jiraIssue worklogs first created asDate month ].\nsortedGrouped := (grouped associations asOrderedCollection sort: [:a :b | a key \u003c b key]) asOrderedDictionary .\ncomputedMean := OrderedDictionary new.\nsortedGrouped keysDo: [ :key | computedMean at: key put: ((grouped at: key) sum: #timespent) / (grouped at: key) size ].\n\n\nc := RSCompositeChart new.\nc add: (RSBarPlot new y: (computedMean values collect: #asSeconds)).\nc horizontalTick fromNames: computedMean orderedKeys;\n\tuseDiagonalLabel.\nc verticalTick labelConversion: [ :v | v seconds ].\nc xlabel: 'Month'.\nc ylabel: 'Time spent'.\nc title: 'Mean time spend by dev on jira issue'.\nc\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevref-bl%2Fjira-pharo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevref-bl%2Fjira-pharo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevref-bl%2Fjira-pharo-api/lists"}