-
Notifications
You must be signed in to change notification settings - Fork 1.8k
added confluence-cloud-content-get to Atlassian Confluence Cloud Inte… #40623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: contrib/shysh-cmd_feature/add-confluence-cloud-content-get
Are you sure you want to change the base?
Conversation
|
Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @merit-maita will know the proposed changes are ready to be reviewed. |
Hi @shysh-cmd, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you very much for your contribution!
i added a couple of comments, please take a look.
in addition to that, please add a unit test to the added command, and add the new command to the readme file.
thanks
def validate_get_content_args(args: dict[str, str]): | ||
""" | ||
Validate arguments for confluence-cloud-content-get command, raise ValueError on invalid arguments. | ||
|
||
:type args: ``Dict[str, str]`` | ||
:param args: The command arguments provided by the user. | ||
|
||
:return: None | ||
""" | ||
content_id = args["content_id"] | ||
if not content_id: | ||
raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("content_id")) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add this validation, just add the key "required: true" to the arg in the yml file
""" | ||
validate_get_content_args(args) | ||
|
||
content_id = args["content_id"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
content_id = args["content_id"] | |
content_id = args.get("content_id") |
|
||
content_id = args["content_id"] | ||
params = {"body-format":"raw"} | ||
request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use urljoin() from commonserverpython you can rewrite the line as:
request_url = urljoin(URL_SUFFIX.get("CONTENT"), content_id)
and import the function in the integration
content_id = args["content_id"] | ||
params = {"body-format":"raw"} | ||
request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}" | ||
params = {"expand":"body.storage"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you add this line like this, it overrides your previous definition: params = {"body-format":"raw"}
response = client.http_request(method="GET", url_suffix=request_url, params=params) | ||
response_json = response.json() | ||
|
||
context = remove_empty_elements_for_context(response_json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have a common function in CommonServerPython that does this job it's called "remove_empty_elements()" you can use it
readable_hr = prepare_hr_for_content_create(response_json, "Content") | ||
|
||
return CommandResults( | ||
outputs_prefix=OUTPUT_PREFIX["CONTENT"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outputs_prefix=OUTPUT_PREFIX["CONTENT"], | |
outputs_prefix=OUTPUT_PREFIX.get("CONTENT"), |
params = {"expand":"body.storage"} | ||
|
||
response = client.http_request(method="GET", url_suffix=request_url, params=params) | ||
response_json = response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the search returned not found, the command should not return an error, the readable should states that the content was not found and not fail the command, please verify this case
@@ -2040,6 +2040,12 @@ script: | |||
- contextPath: ConfluenceCloud.Event.associatedObjects.objectType | |||
description: Type of the associated object. | |||
type: String | |||
- arguments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the outputs of the command
|
||
##### Atlassian Confluence Cloud | ||
|
||
- Added support for **confluence-cloud-content-get** command that retrieves a content item by content id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Added support for **confluence-cloud-content-get** command that retrieves a content item by content id. | |
- Added the **confluence-cloud-content-get** command to retrieve a content item. |
…gration
Contributing to Cortex XSOAR Content
Make sure to register your contribution by filling the contribution registration form
The Pull Request will be reviewed only after the contribution registration form is filled.
Status
Description
added confluence-cloud-content-get to Atlantis Confluence Cloud Integration
Must have