eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'JIRAClient':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: JIRAClient


Inheritance:

   Object
   |
   +--JIRAClient

Package:
stx:goodies/webServer
Category:
Net-Communication-Rest
Version:
rev: 1.13 date: 2018/04/24 19:52:48
user: cg
file: JIRAClient.st directory: goodies/webServer
module: stx stc-classLibrary: webServer

Description:


actually a REST client, but written before we had our RestClient framework.
Therefore, this operates directly via the HTTP interface,
constructing JSON data manually.


Class protocol:

accessing
o  invalidResponseError

o  invalidTransitionError

instance creation
o  new
ensure communication sockets are loaded

o  newWithConnectionTo: anURL
create a new instance and initialize for the given hostname and port

o  newWithConnectionTo: anURL forUser: aUser withPassword: aPassword
create a new instance and initialize for the given hostname and port


Instance protocol:

accessing
o  apiUri
the uri for the latest api

o  apiVersion
the version number of the JIRA REST API that is supported

o  url
the base url of the server

o  url: anURL
the base url of the server

authentification
o  login: aUserName password: aPassword
no login/logout right now - credentials are send with every request,
OAuth can be implemented later on

o  logout
no login/logout right now - credentials are send with every request,
OAuth can be implemented later on

communication
o  delete: aUri
delete the specific URI

o  get: aUri
get for a specific URI

o  post: aUri with: aDictionaryOrList
post the data to a specific URI

o  postProcessHTTPResponse: aResponse
try to unwrap JSON structure from response

o  put: aUri with: aDictionaryOrList
put the data to a specific URI

protocol
o  addComment: aComment toIssue: aKey
add a new comment to a issue, identified by its key

o  getCommentsForIssue: aKey
return the comments for an issue, identified by its key

o  getConfiguration
return the server configuration

o  getFields
return a list of available fields and their description

o  getIssue: aKey
return a issue identified by its key

o  getIssuesForProject: aKey
return all issues for a given project,
identified by the projects key

o  getIssuesForProject: aKey from: startIdx to: endIdx
return the issues for a given project in the given range,
identified by the projects key

o  getIssuesFromJqlSearch: aQuery
return any result for the given JQL query

o  getProject: aKey
return a project identified by its key

o  getProjectComponents: aKey
return all project components identified by the projects key

o  getProjects
return the list of projects visible for the configurated user

o  getServerInfo
return information about the server

o  getTransitionStatesForIssue: aKey

o  postTransitionState: aState forIssue: aKey

o  postTransitionState: aState forIssue: aKey comment: commentOrNil
change the state of a issue
2 - closed
3 - reopened
4 - in progress
5 - resolved

o  postTransitionStateClosedForIssue: aKey
set the issue status to closed - 2

o  postTransitionStateClosedForIssue: aKey comment: comment
set the issue status to closed - 2

o  postTransitionStateReopenedForIssue: aKey
set the issue status to reopened - 3

o  postTransitionStateReopenedForIssue: aKey comment: comment
set the issue status to reopened - 3

o  postTransitionStateResolvedForIssue: aKey
set the issue status to resolved - 5

o  postTransitionStateResolvedForIssue: aKey comment: comment
set the issue status to resolved - 5

o  updateIssue: aKey fields: aDictionaryOrList
update multiple fields of an issue, identified by its key

testing
o  serverIsReachable


Private classes:

    InvalidResponseError
    InvalidTransitionError

Examples:


Demonstrates how to communicate with JIRA via the REST interface.
|instance data|

instance := self newWithConnectionTo:'jira:8080'.
instance login:'EAJP' password:'exept'.  

data := instance getProject:'EAJP'.
data inspect. 
|instance data|

instance := self newWithConnectionTo:'jira:8080' 
                 forUser:'EAJP' 
                 withPassword:'exept'.     

data := instance getIssue:'EAJP-1'.
data inspect. 
|instance data|

instance := self newWithConnectionTo:'jira:8080' 
                 forUser:'EAJP'
                 withPassword:'exept'.     

data := instance getIssuesForProject:'EAJP'.
data inspect.
|instance data|

instance := self newWithConnectionTo:'jira:8080'
                 forUser:'EAJP' 
                 withPassword:'exept'.     

data := instance getIssuesForProject:'EAJP' from:1 to:10.
data inspect.
|instance data|

instance := self newWithConnectionTo:'jira:8080' 
                 forUser:'EDP' 
                 withPassword:'exept'.     

data := instance addComment:'greetings from smalltalk' toIssue:'EDP-1'.
data inspect.
|instance dict data|

instance := self newWithConnectionTo:'jira:8080' 
                 forUser:'EDP' 
                 withPassword:'exept'.     

dict := Dictionary withKeysAndValues:{'description'. 'described from smalltalk'.}.

data := instance updateIssue:'EDP-1' fields:dict.
data inspect.
|instance data|

instance := self newWithConnectionTo:'jira:8080' 
                 forUser:'EDP' 
                 withPassword:'exept'.     

data := instance postTransitionStateClosedForIssue:'EDP-1'.
data inspect.


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 19 Nov 2018 22:21:23 GMT