jira4s


License

License

Categories

Categories

Ant Build Tools
GroupId

GroupId

com.github.allantl
ArtifactId

ArtifactId

jira4s_2.11
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

jira4s
jira4s
Project URL

Project URL

https://github.com/allantl/jira4s
Project Organization

Project Organization

com.github.allantl
Source Code Management

Source Code Management

https://github.com/allantl/jira4s

Download jira4s_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.allantl/jira4s_2.11/ -->
<dependency>
    <groupId>com.github.allantl</groupId>
    <artifactId>jira4s_2.11</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.allantl/jira4s_2.11/
implementation 'com.github.allantl:jira4s_2.11:0.1.0'
// https://jarcasting.com/artifacts/com.github.allantl/jira4s_2.11/
implementation ("com.github.allantl:jira4s_2.11:0.1.0")
'com.github.allantl:jira4s_2.11:jar:0.1.0'
<dependency org="com.github.allantl" name="jira4s_2.11" rev="0.1.0">
  <artifact name="jira4s_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.allantl', module='jira4s_2.11', version='0.1.0')
)
libraryDependencies += "com.github.allantl" % "jira4s_2.11" % "0.1.0"
[com.github.allantl/jira4s_2.11 "0.1.0"]

Dependencies

compile (9)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
io.circe : circe-core_2.11 jar 0.11.0
io.circe : circe-generic_2.11 jar 0.11.0
io.circe : circe-parser_2.11 jar 0.11.0
io.toolsplus : atlassian-jwt-generators_2.11 jar 0.1.6
io.toolsplus : atlassian-jwt-core_2.11 jar 0.1.6
com.softwaremill.sttp : core_2.11 jar 1.6.0
com.softwaremill.sttp : circe_2.11 jar 1.6.0
com.typesafe : config jar 1.3.2

test (2)

Group / Artifact Type Version
org.specs2 : specs2-core_2.11 jar 4.5.1
org.specs2 : specs2-scalacheck_2.11 jar 4.5.1

Project Modules

There are no modules declared in this project.

Jira4s

Build Status Maven Central

Atlassian Jira Client for Scala

Dependencies

Getting Started

Add the following to your build.sbt:

libraryDependencies += "com.github.allantl" %% "jira4s" % "0.2.0"

Usage

This library exposes two types of client

  • JiraSingleTenantClient for authentication using api token and basic auth.
  • JiraMultiTenantClient for Atlassian Connect add-on and OAuth(not supported yet).

To initialize the client with authentication using ApiToken or BasicAuthentication

import cats.Id
import com.allantl.jira4s.auth.{ApiToken, BasicAuthentication}
import com.allantl.jira4s.v2.JiraSingleTenantClient
import com.softwaremill.sttp.HttpURLConnectionBackend

object Jira4S extends App {
    implicit val sttpBackend = HttpURLConnectionBackend()

    // ApiToken
    val client: JiraSingleTenantClient[Id] = JiraSingleTenantClient(
        ApiToken(
          "jiraUrl",
          "email",
          "apiToken"
        )
    )

    // Basic Auth
    val client2: JiraSingleTenantClient[Id] = JiraSingleTenantClient(
        BasicAuthentication(
          "jiraUrl",
          "email",
          "password"
        )
    )

    val issue = client.getIssue("10000")

}

If you are developing an Atlassian Connect add-on

import cats.Id
import com.allantl.jira4s.auth.{AcJwtConfig, AuthContext}
import com.allantl.jira4s.v2.JiraMultiTenantClient
import com.softwaremill.sttp.HttpURLConnectionBackend

object Jira4S extends App {

  implicit val sttpBackend = HttpURLConnectionBackend()

  val jwtExpirationInSeconds = 5L
  val client: JiraMultiTenantClient[Id] = JiraMultiTenantClient(
    AcJwtConfig(
      "addOnKey",
      jwtExpirationInSeconds
    )
  )

  // You need to specify an implicit AuthContext when making a request to Jira
  case class UserCtx(instanceUrl: String, accessToken: String) extends AuthContext

  implicit val userCtx = UserCtx(
    "http://your-domain.atlassian.net",
    "atlassian-host-shared-secret"
  )

  val issue = client.getIssue("10000")

}

Configuration

You can add configuration using environment variables or HOCON in application config. Then, you can initialize the client with

import com.allantl.jira4s.v2.{JiraMultiTenantClient, JiraSingleTenantClient}
import com.softwaremill.sttp.HttpURLConnectionBackend

object Jira4S extends App {

  implicit val sttpBackend = HttpURLConnectionBackend()

  val singleTenantClient = JiraSingleTenantClient()
  val multiTenantClient = JiraMultiTenantClient()

}

Api Token:

jira4s {
  jira-url = "https://your-domain.atlassian.net"
  username = "username"
  api-token = "api-token"
}

Environment Variables:

export JIRA4S_JIRA_URL = "https://your-domain.atlassian.net"
export JIRA4S_USERNAME = "username"
export JIRA4S_API_TOKEN = "api-token"

Basic Authentication

jira4s {
  jira-url = "https://your-domain.atlassian.net"
  username = "username"
  password = "password"
}

Environment Variables:

export JIRA4S_JIRA_URL = "https://your-domain.atlassian.net"
export JIRA4S_USERNAME = "username"
export JIRA4S_PASSWORD = "password"

Atlassian connect add-on

jira4s {
  add-on-key = "Your add on key"
  jwt-expiration-in-seconds = 5
}

Environment Variables:

export JIRA4S_ADD_ON_KEY = "Your add on key"
export JIRA4S_JWT_EXPIRATION_IN_SECONDS = 5

Backend

Sttp supports different type of backends which return different type of effects. Please take a look at sttp docs.

Logging

To add logging to the client, please refer here.

Versions

Version
0.1.0
0.0.3
0.0.2