Skip to content

Commit

Permalink
Merge pull request #93 from gonchik/master
Browse files Browse the repository at this point in the history
Configuration and polish with rest url
  • Loading branch information
gonchik committed Oct 18, 2018
2 parents 8982e91 + d6d6fa3 commit f485db8
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -69,7 +69,7 @@ instance/
.scrapy

# Sphinx documentation
docs/_build/
docs/_build
Thumbs.db
.DS_Store

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Expand Up @@ -9,7 +9,7 @@ Getting Started
---------------

1. Fork the repository on GitHub:
https://github.com/AstroMatt/atlassian-python-api
https://github.com/atlassian-api/atlassian-python-api
2. Make changes
3. Send pull request

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -95,7 +95,7 @@ Development and Deployment (For contributors)
See the `Contribution guidelines for this project`_ for details on how to make changes to this library.

.. _Contribution guidelines for this project: CONTRIBUTING.rst
.. |Build Status| image:: https://travis-ci.org/AstroMatt/atlassian-python-api.svg?branch=master
.. |Build Status| image:: https://travis-ci.org/atlassian-api/atlassian-python-api.svg?branch=master
:target: https://pypi.python.org/pypi/atlassian-python-api
:alt: Build status
.. |PyPI version| image:: https://badge.fury.io/py/atlassian-python-api.svg
Expand All @@ -105,5 +105,5 @@ See the `Contribution guidelines for this project`_ for details on how to make c
:target: https://pypi.python.org/pypi/atlassian-python-api
:alt: License
.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/c822908f507544fe98ae37b25518ae3d
:target: https://www.codacy.com/project/gonchik/atlassian-python-api/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AstroMatt/atlassian-python-api&utm_campaign=Badge_Grade_Dashboard
:target: https://www.codacy.com/project/gonchik/atlassian-python-api/dashboard
:alt: Codacy Badge
2 changes: 1 addition & 1 deletion atlassian/VERSION
@@ -1 +1 @@
1.11.1
1.11.2
17 changes: 11 additions & 6 deletions atlassian/confluence.py
Expand Up @@ -231,19 +231,24 @@ def remove_page_from_trash(self, page_id):

def remove_page_as_draft(self, page_id):
"""
This method removes a page from trash if it is draft
This method removes a page from trash if it is a draft
:param page_id:
:return:
"""
return self.remove_page(page_id=page_id, status='draft')

def remove_page(self, page_id, status=None):
def remove_page(self, page_id, status=None, recursive=False):
"""
This method removes a page
This method removes a page, if it has recursive flag, method removes including child pages
:param page_id:
:param status: OPTIONAL: type of page
:param recursive: OPTIONAL: if True - will recursively delete all children pages too
:return:
"""
if recursive:
children_pages = self.get_page_child_by_type(page_id)
for children_page in children_pages:
self.remove_page(children_page.get('id'), status, recursive)
if status is None:
url = 'rest/api/content/{page_id}'.format(page_id=page_id)
else:
Expand Down Expand Up @@ -323,7 +328,7 @@ def attach_file(self, filename, page_id=None, title=None, space=None, comment=No
else:
log.warn("No 'page_id' found, not uploading attachments")
return None

def set_page_label(self, page_id, label):
"""
Set a label on the page
Expand All @@ -332,8 +337,8 @@ def set_page_label(self, page_id, label):
:return:
"""
url = 'rest/api/content/{page_id}/label'.format(page_id=page_id)
data= { 'prefix': 'global',
'name': label}
data = {'prefix': 'global',
'name': label}
return self.post(path=url, data=data)

def history(self, page_id):
Expand Down
26 changes: 13 additions & 13 deletions atlassian/portfolio.py
Expand Up @@ -24,54 +24,54 @@ def get_epic(self, epic):
'estimates': estimates}

def get_plan(self):
url = '/rest/roadmap/1.0/plans/{0}.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}.json'.format(self.plan_id)
return self.get(url)

def get_stages(self):
url = '/rest/roadmap/1.0/plans/{0}/stages.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/stages.json'.format(self.plan_id)
return self.get(url)

def get_teams(self):
url = '/rest/roadmap/1.0/plans/{0}/teams.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/teams.json'.format(self.plan_id)
return self.get(url)

def get_team_name(self, team_id):
all_teams = self.get_teams()['collection']
return [team['title'] for team in all_teams if team['id'] == str(team_id)][0]

def get_config(self):
url = '/rest/roadmap/1.0/plans/{0}/config.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/config.json'.format(self.plan_id)
return self.get(url)

def get_persons(self):
url = '/rest/roadmap/1.0/plans/{0}/persons.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/persons.json'.format(self.plan_id)
return self.get(url)

def get_streams(self):
url = '/rest/roadmap/1.0/plans/{0}/streams.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/streams.json'.format(self.plan_id)
return self.get(url)

def get_releases(self):
return self.get_streams()

def get_themes(self):
url = '/rest/roadmap/1.0/plans/{0}/themes.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/themes.json'.format(self.plan_id)
return self.get(url)

def get_state(self):
url = '/rest/roadmap/1.0/scheduling/{0}/state.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/scheduling/{0}/state.json'.format(self.plan_id)
return self.get(url)

def get_filter(self, limit=500):
url = '/rest/roadmap/1.0/plans/{0}/workitems/filter.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/{0}/workitems/filter.json'.format(self.plan_id)
return self.post(url, data={'limit': limit})

def get_filters(self, query_string):
url = '/rest/roadmap/1.0/system/filters.json?queryString={0}'.format(query_string)
url = 'rest/roadmap/1.0/system/filters.json?queryString={0}'.format(query_string)
return self.get(url)

def get_dependencies(self, workitem_id, plan_version):
url = '/rest/roadmap/1.0/workitems/{0}/dependencies.json?planVersion={1}'.format(workitem_id, plan_version)
url = 'rest/roadmap/1.0/workitems/{0}/dependencies.json?planVersion={1}'.format(workitem_id, plan_version)
return self.get(url)

def get_stage_name(self, stage_id):
Expand All @@ -82,12 +82,12 @@ def get_estimates_dict(self, estimates):
return {self.get_stage_name(stage['targetId']): stage['value'] for stage in estimates['stages']}

def import_workitem(self, data):
url = '/rest/roadmap/1.0/plans/bulk/{0}/workitems.json'.format(self.plan_id)
url = 'rest/roadmap/1.0/plans/bulk/{0}/workitems.json'.format(self.plan_id)
return self.post(url, data=data)

def get_jql_issues(self, jql, limit=500, exclude_linked=True, estimation_method='estimates',
epic_fetch_enabled=True, load_story_points=True):
url = '/rest/roadmap/1.0/system/import.json'
url = 'rest/roadmap/1.0/system/import.json'
data = {'planId': str(self.plan_id),
'query': jql,
'excludeLinked': exclude_linked,
Expand Down
Empty file modified docs/Makefile 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion docs/index.rst
Expand Up @@ -51,7 +51,7 @@ Add a connection:
bitbucket
service_desk

.. |Build Status| image:: https://travis-ci.org/AstroMatt/atlassian-python-api.svg?branch=master
.. |Build Status| image:: https://travis-ci.org/atlassian-api/atlassian-python-api.svg?branch=master
:target: https://pypi.python.org/pypi/atlassian-python-api
:alt: Build status
.. |PyPI version| image:: https://badge.fury.io/py/atlassian-python-api.svg
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -14,12 +14,12 @@
long_description=long_description,
license='Apache License 2.0',
version=version,
download_url='https://github.com/AstroMatt/atlassian-python-api',
download_url='https://github.com/atlassian-api/atlassian-python-api',

author='Matt Harasymczuk',
author_email='matt@astrotech.io',
url='https://github.com/AstroMatt/atlassian-python-api',
keywords='atlassian jira confluence bitbucket bamboo crowd portfolio rest api',
url='https://github.com/atlassian-api/atlassian-python-api',
keywords='atlassian jira confluence bitbucket bamboo crowd portfolio servicedesk jsd rest api',

packages=find_packages(),
package_dir={'atlassian': 'atlassian'},
Expand Down

0 comments on commit f485db8

Please sign in to comment.