studyfetch-sdk 0.1.0a1__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.
- studyfetch_sdk/__init__.py +100 -0
- studyfetch_sdk/_base_client.py +1992 -0
- studyfetch_sdk/_client.py +403 -0
- studyfetch_sdk/_compat.py +219 -0
- studyfetch_sdk/_constants.py +14 -0
- studyfetch_sdk/_exceptions.py +108 -0
- studyfetch_sdk/_files.py +123 -0
- studyfetch_sdk/_models.py +808 -0
- studyfetch_sdk/_qs.py +150 -0
- studyfetch_sdk/_resource.py +43 -0
- studyfetch_sdk/_response.py +832 -0
- studyfetch_sdk/_streaming.py +333 -0
- studyfetch_sdk/_types.py +219 -0
- studyfetch_sdk/_utils/__init__.py +57 -0
- studyfetch_sdk/_utils/_logs.py +25 -0
- studyfetch_sdk/_utils/_proxy.py +65 -0
- studyfetch_sdk/_utils/_reflection.py +42 -0
- studyfetch_sdk/_utils/_resources_proxy.py +24 -0
- studyfetch_sdk/_utils/_streams.py +12 -0
- studyfetch_sdk/_utils/_sync.py +86 -0
- studyfetch_sdk/_utils/_transform.py +447 -0
- studyfetch_sdk/_utils/_typing.py +151 -0
- studyfetch_sdk/_utils/_utils.py +422 -0
- studyfetch_sdk/_version.py +4 -0
- studyfetch_sdk/lib/.keep +4 -0
- studyfetch_sdk/py.typed +0 -0
- studyfetch_sdk/resources/__init__.py +19 -0
- studyfetch_sdk/resources/v1/__init__.py +215 -0
- studyfetch_sdk/resources/v1/audio_recaps/__init__.py +33 -0
- studyfetch_sdk/resources/v1/audio_recaps/audio_recaps.py +328 -0
- studyfetch_sdk/resources/v1/audio_recaps/sections.py +250 -0
- studyfetch_sdk/resources/v1/auth/__init__.py +61 -0
- studyfetch_sdk/resources/v1/auth/auth.py +620 -0
- studyfetch_sdk/resources/v1/auth/login.py +374 -0
- studyfetch_sdk/resources/v1/auth/number_2fa.py +457 -0
- studyfetch_sdk/resources/v1/auth/organization_invites.py +160 -0
- studyfetch_sdk/resources/v1/chat/__init__.py +47 -0
- studyfetch_sdk/resources/v1/chat/chat.py +576 -0
- studyfetch_sdk/resources/v1/chat/sessions.py +222 -0
- studyfetch_sdk/resources/v1/chat/test.py +190 -0
- studyfetch_sdk/resources/v1/components.py +943 -0
- studyfetch_sdk/resources/v1/embed/__init__.py +33 -0
- studyfetch_sdk/resources/v1/embed/component.py +278 -0
- studyfetch_sdk/resources/v1/embed/embed.py +346 -0
- studyfetch_sdk/resources/v1/explainers.py +216 -0
- studyfetch_sdk/resources/v1/flashcards.py +783 -0
- studyfetch_sdk/resources/v1/folders.py +744 -0
- studyfetch_sdk/resources/v1/materials/__init__.py +61 -0
- studyfetch_sdk/resources/v1/materials/bulk.py +134 -0
- studyfetch_sdk/resources/v1/materials/materials.py +1029 -0
- studyfetch_sdk/resources/v1/materials/test.py +290 -0
- studyfetch_sdk/resources/v1/materials/upload.py +410 -0
- studyfetch_sdk/resources/v1/organizations/__init__.py +103 -0
- studyfetch_sdk/resources/v1/organizations/api_keys.py +260 -0
- studyfetch_sdk/resources/v1/organizations/logo/__init__.py +33 -0
- studyfetch_sdk/resources/v1/organizations/logo/logo.py +166 -0
- studyfetch_sdk/resources/v1/organizations/logo/upload.py +184 -0
- studyfetch_sdk/resources/v1/organizations/organizations.py +428 -0
- studyfetch_sdk/resources/v1/organizations/profile/__init__.py +47 -0
- studyfetch_sdk/resources/v1/organizations/profile/models.py +134 -0
- studyfetch_sdk/resources/v1/organizations/profile/profile.py +248 -0
- studyfetch_sdk/resources/v1/organizations/profile/team.py +462 -0
- studyfetch_sdk/resources/v1/organizations/team/__init__.py +33 -0
- studyfetch_sdk/resources/v1/organizations/team/invite.py +236 -0
- studyfetch_sdk/resources/v1/organizations/team/team.py +564 -0
- studyfetch_sdk/resources/v1/organizations/theme.py +184 -0
- studyfetch_sdk/resources/v1/organizations/usage.py +160 -0
- studyfetch_sdk/resources/v1/scenarios/__init__.py +61 -0
- studyfetch_sdk/resources/v1/scenarios/component.py +330 -0
- studyfetch_sdk/resources/v1/scenarios/scenarios.py +708 -0
- studyfetch_sdk/resources/v1/scenarios/sessions.py +236 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/__init__.py +33 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/submissions.py +102 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/user.py +210 -0
- studyfetch_sdk/resources/v1/tests/__init__.py +33 -0
- studyfetch_sdk/resources/v1/tests/component.py +160 -0
- studyfetch_sdk/resources/v1/tests/tests.py +682 -0
- studyfetch_sdk/resources/v1/upload/__init__.py +33 -0
- studyfetch_sdk/resources/v1/upload/component.py +388 -0
- studyfetch_sdk/resources/v1/upload/upload.py +102 -0
- studyfetch_sdk/resources/v1/usage.py +1126 -0
- studyfetch_sdk/resources/v1/v1.py +518 -0
- studyfetch_sdk/types/__init__.py +3 -0
- studyfetch_sdk/types/v1/__init__.py +52 -0
- studyfetch_sdk/types/v1/admin/__init__.py +3 -0
- studyfetch_sdk/types/v1/admin/organizations/__init__.py +3 -0
- studyfetch_sdk/types/v1/admin/organizations/models/__init__.py +3 -0
- studyfetch_sdk/types/v1/audio_recaps/__init__.py +3 -0
- studyfetch_sdk/types/v1/auth/__init__.py +13 -0
- studyfetch_sdk/types/v1/auth/login_authenticate_params.py +15 -0
- studyfetch_sdk/types/v1/auth/login_verify_2fa_params.py +15 -0
- studyfetch_sdk/types/v1/auth/login_verify_backup_code_params.py +17 -0
- studyfetch_sdk/types/v1/auth/number_2fa_disable_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_enable_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_regenerate_backup_codes_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_send_code_params.py +12 -0
- studyfetch_sdk/types/v1/auth_register_new_user_params.py +23 -0
- studyfetch_sdk/types/v1/auth_request_password_reset_params.py +12 -0
- studyfetch_sdk/types/v1/auth_reset_password_params.py +17 -0
- studyfetch_sdk/types/v1/chat/__init__.py +5 -0
- studyfetch_sdk/types/v1/chat/session_retrieve_params.py +11 -0
- studyfetch_sdk/types/v1/chat_retrieve_session_params.py +13 -0
- studyfetch_sdk/types/v1/chat_send_message_params.py +54 -0
- studyfetch_sdk/types/v1/chat_stream_params.py +28 -0
- studyfetch_sdk/types/v1/component_create_params.py +29 -0
- studyfetch_sdk/types/v1/component_create_response.py +46 -0
- studyfetch_sdk/types/v1/component_embed_params.py +99 -0
- studyfetch_sdk/types/v1/component_embed_response.py +38 -0
- studyfetch_sdk/types/v1/component_list_params.py +14 -0
- studyfetch_sdk/types/v1/component_list_response.py +49 -0
- studyfetch_sdk/types/v1/component_retrieve_response.py +46 -0
- studyfetch_sdk/types/v1/component_update_params.py +12 -0
- studyfetch_sdk/types/v1/component_update_response.py +46 -0
- studyfetch_sdk/types/v1/embed/__init__.py +6 -0
- studyfetch_sdk/types/v1/embed/component_interact_params.py +14 -0
- studyfetch_sdk/types/v1/embed/component_retrieve_params.py +12 -0
- studyfetch_sdk/types/v1/embed_get_theme_params.py +12 -0
- studyfetch_sdk/types/v1/embed_verify_params.py +12 -0
- studyfetch_sdk/types/v1/explainer_handle_webhook_params.py +11 -0
- studyfetch_sdk/types/v1/flashcard_batch_process_params.py +36 -0
- studyfetch_sdk/types/v1/flashcard_batch_process_response.py +39 -0
- studyfetch_sdk/types/v1/flashcard_get_algorithm_info_response.py +37 -0
- studyfetch_sdk/types/v1/flashcard_get_all_params.py +23 -0
- studyfetch_sdk/types/v1/flashcard_get_due_params.py +19 -0
- studyfetch_sdk/types/v1/flashcard_get_stats_params.py +17 -0
- studyfetch_sdk/types/v1/flashcard_get_types_response.py +14 -0
- studyfetch_sdk/types/v1/flashcard_rate_params.py +23 -0
- studyfetch_sdk/types/v1/folder_create_params.py +17 -0
- studyfetch_sdk/types/v1/folder_list_params.py +14 -0
- studyfetch_sdk/types/v1/folder_update_params.py +17 -0
- studyfetch_sdk/types/v1/material_create_params.py +34 -0
- studyfetch_sdk/types/v1/material_create_response.py +62 -0
- studyfetch_sdk/types/v1/material_get_download_url_params.py +13 -0
- studyfetch_sdk/types/v1/material_list_params.py +14 -0
- studyfetch_sdk/types/v1/material_list_response.py +65 -0
- studyfetch_sdk/types/v1/material_retrieve_response.py +62 -0
- studyfetch_sdk/types/v1/materials/__init__.py +8 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_response.py +62 -0
- studyfetch_sdk/types/v1/materials/upload_upload_from_url_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_upload_from_url_response.py +62 -0
- studyfetch_sdk/types/v1/organizations/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/logo/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/profile/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/team/__init__.py +3 -0
- studyfetch_sdk/types/v1/scenario_create_params.py +11 -0
- studyfetch_sdk/types/v1/scenario_update_params.py +11 -0
- studyfetch_sdk/types/v1/scenarios/__init__.py +5 -0
- studyfetch_sdk/types/v1/scenarios/component_update_params.py +11 -0
- studyfetch_sdk/types/v1/scenarios/submissions/__init__.py +3 -0
- studyfetch_sdk/types/v1/test_create_params.py +20 -0
- studyfetch_sdk/types/v1/test_retake_params.py +14 -0
- studyfetch_sdk/types/v1/test_submit_answer_params.py +20 -0
- studyfetch_sdk/types/v1/test_submit_params.py +14 -0
- studyfetch_sdk/types/v1/tests/__init__.py +3 -0
- studyfetch_sdk/types/v1/upload/__init__.py +3 -0
- studyfetch_sdk/types/v1/usage_get_stats_params.py +23 -0
- studyfetch_sdk/types/v1/usage_get_summary_params.py +23 -0
- studyfetch_sdk/types/v1/usage_list_events_params.py +61 -0
- studyfetch_sdk/types/v1/usage_track_chat_params.py +54 -0
- studyfetch_sdk/types/v1/usage_track_event_params.py +128 -0
- studyfetch_sdk-0.1.0a1.dist-info/METADATA +453 -0
- studyfetch_sdk-0.1.0a1.dist-info/RECORD +165 -0
- studyfetch_sdk-0.1.0a1.dist-info/WHEEL +4 -0
- studyfetch_sdk-0.1.0a1.dist-info/licenses/LICENSE +201 -0
studyfetch_sdk/_qs.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, List, Tuple, Union, Mapping, TypeVar
|
|
4
|
+
from urllib.parse import parse_qs, urlencode
|
|
5
|
+
from typing_extensions import Literal, get_args
|
|
6
|
+
|
|
7
|
+
from ._types import NOT_GIVEN, NotGiven, NotGivenOr
|
|
8
|
+
from ._utils import flatten
|
|
9
|
+
|
|
10
|
+
_T = TypeVar("_T")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
ArrayFormat = Literal["comma", "repeat", "indices", "brackets"]
|
|
14
|
+
NestedFormat = Literal["dots", "brackets"]
|
|
15
|
+
|
|
16
|
+
PrimitiveData = Union[str, int, float, bool, None]
|
|
17
|
+
# this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"]
|
|
18
|
+
# https://github.com/microsoft/pyright/issues/3555
|
|
19
|
+
Data = Union[PrimitiveData, List[Any], Tuple[Any], "Mapping[str, Any]"]
|
|
20
|
+
Params = Mapping[str, Data]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Querystring:
|
|
24
|
+
array_format: ArrayFormat
|
|
25
|
+
nested_format: NestedFormat
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
array_format: ArrayFormat = "repeat",
|
|
31
|
+
nested_format: NestedFormat = "brackets",
|
|
32
|
+
) -> None:
|
|
33
|
+
self.array_format = array_format
|
|
34
|
+
self.nested_format = nested_format
|
|
35
|
+
|
|
36
|
+
def parse(self, query: str) -> Mapping[str, object]:
|
|
37
|
+
# Note: custom format syntax is not supported yet
|
|
38
|
+
return parse_qs(query)
|
|
39
|
+
|
|
40
|
+
def stringify(
|
|
41
|
+
self,
|
|
42
|
+
params: Params,
|
|
43
|
+
*,
|
|
44
|
+
array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
|
|
45
|
+
nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
|
|
46
|
+
) -> str:
|
|
47
|
+
return urlencode(
|
|
48
|
+
self.stringify_items(
|
|
49
|
+
params,
|
|
50
|
+
array_format=array_format,
|
|
51
|
+
nested_format=nested_format,
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def stringify_items(
|
|
56
|
+
self,
|
|
57
|
+
params: Params,
|
|
58
|
+
*,
|
|
59
|
+
array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
|
|
60
|
+
nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
|
|
61
|
+
) -> list[tuple[str, str]]:
|
|
62
|
+
opts = Options(
|
|
63
|
+
qs=self,
|
|
64
|
+
array_format=array_format,
|
|
65
|
+
nested_format=nested_format,
|
|
66
|
+
)
|
|
67
|
+
return flatten([self._stringify_item(key, value, opts) for key, value in params.items()])
|
|
68
|
+
|
|
69
|
+
def _stringify_item(
|
|
70
|
+
self,
|
|
71
|
+
key: str,
|
|
72
|
+
value: Data,
|
|
73
|
+
opts: Options,
|
|
74
|
+
) -> list[tuple[str, str]]:
|
|
75
|
+
if isinstance(value, Mapping):
|
|
76
|
+
items: list[tuple[str, str]] = []
|
|
77
|
+
nested_format = opts.nested_format
|
|
78
|
+
for subkey, subvalue in value.items():
|
|
79
|
+
items.extend(
|
|
80
|
+
self._stringify_item(
|
|
81
|
+
# TODO: error if unknown format
|
|
82
|
+
f"{key}.{subkey}" if nested_format == "dots" else f"{key}[{subkey}]",
|
|
83
|
+
subvalue,
|
|
84
|
+
opts,
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
return items
|
|
88
|
+
|
|
89
|
+
if isinstance(value, (list, tuple)):
|
|
90
|
+
array_format = opts.array_format
|
|
91
|
+
if array_format == "comma":
|
|
92
|
+
return [
|
|
93
|
+
(
|
|
94
|
+
key,
|
|
95
|
+
",".join(self._primitive_value_to_str(item) for item in value if item is not None),
|
|
96
|
+
),
|
|
97
|
+
]
|
|
98
|
+
elif array_format == "repeat":
|
|
99
|
+
items = []
|
|
100
|
+
for item in value:
|
|
101
|
+
items.extend(self._stringify_item(key, item, opts))
|
|
102
|
+
return items
|
|
103
|
+
elif array_format == "indices":
|
|
104
|
+
raise NotImplementedError("The array indices format is not supported yet")
|
|
105
|
+
elif array_format == "brackets":
|
|
106
|
+
items = []
|
|
107
|
+
key = key + "[]"
|
|
108
|
+
for item in value:
|
|
109
|
+
items.extend(self._stringify_item(key, item, opts))
|
|
110
|
+
return items
|
|
111
|
+
else:
|
|
112
|
+
raise NotImplementedError(
|
|
113
|
+
f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
serialised = self._primitive_value_to_str(value)
|
|
117
|
+
if not serialised:
|
|
118
|
+
return []
|
|
119
|
+
return [(key, serialised)]
|
|
120
|
+
|
|
121
|
+
def _primitive_value_to_str(self, value: PrimitiveData) -> str:
|
|
122
|
+
# copied from httpx
|
|
123
|
+
if value is True:
|
|
124
|
+
return "true"
|
|
125
|
+
elif value is False:
|
|
126
|
+
return "false"
|
|
127
|
+
elif value is None:
|
|
128
|
+
return ""
|
|
129
|
+
return str(value)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
_qs = Querystring()
|
|
133
|
+
parse = _qs.parse
|
|
134
|
+
stringify = _qs.stringify
|
|
135
|
+
stringify_items = _qs.stringify_items
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class Options:
|
|
139
|
+
array_format: ArrayFormat
|
|
140
|
+
nested_format: NestedFormat
|
|
141
|
+
|
|
142
|
+
def __init__(
|
|
143
|
+
self,
|
|
144
|
+
qs: Querystring = _qs,
|
|
145
|
+
*,
|
|
146
|
+
array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
|
|
147
|
+
nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
|
|
148
|
+
) -> None:
|
|
149
|
+
self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
|
|
150
|
+
self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
import anyio
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ._client import StudyfetchSDK, AsyncStudyfetchSDK
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SyncAPIResource:
|
|
15
|
+
_client: StudyfetchSDK
|
|
16
|
+
|
|
17
|
+
def __init__(self, client: StudyfetchSDK) -> None:
|
|
18
|
+
self._client = client
|
|
19
|
+
self._get = client.get
|
|
20
|
+
self._post = client.post
|
|
21
|
+
self._patch = client.patch
|
|
22
|
+
self._put = client.put
|
|
23
|
+
self._delete = client.delete
|
|
24
|
+
self._get_api_list = client.get_api_list
|
|
25
|
+
|
|
26
|
+
def _sleep(self, seconds: float) -> None:
|
|
27
|
+
time.sleep(seconds)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AsyncAPIResource:
|
|
31
|
+
_client: AsyncStudyfetchSDK
|
|
32
|
+
|
|
33
|
+
def __init__(self, client: AsyncStudyfetchSDK) -> None:
|
|
34
|
+
self._client = client
|
|
35
|
+
self._get = client.get
|
|
36
|
+
self._post = client.post
|
|
37
|
+
self._patch = client.patch
|
|
38
|
+
self._put = client.put
|
|
39
|
+
self._delete = client.delete
|
|
40
|
+
self._get_api_list = client.get_api_list
|
|
41
|
+
|
|
42
|
+
async def _sleep(self, seconds: float) -> None:
|
|
43
|
+
await anyio.sleep(seconds)
|