IGitt.Jira package¶
Submodules¶
IGitt.Jira.JiraComment module¶
Represents the comment resource from JIRA.
-
class
IGitt.Jira.JiraComment.
JiraComment
(token: Union[IGitt.Interfaces.BasicAuthorizationToken, IGitt.Jira.JiraOAuth1Token], issue_id: Union[int, str], comment_id: int)[source]¶ Bases:
IGitt.Jira.JiraMixin
,IGitt.Interfaces.Comment.Comment
Represents a comment on JIRA, mainly with a body and author - oh and it’s deletable!
Retrieves the author of the comment.
Returns: A User object.
-
body
¶ Retrieves the content of the comment:
Returns: A string containing the body.
-
created
¶ Retrieves a timestamp on when the comment was created.
Returns: A datetime.datetime object representing the time of creation of the comment.
-
number
¶ Retrieves the id of the comment.
-
repository
¶ Returns the JIRA project this comment was posted in, as a JiraRepository instance.
-
type
¶ Retrieves the type of the comment it links to.
-
updated
¶ Retrieves a timestamp on when the comment was updated the last time.
Returns: A datetime.datetime object representing the time of the last update of the comment.
IGitt.Jira.JiraIssue module¶
This contains the Issue implementation for Jira.
-
class
IGitt.Jira.JiraIssue.
JiraIssue
(token: IGitt.Jira.JiraOAuth1Token, identifier: Union[str, int])[source]¶ Bases:
IGitt.Jira.JiraMixin
,IGitt.Interfaces.Issue.Issue
This class represents an Issue resource on JIRA.
-
add_comment
(body) → IGitt.Jira.JiraComment.JiraComment[source]¶ Adds a comment to the issue.
Parameters: body – The content of the comment. Returns: The newly created comment. Raises: RuntimeError – If something goes wrong (network, auth…).
-
assignees
¶ Retrieves the assignees of the issue.
Note: JIRA only allows one assignee per issue.
Returns: A set of usernames of assignees.
Retrieves the author of the issue.
Returns: A string containing the username of author.
-
available_labels
¶ Compiles a set of labels that are available for labelling this issue.
Returns: A set of label captions.
-
comments
¶ Retrieves the comments on the issue.
Returns: A set of JiraComment instances.
-
static
create
(token: IGitt.Jira.JiraOAuth1Token, project: str, title: str, body: str = '', issue_type: Optional[str] = None)[source]¶ Creates a new issue with the given title and body on the specified project.
Parameters: - token – The OAuth 1.0 token to be used for authentication.
- project – The identifier of the project in which the issue should be opened.
- issue_type – The name of the issue type resource to be used.
- title – The title of the issue.
- body – The description of the issue.
Returns: A new JiraIssue object.
-
created
¶ Retrieves a timestamp on when the comment was created.
Returns: A datetime.datetime object representing the time of creation of the issue.
-
description
¶ Retrieves the description of the issue.
Returns: A string containing the description of the issue.
-
labels
¶ Retrieves the set of labels the issue is currently tagged with.
Returns: The set of labels.
-
mrs_closed_by
¶ Returns the merge requests that close this issue.
-
number
¶ Retrieves the unique identifier of the issue.
Returns: An integer representing the id of the issue.
-
reactions
¶ Retrieves the reactions / award emojis applied on the issue.
-
reopen
()[source]¶ Reopens the issue.
Raises: RuntimeError – If something goes wrong (network, auth…).
-
state
¶ Retrieves the state of the issue. JIRA determines the state of an issue based on
resolution
property of issue resource. Ifresolution
isnull
, then the issue is still open, otherwise it has been closed or resolved.Returns: Either IssueStates.OPEN or IssueStates.CLOSED.
-
title
¶ Retrieves the title or summary of the issue.
Returns: A string containing the title of summary of the issue.
-
updated
¶ Retrieves a timestamp on when the comment was updated the last time.
Returns: A datetime.datetime object representing the last updated time of the issue.
-
web_url
¶ Returns a human accessible web url for the corresponding issue.
Returns: A string containing the web link for the issue.
-
IGitt.Jira.JiraRepository module¶
Contains a JIRA project implementation.
-
class
IGitt.Jira.JiraRepository.
JiraRepository
(token: Union[IGitt.Jira.JiraOAuth1Token, IGitt.Interfaces.BasicAuthorizationToken], identifier: Union[str, int])[source]¶ Bases:
IGitt.Jira.JiraMixin
,IGitt.Interfaces.Repository.Repository
Represents a project resource on JIRA.
-
clone_url
¶ JIRA projects don’t actually hold a codebase which can be cloned.
-
commits
¶ JIRA projects don’t actually hold a codebase and hence has no commits.
-
static
create
(token: Union[IGitt.Jira.JiraOAuth1Token, IGitt.Interfaces.BasicAuthorizationToken], name: str, project_type: Optional[str] = None, project_key: Optional[str] = None, project_lead: Optional[str] = None, **kwargs)[source]¶ Creates a new JIRA project and returns it.
Parameters: - name – The name of the project.
- project_type – The type of the project.
- project_key – The key identifier of the project to be set.
- project_lead – The project lead.
-
create_file
(*args, **kwargs)[source]¶ JIRA projects don’t actually hold a codebase. So, new files can’t be created.
-
create_issue
(issue_type: str, title: str, body: str = '') → IGitt.Jira.JiraIssue.JiraIssue[source]¶ Creates a new issue in the project.
-
create_label
(name: str, description: Optional[str] = None, label_type: Optional[str] = None, **kwargs)[source]¶ Creates a new label.
-
create_merge_request
(*args, **kwargs)[source]¶ JIRA projects don’t actually hold a codebase to merge changes into.
-
delete_label
(name: str)[source]¶ Deletes the specified label.
Raises: ElementDoesntExistError if no such label exists.
-
filter_issues
(state: str = 'opened') → set[source]¶ Filters issues from a repository based on the chosen properties.
-
full_name
¶ JIRA doesn’t have an account based naming scheme like GitHub. So, this property returns just the project name.
-
get_issue
(issue_number: int)[source]¶ Retrieves the specified issue from the project.
Returns: A JiraIssue object representing the specified issue.
-
get_mr
(mr_number: int)[source]¶ JIRA doesn’t actually hold a codebase and doesn’t support sending merge requests.
-
get_permission_level
(*args, **kwargs) → IGitt.Interfaces.AccessLevel[source]¶ JIRA provides support for custom permission schemes for users which cannot be therefore generalized into an
AccessLevel
enum.
-
hooks
¶ Retrieves all the webhooks this project is hooked to.
Returns: A set of URLs.
-
identifier
¶ Returns the unique identifier of the corresponding repository.
-
issues
¶ Retrieves the set of open JiraIssue objects for this project.
-
merge_requests
¶ JIRA projects don’t actually hold a codebase, so merge requests do not exist.
-
parent
¶ JIRA projects do not support or maintain a fork relationship between each other.
-
register_hook
(url: str, _: Optional[str] = None, events: Optional[Set[IGitt.Interfaces.Repository.WebhookEvents]] = None)[source]¶ Registers a webhook to the given URL.
-
search_issues
(created_after: Optional[datetime.datetime] = None, created_before: Optional[datetime.datetime] = None, updated_after: Optional[datetime.datetime] = None, updated_before: Optional[datetime.datetime] = None, state: Optional[IGitt.Interfaces.IssueStates] = None)[source]¶ List open issues in the repository.
-
top_level_org
¶ JIRA doesn’t support organizations.
-
web_url
¶ Returns a human accessible web url for the corresponding project.
-
Module contents¶
This package contains the JIRA implementations of the interfaces in server.git.Interfaces.
-
class
IGitt.Jira.
JiraMixin
[source]¶ Bases:
IGitt.Utils.CachedDataMixin
Base object for all things on Jira.
-
hoster
¶ Returns jira.
-
url
¶ Returns JIRA API url.
-
web_url
¶ Returns the web link for the corresponding JIRA object.
-
-
class
IGitt.Jira.
JiraOAuth1Token
(client_key, key, secret)[source]¶ Bases:
IGitt.Interfaces.Token
Object representation of JIRA OAuth v1.0 token.
-
auth
¶ A AuthBase instance that can be readily used to configure any kind of authentication easily with requests library.
-
headers
¶ The Authorization headers.
-
parameter
¶ Parameter to be used for authentication
-
value
¶ Token value
-