vViktorPL / elm-jira-connector / Jira.Api

This library helps in communication with Jira REST API by exposing API requests as straightforward tasks and Jira resources data into some opaque types.

Credentials


type Cred

Authentication credentials

createAnonymousCred : String -> Result String Cred

Create credentials for publicly open Jira (as an anonymous user)

createBasicAuthCred : String -> ( String, String ) -> Result String Cred

Create credentials using basic auth method

Jira entities


type Project

Jira Project


type Issue

Jira Issue


type Worklog

Issue worklog entry


type alias WorklogRequest =
{ started : Time.Posix
, timeSpentSeconds : Basics.Int
, comment : Maybe Content 
}

Structure used to add new worklog to an issue


type alias WorklogData =
{ id : String
, issueId : String
, created : Time.Posix
, started : Time.Posix
, updated : Time.Posix
, timeSpent : String
, timeSpentSeconds : Basics.Int
, author : Json.Decode.Value
, updateAuthor : Json.Decode.Value 
}

Persisted worklog details


type Content

Content which is used across comments, descriptions etc

API call tasks


type alias ApiTask response =
Task ApiCallError response

Jira API call task

getProjects : Cred -> Jira.Pagination.PageRequest -> ApiTask (Jira.Pagination.Page Project)

Get page of projects

getAllProjects : Cred -> ApiTask (List Project)

Get all projects

getIssues : Cred -> Jira.Pagination.PageRequest -> Jira.JqlInternal.Jql -> List String -> ApiTask (Jira.Pagination.Page Issue)

Search for issues using Jql with and scoping available fields per issue

getFullIssues : Cred -> Jira.Pagination.PageRequest -> Jira.JqlInternal.Jql -> ApiTask (Jira.Pagination.Page Issue)

Search for issues using Jql with all fields per issue

addWorklog : Cred -> Issue -> WorklogRequest -> ApiTask Worklog

Add worklog to an issue

addWorklog cred
    issue
    { started = Posix.millisToPosix 1543173302785
    , timeSpentSeconds = 3600
    , comment = Just (contentFromString "Some comment")
    }

addWorklogToIssueByKeyOrId : Cred -> String -> WorklogRequest -> ApiTask Worklog

Add worklog to an issue by it's key or id:

addWorklog cred
    "EXA-1"
    { started = Time.millisToPosix 1543173302785
    , timeSpentSeconds = 3600
    , comment = Just (contentFromString "Some comment")
    }

API call helpers

allFields : List String

Fields scope where all fields are requested

allFieldsExcept : List String -> List String

Fields scope where all fields except provided ones are requested

Data getters

getProjectData : Project -> ProjectData

Extract raw data from Project

getIssueId : Issue -> String

Get issue id

getIssueKey : Issue -> String

Get issue key

getIssueFields : Issue -> Json.Decode.Value

Get issue fields. Note: as structure of available fields vary depending on requested fields configuration, you have to decode the fields that you are interested in.

getWorklogData : Worklog -> WorklogData

Get data from worklog

Data creators

contentFromString : String -> Content

Create text content

Errors


type ApiCallError

Error from api call request task

apiErrorToString : ApiCallError -> String

Convert API call error to a simple string