diff --git a/packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py b/packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py index 606331e07..4910b4393 100644 --- a/packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py +++ b/packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py @@ -191,6 +191,18 @@ def list_workspace_settings(self, workspace_id: str) -> list[CatalogWorkspaceSet workspace_settings = load_all_entities(get_workspace_settings).data return [CatalogWorkspaceSetting.from_api(ws) for ws in workspace_settings] + def register_workspace_upload_notification(self, workspace_id: str) -> None: + """Invalidate cache of computed reports in a workspace to force recomputation with new data. + + Args: + workspace_id (str): + Workspace identification string e.g. "demo" + + Returns: + None + """ + self._actions_api.register_workspace_upload_notification(workspace_id) + def resolve_all_workspace_settings(self, workspace_id: str) -> dict: """Resolve values for all settings in a workspace. diff --git a/packages/gooddata-sdk/tests/catalog/fixtures/workspaces/register_workspace_upload_notification.yaml b/packages/gooddata-sdk/tests/catalog/fixtures/workspaces/register_workspace_upload_notification.yaml new file mode 100644 index 000000000..0a8ed2beb --- /dev/null +++ b/packages/gooddata-sdk/tests/catalog/fixtures/workspaces/register_workspace_upload_notification.yaml @@ -0,0 +1,31 @@ +interactions: + - request: + body: null + headers: + Accept-Encoding: + - br, gzip, deflate + Content-Type: + - application/json + X-GDC-VALIDATE-RELATIONS: + - 'true' + X-Requested-With: + - XMLHttpRequest + method: POST + uri: http://localhost:3000/api/v1/actions/workspaces/demo/uploadNotification + response: + body: + string: '' + headers: + DATE: &id001 + - PLACEHOLDER + Expires: + - '0' + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-GDC-TRACE-ID: *id001 + status: + code: 204 + message: No Content +version: 1 diff --git a/packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py b/packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py index cd056817b..2c33fccfb 100644 --- a/packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py +++ b/packages/gooddata-sdk/tests/catalog/test_catalog_workspace.py @@ -1032,3 +1032,10 @@ def test_layout_filter_views(test_config): assert filter_views_expected == filter_views_o finally: safe_delete(sdk.catalog_workspace.put_declarative_filter_views, workspace_id, []) + + +@gd_vcr.use_cassette(str(_fixtures_dir / "register_workspace_upload_notification.yaml")) +def test_register_workspace_upload_notification(test_config): + sdk = GoodDataSdk.create(host_=test_config["host"], token_=test_config["token"]) + # Calling register_workspace_upload_notification should succeed (HTTP 204, no body) + sdk.catalog_workspace.register_workspace_upload_notification(test_config["workspace"])