Skip to content

Commit 0fee409

Browse files
Gonchik TsymzhitovGonchik Tsymzhitov
authored andcommitted
JIRA: add a few method for work with Tempo Accounts
1 parent 2ded504 commit 0fee409

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

atlassian/jira.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,39 @@ def upload_plugin(self, plugin_path):
341341
upm_token = self.request(method='GET', path='rest/plugins/1.0/', headers=headers).headers['upm-token']
342342
url = 'rest/plugins/1.0/?token={upm_token}'.format(upm_token=upm_token)
343343
return self.post(url, files=files, headers=headers)
344+
345+
"""
346+
#######################################################################
347+
# Tempo Account Rest Api implements #
348+
#######################################################################
349+
"""
350+
351+
def tempo_account_get_accounts(self, skip_archived=None, expand=None):
352+
"""
353+
Get all Accounts that the logged in user has permission to browse.
354+
:param skip_archived: bool OPTIONAL: skip archived Accounts, either true or false, default value true.
355+
:param expand: bool OPTIONAL: With expanded data or not
356+
:return:
357+
"""
358+
params = {}
359+
if skip_archived is not None:
360+
params['skipArchived'] = skip_archived
361+
if expand is not None:
362+
params['expand'] = expand
363+
url = 'rest/tempo-accounts/1/account'
364+
return self.get(url, params=params)
365+
366+
def tempo_account_get_customers(self, query=None, count_accounts=None):
367+
"""
368+
Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer.
369+
:param query: OPTIONAL: query for search
370+
:param count_accounts: bool OPTIONAL: provide how many associated Accounts with Customer
371+
:return: list of customers
372+
"""
373+
params = {}
374+
if query is not None:
375+
params['query'] = query
376+
if count_accounts is not None:
377+
params['countAccounts'] = count_accounts
378+
url = 'rest/tempo-accounts/1/customer'
379+
return self.get(url, params=params)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# coding: utf8
2+
from atlassian import Jira
3+
from var import config
4+
import logging
5+
6+
jira = Jira(
7+
url='http://localhost:8080',
8+
username='admin',
9+
password='admin')
10+
11+
results = jira.tempo_account_get_customers()
12+
print("Count of Customers" + str(len(results)))
13+
14+
for result in results:
15+
print(result.get('key'), ' ', result.get('name'))

0 commit comments

Comments
 (0)