2017 © Pedro Peláez
 

library jira-api

Atlassian JIRA client API for XP Framework

image

xp-forge/jira-api

Atlassian JIRA client API for XP Framework

  • Saturday, January 23, 2016
  • by thekid
  • Repository
  • 7 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

jira-api

Build Status on TravisCI XP Framework Module BSD Licence Required PHP 5.5+ Supports PHP 7.0+ Supports HHVM 3.5+ Latest Stable Version, (*1)

Atlassian JIRA client API for XP Framework, (*2)

Usage example

First of all, you need to include the JiraClient class which can be used easily to access the JIRA resources. The following shows a short code example how to use it:, (*3)

use com\atlassian\jira\api\JiraClient;
use com\atlassian\jira\api\query\JiraQuery;
use com\atlassian\jira\api\query\JiraQueryOp;

// Create client (credentials missing here!)
$c= new JiraClient('https://jira.example.com/rest/api/2/');

// Query for issues
$issues= $c->queryIssues((new JiraQuery())
  ->add('status', 'Open', JiraQueryOp::$EQUALS)
  ->addAnd('project', 'BIT', JiraQueryOp::$EQUALS)
);

// Print out list of issues
foreach ($issues as $issue) {
  Console::writeLinef(
    '==> %s: %s (%s)',
    $issue->getKey(),
    $issue->getSummary(),
    $issue->getStatus()->toString()
  );
}

The classes

The current implementation has the following classes:, (*4)

  • com.atlassian.jira.api.JiraClient - the client class which is the main entry point for the application
  • com.atlassian.jira.api.query.JiraQuery - the query object which can be used to build the query
  • com.atlassian.jira.api.query.JiraQueryCriteria - a more complex query object which can be used to build a complex query (see below)
  • com.atlassian.jira.api.query.JiraQueryOp - the query operators which can be used (equals, greater, ...)
  • com.atlassian.jira.api.query.JiraQueryResult - the query result object which contains all information returned for a query

The different types:, (*5)

  • com.atlassian.jira.api.types.JiraProject - a representation for the JIRA project
  • com.atlassian.jira.api.types.JiraComponent - a representation for the JIRA component
  • com.atlassian.jira.api.types.JiraIssue - a representation for the JIRA issue* com.atlassian.jira.api.types.JiraPerson - a representation for a person
  • com.atlassian.jira.api.types.JiraPriority - a representation for the issue priority
  • com.atlassian.jira.api.types.JiraStatus - a representation of the issue status
  • com.atlassian.jira.api.types.JiraIssueType - a representation of the issue type

The gadgets currently implemented:, (*6)

  • com.atlassian.jira.api.gadget.JiraStatsGadget - Generates a list of issue statistic (e.g. assigned issues by person)
  • com.atlassian.jira.api.gadget.JiraCreatedVsResolvedGadget - Shows a statistics chart for created vs. resolved issues for a given query or filter

Using a gadget

Gadget are extension for JIRA which does some "magic". For example it can do special reports or generates some fancy charts. The following example is using the statistics gadget:, (*7)

$result= $client->generateGadget($gadget= create(new JiraStatsGadget())
  ->withProjectOrFilterId('filter-11675')  // Bugs assigned to iDev
);
$n= $stats->addChild(new Node('gadget', NULL, array(
  'name'   => $gadget->getName(),
  'title'  => $result->getFilterOrProjectName(),
  'issues' => $result->getTotalIssueCount()
)));
foreach ($result->getRows() as $row){
  $n->addChild(new Node('person', strip_tags($row['html']), array(
    'percent' => $row['percentage'],
    'count'   => $row['count']
  )));
}

JQL query example

use com\atlassian\jira\api\JiraClient;
use com\atlassian\jira\api\query\JqlQuery;

// Create client (credentials missing here!)
$c= new JiraClient('https://jira.example.com/rest/api/2/');

// Query for issues
$issues= $c->queryIssues(new JqlQuery('status = "Open" and project = "Example"'));

// Print out list of issues
foreach ($issues as $issue) {
  Console::writeLinef(
    '==> %s: %s (%s)',
    $issue->getKey(),
    $issue->getSummary(),
    $issue->getStatus()->toString()
  );
}

The Versions

23/01 2016

dev-master

9999999-dev http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

23/01 2016

v3.0.1

3.0.1.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

20/12 2015

v3.0.0

3.0.0.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

26/09 2015

v2.1.0

2.1.0.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

26/09 2015

v2.0.3

2.0.3.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

22/04 2015

v2.0.2

2.0.2.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

12/02 2015

v2.0.1

2.0.1.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp

11/01 2015

v2.0.0

2.0.0.0 http://xp-framework.net/

Atlassian JIRA client API for XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp