termina 0.0.0__py3-none-any.whl
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.
- termina/__init__.py +184 -0
- termina/auth/__init__.py +2 -0
- termina/auth/client.py +127 -0
- termina/base_client.py +242 -0
- termina/benchmark/__init__.py +21 -0
- termina/benchmark/client.py +1430 -0
- termina/benchmark/types/__init__.py +21 -0
- termina/benchmark/types/benchmark_get_combined_time_series_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_combined_time_series_response_item_value.py +5 -0
- termina/benchmark/types/benchmark_get_deal_benchmark_quantiles_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_deal_benchmark_quantiles_response_item_value.py +5 -0
- termina/benchmark/types/benchmark_get_deal_benchmark_tradeoff_at_scale_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_quantiles_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_quantiles_response_item_value.py +5 -0
- termina/benchmark/types/benchmark_get_scaling_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_time_series_endpoint_request_user_type.py +7 -0
- termina/benchmark/types/benchmark_get_time_series_endpoint_response_value.py +5 -0
- termina/benchmark/types/benchmark_get_tradeoff_at_scale_request_user_type.py +7 -0
- termina/client.py +101 -0
- termina/company/__init__.py +2 -0
- termina/company/client.py +719 -0
- termina/core/__init__.py +30 -0
- termina/core/api_error.py +15 -0
- termina/core/client_wrapper.py +79 -0
- termina/core/datetime_utils.py +28 -0
- termina/core/file.py +38 -0
- termina/core/http_client.py +443 -0
- termina/core/jsonable_encoder.py +99 -0
- termina/core/oauth_token_provider.py +36 -0
- termina/core/pydantic_utilities.py +28 -0
- termina/core/query_encoder.py +33 -0
- termina/core/remove_none_from_dict.py +11 -0
- termina/core/request_options.py +32 -0
- termina/deal/__init__.py +2 -0
- termina/deal/client.py +947 -0
- termina/environment.py +7 -0
- termina/errors/__init__.py +5 -0
- termina/errors/unprocessable_entity_error.py +9 -0
- termina/file/__init__.py +2 -0
- termina/file/client.py +766 -0
- termina/financials/__init__.py +2 -0
- termina/financials/client.py +121 -0
- termina/group/__init__.py +2 -0
- termina/group/client.py +1020 -0
- termina/macro/__init__.py +2 -0
- termina/macro/client.py +506 -0
- termina/macro/types/__init__.py +5 -0
- termina/macro/types/segmentation.py +5 -0
- termina/metadata/__init__.py +2 -0
- termina/metadata/client.py +111 -0
- termina/product/__init__.py +2 -0
- termina/product/client.py +548 -0
- termina/product/types/__init__.py +5 -0
- termina/product/types/frequency.py +5 -0
- termina/py.typed +0 -0
- termina/types/__init__.py +147 -0
- termina/types/account_manager_response.py +42 -0
- termina/types/all_data_metadata_response.py +30 -0
- termina/types/area.py +42 -0
- termina/types/area_x_item.py +5 -0
- termina/types/area_y_item.py +5 -0
- termina/types/authenticate_api_key_response.py +29 -0
- termina/types/available_categories_response.py +5 -0
- termina/types/available_models_response.py +37 -0
- termina/types/band_response.py +36 -0
- termina/types/band_response_high_item.py +5 -0
- termina/types/band_response_low_item.py +5 -0
- termina/types/band_response_x_item.py +5 -0
- termina/types/base_null_model.py +27 -0
- termina/types/benchmark_quantile.py +288 -0
- termina/types/categories_metadata_response.py +38 -0
- termina/types/category.py +32 -0
- termina/types/category_growth_rates.py +84 -0
- termina/types/category_metadata.py +43 -0
- termina/types/category_metadata_default_user_type.py +5 -0
- termina/types/cohorts_response.py +78 -0
- termina/types/column_metadata.py +59 -0
- termina/types/column_mini_metadata.py +49 -0
- termina/types/columns_metadata_response.py +38 -0
- termina/types/company_response.py +44 -0
- termina/types/concentration_endpoint_cdf_detail.py +47 -0
- termina/types/concentration_endpoint_top_users_detail.py +42 -0
- termina/types/concentration_response.py +53 -0
- termina/types/concentration_timeseries_detail.py +94 -0
- termina/types/contribution_response.py +80 -0
- termina/types/contribution_summary_response.py +113 -0
- termina/types/create_api_key_response.py +29 -0
- termina/types/create_file_response.py +42 -0
- termina/types/deal_combined_metrics_response.py +293 -0
- termina/types/deal_data_availablity_response.py +54 -0
- termina/types/deal_with_files_response.py +76 -0
- termina/types/file_response.py +40 -0
- termina/types/file_type.py +7 -0
- termina/types/financial_metrics.py +57 -0
- termina/types/financials_response.py +51 -0
- termina/types/freq.py +5 -0
- termina/types/frequency.py +5 -0
- termina/types/gcs_signed_url_response.py +32 -0
- termina/types/group_response.py +57 -0
- termina/types/group_user.py +45 -0
- termina/types/group_with_users_response.py +59 -0
- termina/types/growth_accounting_response.py +135 -0
- termina/types/healthz_response.py +29 -0
- termina/types/http_validation_error.py +30 -0
- termina/types/income_statement_entry.py +47 -0
- termina/types/list_companies_response.py +33 -0
- termina/types/list_deals_response.py +33 -0
- termina/types/list_files_response.py +33 -0
- termina/types/list_users_response.py +33 -0
- termina/types/method.py +5 -0
- termina/types/model_metadata.py +43 -0
- termina/types/models_metadata_response.py +43 -0
- termina/types/permission_model.py +37 -0
- termina/types/priority.py +5 -0
- termina/types/product_info_response.py +30 -0
- termina/types/role_response.py +33 -0
- termina/types/scale.py +42 -0
- termina/types/scale_model.py +43 -0
- termina/types/scale_model_response.py +34 -0
- termina/types/scale_model_response_pred_item_value.py +5 -0
- termina/types/scale_model_response_raw_data_item_value.py +5 -0
- termina/types/scale_models_response.py +7 -0
- termina/types/scaling.py +5 -0
- termina/types/status.py +7 -0
- termina/types/tradeoff_model.py +49 -0
- termina/types/tradeoff_models_response.py +7 -0
- termina/types/tradeoff_response.py +36 -0
- termina/types/tradeoff_response_discarded_raw_data_item_value.py +5 -0
- termina/types/tradeoff_response_raw_data_item_value.py +5 -0
- termina/types/unit.py +5 -0
- termina/types/unit_economics_info_response.py +29 -0
- termina/types/user_accounting_response.py +103 -0
- termina/types/user_role_response.py +32 -0
- termina/types/user_type.py +5 -0
- termina/types/user_with_permissions_response.py +49 -0
- termina/types/validation_error.py +32 -0
- termina/types/validation_error_loc_item.py +5 -0
- termina/types/weather_components.py +57 -0
- termina/types/weather_data.py +31 -0
- termina/types/weather_data_keys.py +30 -0
- termina/types/weather_ecosystems_response.py +30 -0
- termina/types/weather_gauge.py +42 -0
- termina/types/weather_market_context.py +57 -0
- termina/types/weather_metadata.py +58 -0
- termina/types/weather_metadata_response.py +5 -0
- termina/unit_economics/__init__.py +2 -0
- termina/unit_economics/client.py +147 -0
- termina/user/__init__.py +2 -0
- termina/user/client.py +233 -0
- termina/version.py +4 -0
- termina-0.0.0.dist-info/METADATA +87 -0
- termina-0.0.0.dist-info/RECORD +153 -0
- termina-0.0.0.dist-info/WHEEL +4 -0
termina/__init__.py
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import (
|
|
4
|
+
AccountManagerResponse,
|
|
5
|
+
AllDataMetadataResponse,
|
|
6
|
+
Area,
|
|
7
|
+
AuthenticateApiKeyResponse,
|
|
8
|
+
AvailableCategoriesResponse,
|
|
9
|
+
AvailableModelsResponse,
|
|
10
|
+
BandResponse,
|
|
11
|
+
BenchmarkQuantile,
|
|
12
|
+
CategoriesMetadataResponse,
|
|
13
|
+
CategoryGrowthRates,
|
|
14
|
+
CategoryMetadata,
|
|
15
|
+
CategoryMetadataDefaultUserType,
|
|
16
|
+
CohortsResponse,
|
|
17
|
+
ColumnMetadata,
|
|
18
|
+
ColumnMiniMetadata,
|
|
19
|
+
ColumnsMetadataResponse,
|
|
20
|
+
CompanyResponse,
|
|
21
|
+
ConcentrationEndpointCdfDetail,
|
|
22
|
+
ConcentrationEndpointTopUsersDetail,
|
|
23
|
+
ConcentrationResponse,
|
|
24
|
+
ConcentrationTimeseriesDetail,
|
|
25
|
+
ContributionResponse,
|
|
26
|
+
CreateApiKeyResponse,
|
|
27
|
+
CreateFileResponse,
|
|
28
|
+
DealCombinedMetricsResponse,
|
|
29
|
+
DealDataAvailablityResponse,
|
|
30
|
+
DealWithFilesResponse,
|
|
31
|
+
FileResponse,
|
|
32
|
+
FileType,
|
|
33
|
+
FinancialMetrics,
|
|
34
|
+
FinancialsResponse,
|
|
35
|
+
Freq,
|
|
36
|
+
Frequency,
|
|
37
|
+
GcsSignedUrlResponse,
|
|
38
|
+
GroupResponse,
|
|
39
|
+
GroupUser,
|
|
40
|
+
GroupWithUsersResponse,
|
|
41
|
+
GrowthAccountingResponse,
|
|
42
|
+
HealthzResponse,
|
|
43
|
+
HttpValidationError,
|
|
44
|
+
IncomeStatementEntry,
|
|
45
|
+
ListCompaniesResponse,
|
|
46
|
+
ListDealsResponse,
|
|
47
|
+
ListFilesResponse,
|
|
48
|
+
ListUsersResponse,
|
|
49
|
+
ModelMetadata,
|
|
50
|
+
ModelsMetadataResponse,
|
|
51
|
+
PermissionModel,
|
|
52
|
+
Priority,
|
|
53
|
+
ProductInfoResponse,
|
|
54
|
+
RoleResponse,
|
|
55
|
+
Scale,
|
|
56
|
+
ScaleModel,
|
|
57
|
+
ScaleModelsResponse,
|
|
58
|
+
Scaling,
|
|
59
|
+
Status,
|
|
60
|
+
TradeoffModel,
|
|
61
|
+
TradeoffModelsResponse,
|
|
62
|
+
Unit,
|
|
63
|
+
UnitEconomicsInfoResponse,
|
|
64
|
+
UserAccountingResponse,
|
|
65
|
+
UserRoleResponse,
|
|
66
|
+
UserType,
|
|
67
|
+
UserWithPermissionsResponse,
|
|
68
|
+
ValidationError,
|
|
69
|
+
ValidationErrorLocItem,
|
|
70
|
+
WeatherComponents,
|
|
71
|
+
WeatherGauge,
|
|
72
|
+
WeatherMarketContext,
|
|
73
|
+
WeatherMetadata,
|
|
74
|
+
WeatherMetadataResponse,
|
|
75
|
+
)
|
|
76
|
+
from .errors import UnprocessableEntityError
|
|
77
|
+
from . import auth, benchmark, company, deal, file, financials, group, macro, metadata, product, unit_economics, user
|
|
78
|
+
from .benchmark import (
|
|
79
|
+
BenchmarkGetCombinedTimeSeriesRequestUserType,
|
|
80
|
+
BenchmarkGetDealBenchmarkQuantilesRequestUserType,
|
|
81
|
+
BenchmarkGetDealBenchmarkTradeoffAtScaleRequestUserType,
|
|
82
|
+
BenchmarkGetQuantilesRequestUserType,
|
|
83
|
+
BenchmarkGetScalingRequestUserType,
|
|
84
|
+
BenchmarkGetTimeSeriesEndpointRequestUserType,
|
|
85
|
+
BenchmarkGetTradeoffAtScaleRequestUserType,
|
|
86
|
+
)
|
|
87
|
+
from .environment import TerminaEnvironment
|
|
88
|
+
from .version import __version__
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
"AccountManagerResponse",
|
|
92
|
+
"AllDataMetadataResponse",
|
|
93
|
+
"Area",
|
|
94
|
+
"AuthenticateApiKeyResponse",
|
|
95
|
+
"AvailableCategoriesResponse",
|
|
96
|
+
"AvailableModelsResponse",
|
|
97
|
+
"BandResponse",
|
|
98
|
+
"BenchmarkGetCombinedTimeSeriesRequestUserType",
|
|
99
|
+
"BenchmarkGetDealBenchmarkQuantilesRequestUserType",
|
|
100
|
+
"BenchmarkGetDealBenchmarkTradeoffAtScaleRequestUserType",
|
|
101
|
+
"BenchmarkGetQuantilesRequestUserType",
|
|
102
|
+
"BenchmarkGetScalingRequestUserType",
|
|
103
|
+
"BenchmarkGetTimeSeriesEndpointRequestUserType",
|
|
104
|
+
"BenchmarkGetTradeoffAtScaleRequestUserType",
|
|
105
|
+
"BenchmarkQuantile",
|
|
106
|
+
"CategoriesMetadataResponse",
|
|
107
|
+
"CategoryGrowthRates",
|
|
108
|
+
"CategoryMetadata",
|
|
109
|
+
"CategoryMetadataDefaultUserType",
|
|
110
|
+
"CohortsResponse",
|
|
111
|
+
"ColumnMetadata",
|
|
112
|
+
"ColumnMiniMetadata",
|
|
113
|
+
"ColumnsMetadataResponse",
|
|
114
|
+
"CompanyResponse",
|
|
115
|
+
"ConcentrationEndpointCdfDetail",
|
|
116
|
+
"ConcentrationEndpointTopUsersDetail",
|
|
117
|
+
"ConcentrationResponse",
|
|
118
|
+
"ConcentrationTimeseriesDetail",
|
|
119
|
+
"ContributionResponse",
|
|
120
|
+
"CreateApiKeyResponse",
|
|
121
|
+
"CreateFileResponse",
|
|
122
|
+
"DealCombinedMetricsResponse",
|
|
123
|
+
"DealDataAvailablityResponse",
|
|
124
|
+
"DealWithFilesResponse",
|
|
125
|
+
"FileResponse",
|
|
126
|
+
"FileType",
|
|
127
|
+
"FinancialMetrics",
|
|
128
|
+
"FinancialsResponse",
|
|
129
|
+
"Freq",
|
|
130
|
+
"Frequency",
|
|
131
|
+
"GcsSignedUrlResponse",
|
|
132
|
+
"GroupResponse",
|
|
133
|
+
"GroupUser",
|
|
134
|
+
"GroupWithUsersResponse",
|
|
135
|
+
"GrowthAccountingResponse",
|
|
136
|
+
"HealthzResponse",
|
|
137
|
+
"HttpValidationError",
|
|
138
|
+
"IncomeStatementEntry",
|
|
139
|
+
"ListCompaniesResponse",
|
|
140
|
+
"ListDealsResponse",
|
|
141
|
+
"ListFilesResponse",
|
|
142
|
+
"ListUsersResponse",
|
|
143
|
+
"ModelMetadata",
|
|
144
|
+
"ModelsMetadataResponse",
|
|
145
|
+
"PermissionModel",
|
|
146
|
+
"Priority",
|
|
147
|
+
"ProductInfoResponse",
|
|
148
|
+
"RoleResponse",
|
|
149
|
+
"Scale",
|
|
150
|
+
"ScaleModel",
|
|
151
|
+
"ScaleModelsResponse",
|
|
152
|
+
"Scaling",
|
|
153
|
+
"Status",
|
|
154
|
+
"TerminaEnvironment",
|
|
155
|
+
"TradeoffModel",
|
|
156
|
+
"TradeoffModelsResponse",
|
|
157
|
+
"Unit",
|
|
158
|
+
"UnitEconomicsInfoResponse",
|
|
159
|
+
"UnprocessableEntityError",
|
|
160
|
+
"UserAccountingResponse",
|
|
161
|
+
"UserRoleResponse",
|
|
162
|
+
"UserType",
|
|
163
|
+
"UserWithPermissionsResponse",
|
|
164
|
+
"ValidationError",
|
|
165
|
+
"ValidationErrorLocItem",
|
|
166
|
+
"WeatherComponents",
|
|
167
|
+
"WeatherGauge",
|
|
168
|
+
"WeatherMarketContext",
|
|
169
|
+
"WeatherMetadata",
|
|
170
|
+
"WeatherMetadataResponse",
|
|
171
|
+
"__version__",
|
|
172
|
+
"auth",
|
|
173
|
+
"benchmark",
|
|
174
|
+
"company",
|
|
175
|
+
"deal",
|
|
176
|
+
"file",
|
|
177
|
+
"financials",
|
|
178
|
+
"group",
|
|
179
|
+
"macro",
|
|
180
|
+
"metadata",
|
|
181
|
+
"product",
|
|
182
|
+
"unit_economics",
|
|
183
|
+
"user",
|
|
184
|
+
]
|
termina/auth/__init__.py
ADDED
termina/auth/client.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.pydantic_utilities import pydantic_v1
|
|
9
|
+
from ..core.request_options import RequestOptions
|
|
10
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
11
|
+
from ..types.authenticate_api_key_response import AuthenticateApiKeyResponse
|
|
12
|
+
from ..types.http_validation_error import HttpValidationError
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AuthClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._client_wrapper = client_wrapper
|
|
21
|
+
|
|
22
|
+
def get_token(
|
|
23
|
+
self, *, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
24
|
+
) -> AuthenticateApiKeyResponse:
|
|
25
|
+
"""
|
|
26
|
+
Authenticate an API key and return an access token
|
|
27
|
+
|
|
28
|
+
Returns a client JWT for the provided API key, where the JWT contains claims for permissions and access and can be
|
|
29
|
+
refreshed as part of an OAuth flow.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
api_key : str
|
|
34
|
+
|
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
|
36
|
+
Request-specific configuration.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
AuthenticateApiKeyResponse
|
|
41
|
+
Successful Response
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
from termina.client import Termina
|
|
46
|
+
|
|
47
|
+
client = Termina(
|
|
48
|
+
token="YOUR_TOKEN",
|
|
49
|
+
)
|
|
50
|
+
client.auth.get_token(
|
|
51
|
+
api_key="api_key",
|
|
52
|
+
)
|
|
53
|
+
"""
|
|
54
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
55
|
+
"api/v1/auth/get-token",
|
|
56
|
+
method="POST",
|
|
57
|
+
json={"api_key": api_key},
|
|
58
|
+
request_options=request_options,
|
|
59
|
+
omit=OMIT,
|
|
60
|
+
)
|
|
61
|
+
if 200 <= _response.status_code < 300:
|
|
62
|
+
return pydantic_v1.parse_obj_as(AuthenticateApiKeyResponse, _response.json()) # type: ignore
|
|
63
|
+
if _response.status_code == 422:
|
|
64
|
+
raise UnprocessableEntityError(
|
|
65
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
|
66
|
+
)
|
|
67
|
+
try:
|
|
68
|
+
_response_json = _response.json()
|
|
69
|
+
except JSONDecodeError:
|
|
70
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
71
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class AsyncAuthClient:
|
|
75
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
76
|
+
self._client_wrapper = client_wrapper
|
|
77
|
+
|
|
78
|
+
async def get_token(
|
|
79
|
+
self, *, api_key: str, request_options: typing.Optional[RequestOptions] = None
|
|
80
|
+
) -> AuthenticateApiKeyResponse:
|
|
81
|
+
"""
|
|
82
|
+
Authenticate an API key and return an access token
|
|
83
|
+
|
|
84
|
+
Returns a client JWT for the provided API key, where the JWT contains claims for permissions and access and can be
|
|
85
|
+
refreshed as part of an OAuth flow.
|
|
86
|
+
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
|
+
api_key : str
|
|
90
|
+
|
|
91
|
+
request_options : typing.Optional[RequestOptions]
|
|
92
|
+
Request-specific configuration.
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
AuthenticateApiKeyResponse
|
|
97
|
+
Successful Response
|
|
98
|
+
|
|
99
|
+
Examples
|
|
100
|
+
--------
|
|
101
|
+
from termina.client import AsyncTermina
|
|
102
|
+
|
|
103
|
+
client = AsyncTermina(
|
|
104
|
+
token="YOUR_TOKEN",
|
|
105
|
+
)
|
|
106
|
+
await client.auth.get_token(
|
|
107
|
+
api_key="api_key",
|
|
108
|
+
)
|
|
109
|
+
"""
|
|
110
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
111
|
+
"api/v1/auth/get-token",
|
|
112
|
+
method="POST",
|
|
113
|
+
json={"api_key": api_key},
|
|
114
|
+
request_options=request_options,
|
|
115
|
+
omit=OMIT,
|
|
116
|
+
)
|
|
117
|
+
if 200 <= _response.status_code < 300:
|
|
118
|
+
return pydantic_v1.parse_obj_as(AuthenticateApiKeyResponse, _response.json()) # type: ignore
|
|
119
|
+
if _response.status_code == 422:
|
|
120
|
+
raise UnprocessableEntityError(
|
|
121
|
+
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
|
122
|
+
)
|
|
123
|
+
try:
|
|
124
|
+
_response_json = _response.json()
|
|
125
|
+
except JSONDecodeError:
|
|
126
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
127
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
termina/base_client.py
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from .auth.client import AsyncAuthClient, AuthClient
|
|
9
|
+
from .benchmark.client import AsyncBenchmarkClient, BenchmarkClient
|
|
10
|
+
from .company.client import AsyncCompanyClient, CompanyClient
|
|
11
|
+
from .core.api_error import ApiError
|
|
12
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
13
|
+
from .core.pydantic_utilities import pydantic_v1
|
|
14
|
+
from .core.request_options import RequestOptions
|
|
15
|
+
from .deal.client import AsyncDealClient, DealClient
|
|
16
|
+
from .environment import TerminaEnvironment
|
|
17
|
+
from .file.client import AsyncFileClient, FileClient
|
|
18
|
+
from .financials.client import AsyncFinancialsClient, FinancialsClient
|
|
19
|
+
from .group.client import AsyncGroupClient, GroupClient
|
|
20
|
+
from .macro.client import AsyncMacroClient, MacroClient
|
|
21
|
+
from .metadata.client import AsyncMetadataClient, MetadataClient
|
|
22
|
+
from .product.client import AsyncProductClient, ProductClient
|
|
23
|
+
from .types.healthz_response import HealthzResponse
|
|
24
|
+
from .unit_economics.client import AsyncUnitEconomicsClient, UnitEconomicsClient
|
|
25
|
+
from .user.client import AsyncUserClient, UserClient
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BaseClient:
|
|
29
|
+
"""
|
|
30
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
base_url : typing.Optional[str]
|
|
35
|
+
The base url to use for requests from the client.
|
|
36
|
+
|
|
37
|
+
environment : TerminaEnvironment
|
|
38
|
+
The environment to use for requests from the client. from .environment import TerminaEnvironment
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Defaults to TerminaEnvironment.DEFAULT
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
47
|
+
timeout : typing.Optional[float]
|
|
48
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
49
|
+
|
|
50
|
+
follow_redirects : typing.Optional[bool]
|
|
51
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
52
|
+
|
|
53
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
54
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
55
|
+
|
|
56
|
+
Examples
|
|
57
|
+
--------
|
|
58
|
+
from termina.client import Termina
|
|
59
|
+
|
|
60
|
+
client = Termina(
|
|
61
|
+
token="YOUR_TOKEN",
|
|
62
|
+
)
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
*,
|
|
68
|
+
base_url: typing.Optional[str] = None,
|
|
69
|
+
environment: TerminaEnvironment = TerminaEnvironment.DEFAULT,
|
|
70
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
71
|
+
timeout: typing.Optional[float] = None,
|
|
72
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
73
|
+
httpx_client: typing.Optional[httpx.Client] = None
|
|
74
|
+
):
|
|
75
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
76
|
+
self._client_wrapper = SyncClientWrapper(
|
|
77
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
78
|
+
token=token,
|
|
79
|
+
httpx_client=httpx_client
|
|
80
|
+
if httpx_client is not None
|
|
81
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
82
|
+
if follow_redirects is not None
|
|
83
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
84
|
+
timeout=_defaulted_timeout,
|
|
85
|
+
)
|
|
86
|
+
self.auth = AuthClient(client_wrapper=self._client_wrapper)
|
|
87
|
+
self.group = GroupClient(client_wrapper=self._client_wrapper)
|
|
88
|
+
self.user = UserClient(client_wrapper=self._client_wrapper)
|
|
89
|
+
self.macro = MacroClient(client_wrapper=self._client_wrapper)
|
|
90
|
+
self.company = CompanyClient(client_wrapper=self._client_wrapper)
|
|
91
|
+
self.deal = DealClient(client_wrapper=self._client_wrapper)
|
|
92
|
+
self.file = FileClient(client_wrapper=self._client_wrapper)
|
|
93
|
+
self.financials = FinancialsClient(client_wrapper=self._client_wrapper)
|
|
94
|
+
self.product = ProductClient(client_wrapper=self._client_wrapper)
|
|
95
|
+
self.unit_economics = UnitEconomicsClient(client_wrapper=self._client_wrapper)
|
|
96
|
+
self.metadata = MetadataClient(client_wrapper=self._client_wrapper)
|
|
97
|
+
self.benchmark = BenchmarkClient(client_wrapper=self._client_wrapper)
|
|
98
|
+
|
|
99
|
+
def healthz(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthzResponse:
|
|
100
|
+
"""
|
|
101
|
+
Parameters
|
|
102
|
+
----------
|
|
103
|
+
request_options : typing.Optional[RequestOptions]
|
|
104
|
+
Request-specific configuration.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
HealthzResponse
|
|
109
|
+
Successful Response
|
|
110
|
+
|
|
111
|
+
Examples
|
|
112
|
+
--------
|
|
113
|
+
from termina.client import Termina
|
|
114
|
+
|
|
115
|
+
client = Termina(
|
|
116
|
+
token="YOUR_TOKEN",
|
|
117
|
+
)
|
|
118
|
+
client.healthz()
|
|
119
|
+
"""
|
|
120
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
121
|
+
"api/v1/healthz", method="GET", request_options=request_options
|
|
122
|
+
)
|
|
123
|
+
if 200 <= _response.status_code < 300:
|
|
124
|
+
return pydantic_v1.parse_obj_as(HealthzResponse, _response.json()) # type: ignore
|
|
125
|
+
try:
|
|
126
|
+
_response_json = _response.json()
|
|
127
|
+
except JSONDecodeError:
|
|
128
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
129
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class AsyncBaseClient:
|
|
133
|
+
"""
|
|
134
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
135
|
+
|
|
136
|
+
Parameters
|
|
137
|
+
----------
|
|
138
|
+
base_url : typing.Optional[str]
|
|
139
|
+
The base url to use for requests from the client.
|
|
140
|
+
|
|
141
|
+
environment : TerminaEnvironment
|
|
142
|
+
The environment to use for requests from the client. from .environment import TerminaEnvironment
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
Defaults to TerminaEnvironment.DEFAULT
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
151
|
+
timeout : typing.Optional[float]
|
|
152
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
153
|
+
|
|
154
|
+
follow_redirects : typing.Optional[bool]
|
|
155
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
156
|
+
|
|
157
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
158
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
159
|
+
|
|
160
|
+
Examples
|
|
161
|
+
--------
|
|
162
|
+
from termina.client import AsyncTermina
|
|
163
|
+
|
|
164
|
+
client = AsyncTermina(
|
|
165
|
+
token="YOUR_TOKEN",
|
|
166
|
+
)
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
def __init__(
|
|
170
|
+
self,
|
|
171
|
+
*,
|
|
172
|
+
base_url: typing.Optional[str] = None,
|
|
173
|
+
environment: TerminaEnvironment = TerminaEnvironment.DEFAULT,
|
|
174
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
175
|
+
timeout: typing.Optional[float] = None,
|
|
176
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
177
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None
|
|
178
|
+
):
|
|
179
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
180
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
181
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
182
|
+
token=token,
|
|
183
|
+
httpx_client=httpx_client
|
|
184
|
+
if httpx_client is not None
|
|
185
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
186
|
+
if follow_redirects is not None
|
|
187
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
188
|
+
timeout=_defaulted_timeout,
|
|
189
|
+
)
|
|
190
|
+
self.auth = AsyncAuthClient(client_wrapper=self._client_wrapper)
|
|
191
|
+
self.group = AsyncGroupClient(client_wrapper=self._client_wrapper)
|
|
192
|
+
self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
|
|
193
|
+
self.macro = AsyncMacroClient(client_wrapper=self._client_wrapper)
|
|
194
|
+
self.company = AsyncCompanyClient(client_wrapper=self._client_wrapper)
|
|
195
|
+
self.deal = AsyncDealClient(client_wrapper=self._client_wrapper)
|
|
196
|
+
self.file = AsyncFileClient(client_wrapper=self._client_wrapper)
|
|
197
|
+
self.financials = AsyncFinancialsClient(client_wrapper=self._client_wrapper)
|
|
198
|
+
self.product = AsyncProductClient(client_wrapper=self._client_wrapper)
|
|
199
|
+
self.unit_economics = AsyncUnitEconomicsClient(client_wrapper=self._client_wrapper)
|
|
200
|
+
self.metadata = AsyncMetadataClient(client_wrapper=self._client_wrapper)
|
|
201
|
+
self.benchmark = AsyncBenchmarkClient(client_wrapper=self._client_wrapper)
|
|
202
|
+
|
|
203
|
+
async def healthz(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthzResponse:
|
|
204
|
+
"""
|
|
205
|
+
Parameters
|
|
206
|
+
----------
|
|
207
|
+
request_options : typing.Optional[RequestOptions]
|
|
208
|
+
Request-specific configuration.
|
|
209
|
+
|
|
210
|
+
Returns
|
|
211
|
+
-------
|
|
212
|
+
HealthzResponse
|
|
213
|
+
Successful Response
|
|
214
|
+
|
|
215
|
+
Examples
|
|
216
|
+
--------
|
|
217
|
+
from termina.client import AsyncTermina
|
|
218
|
+
|
|
219
|
+
client = AsyncTermina(
|
|
220
|
+
token="YOUR_TOKEN",
|
|
221
|
+
)
|
|
222
|
+
await client.healthz()
|
|
223
|
+
"""
|
|
224
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
225
|
+
"api/v1/healthz", method="GET", request_options=request_options
|
|
226
|
+
)
|
|
227
|
+
if 200 <= _response.status_code < 300:
|
|
228
|
+
return pydantic_v1.parse_obj_as(HealthzResponse, _response.json()) # type: ignore
|
|
229
|
+
try:
|
|
230
|
+
_response_json = _response.json()
|
|
231
|
+
except JSONDecodeError:
|
|
232
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
233
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: TerminaEnvironment) -> str:
|
|
237
|
+
if base_url is not None:
|
|
238
|
+
return base_url
|
|
239
|
+
elif environment is not None:
|
|
240
|
+
return environment.value
|
|
241
|
+
else:
|
|
242
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import (
|
|
4
|
+
BenchmarkGetCombinedTimeSeriesRequestUserType,
|
|
5
|
+
BenchmarkGetDealBenchmarkQuantilesRequestUserType,
|
|
6
|
+
BenchmarkGetDealBenchmarkTradeoffAtScaleRequestUserType,
|
|
7
|
+
BenchmarkGetQuantilesRequestUserType,
|
|
8
|
+
BenchmarkGetScalingRequestUserType,
|
|
9
|
+
BenchmarkGetTimeSeriesEndpointRequestUserType,
|
|
10
|
+
BenchmarkGetTradeoffAtScaleRequestUserType,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"BenchmarkGetCombinedTimeSeriesRequestUserType",
|
|
15
|
+
"BenchmarkGetDealBenchmarkQuantilesRequestUserType",
|
|
16
|
+
"BenchmarkGetDealBenchmarkTradeoffAtScaleRequestUserType",
|
|
17
|
+
"BenchmarkGetQuantilesRequestUserType",
|
|
18
|
+
"BenchmarkGetScalingRequestUserType",
|
|
19
|
+
"BenchmarkGetTimeSeriesEndpointRequestUserType",
|
|
20
|
+
"BenchmarkGetTradeoffAtScaleRequestUserType",
|
|
21
|
+
]
|