Skip to content

Commit a91a3af

Browse files
committed
Merge
2 parents 5894be5 + 11ca0c0 commit a91a3af

8 files changed

Lines changed: 79 additions & 14 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.4.0"
2+
".": "2.5.0"
33
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [2.5.0](https://github.com/BLSQ/openhexa-sdk-python/compare/v2.4.0...v2.5.0) (2025-06-20)
4+
5+
6+
### Features
7+
8+
* add a "country" property to the current_workspace ([#273](https://github.com/BLSQ/openhexa-sdk-python/issues/273)) ([d942273](https://github.com/BLSQ/openhexa-sdk-python/commit/d942273c8ab7c8b9d41f6228dc783a9d2ec4b0b9))
9+
310
## [2.4.0](https://github.com/BLSQ/openhexa-sdk-python/compare/v2.3.1...v2.4.0) (2025-06-16)
411

512

openhexa/cli/graphql/graphql_client/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@
643643
DenyAccessmodAccessRequestDenyAccessmodAccessRequest,
644644
)
645645
from .disable_two_factor import DisableTwoFactor, DisableTwoFactorDisableTwoFactor
646-
from .dummy import Dummy
647646
from .enable_two_factor import EnableTwoFactor, EnableTwoFactorEnableTwoFactor
648647
from .enums import (
649648
AccessmodAccessibilityAnalysisAlgorithm,
@@ -812,6 +811,11 @@
812811
GenerateWorkspaceToken,
813812
GenerateWorkspaceTokenGenerateWorkspaceToken,
814813
)
814+
from .get_countries import (
815+
GetCountries,
816+
GetCountriesWorkspace,
817+
GetCountriesWorkspaceCountries,
818+
)
815819
from .input_types import (
816820
AddPipelineOutputInput,
817821
AddToFavoritesInput,
@@ -2326,7 +2330,6 @@
23262330
"DisableTwoFactorDisableTwoFactor",
23272331
"DisableTwoFactorError",
23282332
"DisableTwoFactorInput",
2329-
"Dummy",
23302333
"EnableTwoFactor",
23312334
"EnableTwoFactorEnableTwoFactor",
23322335
"EnableTwoFactorError",
@@ -2370,6 +2373,9 @@
23702373
"GenerateWorkspaceTokenError",
23712374
"GenerateWorkspaceTokenGenerateWorkspaceToken",
23722375
"GenerateWorkspaceTokenInput",
2376+
"GetCountries",
2377+
"GetCountriesWorkspace",
2378+
"GetCountriesWorkspaceCountries",
23732379
"GraphQLClientError",
23742380
"GraphQLClientGraphQLError",
23752381
"GraphQLClientGraphQLMultiError",

openhexa/cli/graphql/graphql_client/client.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
from .delete_workspace_member import DeleteWorkspaceMember
8181
from .deny_accessmod_access_request import DenyAccessmodAccessRequest
8282
from .disable_two_factor import DisableTwoFactor
83-
from .dummy import Dummy
8483
from .enable_two_factor import EnableTwoFactor
8584
from .enums import (
8685
AccessmodFilesetMode,
@@ -94,6 +93,7 @@
9493
from .generate_new_database_password import GenerateNewDatabasePassword
9594
from .generate_pipeline_webhook_url import GeneratePipelineWebhookUrl
9695
from .generate_workspace_token import GenerateWorkspaceToken
96+
from .get_countries import GetCountries
9797
from .input_types import (
9898
AddPipelineOutputInput,
9999
AddToFavoritesInput,
@@ -11724,17 +11724,24 @@ def workspaces(
1172411724
data = self.get_data(response)
1172511725
return Workspaces.model_validate(data)
1172611726

11727-
def dummy(self, **kwargs: Any) -> Dummy:
11727+
def get_countries(self, workspace_slug: str, **kwargs: Any) -> GetCountries:
1172811728
query = gql(
1172911729
"""
11730-
query dummy {
11731-
__typename
11730+
query getCountries($workspaceSlug: String!) {
11731+
workspace(slug: $workspaceSlug) {
11732+
countries {
11733+
code
11734+
name
11735+
flag
11736+
alpha3
11737+
}
11738+
}
1173211739
}
1173311740
"""
1173411741
)
11735-
variables: Dict[str, object] = {}
11742+
variables: Dict[str, object] = {"workspaceSlug": workspace_slug}
1173611743
response = self.execute(
11737-
query=query, operation_name="dummy", variables=variables, **kwargs
11744+
query=query, operation_name="getCountries", variables=variables, **kwargs
1173811745
)
1173911746
data = self.get_data(response)
11740-
return Dummy.model_validate(data)
11747+
return GetCountries.model_validate(data)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated by ariadne-codegen
2+
# Source: openhexa/cli/graphql/queries
3+
4+
from typing import List, Optional
5+
6+
from pydantic import Field
7+
8+
from .base_model import BaseModel
9+
10+
11+
class GetCountries(BaseModel):
12+
workspace: Optional["GetCountriesWorkspace"]
13+
14+
15+
class GetCountriesWorkspace(BaseModel):
16+
countries: List["GetCountriesWorkspaceCountries"]
17+
18+
19+
class GetCountriesWorkspaceCountries(BaseModel):
20+
code: str
21+
name: str
22+
flag: str
23+
alpha_3: str = Field(alias="alpha3")
24+
25+
26+
GetCountries.model_rebuild()
27+
GetCountriesWorkspace.model_rebuild()
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
query dummy {
2-
__typename
1+
query getCountries($workspaceSlug:String!){
2+
workspace(slug: $workspaceSlug) {
3+
countries {
4+
code
5+
name
6+
flag
7+
alpha3
8+
}
9+
}
310
}

openhexa/sdk/workspaces/current_workspace.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from dataclasses import fields, make_dataclass
88
from warnings import warn
99

10+
from openhexa.cli.api import GetCountriesWorkspaceCountries
1011
from openhexa.utils import stringcase
1112

1213
from ..datasets import Dataset
@@ -59,6 +60,16 @@ def slug(self) -> str:
5960
except KeyError:
6061
raise WorkspaceConfigError("The workspace slug is not available in this environment.")
6162

63+
@property
64+
def countries(self) -> list[GetCountriesWorkspaceCountries]:
65+
"""The countries of the workspace."""
66+
from openhexa.cli.api import OpenHexaClient
67+
68+
try:
69+
return OpenHexaClient().get_countries(workspace_slug=self.slug).workspace.countries
70+
except KeyError:
71+
raise WorkspaceConfigError("The workspace countries are not available in this environment.")
72+
6273
@property
6374
def database_host(self) -> str:
6475
"""The workspace database host."""

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "openhexa.sdk"
7-
version = "2.4.0"
7+
version = "2.5.0"
88
description = "OpenHEXA SDK"
99

1010
authors = [{ name = "Bluesquare", email = "dev@bluesquarehub.com" }]
@@ -97,7 +97,7 @@ ignore = [
9797
"ANN202",
9898
"ANN204",
9999
"ANN205",
100-
"ANN401",
100+
"ANN401"
101101
]
102102

103103
[tool.ruff.pycodestyle]

0 commit comments

Comments
 (0)