unique-six 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. unique_six-0.1.3/PKG-INFO +61 -0
  2. unique_six-0.1.3/README.md +44 -0
  3. unique_six-0.1.3/pyproject.toml +70 -0
  4. unique_six-0.1.3/unique_six/__init__.py +13 -0
  5. unique_six-0.1.3/unique_six/client.py +137 -0
  6. unique_six-0.1.3/unique_six/exception.py +29 -0
  7. unique_six-0.1.3/unique_six/get_creds.sh +110 -0
  8. unique_six-0.1.3/unique_six/http_adapter.py +47 -0
  9. unique_six-0.1.3/unique_six/schema/__init__.py +61 -0
  10. unique_six-0.1.3/unique_six/schema/common/base/__init__.py +7 -0
  11. unique_six-0.1.3/unique_six/schema/common/base/model.py +10 -0
  12. unique_six-0.1.3/unique_six/schema/common/base/request.py +17 -0
  13. unique_six-0.1.3/unique_six/schema/common/base/response.py +94 -0
  14. unique_six-0.1.3/unique_six/schema/common/entity.py +28 -0
  15. unique_six-0.1.3/unique_six/schema/common/instrument.py +130 -0
  16. unique_six-0.1.3/unique_six/schema/common/language.py +8 -0
  17. unique_six-0.1.3/unique_six/schema/common/listing.py +33 -0
  18. unique_six-0.1.3/unique_six/schema/common/lookup.py +8 -0
  19. unique_six-0.1.3/unique_six/schema/common/market.py +25 -0
  20. unique_six-0.1.3/unique_six/schema/common/price.py +7 -0
  21. unique_six-0.1.3/unique_six/schema/common/security.py +16 -0
  22. unique_six-0.1.3/unique_six/schema/end_of_day_history/__init__.py +15 -0
  23. unique_six-0.1.3/unique_six/schema/end_of_day_history/request.py +20 -0
  24. unique_six-0.1.3/unique_six/schema/end_of_day_history/response.py +213 -0
  25. unique_six-0.1.3/unique_six/schema/entity_base/__init__.py +11 -0
  26. unique_six-0.1.3/unique_six/schema/entity_base/listing/request.py +14 -0
  27. unique_six-0.1.3/unique_six/schema/entity_base/listing/response.py +91 -0
  28. unique_six-0.1.3/unique_six/schema/free_text_search/__init__.py +27 -0
  29. unique_six-0.1.3/unique_six/schema/free_text_search/entities/__init__.py +5 -0
  30. unique_six-0.1.3/unique_six/schema/free_text_search/entities/request.py +7 -0
  31. unique_six-0.1.3/unique_six/schema/free_text_search/entities/response.py +94 -0
  32. unique_six-0.1.3/unique_six/schema/free_text_search/instruments/__init__.py +5 -0
  33. unique_six-0.1.3/unique_six/schema/free_text_search/instruments/request.py +10 -0
  34. unique_six-0.1.3/unique_six/schema/free_text_search/instruments/response.py +279 -0
  35. unique_six-0.1.3/unique_six/schema/free_text_search/markets/__init__.py +5 -0
  36. unique_six-0.1.3/unique_six/schema/free_text_search/markets/request.py +10 -0
  37. unique_six-0.1.3/unique_six/schema/free_text_search/markets/response.py +101 -0
  38. unique_six-0.1.3/unique_six/schema/intraday_history/__init__.py +11 -0
  39. unique_six-0.1.3/unique_six/schema/intraday_history/summary/request.py +27 -0
  40. unique_six-0.1.3/unique_six/schema/intraday_history/summary/response.py +94 -0
  41. unique_six-0.1.3/unique_six/schema/intraday_snapshot/__init__.py +15 -0
  42. unique_six-0.1.3/unique_six/schema/intraday_snapshot/quality_of_service.py +8 -0
  43. unique_six-0.1.3/unique_six/schema/intraday_snapshot/request.py +17 -0
  44. unique_six-0.1.3/unique_six/schema/intraday_snapshot/response.py +181 -0
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.3
2
+ Name: unique-six
3
+ Version: 0.1.3
4
+ Summary: Unique Six API client
5
+ Author: Ahmed Jellouli, Azeez Raheem
6
+ Author-email: Ahmed Jellouli <ahmed.jellouli.ext@unique.ch>, Azeez Raheem <azeez.raheem.ext@unique.ai>
7
+ License: Proprietary
8
+ Requires-Dist: pydantic>=2.12.4
9
+ Requires-Dist: python-dotenv>=1.0.1
10
+ Requires-Dist: unique-toolkit>=1.50.4
11
+ Requires-Dist: cryptography>=46.0.5
12
+ Requires-Dist: pyopenssl>=25.0.0
13
+ Requires-Dist: requests>=2.32.0
14
+ Requires-Dist: urllib3>=2.0.0
15
+ Requires-Python: >=3.12, <4
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Unique Six Connector
19
+
20
+ A Python connector library for the [Six API](https://api.six-group.com/web/), providing easy access to end of day history, free text search, intraday history, intraday snapshot and entity listing.
21
+
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ poetry add unique_six
27
+ ```
28
+
29
+ Or using pip:
30
+
31
+ ```bash
32
+ pip install unique_six
33
+ ```
34
+
35
+ ```bash
36
+ # Clone the repository
37
+ git clone <repository_url>
38
+ cd unique_six
39
+
40
+ # Install dependencies
41
+ poetry install
42
+
43
+ # Run linting
44
+ poetry run ruff check .
45
+
46
+ # Run formatting
47
+ poetry run ruff format .
48
+ ```
49
+
50
+
51
+ ## License
52
+
53
+ Proprietary
54
+
55
+ ## Authors
56
+
57
+ - Ahmed Jellouli <ahmed.jellouli.ext@unique.ch>
58
+
59
+ ## Support
60
+
61
+ For issues and questions, please contact the maintainers or refer to the [Six API documentation](https://developer.six-group.com/en/home.html).
@@ -0,0 +1,44 @@
1
+ # Unique Six Connector
2
+
3
+ A Python connector library for the [Six API](https://api.six-group.com/web/), providing easy access to end of day history, free text search, intraday history, intraday snapshot and entity listing.
4
+
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ poetry add unique_six
10
+ ```
11
+
12
+ Or using pip:
13
+
14
+ ```bash
15
+ pip install unique_six
16
+ ```
17
+
18
+ ```bash
19
+ # Clone the repository
20
+ git clone <repository_url>
21
+ cd unique_six
22
+
23
+ # Install dependencies
24
+ poetry install
25
+
26
+ # Run linting
27
+ poetry run ruff check .
28
+
29
+ # Run formatting
30
+ poetry run ruff format .
31
+ ```
32
+
33
+
34
+ ## License
35
+
36
+ Proprietary
37
+
38
+ ## Authors
39
+
40
+ - Ahmed Jellouli <ahmed.jellouli.ext@unique.ch>
41
+
42
+ ## Support
43
+
44
+ For issues and questions, please contact the maintainers or refer to the [Six API documentation](https://developer.six-group.com/en/home.html).
@@ -0,0 +1,70 @@
1
+ [project]
2
+ name = "unique_six"
3
+ version = "0.1.3"
4
+ description = "Unique Six API client"
5
+ authors = [
6
+ { name = "Ahmed Jellouli", email = "ahmed.jellouli.ext@unique.ch" },
7
+ { name = "Azeez Raheem", email = "azeez.raheem.ext@unique.ai" },
8
+ ]
9
+ readme = "README.md"
10
+ license = { text = "Proprietary" }
11
+ requires-python = ">=3.12,<4"
12
+ dependencies = [
13
+ "pydantic>=2.12.4",
14
+ "python-dotenv>=1.0.1",
15
+ "unique-toolkit>=1.50.4",
16
+ "cryptography>=46.0.5",
17
+ "pyopenssl>=25.0.0",
18
+ "requests>=2.32.0",
19
+ "urllib3>=2.0.0",
20
+ ]
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "ruff>=0.12.10",
25
+ "pytest>=8.0.0",
26
+ "pytest-cov>=4.1.0",
27
+ "pytest-mock>=3.12.0",
28
+ "responses>=0.25.0",
29
+ "deptry>=0.24.0",
30
+ ]
31
+
32
+ [build-system]
33
+ requires = ["uv_build>=0.7.19,<0.8"]
34
+ build-backend = "uv_build"
35
+
36
+ [tool.uv.build-backend]
37
+ module-root = ""
38
+
39
+ [tool.uv]
40
+ constraint-dependencies = ["lxml>=5.0.0"]
41
+
42
+ [tool.uv.sources]
43
+ unique-toolkit = { path = "../../unique_toolkit", editable = true }
44
+
45
+ [tool.ruff]
46
+ target-version = "py311"
47
+
48
+ [tool.ruff.lint]
49
+ extend-select = ["I"]
50
+
51
+ [tool.deptry]
52
+ known_first_party = ["unique_six"]
53
+ extend_exclude = ["tests", "conftest.py"]
54
+
55
+ [tool.deptry.per_rule_ignores]
56
+ DEP002 = ["python-dotenv", "unique-toolkit", "pyopenssl"]
57
+
58
+ [tool.pytest.ini_options]
59
+ addopts = "--strict-markers"
60
+ asyncio_mode = "auto"
61
+ markers = [
62
+ "unit: for unit tests",
63
+ "integration: for integration tests that require API credentials",
64
+ "serial",
65
+ "asyncio: for async tests",
66
+ "ai: AI-authored test",
67
+ ]
68
+ filterwarnings = [
69
+ "ignore:DeprecationWarning",
70
+ ]
@@ -0,0 +1,13 @@
1
+ from unique_six.client import (
2
+ SixApiClient,
3
+ )
4
+ from unique_six.exception import (
5
+ SixApiException,
6
+ raise_errors_from_api_response,
7
+ )
8
+
9
+ __all__ = [
10
+ "SixApiClient",
11
+ "SixApiException",
12
+ "raise_errors_from_api_response",
13
+ ]
@@ -0,0 +1,137 @@
1
+ import re
2
+ import urllib.parse
3
+ import urllib.request
4
+ from typing import Any, Callable, ParamSpec, TypeVar
5
+
6
+ import requests
7
+
8
+ from unique_six.http_adapter import InMemoryCertAdapter
9
+ from unique_six.schema import (
10
+ BaseRequestParams,
11
+ BaseResponsePayload,
12
+ )
13
+ from unique_six.schema.end_of_day_history import (
14
+ EndOfDayHistoryRequestParams,
15
+ EndOfDayHistoryResponsePayload,
16
+ )
17
+ from unique_six.schema.entity_base import (
18
+ EntityBaseByListingRequestParams,
19
+ EntityBaseByListingResponsePayload,
20
+ )
21
+ from unique_six.schema.free_text_search import (
22
+ FreeTextEntitiesSearchResponsePayload,
23
+ FreeTextInstrumentsSearchResponsePayload,
24
+ FreeTextMarketsSearchResponsePayload,
25
+ FreeTextSearchEntitiesRequestParams,
26
+ FreeTextSearchInstrumentsRequestParams,
27
+ FreeTextSearchMarketsRequestParams,
28
+ )
29
+ from unique_six.schema.intraday_history import (
30
+ IntradayHistorySummaryRequestParams,
31
+ IntradayHistorySummaryResponsePayload,
32
+ )
33
+ from unique_six.schema.intraday_snapshot import (
34
+ IntradaySnapshotRequestParams,
35
+ IntradaySnapshotResponsePayload,
36
+ )
37
+
38
+ API_URL = "https://api.six-group.com/web/"
39
+
40
+
41
+ def split_cert_chain(cert: str) -> list[str]:
42
+ return re.findall(".*?-----END CERTIFICATE-----", cert, re.DOTALL)
43
+
44
+
45
+ class SixApiClient:
46
+ def __init__(self, cert: str, key: str) -> None:
47
+ self._session = requests.Session()
48
+ self._session.headers = {"accept": "application/json"}
49
+ self._url = API_URL
50
+
51
+ certs = [c.encode("utf-8") for c in split_cert_chain(cert)]
52
+ cert_adapter = InMemoryCertAdapter(
53
+ certs[0],
54
+ key.encode("utf-8"),
55
+ certs[1:],
56
+ )
57
+ self._session.mount(self._url, cert_adapter)
58
+
59
+ # Endpoints
60
+ self.end_of_day_history = endpoint(
61
+ self,
62
+ "v1/listings/marketData/endOfDayHistory",
63
+ EndOfDayHistoryRequestParams,
64
+ EndOfDayHistoryResponsePayload,
65
+ )
66
+ self.free_text_search_instruments = endpoint(
67
+ self,
68
+ "v1/search/freeTextSearch/instruments",
69
+ FreeTextSearchInstrumentsRequestParams,
70
+ FreeTextInstrumentsSearchResponsePayload,
71
+ )
72
+ self.free_text_search_entities = endpoint(
73
+ self,
74
+ "v1/search/freeTextSearch/entities",
75
+ FreeTextSearchEntitiesRequestParams,
76
+ FreeTextEntitiesSearchResponsePayload,
77
+ )
78
+ self.free_text_search_markets = endpoint(
79
+ self,
80
+ "v1/search/freeTextSearch/markets",
81
+ FreeTextSearchMarketsRequestParams,
82
+ FreeTextMarketsSearchResponsePayload,
83
+ )
84
+ self.intraday_history_summary = endpoint(
85
+ self,
86
+ "v1/listings/marketData/intradayHistory/summary",
87
+ IntradayHistorySummaryRequestParams,
88
+ IntradayHistorySummaryResponsePayload,
89
+ )
90
+ self.intraday_snapshot = endpoint(
91
+ self,
92
+ "v1/listings/marketData/intradaySnapshot",
93
+ IntradaySnapshotRequestParams,
94
+ IntradaySnapshotResponsePayload,
95
+ )
96
+ self.entity_base_by_listing = endpoint(
97
+ self,
98
+ "v1/listings/referenceData/entityBase",
99
+ EntityBaseByListingRequestParams,
100
+ EntityBaseByListingResponsePayload,
101
+ )
102
+
103
+ def request(self, end_point: str, params: dict[str, Any]) -> dict[str, Any]:
104
+ complete_url = f"{self._url}{end_point}?{urllib.parse.urlencode(params)}"
105
+ response = self._session.get(complete_url)
106
+ response.raise_for_status()
107
+ return response.json()
108
+
109
+
110
+ ResponseType = TypeVar("ResponseType", bound=BaseResponsePayload)
111
+ RequestType = TypeVar("RequestType", bound=BaseRequestParams)
112
+ RequestConstructorSpec = ParamSpec("RequestConstructorSpec")
113
+
114
+
115
+ def endpoint(
116
+ client: SixApiClient,
117
+ url: str,
118
+ params: Callable[RequestConstructorSpec, RequestType],
119
+ response_type: type[ResponseType],
120
+ ) -> Callable[RequestConstructorSpec, ResponseType]:
121
+ def endpoint_f(
122
+ *args: RequestConstructorSpec.args,
123
+ **kwargs: RequestConstructorSpec.kwargs,
124
+ ) -> ResponseType:
125
+ return response_type.model_validate(
126
+ client.request(
127
+ url,
128
+ params(*args, **kwargs).model_dump(
129
+ exclude_unset=True,
130
+ by_alias=True,
131
+ exclude_defaults=True,
132
+ mode="json",
133
+ ),
134
+ )
135
+ )
136
+
137
+ return endpoint_f
@@ -0,0 +1,29 @@
1
+ from unique_six.schema.common.base.response import (
2
+ BaseResponsePayload,
3
+ ErrorDetail,
4
+ )
5
+
6
+
7
+ def error_to_str(error: ErrorDetail) -> str:
8
+ error_str = f"Error {error.code}: {error.category}"
9
+ if error.message:
10
+ error_str += f": {error.message}"
11
+ return error_str
12
+
13
+
14
+ class SixApiException(Exception):
15
+ def __init__(self, errors: list[ErrorDetail]) -> None:
16
+ self.errors = errors
17
+
18
+ def __str__(self) -> str:
19
+ if len(self.errors) == 1:
20
+ return error_to_str(self.errors[0])
21
+ else:
22
+ return "Errors:\n" + "\n".join(
23
+ [error_to_str(error) for error in self.errors]
24
+ )
25
+
26
+
27
+ def raise_errors_from_api_response(response: BaseResponsePayload) -> None:
28
+ if response.errors is not None and len(response.errors) > 0:
29
+ raise SixApiException(response.errors)
@@ -0,0 +1,110 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ show_usage() {
6
+ cat <<EOF
7
+ Usage: $0 --cert|-c CERT_FILE --key|-k KEY_FILE [--output|-o OUTPUT_FILE]
8
+
9
+ Encode certificate and key files into a base64-encoded string
10
+
11
+ Options:
12
+ -c, --cert CERT_FILE Path to the certificate file
13
+ -k, --key KEY_FILE Path to the private key file
14
+ -o, --output OUTPUT_FILE Output file to write the result (if not specified, prints to stdout)
15
+ -h, --help Show this help message
16
+
17
+ Examples:
18
+ $0 --cert cert.pem --key key.pem
19
+ $0 -c /path/to/cert.crt -k /path/to/private.key
20
+ $0 -c cert.pem -k key.pem -o encoded_creds.txt
21
+ EOF
22
+ }
23
+
24
+ get_creds() {
25
+ local cert_path="$1"
26
+ local key_path="$2"
27
+
28
+ if [[ ! -f "$cert_path" ]]; then
29
+ echo "Error: Certificate file not found: $cert_path" >&2
30
+ exit 1
31
+ fi
32
+
33
+ if [[ ! -f "$key_path" ]]; then
34
+ echo "Error: Key file not found: $key_path" >&2
35
+ exit 1
36
+ fi
37
+
38
+ if ! cert_content=$(cat "$cert_path" 2>/dev/null); then
39
+ echo "Error reading certificate file: $cert_path" >&2
40
+ exit 1
41
+ fi
42
+
43
+ if ! key_content=$(cat "$key_path" 2>/dev/null); then
44
+ echo "Error reading key file: $key_path" >&2
45
+ exit 1
46
+ fi
47
+
48
+ cert_escaped=$(printf '%s' "$cert_content" | tr -d '\n')
49
+ key_escaped=$(printf '%s' "$key_content" | tr -d '\n')
50
+
51
+ content="[\"$cert_escaped\",\"$key_escaped\"]"
52
+ echo -n "$content" | base64
53
+ }
54
+
55
+ cert_path=""
56
+ key_path=""
57
+ output_file=""
58
+
59
+ while [[ $# -gt 0 ]]; do
60
+ case $1 in
61
+ -c | --cert)
62
+ cert_path="$2"
63
+ shift 2
64
+ ;;
65
+ -k | --key)
66
+ key_path="$2"
67
+ shift 2
68
+ ;;
69
+ -o | --output)
70
+ output_file="$2"
71
+ shift 2
72
+ ;;
73
+ -h | --help)
74
+ show_usage
75
+ exit 0
76
+ ;;
77
+ *)
78
+ echo "Error: Unknown option $1" >&2
79
+ show_usage
80
+ exit 1
81
+ ;;
82
+ esac
83
+ done
84
+
85
+ if [[ -z "$cert_path" ]]; then
86
+ echo "Error: Certificate file path is required" >&2
87
+ show_usage
88
+ exit 1
89
+ fi
90
+
91
+ if [[ -z "$key_path" ]]; then
92
+ echo "Error: Key file path is required" >&2
93
+ show_usage
94
+ exit 1
95
+ fi
96
+
97
+ if ! encoded_creds=$(get_creds "$cert_path" "$key_path"); then
98
+ echo "Error processing files" >&2
99
+ exit 1
100
+ fi
101
+
102
+ if [[ -n "$output_file" ]]; then
103
+ if ! echo "$encoded_creds" >"$output_file"; then
104
+ echo "Error writing to output file: $output_file" >&2
105
+ exit 1
106
+ fi
107
+ echo "Encoded credentials written to: $output_file"
108
+ else
109
+ echo "$encoded_creds"
110
+ fi
@@ -0,0 +1,47 @@
1
+ from typing import Iterable
2
+
3
+ from cryptography.hazmat.primitives.serialization import load_pem_private_key
4
+ from cryptography.x509 import load_pem_x509_certificate
5
+ from requests.adapters import HTTPAdapter
6
+ from urllib3.contrib.pyopenssl import (
7
+ PyOpenSSLContext,
8
+ )
9
+ from urllib3.util.ssl_ import PROTOCOL_TLS_CLIENT
10
+
11
+
12
+ class InMemoryCertAdapter(HTTPAdapter):
13
+ def __init__(
14
+ self,
15
+ cert: bytes,
16
+ key: bytes,
17
+ chain_certs: Iterable[bytes] | None = None,
18
+ *args,
19
+ **kwargs,
20
+ ) -> None:
21
+ self._chain_certs = tuple(chain_certs) if chain_certs else None
22
+ self._cert = cert
23
+ self._key = key
24
+ super().__init__(*args, **kwargs)
25
+
26
+ def init_poolmanager(self, *args, **kwargs):
27
+ context = self._create_ssl_context()
28
+ kwargs["ssl_context"] = context
29
+ return super().init_poolmanager(*args, **kwargs)
30
+
31
+ def _create_ssl_context(self) -> PyOpenSSLContext:
32
+ context = PyOpenSSLContext(PROTOCOL_TLS_CLIENT)
33
+ context.set_default_verify_paths()
34
+
35
+ context._ctx.use_certificate(load_pem_x509_certificate(self._cert))
36
+ if self._chain_certs is not None:
37
+ for c in self._chain_certs:
38
+ context._ctx.add_extra_chain_cert(load_pem_x509_certificate(c))
39
+
40
+ context._ctx.use_privatekey(
41
+ load_pem_private_key(self._key, password=None) # type: ignore
42
+ )
43
+
44
+ # Throw an exception if the private key is not valid
45
+ context._ctx.check_privatekey()
46
+
47
+ return context
@@ -0,0 +1,61 @@
1
+ from unique_six.schema.common.base import (
2
+ BaseAPIModel,
3
+ BaseRequestParams,
4
+ BaseResponsePayload,
5
+ )
6
+ from unique_six.schema.common.entity import (
7
+ EntityStatus,
8
+ EntityType,
9
+ )
10
+ from unique_six.schema.common.instrument import (
11
+ ContractType,
12
+ ContractUnitType,
13
+ CurrentCouponType,
14
+ ExerciseType,
15
+ InstrumentStatus,
16
+ InstrumentType,
17
+ InstrumentUnitType,
18
+ MaturityType,
19
+ OptionType,
20
+ )
21
+ from unique_six.schema.common.language import Language
22
+ from unique_six.schema.common.listing import (
23
+ ListingIdentifierScheme,
24
+ ListingStatus,
25
+ )
26
+ from unique_six.schema.common.lookup import LookupStatus
27
+ from unique_six.schema.common.market import (
28
+ MarketStatus,
29
+ MarketType,
30
+ MicType,
31
+ )
32
+ from unique_six.schema.common.price import PriceAdjustment
33
+ from unique_six.schema.common.security import (
34
+ SecurityType,
35
+ )
36
+
37
+ __all__ = [
38
+ "BaseAPIModel",
39
+ "BaseRequestParams",
40
+ "BaseResponsePayload",
41
+ "ListingIdentifierScheme",
42
+ "InstrumentType",
43
+ "InstrumentStatus",
44
+ "InstrumentUnitType",
45
+ "SecurityType",
46
+ "Language",
47
+ "ContractType",
48
+ "CurrentCouponType",
49
+ "ContractUnitType",
50
+ "OptionType",
51
+ "ExerciseType",
52
+ "MaturityType",
53
+ "EntityType",
54
+ "EntityStatus",
55
+ "MarketType",
56
+ "MicType",
57
+ "MarketStatus",
58
+ "PriceAdjustment",
59
+ "ListingStatus",
60
+ "LookupStatus",
61
+ ]
@@ -0,0 +1,7 @@
1
+ from unique_six.schema.common.base.model import BaseAPIModel
2
+ from unique_six.schema.common.base.request import BaseRequestParams
3
+ from unique_six.schema.common.base.response import (
4
+ BaseResponsePayload,
5
+ )
6
+
7
+ __all__ = ["BaseAPIModel", "BaseRequestParams", "BaseResponsePayload"]
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel, ConfigDict
2
+ from pydantic.alias_generators import to_camel
3
+
4
+
5
+ class BaseAPIModel(BaseModel):
6
+ model_config = ConfigDict(
7
+ populate_by_name=True,
8
+ alias_generator=to_camel,
9
+ use_enum_values=True,
10
+ )
@@ -0,0 +1,17 @@
1
+ from enum import StrEnum
2
+
3
+ from pydantic import Field
4
+
5
+ from unique_six.schema.common.base.model import BaseAPIModel
6
+ from unique_six.schema.common.language import Language
7
+
8
+
9
+ class RequestExtension(StrEnum):
10
+ EXPLAIN = "EXPLAIN"
11
+ DATA_STATUS = "DATA_STATUS"
12
+ DATASET_IDS = "DATASET_IDS"
13
+
14
+
15
+ class BaseRequestParams(BaseAPIModel):
16
+ preferred_language: Language = Field(default=Language.EN)
17
+ extensions: list[RequestExtension] = Field(default=[])