|
7 | 7 | from dataclasses import fields, make_dataclass |
8 | 8 | from warnings import warn |
9 | 9 |
|
| 10 | +from openhexa.cli.api import OpenHexaClient |
10 | 11 | from openhexa.utils import stringcase |
11 | 12 |
|
| 13 | +from ...cli.graphql.graphql_client import GetCountriesWorkspaceCountries |
12 | 14 | from ..datasets import Dataset |
13 | 15 | from ..utils import graphql |
14 | 16 | from .connection import ( |
|
20 | 22 | PostgreSQLConnection, |
21 | 23 | S3Connection, |
22 | 24 | ) |
23 | | -from openhexa.cli.api import OpenHexaClient |
24 | | - |
25 | | - |
26 | | -class Country: |
27 | | - """Represents a country with its code, name, alpha3 code and flag.""" |
28 | | - |
29 | | - def __init__(self, code: str, name: str, alpha3: str, flag: str): |
30 | | - """Initialize a Country object.""" |
31 | | - self.code = code |
32 | | - self.name = name |
33 | | - self.alpha3 = alpha3 |
34 | | - self.flag = flag |
35 | | - |
36 | | - def __repr__(self): |
37 | | - """Return a string representation of the Country object.""" |
38 | | - return f"Country(code={self.code}, name={self.name}, alpha3={self.alpha3}, flag={self.flag})" |
39 | 25 |
|
40 | 26 |
|
41 | 27 | class WorkspaceConfigError(Exception): |
@@ -76,7 +62,7 @@ def slug(self) -> str: |
76 | 62 | raise WorkspaceConfigError("The workspace slug is not available in this environment.") |
77 | 63 |
|
78 | 64 | @property |
79 | | - def countries(self) -> list[Country]: |
| 65 | + def countries(self) -> list[GetCountriesWorkspaceCountries]: |
80 | 66 | """The countries of the workspace.""" |
81 | 67 | try: |
82 | 68 | return OpenHexaClient().get_countries(workspace_slug=self.slug).workspace.countries |
|
0 commit comments