frameio 0.0.23__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/__init__.py +1115 -0
- frameio/account_permissions/__init__.py +4 -0
- frameio/account_permissions/client.py +182 -0
- frameio/account_permissions/raw_client.py +301 -0
- frameio/accounts/__init__.py +4 -0
- frameio/accounts/client.py +151 -0
- frameio/accounts/raw_client.py +281 -0
- frameio/client.py +439 -0
- frameio/comments/__init__.py +34 -0
- frameio/comments/client.py +596 -0
- frameio/comments/raw_client.py +1252 -0
- frameio/comments/types/__init__.py +38 -0
- frameio/comments/types/create_comment_params_data.py +25 -0
- frameio/comments/types/update_comment_params_data.py +25 -0
- frameio/core/__init__.py +110 -0
- frameio/core/api_error.py +23 -0
- frameio/core/client_wrapper.py +87 -0
- frameio/core/datetime_utils.py +28 -0
- frameio/core/file.py +67 -0
- frameio/core/force_multipart.py +18 -0
- frameio/core/http_client.py +543 -0
- frameio/core/http_response.py +55 -0
- frameio/core/jsonable_encoder.py +100 -0
- frameio/core/pagination.py +82 -0
- frameio/core/pydantic_utilities.py +258 -0
- frameio/core/query_encoder.py +58 -0
- frameio/core/remove_none_from_dict.py +11 -0
- frameio/core/request_options.py +35 -0
- frameio/core/serialization.py +276 -0
- frameio/environment.py +7 -0
- frameio/errors/__init__.py +53 -0
- frameio/errors/bad_request_error.py +11 -0
- frameio/errors/forbidden_error.py +11 -0
- frameio/errors/not_found_error.py +11 -0
- frameio/errors/too_many_requests_error.py +11 -0
- frameio/errors/unauthorized_error.py +11 -0
- frameio/errors/unprocessable_entity_error.py +10 -0
- frameio/files/__init__.py +55 -0
- frameio/files/client.py +1136 -0
- frameio/files/raw_client.py +2492 -0
- frameio/files/types/__init__.py +53 -0
- frameio/files/types/file_copy_params_data.py +15 -0
- frameio/files/types/file_create_local_upload_params_data.py +20 -0
- frameio/files/types/file_create_params_data.py +31 -0
- frameio/files/types/file_create_remote_upload_params_data.py +20 -0
- frameio/files/types/file_move_params_data.py +15 -0
- frameio/files/types/file_update_params_data.py +15 -0
- frameio/folders/__init__.py +39 -0
- frameio/folders/client.py +988 -0
- frameio/folders/raw_client.py +2058 -0
- frameio/folders/types/__init__.py +42 -0
- frameio/folders/types/folder_copy_params_data.py +15 -0
- frameio/folders/types/folder_create_params_data.py +15 -0
- frameio/folders/types/folder_move_params_data.py +15 -0
- frameio/folders/types/folder_update_params_data.py +15 -0
- frameio/metadata/__init__.py +37 -0
- frameio/metadata/client.py +291 -0
- frameio/metadata/raw_client.py +509 -0
- frameio/metadata/types/__init__.py +38 -0
- frameio/metadata/types/bulk_update_metadata_params_data.py +23 -0
- frameio/metadata/types/bulk_update_metadata_params_data_values_item.py +13 -0
- frameio/metadata_fields/__init__.py +103 -0
- frameio/metadata_fields/client.py +536 -0
- frameio/metadata_fields/raw_client.py +996 -0
- frameio/metadata_fields/types/__init__.py +105 -0
- frameio/metadata_fields/types/create_field_definition_params_data.py +108 -0
- frameio/metadata_fields/types/update_field_definition_params_data.py +114 -0
- frameio/project_permissions/__init__.py +4 -0
- frameio/project_permissions/client.py +415 -0
- frameio/project_permissions/raw_client.py +789 -0
- frameio/projects/__init__.py +4 -0
- frameio/projects/client.py +582 -0
- frameio/projects/raw_client.py +1250 -0
- frameio/py.typed +0 -0
- frameio/shares/__init__.py +64 -0
- frameio/shares/client.py +1192 -0
- frameio/shares/raw_client.py +2446 -0
- frameio/shares/types/__init__.py +61 -0
- frameio/shares/types/add_asset_params_data.py +15 -0
- frameio/shares/types/add_reviewers_to_share_params_data.py +18 -0
- frameio/shares/types/add_reviewers_to_share_params_data_reviewers.py +27 -0
- frameio/shares/types/create_share_params_data.py +25 -0
- frameio/shares/types/remove_reviewer_params_data.py +13 -0
- frameio/shares/types/remove_reviewer_params_data_reviewers.py +27 -0
- frameio/shares/types/update_share_params_data.py +33 -0
- frameio/shares/types/update_share_params_data_access.py +5 -0
- frameio/types/__init__.py +959 -0
- frameio/types/account.py +65 -0
- frameio/types/account_roles_item.py +5 -0
- frameio/types/account_user_role.py +23 -0
- frameio/types/account_user_role_role.py +5 -0
- frameio/types/account_user_roles_response.py +27 -0
- frameio/types/accounts_response.py +23 -0
- frameio/types/add_asset_response.py +13 -0
- frameio/types/add_asset_response_data.py +15 -0
- frameio/types/asset_common.py +48 -0
- frameio/types/asset_common_type.py +5 -0
- frameio/types/asset_common_with_includes.py +56 -0
- frameio/types/asset_include.py +5 -0
- frameio/types/asset_share_params.py +38 -0
- frameio/types/asset_share_params_access.py +5 -0
- frameio/types/asset_with_includes.py +72 -0
- frameio/types/assets_with_includes_response.py +23 -0
- frameio/types/bad_request.py +13 -0
- frameio/types/bad_request_errors_item.py +15 -0
- frameio/types/bad_request_errors_item_source.py +12 -0
- frameio/types/boolean_value.py +12 -0
- frameio/types/children_type.py +3 -0
- frameio/types/comment.py +52 -0
- frameio/types/comment_include.py +5 -0
- frameio/types/comment_response.py +13 -0
- frameio/types/comment_with_includes.py +17 -0
- frameio/types/comment_with_includes_response.py +13 -0
- frameio/types/comments_with_includes_response.py +23 -0
- frameio/types/date_definition.py +43 -0
- frameio/types/date_definition_field_configuration.py +21 -0
- frameio/types/date_definition_field_configuration_display_format.py +7 -0
- frameio/types/date_definition_field_configuration_time_format.py +5 -0
- frameio/types/date_definition_params.py +17 -0
- frameio/types/date_definition_params_field_configuration.py +23 -0
- frameio/types/date_definition_params_field_configuration_display_format.py +7 -0
- frameio/types/date_definition_params_field_configuration_time_format.py +7 -0
- frameio/types/date_definition_with_includes.py +13 -0
- frameio/types/date_value.py +12 -0
- frameio/types/email.py +3 -0
- frameio/types/field_definition.py +163 -0
- frameio/types/field_definition_include.py +5 -0
- frameio/types/field_definition_response.py +13 -0
- frameio/types/field_definition_with_includes.py +174 -0
- frameio/types/field_definitions_with_includes_response.py +27 -0
- frameio/types/field_value_common.py +29 -0
- frameio/types/file.py +60 -0
- frameio/types/file_copy_response.py +13 -0
- frameio/types/file_remote_upload_response.py +17 -0
- frameio/types/file_response.py +13 -0
- frameio/types/file_status.py +5 -0
- frameio/types/file_upload_status.py +41 -0
- frameio/types/file_upload_status_response.py +13 -0
- frameio/types/file_with_includes.py +25 -0
- frameio/types/file_with_includes_response.py +13 -0
- frameio/types/file_with_includes_status.py +5 -0
- frameio/types/file_with_media_links_include.py +19 -0
- frameio/types/file_with_upload_urls.py +16 -0
- frameio/types/file_with_upload_urls_response.py +13 -0
- frameio/types/folder.py +15 -0
- frameio/types/folder_copy_response.py +13 -0
- frameio/types/folder_response.py +13 -0
- frameio/types/folder_with_includes.py +61 -0
- frameio/types/folder_with_includes_response.py +13 -0
- frameio/types/folders_with_includes_response.py +23 -0
- frameio/types/forbidden.py +13 -0
- frameio/types/forbidden_errors_item.py +15 -0
- frameio/types/forbidden_errors_item_source.py +12 -0
- frameio/types/include.py +5 -0
- frameio/types/include_total_count.py +3 -0
- frameio/types/integer_value.py +12 -0
- frameio/types/json_error_response.py +13 -0
- frameio/types/json_error_response_errors_item.py +15 -0
- frameio/types/json_error_response_errors_item_source.py +12 -0
- frameio/types/links.py +22 -0
- frameio/types/long_text_definition.py +43 -0
- frameio/types/long_text_definition_field_configuration.py +10 -0
- frameio/types/long_text_definition_params.py +15 -0
- frameio/types/long_text_definition_with_includes.py +13 -0
- frameio/types/media_link_common.py +17 -0
- frameio/types/media_links_collection.py +23 -0
- frameio/types/metadata_field.py +145 -0
- frameio/types/metadata_response.py +13 -0
- frameio/types/metadata_with_definition.py +21 -0
- frameio/types/multi_select_value.py +14 -0
- frameio/types/multi_user_value.py +20 -0
- frameio/types/multi_user_value_member_options_type.py +5 -0
- frameio/types/no_content.py +3 -0
- frameio/types/not_found.py +13 -0
- frameio/types/not_found_errors_item.py +15 -0
- frameio/types/not_found_errors_item_source.py +12 -0
- frameio/types/number_definition.py +43 -0
- frameio/types/number_definition_field_configuration.py +21 -0
- frameio/types/number_definition_field_configuration_number_format.py +7 -0
- frameio/types/number_definition_params.py +17 -0
- frameio/types/number_definition_params_field_configuration.py +23 -0
- frameio/types/number_definition_params_field_configuration_number_format.py +7 -0
- frameio/types/number_definition_with_includes.py +13 -0
- frameio/types/number_value.py +12 -0
- frameio/types/original_media_link.py +16 -0
- frameio/types/profile.py +34 -0
- frameio/types/profile_response.py +17 -0
- frameio/types/project.py +55 -0
- frameio/types/project_include.py +5 -0
- frameio/types/project_params.py +17 -0
- frameio/types/project_params_data.py +15 -0
- frameio/types/project_response.py +17 -0
- frameio/types/project_with_includes.py +18 -0
- frameio/types/project_with_includes_response.py +17 -0
- frameio/types/projects_with_includes_response.py +27 -0
- frameio/types/rating_definition.py +43 -0
- frameio/types/rating_definition_field_configuration.py +22 -0
- frameio/types/rating_definition_field_configuration_style.py +5 -0
- frameio/types/rating_definition_params.py +17 -0
- frameio/types/rating_definition_params_field_configuration.py +22 -0
- frameio/types/rating_definition_params_field_configuration_style.py +5 -0
- frameio/types/rating_definition_with_includes.py +13 -0
- frameio/types/remove_asset_response.py +13 -0
- frameio/types/remove_asset_response_data.py +15 -0
- frameio/types/rendition_media_link.py +19 -0
- frameio/types/request_after_opaque_cursor.py +5 -0
- frameio/types/request_page_size.py +3 -0
- frameio/types/select_definition.py +43 -0
- frameio/types/select_definition_field_configuration.py +18 -0
- frameio/types/select_definition_field_configuration_options_item.py +22 -0
- frameio/types/select_definition_params.py +17 -0
- frameio/types/select_definition_params_field_configuration.py +20 -0
- frameio/types/select_definition_params_field_configuration_options_item.py +20 -0
- frameio/types/select_definition_with_includes.py +13 -0
- frameio/types/select_multi_definition.py +43 -0
- frameio/types/select_multi_definition_field_configuration.py +18 -0
- frameio/types/select_multi_definition_field_configuration_options_item.py +22 -0
- frameio/types/select_multi_definition_params.py +17 -0
- frameio/types/select_multi_definition_params_field_configuration.py +20 -0
- frameio/types/select_multi_definition_params_field_configuration_options_item.py +20 -0
- frameio/types/select_multi_definition_with_includes.py +13 -0
- frameio/types/select_option.py +20 -0
- frameio/types/select_value.py +14 -0
- frameio/types/share.py +66 -0
- frameio/types/share_access.py +5 -0
- frameio/types/share_response.py +13 -0
- frameio/types/share_reviewers_response.py +27 -0
- frameio/types/shares_response.py +27 -0
- frameio/types/single_user_value.py +20 -0
- frameio/types/single_user_value_member_options_type.py +5 -0
- frameio/types/text_definition.py +43 -0
- frameio/types/text_definition_field_configuration.py +10 -0
- frameio/types/text_definition_params.py +15 -0
- frameio/types/text_definition_with_includes.py +13 -0
- frameio/types/text_value.py +12 -0
- frameio/types/toggle_definition.py +43 -0
- frameio/types/toggle_definition_field_configuration.py +15 -0
- frameio/types/toggle_definition_params.py +17 -0
- frameio/types/toggle_definition_params_field_configuration.py +15 -0
- frameio/types/toggle_definition_with_includes.py +13 -0
- frameio/types/too_many_requests.py +13 -0
- frameio/types/too_many_requests_errors_item.py +15 -0
- frameio/types/too_many_requests_errors_item_source.py +12 -0
- frameio/types/unauthorized.py +13 -0
- frameio/types/unauthorized_errors_item.py +15 -0
- frameio/types/unauthorized_errors_item_source.py +12 -0
- frameio/types/unprocessable_entity.py +13 -0
- frameio/types/unprocessable_entity_errors_item.py +15 -0
- frameio/types/unprocessable_entity_errors_item_source.py +12 -0
- frameio/types/update_date_definition_params.py +17 -0
- frameio/types/update_date_definition_params_field_configuration.py +25 -0
- frameio/types/update_date_definition_params_field_configuration_display_format.py +7 -0
- frameio/types/update_date_definition_params_field_configuration_time_format.py +7 -0
- frameio/types/update_long_text_definition_params.py +15 -0
- frameio/types/update_number_definition_params.py +17 -0
- frameio/types/update_number_definition_params_field_configuration.py +25 -0
- frameio/types/update_number_definition_params_field_configuration_number_format.py +7 -0
- frameio/types/update_rating_definition_params.py +17 -0
- frameio/types/update_rating_definition_params_field_configuration.py +24 -0
- frameio/types/update_rating_definition_params_field_configuration_style.py +7 -0
- frameio/types/update_select_definition_params.py +17 -0
- frameio/types/update_select_definition_params_field_configuration.py +20 -0
- frameio/types/update_select_definition_params_field_configuration_options_item.py +20 -0
- frameio/types/update_select_multi_definition_params.py +19 -0
- frameio/types/update_select_multi_definition_params_field_configuration.py +20 -0
- frameio/types/update_select_multi_definition_params_field_configuration_options_item.py +20 -0
- frameio/types/update_text_definition_params.py +15 -0
- frameio/types/update_toggle_definition_params.py +17 -0
- frameio/types/update_toggle_definition_params_field_configuration.py +15 -0
- frameio/types/update_user_multi_definition_params.py +17 -0
- frameio/types/update_user_multi_definition_params_field_configuration.py +25 -0
- frameio/types/update_user_multi_definition_params_field_configuration_custom_members_item.py +20 -0
- frameio/types/update_user_multi_definition_params_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/update_user_multi_definition_params_field_configuration_member_options_type.py +7 -0
- frameio/types/update_user_roles_params.py +17 -0
- frameio/types/update_user_roles_params_data.py +13 -0
- frameio/types/update_user_roles_params_data_role.py +7 -0
- frameio/types/update_user_roles_response.py +13 -0
- frameio/types/update_user_roles_response_data.py +13 -0
- frameio/types/update_user_roles_response_data_role.py +7 -0
- frameio/types/update_user_single_definition_params.py +17 -0
- frameio/types/update_user_single_definition_params_field_configuration.py +25 -0
- frameio/types/update_user_single_definition_params_field_configuration_custom_members_item.py +20 -0
- frameio/types/update_user_single_definition_params_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/update_user_single_definition_params_field_configuration_member_options_type.py +7 -0
- frameio/types/upload_url.py +20 -0
- frameio/types/user.py +44 -0
- frameio/types/user_multi_definition.py +43 -0
- frameio/types/user_multi_definition_field_configuration.py +23 -0
- frameio/types/user_multi_definition_field_configuration_custom_members_item.py +20 -0
- frameio/types/user_multi_definition_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/user_multi_definition_field_configuration_member_options_type.py +7 -0
- frameio/types/user_multi_definition_params.py +17 -0
- frameio/types/user_multi_definition_params_field_configuration.py +23 -0
- frameio/types/user_multi_definition_params_field_configuration_custom_members_item.py +20 -0
- frameio/types/user_multi_definition_params_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/user_multi_definition_params_field_configuration_member_options_type.py +7 -0
- frameio/types/user_multi_definition_with_includes.py +13 -0
- frameio/types/user_role.py +19 -0
- frameio/types/user_role_role.py +7 -0
- frameio/types/user_roles_response.py +27 -0
- frameio/types/user_single_definition.py +43 -0
- frameio/types/user_single_definition_field_configuration.py +23 -0
- frameio/types/user_single_definition_field_configuration_custom_members_item.py +20 -0
- frameio/types/user_single_definition_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/user_single_definition_field_configuration_member_options_type.py +7 -0
- frameio/types/user_single_definition_params.py +17 -0
- frameio/types/user_single_definition_params_field_configuration.py +23 -0
- frameio/types/user_single_definition_params_field_configuration_custom_members_item.py +20 -0
- frameio/types/user_single_definition_params_field_configuration_custom_members_item_type.py +7 -0
- frameio/types/user_single_definition_params_field_configuration_member_options_type.py +7 -0
- frameio/types/user_single_definition_with_includes.py +13 -0
- frameio/types/user_value.py +18 -0
- frameio/types/user_value_type.py +5 -0
- frameio/types/uuid_.py +3 -0
- frameio/types/version_stack.py +50 -0
- frameio/types/version_stack_copy_response.py +13 -0
- frameio/types/version_stack_response.py +13 -0
- frameio/types/version_stack_with_includes.py +58 -0
- frameio/types/version_stack_with_includes_response.py +13 -0
- frameio/types/version_stacks_with_includes_response.py +19 -0
- frameio/types/webhook.py +36 -0
- frameio/types/webhook_create_response.py +17 -0
- frameio/types/webhook_create_response_data.py +15 -0
- frameio/types/webhook_events.py +5 -0
- frameio/types/webhook_response.py +13 -0
- frameio/types/webhook_with_includes.py +13 -0
- frameio/types/webhook_with_includes_response.py +13 -0
- frameio/types/webhooks_with_includes_response.py +23 -0
- frameio/types/workspace.py +40 -0
- frameio/types/workspace_include.py +5 -0
- frameio/types/workspace_params.py +17 -0
- frameio/types/workspace_params_data.py +15 -0
- frameio/types/workspace_response.py +17 -0
- frameio/types/workspace_with_includes.py +13 -0
- frameio/types/workspace_with_includes_response.py +17 -0
- frameio/types/workspaces_with_includes_response.py +27 -0
- frameio/users/__init__.py +4 -0
- frameio/users/client.py +100 -0
- frameio/users/raw_client.py +234 -0
- frameio/version.py +3 -0
- frameio/version_stacks/__init__.py +38 -0
- frameio/version_stacks/client.py +699 -0
- frameio/version_stacks/raw_client.py +1359 -0
- frameio/version_stacks/types/__init__.py +40 -0
- frameio/version_stacks/types/version_stack_copy_params_data.py +15 -0
- frameio/version_stacks/types/version_stack_create_params_data.py +19 -0
- frameio/version_stacks/types/version_stack_move_params_data.py +15 -0
- frameio/webhooks/__init__.py +34 -0
- frameio/webhooks/client.py +782 -0
- frameio/webhooks/raw_client.py +1312 -0
- frameio/webhooks/types/__init__.py +38 -0
- frameio/webhooks/types/webhook_create_params_data.py +18 -0
- frameio/webhooks/types/webhook_update_params_data.py +23 -0
- frameio/workspace_permissions/__init__.py +4 -0
- frameio/workspace_permissions/client.py +419 -0
- frameio/workspace_permissions/raw_client.py +789 -0
- frameio/workspaces/__init__.py +4 -0
- frameio/workspaces/client.py +552 -0
- frameio/workspaces/raw_client.py +1226 -0
- frameio-0.0.23.dist-info/METADATA +255 -0
- frameio-0.0.23.dist-info/RECORD +363 -0
- frameio-0.0.23.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import collections
|
|
4
|
+
import inspect
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
import pydantic
|
|
8
|
+
import typing_extensions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FieldMetadata:
|
|
12
|
+
"""
|
|
13
|
+
Metadata class used to annotate fields to provide additional information.
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
class MyDict(TypedDict):
|
|
17
|
+
field: typing.Annotated[str, FieldMetadata(alias="field_name")]
|
|
18
|
+
|
|
19
|
+
Will serialize: `{"field": "value"}`
|
|
20
|
+
To: `{"field_name": "value"}`
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
alias: str
|
|
24
|
+
|
|
25
|
+
def __init__(self, *, alias: str) -> None:
|
|
26
|
+
self.alias = alias
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def convert_and_respect_annotation_metadata(
|
|
30
|
+
*,
|
|
31
|
+
object_: typing.Any,
|
|
32
|
+
annotation: typing.Any,
|
|
33
|
+
inner_type: typing.Optional[typing.Any] = None,
|
|
34
|
+
direction: typing.Literal["read", "write"],
|
|
35
|
+
) -> typing.Any:
|
|
36
|
+
"""
|
|
37
|
+
Respect the metadata annotations on a field, such as aliasing. This function effectively
|
|
38
|
+
manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for
|
|
39
|
+
TypedDicts, which cannot support aliasing out of the box, and can be extended for additional
|
|
40
|
+
utilities, such as defaults.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
object_ : typing.Any
|
|
45
|
+
|
|
46
|
+
annotation : type
|
|
47
|
+
The type we're looking to apply typing annotations from
|
|
48
|
+
|
|
49
|
+
inner_type : typing.Optional[type]
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
typing.Any
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
if object_ is None:
|
|
57
|
+
return None
|
|
58
|
+
if inner_type is None:
|
|
59
|
+
inner_type = annotation
|
|
60
|
+
|
|
61
|
+
clean_type = _remove_annotations(inner_type)
|
|
62
|
+
# Pydantic models
|
|
63
|
+
if (
|
|
64
|
+
inspect.isclass(clean_type)
|
|
65
|
+
and issubclass(clean_type, pydantic.BaseModel)
|
|
66
|
+
and isinstance(object_, typing.Mapping)
|
|
67
|
+
):
|
|
68
|
+
return _convert_mapping(object_, clean_type, direction)
|
|
69
|
+
# TypedDicts
|
|
70
|
+
if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping):
|
|
71
|
+
return _convert_mapping(object_, clean_type, direction)
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
typing_extensions.get_origin(clean_type) == typing.Dict
|
|
75
|
+
or typing_extensions.get_origin(clean_type) == dict
|
|
76
|
+
or clean_type == typing.Dict
|
|
77
|
+
) and isinstance(object_, typing.Dict):
|
|
78
|
+
key_type = typing_extensions.get_args(clean_type)[0]
|
|
79
|
+
value_type = typing_extensions.get_args(clean_type)[1]
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
key: convert_and_respect_annotation_metadata(
|
|
83
|
+
object_=value,
|
|
84
|
+
annotation=annotation,
|
|
85
|
+
inner_type=value_type,
|
|
86
|
+
direction=direction,
|
|
87
|
+
)
|
|
88
|
+
for key, value in object_.items()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# If you're iterating on a string, do not bother to coerce it to a sequence.
|
|
92
|
+
if not isinstance(object_, str):
|
|
93
|
+
if (
|
|
94
|
+
typing_extensions.get_origin(clean_type) == typing.Set
|
|
95
|
+
or typing_extensions.get_origin(clean_type) == set
|
|
96
|
+
or clean_type == typing.Set
|
|
97
|
+
) and isinstance(object_, typing.Set):
|
|
98
|
+
inner_type = typing_extensions.get_args(clean_type)[0]
|
|
99
|
+
return {
|
|
100
|
+
convert_and_respect_annotation_metadata(
|
|
101
|
+
object_=item,
|
|
102
|
+
annotation=annotation,
|
|
103
|
+
inner_type=inner_type,
|
|
104
|
+
direction=direction,
|
|
105
|
+
)
|
|
106
|
+
for item in object_
|
|
107
|
+
}
|
|
108
|
+
elif (
|
|
109
|
+
(
|
|
110
|
+
typing_extensions.get_origin(clean_type) == typing.List
|
|
111
|
+
or typing_extensions.get_origin(clean_type) == list
|
|
112
|
+
or clean_type == typing.List
|
|
113
|
+
)
|
|
114
|
+
and isinstance(object_, typing.List)
|
|
115
|
+
) or (
|
|
116
|
+
(
|
|
117
|
+
typing_extensions.get_origin(clean_type) == typing.Sequence
|
|
118
|
+
or typing_extensions.get_origin(clean_type) == collections.abc.Sequence
|
|
119
|
+
or clean_type == typing.Sequence
|
|
120
|
+
)
|
|
121
|
+
and isinstance(object_, typing.Sequence)
|
|
122
|
+
):
|
|
123
|
+
inner_type = typing_extensions.get_args(clean_type)[0]
|
|
124
|
+
return [
|
|
125
|
+
convert_and_respect_annotation_metadata(
|
|
126
|
+
object_=item,
|
|
127
|
+
annotation=annotation,
|
|
128
|
+
inner_type=inner_type,
|
|
129
|
+
direction=direction,
|
|
130
|
+
)
|
|
131
|
+
for item in object_
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
if typing_extensions.get_origin(clean_type) == typing.Union:
|
|
135
|
+
# We should be able to ~relatively~ safely try to convert keys against all
|
|
136
|
+
# member types in the union, the edge case here is if one member aliases a field
|
|
137
|
+
# of the same name to a different name from another member
|
|
138
|
+
# Or if another member aliases a field of the same name that another member does not.
|
|
139
|
+
for member in typing_extensions.get_args(clean_type):
|
|
140
|
+
object_ = convert_and_respect_annotation_metadata(
|
|
141
|
+
object_=object_,
|
|
142
|
+
annotation=annotation,
|
|
143
|
+
inner_type=member,
|
|
144
|
+
direction=direction,
|
|
145
|
+
)
|
|
146
|
+
return object_
|
|
147
|
+
|
|
148
|
+
annotated_type = _get_annotation(annotation)
|
|
149
|
+
if annotated_type is None:
|
|
150
|
+
return object_
|
|
151
|
+
|
|
152
|
+
# If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.)
|
|
153
|
+
# Then we can safely call it on the recursive conversion.
|
|
154
|
+
return object_
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _convert_mapping(
|
|
158
|
+
object_: typing.Mapping[str, object],
|
|
159
|
+
expected_type: typing.Any,
|
|
160
|
+
direction: typing.Literal["read", "write"],
|
|
161
|
+
) -> typing.Mapping[str, object]:
|
|
162
|
+
converted_object: typing.Dict[str, object] = {}
|
|
163
|
+
try:
|
|
164
|
+
annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
|
|
165
|
+
except NameError:
|
|
166
|
+
# The TypedDict contains a circular reference, so
|
|
167
|
+
# we use the __annotations__ attribute directly.
|
|
168
|
+
annotations = getattr(expected_type, "__annotations__", {})
|
|
169
|
+
aliases_to_field_names = _get_alias_to_field_name(annotations)
|
|
170
|
+
for key, value in object_.items():
|
|
171
|
+
if direction == "read" and key in aliases_to_field_names:
|
|
172
|
+
dealiased_key = aliases_to_field_names.get(key)
|
|
173
|
+
if dealiased_key is not None:
|
|
174
|
+
type_ = annotations.get(dealiased_key)
|
|
175
|
+
else:
|
|
176
|
+
type_ = annotations.get(key)
|
|
177
|
+
# Note you can't get the annotation by the field name if you're in read mode, so you must check the aliases map
|
|
178
|
+
#
|
|
179
|
+
# So this is effectively saying if we're in write mode, and we don't have a type, or if we're in read mode and we don't have an alias
|
|
180
|
+
# then we can just pass the value through as is
|
|
181
|
+
if type_ is None:
|
|
182
|
+
converted_object[key] = value
|
|
183
|
+
elif direction == "read" and key not in aliases_to_field_names:
|
|
184
|
+
converted_object[key] = convert_and_respect_annotation_metadata(
|
|
185
|
+
object_=value, annotation=type_, direction=direction
|
|
186
|
+
)
|
|
187
|
+
else:
|
|
188
|
+
converted_object[_alias_key(key, type_, direction, aliases_to_field_names)] = (
|
|
189
|
+
convert_and_respect_annotation_metadata(object_=value, annotation=type_, direction=direction)
|
|
190
|
+
)
|
|
191
|
+
return converted_object
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]:
|
|
195
|
+
maybe_annotated_type = typing_extensions.get_origin(type_)
|
|
196
|
+
if maybe_annotated_type is None:
|
|
197
|
+
return None
|
|
198
|
+
|
|
199
|
+
if maybe_annotated_type == typing_extensions.NotRequired:
|
|
200
|
+
type_ = typing_extensions.get_args(type_)[0]
|
|
201
|
+
maybe_annotated_type = typing_extensions.get_origin(type_)
|
|
202
|
+
|
|
203
|
+
if maybe_annotated_type == typing_extensions.Annotated:
|
|
204
|
+
return type_
|
|
205
|
+
|
|
206
|
+
return None
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def _remove_annotations(type_: typing.Any) -> typing.Any:
|
|
210
|
+
maybe_annotated_type = typing_extensions.get_origin(type_)
|
|
211
|
+
if maybe_annotated_type is None:
|
|
212
|
+
return type_
|
|
213
|
+
|
|
214
|
+
if maybe_annotated_type == typing_extensions.NotRequired:
|
|
215
|
+
return _remove_annotations(typing_extensions.get_args(type_)[0])
|
|
216
|
+
|
|
217
|
+
if maybe_annotated_type == typing_extensions.Annotated:
|
|
218
|
+
return _remove_annotations(typing_extensions.get_args(type_)[0])
|
|
219
|
+
|
|
220
|
+
return type_
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def get_alias_to_field_mapping(type_: typing.Any) -> typing.Dict[str, str]:
|
|
224
|
+
annotations = typing_extensions.get_type_hints(type_, include_extras=True)
|
|
225
|
+
return _get_alias_to_field_name(annotations)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def get_field_to_alias_mapping(type_: typing.Any) -> typing.Dict[str, str]:
|
|
229
|
+
annotations = typing_extensions.get_type_hints(type_, include_extras=True)
|
|
230
|
+
return _get_field_to_alias_name(annotations)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def _get_alias_to_field_name(
|
|
234
|
+
field_to_hint: typing.Dict[str, typing.Any],
|
|
235
|
+
) -> typing.Dict[str, str]:
|
|
236
|
+
aliases = {}
|
|
237
|
+
for field, hint in field_to_hint.items():
|
|
238
|
+
maybe_alias = _get_alias_from_type(hint)
|
|
239
|
+
if maybe_alias is not None:
|
|
240
|
+
aliases[maybe_alias] = field
|
|
241
|
+
return aliases
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def _get_field_to_alias_name(
|
|
245
|
+
field_to_hint: typing.Dict[str, typing.Any],
|
|
246
|
+
) -> typing.Dict[str, str]:
|
|
247
|
+
aliases = {}
|
|
248
|
+
for field, hint in field_to_hint.items():
|
|
249
|
+
maybe_alias = _get_alias_from_type(hint)
|
|
250
|
+
if maybe_alias is not None:
|
|
251
|
+
aliases[field] = maybe_alias
|
|
252
|
+
return aliases
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def _get_alias_from_type(type_: typing.Any) -> typing.Optional[str]:
|
|
256
|
+
maybe_annotated_type = _get_annotation(type_)
|
|
257
|
+
|
|
258
|
+
if maybe_annotated_type is not None:
|
|
259
|
+
# The actual annotations are 1 onward, the first is the annotated type
|
|
260
|
+
annotations = typing_extensions.get_args(maybe_annotated_type)[1:]
|
|
261
|
+
|
|
262
|
+
for annotation in annotations:
|
|
263
|
+
if isinstance(annotation, FieldMetadata) and annotation.alias is not None:
|
|
264
|
+
return annotation.alias
|
|
265
|
+
return None
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def _alias_key(
|
|
269
|
+
key: str,
|
|
270
|
+
type_: typing.Any,
|
|
271
|
+
direction: typing.Literal["read", "write"],
|
|
272
|
+
aliases_to_field_names: typing.Dict[str, str],
|
|
273
|
+
) -> str:
|
|
274
|
+
if direction == "read":
|
|
275
|
+
return aliases_to_field_names.get(key, key)
|
|
276
|
+
return _get_alias_from_type(type_=type_) or key
|
frameio/environment.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .bad_request_error import BadRequestError
|
|
10
|
+
from .forbidden_error import ForbiddenError
|
|
11
|
+
from .not_found_error import NotFoundError
|
|
12
|
+
from .too_many_requests_error import TooManyRequestsError
|
|
13
|
+
from .unauthorized_error import UnauthorizedError
|
|
14
|
+
from .unprocessable_entity_error import UnprocessableEntityError
|
|
15
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
16
|
+
"BadRequestError": ".bad_request_error",
|
|
17
|
+
"ForbiddenError": ".forbidden_error",
|
|
18
|
+
"NotFoundError": ".not_found_error",
|
|
19
|
+
"TooManyRequestsError": ".too_many_requests_error",
|
|
20
|
+
"UnauthorizedError": ".unauthorized_error",
|
|
21
|
+
"UnprocessableEntityError": ".unprocessable_entity_error",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
26
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
27
|
+
if module_name is None:
|
|
28
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
29
|
+
try:
|
|
30
|
+
module = import_module(module_name, __package__)
|
|
31
|
+
if module_name == f".{attr_name}":
|
|
32
|
+
return module
|
|
33
|
+
else:
|
|
34
|
+
return getattr(module, attr_name)
|
|
35
|
+
except ImportError as e:
|
|
36
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
37
|
+
except AttributeError as e:
|
|
38
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def __dir__():
|
|
42
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
43
|
+
return sorted(lazy_attrs)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"BadRequestError",
|
|
48
|
+
"ForbiddenError",
|
|
49
|
+
"NotFoundError",
|
|
50
|
+
"TooManyRequestsError",
|
|
51
|
+
"UnauthorizedError",
|
|
52
|
+
"UnprocessableEntityError",
|
|
53
|
+
]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.bad_request import BadRequest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BadRequestError(ApiError):
|
|
10
|
+
def __init__(self, body: BadRequest, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=400, headers=headers, body=body)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.forbidden import Forbidden
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ForbiddenError(ApiError):
|
|
10
|
+
def __init__(self, body: Forbidden, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=403, headers=headers, body=body)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.not_found import NotFound
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class NotFoundError(ApiError):
|
|
10
|
+
def __init__(self, body: NotFound, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=404, headers=headers, body=body)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.too_many_requests import TooManyRequests
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TooManyRequestsError(ApiError):
|
|
10
|
+
def __init__(self, body: TooManyRequests, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=429, headers=headers, body=body)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.unauthorized import Unauthorized
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class UnauthorizedError(ApiError):
|
|
10
|
+
def __init__(self, body: Unauthorized, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=401, headers=headers, body=body)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UnprocessableEntityError(ApiError):
|
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
|
+
super().__init__(status_code=422, headers=headers, body=body)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import (
|
|
10
|
+
FileCopyParamsData,
|
|
11
|
+
FileCreateLocalUploadParamsData,
|
|
12
|
+
FileCreateParamsData,
|
|
13
|
+
FileCreateRemoteUploadParamsData,
|
|
14
|
+
FileMoveParamsData,
|
|
15
|
+
FileUpdateParamsData,
|
|
16
|
+
)
|
|
17
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
18
|
+
"FileCopyParamsData": ".types",
|
|
19
|
+
"FileCreateLocalUploadParamsData": ".types",
|
|
20
|
+
"FileCreateParamsData": ".types",
|
|
21
|
+
"FileCreateRemoteUploadParamsData": ".types",
|
|
22
|
+
"FileMoveParamsData": ".types",
|
|
23
|
+
"FileUpdateParamsData": ".types",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
28
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
29
|
+
if module_name is None:
|
|
30
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
31
|
+
try:
|
|
32
|
+
module = import_module(module_name, __package__)
|
|
33
|
+
if module_name == f".{attr_name}":
|
|
34
|
+
return module
|
|
35
|
+
else:
|
|
36
|
+
return getattr(module, attr_name)
|
|
37
|
+
except ImportError as e:
|
|
38
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
39
|
+
except AttributeError as e:
|
|
40
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def __dir__():
|
|
44
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
45
|
+
return sorted(lazy_attrs)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
"FileCopyParamsData",
|
|
50
|
+
"FileCreateLocalUploadParamsData",
|
|
51
|
+
"FileCreateParamsData",
|
|
52
|
+
"FileCreateRemoteUploadParamsData",
|
|
53
|
+
"FileMoveParamsData",
|
|
54
|
+
"FileUpdateParamsData",
|
|
55
|
+
]
|