text stringlengths 81 112k |
|---|
Add a simple remote link from an issue to web resource.
This avoids the admin access problems from add_remote_link by just
using a simple object and presuming all fields are correct and not
requiring more complex ``application`` data.
``object`` should be a dict containing at l... |
Get a list of the transitions available on the specified issue to the current user.
:param issue: ID or key of the issue to get the transitions from
:param id: if present, get only the transition matching this ID
:param expand: extra information to fetch inside each transition
def transitions(... |
Get a transitionid available on the specified issue to the current user.
Look at https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1074 for json reference
:param issue: ID or key of the issue to get the transitions from
:param trans_name: iname of transition we are looking for
def ... |
Perform a transition on an issue.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored. Field values will be set o... |
Register a vote for the current authenticated user on an issue.
:param issue: ID or key of the issue to vote on
:rtype: Response
def add_vote(self, issue):
"""Register a vote for the current authenticated user on an issue.
:param issue: ID or key of the issue to vote on
:rtype... |
Remove the current authenticated user's vote from an issue.
:param issue: ID or key of the issue to remove vote on
def remove_vote(self, issue):
"""Remove the current authenticated user's vote from an issue.
:param issue: ID or key of the issue to remove vote on
"""
url = self... |
Add a user to an issue's watchers list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to add to the watchers list
def add_watcher(self, issue, watcher):
"""Add a user to an issue's watchers list.
:param issue: ID or key of the issue affected
... |
Remove a user from an issue's watch list.
:param issue: ID or key of the issue affected
:param watcher: username of the user to remove from the watchers list
:rtype: Response
def remove_watcher(self, issue, watcher):
"""Remove a user from an issue's watch list.
:param issue: I... |
Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklogs from
:rtype: List[Worklog]
def worklogs(self, issue):
"""Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklog... |
Add a new worklog entry on an issue and return a Resource for it.
:param issue: the issue to add the worklog to
:param timeSpent: a worklog entry with this amount of time spent, e.g. "2d"
:param adjustEstimate: (optional) allows the user to provide specific instructions to update the remaining
... |
Create a link between two issues.
:param type: the type of link to create
:param inwardIssue: the issue to link from
:param outwardIssue: the issue to link to
:param comment: a comment to add to the issues with the link. Should be
a dict containing ``body`` and ``visibility... |
Delete a link between two issues.
:param id: ID of the issue link to delete
def delete_issue_link(self, id):
"""Delete a link between two issues.
:param id: ID of the issue link to delete
"""
url = self._get_url('issueLink') + "/" + id
return self._session.delete(url) |
Get a list of issue link type Resources from the server.
:rtype: List[IssueLinkType]
def issue_link_types(self):
"""Get a list of issue link type Resources from the server.
:rtype: List[IssueLinkType]
"""
r_json = self._get_json('issueLinkType')
link_types = [IssueLink... |
Get a list of issue type Resources from the server.
:rtype: List[IssueType]
def issue_types(self):
"""Get a list of issue type Resources from the server.
:rtype: List[IssueType]
"""
r_json = self._get_json('issuetype')
issue_types = [IssueType(
self._optio... |
:param name: Name of the issue type
:type name: str
:rtype: IssueType
def issue_type_by_name(self, name):
"""
:param name: Name of the issue type
:type name: str
:rtype: IssueType
"""
issue_types = self.issue_types()
try:
issue_type = ... |
Returns request types supported by a service desk instance.
:param service_desk: The service desk instance.
:type service_desk: ServiceDesk
:rtype: List[RequestType]
def request_types(self, service_desk):
""" Returns request types supported by a service desk instance.
:param ser... |
Get a dict of all available permissions on the server.
:param projectKey: limit returned permissions to the specified project
:type projectKey: Optional[str]
:param projectId: limit returned permissions to the specified project
:type projectId: Optional[str]
:param issueKey: lim... |
Get a list of priority Resources from the server.
:rtype: List[Priority]
def priorities(self):
"""Get a list of priority Resources from the server.
:rtype: List[Priority]
"""
r_json = self._get_json('priority')
priorities = [Priority(
self._options, self._... |
Get a list of project Resources from the server visible to the current authenticated user.
:rtype: List[Project]
def projects(self):
"""Get a list of project Resources from the server visible to the current authenticated user.
:rtype: List[Project]
"""
r_json = self._get_json... |
Register an image file as a project avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
autodetect the picture's content type: this mechanis... |
Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_project_avatar`, use this method to confirm the avatar
for use. The final avatar can be a subarea of the uploaded image, which is customized with the
``crop... |
Set a project's avatar.
:param project: ID or key of the project to set the avatar on
:param avatar: ID of the avatar to set
def set_project_avatar(self, project, avatar):
"""Set a project's avatar.
:param project: ID or key of the project to set the avatar on
:param avatar: I... |
Delete a project's avatar.
:param project: ID or key of the project to delete the avatar from
:param avatar: ID of the avatar to delete
def delete_project_avatar(self, project, avatar):
"""Delete a project's avatar.
:param project: ID or key of the project to delete the avatar from
... |
Get a list of component Resources present on a project.
:param project: ID or key of the project to get components from
:type project: str
:rtype: List[Component]
def project_components(self, project):
"""Get a list of component Resources present on a project.
:param project: ... |
Get a list of version Resources present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:rtype: List[Version]
def project_versions(self, project):
"""Get a list of version Resources present on a project.
:param project: ID or key ... |
Get a version Resource by its name present on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param version_name: name of the version to search for
:type version_name: str
:rtype: Optional[Version]
def get_project_version_by_name(sel... |
Rename a version Resource on a project.
:param project: ID or key of the project to get versions from
:type project: str
:param old_name: old name of the version to rename
:type old_name: str
:param new_name: new name of the version to rename
:type new_name: str
... |
Get a dict of role names to resource locations for a project.
:param project: ID or key of the project to get roles from
def project_roles(self, project):
"""Get a dict of role names to resource locations for a project.
:param project: ID or key of the project to get roles from
"""
... |
Get a role Resource.
:param project: ID or key of the project to get the role from
:param id: ID of the role to get
def project_role(self, project, id):
"""Get a role Resource.
:param project: ID or key of the project to get the role from
:param id: ID of the role to get
... |
Get a list of resolution Resources from the server.
:rtype: List[Resolution]
def resolutions(self):
"""Get a list of resolution Resources from the server.
:rtype: List[Resolution]
"""
r_json = self._get_json('resolution')
resolutions = [Resolution(
self._o... |
Get a :class:`~jira.client.ResultList` of issue Resources matching a JQL search string.
:param jql_str: The JQL search string.
:type jql_str: str
:param startAt: Index of the first issue to return. (Default: 0)
:type startAt: int
:param maxResults: Maximum number of issues to re... |
Get a dict of server information for this JIRA instance.
:rtype: Dict[str, Any]
def server_info(self):
"""Get a dict of server information for this JIRA instance.
:rtype: Dict[str, Any]
"""
retry = 0
j = self._get_json('serverInfo')
while not j and retry < 3:
... |
Get a list of status Resources from the server.
:rtype: List[Status]
def statuses(self):
"""Get a list of status Resources from the server.
:rtype: List[Status]
"""
r_json = self._get_json('status')
statuses = [Status(self._options, self._session, raw_stat_json)
... |
Get a list of status category Resources from the server.
:rtype: List[StatusCategory]
def statuscategories(self):
"""Get a list of status category Resources from the server.
:rtype: List[StatusCategory]
"""
r_json = self._get_json('statuscategory')
statuscategories = [... |
Get a user Resource from the server.
:param id: ID of the user to get
:param id: str
:param expand: Extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: User
def user(self, id, expand=None):
"""Get a user Resource from the server.
... |
Get a list of user Resources that match the search string and can be assigned issues for projects.
:param username: A string to match usernames against
:type username: str
:param projectKeys: Comma-separated list of project keys to check for issue assignment permissions
:type projectKey... |
Get a list of user Resources that match the search string for assigning or creating issues.
This method is intended to find users that are eligible to create issues in a project or be assigned
to an existing issue. When searching for eligible creators, specify a project. When searching for eligible
... |
Register an image file as a user avatar.
The avatar created is temporary and must be confirmed before it can
be used.
Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
autodetect the picture's content type: this mechanism relies on... |
Confirm the temporary avatar image previously uploaded with the specified cropping.
After a successful registry with :py:meth:`create_temp_user_avatar`, use this method to confirm the avatar for
use. The final avatar can be a subarea of the uploaded image, which is customized with the
``croppin... |
Set a user's avatar.
:param username: the user to set the avatar for
:param avatar: ID of the avatar to set
def set_user_avatar(self, username, avatar):
"""Set a user's avatar.
:param username: the user to set the avatar for
:param avatar: ID of the avatar to set
"""
... |
Delete a user's avatar.
:param username: the user to delete the avatar from
:param avatar: ID of the avatar to remove
def delete_user_avatar(self, username, avatar):
"""Delete a user's avatar.
:param username: the user to delete the avatar from
:param avatar: ID of the avatar ... |
Get a list of user Resources that match the specified search string.
:param user: a string to match usernames, name or email against.
:type user: str
:param startAt: index of the first user to return.
:type startAt: int
:param maxResults: maximum number of users to return.
... |
Get a list of user Resources that match a username string and have browse permission for the issue or project.
:param user: a string to match usernames against.
:type user: str
:param issueKey: find users with browse permission for this issue.
:type issueKey: Optional[str]
:para... |
Create a version in a project and return a Resource for it.
:param name: name of the version to create
:type name: str
:param project: key of the project to create the version in
:type project: str
:param description: a description of the version
:type description: str
... |
Move a version within a project's ordered version list and return a new version Resource for it.
One, but not both, of ``after`` and ``position`` must be specified.
:param id: ID of the version to move
:param after: the self attribute of a version to place the specified version after (that is,... |
Get a version Resource.
:param id: ID of the version to get
:type id: str
:param expand: extra information to fetch inside each resource
:type expand: Optional[Any]
:rtype: Version
def version(self, id, expand=None):
"""Get a version Resource.
:param id: ID of... |
Get a dict of the current authenticated user's session information.
:param auth: Tuple of username and password.
:type auth: Optional[Tuple[str,str]]
:rtype: User
def session(self, auth=None):
"""Get a dict of the current authenticated user's session information.
:param auth:... |
Destroy the user's current WebSudo session.
Works only for non-cloud deployments, for others does nothing.
:rtype: Optional[Any]
def kill_websudo(self):
"""Destroy the user's current WebSudo session.
Works only for non-cloud deployments, for others does nothing.
:rtype: Opti... |
Creates a basic http session.
:param username: Username for the session
:type username: str
:param password: Password for the username
:type password: str
:param timeout: If set determines the timeout period for the Session.
:type timeout: Optional[int]
:rtype: ... |
Returns the full url based on JIRA base url and the path provided
:param path: The subpath desired.
:type path: str
:param base: The base url which should be prepended to the path
:type base: Optional[str]
:return Fully qualified URL
:rtype: str
def _get_url(self, path... |
Get the json for a given path and params.
:param path: The subpath required
:type path: str
:param params: Parameters to filter the json query.
:type params: Optional[Dict[str, Any]]
:param base: The Base JIRA URL, defaults to the instance base.
:type base: Optional[str]... |
Get the MIME type for a given stream of bytes
:param buff: Stream of bytes
:type buff: bytes
:rtype: str
def _get_mime_type(self, buff):
"""Get the MIME type for a given stream of bytes
:param buff: Stream of bytes
:type buff: bytes
:rtype: str
"""
... |
Rename a JIRA user.
:param old_user: Old username login
:type old_user: str
:param new_user: New username login
:type new_user: str
def rename_user(self, old_user, new_user):
"""Rename a JIRA user.
:param old_user: Old username login
:type old_user: str
... |
Deletes a JIRA User.
:param username: Username to delete
:type username: str
:return: Success of user deletion
:rtype: bool
def delete_user(self, username):
"""Deletes a JIRA User.
:param username: Username to delete
:type username: str
:return: Succe... |
Disable/deactivate the user.
:param username: User to be deactivated.
:type username: str
:rtype: Union[str, int]
def deactivate_user(self, username):
"""Disable/deactivate the user.
:param username: User to be deactivated.
:type username: str
:rtype: Union[s... |
Start jira re-indexing. Returns True if reindexing is in progress or not needed, or False.
If you call reindex() without any parameters it will perform a background reindex only if JIRA thinks it should do it.
:param force: reindex even if JIRA doesn't say this is needed, False by default.
:pa... |
Will call jira export to backup as zipped xml. Returning with success does not mean that the backup process finished.
def backup(self, filename='backup.zip', attachments=False):
"""Will call jira export to backup as zipped xml. Returning with success does not mean that the backup process finished."""
i... |
Return status of cloud backup as a dict.
Is there a way to get progress for Server version?
def backup_progress(self):
"""Return status of cloud backup as a dict.
Is there a way to get progress for Server version?
"""
epoch_time = int(time.time() * 1000)
if self.deploy... |
Return boolean based on 'alternativePercentage' and 'size' returned from backup_progress (cloud only).
def backup_complete(self):
"""Return boolean based on 'alternativePercentage' and 'size' returned from backup_progress (cloud only)."""
if self.deploymentType != 'Cloud':
logging.warning(
... |
Download backup file from WebDAV (cloud only).
def backup_download(self, filename=None):
"""Download backup file from WebDAV (cloud only)."""
if self.deploymentType != 'Cloud':
logging.warning(
'This functionality is not available in Server version')
return None
... |
Returns the username of the current user.
:rtype: str
def current_user(self):
"""Returns the username of the current user.
:rtype: str
"""
if not hasattr(self, '_serverInfo') or 'username' not in self._serverInfo:
url = self._get_url('serverInfo')
r = ... |
Delete project from Jira.
:param pid: JIRA projectID or Project or slug
:type pid: str
:return: True if project was deleted
:rtype: bool
:raises JIRAError: If project not found or not enough permissions
:raises ValueError: If pid parameter is not Project, slug or Projec... |
Create a project with the specified parameters.
:param key: Mandatory. Must match JIRA project key requirements, usually only 2-10 uppercase characters.
:type: str
:param name: If not specified it will use the key value.
:type name: Optional[str]
:param assignee: If not specifie... |
Create a new JIRA user.
:param username: the username of the new user
:type username: str
:param email: email address of the new user
:type email: str
:param directoryId: The directory ID the new user should be a part of (Default: 1)
:type directoryId: int
:param... |
Add a user to an existing group.
:param username: Username that will be added to specified group.
:type username: str
:param group: Group that the user will be added to.
:type group: str
:return: json response from Jira server for success or a value that evaluates as False in c... |
Remove a user from a group.
:param username: The user to remove from the group.
:param groupname: The group that the user will be removed from.
def remove_user_from_group(self, username, groupname):
"""Remove a user from a group.
:param username: The user to remove from the group.
... |
Get a list of board resources.
:param startAt: The starting index of the returned boards. Base index: 0.
:param maxResults: The maximum number of boards to return per page. Default: 50
:param type: Filters results to boards of the specified type. Valid values: scrum, kanban.
:param name... |
Get a list of sprint GreenHopperResources.
:param board_id: the board to get sprints from
:param extended: Used only by old GreenHopper API to fetch additional information like
startDate, endDate, completeDate, much slower because it requires an additional requests for each sprint.
... |
Return the total incompleted points this sprint.
def incompletedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=s... |
Return the completed issues for the sprint.
def removed_issues(self, board_id, sprint_id):
"""Return the completed issues for the sprint."""
r_json = self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)
... |
Return the total incompleted points this sprint.
def removedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.... |
Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from
def sprint_info(self, board_id, sprint_id):
"""Return the information about a sprint.
:param board_id: the board retrie... |
Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint`
def sprint(self, id):
"""Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
... |
Delete an agile board.
def delete_board(self, id):
"""Delete an agile board."""
board = Board(self._options, self._session, raw={'id': id})
board.delete() |
Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type project_ids: str
:param preset: What preset to use for this board. (Default: "scrum")
:type preset: 'kanban', 'scrum',... |
Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start date for the sprint.
:type startDate: Optional[Any]
:param endDate: E... |
Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was completed,
preferably before it started. A completed sprint's... |
Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: str
:param ignore_epics: ignore any issues listed in ``issue_keys`` that a... |
Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue.
def rank(self, issue, next_issue):
"""Rank an issue before another using the default Ra... |
Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder`` object (if no ``self`` link is present).
def dict2resource(raw, top... |
Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]]
def find(self,
id,
params=None,
):
"""Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str... |
Gets the url for the specified path.
:type path: str
:rtype: str
def _get_url(self, path):
""" Gets the url for the specified path.
:type path: str
:rtype: str
"""
options = self._options.copy()
options.update({'path': path})
return self._bas... |
Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this method
will only raise errors in case of user error.
:param fields: Field... |
Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
:param params: Parameters for the delet... |
Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[str]
def _load(self,
url,
headers=CaseInsensitiveDict(),
params=None,
path=None,
):
... |
Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any]
def _parse_raw(self, raw):
"""Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any]
"""
self.raw = raw
if not raw:
raise NotImplementedError("We cannot instantiate empty... |
Return the file content as a string.
def get(self):
"""Return the file content as a string."""
r = self._session.get(self.content, headers={'Accept': '*/*'})
return r.content |
Return the file content as an iterable stream.
def iter_content(self, chunk_size=1024):
"""Return the file content as an iterable stream."""
r = self._session.get(self.content, stream=True)
return r.iter_content(chunk_size) |
Delete this component from the server.
:param moveIssuesTo: the name of the component to which to move any issues this component is applied
def delete(self, moveIssuesTo=None):
"""Delete this component from the server.
:param moveIssuesTo: the name of the component to which to move any issues... |
Update this issue on the server.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored.
JIRA projects may ... |
Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select
:param field: The field name
:param value: The field's value
:type field: str
def add_field_value(self, field, value):
... |
Delete this issue from the server.
:param deleteSubtasks: if the issue has subtasks, this argument must be set to true for the call to succeed.
:type deleteSubtasks: bool
def delete(self, deleteSubtasks=False):
"""Delete this issue from the server.
:param deleteSubtasks: if the issue... |
Update a RemoteLink. 'object' is required.
For definitions of the allowable fields for 'object' and the keyword arguments 'globalId', 'application' and
'relationship', see https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+for+Remote+Issue+Links.
:param object: the link details to a... |
Delete this worklog entry from its associated issue.
:param adjustEstimate: one of ``new``, ``leave``, ``manual`` or ``auto``.
``auto`` is the default and adjusts the estimate automatically.
``leave`` leaves the estimate unchanged by this deletion.
:param newEstimate: combined w... |
Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role
:type groups: string, list or tuple
def upda... |
Add the specified users or groups to this project role.
One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role
:type groups: string, list or tuple
... |
Delete this project version from the server.
If neither of the arguments are specified, the version is
removed from all issues it is attached to.
:param moveFixIssuesTo: in issues for which this version is a fix
version, add this argument version to the fix version list
... |
Update this project version from the server. It is prior used to archive versions.
def update(self, **args):
"""Update this project version from the server. It is prior used to archive versions."""
data = {}
for field in args:
data[field] = args[field]
super(Version, self).... |
Return a JIRA object by loading the connection details from the `config.ini` file.
:param profile: The name of the section from config.ini file that stores server config url/username/password
:param url: URL of the Jira server
:param username: username to use for authentication
:param password: passwor... |
为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from flask import Flask
from werobot.contrib.flask import make_view
app = Flask(__name_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.