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