|
53 | 53 | from jira.resilientsession import PrepareRequestForRetry, ResilientSession
|
54 | 54 | from jira.resources import (
|
55 | 55 | AgileResource,
|
| 56 | + AppProperty, |
| 57 | + AtlassianConnectResource, |
56 | 58 | Attachment,
|
57 | 59 | Board,
|
58 | 60 | Comment,
|
@@ -352,6 +354,7 @@ class JIRA:
|
352 | 354 | "rest_api_version": "2",
|
353 | 355 | "agile_rest_path": AgileResource.AGILE_BASE_REST_PATH,
|
354 | 356 | "agile_rest_api_version": "1.0",
|
| 357 | + "ace_rest_api_version": "1", |
355 | 358 | "verify": True,
|
356 | 359 | "resilient": True,
|
357 | 360 | "async": False,
|
@@ -424,6 +427,7 @@ def __init__(
|
424 | 427 | * rest_path -- the root REST path to use. Defaults to ``api``, where the Jira REST resources live.
|
425 | 428 | * rest_api_version -- the version of the REST resources under rest_path to use. Defaults to ``2``.
|
426 | 429 | * agile_rest_path - the REST path to use for Jira Agile requests. Defaults to ``agile``.
|
| 430 | + * ace_rest_api_version -- the version of the REST resource to use for Jira Atlassian Connect. Defaults to ``1``. |
427 | 431 | * verify (Union[bool, str]) -- Verify SSL certs. (Default: ``True``).
|
428 | 432 | Or path to a CA_BUNDLE file or directory with certificates of trusted CAs, for the `requests` library to use.
|
429 | 433 | * client_cert (Union[str, Tuple[str,str]]) -- Path to file with both cert and key or a tuple of (cert,key), for the `requests` library to use for client side SSL.
|
@@ -3662,6 +3666,62 @@ def kill_session(self) -> Response:
|
3662 | 3666 | url = self.server_url + "/rest/auth/latest/session"
|
3663 | 3667 | return self._session.delete(url)
|
3664 | 3668 |
|
| 3669 | + # App properties |
| 3670 | + |
| 3671 | + def app_properties(self, addon_key: str) -> List[AppProperty]: |
| 3672 | + """Get a list of app properties. |
| 3673 | +
|
| 3674 | + Args: |
| 3675 | + addon_key (str): The key of the app, as defined in its descriptor |
| 3676 | +
|
| 3677 | + Returns: |
| 3678 | + List[AppProperty] |
| 3679 | + """ |
| 3680 | + r_json = self._get_json( |
| 3681 | + "addons/" + addon_key + "/properties", |
| 3682 | + base=AtlassianConnectResource.ACE_BASE_URL, |
| 3683 | + ) |
| 3684 | + properties = [ |
| 3685 | + AppProperty( |
| 3686 | + self._options, |
| 3687 | + self._session, |
| 3688 | + json_loads(self._session.get(raw_ap_json["self"])), |
| 3689 | + ) |
| 3690 | + for raw_ap_json in r_json["keys"] |
| 3691 | + ] |
| 3692 | + return properties |
| 3693 | + |
| 3694 | + def app_property(self, addon_key: str, property_key: str) -> AppProperty: |
| 3695 | + """Get an app property Resource from the server. |
| 3696 | +
|
| 3697 | + Args: |
| 3698 | + addon_key (str): The key of the app, as defined in its descriptor |
| 3699 | + property_key (str): The key of the property |
| 3700 | +
|
| 3701 | + Returns: |
| 3702 | + AppProperty |
| 3703 | + """ |
| 3704 | + return self._find_for_resource(AppProperty, (addon_key, property_key)) |
| 3705 | + |
| 3706 | + def create_app_property( |
| 3707 | + self, addon_key: str, property_key: str, data: Dict[str, Any] |
| 3708 | + ) -> Response: |
| 3709 | + """Create a new app property. |
| 3710 | +
|
| 3711 | + Args: |
| 3712 | + addon_key (str): The key of the app, as defined in its descriptor |
| 3713 | + property_key (str): The key of the property |
| 3714 | + data (Dict[str, Any]): The property value |
| 3715 | +
|
| 3716 | + Returns: |
| 3717 | + Response |
| 3718 | + """ |
| 3719 | + url = self._get_url( |
| 3720 | + "addons/" + addon_key + "/properties/" + property_key, |
| 3721 | + base=AtlassianConnectResource.ACE_BASE_URL, |
| 3722 | + ) |
| 3723 | + return self._session.put(url, data=json.dumps(data)) |
| 3724 | + |
3665 | 3725 | # Websudo
|
3666 | 3726 | def kill_websudo(self) -> Response | None:
|
3667 | 3727 | """Destroy the user's current WebSudo session.
|
|
0 commit comments