futuresearch 0.6.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.
- futuresearch/__init__.py +28 -0
- futuresearch/api_utils.py +65 -0
- futuresearch/billing.py +29 -0
- futuresearch/built_in_lists.py +104 -0
- futuresearch/constants.py +13 -0
- futuresearch/generated/__init__.py +8 -0
- futuresearch/generated/api/__init__.py +1 -0
- futuresearch/generated/api/artifacts/__init__.py +1 -0
- futuresearch/generated/api/artifacts/upload_data_artifacts_upload_post.py +212 -0
- futuresearch/generated/api/billing/__init__.py +1 -0
- futuresearch/generated/api/billing/get_billing_balance_billing_get.py +131 -0
- futuresearch/generated/api/built_in_lists/__init__.py +1 -0
- futuresearch/generated/api/built_in_lists/list_built_in_lists_endpoint_built_in_lists_get.py +198 -0
- futuresearch/generated/api/built_in_lists/use_built_in_list_endpoint_built_in_lists_use_post.py +174 -0
- futuresearch/generated/api/default/__init__.py +1 -0
- futuresearch/generated/api/default/whoami_whoami_get.py +135 -0
- futuresearch/generated/api/health/__init__.py +1 -0
- futuresearch/generated/api/health/health_health_get.py +123 -0
- futuresearch/generated/api/operations/__init__.py +1 -0
- futuresearch/generated/api/operations/agent_map_operations_agent_map_post.py +219 -0
- futuresearch/generated/api/operations/classify_operations_classify_post.py +195 -0
- futuresearch/generated/api/operations/dedupe_operations_dedupe_post.py +195 -0
- futuresearch/generated/api/operations/forecast_operations_forecast_post.py +195 -0
- futuresearch/generated/api/operations/merge_operations_merge_post.py +195 -0
- futuresearch/generated/api/operations/rank_operations_rank_post.py +195 -0
- futuresearch/generated/api/operations/single_agent_operations_single_agent_post.py +251 -0
- futuresearch/generated/api/sessions/__init__.py +1 -0
- futuresearch/generated/api/sessions/create_session_endpoint_sessions_post.py +174 -0
- futuresearch/generated/api/sessions/list_session_tasks_sessions_session_id_tasks_get.py +169 -0
- futuresearch/generated/api/sessions/list_sessions_endpoint_sessions_get.py +188 -0
- futuresearch/generated/api/tasks/__init__.py +1 -0
- futuresearch/generated/api/tasks/cancel_task_tasks_task_id_cancel_post.py +175 -0
- futuresearch/generated/api/tasks/get_task_result_tasks_task_id_result_get.py +179 -0
- futuresearch/generated/api/tasks/get_task_status_tasks_task_id_status_get.py +175 -0
- futuresearch/generated/api/uploads/__init__.py +1 -0
- futuresearch/generated/api/uploads/request_upload_uploads_request_post.py +178 -0
- futuresearch/generated/api/uploads/upload_csv_presigned_uploads_upload_id_put.py +173 -0
- futuresearch/generated/client.py +268 -0
- futuresearch/generated/errors.py +16 -0
- futuresearch/generated/models/__init__.py +141 -0
- futuresearch/generated/models/agent_map_operation.py +356 -0
- futuresearch/generated/models/agent_map_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/agent_map_operation_input_type_2.py +46 -0
- futuresearch/generated/models/agent_map_operation_response_schema_type_0.py +46 -0
- futuresearch/generated/models/billing_response.py +62 -0
- futuresearch/generated/models/built_in_list_item.py +86 -0
- futuresearch/generated/models/built_in_lists_response.py +83 -0
- futuresearch/generated/models/cancel_task_response.py +72 -0
- futuresearch/generated/models/classify_operation.py +198 -0
- futuresearch/generated/models/classify_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/classify_operation_input_type_2.py +46 -0
- futuresearch/generated/models/create_artifact_response.py +102 -0
- futuresearch/generated/models/create_session.py +61 -0
- futuresearch/generated/models/dedupe_operation.py +209 -0
- futuresearch/generated/models/dedupe_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/dedupe_operation_input_type_2.py +46 -0
- futuresearch/generated/models/dedupe_operation_strategy.py +10 -0
- futuresearch/generated/models/error_response.py +109 -0
- futuresearch/generated/models/error_response_details_type_0.py +46 -0
- futuresearch/generated/models/forecast_operation.py +172 -0
- futuresearch/generated/models/forecast_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/forecast_operation_input_type_2.py +46 -0
- futuresearch/generated/models/health_response.py +61 -0
- futuresearch/generated/models/http_validation_error.py +79 -0
- futuresearch/generated/models/insufficient_balance_response.py +88 -0
- futuresearch/generated/models/llm_enum_public.py +50 -0
- futuresearch/generated/models/merge_breakdown_response.py +215 -0
- futuresearch/generated/models/merge_operation.py +333 -0
- futuresearch/generated/models/merge_operation_left_input_type_1_item.py +46 -0
- futuresearch/generated/models/merge_operation_left_input_type_2.py +46 -0
- futuresearch/generated/models/merge_operation_relationship_type_type_0.py +11 -0
- futuresearch/generated/models/merge_operation_right_input_type_1_item.py +46 -0
- futuresearch/generated/models/merge_operation_right_input_type_2.py +46 -0
- futuresearch/generated/models/merge_operation_use_web_search_type_0.py +10 -0
- futuresearch/generated/models/operation_response.py +131 -0
- futuresearch/generated/models/public_effort_level.py +10 -0
- futuresearch/generated/models/public_task_type.py +15 -0
- futuresearch/generated/models/rank_operation.py +223 -0
- futuresearch/generated/models/rank_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/rank_operation_input_type_2.py +46 -0
- futuresearch/generated/models/rank_operation_response_schema_type_0.py +46 -0
- futuresearch/generated/models/request_upload_request.py +94 -0
- futuresearch/generated/models/request_upload_response.py +94 -0
- futuresearch/generated/models/session_list_item.py +88 -0
- futuresearch/generated/models/session_list_response.py +99 -0
- futuresearch/generated/models/session_response.py +62 -0
- futuresearch/generated/models/session_task_item.py +200 -0
- futuresearch/generated/models/session_tasks_response.py +84 -0
- futuresearch/generated/models/single_agent_operation.py +345 -0
- futuresearch/generated/models/single_agent_operation_input_type_1_item.py +46 -0
- futuresearch/generated/models/single_agent_operation_input_type_2.py +46 -0
- futuresearch/generated/models/single_agent_operation_response_schema_type_0.py +46 -0
- futuresearch/generated/models/task_progress_info.py +93 -0
- futuresearch/generated/models/task_result_response.py +218 -0
- futuresearch/generated/models/task_result_response_data_type_0_item.py +46 -0
- futuresearch/generated/models/task_result_response_data_type_1.py +46 -0
- futuresearch/generated/models/task_status.py +12 -0
- futuresearch/generated/models/task_status_response.py +225 -0
- futuresearch/generated/models/upload_complete_response.py +94 -0
- futuresearch/generated/models/upload_data_artifacts_upload_post_files_body.py +95 -0
- futuresearch/generated/models/upload_data_artifacts_upload_post_json_body.py +130 -0
- futuresearch/generated/models/upload_data_artifacts_upload_post_json_body_data_type_0_item.py +46 -0
- futuresearch/generated/models/upload_data_artifacts_upload_post_json_body_data_type_1.py +46 -0
- futuresearch/generated/models/use_built_in_list_request.py +94 -0
- futuresearch/generated/models/use_built_in_list_response.py +78 -0
- futuresearch/generated/models/validation_error.py +90 -0
- futuresearch/generated/models/whoami_whoami_get_response_whoami_whoami_get.py +46 -0
- futuresearch/generated/py.typed +1 -0
- futuresearch/generated/types.py +54 -0
- futuresearch/ops.py +887 -0
- futuresearch/result.py +94 -0
- futuresearch/session.py +167 -0
- futuresearch/task.py +381 -0
- futuresearch-0.6.0.dist-info/METADATA +284 -0
- futuresearch-0.6.0.dist-info/RECORD +117 -0
- futuresearch-0.6.0.dist-info/WHEEL +4 -0
- futuresearch-0.6.0.dist-info/licenses/LICENSE.txt +21 -0
futuresearch/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from importlib.metadata import version
|
|
2
|
+
|
|
3
|
+
from futuresearch.api_utils import create_client
|
|
4
|
+
from futuresearch.billing import BillingResponse, get_billing_balance
|
|
5
|
+
from futuresearch.session import (
|
|
6
|
+
Session,
|
|
7
|
+
SessionInfo,
|
|
8
|
+
SessionListResult,
|
|
9
|
+
create_session,
|
|
10
|
+
list_sessions,
|
|
11
|
+
)
|
|
12
|
+
from futuresearch.task import fetch_task_data, print_progress
|
|
13
|
+
|
|
14
|
+
__version__ = version("futuresearch")
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"BillingResponse",
|
|
18
|
+
"Session",
|
|
19
|
+
"SessionInfo",
|
|
20
|
+
"SessionListResult",
|
|
21
|
+
"__version__",
|
|
22
|
+
"create_client",
|
|
23
|
+
"create_session",
|
|
24
|
+
"fetch_task_data",
|
|
25
|
+
"get_billing_balance",
|
|
26
|
+
"list_sessions",
|
|
27
|
+
"print_progress",
|
|
28
|
+
]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import TypeVar
|
|
3
|
+
|
|
4
|
+
from futuresearch.constants import DEFAULT_FUTURESEARCH_API_URL, FuturesearchError
|
|
5
|
+
from futuresearch.generated.client import AuthenticatedClient
|
|
6
|
+
from futuresearch.generated.models.error_response import ErrorResponse
|
|
7
|
+
from futuresearch.generated.models.http_validation_error import HTTPValidationError
|
|
8
|
+
from futuresearch.generated.models.insufficient_balance_response import (
|
|
9
|
+
InsufficientBalanceResponse,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
# Backwards compatibility alias
|
|
13
|
+
EveryrowError = FuturesearchError
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def create_client() -> AuthenticatedClient:
|
|
17
|
+
"""Create an AuthenticatedClient from environment variables.
|
|
18
|
+
|
|
19
|
+
Reads FUTURESEARCH_API_KEY (or legacy EVERYROW_API_KEY) and
|
|
20
|
+
FUTURESEARCH_API_URL (or legacy EVERYROW_API_URL) from environment variables.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
AuthenticatedClient: A configured client instance
|
|
24
|
+
|
|
25
|
+
Raises:
|
|
26
|
+
ValueError: If no API key is set in environment
|
|
27
|
+
"""
|
|
28
|
+
api_key = os.environ.get("FUTURESEARCH_API_KEY") or os.environ.get(
|
|
29
|
+
"EVERYROW_API_KEY"
|
|
30
|
+
)
|
|
31
|
+
if not api_key:
|
|
32
|
+
raise ValueError("FUTURESEARCH_API_KEY is not set; cannot initialize client")
|
|
33
|
+
api_url = (
|
|
34
|
+
os.environ.get("FUTURESEARCH_API_URL")
|
|
35
|
+
or os.environ.get("EVERYROW_API_URL")
|
|
36
|
+
or DEFAULT_FUTURESEARCH_API_URL
|
|
37
|
+
)
|
|
38
|
+
return AuthenticatedClient(
|
|
39
|
+
base_url=api_url,
|
|
40
|
+
token=api_key,
|
|
41
|
+
raise_on_unexpected_status=True,
|
|
42
|
+
follow_redirects=True,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
T = TypeVar("T")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def handle_response[T](
|
|
50
|
+
response: T
|
|
51
|
+
| ErrorResponse
|
|
52
|
+
| HTTPValidationError
|
|
53
|
+
| InsufficientBalanceResponse
|
|
54
|
+
| None,
|
|
55
|
+
) -> T:
|
|
56
|
+
if isinstance(response, ErrorResponse):
|
|
57
|
+
raise FuturesearchError(response.message)
|
|
58
|
+
if isinstance(response, HTTPValidationError):
|
|
59
|
+
raise FuturesearchError(response.detail)
|
|
60
|
+
if isinstance(response, InsufficientBalanceResponse):
|
|
61
|
+
raise FuturesearchError(response.message)
|
|
62
|
+
if response is None:
|
|
63
|
+
raise FuturesearchError("Unknown error")
|
|
64
|
+
|
|
65
|
+
return response
|
futuresearch/billing.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Billing utilities for futuresearch SDK."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from futuresearch.api_utils import create_client
|
|
6
|
+
from futuresearch.generated.api.billing import get_billing_balance_billing_get
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class BillingResponse:
|
|
11
|
+
"""Response containing the user's current billing balance."""
|
|
12
|
+
|
|
13
|
+
current_balance_dollars: float
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
async def get_billing_balance() -> BillingResponse:
|
|
17
|
+
"""Get the current billing balance for the authenticated user.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
BillingResponse containing the user's current balance.
|
|
21
|
+
|
|
22
|
+
Raises:
|
|
23
|
+
RuntimeError: If the request fails
|
|
24
|
+
"""
|
|
25
|
+
client = create_client()
|
|
26
|
+
response = await get_billing_balance_billing_get.asyncio(client=client)
|
|
27
|
+
if response is None:
|
|
28
|
+
raise RuntimeError("Failed to get billing balance")
|
|
29
|
+
return BillingResponse(current_balance_dollars=response.current_balance_dollars)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Built-in lists: browse and import pre-built datasets."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
from futuresearch.constants import EveryrowError
|
|
7
|
+
from futuresearch.generated.client import AuthenticatedClient
|
|
8
|
+
from futuresearch.session import Session
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class BuiltInListItem:
|
|
13
|
+
"""A built-in dataset available for import."""
|
|
14
|
+
|
|
15
|
+
name: str
|
|
16
|
+
artifact_id: UUID
|
|
17
|
+
category: str
|
|
18
|
+
fields: list[str]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class UseBuiltInListResult:
|
|
23
|
+
"""Result of importing a built-in list into a session."""
|
|
24
|
+
|
|
25
|
+
artifact_id: UUID
|
|
26
|
+
session_id: UUID
|
|
27
|
+
task_id: UUID
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def list_built_in_datasets(
|
|
31
|
+
client: AuthenticatedClient,
|
|
32
|
+
search: str | None = None,
|
|
33
|
+
category: str | None = None,
|
|
34
|
+
) -> list[BuiltInListItem]:
|
|
35
|
+
"""Fetch available built-in datasets from the API.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
client: Authenticated API client.
|
|
39
|
+
search: Optional search term to match against list names (case-insensitive).
|
|
40
|
+
category: Optional category filter.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
List of available built-in datasets.
|
|
44
|
+
"""
|
|
45
|
+
params: dict[str, str] = {}
|
|
46
|
+
if search:
|
|
47
|
+
params["search"] = search
|
|
48
|
+
if category:
|
|
49
|
+
params["category"] = category
|
|
50
|
+
|
|
51
|
+
response = await client.get_async_httpx_client().request(
|
|
52
|
+
method="GET",
|
|
53
|
+
url="/built-in-lists",
|
|
54
|
+
params=params,
|
|
55
|
+
)
|
|
56
|
+
if response.status_code != 200:
|
|
57
|
+
raise EveryrowError(f"Failed to list built-in datasets: {response.text}")
|
|
58
|
+
|
|
59
|
+
data = response.json()
|
|
60
|
+
return [
|
|
61
|
+
BuiltInListItem(
|
|
62
|
+
name=item["name"],
|
|
63
|
+
artifact_id=UUID(item["artifact_id"]),
|
|
64
|
+
category=item["category"],
|
|
65
|
+
fields=item["fields"],
|
|
66
|
+
)
|
|
67
|
+
for item in data.get("lists", [])
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def use_built_in_list(
|
|
72
|
+
artifact_id: UUID,
|
|
73
|
+
session: Session,
|
|
74
|
+
session_id: UUID | None = None,
|
|
75
|
+
) -> UseBuiltInListResult:
|
|
76
|
+
"""Copy a built-in list into a session, ready for use in operations.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
artifact_id: The artifact_id from browse results.
|
|
80
|
+
session: Session object (provides client and session_id).
|
|
81
|
+
session_id: Optional override session_id. Defaults to session.session_id.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
UseBuiltInListResult with the new artifact_id, session_id, and task_id.
|
|
85
|
+
"""
|
|
86
|
+
body = {
|
|
87
|
+
"artifact_id": str(artifact_id),
|
|
88
|
+
"session_id": str(session_id or session.session_id),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
response = await session.client.get_async_httpx_client().request(
|
|
92
|
+
method="POST",
|
|
93
|
+
url="/built-in-lists/use",
|
|
94
|
+
json=body,
|
|
95
|
+
)
|
|
96
|
+
if response.status_code != 200:
|
|
97
|
+
raise EveryrowError(f"Failed to use built-in list: {response.text}")
|
|
98
|
+
|
|
99
|
+
data = response.json()
|
|
100
|
+
return UseBuiltInListResult(
|
|
101
|
+
artifact_id=UUID(data["artifact_id"]),
|
|
102
|
+
session_id=UUID(data["session_id"]),
|
|
103
|
+
task_id=UUID(data["task_id"]),
|
|
104
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
DEFAULT_FUTURESEARCH_APP_URL = "https://futuresearch.ai"
|
|
2
|
+
DEFAULT_FUTURESEARCH_API_URL = "https://futuresearch.ai/api/v0"
|
|
3
|
+
|
|
4
|
+
# Backwards compatibility aliases
|
|
5
|
+
DEFAULT_EVERYROW_APP_URL = DEFAULT_FUTURESEARCH_APP_URL
|
|
6
|
+
DEFAULT_EVERYROW_API_URL = DEFAULT_FUTURESEARCH_API_URL
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FuturesearchError(Exception): ...
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Backwards compatibility alias
|
|
13
|
+
EveryrowError = FuturesearchError
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.create_artifact_response import CreateArtifactResponse
|
|
9
|
+
from ...models.error_response import ErrorResponse
|
|
10
|
+
from ...models.upload_data_artifacts_upload_post_files_body import UploadDataArtifactsUploadPostFilesBody
|
|
11
|
+
from ...models.upload_data_artifacts_upload_post_json_body import UploadDataArtifactsUploadPostJsonBody
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: UploadDataArtifactsUploadPostJsonBody | UploadDataArtifactsUploadPostFilesBody | Unset = UNSET,
|
|
18
|
+
x_cohort_source: None | str | Unset = UNSET,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
if not isinstance(x_cohort_source, Unset):
|
|
22
|
+
headers["X-Cohort-Source"] = x_cohort_source
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/artifacts/upload",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if isinstance(body, UploadDataArtifactsUploadPostJsonBody):
|
|
30
|
+
_kwargs["json"] = body.to_dict()
|
|
31
|
+
|
|
32
|
+
headers["Content-Type"] = "application/json"
|
|
33
|
+
if isinstance(body, UploadDataArtifactsUploadPostFilesBody):
|
|
34
|
+
_kwargs["files"] = body.to_multipart()
|
|
35
|
+
|
|
36
|
+
headers["Content-Type"] = "multipart/form-data"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> CreateArtifactResponse | ErrorResponse | None:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = CreateArtifactResponse.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
|
|
50
|
+
if response.status_code == 422:
|
|
51
|
+
response_422 = ErrorResponse.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_422
|
|
54
|
+
|
|
55
|
+
if response.status_code == 504:
|
|
56
|
+
response_504 = ErrorResponse.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_504
|
|
59
|
+
|
|
60
|
+
if client.raise_on_unexpected_status:
|
|
61
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
62
|
+
else:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _build_response(
|
|
67
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
68
|
+
) -> Response[CreateArtifactResponse | ErrorResponse]:
|
|
69
|
+
return Response(
|
|
70
|
+
status_code=HTTPStatus(response.status_code),
|
|
71
|
+
content=response.content,
|
|
72
|
+
headers=response.headers,
|
|
73
|
+
parsed=_parse_response(client=client, response=response),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def sync_detailed(
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient,
|
|
80
|
+
body: UploadDataArtifactsUploadPostJsonBody | UploadDataArtifactsUploadPostFilesBody | Unset = UNSET,
|
|
81
|
+
x_cohort_source: None | str | Unset = UNSET,
|
|
82
|
+
) -> Response[CreateArtifactResponse | ErrorResponse]:
|
|
83
|
+
"""Upload data as an artifact (CSV or JSON)
|
|
84
|
+
|
|
85
|
+
Unified upload endpoint. Send a CSV/TSV file as multipart/form-data, or send JSON data as
|
|
86
|
+
application/json. Both paths create an UPLOAD_DATA task and return artifact_id, session_id, and
|
|
87
|
+
task_id.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
x_cohort_source (None | str | Unset):
|
|
91
|
+
body (UploadDataArtifactsUploadPostJsonBody):
|
|
92
|
+
body (UploadDataArtifactsUploadPostFilesBody):
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Response[CreateArtifactResponse | ErrorResponse]
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs(
|
|
103
|
+
body=body,
|
|
104
|
+
x_cohort_source=x_cohort_source,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
response = client.get_httpx_client().request(
|
|
108
|
+
**kwargs,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return _build_response(client=client, response=response)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def sync(
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient,
|
|
117
|
+
body: UploadDataArtifactsUploadPostJsonBody | UploadDataArtifactsUploadPostFilesBody | Unset = UNSET,
|
|
118
|
+
x_cohort_source: None | str | Unset = UNSET,
|
|
119
|
+
) -> CreateArtifactResponse | ErrorResponse | None:
|
|
120
|
+
"""Upload data as an artifact (CSV or JSON)
|
|
121
|
+
|
|
122
|
+
Unified upload endpoint. Send a CSV/TSV file as multipart/form-data, or send JSON data as
|
|
123
|
+
application/json. Both paths create an UPLOAD_DATA task and return artifact_id, session_id, and
|
|
124
|
+
task_id.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
x_cohort_source (None | str | Unset):
|
|
128
|
+
body (UploadDataArtifactsUploadPostJsonBody):
|
|
129
|
+
body (UploadDataArtifactsUploadPostFilesBody):
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
133
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
CreateArtifactResponse | ErrorResponse
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
return sync_detailed(
|
|
140
|
+
client=client,
|
|
141
|
+
body=body,
|
|
142
|
+
x_cohort_source=x_cohort_source,
|
|
143
|
+
).parsed
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
async def asyncio_detailed(
|
|
147
|
+
*,
|
|
148
|
+
client: AuthenticatedClient,
|
|
149
|
+
body: UploadDataArtifactsUploadPostJsonBody | UploadDataArtifactsUploadPostFilesBody | Unset = UNSET,
|
|
150
|
+
x_cohort_source: None | str | Unset = UNSET,
|
|
151
|
+
) -> Response[CreateArtifactResponse | ErrorResponse]:
|
|
152
|
+
"""Upload data as an artifact (CSV or JSON)
|
|
153
|
+
|
|
154
|
+
Unified upload endpoint. Send a CSV/TSV file as multipart/form-data, or send JSON data as
|
|
155
|
+
application/json. Both paths create an UPLOAD_DATA task and return artifact_id, session_id, and
|
|
156
|
+
task_id.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
x_cohort_source (None | str | Unset):
|
|
160
|
+
body (UploadDataArtifactsUploadPostJsonBody):
|
|
161
|
+
body (UploadDataArtifactsUploadPostFilesBody):
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Response[CreateArtifactResponse | ErrorResponse]
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
kwargs = _get_kwargs(
|
|
172
|
+
body=body,
|
|
173
|
+
x_cohort_source=x_cohort_source,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
177
|
+
|
|
178
|
+
return _build_response(client=client, response=response)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def asyncio(
|
|
182
|
+
*,
|
|
183
|
+
client: AuthenticatedClient,
|
|
184
|
+
body: UploadDataArtifactsUploadPostJsonBody | UploadDataArtifactsUploadPostFilesBody | Unset = UNSET,
|
|
185
|
+
x_cohort_source: None | str | Unset = UNSET,
|
|
186
|
+
) -> CreateArtifactResponse | ErrorResponse | None:
|
|
187
|
+
"""Upload data as an artifact (CSV or JSON)
|
|
188
|
+
|
|
189
|
+
Unified upload endpoint. Send a CSV/TSV file as multipart/form-data, or send JSON data as
|
|
190
|
+
application/json. Both paths create an UPLOAD_DATA task and return artifact_id, session_id, and
|
|
191
|
+
task_id.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
x_cohort_source (None | str | Unset):
|
|
195
|
+
body (UploadDataArtifactsUploadPostJsonBody):
|
|
196
|
+
body (UploadDataArtifactsUploadPostFilesBody):
|
|
197
|
+
|
|
198
|
+
Raises:
|
|
199
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
200
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
CreateArtifactResponse | ErrorResponse
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
await asyncio_detailed(
|
|
208
|
+
client=client,
|
|
209
|
+
body=body,
|
|
210
|
+
x_cohort_source=x_cohort_source,
|
|
211
|
+
)
|
|
212
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.billing_response import BillingResponse
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
13
|
+
_kwargs: dict[str, Any] = {
|
|
14
|
+
"method": "get",
|
|
15
|
+
"url": "/billing",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return _kwargs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> BillingResponse | None:
|
|
22
|
+
if response.status_code == 200:
|
|
23
|
+
response_200 = BillingResponse.from_dict(response.json())
|
|
24
|
+
|
|
25
|
+
return response_200
|
|
26
|
+
|
|
27
|
+
if client.raise_on_unexpected_status:
|
|
28
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
29
|
+
else:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[BillingResponse]:
|
|
34
|
+
return Response(
|
|
35
|
+
status_code=HTTPStatus(response.status_code),
|
|
36
|
+
content=response.content,
|
|
37
|
+
headers=response.headers,
|
|
38
|
+
parsed=_parse_response(client=client, response=response),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def sync_detailed(
|
|
43
|
+
*,
|
|
44
|
+
client: AuthenticatedClient,
|
|
45
|
+
) -> Response[BillingResponse]:
|
|
46
|
+
"""Get billing balance
|
|
47
|
+
|
|
48
|
+
Get the current billing balance for the authenticated user.
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
52
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Response[BillingResponse]
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
kwargs = _get_kwargs()
|
|
59
|
+
|
|
60
|
+
response = client.get_httpx_client().request(
|
|
61
|
+
**kwargs,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return _build_response(client=client, response=response)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync(
|
|
68
|
+
*,
|
|
69
|
+
client: AuthenticatedClient,
|
|
70
|
+
) -> BillingResponse | None:
|
|
71
|
+
"""Get billing balance
|
|
72
|
+
|
|
73
|
+
Get the current billing balance for the authenticated user.
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
BillingResponse
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
return sync_detailed(
|
|
84
|
+
client=client,
|
|
85
|
+
).parsed
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def asyncio_detailed(
|
|
89
|
+
*,
|
|
90
|
+
client: AuthenticatedClient,
|
|
91
|
+
) -> Response[BillingResponse]:
|
|
92
|
+
"""Get billing balance
|
|
93
|
+
|
|
94
|
+
Get the current billing balance for the authenticated user.
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Response[BillingResponse]
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
kwargs = _get_kwargs()
|
|
105
|
+
|
|
106
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
107
|
+
|
|
108
|
+
return _build_response(client=client, response=response)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
async def asyncio(
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient,
|
|
114
|
+
) -> BillingResponse | None:
|
|
115
|
+
"""Get billing balance
|
|
116
|
+
|
|
117
|
+
Get the current billing balance for the authenticated user.
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
BillingResponse
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
await asyncio_detailed(
|
|
129
|
+
client=client,
|
|
130
|
+
)
|
|
131
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|