frameio 0.0.28__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.
- frameio/__init__.py +1158 -0
- frameio/account_permissions/__init__.py +4 -0
- frameio/account_permissions/client.py +193 -0
- frameio/account_permissions/raw_client.py +333 -0
- frameio/accounts/__init__.py +4 -0
- frameio/accounts/client.py +162 -0
- frameio/accounts/raw_client.py +309 -0
- frameio/client.py +439 -0
- frameio/comments/__init__.py +38 -0
- frameio/comments/client.py +654 -0
- frameio/comments/raw_client.py +1316 -0
- frameio/comments/types/__init__.py +40 -0
- frameio/comments/types/comments_show_request_include.py +5 -0
- frameio/comments/types/create_comment_params_data.py +33 -0
- frameio/comments/types/update_comment_params_data.py +33 -0
- frameio/core/__init__.py +122 -0
- frameio/core/api_error.py +23 -0
- frameio/core/client_wrapper.py +95 -0
- frameio/core/custom_pagination.py +152 -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 +663 -0
- frameio/core/http_response.py +55 -0
- frameio/core/http_sse/__init__.py +42 -0
- frameio/core/http_sse/_api.py +112 -0
- frameio/core/http_sse/_decoders.py +61 -0
- frameio/core/http_sse/_exceptions.py +7 -0
- frameio/core/http_sse/_models.py +17 -0
- frameio/core/jsonable_encoder.py +100 -0
- frameio/core/pagination.py +82 -0
- frameio/core/pydantic_utilities.py +361 -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/core/unchecked_base_model.py +376 -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 +58 -0
- frameio/files/client.py +1171 -0
- frameio/files/raw_client.py +2517 -0
- frameio/files/types/__init__.py +56 -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/files/types/files_copy_request_copy_comments.py +5 -0
- frameio/folders/__init__.py +39 -0
- frameio/folders/client.py +1004 -0
- frameio/folders/raw_client.py +2074 -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 +293 -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 +112 -0
- frameio/metadata_fields/types/update_field_definition_params_data.py +118 -0
- frameio/project_permissions/__init__.py +4 -0
- frameio/project_permissions/client.py +426 -0
- frameio/project_permissions/raw_client.py +824 -0
- frameio/projects/__init__.py +38 -0
- frameio/projects/client.py +604 -0
- frameio/projects/raw_client.py +1286 -0
- frameio/projects/types/__init__.py +40 -0
- frameio/projects/types/project_params_data.py +20 -0
- frameio/projects/types/project_update_params_data.py +26 -0
- frameio/projects/types/project_update_params_data_status.py +5 -0
- frameio/py.typed +0 -0
- frameio/shares/__init__.py +64 -0
- frameio/shares/client.py +1217 -0
- frameio/shares/raw_client.py +2511 -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 +26 -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 +34 -0
- frameio/shares/types/update_share_params_data_access.py +5 -0
- frameio/types/__init__.py +983 -0
- frameio/types/account.py +70 -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 +58 -0
- frameio/types/asset_common_with_includes_type.py +5 -0
- frameio/types/asset_include.py +5 -0
- frameio/types/asset_share_params.py +39 -0
- frameio/types/asset_share_params_access.py +5 -0
- frameio/types/asset_with_includes.py +76 -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 +59 -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 +49 -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_field_type.py +10 -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/empty_json.py +5 -0
- frameio/types/field_definition.py +167 -0
- frameio/types/field_definition_include.py +5 -0
- frameio/types/field_definition_response.py +13 -0
- frameio/types/field_definition_with_includes.py +178 -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 +63 -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 +49 -0
- frameio/types/long_text_definition_field_configuration.py +10 -0
- frameio/types/long_text_definition_field_type.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 +24 -0
- frameio/types/metadata_field.py +149 -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 +66 -0
- frameio/types/project_include.py +5 -0
- frameio/types/project_response.py +17 -0
- frameio/types/project_status.py +5 -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 +49 -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_field_type.py +10 -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 +49 -0
- frameio/types/text_definition_field_configuration.py +10 -0
- frameio/types/text_definition_field_type.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/time_stamp.py +5 -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 +49 -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_field_type.py +10 -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 +49 -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_field_type.py +10 -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 +60 -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 +49 -0
- frameio/version_stacks/client.py +818 -0
- frameio/version_stacks/raw_client.py +1614 -0
- frameio/version_stacks/types/__init__.py +47 -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/version_stacks/types/version_stacks_show_request_include.py +19 -0
- frameio/webhooks/__init__.py +34 -0
- frameio/webhooks/client.py +793 -0
- frameio/webhooks/raw_client.py +1347 -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 +430 -0
- frameio/workspace_permissions/raw_client.py +824 -0
- frameio/workspaces/__init__.py +4 -0
- frameio/workspaces/client.py +563 -0
- frameio/workspaces/raw_client.py +1259 -0
- frameio-0.0.28.dist-info/METADATA +259 -0
- frameio-0.0.28.dist-info/RECORD +385 -0
- frameio-0.0.28.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,40 @@
|
|
|
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 .comments_show_request_include import CommentsShowRequestInclude
|
|
10
|
+
from .create_comment_params_data import CreateCommentParamsData
|
|
11
|
+
from .update_comment_params_data import UpdateCommentParamsData
|
|
12
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
13
|
+
"CommentsShowRequestInclude": ".comments_show_request_include",
|
|
14
|
+
"CreateCommentParamsData": ".create_comment_params_data",
|
|
15
|
+
"UpdateCommentParamsData": ".update_comment_params_data",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
20
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
21
|
+
if module_name is None:
|
|
22
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
23
|
+
try:
|
|
24
|
+
module = import_module(module_name, __package__)
|
|
25
|
+
if module_name == f".{attr_name}":
|
|
26
|
+
return module
|
|
27
|
+
else:
|
|
28
|
+
return getattr(module, attr_name)
|
|
29
|
+
except ImportError as e:
|
|
30
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
31
|
+
except AttributeError as e:
|
|
32
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def __dir__():
|
|
36
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
37
|
+
return sorted(lazy_attrs)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = ["CommentsShowRequestInclude", "CreateCommentParamsData", "UpdateCommentParamsData"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
7
|
+
from ...types.time_stamp import TimeStamp
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CreateCommentParamsData(UncheckedBaseModel):
|
|
11
|
+
annotation: typing.Optional[str] = pydantic.Field(default=None)
|
|
12
|
+
"""
|
|
13
|
+
JSON geometry for on-screen drawings. Allowed for document, image, video, or stream file types. JSON must be stringified.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
completed: typing.Optional[bool] = pydantic.Field(default=None)
|
|
17
|
+
"""
|
|
18
|
+
Comment completion status
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
page: typing.Optional[int] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
Document page. Only allowed when file type is a pdf document
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
text: str = pydantic.Field()
|
|
27
|
+
"""
|
|
28
|
+
Comment text (required)
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
timestamp: typing.Optional[TimeStamp] = None
|
|
32
|
+
|
|
33
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
7
|
+
from ...types.time_stamp import TimeStamp
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class UpdateCommentParamsData(UncheckedBaseModel):
|
|
11
|
+
annotation: typing.Optional[str] = pydantic.Field(default=None)
|
|
12
|
+
"""
|
|
13
|
+
JSON geometry for on-screen drawings. Allowed for document, image, video, or stream file types. JSON must be stringified.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
completed: typing.Optional[bool] = pydantic.Field(default=None)
|
|
17
|
+
"""
|
|
18
|
+
Comment completion status
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
page: typing.Optional[int] = pydantic.Field(default=None)
|
|
22
|
+
"""
|
|
23
|
+
Document page. Only allowed when file type is a pdf document
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
text: typing.Optional[str] = pydantic.Field(default=None)
|
|
27
|
+
"""
|
|
28
|
+
Comment text
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
timestamp: typing.Optional[TimeStamp] = None
|
|
32
|
+
|
|
33
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
|
frameio/core/__init__.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
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 .api_error import ApiError
|
|
10
|
+
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
|
11
|
+
from .custom_pagination import AsyncCustomPager, SyncCustomPager
|
|
12
|
+
from .datetime_utils import serialize_datetime
|
|
13
|
+
from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
|
|
14
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
15
|
+
from .http_response import AsyncHttpResponse, HttpResponse
|
|
16
|
+
from .jsonable_encoder import jsonable_encoder
|
|
17
|
+
from .pagination import AsyncPager, SyncPager
|
|
18
|
+
from .pydantic_utilities import (
|
|
19
|
+
IS_PYDANTIC_V2,
|
|
20
|
+
UniversalBaseModel,
|
|
21
|
+
UniversalRootModel,
|
|
22
|
+
parse_obj_as,
|
|
23
|
+
universal_field_validator,
|
|
24
|
+
universal_root_validator,
|
|
25
|
+
update_forward_refs,
|
|
26
|
+
)
|
|
27
|
+
from .query_encoder import encode_query
|
|
28
|
+
from .remove_none_from_dict import remove_none_from_dict
|
|
29
|
+
from .request_options import RequestOptions
|
|
30
|
+
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
31
|
+
from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
|
|
32
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
33
|
+
"ApiError": ".api_error",
|
|
34
|
+
"AsyncClientWrapper": ".client_wrapper",
|
|
35
|
+
"AsyncCustomPager": ".custom_pagination",
|
|
36
|
+
"AsyncHttpClient": ".http_client",
|
|
37
|
+
"AsyncHttpResponse": ".http_response",
|
|
38
|
+
"AsyncPager": ".pagination",
|
|
39
|
+
"BaseClientWrapper": ".client_wrapper",
|
|
40
|
+
"FieldMetadata": ".serialization",
|
|
41
|
+
"File": ".file",
|
|
42
|
+
"HttpClient": ".http_client",
|
|
43
|
+
"HttpResponse": ".http_response",
|
|
44
|
+
"IS_PYDANTIC_V2": ".pydantic_utilities",
|
|
45
|
+
"RequestOptions": ".request_options",
|
|
46
|
+
"SyncClientWrapper": ".client_wrapper",
|
|
47
|
+
"SyncCustomPager": ".custom_pagination",
|
|
48
|
+
"SyncPager": ".pagination",
|
|
49
|
+
"UncheckedBaseModel": ".unchecked_base_model",
|
|
50
|
+
"UnionMetadata": ".unchecked_base_model",
|
|
51
|
+
"UniversalBaseModel": ".pydantic_utilities",
|
|
52
|
+
"UniversalRootModel": ".pydantic_utilities",
|
|
53
|
+
"construct_type": ".unchecked_base_model",
|
|
54
|
+
"convert_and_respect_annotation_metadata": ".serialization",
|
|
55
|
+
"convert_file_dict_to_httpx_tuples": ".file",
|
|
56
|
+
"encode_query": ".query_encoder",
|
|
57
|
+
"jsonable_encoder": ".jsonable_encoder",
|
|
58
|
+
"parse_obj_as": ".pydantic_utilities",
|
|
59
|
+
"remove_none_from_dict": ".remove_none_from_dict",
|
|
60
|
+
"serialize_datetime": ".datetime_utils",
|
|
61
|
+
"universal_field_validator": ".pydantic_utilities",
|
|
62
|
+
"universal_root_validator": ".pydantic_utilities",
|
|
63
|
+
"update_forward_refs": ".pydantic_utilities",
|
|
64
|
+
"with_content_type": ".file",
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
69
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
70
|
+
if module_name is None:
|
|
71
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
72
|
+
try:
|
|
73
|
+
module = import_module(module_name, __package__)
|
|
74
|
+
if module_name == f".{attr_name}":
|
|
75
|
+
return module
|
|
76
|
+
else:
|
|
77
|
+
return getattr(module, attr_name)
|
|
78
|
+
except ImportError as e:
|
|
79
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
80
|
+
except AttributeError as e:
|
|
81
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def __dir__():
|
|
85
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
86
|
+
return sorted(lazy_attrs)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
__all__ = [
|
|
90
|
+
"ApiError",
|
|
91
|
+
"AsyncClientWrapper",
|
|
92
|
+
"AsyncCustomPager",
|
|
93
|
+
"AsyncHttpClient",
|
|
94
|
+
"AsyncHttpResponse",
|
|
95
|
+
"AsyncPager",
|
|
96
|
+
"BaseClientWrapper",
|
|
97
|
+
"FieldMetadata",
|
|
98
|
+
"File",
|
|
99
|
+
"HttpClient",
|
|
100
|
+
"HttpResponse",
|
|
101
|
+
"IS_PYDANTIC_V2",
|
|
102
|
+
"RequestOptions",
|
|
103
|
+
"SyncClientWrapper",
|
|
104
|
+
"SyncCustomPager",
|
|
105
|
+
"SyncPager",
|
|
106
|
+
"UncheckedBaseModel",
|
|
107
|
+
"UnionMetadata",
|
|
108
|
+
"UniversalBaseModel",
|
|
109
|
+
"UniversalRootModel",
|
|
110
|
+
"construct_type",
|
|
111
|
+
"convert_and_respect_annotation_metadata",
|
|
112
|
+
"convert_file_dict_to_httpx_tuples",
|
|
113
|
+
"encode_query",
|
|
114
|
+
"jsonable_encoder",
|
|
115
|
+
"parse_obj_as",
|
|
116
|
+
"remove_none_from_dict",
|
|
117
|
+
"serialize_datetime",
|
|
118
|
+
"universal_field_validator",
|
|
119
|
+
"universal_root_validator",
|
|
120
|
+
"update_forward_refs",
|
|
121
|
+
"with_content_type",
|
|
122
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiError(Exception):
|
|
7
|
+
headers: Optional[Dict[str, str]]
|
|
8
|
+
status_code: Optional[int]
|
|
9
|
+
body: Any
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
headers: Optional[Dict[str, str]] = None,
|
|
15
|
+
status_code: Optional[int] = None,
|
|
16
|
+
body: Any = None,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.headers = headers
|
|
19
|
+
self.status_code = status_code
|
|
20
|
+
self.body = body
|
|
21
|
+
|
|
22
|
+
def __str__(self) -> str:
|
|
23
|
+
return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseClientWrapper:
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
*,
|
|
13
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
14
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
15
|
+
base_url: str,
|
|
16
|
+
timeout: typing.Optional[float] = None,
|
|
17
|
+
):
|
|
18
|
+
self._token = token
|
|
19
|
+
self._headers = headers
|
|
20
|
+
self._base_url = base_url
|
|
21
|
+
self._timeout = timeout
|
|
22
|
+
|
|
23
|
+
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
|
+
headers: typing.Dict[str, str] = {
|
|
25
|
+
"User-Agent": "frameio/0.0.28",
|
|
26
|
+
"X-Fern-Language": "Python",
|
|
27
|
+
"X-Fern-SDK-Name": "frameio",
|
|
28
|
+
"X-Fern-SDK-Version": "0.0.28",
|
|
29
|
+
**(self.get_custom_headers() or {}),
|
|
30
|
+
}
|
|
31
|
+
headers["Authorization"] = f"Bearer {self._get_token()}"
|
|
32
|
+
return headers
|
|
33
|
+
|
|
34
|
+
def _get_token(self) -> str:
|
|
35
|
+
if isinstance(self._token, str):
|
|
36
|
+
return self._token
|
|
37
|
+
else:
|
|
38
|
+
return self._token()
|
|
39
|
+
|
|
40
|
+
def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
|
|
41
|
+
return self._headers
|
|
42
|
+
|
|
43
|
+
def get_base_url(self) -> str:
|
|
44
|
+
return self._base_url
|
|
45
|
+
|
|
46
|
+
def get_timeout(self) -> typing.Optional[float]:
|
|
47
|
+
return self._timeout
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SyncClientWrapper(BaseClientWrapper):
|
|
51
|
+
def __init__(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
55
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
56
|
+
base_url: str,
|
|
57
|
+
timeout: typing.Optional[float] = None,
|
|
58
|
+
httpx_client: httpx.Client,
|
|
59
|
+
):
|
|
60
|
+
super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
|
|
61
|
+
self.httpx_client = HttpClient(
|
|
62
|
+
httpx_client=httpx_client,
|
|
63
|
+
base_headers=self.get_headers,
|
|
64
|
+
base_timeout=self.get_timeout,
|
|
65
|
+
base_url=self.get_base_url,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class AsyncClientWrapper(BaseClientWrapper):
|
|
70
|
+
def __init__(
|
|
71
|
+
self,
|
|
72
|
+
*,
|
|
73
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
74
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
75
|
+
base_url: str,
|
|
76
|
+
timeout: typing.Optional[float] = None,
|
|
77
|
+
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
|
|
78
|
+
httpx_client: httpx.AsyncClient,
|
|
79
|
+
):
|
|
80
|
+
super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
|
|
81
|
+
self._async_token = async_token
|
|
82
|
+
self.httpx_client = AsyncHttpClient(
|
|
83
|
+
httpx_client=httpx_client,
|
|
84
|
+
base_headers=self.get_headers,
|
|
85
|
+
base_timeout=self.get_timeout,
|
|
86
|
+
base_url=self.get_base_url,
|
|
87
|
+
async_base_headers=self.async_get_headers,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
async def async_get_headers(self) -> typing.Dict[str, str]:
|
|
91
|
+
headers = self.get_headers()
|
|
92
|
+
if self._async_token is not None:
|
|
93
|
+
token = await self._async_token()
|
|
94
|
+
headers["Authorization"] = f"Bearer {token}"
|
|
95
|
+
return headers
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Custom Pagination Support
|
|
5
|
+
|
|
6
|
+
This file is designed to be modified by SDK users to implement their own
|
|
7
|
+
pagination logic. The generator will import SyncCustomPager and AsyncCustomPager
|
|
8
|
+
from this module when custom pagination is used.
|
|
9
|
+
|
|
10
|
+
Users should:
|
|
11
|
+
1. Implement their custom pager (e.g., PayrocPager, MyCustomPager, etc.)
|
|
12
|
+
2. Create adapter classes (SyncCustomPager/AsyncCustomPager) that bridge
|
|
13
|
+
between the generated SDK code and their custom pager implementation
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from typing import Any, AsyncIterator, Generic, Iterator, TypeVar
|
|
19
|
+
|
|
20
|
+
# Import the base utilities you'll need
|
|
21
|
+
# Adjust these imports based on your actual structure
|
|
22
|
+
try:
|
|
23
|
+
from .client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
24
|
+
except ImportError:
|
|
25
|
+
# Fallback for type hints
|
|
26
|
+
AsyncClientWrapper = Any # type: ignore
|
|
27
|
+
SyncClientWrapper = Any # type: ignore
|
|
28
|
+
|
|
29
|
+
TItem = TypeVar("TItem")
|
|
30
|
+
TResponse = TypeVar("TResponse")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SyncCustomPager(Generic[TItem, TResponse]):
|
|
34
|
+
"""
|
|
35
|
+
Adapter for custom synchronous pagination.
|
|
36
|
+
|
|
37
|
+
The generator will call this with:
|
|
38
|
+
SyncCustomPager(initial_response=response, client_wrapper=client_wrapper)
|
|
39
|
+
|
|
40
|
+
Implement this class to extract pagination metadata from your response
|
|
41
|
+
and delegate to your custom pager implementation.
|
|
42
|
+
|
|
43
|
+
Example implementation:
|
|
44
|
+
|
|
45
|
+
class SyncCustomPager(Generic[TItem, TResponse]):
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
initial_response: TResponse,
|
|
50
|
+
client_wrapper: SyncClientWrapper,
|
|
51
|
+
):
|
|
52
|
+
# Extract data and pagination metadata from response
|
|
53
|
+
data = initial_response.data # Adjust based on your response structure
|
|
54
|
+
links = initial_response.links
|
|
55
|
+
|
|
56
|
+
# Initialize your custom pager
|
|
57
|
+
self._pager = MyCustomPager(
|
|
58
|
+
current_page=Page(data),
|
|
59
|
+
httpx_client=client_wrapper.httpx_client,
|
|
60
|
+
get_headers=client_wrapper.get_headers,
|
|
61
|
+
# ... other parameters
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def __iter__(self):
|
|
65
|
+
return iter(self._pager)
|
|
66
|
+
|
|
67
|
+
# Delegate other methods to your pager...
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
def __init__(
|
|
71
|
+
self,
|
|
72
|
+
*,
|
|
73
|
+
initial_response: TResponse,
|
|
74
|
+
client_wrapper: SyncClientWrapper,
|
|
75
|
+
):
|
|
76
|
+
"""
|
|
77
|
+
Initialize the custom pager.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
initial_response: The parsed API response from the first request
|
|
81
|
+
client_wrapper: The client wrapper providing HTTP client and utilities
|
|
82
|
+
"""
|
|
83
|
+
raise NotImplementedError(
|
|
84
|
+
"SyncCustomPager must be implemented. "
|
|
85
|
+
"Please implement this class in core/custom_pagination.py to define your pagination logic. "
|
|
86
|
+
"See the class docstring for examples."
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def __iter__(self) -> Iterator[TItem]:
|
|
90
|
+
"""Iterate through all items across all pages."""
|
|
91
|
+
raise NotImplementedError("Must implement __iter__ method")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class AsyncCustomPager(Generic[TItem, TResponse]):
|
|
95
|
+
"""
|
|
96
|
+
Adapter for custom asynchronous pagination.
|
|
97
|
+
|
|
98
|
+
The generator will call this with:
|
|
99
|
+
AsyncCustomPager(initial_response=response, client_wrapper=client_wrapper)
|
|
100
|
+
|
|
101
|
+
Implement this class to extract pagination metadata from your response
|
|
102
|
+
and delegate to your custom async pager implementation.
|
|
103
|
+
|
|
104
|
+
Example implementation:
|
|
105
|
+
|
|
106
|
+
class AsyncCustomPager(Generic[TItem, TResponse]):
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
*,
|
|
110
|
+
initial_response: TResponse,
|
|
111
|
+
client_wrapper: AsyncClientWrapper,
|
|
112
|
+
):
|
|
113
|
+
# Extract data and pagination metadata from response
|
|
114
|
+
data = initial_response.data # Adjust based on your response structure
|
|
115
|
+
links = initial_response.links
|
|
116
|
+
|
|
117
|
+
# Initialize your custom async pager
|
|
118
|
+
self._pager = MyAsyncCustomPager(
|
|
119
|
+
current_page=Page(data),
|
|
120
|
+
httpx_client=client_wrapper.httpx_client,
|
|
121
|
+
get_headers=client_wrapper.get_headers,
|
|
122
|
+
# ... other parameters
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
async def __aiter__(self):
|
|
126
|
+
return self._pager.__aiter__()
|
|
127
|
+
|
|
128
|
+
# Delegate other methods to your pager...
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
def __init__(
|
|
132
|
+
self,
|
|
133
|
+
*,
|
|
134
|
+
initial_response: TResponse,
|
|
135
|
+
client_wrapper: AsyncClientWrapper,
|
|
136
|
+
):
|
|
137
|
+
"""
|
|
138
|
+
Initialize the custom async pager.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
initial_response: The parsed API response from the first request
|
|
142
|
+
client_wrapper: The client wrapper providing HTTP client and utilities
|
|
143
|
+
"""
|
|
144
|
+
raise NotImplementedError(
|
|
145
|
+
"AsyncCustomPager must be implemented. "
|
|
146
|
+
"Please implement this class in core/custom_pagination.py to define your pagination logic. "
|
|
147
|
+
"See the class docstring for examples."
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
async def __aiter__(self) -> AsyncIterator[TItem]:
|
|
151
|
+
"""Asynchronously iterate through all items across all pages."""
|
|
152
|
+
raise NotImplementedError("Must implement __aiter__ method")
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def serialize_datetime(v: dt.datetime) -> str:
|
|
7
|
+
"""
|
|
8
|
+
Serialize a datetime including timezone info.
|
|
9
|
+
|
|
10
|
+
Uses the timezone info provided if present, otherwise uses the current runtime's timezone info.
|
|
11
|
+
|
|
12
|
+
UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def _serialize_zoned_datetime(v: dt.datetime) -> str:
|
|
16
|
+
if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None):
|
|
17
|
+
# UTC is a special case where we use "Z" at the end instead of "+00:00"
|
|
18
|
+
return v.isoformat().replace("+00:00", "Z")
|
|
19
|
+
else:
|
|
20
|
+
# Delegate to the typical +/- offset format
|
|
21
|
+
return v.isoformat()
|
|
22
|
+
|
|
23
|
+
if v.tzinfo is not None:
|
|
24
|
+
return _serialize_zoned_datetime(v)
|
|
25
|
+
else:
|
|
26
|
+
local_tz = dt.datetime.now().astimezone().tzinfo
|
|
27
|
+
localized_dt = v.replace(tzinfo=local_tz)
|
|
28
|
+
return _serialize_zoned_datetime(localized_dt)
|
frameio/core/file.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import IO, Dict, List, Mapping, Optional, Tuple, Union, cast
|
|
4
|
+
|
|
5
|
+
# File typing inspired by the flexibility of types within the httpx library
|
|
6
|
+
# https://github.com/encode/httpx/blob/master/httpx/_types.py
|
|
7
|
+
FileContent = Union[IO[bytes], bytes, str]
|
|
8
|
+
File = Union[
|
|
9
|
+
# file (or bytes)
|
|
10
|
+
FileContent,
|
|
11
|
+
# (filename, file (or bytes))
|
|
12
|
+
Tuple[Optional[str], FileContent],
|
|
13
|
+
# (filename, file (or bytes), content_type)
|
|
14
|
+
Tuple[Optional[str], FileContent, Optional[str]],
|
|
15
|
+
# (filename, file (or bytes), content_type, headers)
|
|
16
|
+
Tuple[
|
|
17
|
+
Optional[str],
|
|
18
|
+
FileContent,
|
|
19
|
+
Optional[str],
|
|
20
|
+
Mapping[str, str],
|
|
21
|
+
],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def convert_file_dict_to_httpx_tuples(
|
|
26
|
+
d: Dict[str, Union[File, List[File]]],
|
|
27
|
+
) -> List[Tuple[str, File]]:
|
|
28
|
+
"""
|
|
29
|
+
The format we use is a list of tuples, where the first element is the
|
|
30
|
+
name of the file and the second is the file object. Typically HTTPX wants
|
|
31
|
+
a dict, but to be able to send lists of files, you have to use the list
|
|
32
|
+
approach (which also works for non-lists)
|
|
33
|
+
https://github.com/encode/httpx/pull/1032
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
httpx_tuples = []
|
|
37
|
+
for key, file_like in d.items():
|
|
38
|
+
if isinstance(file_like, list):
|
|
39
|
+
for file_like_item in file_like:
|
|
40
|
+
httpx_tuples.append((key, file_like_item))
|
|
41
|
+
else:
|
|
42
|
+
httpx_tuples.append((key, file_like))
|
|
43
|
+
return httpx_tuples
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def with_content_type(*, file: File, default_content_type: str) -> File:
|
|
47
|
+
"""
|
|
48
|
+
This function resolves to the file's content type, if provided, and defaults
|
|
49
|
+
to the default_content_type value if not.
|
|
50
|
+
"""
|
|
51
|
+
if isinstance(file, tuple):
|
|
52
|
+
if len(file) == 2:
|
|
53
|
+
filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
|
|
54
|
+
return (filename, content, default_content_type)
|
|
55
|
+
elif len(file) == 3:
|
|
56
|
+
filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
|
|
57
|
+
out_content_type = file_content_type or default_content_type
|
|
58
|
+
return (filename, content, out_content_type)
|
|
59
|
+
elif len(file) == 4:
|
|
60
|
+
filename, content, file_content_type, headers = cast( # type: ignore
|
|
61
|
+
Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
|
|
62
|
+
)
|
|
63
|
+
out_content_type = file_content_type or default_content_type
|
|
64
|
+
return (filename, content, out_content_type, headers)
|
|
65
|
+
else:
|
|
66
|
+
raise ValueError(f"Unexpected tuple length: {len(file)}")
|
|
67
|
+
return (None, file, default_content_type)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ForceMultipartDict(Dict[str, Any]):
|
|
7
|
+
"""
|
|
8
|
+
A dictionary subclass that always evaluates to True in boolean contexts.
|
|
9
|
+
|
|
10
|
+
This is used to force multipart/form-data encoding in HTTP requests even when
|
|
11
|
+
the dictionary is empty, which would normally evaluate to False.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __bool__(self) -> bool:
|
|
15
|
+
return True
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
FORCE_MULTIPART = ForceMultipartDict()
|