Code Repository
Introduction
Easy for Jira brings a seamless and efficient way to manage your Jira workflows. Our Code Repository feature is designed to streamline your coding process, making it more organized and accessible. This functionality allows you to create, manage, and reference reusable code across various components of your app, ensuring a smoother and more integrated workflow experience.
Features
Create Reusable Code
- Efficiency: Quickly write and store reusable code snippets that you can use anywhere in the app.
- Simplicity: Easy access to frequently used code, enhancing productivity and reducing lead time, which is our motto!
- Integration: Seamlessly reference your code in listeners, postfunctions, and the console. So you can reference it in the post functions that require that functionality and streamline the updates in that code, while keeping track of changes.
- Flexibility: Use your stored code across different modules, it allows you to import your code literally anywhere in the tool.
- Control: Keep track of different versions of your code. When you make edits to your code, it will keep track of the changes for you.
- Safety: Effortlessly rollback to previous versions when needed, ensuring reliability and stability.
- Convenience: Import codes into your projects with a simple
import <filename>
command (note: the .py
extension is not required).
- Accessibility: Enhance collaboration by easily sharing code among team members.
Creating and Storing Code
- Write Your Code: Create your code snippet in the "Code Repository" editor, in the sidebar.
- Set a unique filename to it: This is important because when your code is imported, if there's concurrency in the files, they won't work.
- Write the Documentation (optional
but your manager will like it very much) : This is important for maintenance, keep in mind that versioning won't cover your documentation, only the code.
- Save: Store your code in the repository with a unique filename. This will also allow you to document that specific code in the own editor, so anyone that opens it has access to the necessity of the code.
Referencing Code
- In Listeners, Postfunctions, or Console: Simply reference the code by its filename the same way you import files in your python editor.
- Example: Use
import myCodeSnippet
to integrate the snippet into your workflow.
Versioning and Rollback
- Track Changes: The system automatically logs versions each time you save changes.
- Rollback: Select a previous version from the version history to revert changes.
Advanced Usage Tips
Explore advanced functionalities and best practices for effective code management and integration within your Jira environment.
Troubleshooting Common Issues
Solutions to common challenges users might face while using the Code Repository feature, ensuring a smooth and uninterrupted workflow.
- My imported class/function is not working.
- Check if you are calling your class/function in the main file.
Best Practices
- Regular Updates: Keep your code snippets up to date for optimal performance.
- Clear Naming Conventions: Use descriptive filenames to easily identify and access code.
FAQs
- Q: How do I manage different versions of my code?
- A: The Code Repository automatically tracks each change. You can view and select any version from the version history.
- Q: Can I share my code snippets with team members?
- A: Yes, your team members can import your code snippets into their workflows using the
import
statement.
Support
If you encounter any issues or have further questions, open a ticket on our portal.
Issue
The Issue object is expertly engineered to streamline your development workflow, offering an extensive array of prebuilt functions tailored for scalability. This class, an extension of JIRA's issue functionality, simplifies complex processes and enhances productivity.
Type | Name | Parameters | Docstring |
---|
Property | is_subtask | | Checks if the issuetype is a subtask. |
Property | has_parent | | Checks if the issue has a parent. |
Property | has_attachments | | Checks if the issue has attachments. |
Property | has_comments | | Checks if the issue has comments. |
Property | has_links | | Checks if the issue has links to other issues. |
Property | last_comment | | Returns the last comment on the issue. |
Property | has_subtasks | | Checks if the issue has subtasks. |
Property | parent_summary | | Returns the summary of the parent issue if it exists; otherwise, returns the summary of the current issue. |
Property | child | | |
Property | parent_status | | Returns the summary of the parent issue if it exists; otherwise, returns the summary of the current issue. |
Property | transitions | | |
Property | comments | | Fetches the list of comments for the issue, list goes from older to newer Parameters: None. Returns List of Comments with the following structure: [ "self": "comment url", "id": "327254", "author": { "self": "user url", "accountId": "accountIdoftheUser", "emailAddress": "email@domain.com", "avatarUrls": {urls}, "displayName": "user.displayname", "active": true, "timeZone": "America/New_York", "accountType": "atlassian" }, "body": "message body is here", "updateAuthor": { "self": "url of the updateauthor", "accountId": "accountIdoftheUser", "emailAddress": "email@domain.com", "avatarUrls": {urls} "displayName": "display name of the user", "active": true, "timeZone": "America/New_York", "accountType": "atlassian" }, "created": "2024-01-22T18:06:48.618-0500", "updated": "2024-01-22T18:06:48.618-0500", "jsdPublic": bool ] |
Method | copy_field_from | source_issue, field | |
Method | copy_field_value | source_field, target_field | |
Method | assign_to | account_id: str or dict | Assigns the issue to the specified user by account id or user object (eg.: reporter field, assignee field) example: issue.assign_to(issue.fields.reporter) it uses the "set" function behind the curtains (return None) |
Method | set | field, value | Sets a field of the issue to the specified value in a separate thread. |
Method | delete | | Deletes the issue. |
Method | link_to | outward_key, link_type_name="Relates to" | Links the current issue to another issue with the specified link type. |
Method | transition | transition, **fields | Transitions an issue to the selected status. Parameters: `transition` (str or int, representing either the transition name or ID), additional keyword arguments for fields. If `transition` is a name, it must be an exact match. Returns API response. Raises: ValueError: If `transition` is neither a string nor an integer. |
Method | add_comment | comment, internal=False | Post a comment to a Jira issue. Parameters: `comment` (str), `internal` (bool, default False). Returns API response. |
Method | set_property | key: str, value: any | Sets an issue property. Properties are "arbitrary" so value can be any. # Added @ 12/12/23 |
Instance
The instance object, you can use it to interact with the instance.
Type | Name | Parameters | Docstring |
---|
Property | projects | | Property that returns a list of projects available in the remote instance. Returns: list: A list of project objects. |
Property | issuetypes | | Property that returns a list of issue types available in the remote instance. Returns: list: A list of issue type objects. |
Method | headers | method, url | Generates and returns the headers with an authentication token for HTTP requests. Args: method (str): The HTTP request method (e.g., 'GET', 'POST', 'PUT', 'DELETE'). url (str): The URL to which the HTTP request will be sent. Returns: dict: A dictionary containing HTTP headers with authentication token. |
Method | get | url, params={} | Sends an HTTP GET request to the specified URL with optional query parameters. Args: url (str): The URL to which the GET request will be sent. params (dict, optional): Optional query parameters to include in the request. Returns: requests.Response: The HTTP response object. |
Method | post | url, data, params={} | Sends an HTTP POST request to the specified URL with data and optional query parameters. Args: url (str): The URL to which the POST request will be sent. data: The data to include in the request body. params (dict, optional): Optional query parameters to include in the request. Returns: requests.Response: The HTTP response object. |
Method | put | url, data, params={} | Sends an HTTP PUT request to the specified URL with data and optional query parameters. Args: url (str): The URL to which the PUT request will be sent. data: The data to include in the request body. params (dict, optional): Optional query parameters to include in the request. Returns: requests.Response: The HTTP response object. |
Method | delete | url, params={} | Sends an HTTP DELETE request to the specified URL with optional query parameters. Args: url (str): The URL to which the DELETE request will be sent. params (dict, optional): Optional query parameters to include in the request. Returns: requests.Response: The HTTP response object. |
Method | search_issues | jql | Searches for issues in the remote instance using JQL (Jira Query Language). Args: jql (str): The Jira Query Language (JQL) query string. Returns: list: A list of Objectify objects representing the matching issues. |
Method | project | project_key | Retrieves a specific project by its key and returns it as a JiraProjectWrapper object. Args: project_key (str): The key of the project to retrieve. Returns: JiraProjectWrapper: A JiraProjectWrapper object representing the specified project. |
Logger
The logger object, you can use it to register log messages that will be displayed to users in the UI
Type | Name | Parameters | Docstring |
---|
Method | info | message | Logs an informational message with the given message text and additional metadata. Args: message (str): The informational message text. Returns: dict: A dictionary containing log information including level, message, and metadata. |
Method | warn | message | Logs a warning message with the given message text and additional metadata. Args: message (str): The warning message text. Returns: dict: A dictionary containing log information including level, message, and metadata. |
Method | error | message | Logs an error message with the given message text and additional metadata. Args: message (str): The error message text. Returns: dict: A dictionary containing log information including level, message, and metadata. |
Method | debug | message | Logs an error message with the given message text and additional metadata. Args: message (str): The error message text. Returns: dict: A dictionary containing log information including level, message, and metadata. |
Tempo
Tempo object, that will let you use the Tempo REST API in EFJ.
Type | Name | Parameters | Docstring |
---|
Property | base_url | | Property that returns the base URL for the Tempo API. Returns: str: The base URL for the Tempo API. |
Property | headers | | Returns the HTTP headers with the authorization token. Returns: dict: A dictionary containing HTTP headers with the authorization token. |
Method | set_token | api_token | Sets the API token for authentication and returns the updated TempoWrapper object. Args: api_token (str): The API token to set. Returns: TempoWrapper: The updated TempoWrapper object with the new API token. |
Method | get | resource, **kwargs | Sends an HTTP GET request to the specified resource with optional headers and parameters. Args: resource (str): The resource URL to send the GET request to. **kwargs: Additional keyword arguments for headers and parameters. Returns: requests.Response: The HTTP response object. |
Method | post | endpoint, data, **kwargs | Sends an HTTP POST request to the specified endpoint with data and optional headers and parameters. Args: endpoint (str): The endpoint URL to send the POST request to. data: The data to include in the request body. **kwargs: Additional keyword arguments for headers and parameters. Returns: requests.Response: The HTTP response object. |
Method | put | endpoint, data, **kwargs | Sends an HTTP PUT request to the specified endpoint with data and optional headers and parameters. Args: endpoint (str): The endpoint URL to send the PUT request to. data: The data to include in the request body. **kwargs: Additional keyword arguments for headers and parameters. Returns: requests.Response: The HTTP response object. |
Method | delete | endpoint, **kwargs | Sends an HTTP DELETE request to the specified endpoint with optional headers and parameters. Args: endpoint (str): The endpoint URL to send the DELETE request to. **kwargs: Additional keyword arguments for headers and parameters. Returns: requests.Response: The HTTP response object. |
Align
The align connector object, you can use it to interact with the parent Align Instance.
Type | Name | Parameters | Docstring |
---|
Property | headers | | Generates the headers required for making API requests. :return: A dictionary containing headers. |
Property | base_url | | Constructs the base URL for the API endpoints. :return: Base URL as a string. |
Method | set_token | token: str | Sets the authentication token for the Jira Align API. The TOKEN provided should be a raw string. When using this function, use it as align.set_token(r'YOURTOKEN') with the leading "r" as RAW :param token: Authentication token as a string. |
Method | set_site_url | url: str | Sets the base URL of the Jira Align site. :param url: URL of the Jira Align site. |
Method | get | endpoint, **kwargs | Makes a GET request to a specified endpoint. :param endpoint: API endpoint to make the GET request to. :param kwargs: Additional arguments to pass to the request method. :return: Response object from the requests library. |
Method | post | endpoint, data, **kwargs | Makes a POST request to a specified endpoint with provided data. :param endpoint: API endpoint to make the POST request to. :param data: Data to be sent in the POST request. :param kwargs: Additional arguments to pass to the request method. :return: Response object from the requests library. |
Method | put | endpoint, data, **kwargs | Makes a PUT request to a specified endpoint with provided data. :param endpoint: API endpoint to make the PUT request to. :param data: Data to be sent in the PUT request. :param kwargs: Additional arguments to pass to the request method. :return: Response object from the requests library. |
Method | patch | endpoint, data, **kwargs | Makes a PATCH request to a specified endpoint with provided data. :param endpoint: API endpoint to make the PATCH request to. :param data: Data to be sent in the PATCH request. :param kwargs: Additional arguments to pass to the request method. :return: Response object from the requests library. |
Method | delete | endpoint, **kwargs | Makes a DELETE request to a specified endpoint. :param endpoint: API endpoint to make the DELETE request to. :param kwargs: Additional arguments to pass to the request method. :return: Response object from the requests library. |
Method | get_all_users | | Fetches all users from Jira Align with pagination. :return: A list of user data. |
Method | add_user | user_dict, **kwargs | Adds a new user to Jira Align. :param user_dict: A dictionary containing the user's information. :param kwargs: Additional arguments to pass to the POST request method. :return: The response from the Jira Align API as a JSON object. |
Method | enable_user | user_id, **kwargs | Enables a user account in Jira Align. :param user_id: The unique identifier of the user to enable. :param kwargs: Additional arguments to pass to the PATCH request method. :return: The response from the Jira Align API as a JSON object. |
Method | disable_user | user_id, **kwargs | Disables a user account in Jira Align. :param user_id: The unique identifier of the user to disable. :param kwargs: Additional arguments to pass to the PATCH request method. :return: The response from the Jira Align API as a JSON object. |
Api
The API object, you can use it to interact with the instance API.
Type | Name | Parameters | Docstring |
---|
Property | instance_url | | Returns the instance url return self.client.baseUrl |
Property | projects | | Get a list of Jira projects. Returns: list of dict: A list of project information dictionaries. |
Property | issuetypes | | Get a list of Jira issuetypes. Returns: list of dict: A list of issuetypes information dictionaries. |
Property | fields | | Get a list of Jira Fields. Returns: list of dict: A list of field information dictionaries. |
Property | user_management | | Get an instance of UserManagement for managing user-related operations. Returns: UserManagement: An instance of the UserManagement class. |
Method | headers | method, url | Generate headers for making API requests. Args: method (str): HTTP request method (e.g., GET, POST, PUT). url (str): The URL for the API request. Returns: dict: A dictionary containing the HTTP headers. |
Method | create_issue | | Create a new Jira issue. Args: project_key_or_id (str or int): The key or ID of the project where the issue will be created. issuetype (str or int): The name or ID of the issue type. summary (str): The summary text for the issue. **kwargs: Additional fields and values to be set in the issue. Returns: JiraIssue: A JiraIssue object representing the newly created issue. |
Method | get_issue | key | Retrieve a Jira issue by its key. Args: key (str): The key of the Jira issue to retrieve. Returns: JiraIssue: A JiraIssue object representing the retrieved issue. |
Method | get | url, params={} | Send a GET request to the Jira API. Args: url (str): The URL for the GET request. params (dict): Optional query parameters to include in the request. Returns: requests.Response: The response from the GET request. |
Method | post | url, data, params={} | Send a POST request to the Jira API. Args: url (str): The URL for the POST request. data (dict): The data to be included in the request body. params (dict): Optional query parameters to include in the request. Returns: requests.Response: The response from the POST request. |
Method | put | url, data, params={} | Send a PUT request to the Jira API. Args: url (str): The URL for the PUT request. data (dict): The data to be included in the request body. params (dict): Optional query parameters to include in the request. Returns: requests.Response: The response from the PUT request. |
Method | delete | url, params={} | Send a DELETE request to the Jira API. Args: url (str): The URL for the DELETE request. params (dict): Optional query parameters to include in the request. Returns: requests.Response: The response from the DELETE request. |
Method | edit_issue | key, fields: dict | Edit a Jira issue by updating its fields. Args: key (str): The key of the Jira issue to edit. fields (dict): A dictionary containing the fields and their new values to be updated. Returns: requests.Response: The response from the PUT request to update the issue. |
Method | search_issues | jql | Search for Jira issues using JQL (Jira Query Language). Args: jql (str): The JQL query to search for issues. Returns: list of JiraIssue: A list of JiraIssue objects representing the matching issues. |
Method | get_user_groups | accountId | Get user groups for a given user account ID. Args: accountId (str): The user account ID. Returns: list of Objectify: A list of Objectify objects representing user groups. |
Method | add_user_to_group | accountId, group_name_or_id, type="groupname" | Add a user to a user group. Args: accountId (str): The user account ID. group_name_or_id (str): The name or ID of the user group. type (str): The type of the group (default is 'groupname'). Returns: requests.Response: The response from the POST request to add the user to the group. |
Method | remove_user_from_group | accountId, group_name_or_id, type="groupname" | Remove a user from a user group. Args: accountId (str): The user account ID. group_name_or_id (str): The name or ID of the user group. type (str): The type of the group (default is 'groupname'). Returns: requests.Response: The response from the DELETE request to remove the user from the group. |
Database
The 'ExternalDB' connector allows you to interact with external databases.
Type | Name | Parameters | Docstring |
---|
Method | query | query_string | Execute a SQL query on the connected database. This method creates a Query object which can be used to execute a SQL query and handle the results. It uses the current database connection to execute the query. Parameters: - query_string (str): The SQL query string to be executed. Returns: - Query: An instance of the nested Query class which can be used to fetch results. Example: - db.query('SELECT * FROM table_name') |
Method | all | as_object=False | Fetch all query results. This method fetches all the results from a SQL query execution and returns them. Parameters: - as_object (bool): If True, each row is returned as an object (not a dict); otherwise, as a dictionary. Returns: - list: A list containing all query results in the specified format. |
Method | first | as_object=False | Fetch the first result of the query. This method returns the first row of the query results. Parameters: - as_object (bool): If True, the result is returned as an object (not a dict); otherwise, as a dictionary. Returns: - dict or Objectify or None: The first query result in the specified format, or None if there are no results. |
Method | last | as_object=False | Fetch the last result of the query. This method returns the last row from the query results. Parameters: - as_object (bool): If True, the result is returned as an Objectify object; otherwise, as a dictionary. Returns: - dict or Objectify or None: The last query result in the specified format, or None if there are no results. |
Method | limit | n | Limit the number of results to the specified number. This method returns only the first 'n' results of the query. Parameters: - n (int): The number of results to return. Returns: - list: A list of the first 'n' query results in dictionary format. |
To initialize the object, simply do: database(connection_string)