Skip to content

Add Recycle Bin endpoint (list, get, restore, delete, empty) - #1912

Open
officialasishkumar wants to merge 1 commit into
tableau:developmentfrom
officialasishkumar:feat/recycle-bin-endpoint
Open

officialasishkumar wants to merge 1 commit into
tableau:developmentfrom
officialasishkumar:feat/recycle-bin-endpoint

Conversation

@officialasishkumar

Copy link
Copy Markdown

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_bin endpoint (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 via RequestOptions
  • get_by_id(content_type, content_id)
  • restore(item, project, content_type=None) - restore into a project
  • delete(item, content_type=None) - permanently delete one item
  • empty(as_job=False) - permanently delete everything; with as_job=True returns the EmptyRecycleBin JobItem

New TSC.RecycleBinItem model (id, name, content_type, created_at, updated_at, original_path, is_read_only, owner_id, deleter_id) and a RequestOptions.Field.DeleterId filter field. item arguments accept either a RecycleBinItem (whose reported content type is used) or an id string plus content_type; content types are accepted in plural or singular form.

Test plan

test/test_recycle_bin.py covers URL building, the 3.29 version gate, parsing of list/get responses, filter/paging query params, plural/singular and invalid content types, restore (projectId query param, item and id forms, missing project/content type), delete, and empty with and without asJob. 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.

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>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 14:55
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @officialasishkumar to sign the Salesforce Inc. Contributor License Agreement.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Type 1] Add Recycle Bin Methods

2 participants