isaacus 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.
- isaacus/__init__.py +84 -0
- isaacus/_base_client.py +1969 -0
- isaacus/_client.py +397 -0
- isaacus/_compat.py +219 -0
- isaacus/_constants.py +14 -0
- isaacus/_exceptions.py +108 -0
- isaacus/_files.py +123 -0
- isaacus/_models.py +801 -0
- isaacus/_qs.py +150 -0
- isaacus/_resource.py +43 -0
- isaacus/_response.py +830 -0
- isaacus/_streaming.py +333 -0
- isaacus/_types.py +217 -0
- isaacus/_utils/__init__.py +57 -0
- isaacus/_utils/_logs.py +25 -0
- isaacus/_utils/_proxy.py +62 -0
- isaacus/_utils/_reflection.py +42 -0
- isaacus/_utils/_streams.py +12 -0
- isaacus/_utils/_sync.py +86 -0
- isaacus/_utils/_transform.py +402 -0
- isaacus/_utils/_typing.py +149 -0
- isaacus/_utils/_utils.py +414 -0
- isaacus/_version.py +4 -0
- isaacus/lib/.keep +4 -0
- isaacus/py.typed +0 -0
- isaacus/resources/__init__.py +19 -0
- isaacus/resources/classifications/__init__.py +33 -0
- isaacus/resources/classifications/classifications.py +102 -0
- isaacus/resources/classifications/universal.py +263 -0
- isaacus/types/__init__.py +3 -0
- isaacus/types/classifications/__init__.py +6 -0
- isaacus/types/classifications/universal_classification.py +55 -0
- isaacus/types/classifications/universal_create_params.py +64 -0
- isaacus-0.1.0a1.dist-info/METADATA +391 -0
- isaacus-0.1.0a1.dist-info/RECORD +37 -0
- isaacus-0.1.0a1.dist-info/WHEEL +4 -0
- isaacus-0.1.0a1.dist-info/licenses/LICENSE +201 -0
isaacus/_utils/_utils.py
ADDED
@@ -0,0 +1,414 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import os
|
4
|
+
import re
|
5
|
+
import inspect
|
6
|
+
import functools
|
7
|
+
from typing import (
|
8
|
+
Any,
|
9
|
+
Tuple,
|
10
|
+
Mapping,
|
11
|
+
TypeVar,
|
12
|
+
Callable,
|
13
|
+
Iterable,
|
14
|
+
Sequence,
|
15
|
+
cast,
|
16
|
+
overload,
|
17
|
+
)
|
18
|
+
from pathlib import Path
|
19
|
+
from datetime import date, datetime
|
20
|
+
from typing_extensions import TypeGuard
|
21
|
+
|
22
|
+
import sniffio
|
23
|
+
|
24
|
+
from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
|
25
|
+
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
|
26
|
+
|
27
|
+
_T = TypeVar("_T")
|
28
|
+
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
|
29
|
+
_MappingT = TypeVar("_MappingT", bound=Mapping[str, object])
|
30
|
+
_SequenceT = TypeVar("_SequenceT", bound=Sequence[object])
|
31
|
+
CallableT = TypeVar("CallableT", bound=Callable[..., Any])
|
32
|
+
|
33
|
+
|
34
|
+
def flatten(t: Iterable[Iterable[_T]]) -> list[_T]:
|
35
|
+
return [item for sublist in t for item in sublist]
|
36
|
+
|
37
|
+
|
38
|
+
def extract_files(
|
39
|
+
# TODO: this needs to take Dict but variance issues.....
|
40
|
+
# create protocol type ?
|
41
|
+
query: Mapping[str, object],
|
42
|
+
*,
|
43
|
+
paths: Sequence[Sequence[str]],
|
44
|
+
) -> list[tuple[str, FileTypes]]:
|
45
|
+
"""Recursively extract files from the given dictionary based on specified paths.
|
46
|
+
|
47
|
+
A path may look like this ['foo', 'files', '<array>', 'data'].
|
48
|
+
|
49
|
+
Note: this mutates the given dictionary.
|
50
|
+
"""
|
51
|
+
files: list[tuple[str, FileTypes]] = []
|
52
|
+
for path in paths:
|
53
|
+
files.extend(_extract_items(query, path, index=0, flattened_key=None))
|
54
|
+
return files
|
55
|
+
|
56
|
+
|
57
|
+
def _extract_items(
|
58
|
+
obj: object,
|
59
|
+
path: Sequence[str],
|
60
|
+
*,
|
61
|
+
index: int,
|
62
|
+
flattened_key: str | None,
|
63
|
+
) -> list[tuple[str, FileTypes]]:
|
64
|
+
try:
|
65
|
+
key = path[index]
|
66
|
+
except IndexError:
|
67
|
+
if isinstance(obj, NotGiven):
|
68
|
+
# no value was provided - we can safely ignore
|
69
|
+
return []
|
70
|
+
|
71
|
+
# cyclical import
|
72
|
+
from .._files import assert_is_file_content
|
73
|
+
|
74
|
+
# We have exhausted the path, return the entry we found.
|
75
|
+
assert_is_file_content(obj, key=flattened_key)
|
76
|
+
assert flattened_key is not None
|
77
|
+
return [(flattened_key, cast(FileTypes, obj))]
|
78
|
+
|
79
|
+
index += 1
|
80
|
+
if is_dict(obj):
|
81
|
+
try:
|
82
|
+
# We are at the last entry in the path so we must remove the field
|
83
|
+
if (len(path)) == index:
|
84
|
+
item = obj.pop(key)
|
85
|
+
else:
|
86
|
+
item = obj[key]
|
87
|
+
except KeyError:
|
88
|
+
# Key was not present in the dictionary, this is not indicative of an error
|
89
|
+
# as the given path may not point to a required field. We also do not want
|
90
|
+
# to enforce required fields as the API may differ from the spec in some cases.
|
91
|
+
return []
|
92
|
+
if flattened_key is None:
|
93
|
+
flattened_key = key
|
94
|
+
else:
|
95
|
+
flattened_key += f"[{key}]"
|
96
|
+
return _extract_items(
|
97
|
+
item,
|
98
|
+
path,
|
99
|
+
index=index,
|
100
|
+
flattened_key=flattened_key,
|
101
|
+
)
|
102
|
+
elif is_list(obj):
|
103
|
+
if key != "<array>":
|
104
|
+
return []
|
105
|
+
|
106
|
+
return flatten(
|
107
|
+
[
|
108
|
+
_extract_items(
|
109
|
+
item,
|
110
|
+
path,
|
111
|
+
index=index,
|
112
|
+
flattened_key=flattened_key + "[]" if flattened_key is not None else "[]",
|
113
|
+
)
|
114
|
+
for item in obj
|
115
|
+
]
|
116
|
+
)
|
117
|
+
|
118
|
+
# Something unexpected was passed, just ignore it.
|
119
|
+
return []
|
120
|
+
|
121
|
+
|
122
|
+
def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
|
123
|
+
return not isinstance(obj, NotGiven)
|
124
|
+
|
125
|
+
|
126
|
+
# Type safe methods for narrowing types with TypeVars.
|
127
|
+
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
128
|
+
# however this cause Pyright to rightfully report errors. As we know we don't
|
129
|
+
# care about the contained types we can safely use `object` in it's place.
|
130
|
+
#
|
131
|
+
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
132
|
+
# `is_*` is for when you're dealing with an unknown input
|
133
|
+
# `is_*_t` is for when you're narrowing a known union type to a specific subset
|
134
|
+
|
135
|
+
|
136
|
+
def is_tuple(obj: object) -> TypeGuard[tuple[object, ...]]:
|
137
|
+
return isinstance(obj, tuple)
|
138
|
+
|
139
|
+
|
140
|
+
def is_tuple_t(obj: _TupleT | object) -> TypeGuard[_TupleT]:
|
141
|
+
return isinstance(obj, tuple)
|
142
|
+
|
143
|
+
|
144
|
+
def is_sequence(obj: object) -> TypeGuard[Sequence[object]]:
|
145
|
+
return isinstance(obj, Sequence)
|
146
|
+
|
147
|
+
|
148
|
+
def is_sequence_t(obj: _SequenceT | object) -> TypeGuard[_SequenceT]:
|
149
|
+
return isinstance(obj, Sequence)
|
150
|
+
|
151
|
+
|
152
|
+
def is_mapping(obj: object) -> TypeGuard[Mapping[str, object]]:
|
153
|
+
return isinstance(obj, Mapping)
|
154
|
+
|
155
|
+
|
156
|
+
def is_mapping_t(obj: _MappingT | object) -> TypeGuard[_MappingT]:
|
157
|
+
return isinstance(obj, Mapping)
|
158
|
+
|
159
|
+
|
160
|
+
def is_dict(obj: object) -> TypeGuard[dict[object, object]]:
|
161
|
+
return isinstance(obj, dict)
|
162
|
+
|
163
|
+
|
164
|
+
def is_list(obj: object) -> TypeGuard[list[object]]:
|
165
|
+
return isinstance(obj, list)
|
166
|
+
|
167
|
+
|
168
|
+
def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
|
169
|
+
return isinstance(obj, Iterable)
|
170
|
+
|
171
|
+
|
172
|
+
def deepcopy_minimal(item: _T) -> _T:
|
173
|
+
"""Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
|
174
|
+
|
175
|
+
- mappings, e.g. `dict`
|
176
|
+
- list
|
177
|
+
|
178
|
+
This is done for performance reasons.
|
179
|
+
"""
|
180
|
+
if is_mapping(item):
|
181
|
+
return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
|
182
|
+
if is_list(item):
|
183
|
+
return cast(_T, [deepcopy_minimal(entry) for entry in item])
|
184
|
+
return item
|
185
|
+
|
186
|
+
|
187
|
+
# copied from https://github.com/Rapptz/RoboDanny
|
188
|
+
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
|
189
|
+
size = len(seq)
|
190
|
+
if size == 0:
|
191
|
+
return ""
|
192
|
+
|
193
|
+
if size == 1:
|
194
|
+
return seq[0]
|
195
|
+
|
196
|
+
if size == 2:
|
197
|
+
return f"{seq[0]} {final} {seq[1]}"
|
198
|
+
|
199
|
+
return delim.join(seq[:-1]) + f" {final} {seq[-1]}"
|
200
|
+
|
201
|
+
|
202
|
+
def quote(string: str) -> str:
|
203
|
+
"""Add single quotation marks around the given string. Does *not* do any escaping."""
|
204
|
+
return f"'{string}'"
|
205
|
+
|
206
|
+
|
207
|
+
def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]:
|
208
|
+
"""Decorator to enforce a given set of arguments or variants of arguments are passed to the decorated function.
|
209
|
+
|
210
|
+
Useful for enforcing runtime validation of overloaded functions.
|
211
|
+
|
212
|
+
Example usage:
|
213
|
+
```py
|
214
|
+
@overload
|
215
|
+
def foo(*, a: str) -> str: ...
|
216
|
+
|
217
|
+
|
218
|
+
@overload
|
219
|
+
def foo(*, b: bool) -> str: ...
|
220
|
+
|
221
|
+
|
222
|
+
# This enforces the same constraints that a static type checker would
|
223
|
+
# i.e. that either a or b must be passed to the function
|
224
|
+
@required_args(["a"], ["b"])
|
225
|
+
def foo(*, a: str | None = None, b: bool | None = None) -> str: ...
|
226
|
+
```
|
227
|
+
"""
|
228
|
+
|
229
|
+
def inner(func: CallableT) -> CallableT:
|
230
|
+
params = inspect.signature(func).parameters
|
231
|
+
positional = [
|
232
|
+
name
|
233
|
+
for name, param in params.items()
|
234
|
+
if param.kind
|
235
|
+
in {
|
236
|
+
param.POSITIONAL_ONLY,
|
237
|
+
param.POSITIONAL_OR_KEYWORD,
|
238
|
+
}
|
239
|
+
]
|
240
|
+
|
241
|
+
@functools.wraps(func)
|
242
|
+
def wrapper(*args: object, **kwargs: object) -> object:
|
243
|
+
given_params: set[str] = set()
|
244
|
+
for i, _ in enumerate(args):
|
245
|
+
try:
|
246
|
+
given_params.add(positional[i])
|
247
|
+
except IndexError:
|
248
|
+
raise TypeError(
|
249
|
+
f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given"
|
250
|
+
) from None
|
251
|
+
|
252
|
+
for key in kwargs.keys():
|
253
|
+
given_params.add(key)
|
254
|
+
|
255
|
+
for variant in variants:
|
256
|
+
matches = all((param in given_params for param in variant))
|
257
|
+
if matches:
|
258
|
+
break
|
259
|
+
else: # no break
|
260
|
+
if len(variants) > 1:
|
261
|
+
variations = human_join(
|
262
|
+
["(" + human_join([quote(arg) for arg in variant], final="and") + ")" for variant in variants]
|
263
|
+
)
|
264
|
+
msg = f"Missing required arguments; Expected either {variations} arguments to be given"
|
265
|
+
else:
|
266
|
+
assert len(variants) > 0
|
267
|
+
|
268
|
+
# TODO: this error message is not deterministic
|
269
|
+
missing = list(set(variants[0]) - given_params)
|
270
|
+
if len(missing) > 1:
|
271
|
+
msg = f"Missing required arguments: {human_join([quote(arg) for arg in missing])}"
|
272
|
+
else:
|
273
|
+
msg = f"Missing required argument: {quote(missing[0])}"
|
274
|
+
raise TypeError(msg)
|
275
|
+
return func(*args, **kwargs)
|
276
|
+
|
277
|
+
return wrapper # type: ignore
|
278
|
+
|
279
|
+
return inner
|
280
|
+
|
281
|
+
|
282
|
+
_K = TypeVar("_K")
|
283
|
+
_V = TypeVar("_V")
|
284
|
+
|
285
|
+
|
286
|
+
@overload
|
287
|
+
def strip_not_given(obj: None) -> None: ...
|
288
|
+
|
289
|
+
|
290
|
+
@overload
|
291
|
+
def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ...
|
292
|
+
|
293
|
+
|
294
|
+
@overload
|
295
|
+
def strip_not_given(obj: object) -> object: ...
|
296
|
+
|
297
|
+
|
298
|
+
def strip_not_given(obj: object | None) -> object:
|
299
|
+
"""Remove all top-level keys where their values are instances of `NotGiven`"""
|
300
|
+
if obj is None:
|
301
|
+
return None
|
302
|
+
|
303
|
+
if not is_mapping(obj):
|
304
|
+
return obj
|
305
|
+
|
306
|
+
return {key: value for key, value in obj.items() if not isinstance(value, NotGiven)}
|
307
|
+
|
308
|
+
|
309
|
+
def coerce_integer(val: str) -> int:
|
310
|
+
return int(val, base=10)
|
311
|
+
|
312
|
+
|
313
|
+
def coerce_float(val: str) -> float:
|
314
|
+
return float(val)
|
315
|
+
|
316
|
+
|
317
|
+
def coerce_boolean(val: str) -> bool:
|
318
|
+
return val == "true" or val == "1" or val == "on"
|
319
|
+
|
320
|
+
|
321
|
+
def maybe_coerce_integer(val: str | None) -> int | None:
|
322
|
+
if val is None:
|
323
|
+
return None
|
324
|
+
return coerce_integer(val)
|
325
|
+
|
326
|
+
|
327
|
+
def maybe_coerce_float(val: str | None) -> float | None:
|
328
|
+
if val is None:
|
329
|
+
return None
|
330
|
+
return coerce_float(val)
|
331
|
+
|
332
|
+
|
333
|
+
def maybe_coerce_boolean(val: str | None) -> bool | None:
|
334
|
+
if val is None:
|
335
|
+
return None
|
336
|
+
return coerce_boolean(val)
|
337
|
+
|
338
|
+
|
339
|
+
def removeprefix(string: str, prefix: str) -> str:
|
340
|
+
"""Remove a prefix from a string.
|
341
|
+
|
342
|
+
Backport of `str.removeprefix` for Python < 3.9
|
343
|
+
"""
|
344
|
+
if string.startswith(prefix):
|
345
|
+
return string[len(prefix) :]
|
346
|
+
return string
|
347
|
+
|
348
|
+
|
349
|
+
def removesuffix(string: str, suffix: str) -> str:
|
350
|
+
"""Remove a suffix from a string.
|
351
|
+
|
352
|
+
Backport of `str.removesuffix` for Python < 3.9
|
353
|
+
"""
|
354
|
+
if string.endswith(suffix):
|
355
|
+
return string[: -len(suffix)]
|
356
|
+
return string
|
357
|
+
|
358
|
+
|
359
|
+
def file_from_path(path: str) -> FileTypes:
|
360
|
+
contents = Path(path).read_bytes()
|
361
|
+
file_name = os.path.basename(path)
|
362
|
+
return (file_name, contents)
|
363
|
+
|
364
|
+
|
365
|
+
def get_required_header(headers: HeadersLike, header: str) -> str:
|
366
|
+
lower_header = header.lower()
|
367
|
+
if is_mapping_t(headers):
|
368
|
+
# mypy doesn't understand the type narrowing here
|
369
|
+
for k, v in headers.items(): # type: ignore
|
370
|
+
if k.lower() == lower_header and isinstance(v, str):
|
371
|
+
return v
|
372
|
+
|
373
|
+
# to deal with the case where the header looks like Stainless-Event-Id
|
374
|
+
intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())
|
375
|
+
|
376
|
+
for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
|
377
|
+
value = headers.get(normalized_header)
|
378
|
+
if value:
|
379
|
+
return value
|
380
|
+
|
381
|
+
raise ValueError(f"Could not find {header} header")
|
382
|
+
|
383
|
+
|
384
|
+
def get_async_library() -> str:
|
385
|
+
try:
|
386
|
+
return sniffio.current_async_library()
|
387
|
+
except Exception:
|
388
|
+
return "false"
|
389
|
+
|
390
|
+
|
391
|
+
def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]:
|
392
|
+
"""A version of functools.lru_cache that retains the type signature
|
393
|
+
for the wrapped function arguments.
|
394
|
+
"""
|
395
|
+
wrapper = functools.lru_cache( # noqa: TID251
|
396
|
+
maxsize=maxsize,
|
397
|
+
)
|
398
|
+
return cast(Any, wrapper) # type: ignore[no-any-return]
|
399
|
+
|
400
|
+
|
401
|
+
def json_safe(data: object) -> object:
|
402
|
+
"""Translates a mapping / sequence recursively in the same fashion
|
403
|
+
as `pydantic` v2's `model_dump(mode="json")`.
|
404
|
+
"""
|
405
|
+
if is_mapping(data):
|
406
|
+
return {json_safe(key): json_safe(value) for key, value in data.items()}
|
407
|
+
|
408
|
+
if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)):
|
409
|
+
return [json_safe(item) for item in data]
|
410
|
+
|
411
|
+
if isinstance(data, (datetime, date)):
|
412
|
+
return data.isoformat()
|
413
|
+
|
414
|
+
return data
|
isaacus/_version.py
ADDED
isaacus/lib/.keep
ADDED
isaacus/py.typed
ADDED
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from .classifications import (
|
4
|
+
ClassificationsResource,
|
5
|
+
AsyncClassificationsResource,
|
6
|
+
ClassificationsResourceWithRawResponse,
|
7
|
+
AsyncClassificationsResourceWithRawResponse,
|
8
|
+
ClassificationsResourceWithStreamingResponse,
|
9
|
+
AsyncClassificationsResourceWithStreamingResponse,
|
10
|
+
)
|
11
|
+
|
12
|
+
__all__ = [
|
13
|
+
"ClassificationsResource",
|
14
|
+
"AsyncClassificationsResource",
|
15
|
+
"ClassificationsResourceWithRawResponse",
|
16
|
+
"AsyncClassificationsResourceWithRawResponse",
|
17
|
+
"ClassificationsResourceWithStreamingResponse",
|
18
|
+
"AsyncClassificationsResourceWithStreamingResponse",
|
19
|
+
]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from .universal import (
|
4
|
+
UniversalResource,
|
5
|
+
AsyncUniversalResource,
|
6
|
+
UniversalResourceWithRawResponse,
|
7
|
+
AsyncUniversalResourceWithRawResponse,
|
8
|
+
UniversalResourceWithStreamingResponse,
|
9
|
+
AsyncUniversalResourceWithStreamingResponse,
|
10
|
+
)
|
11
|
+
from .classifications import (
|
12
|
+
ClassificationsResource,
|
13
|
+
AsyncClassificationsResource,
|
14
|
+
ClassificationsResourceWithRawResponse,
|
15
|
+
AsyncClassificationsResourceWithRawResponse,
|
16
|
+
ClassificationsResourceWithStreamingResponse,
|
17
|
+
AsyncClassificationsResourceWithStreamingResponse,
|
18
|
+
)
|
19
|
+
|
20
|
+
__all__ = [
|
21
|
+
"UniversalResource",
|
22
|
+
"AsyncUniversalResource",
|
23
|
+
"UniversalResourceWithRawResponse",
|
24
|
+
"AsyncUniversalResourceWithRawResponse",
|
25
|
+
"UniversalResourceWithStreamingResponse",
|
26
|
+
"AsyncUniversalResourceWithStreamingResponse",
|
27
|
+
"ClassificationsResource",
|
28
|
+
"AsyncClassificationsResource",
|
29
|
+
"ClassificationsResourceWithRawResponse",
|
30
|
+
"AsyncClassificationsResourceWithRawResponse",
|
31
|
+
"ClassificationsResourceWithStreamingResponse",
|
32
|
+
"AsyncClassificationsResourceWithStreamingResponse",
|
33
|
+
]
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from ..._compat import cached_property
|
6
|
+
from .universal import (
|
7
|
+
UniversalResource,
|
8
|
+
AsyncUniversalResource,
|
9
|
+
UniversalResourceWithRawResponse,
|
10
|
+
AsyncUniversalResourceWithRawResponse,
|
11
|
+
UniversalResourceWithStreamingResponse,
|
12
|
+
AsyncUniversalResourceWithStreamingResponse,
|
13
|
+
)
|
14
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
15
|
+
|
16
|
+
__all__ = ["ClassificationsResource", "AsyncClassificationsResource"]
|
17
|
+
|
18
|
+
|
19
|
+
class ClassificationsResource(SyncAPIResource):
|
20
|
+
@cached_property
|
21
|
+
def universal(self) -> UniversalResource:
|
22
|
+
return UniversalResource(self._client)
|
23
|
+
|
24
|
+
@cached_property
|
25
|
+
def with_raw_response(self) -> ClassificationsResourceWithRawResponse:
|
26
|
+
"""
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
28
|
+
the raw response object instead of the parsed content.
|
29
|
+
|
30
|
+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
|
31
|
+
"""
|
32
|
+
return ClassificationsResourceWithRawResponse(self)
|
33
|
+
|
34
|
+
@cached_property
|
35
|
+
def with_streaming_response(self) -> ClassificationsResourceWithStreamingResponse:
|
36
|
+
"""
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
38
|
+
|
39
|
+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response
|
40
|
+
"""
|
41
|
+
return ClassificationsResourceWithStreamingResponse(self)
|
42
|
+
|
43
|
+
|
44
|
+
class AsyncClassificationsResource(AsyncAPIResource):
|
45
|
+
@cached_property
|
46
|
+
def universal(self) -> AsyncUniversalResource:
|
47
|
+
return AsyncUniversalResource(self._client)
|
48
|
+
|
49
|
+
@cached_property
|
50
|
+
def with_raw_response(self) -> AsyncClassificationsResourceWithRawResponse:
|
51
|
+
"""
|
52
|
+
This property can be used as a prefix for any HTTP method call to return
|
53
|
+
the raw response object instead of the parsed content.
|
54
|
+
|
55
|
+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
|
56
|
+
"""
|
57
|
+
return AsyncClassificationsResourceWithRawResponse(self)
|
58
|
+
|
59
|
+
@cached_property
|
60
|
+
def with_streaming_response(self) -> AsyncClassificationsResourceWithStreamingResponse:
|
61
|
+
"""
|
62
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
63
|
+
|
64
|
+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response
|
65
|
+
"""
|
66
|
+
return AsyncClassificationsResourceWithStreamingResponse(self)
|
67
|
+
|
68
|
+
|
69
|
+
class ClassificationsResourceWithRawResponse:
|
70
|
+
def __init__(self, classifications: ClassificationsResource) -> None:
|
71
|
+
self._classifications = classifications
|
72
|
+
|
73
|
+
@cached_property
|
74
|
+
def universal(self) -> UniversalResourceWithRawResponse:
|
75
|
+
return UniversalResourceWithRawResponse(self._classifications.universal)
|
76
|
+
|
77
|
+
|
78
|
+
class AsyncClassificationsResourceWithRawResponse:
|
79
|
+
def __init__(self, classifications: AsyncClassificationsResource) -> None:
|
80
|
+
self._classifications = classifications
|
81
|
+
|
82
|
+
@cached_property
|
83
|
+
def universal(self) -> AsyncUniversalResourceWithRawResponse:
|
84
|
+
return AsyncUniversalResourceWithRawResponse(self._classifications.universal)
|
85
|
+
|
86
|
+
|
87
|
+
class ClassificationsResourceWithStreamingResponse:
|
88
|
+
def __init__(self, classifications: ClassificationsResource) -> None:
|
89
|
+
self._classifications = classifications
|
90
|
+
|
91
|
+
@cached_property
|
92
|
+
def universal(self) -> UniversalResourceWithStreamingResponse:
|
93
|
+
return UniversalResourceWithStreamingResponse(self._classifications.universal)
|
94
|
+
|
95
|
+
|
96
|
+
class AsyncClassificationsResourceWithStreamingResponse:
|
97
|
+
def __init__(self, classifications: AsyncClassificationsResource) -> None:
|
98
|
+
self._classifications = classifications
|
99
|
+
|
100
|
+
@cached_property
|
101
|
+
def universal(self) -> AsyncUniversalResourceWithStreamingResponse:
|
102
|
+
return AsyncUniversalResourceWithStreamingResponse(self._classifications.universal)
|