Skip to content

Commit adfef2a

Browse files
committed
feat: add locale to gooddata-sdk
jira: CQ-1650 risk: low
1 parent c275e6c commit adfef2a

File tree

2 files changed

+26
-0
lines changed
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace

2 files changed

+26
-0
lines changed

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/declarative_model/workspace/logical_model/dataset/dataset.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from gooddata_api_client.model.declarative_dataset_sql import DeclarativeDatasetSql
1414
from gooddata_api_client.model.declarative_fact import DeclarativeFact
1515
from gooddata_api_client.model.declarative_label import DeclarativeLabel
16+
from gooddata_api_client.model.declarative_label_translation import DeclarativeLabelTranslation
1617
from gooddata_api_client.model.declarative_reference import DeclarativeReference
1718
from gooddata_api_client.model.declarative_reference_source import DeclarativeReferenceSource
1819
from gooddata_api_client.model.declarative_source_fact_reference import DeclarativeSourceFactReference
@@ -77,6 +78,7 @@ class CatalogDeclarativeAttribute(Base):
7778
description: Optional[str] = None
7879
tags: Optional[list[str]] = None
7980
is_hidden: Optional[bool] = None
81+
locale: Optional[str] = None
8082

8183
@staticmethod
8284
def client_class() -> type[DeclarativeAttribute]:
@@ -143,6 +145,16 @@ def client_class() -> type[DeclarativeDatasetSql]:
143145
return DeclarativeDatasetSql
144146

145147

148+
@attr.s(auto_attribs=True, kw_only=True)
149+
class CatalogDeclarativeLabelTranslation(Base):
150+
locale: str
151+
source_column: str
152+
153+
@staticmethod
154+
def client_class() -> type[DeclarativeLabelTranslation]:
155+
return DeclarativeLabelTranslation
156+
157+
146158
@attr.s(auto_attribs=True, kw_only=True)
147159
class CatalogDeclarativeLabel(Base):
148160
id: str
@@ -153,6 +165,8 @@ class CatalogDeclarativeLabel(Base):
153165
tags: Optional[list[str]] = None
154166
value_type: Optional[str] = None
155167
is_hidden: Optional[bool] = None
168+
locale: Optional[str] = None
169+
translations: Optional[list[CatalogDeclarativeLabelTranslation]] = None
156170

157171
@staticmethod
158172
def client_class() -> type[DeclarativeLabel]:

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/content_objects/dataset.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def value_type(self) -> bool:
3636
def is_hidden(self) -> Optional[bool]:
3737
return safeget(self.json_api_attributes, ["isHidden"])
3838

39+
@property
40+
def locale(self) -> Optional[str]:
41+
return safeget(self.json_api_attributes, ["locale"])
42+
43+
@property
44+
def translations(self) -> Optional[list[dict[str, str]]]:
45+
return safeget(self.json_api_attributes, ["translations"])
46+
3947
def as_computable(self) -> Attribute:
4048
return Attribute(local_id=self.id, label=self.id)
4149

@@ -73,6 +81,10 @@ def granularity(self) -> Union[str, None]:
7381
def is_hidden(self) -> Optional[bool]:
7482
return safeget(self.json_api_attributes, ["isHidden"])
7583

84+
@property
85+
def locale(self) -> Optional[bool]:
86+
return safeget(self.json_api_attributes, ["locale"])
87+
7688
def primary_label(self) -> Union[CatalogLabel, None]:
7789
# use cast as mypy is not applying next, it claims, type is filter[CatalogLabel]
7890
return cast(Union[CatalogLabel, None], next(filter(lambda x: x.primary, self.labels), None))

0 commit comments

Comments
 (0)