Repository navigation
Add Recycle Bin endpoint (list, get, restore, delete, empty) - #1912
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.