-
-
Notifications
You must be signed in to change notification settings - Fork 88
Add endpoint for managing recycle bin #1920
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: main
Are you sure you want to change the base?
Conversation
@rohnsha0 thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
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.
Mostly just strings and docs matters.
Co-authored-by: Steve Piercy <[email protected]>
@@ -0,0 +1,147 @@ | |||
# Recycle Bin |
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.
Above this page title, insert required html meta stuff. See other files in this directory for examples.
# Recycle Bin | |
# Recycle bin |
@@ -0,0 +1,147 @@ | |||
# Recycle Bin | |||
|
|||
The Recycle Bin REST API provides endpoints to interact with the Plone Recycle Bin functionality. |
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.
The Recycle Bin REST API provides endpoints to interact with the Plone Recycle Bin functionality. | |
Plone's recycle bin functionality is managed through the `@recyclebin` endpoint. |
```http-example | ||
GET /@recyclebin HTTP/1.1 | ||
Accept: application/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.
This and all http example requests and responses should follow the pattern of other documentation in this directory. This allows tests to run both on the documentation and on the code. Here's example MyST markup that pulls in files as literal includes. You'll also need to create the included files.
plone.restapi/docs/source/endpoints/addons.md
Lines 17 to 30 in 70da1de
## Reading add-ons records | |
Reading a single record: | |
```{eval-rst} | |
.. http:example:: curl httpie python-requests | |
:request: ../../../src/plone/restapi/tests/http-examples/addons_get.req | |
``` | |
Example response: | |
```{literalinclude} ../../../src/plone/restapi/tests/http-examples/addons_get.resp | |
:language: http | |
``` |
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.
See also the contributing guide at https://6.docs.plone.org/plone.restapi/docs/source/contributing/index.html#generate-documentation-examples
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.
Steve is right--look at some of the other services for examples. We're supposed to have tests like the ones in test_documentation.py which actually call the endpoint, then record the request and response so they can be included in the docs. That way we will notice if something changes the response in the future.
"purge": f"{self.context.absolute_url()}/@recyclebin-purge", | ||
}, | ||
} | ||
) |
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.
This should paginate the results using the same batching utility that other services use. This service will also need to take params for the filters needed to support the UI.
|
||
|
||
class RecycleBinPurge(Service): | ||
"""POST /@recyclebin-purge - Permanently delete an item from the recycle bin""" |
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.
This should be a DELETE request to /@recyclebin/<item_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.
We should also support a DELETE on /@recyclebin
for emptying the entire recycle bin.
|
||
|
||
class RecycleBinRestore(Service): | ||
"""POST /@recyclebin-restore - Restore an item from the recycle bin""" |
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.
This should be a POST to /@recyclebin/<item_id>/restore
|
||
|
||
class RecycleBinGet(Service): | ||
"""GET /@recyclebin - List items in the recycle bin""" |
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'll also want a GET for /@recyclebin/<item_id>
to get one specific item (for the detail page).
```http-example | ||
GET /@recyclebin HTTP/1.1 | ||
Accept: application/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.
Steve is right--look at some of the other services for examples. We're supposed to have tests like the ones in test_documentation.py which actually call the endpoint, then record the request and response so they can be included in the docs. That way we will notice if something changes the response in the future.
should be merged after #4166
📚 Documentation preview 📚: https://plonerestapi--1920.org.readthedocs.build/en/1920/endpoints/recycle-bin.html