frameio 0.0.23__py3-none-any.whl → 0.0.24__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.
Potentially problematic release.
This version of frameio might be problematic. Click here for more details.
- frameio/account_permissions/client.py +2 -2
- frameio/account_permissions/raw_client.py +17 -17
- frameio/accounts/client.py +2 -2
- frameio/accounts/raw_client.py +17 -17
- frameio/comments/client.py +10 -10
- frameio/comments/raw_client.py +79 -79
- frameio/comments/types/create_comment_params_data.py +2 -2
- frameio/comments/types/update_comment_params_data.py +2 -2
- frameio/core/__init__.py +7 -0
- frameio/core/client_wrapper.py +2 -2
- frameio/core/unchecked_base_model.py +341 -0
- frameio/files/client.py +20 -20
- frameio/files/raw_client.py +159 -159
- frameio/files/types/file_copy_params_data.py +2 -2
- frameio/files/types/file_create_local_upload_params_data.py +2 -2
- frameio/files/types/file_create_params_data.py +2 -2
- frameio/files/types/file_create_remote_upload_params_data.py +2 -2
- frameio/files/types/file_move_params_data.py +2 -2
- frameio/files/types/file_update_params_data.py +2 -2
- frameio/folders/client.py +10 -10
- frameio/folders/raw_client.py +121 -121
- frameio/folders/types/folder_copy_params_data.py +2 -2
- frameio/folders/types/folder_create_params_data.py +2 -2
- frameio/folders/types/folder_move_params_data.py +2 -2
- frameio/folders/types/folder_update_params_data.py +2 -2
- frameio/metadata/client.py +16 -16
- frameio/metadata/raw_client.py +31 -31
- frameio/metadata/types/bulk_update_metadata_params_data.py +2 -2
- frameio/metadata/types/bulk_update_metadata_params_data_values_item.py +2 -2
- frameio/metadata_fields/client.py +8 -8
- frameio/metadata_fields/raw_client.py +63 -63
- frameio/metadata_fields/types/create_field_definition_params_data.py +26 -22
- frameio/metadata_fields/types/update_field_definition_params_data.py +26 -22
- frameio/project_permissions/client.py +6 -6
- frameio/project_permissions/raw_client.py +47 -47
- frameio/projects/client.py +10 -10
- frameio/projects/raw_client.py +79 -79
- frameio/shares/client.py +30 -30
- frameio/shares/raw_client.py +155 -155
- frameio/shares/types/add_asset_params_data.py +2 -2
- frameio/shares/types/add_reviewers_to_share_params_data.py +2 -2
- frameio/shares/types/add_reviewers_to_share_params_data_reviewers.py +2 -2
- frameio/shares/types/create_share_params_data.py +4 -3
- frameio/shares/types/remove_reviewer_params_data.py +2 -2
- frameio/shares/types/remove_reviewer_params_data_reviewers.py +2 -2
- frameio/shares/types/update_share_params_data.py +2 -2
- frameio/types/account.py +2 -2
- frameio/types/account_user_role.py +2 -2
- frameio/types/account_user_roles_response.py +2 -2
- frameio/types/accounts_response.py +2 -2
- frameio/types/add_asset_response.py +2 -2
- frameio/types/asset_common.py +2 -2
- frameio/types/asset_common_with_includes.py +2 -2
- frameio/types/asset_share_params.py +2 -2
- frameio/types/asset_with_includes.py +9 -5
- frameio/types/assets_with_includes_response.py +2 -2
- frameio/types/bad_request.py +2 -2
- frameio/types/bad_request_errors_item.py +2 -2
- frameio/types/bad_request_errors_item_source.py +2 -2
- frameio/types/comment.py +2 -2
- frameio/types/comment_response.py +2 -2
- frameio/types/comment_with_includes_response.py +2 -2
- frameio/types/comments_with_includes_response.py +2 -2
- frameio/types/date_definition.py +2 -2
- frameio/types/date_definition_field_configuration.py +2 -2
- frameio/types/date_definition_params.py +2 -2
- frameio/types/date_definition_params_field_configuration.py +2 -2
- frameio/types/field_definition.py +26 -22
- frameio/types/field_definition_response.py +2 -2
- frameio/types/field_definition_with_includes.py +26 -22
- frameio/types/field_definitions_with_includes_response.py +2 -2
- frameio/types/field_value_common.py +2 -2
- frameio/types/file.py +2 -2
- frameio/types/file_copy_response.py +2 -2
- frameio/types/file_remote_upload_response.py +2 -2
- frameio/types/file_response.py +2 -2
- frameio/types/file_upload_status.py +2 -2
- frameio/types/file_upload_status_response.py +2 -2
- frameio/types/file_with_includes_response.py +2 -2
- frameio/types/file_with_upload_urls_response.py +2 -2
- frameio/types/folder_copy_response.py +2 -2
- frameio/types/folder_response.py +2 -2
- frameio/types/folder_with_includes.py +2 -2
- frameio/types/folder_with_includes_response.py +2 -2
- frameio/types/folders_with_includes_response.py +2 -2
- frameio/types/forbidden.py +2 -2
- frameio/types/forbidden_errors_item.py +2 -2
- frameio/types/forbidden_errors_item_source.py +2 -2
- frameio/types/json_error_response.py +2 -2
- frameio/types/json_error_response_errors_item.py +2 -2
- frameio/types/json_error_response_errors_item_source.py +2 -2
- frameio/types/links.py +2 -2
- frameio/types/long_text_definition.py +2 -2
- frameio/types/long_text_definition_field_configuration.py +2 -2
- frameio/types/long_text_definition_params.py +2 -2
- frameio/types/media_link_common.py +2 -2
- frameio/types/media_links_collection.py +2 -2
- frameio/types/metadata_field.py +28 -24
- frameio/types/metadata_response.py +2 -2
- frameio/types/metadata_with_definition.py +2 -2
- frameio/types/not_found.py +2 -2
- frameio/types/not_found_errors_item.py +2 -2
- frameio/types/not_found_errors_item_source.py +2 -2
- frameio/types/number_definition.py +2 -2
- frameio/types/number_definition_field_configuration.py +2 -2
- frameio/types/number_definition_params.py +2 -2
- frameio/types/number_definition_params_field_configuration.py +2 -2
- frameio/types/profile.py +2 -2
- frameio/types/profile_response.py +2 -2
- frameio/types/project.py +2 -2
- frameio/types/project_params.py +2 -2
- frameio/types/project_params_data.py +2 -2
- frameio/types/project_response.py +2 -2
- frameio/types/project_with_includes_response.py +2 -2
- frameio/types/projects_with_includes_response.py +2 -2
- frameio/types/rating_definition.py +2 -2
- frameio/types/rating_definition_field_configuration.py +2 -2
- frameio/types/rating_definition_params.py +2 -2
- frameio/types/rating_definition_params_field_configuration.py +2 -2
- frameio/types/remove_asset_response.py +2 -2
- frameio/types/select_definition.py +2 -2
- frameio/types/select_definition_field_configuration.py +2 -2
- frameio/types/select_definition_field_configuration_options_item.py +2 -2
- frameio/types/select_definition_params.py +2 -2
- frameio/types/select_definition_params_field_configuration.py +2 -2
- frameio/types/select_definition_params_field_configuration_options_item.py +2 -2
- frameio/types/select_multi_definition.py +2 -2
- frameio/types/select_multi_definition_field_configuration.py +2 -2
- frameio/types/select_multi_definition_field_configuration_options_item.py +2 -2
- frameio/types/select_multi_definition_params.py +2 -2
- frameio/types/select_multi_definition_params_field_configuration.py +2 -2
- frameio/types/select_multi_definition_params_field_configuration_options_item.py +2 -2
- frameio/types/select_option.py +2 -2
- frameio/types/share.py +2 -2
- frameio/types/share_response.py +2 -2
- frameio/types/share_reviewers_response.py +2 -2
- frameio/types/shares_response.py +2 -2
- frameio/types/text_definition.py +2 -2
- frameio/types/text_definition_field_configuration.py +2 -2
- frameio/types/text_definition_params.py +2 -2
- frameio/types/toggle_definition.py +2 -2
- frameio/types/toggle_definition_field_configuration.py +2 -2
- frameio/types/toggle_definition_params.py +2 -2
- frameio/types/toggle_definition_params_field_configuration.py +2 -2
- frameio/types/too_many_requests.py +2 -2
- frameio/types/too_many_requests_errors_item.py +2 -2
- frameio/types/too_many_requests_errors_item_source.py +2 -2
- frameio/types/unauthorized.py +2 -2
- frameio/types/unauthorized_errors_item.py +2 -2
- frameio/types/unauthorized_errors_item_source.py +2 -2
- frameio/types/unprocessable_entity.py +2 -2
- frameio/types/unprocessable_entity_errors_item.py +2 -2
- frameio/types/unprocessable_entity_errors_item_source.py +2 -2
- frameio/types/update_date_definition_params.py +2 -2
- frameio/types/update_date_definition_params_field_configuration.py +2 -2
- frameio/types/update_long_text_definition_params.py +2 -2
- frameio/types/update_number_definition_params.py +2 -2
- frameio/types/update_number_definition_params_field_configuration.py +2 -2
- frameio/types/update_rating_definition_params.py +2 -2
- frameio/types/update_rating_definition_params_field_configuration.py +2 -2
- frameio/types/update_select_definition_params.py +2 -2
- frameio/types/update_select_definition_params_field_configuration.py +2 -2
- frameio/types/update_select_definition_params_field_configuration_options_item.py +2 -2
- frameio/types/update_select_multi_definition_params.py +2 -2
- frameio/types/update_select_multi_definition_params_field_configuration.py +2 -2
- frameio/types/update_select_multi_definition_params_field_configuration_options_item.py +2 -2
- frameio/types/update_text_definition_params.py +2 -2
- frameio/types/update_toggle_definition_params.py +2 -2
- frameio/types/update_toggle_definition_params_field_configuration.py +2 -2
- frameio/types/update_user_multi_definition_params.py +2 -2
- frameio/types/update_user_multi_definition_params_field_configuration.py +2 -2
- frameio/types/update_user_multi_definition_params_field_configuration_custom_members_item.py +2 -2
- frameio/types/update_user_roles_params.py +2 -2
- frameio/types/update_user_roles_params_data.py +2 -2
- frameio/types/update_user_roles_response.py +2 -2
- frameio/types/update_user_roles_response_data.py +2 -2
- frameio/types/update_user_single_definition_params.py +2 -2
- frameio/types/update_user_single_definition_params_field_configuration.py +2 -2
- frameio/types/update_user_single_definition_params_field_configuration_custom_members_item.py +2 -2
- frameio/types/upload_url.py +2 -2
- frameio/types/user.py +2 -2
- frameio/types/user_multi_definition.py +2 -2
- frameio/types/user_multi_definition_field_configuration.py +2 -2
- frameio/types/user_multi_definition_field_configuration_custom_members_item.py +2 -2
- frameio/types/user_multi_definition_params.py +2 -2
- frameio/types/user_multi_definition_params_field_configuration.py +2 -2
- frameio/types/user_multi_definition_params_field_configuration_custom_members_item.py +2 -2
- frameio/types/user_role.py +2 -2
- frameio/types/user_roles_response.py +2 -2
- frameio/types/user_single_definition.py +2 -2
- frameio/types/user_single_definition_field_configuration.py +2 -2
- frameio/types/user_single_definition_field_configuration_custom_members_item.py +2 -2
- frameio/types/user_single_definition_params.py +2 -2
- frameio/types/user_single_definition_params_field_configuration.py +2 -2
- frameio/types/user_single_definition_params_field_configuration_custom_members_item.py +2 -2
- frameio/types/user_value.py +2 -2
- frameio/types/version_stack.py +2 -2
- frameio/types/version_stack_copy_response.py +2 -2
- frameio/types/version_stack_response.py +2 -2
- frameio/types/version_stack_with_includes.py +2 -2
- frameio/types/version_stack_with_includes_response.py +2 -2
- frameio/types/version_stacks_with_includes_response.py +2 -2
- frameio/types/webhook.py +2 -2
- frameio/types/webhook_create_response.py +2 -2
- frameio/types/webhook_response.py +2 -2
- frameio/types/webhook_with_includes_response.py +2 -2
- frameio/types/webhooks_with_includes_response.py +2 -2
- frameio/types/workspace.py +2 -2
- frameio/types/workspace_params.py +2 -2
- frameio/types/workspace_params_data.py +2 -2
- frameio/types/workspace_response.py +2 -2
- frameio/types/workspace_with_includes_response.py +2 -2
- frameio/types/workspaces_with_includes_response.py +2 -2
- frameio/users/client.py +2 -2
- frameio/users/raw_client.py +17 -17
- frameio/version_stacks/client.py +10 -10
- frameio/version_stacks/raw_client.py +77 -77
- frameio/version_stacks/types/version_stack_copy_params_data.py +2 -2
- frameio/version_stacks/types/version_stack_create_params_data.py +3 -3
- frameio/version_stacks/types/version_stack_move_params_data.py +2 -2
- frameio/webhooks/client.py +8 -8
- frameio/webhooks/raw_client.py +77 -77
- frameio/webhooks/types/webhook_create_params_data.py +2 -2
- frameio/webhooks/types/webhook_update_params_data.py +2 -2
- frameio/workspace_permissions/client.py +6 -6
- frameio/workspace_permissions/raw_client.py +47 -47
- frameio/workspaces/client.py +10 -10
- frameio/workspaces/raw_client.py +79 -79
- {frameio-0.0.23.dist-info → frameio-0.0.24.dist-info}/METADATA +1 -1
- frameio-0.0.24.dist-info/RECORD +364 -0
- frameio-0.0.23.dist-info/RECORD +0 -363
- {frameio-0.0.23.dist-info → frameio-0.0.24.dist-info}/WHEEL +0 -0
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
import pydantic
|
|
6
|
-
from ...core.
|
|
6
|
+
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class CreateCommentParamsData(
|
|
9
|
+
class CreateCommentParamsData(UncheckedBaseModel):
|
|
10
10
|
page: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
11
|
"""
|
|
12
12
|
Document page. Only allowed when file type is a pdf document
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
import pydantic
|
|
6
|
-
from ...core.
|
|
6
|
+
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class UpdateCommentParamsData(
|
|
9
|
+
class UpdateCommentParamsData(UncheckedBaseModel):
|
|
10
10
|
page: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
11
|
"""
|
|
12
12
|
Document page. Only allowed when file type is a pdf document
|
frameio/core/__init__.py
CHANGED
|
@@ -27,6 +27,7 @@ if typing.TYPE_CHECKING:
|
|
|
27
27
|
from .remove_none_from_dict import remove_none_from_dict
|
|
28
28
|
from .request_options import RequestOptions
|
|
29
29
|
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
30
|
+
from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
|
|
30
31
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
31
32
|
"ApiError": ".api_error",
|
|
32
33
|
"AsyncClientWrapper": ".client_wrapper",
|
|
@@ -42,8 +43,11 @@ _dynamic_imports: typing.Dict[str, str] = {
|
|
|
42
43
|
"RequestOptions": ".request_options",
|
|
43
44
|
"SyncClientWrapper": ".client_wrapper",
|
|
44
45
|
"SyncPager": ".pagination",
|
|
46
|
+
"UncheckedBaseModel": ".unchecked_base_model",
|
|
47
|
+
"UnionMetadata": ".unchecked_base_model",
|
|
45
48
|
"UniversalBaseModel": ".pydantic_utilities",
|
|
46
49
|
"UniversalRootModel": ".pydantic_utilities",
|
|
50
|
+
"construct_type": ".unchecked_base_model",
|
|
47
51
|
"convert_and_respect_annotation_metadata": ".serialization",
|
|
48
52
|
"convert_file_dict_to_httpx_tuples": ".file",
|
|
49
53
|
"encode_query": ".query_encoder",
|
|
@@ -94,8 +98,11 @@ __all__ = [
|
|
|
94
98
|
"RequestOptions",
|
|
95
99
|
"SyncClientWrapper",
|
|
96
100
|
"SyncPager",
|
|
101
|
+
"UncheckedBaseModel",
|
|
102
|
+
"UnionMetadata",
|
|
97
103
|
"UniversalBaseModel",
|
|
98
104
|
"UniversalRootModel",
|
|
105
|
+
"construct_type",
|
|
99
106
|
"convert_and_respect_annotation_metadata",
|
|
100
107
|
"convert_file_dict_to_httpx_tuples",
|
|
101
108
|
"encode_query",
|
frameio/core/client_wrapper.py
CHANGED
|
@@ -22,10 +22,10 @@ class BaseClientWrapper:
|
|
|
22
22
|
|
|
23
23
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
24
|
headers: typing.Dict[str, str] = {
|
|
25
|
-
"User-Agent": "frameio/v0.0.
|
|
25
|
+
"User-Agent": "frameio/v0.0.24",
|
|
26
26
|
"X-Fern-Language": "Python",
|
|
27
27
|
"X-Fern-SDK-Name": "frameio",
|
|
28
|
-
"X-Fern-SDK-Version": "v0.0.
|
|
28
|
+
"X-Fern-SDK-Version": "v0.0.24",
|
|
29
29
|
**(self.get_custom_headers() or {}),
|
|
30
30
|
}
|
|
31
31
|
token = self._get_token()
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import inspect
|
|
5
|
+
import typing
|
|
6
|
+
import uuid
|
|
7
|
+
|
|
8
|
+
import pydantic
|
|
9
|
+
import typing_extensions
|
|
10
|
+
from .pydantic_utilities import (
|
|
11
|
+
IS_PYDANTIC_V2,
|
|
12
|
+
ModelField,
|
|
13
|
+
UniversalBaseModel,
|
|
14
|
+
get_args,
|
|
15
|
+
get_origin,
|
|
16
|
+
is_literal_type,
|
|
17
|
+
is_union,
|
|
18
|
+
parse_date,
|
|
19
|
+
parse_datetime,
|
|
20
|
+
parse_obj_as,
|
|
21
|
+
)
|
|
22
|
+
from .serialization import get_field_to_alias_mapping
|
|
23
|
+
from pydantic_core import PydanticUndefined
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class UnionMetadata:
|
|
27
|
+
discriminant: str
|
|
28
|
+
|
|
29
|
+
def __init__(self, *, discriminant: str) -> None:
|
|
30
|
+
self.discriminant = discriminant
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Model = typing.TypeVar("Model", bound=pydantic.BaseModel)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class UncheckedBaseModel(UniversalBaseModel):
|
|
37
|
+
if IS_PYDANTIC_V2:
|
|
38
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
|
|
39
|
+
else:
|
|
40
|
+
|
|
41
|
+
class Config:
|
|
42
|
+
extra = pydantic.Extra.allow
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def model_construct(
|
|
46
|
+
cls: typing.Type["Model"],
|
|
47
|
+
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
48
|
+
**values: typing.Any,
|
|
49
|
+
) -> "Model":
|
|
50
|
+
# Fallback construct function to the specified override below.
|
|
51
|
+
return cls.construct(_fields_set=_fields_set, **values)
|
|
52
|
+
|
|
53
|
+
# Allow construct to not validate model
|
|
54
|
+
# Implementation taken from: https://github.com/pydantic/pydantic/issues/1168#issuecomment-817742836
|
|
55
|
+
@classmethod
|
|
56
|
+
def construct(
|
|
57
|
+
cls: typing.Type["Model"],
|
|
58
|
+
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
59
|
+
**values: typing.Any,
|
|
60
|
+
) -> "Model":
|
|
61
|
+
m = cls.__new__(cls)
|
|
62
|
+
fields_values = {}
|
|
63
|
+
|
|
64
|
+
if _fields_set is None:
|
|
65
|
+
_fields_set = set(values.keys())
|
|
66
|
+
|
|
67
|
+
fields = _get_model_fields(cls)
|
|
68
|
+
populate_by_name = _get_is_populate_by_name(cls)
|
|
69
|
+
field_aliases = get_field_to_alias_mapping(cls)
|
|
70
|
+
|
|
71
|
+
for name, field in fields.items():
|
|
72
|
+
# Key here is only used to pull data from the values dict
|
|
73
|
+
# you should always use the NAME of the field to for field_values, etc.
|
|
74
|
+
# because that's how the object is constructed from a pydantic perspective
|
|
75
|
+
key = field.alias
|
|
76
|
+
if (key is None or field.alias == name) and name in field_aliases:
|
|
77
|
+
key = field_aliases[name]
|
|
78
|
+
|
|
79
|
+
if key is None or (key not in values and populate_by_name): # Added this to allow population by field name
|
|
80
|
+
key = name
|
|
81
|
+
|
|
82
|
+
if key in values:
|
|
83
|
+
if IS_PYDANTIC_V2:
|
|
84
|
+
type_ = field.annotation # type: ignore # Pydantic v2
|
|
85
|
+
else:
|
|
86
|
+
type_ = typing.cast(typing.Type, field.outer_type_) # type: ignore # Pydantic < v1.10.15
|
|
87
|
+
|
|
88
|
+
fields_values[name] = (
|
|
89
|
+
construct_type(object_=values[key], type_=type_) if type_ is not None else values[key]
|
|
90
|
+
)
|
|
91
|
+
_fields_set.add(name)
|
|
92
|
+
else:
|
|
93
|
+
default = _get_field_default(field)
|
|
94
|
+
fields_values[name] = default
|
|
95
|
+
|
|
96
|
+
# If the default values are non-null act like they've been set
|
|
97
|
+
# This effectively allows exclude_unset to work like exclude_none where
|
|
98
|
+
# the latter passes through intentionally set none values.
|
|
99
|
+
if default != None and default != PydanticUndefined:
|
|
100
|
+
_fields_set.add(name)
|
|
101
|
+
|
|
102
|
+
# Add extras back in
|
|
103
|
+
extras = {}
|
|
104
|
+
pydantic_alias_fields = [field.alias for field in fields.values()]
|
|
105
|
+
internal_alias_fields = list(field_aliases.values())
|
|
106
|
+
for key, value in values.items():
|
|
107
|
+
# If the key is not a field by name, nor an alias to a field, then it's extra
|
|
108
|
+
if (key not in pydantic_alias_fields and key not in internal_alias_fields) and key not in fields:
|
|
109
|
+
if IS_PYDANTIC_V2:
|
|
110
|
+
extras[key] = value
|
|
111
|
+
else:
|
|
112
|
+
_fields_set.add(key)
|
|
113
|
+
fields_values[key] = value
|
|
114
|
+
|
|
115
|
+
object.__setattr__(m, "__dict__", fields_values)
|
|
116
|
+
|
|
117
|
+
if IS_PYDANTIC_V2:
|
|
118
|
+
object.__setattr__(m, "__pydantic_private__", None)
|
|
119
|
+
object.__setattr__(m, "__pydantic_extra__", extras)
|
|
120
|
+
object.__setattr__(m, "__pydantic_fields_set__", _fields_set)
|
|
121
|
+
else:
|
|
122
|
+
object.__setattr__(m, "__fields_set__", _fields_set)
|
|
123
|
+
m._init_private_attributes() # type: ignore # Pydantic v1
|
|
124
|
+
return m
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _validate_collection_items_compatible(collection: typing.Any, target_type: typing.Type[typing.Any]) -> bool:
|
|
128
|
+
"""
|
|
129
|
+
Validate that all items in a collection are compatible with the target type.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
collection: The collection to validate (list, set, or dict values)
|
|
133
|
+
target_type: The target type to validate against
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
True if all items are compatible, False otherwise
|
|
137
|
+
"""
|
|
138
|
+
if inspect.isclass(target_type) and issubclass(target_type, pydantic.BaseModel):
|
|
139
|
+
for item in collection:
|
|
140
|
+
try:
|
|
141
|
+
# Try to validate the item against the target type
|
|
142
|
+
if isinstance(item, dict):
|
|
143
|
+
parse_obj_as(target_type, item)
|
|
144
|
+
else:
|
|
145
|
+
# If it's not a dict, it might already be the right type
|
|
146
|
+
if not isinstance(item, target_type):
|
|
147
|
+
return False
|
|
148
|
+
except Exception:
|
|
149
|
+
return False
|
|
150
|
+
return True
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _convert_undiscriminated_union_type(union_type: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
154
|
+
inner_types = get_args(union_type)
|
|
155
|
+
if typing.Any in inner_types:
|
|
156
|
+
return object_
|
|
157
|
+
|
|
158
|
+
for inner_type in inner_types:
|
|
159
|
+
# Handle lists of objects that need parsing
|
|
160
|
+
if get_origin(inner_type) is list and isinstance(object_, list):
|
|
161
|
+
list_inner_type = get_args(inner_type)[0]
|
|
162
|
+
try:
|
|
163
|
+
if inspect.isclass(list_inner_type) and issubclass(list_inner_type, pydantic.BaseModel):
|
|
164
|
+
# Validate that all items in the list are compatible with the target type
|
|
165
|
+
if _validate_collection_items_compatible(object_, list_inner_type):
|
|
166
|
+
parsed_list = [parse_obj_as(object_=item, type_=list_inner_type) for item in object_]
|
|
167
|
+
return parsed_list
|
|
168
|
+
except Exception:
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
try:
|
|
172
|
+
if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel):
|
|
173
|
+
# Attempt a validated parse until one works
|
|
174
|
+
return parse_obj_as(inner_type, object_)
|
|
175
|
+
except Exception:
|
|
176
|
+
continue
|
|
177
|
+
|
|
178
|
+
# If none of the types work, just return the first successful cast
|
|
179
|
+
for inner_type in inner_types:
|
|
180
|
+
try:
|
|
181
|
+
return construct_type(object_=object_, type_=inner_type)
|
|
182
|
+
except Exception:
|
|
183
|
+
continue
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _convert_union_type(type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
187
|
+
base_type = get_origin(type_) or type_
|
|
188
|
+
union_type = type_
|
|
189
|
+
if base_type == typing_extensions.Annotated: # type: ignore[comparison-overlap]
|
|
190
|
+
union_type = get_args(type_)[0]
|
|
191
|
+
annotated_metadata = get_args(type_)[1:]
|
|
192
|
+
for metadata in annotated_metadata:
|
|
193
|
+
if isinstance(metadata, UnionMetadata):
|
|
194
|
+
try:
|
|
195
|
+
# Cast to the correct type, based on the discriminant
|
|
196
|
+
for inner_type in get_args(union_type):
|
|
197
|
+
try:
|
|
198
|
+
objects_discriminant = getattr(object_, metadata.discriminant)
|
|
199
|
+
except:
|
|
200
|
+
objects_discriminant = object_[metadata.discriminant]
|
|
201
|
+
if inner_type.__fields__[metadata.discriminant].default == objects_discriminant:
|
|
202
|
+
return construct_type(object_=object_, type_=inner_type)
|
|
203
|
+
except Exception:
|
|
204
|
+
# Allow to fall through to our regular union handling
|
|
205
|
+
pass
|
|
206
|
+
return _convert_undiscriminated_union_type(union_type, object_)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def construct_type(*, type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
|
|
210
|
+
"""
|
|
211
|
+
Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just
|
|
212
|
+
Pydantic models.
|
|
213
|
+
The idea is to essentially attempt to coerce object_ to type_ (recursively)
|
|
214
|
+
"""
|
|
215
|
+
# Short circuit when dealing with optionals, don't try to coerces None to a type
|
|
216
|
+
if object_ is None:
|
|
217
|
+
return None
|
|
218
|
+
|
|
219
|
+
base_type = get_origin(type_) or type_
|
|
220
|
+
is_annotated = base_type == typing_extensions.Annotated # type: ignore[comparison-overlap]
|
|
221
|
+
maybe_annotation_members = get_args(type_)
|
|
222
|
+
is_annotated_union = is_annotated and is_union(get_origin(maybe_annotation_members[0]))
|
|
223
|
+
|
|
224
|
+
if base_type == typing.Any: # type: ignore[comparison-overlap]
|
|
225
|
+
return object_
|
|
226
|
+
|
|
227
|
+
if base_type == dict:
|
|
228
|
+
if not isinstance(object_, typing.Mapping):
|
|
229
|
+
return object_
|
|
230
|
+
|
|
231
|
+
key_type, items_type = get_args(type_)
|
|
232
|
+
d = {
|
|
233
|
+
construct_type(object_=key, type_=key_type): construct_type(object_=item, type_=items_type)
|
|
234
|
+
for key, item in object_.items()
|
|
235
|
+
}
|
|
236
|
+
return d
|
|
237
|
+
|
|
238
|
+
if base_type == list:
|
|
239
|
+
if not isinstance(object_, list):
|
|
240
|
+
return object_
|
|
241
|
+
|
|
242
|
+
inner_type = get_args(type_)[0]
|
|
243
|
+
return [construct_type(object_=entry, type_=inner_type) for entry in object_]
|
|
244
|
+
|
|
245
|
+
if base_type == set:
|
|
246
|
+
if not isinstance(object_, set) and not isinstance(object_, list):
|
|
247
|
+
return object_
|
|
248
|
+
|
|
249
|
+
inner_type = get_args(type_)[0]
|
|
250
|
+
return {construct_type(object_=entry, type_=inner_type) for entry in object_}
|
|
251
|
+
|
|
252
|
+
if is_union(base_type) or is_annotated_union:
|
|
253
|
+
return _convert_union_type(type_, object_)
|
|
254
|
+
|
|
255
|
+
# Cannot do an `issubclass` with a literal type, let's also just confirm we have a class before this call
|
|
256
|
+
if (
|
|
257
|
+
object_ is not None
|
|
258
|
+
and not is_literal_type(type_)
|
|
259
|
+
and (
|
|
260
|
+
(inspect.isclass(base_type) and issubclass(base_type, pydantic.BaseModel))
|
|
261
|
+
or (
|
|
262
|
+
is_annotated
|
|
263
|
+
and inspect.isclass(maybe_annotation_members[0])
|
|
264
|
+
and issubclass(maybe_annotation_members[0], pydantic.BaseModel)
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
):
|
|
268
|
+
if IS_PYDANTIC_V2:
|
|
269
|
+
return type_.model_construct(**object_)
|
|
270
|
+
else:
|
|
271
|
+
return type_.construct(**object_)
|
|
272
|
+
|
|
273
|
+
if base_type == dt.datetime:
|
|
274
|
+
try:
|
|
275
|
+
return parse_datetime(object_)
|
|
276
|
+
except Exception:
|
|
277
|
+
return object_
|
|
278
|
+
|
|
279
|
+
if base_type == dt.date:
|
|
280
|
+
try:
|
|
281
|
+
return parse_date(object_)
|
|
282
|
+
except Exception:
|
|
283
|
+
return object_
|
|
284
|
+
|
|
285
|
+
if base_type == uuid.UUID:
|
|
286
|
+
try:
|
|
287
|
+
return uuid.UUID(object_)
|
|
288
|
+
except Exception:
|
|
289
|
+
return object_
|
|
290
|
+
|
|
291
|
+
if base_type == int:
|
|
292
|
+
try:
|
|
293
|
+
return int(object_)
|
|
294
|
+
except Exception:
|
|
295
|
+
return object_
|
|
296
|
+
|
|
297
|
+
if base_type == bool:
|
|
298
|
+
try:
|
|
299
|
+
if isinstance(object_, str):
|
|
300
|
+
stringified_object = object_.lower()
|
|
301
|
+
return stringified_object == "true" or stringified_object == "1"
|
|
302
|
+
|
|
303
|
+
return bool(object_)
|
|
304
|
+
except Exception:
|
|
305
|
+
return object_
|
|
306
|
+
|
|
307
|
+
return object_
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def _get_is_populate_by_name(model: typing.Type["Model"]) -> bool:
|
|
311
|
+
if IS_PYDANTIC_V2:
|
|
312
|
+
return model.model_config.get("populate_by_name", False) # type: ignore # Pydantic v2
|
|
313
|
+
return model.__config__.allow_population_by_field_name # type: ignore # Pydantic v1
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo]
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
# Pydantic V1 swapped the typing of __fields__'s values from ModelField to FieldInfo
|
|
320
|
+
# And so we try to handle both V1 cases, as well as V2 (FieldInfo from model.model_fields)
|
|
321
|
+
def _get_model_fields(
|
|
322
|
+
model: typing.Type["Model"],
|
|
323
|
+
) -> typing.Mapping[str, PydanticField]:
|
|
324
|
+
if IS_PYDANTIC_V2:
|
|
325
|
+
return model.model_fields # type: ignore # Pydantic v2
|
|
326
|
+
else:
|
|
327
|
+
return model.__fields__ # type: ignore # Pydantic v1
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def _get_field_default(field: PydanticField) -> typing.Any:
|
|
331
|
+
try:
|
|
332
|
+
value = field.get_default() # type: ignore # Pydantic < v1.10.15
|
|
333
|
+
except:
|
|
334
|
+
value = field.default
|
|
335
|
+
if IS_PYDANTIC_V2:
|
|
336
|
+
from pydantic_core import PydanticUndefined
|
|
337
|
+
|
|
338
|
+
if value == PydanticUndefined:
|
|
339
|
+
return None
|
|
340
|
+
return value
|
|
341
|
+
return value
|
frameio/files/client.py
CHANGED
|
@@ -55,7 +55,7 @@ class FilesClient:
|
|
|
55
55
|
request_options: typing.Optional[RequestOptions] = None,
|
|
56
56
|
) -> AssetsWithIncludesResponse:
|
|
57
57
|
"""
|
|
58
|
-
List files in a given folder. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
58
|
+
List files in a given folder. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
59
59
|
|
|
60
60
|
Parameters
|
|
61
61
|
----------
|
|
@@ -123,7 +123,7 @@ class FilesClient:
|
|
|
123
123
|
request_options: typing.Optional[RequestOptions] = None,
|
|
124
124
|
) -> FileWithUploadUrlsResponse:
|
|
125
125
|
"""
|
|
126
|
-
Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
126
|
+
Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
127
127
|
|
|
128
128
|
Parameters
|
|
129
129
|
----------
|
|
@@ -185,7 +185,7 @@ class FilesClient:
|
|
|
185
185
|
`media_links.video_h264_180` on a static image file) or transoding process hasn't completed
|
|
186
186
|
(i.e. the file's `status` is "uploaded" rather than "transcoded"), then the link will also be set to null in
|
|
187
187
|
the response payload. In short, the client must handle null media links gracefully.
|
|
188
|
-
<br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
188
|
+
<br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
189
189
|
|
|
190
190
|
Parameters
|
|
191
191
|
----------
|
|
@@ -226,7 +226,7 @@ class FilesClient:
|
|
|
226
226
|
self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
|
|
227
227
|
) -> None:
|
|
228
228
|
"""
|
|
229
|
-
Delete file by ID. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
229
|
+
Delete file by ID. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
230
230
|
|
|
231
231
|
Parameters
|
|
232
232
|
----------
|
|
@@ -267,7 +267,7 @@ class FilesClient:
|
|
|
267
267
|
request_options: typing.Optional[RequestOptions] = None,
|
|
268
268
|
) -> FileResponse:
|
|
269
269
|
"""
|
|
270
|
-
Update file details. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
270
|
+
Update file details. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
271
271
|
|
|
272
272
|
Parameters
|
|
273
273
|
----------
|
|
@@ -315,7 +315,7 @@ class FilesClient:
|
|
|
315
315
|
request_options: typing.Optional[RequestOptions] = None,
|
|
316
316
|
) -> FileCopyResponse:
|
|
317
317
|
"""
|
|
318
|
-
Copy file. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
318
|
+
Copy file. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
319
319
|
|
|
320
320
|
Parameters
|
|
321
321
|
----------
|
|
@@ -363,7 +363,7 @@ class FilesClient:
|
|
|
363
363
|
request_options: typing.Optional[RequestOptions] = None,
|
|
364
364
|
) -> FileRemoteUploadResponse:
|
|
365
365
|
"""
|
|
366
|
-
Create new file under parent folder through remote upload. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
366
|
+
Create new file under parent folder through remote upload. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
367
367
|
|
|
368
368
|
Parameters
|
|
369
369
|
----------
|
|
@@ -414,7 +414,7 @@ class FilesClient:
|
|
|
414
414
|
request_options: typing.Optional[RequestOptions] = None,
|
|
415
415
|
) -> FileResponse:
|
|
416
416
|
"""
|
|
417
|
-
Move file to a folder or version_stack. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
417
|
+
Move file to a folder or version_stack. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
418
418
|
|
|
419
419
|
Parameters
|
|
420
420
|
----------
|
|
@@ -462,7 +462,7 @@ class FilesClient:
|
|
|
462
462
|
request_options: typing.Optional[RequestOptions] = None,
|
|
463
463
|
) -> FileWithUploadUrlsResponse:
|
|
464
464
|
"""
|
|
465
|
-
Create new file under parent folder through local upload. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
465
|
+
Create new file under parent folder through local upload. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
466
466
|
|
|
467
467
|
Parameters
|
|
468
468
|
----------
|
|
@@ -508,7 +508,7 @@ class FilesClient:
|
|
|
508
508
|
self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
|
|
509
509
|
) -> FileUploadStatusResponse:
|
|
510
510
|
"""
|
|
511
|
-
Show file upload status details. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
511
|
+
Show file upload status details. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
512
512
|
|
|
513
513
|
Parameters
|
|
514
514
|
----------
|
|
@@ -569,7 +569,7 @@ class AsyncFilesClient:
|
|
|
569
569
|
request_options: typing.Optional[RequestOptions] = None,
|
|
570
570
|
) -> AssetsWithIncludesResponse:
|
|
571
571
|
"""
|
|
572
|
-
List files in a given folder. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
572
|
+
List files in a given folder. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
573
573
|
|
|
574
574
|
Parameters
|
|
575
575
|
----------
|
|
@@ -645,7 +645,7 @@ class AsyncFilesClient:
|
|
|
645
645
|
request_options: typing.Optional[RequestOptions] = None,
|
|
646
646
|
) -> FileWithUploadUrlsResponse:
|
|
647
647
|
"""
|
|
648
|
-
Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
648
|
+
Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
649
649
|
|
|
650
650
|
Parameters
|
|
651
651
|
----------
|
|
@@ -715,7 +715,7 @@ class AsyncFilesClient:
|
|
|
715
715
|
`media_links.video_h264_180` on a static image file) or transoding process hasn't completed
|
|
716
716
|
(i.e. the file's `status` is "uploaded" rather than "transcoded"), then the link will also be set to null in
|
|
717
717
|
the response payload. In short, the client must handle null media links gracefully.
|
|
718
|
-
<br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
718
|
+
<br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
719
719
|
|
|
720
720
|
Parameters
|
|
721
721
|
----------
|
|
@@ -764,7 +764,7 @@ class AsyncFilesClient:
|
|
|
764
764
|
self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
|
|
765
765
|
) -> None:
|
|
766
766
|
"""
|
|
767
|
-
Delete file by ID. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
767
|
+
Delete file by ID. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
768
768
|
|
|
769
769
|
Parameters
|
|
770
770
|
----------
|
|
@@ -813,7 +813,7 @@ class AsyncFilesClient:
|
|
|
813
813
|
request_options: typing.Optional[RequestOptions] = None,
|
|
814
814
|
) -> FileResponse:
|
|
815
815
|
"""
|
|
816
|
-
Update file details. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
816
|
+
Update file details. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
817
817
|
|
|
818
818
|
Parameters
|
|
819
819
|
----------
|
|
@@ -869,7 +869,7 @@ class AsyncFilesClient:
|
|
|
869
869
|
request_options: typing.Optional[RequestOptions] = None,
|
|
870
870
|
) -> FileCopyResponse:
|
|
871
871
|
"""
|
|
872
|
-
Copy file. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
872
|
+
Copy file. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
873
873
|
|
|
874
874
|
Parameters
|
|
875
875
|
----------
|
|
@@ -925,7 +925,7 @@ class AsyncFilesClient:
|
|
|
925
925
|
request_options: typing.Optional[RequestOptions] = None,
|
|
926
926
|
) -> FileRemoteUploadResponse:
|
|
927
927
|
"""
|
|
928
|
-
Create new file under parent folder through remote upload. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
928
|
+
Create new file under parent folder through remote upload. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
929
929
|
|
|
930
930
|
Parameters
|
|
931
931
|
----------
|
|
@@ -984,7 +984,7 @@ class AsyncFilesClient:
|
|
|
984
984
|
request_options: typing.Optional[RequestOptions] = None,
|
|
985
985
|
) -> FileResponse:
|
|
986
986
|
"""
|
|
987
|
-
Move file to a folder or version_stack. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per
|
|
987
|
+
Move file to a folder or version_stack. <br><br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
|
|
988
988
|
|
|
989
989
|
Parameters
|
|
990
990
|
----------
|
|
@@ -1040,7 +1040,7 @@ class AsyncFilesClient:
|
|
|
1040
1040
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1041
1041
|
) -> FileWithUploadUrlsResponse:
|
|
1042
1042
|
"""
|
|
1043
|
-
Create new file under parent folder through local upload. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
1043
|
+
Create new file under parent folder through local upload. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
1044
1044
|
|
|
1045
1045
|
Parameters
|
|
1046
1046
|
----------
|
|
@@ -1094,7 +1094,7 @@ class AsyncFilesClient:
|
|
|
1094
1094
|
self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
|
|
1095
1095
|
) -> FileUploadStatusResponse:
|
|
1096
1096
|
"""
|
|
1097
|
-
Show file upload status details. <br><br>Rate Limits: 5 calls per 1 second(s) per
|
|
1097
|
+
Show file upload status details. <br><br>Rate Limits: 5 calls per 1 second(s) per account_user
|
|
1098
1098
|
|
|
1099
1099
|
Parameters
|
|
1100
1100
|
----------
|