Repository navigation
Add Recycle Bin endpoint (list, get, restore, delete, empty) - #1912
officialasishkumar wants to merge 1 commit into
Conversation
Wrap the five Recycle Bin REST methods introduced in API 3.29: - get(content_type, req_options): list deleted workbooks, datasources, flows or projects, with filter/sort/paging through RequestOptions - get_by_id(content_type, content_id) - restore(item, project, content_type=None): POST .../restore?projectId= - delete(item, content_type=None): permanently delete one item - empty(as_job=False): delete everything, optionally as an EmptyRecycleBin job returned as a JobItem Add RecycleBinItem (id, name, content_type, created/updated times, original_path, is_read_only, owner_id, deleter_id) and export it from the package. Content types accept the plural URL form or the singular form the server reports on an item, so a RecycleBinItem can be passed straight to restore()/delete(). Add the DeleterId filter field used by the list method. Fixes tableau#1896 Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
|
Thanks for the contribution! Before we can merge this, we need @officialasishkumar to sign the Salesforce Inc. Contributor License Agreement. |
|
Thanks for the contribution, @officialasishkumar. Before we can review and merge this, the Salesforce Contributor License Agreement needs to be signed. The link is in the CLA bot's comment above. If you hit any problems signing it, or have questions about the PR, let us know here or reach out in the devplat Slack channel and we can help. Comment drafted with AI assistance (Claude) and posted by Jac. |
|
Thanks for this, @officialasishkumar. I checked the verbs, query parameters (
Drafted with AI assistance (Claude); reviewed and posted by Jac. |
Motivation
Closes #1896. Deleted workbooks, data sources, flows and projects sit in the site's recycle bin, and TSC had no way to list, restore or permanently delete them. Permanently deleting is also the only way to free the content name/URL for a later re-publish (the issue's use case).
Behavior change
New
server.recycle_binendpoint (REST API 3.29+), purely additive:get(content_type, req_options=None)- list deleted content of one type ("workbooks","datasources","flows","projects"), with filter/sort/paging viaRequestOptionsget_by_id(content_type, content_id)restore(item, project, content_type=None)- restore into a projectdelete(item, content_type=None)- permanently delete one itemempty(as_job=False)- permanently delete everything; withas_job=Truereturns theEmptyRecycleBinJobItemNew
TSC.RecycleBinItemmodel (id, name, content_type, created_at, updated_at, original_path, is_read_only, owner_id, deleter_id) and aRequestOptions.Field.DeleterIdfilter field.itemarguments accept either aRecycleBinItem(whose reported content type is used) or an id string pluscontent_type; content types are accepted in plural or singular form.Test plan
test/test_recycle_bin.pycovers URL building, the 3.29 version gate, parsing of list/get responses, filter/paging query params, plural/singular and invalid content types, restore (projectIdquery param, item and id forms, missing project/content type), delete, andemptywith and withoutasJob. The full suite passes locally (1071 passed), and black and mypy are clean. Request/response shapes follow the REST API reference; not verified against a live server.