Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ def get_label_elements(
sort_order: Literal["ASC", "DESC"] | None = None,
offset: int | None = None,
limit: int | None = None,
x_gdc_correlation: str | None = None,
) -> list[str]:
"""
Get existing values for a label.
Expand Down Expand Up @@ -641,6 +642,9 @@ def get_label_elements(
Optional parameter specifying the offset for the returned values.
limit (Optional[int]):
Optional parameter specifying the limit for the returned values.
x_gdc_correlation (Optional[str]):
Optional correlation header value (x-gdc-correlation) forwarded to the backend
for query tagging and debugging purposes.
Returns:
list of label values
"""
Expand Down Expand Up @@ -679,6 +683,8 @@ def get_label_elements(
paging_params["offset"] = offset
if limit is not None:
paging_params["limit"] = limit
if x_gdc_correlation is not None:
paging_params["x_gdc_correlation"] = x_gdc_correlation

# TODO - fix return type of Paging.next in Backend + add support for this API to SDK
values = self._actions_api.compute_label_elements_post(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,23 @@ def test_label_elements(test_config):
assert label_values == ["Delivered"]


def test_get_label_elements_forwards_x_gdc_correlation():
mock_api_client = MagicMock()
mock_api_client.actions_api.compute_label_elements_post.return_value = {"elements": []}
from gooddata_sdk.catalog.workspace.content_service import CatalogWorkspaceContentService

service = CatalogWorkspaceContentService(mock_api_client)

service.get_label_elements(
"workspace_id",
"order_status",
x_gdc_correlation="dashboard-id:widget-id",
)

call_kwargs = mock_api_client.actions_api.compute_label_elements_post.call_args
assert call_kwargs[1].get("x_gdc_correlation") == "dashboard-id:widget-id"


@gd_vcr.use_cassette(str(_fixtures_dir / "explicit_workspace_data_filter.yaml"))
def test_explicit_workspace_data_filter(test_config):
"""
Expand Down
Loading