From 2bdbd8ac933dc5f49fcb43ce0a7e26d8cd6fa36b Mon Sep 17 00:00:00 2001 From: box-sdk-build <94016436+box-sdk-build@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:33:29 +0100 Subject: [PATCH] codegen output 8e9394c88ed14011a6a3ba1f32637a8d (#40) * generated with codegen at box/box-codegen@01f57d4 and spec at box/box-openapi@644ca90 * generated with codegen at box/box-codegen@dfa481b7 and spec at box/box-openapi@f0ab5d7 * generated with codegen at box/box-codegen@dfa481b7 and spec at box/box-openapi@d4c873b * generated with codegen at box/box-codegen@ffe51a21 and spec at box/box-openapi@d4c873b --- box_sdk_gen/auth.py | 11 ++- box_sdk_gen/managers/avatars.py | 2 +- box_sdk_gen/managers/chunked_uploads.py | 6 +- box_sdk_gen/managers/classifications.py | 14 +-- .../collaboration_allowlist_entries.py | 2 +- .../collaboration_allowlist_exempt_targets.py | 2 +- box_sdk_gen/managers/comments.py | 4 +- box_sdk_gen/managers/email_aliases.py | 2 +- box_sdk_gen/managers/file_classifications.py | 2 +- box_sdk_gen/managers/file_requests.py | 4 +- box_sdk_gen/managers/file_versions.py | 4 +- box_sdk_gen/managers/file_watermarks.py | 2 +- box_sdk_gen/managers/files.py | 4 +- .../managers/folder_classifications.py | 2 +- box_sdk_gen/managers/folder_locks.py | 2 +- box_sdk_gen/managers/folder_watermarks.py | 2 +- box_sdk_gen/managers/folders.py | 6 +- box_sdk_gen/managers/groups.py | 4 +- box_sdk_gen/managers/integration_mappings.py | 4 +- box_sdk_gen/managers/invites.py | 2 +- box_sdk_gen/managers/legal_hold_policies.py | 4 +- .../managers/legal_hold_policy_assignments.py | 2 +- box_sdk_gen/managers/memberships.py | 4 +- .../managers/metadata_cascade_policies.py | 4 +- box_sdk_gen/managers/metadata_templates.py | 2 +- box_sdk_gen/managers/retention_policies.py | 4 +- .../managers/retention_policy_assignments.py | 2 +- box_sdk_gen/managers/search.py | 2 +- box_sdk_gen/managers/session_termination.py | 4 +- box_sdk_gen/managers/shared_links_files.py | 6 +- box_sdk_gen/managers/shared_links_folders.py | 6 +- .../managers/shared_links_web_links.py | 6 +- .../shield_information_barrier_reports.py | 2 +- ...eld_information_barrier_segment_members.py | 2 +- ...nformation_barrier_segment_restrictions.py | 2 +- .../shield_information_barrier_segments.py | 4 +- .../managers/shield_information_barriers.py | 4 +- box_sdk_gen/managers/sign_requests.py | 2 +- box_sdk_gen/managers/skills.py | 8 +- .../managers/storage_policy_assignments.py | 7 +- box_sdk_gen/managers/task_assignments.py | 4 +- box_sdk_gen/managers/tasks.py | 4 +- .../terms_of_service_user_statuses.py | 4 +- box_sdk_gen/managers/terms_of_services.py | 4 +- box_sdk_gen/managers/transfer.py | 2 +- box_sdk_gen/managers/trashed_files.py | 2 +- box_sdk_gen/managers/trashed_folders.py | 2 +- box_sdk_gen/managers/trashed_web_links.py | 8 +- box_sdk_gen/managers/uploads.py | 6 +- box_sdk_gen/managers/user_collaborations.py | 4 +- box_sdk_gen/managers/users.py | 4 +- box_sdk_gen/managers/web_links.py | 4 +- box_sdk_gen/managers/webhooks.py | 12 ++- box_sdk_gen/managers/workflows.py | 2 +- box_sdk_gen/managers/zip_downloads.py | 86 ++++++++++------ box_sdk_gen/schemas.py | 48 ++++----- docs/sign_templates.md | 12 ++- docs/trashed_web_links.md | 22 ++++- docs/web_links.md | 2 +- docs/zip_downloads.md | 53 ++++++++-- test/auth.py | 76 ++++++++------ test/avatars.py | 16 +-- test/chunked_uploads.py | 20 +--- test/collaboration_allowlist_entries.py | 22 +---- .../collaboration_allowlist_exempt_targets.py | 32 +++--- test/collections.py | 20 +--- test/comments.py | 22 ++--- test/commons.py | 45 ++++++--- test/downloads.py | 22 +---- test/email_aliases.py | 20 +--- test/file_metadata.py | 19 +--- test/file_versions.py | 20 +--- test/files.py | 30 ++---- test/folder_locks.py | 20 +--- test/folder_metadata.py | 21 +--- test/folders.py | 20 +--- test/groups.py | 20 +--- test/memberships.py | 20 +--- test/metadata_templates.py | 20 +--- test/recent_items.py | 17 +--- test/retention_policies.py | 36 +++---- test/search.py | 20 +--- test/sign_requests.py | 24 ++--- test/sign_templates.py | 31 ++++++ test/tasks.py | 20 +--- test/trashed_files.py | 20 +--- test/trashed_folders.py | 20 +--- test/trashed_web_links.py | 54 ++++++++++ test/uploads.py | 24 +---- test/users.py | 20 +--- test/webhooks.py | 20 +--- test/weblinks.py | 27 ++--- test/zip_downloads.py | 99 +++++++++++++++++++ 93 files changed, 684 insertions(+), 676 deletions(-) create mode 100644 test/sign_templates.py create mode 100644 test/trashed_web_links.py create mode 100644 test/zip_downloads.py diff --git a/box_sdk_gen/auth.py b/box_sdk_gen/auth.py index 60926b19..40d84298 100644 --- a/box_sdk_gen/auth.py +++ b/box_sdk_gen/auth.py @@ -1,11 +1,16 @@ -from abc import abstractmethod from typing import Optional -from .network import NetworkSession -from .schemas import AccessToken +from abc import abstractmethod + +from box_sdk_gen.schemas import AccessToken + +from box_sdk_gen.network import NetworkSession class Authentication: + def __init__(self): + pass + @abstractmethod def retrieve_token( self, network_session: Optional[NetworkSession] = None diff --git a/box_sdk_gen/managers/avatars.py b/box_sdk_gen/managers/avatars.py index 34628fef..0ad1fb5d 100644 --- a/box_sdk_gen/managers/avatars.py +++ b/box_sdk_gen/managers/avatars.py @@ -86,7 +86,7 @@ def create_user_avatar( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'pic': pic, 'pic_file_name': pic_file_name, 'pic_content_type': pic_content_type, diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py index dab717e8..e5045363 100644 --- a/box_sdk_gen/managers/chunked_uploads.py +++ b/box_sdk_gen/managers/chunked_uploads.py @@ -106,7 +106,7 @@ def create_file_upload_session( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'folder_id': folder_id, 'file_size': file_size, 'file_name': file_name, @@ -152,7 +152,7 @@ def create_file_upload_session_for_existing_file( """ if extra_headers is None: extra_headers = {} - request_body = {'file_size': file_size, 'file_name': file_name} + request_body: Dict = {'file_size': file_size, 'file_name': file_name} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( @@ -402,7 +402,7 @@ def create_file_upload_session_commit( """ if extra_headers is None: extra_headers = {} - request_body = {'parts': parts} + request_body: Dict = {'parts': parts} headers_map: Dict[str, str] = prepare_params( { 'digest': to_string(digest), diff --git a/box_sdk_gen/managers/classifications.py b/box_sdk_gen/managers/classifications.py index b97091d7..c996f624 100644 --- a/box_sdk_gen/managers/classifications.py +++ b/box_sdk_gen/managers/classifications.py @@ -50,7 +50,7 @@ class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBody def __init__( self, classification_definition: Optional[str] = None, - color_id: Optional[int] = None, + color_id: Optional[float] = None, **kwargs ): """ @@ -69,7 +69,7 @@ def __init__( * `5`: Dark blue * `6`: Light green * `7`: Gray - :type color_id: Optional[int], optional + :type color_id: Optional[float], optional """ super().__init__(**kwargs) self.classification_definition = classification_definition @@ -150,7 +150,7 @@ class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestB def __init__( self, classification_definition: Optional[str] = None, - color_id: Optional[int] = None, + color_id: Optional[float] = None, **kwargs ): """ @@ -169,7 +169,7 @@ def __init__( * `5`: Dark blue * `6`: Light green * `7`: Gray - :type color_id: Optional[int], optional + :type color_id: Optional[float], optional """ super().__init__(**kwargs) self.classification_definition = classification_definition @@ -308,7 +308,7 @@ class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfi def __init__( self, classification_definition: Optional[str] = None, - color_id: Optional[int] = None, + color_id: Optional[float] = None, **kwargs ): """ @@ -327,7 +327,7 @@ def __init__( * `5`: Dark blue * `6`: Light green * `7`: Gray - :type color_id: Optional[int], optional + :type color_id: Optional[float], optional """ super().__init__(**kwargs) self.classification_definition = classification_definition @@ -700,7 +700,7 @@ def create_metadata_template_schema_classification( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'scope': scope, 'templateKey': template_key, 'displayName': display_name, diff --git a/box_sdk_gen/managers/collaboration_allowlist_entries.py b/box_sdk_gen/managers/collaboration_allowlist_entries.py index 0ec78112..d288bf5d 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_entries.py +++ b/box_sdk_gen/managers/collaboration_allowlist_entries.py @@ -107,7 +107,7 @@ def create_collaboration_whitelist_entry( """ if extra_headers is None: extra_headers = {} - request_body = {'domain': domain, 'direction': direction} + request_body: Dict = {'domain': domain, 'direction': direction} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/collaboration_whitelist_entries']), diff --git a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py index 683b647d..fd1f5d07 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py +++ b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py @@ -108,7 +108,7 @@ def create_collaboration_whitelist_exempt_target( """ if extra_headers is None: extra_headers = {} - request_body = {'user': user} + request_body: Dict = {'user': user} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets']), diff --git a/box_sdk_gen/managers/comments.py b/box_sdk_gen/managers/comments.py index b92bbb31..22cf987a 100644 --- a/box_sdk_gen/managers/comments.py +++ b/box_sdk_gen/managers/comments.py @@ -199,7 +199,7 @@ def update_comment_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'message': message} + request_body: Dict = {'message': message} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -286,7 +286,7 @@ def create_comment( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'message': message, 'tagged_message': tagged_message, 'item': item, diff --git a/box_sdk_gen/managers/email_aliases.py b/box_sdk_gen/managers/email_aliases.py index d157425b..4731be9a 100644 --- a/box_sdk_gen/managers/email_aliases.py +++ b/box_sdk_gen/managers/email_aliases.py @@ -94,7 +94,7 @@ def create_user_email_alias( """ if extra_headers is None: extra_headers = {} - request_body = {'email': email} + request_body: Dict = {'email': email} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/file_classifications.py b/box_sdk_gen/managers/file_classifications.py index 052c0988..3b00e69e 100644 --- a/box_sdk_gen/managers/file_classifications.py +++ b/box_sdk_gen/managers/file_classifications.py @@ -174,7 +174,7 @@ def create_file_metadata_enterprise_security_classification( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'Box__Security__Classification__Key': box_security_classification_key } headers_map: Dict[str, str] = prepare_params({**extra_headers}) diff --git a/box_sdk_gen/managers/file_requests.py b/box_sdk_gen/managers/file_requests.py index 94ff7ef6..4b949482 100644 --- a/box_sdk_gen/managers/file_requests.py +++ b/box_sdk_gen/managers/file_requests.py @@ -184,7 +184,7 @@ def update_file_request_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'title': title, 'description': description, 'status': status, @@ -311,7 +311,7 @@ def create_file_request_copy( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'folder': folder, 'title': title, 'description': description, diff --git a/box_sdk_gen/managers/file_versions.py b/box_sdk_gen/managers/file_versions.py index f9e3c2fc..1f4472c7 100644 --- a/box_sdk_gen/managers/file_versions.py +++ b/box_sdk_gen/managers/file_versions.py @@ -212,7 +212,7 @@ def update_file_version_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'trashed_at': trashed_at} + request_body: Dict = {'trashed_at': trashed_at} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( @@ -361,7 +361,7 @@ def promote_file_version( """ if extra_headers is None: extra_headers = {} - request_body = {'id': id, 'type': type} + request_body: Dict = {'id': id, 'type': type} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/file_watermarks.py b/box_sdk_gen/managers/file_watermarks.py index 08fb894b..83b64250 100644 --- a/box_sdk_gen/managers/file_watermarks.py +++ b/box_sdk_gen/managers/file_watermarks.py @@ -113,7 +113,7 @@ def update_file_watermark( """ if extra_headers is None: extra_headers = {} - request_body = {'watermark': watermark} + request_body: Dict = {'watermark': watermark} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py index 64bc822c..4522f0eb 100644 --- a/box_sdk_gen/managers/files.py +++ b/box_sdk_gen/managers/files.py @@ -370,7 +370,7 @@ def update_file_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'description': description, 'parent': parent, @@ -496,7 +496,7 @@ def copy_file( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'version': version, 'parent': parent} + request_body: Dict = {'name': name, 'version': version, 'parent': parent} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/folder_classifications.py b/box_sdk_gen/managers/folder_classifications.py index 1933096e..5542356c 100644 --- a/box_sdk_gen/managers/folder_classifications.py +++ b/box_sdk_gen/managers/folder_classifications.py @@ -178,7 +178,7 @@ def create_folder_metadata_enterprise_security_classification( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'Box__Security__Classification__Key': box_security_classification_key } headers_map: Dict[str, str] = prepare_params({**extra_headers}) diff --git a/box_sdk_gen/managers/folder_locks.py b/box_sdk_gen/managers/folder_locks.py index 3b59b6e5..1c964b74 100644 --- a/box_sdk_gen/managers/folder_locks.py +++ b/box_sdk_gen/managers/folder_locks.py @@ -139,7 +139,7 @@ def create_folder_lock( """ if extra_headers is None: extra_headers = {} - request_body = {'locked_operations': locked_operations, 'folder': folder} + request_body: Dict = {'locked_operations': locked_operations, 'folder': folder} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/folder_locks']), diff --git a/box_sdk_gen/managers/folder_watermarks.py b/box_sdk_gen/managers/folder_watermarks.py index a2dcd700..6a8134fe 100644 --- a/box_sdk_gen/managers/folder_watermarks.py +++ b/box_sdk_gen/managers/folder_watermarks.py @@ -119,7 +119,7 @@ def update_folder_watermark( """ if extra_headers is None: extra_headers = {} - request_body = {'watermark': watermark} + request_body: Dict = {'watermark': watermark} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py index 5e486016..32fbb7bf 100644 --- a/box_sdk_gen/managers/folders.py +++ b/box_sdk_gen/managers/folders.py @@ -483,7 +483,7 @@ def update_folder_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'description': description, 'sync_state': sync_state, @@ -746,7 +746,7 @@ def create_folder( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'parent': parent, 'folder_upload_email': folder_upload_email, @@ -815,7 +815,7 @@ def copy_folder( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'parent': parent} + request_body: Dict = {'name': name, 'parent': parent} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/groups.py b/box_sdk_gen/managers/groups.py index 9683f9da..e01f663e 100644 --- a/box_sdk_gen/managers/groups.py +++ b/box_sdk_gen/managers/groups.py @@ -197,7 +197,7 @@ def create_group( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'provenance': provenance, 'external_sync_identifier': external_sync_identifier, @@ -345,7 +345,7 @@ def update_group_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'provenance': provenance, 'external_sync_identifier': external_sync_identifier, diff --git a/box_sdk_gen/managers/integration_mappings.py b/box_sdk_gen/managers/integration_mappings.py index 57600cc4..01899493 100644 --- a/box_sdk_gen/managers/integration_mappings.py +++ b/box_sdk_gen/managers/integration_mappings.py @@ -148,7 +148,7 @@ def create_integration_mapping_slack( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'partner_item': partner_item, 'box_item': box_item, 'options': options, @@ -194,7 +194,7 @@ def update_integration_mapping_slack_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'box_item': box_item, 'options': options} + request_body: Dict = {'box_item': box_item, 'options': options} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/invites.py b/box_sdk_gen/managers/invites.py index 17574cb7..ea06fa33 100644 --- a/box_sdk_gen/managers/invites.py +++ b/box_sdk_gen/managers/invites.py @@ -107,7 +107,7 @@ def create_invite( """ if extra_headers is None: extra_headers = {} - request_body = {'enterprise': enterprise, 'actionable_by': actionable_by} + request_body: Dict = {'enterprise': enterprise, 'actionable_by': actionable_by} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/legal_hold_policies.py b/box_sdk_gen/managers/legal_hold_policies.py index 8b208744..6a59823d 100644 --- a/box_sdk_gen/managers/legal_hold_policies.py +++ b/box_sdk_gen/managers/legal_hold_policies.py @@ -146,7 +146,7 @@ def create_legal_hold_policy( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'policy_name': policy_name, 'description': description, 'filter_started_at': filter_started_at, @@ -225,7 +225,7 @@ def update_legal_hold_policy_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'policy_name': policy_name, 'description': description, 'release_notes': release_notes, diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py index 58f9445c..577f12ca 100644 --- a/box_sdk_gen/managers/legal_hold_policy_assignments.py +++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py @@ -161,7 +161,7 @@ def create_legal_hold_policy_assignment( """ if extra_headers is None: extra_headers = {} - request_body = {'policy_id': policy_id, 'assign_to': assign_to} + request_body: Dict = {'policy_id': policy_id, 'assign_to': assign_to} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), diff --git a/box_sdk_gen/managers/memberships.py b/box_sdk_gen/managers/memberships.py index 9df98ba4..ee107f78 100644 --- a/box_sdk_gen/managers/memberships.py +++ b/box_sdk_gen/managers/memberships.py @@ -217,7 +217,7 @@ def create_group_membership( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'user': user, 'group': group, 'role': role, @@ -335,7 +335,7 @@ def update_group_membership_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'role': role, 'configurable_permissions': configurable_permissions, } diff --git a/box_sdk_gen/managers/metadata_cascade_policies.py b/box_sdk_gen/managers/metadata_cascade_policies.py index a89acadd..5ec67ca1 100644 --- a/box_sdk_gen/managers/metadata_cascade_policies.py +++ b/box_sdk_gen/managers/metadata_cascade_policies.py @@ -159,7 +159,7 @@ def create_metadata_cascade_policy( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'folder_id': folder_id, 'scope': scope, 'templateKey': template_key, @@ -277,7 +277,7 @@ def create_metadata_cascade_policy_apply( """ if extra_headers is None: extra_headers = {} - request_body = {'conflict_resolution': conflict_resolution} + request_body: Dict = {'conflict_resolution': conflict_resolution} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/metadata_templates.py b/box_sdk_gen/managers/metadata_templates.py index 8757a186..3e16774c 100644 --- a/box_sdk_gen/managers/metadata_templates.py +++ b/box_sdk_gen/managers/metadata_templates.py @@ -550,7 +550,7 @@ def create_metadata_template_schema( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'scope': scope, 'templateKey': template_key, 'displayName': display_name, diff --git a/box_sdk_gen/managers/retention_policies.py b/box_sdk_gen/managers/retention_policies.py index 326f8f01..8c6cc022 100644 --- a/box_sdk_gen/managers/retention_policies.py +++ b/box_sdk_gen/managers/retention_policies.py @@ -197,7 +197,7 @@ def create_retention_policy( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'policy_name': policy_name, 'description': description, 'policy_type': policy_type, @@ -344,7 +344,7 @@ def update_retention_policy_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'policy_name': policy_name, 'description': description, 'disposition_action': disposition_action, diff --git a/box_sdk_gen/managers/retention_policy_assignments.py b/box_sdk_gen/managers/retention_policy_assignments.py index 33ca35ef..3e3624a9 100644 --- a/box_sdk_gen/managers/retention_policy_assignments.py +++ b/box_sdk_gen/managers/retention_policy_assignments.py @@ -192,7 +192,7 @@ def create_retention_policy_assignment( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'policy_id': policy_id, 'assign_to': assign_to, 'filter_fields': filter_fields, diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index 0cd7831c..99eb2d23 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -203,7 +203,7 @@ def create_metadata_query_execute_read( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'from': from_, 'query': query, 'query_params': query_params, diff --git a/box_sdk_gen/managers/session_termination.py b/box_sdk_gen/managers/session_termination.py index affef00d..23f898fe 100644 --- a/box_sdk_gen/managers/session_termination.py +++ b/box_sdk_gen/managers/session_termination.py @@ -64,7 +64,7 @@ def create_user_terminate_session( """ if extra_headers is None: extra_headers = {} - request_body = {'user_ids': user_ids, 'user_logins': user_logins} + request_body: Dict = {'user_ids': user_ids, 'user_logins': user_logins} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/users/terminate_sessions']), @@ -103,7 +103,7 @@ def create_group_terminate_session( """ if extra_headers is None: extra_headers = {} - request_body = {'group_ids': group_ids} + request_body: Dict = {'group_ids': group_ids} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/groups/terminate_sessions']), diff --git a/box_sdk_gen/managers/shared_links_files.py b/box_sdk_gen/managers/shared_links_files.py index 1a94dd62..1f0a4683 100644 --- a/box_sdk_gen/managers/shared_links_files.py +++ b/box_sdk_gen/managers/shared_links_files.py @@ -370,7 +370,7 @@ def update_file_add_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -421,7 +421,7 @@ def update_file_update_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -473,7 +473,7 @@ def update_file_remove_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/shared_links_folders.py b/box_sdk_gen/managers/shared_links_folders.py index 2cb65200..59539835 100644 --- a/box_sdk_gen/managers/shared_links_folders.py +++ b/box_sdk_gen/managers/shared_links_folders.py @@ -362,7 +362,7 @@ def update_folder_add_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -415,7 +415,7 @@ def update_folder_update_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -469,7 +469,7 @@ def update_folder_remove_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/shared_links_web_links.py b/box_sdk_gen/managers/shared_links_web_links.py index a8e57a22..9aa36b20 100644 --- a/box_sdk_gen/managers/shared_links_web_links.py +++ b/box_sdk_gen/managers/shared_links_web_links.py @@ -346,7 +346,7 @@ def update_web_link_add_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -392,7 +392,7 @@ def update_web_link_update_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( @@ -439,7 +439,7 @@ def update_web_link_remove_shared_link( """ if extra_headers is None: extra_headers = {} - request_body = {'shared_link': shared_link} + request_body: Dict = {'shared_link': shared_link} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/shield_information_barrier_reports.py b/box_sdk_gen/managers/shield_information_barrier_reports.py index 9484cd81..f51290d8 100644 --- a/box_sdk_gen/managers/shield_information_barrier_reports.py +++ b/box_sdk_gen/managers/shield_information_barrier_reports.py @@ -101,7 +101,7 @@ def create_shield_information_barrier_report( """ if extra_headers is None: extra_headers = {} - request_body = {'shield_information_barrier': shield_information_barrier} + request_body: Dict = {'shield_information_barrier': shield_information_barrier} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), diff --git a/box_sdk_gen/managers/shield_information_barrier_segment_members.py b/box_sdk_gen/managers/shield_information_barrier_segment_members.py index 56967206..3dc722ee 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_members.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_members.py @@ -227,7 +227,7 @@ def create_shield_information_barrier_segment_member( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'type': type, 'shield_information_barrier': shield_information_barrier, 'shield_information_barrier_segment': shield_information_barrier_segment, diff --git a/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py index 72fea47c..bf6de874 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py @@ -260,7 +260,7 @@ def create_shield_information_barrier_segment_restriction( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'type': type, 'shield_information_barrier': shield_information_barrier, 'shield_information_barrier_segment': shield_information_barrier_segment, diff --git a/box_sdk_gen/managers/shield_information_barrier_segments.py b/box_sdk_gen/managers/shield_information_barrier_segments.py index 826c77d3..7d9ad4af 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segments.py +++ b/box_sdk_gen/managers/shield_information_barrier_segments.py @@ -97,7 +97,7 @@ def update_shield_information_barrier_segment_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'description': description} + request_body: Dict = {'name': name, 'description': description} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( @@ -220,7 +220,7 @@ def create_shield_information_barrier_segment( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'shield_information_barrier': shield_information_barrier, 'name': name, 'description': description, diff --git a/box_sdk_gen/managers/shield_information_barriers.py b/box_sdk_gen/managers/shield_information_barriers.py index 25ecbd4d..ffb9a833 100644 --- a/box_sdk_gen/managers/shield_information_barriers.py +++ b/box_sdk_gen/managers/shield_information_barriers.py @@ -99,7 +99,7 @@ def create_shield_information_barrier_change_status( """ if extra_headers is None: extra_headers = {} - request_body = {'id': id, 'status': status} + request_body: Dict = {'id': id, 'status': status} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( @@ -175,7 +175,7 @@ def create_shield_information_barrier( """ if extra_headers is None: extra_headers = {} - request_body = {'enterprise': enterprise} + request_body: Dict = {'enterprise': enterprise} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/shield_information_barriers']), diff --git a/box_sdk_gen/managers/sign_requests.py b/box_sdk_gen/managers/sign_requests.py index a40e9a65..04e2fcb9 100644 --- a/box_sdk_gen/managers/sign_requests.py +++ b/box_sdk_gen/managers/sign_requests.py @@ -260,7 +260,7 @@ def create_sign_request( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'source_files': source_files, 'signature_color': signature_color, 'signers': signers, diff --git a/box_sdk_gen/managers/skills.py b/box_sdk_gen/managers/skills.py index 4fa729f6..5a531125 100644 --- a/box_sdk_gen/managers/skills.py +++ b/box_sdk_gen/managers/skills.py @@ -155,13 +155,13 @@ def __init__( class UpdateSkillInvocationByIdUsageArg(BaseObject): def __init__( - self, unit: Optional[str] = None, value: Optional[int] = None, **kwargs + self, unit: Optional[str] = None, value: Optional[float] = None, **kwargs ): """ :param unit: `file` :type unit: Optional[str], optional :param value: `1` - :type value: Optional[int], optional + :type value: Optional[float], optional """ super().__init__(**kwargs) self.unit = unit @@ -244,7 +244,7 @@ def create_file_metadata_global_box_skills_card( """ if extra_headers is None: extra_headers = {} - request_body = {'cards': cards} + request_body: Dict = {'cards': cards} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( @@ -384,7 +384,7 @@ def update_skill_invocation_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'status': status, 'metadata': metadata, 'file': file, diff --git a/box_sdk_gen/managers/storage_policy_assignments.py b/box_sdk_gen/managers/storage_policy_assignments.py index 0bc0be68..dbc8ff2c 100644 --- a/box_sdk_gen/managers/storage_policy_assignments.py +++ b/box_sdk_gen/managers/storage_policy_assignments.py @@ -178,7 +178,10 @@ def create_storage_policy_assignment( """ if extra_headers is None: extra_headers = {} - request_body = {'storage_policy': storage_policy, 'assigned_to': assigned_to} + request_body: Dict = { + 'storage_policy': storage_policy, + 'assigned_to': assigned_to, + } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/storage_policy_assignments']), @@ -246,7 +249,7 @@ def update_storage_policy_assignment_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'storage_policy': storage_policy} + request_body: Dict = {'storage_policy': storage_policy} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/task_assignments.py b/box_sdk_gen/managers/task_assignments.py index 6948d5ef..50f83636 100644 --- a/box_sdk_gen/managers/task_assignments.py +++ b/box_sdk_gen/managers/task_assignments.py @@ -136,7 +136,7 @@ def create_task_assignment( """ if extra_headers is None: extra_headers = {} - request_body = {'task': task, 'assign_to': assign_to} + request_body: Dict = {'task': task, 'assign_to': assign_to} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/task_assignments']), @@ -213,7 +213,7 @@ def update_task_assignment_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'message': message, 'resolution_state': resolution_state} + request_body: Dict = {'message': message, 'resolution_state': resolution_state} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/tasks.py b/box_sdk_gen/managers/tasks.py index 07f17fe6..bb63b8cc 100644 --- a/box_sdk_gen/managers/tasks.py +++ b/box_sdk_gen/managers/tasks.py @@ -158,7 +158,7 @@ def create_task( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'item': item, 'action': action, 'message': message, @@ -244,7 +244,7 @@ def update_task_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'action': action, 'message': message, 'due_at': due_at, diff --git a/box_sdk_gen/managers/terms_of_service_user_statuses.py b/box_sdk_gen/managers/terms_of_service_user_statuses.py index cd3d7e57..9a9cb9a6 100644 --- a/box_sdk_gen/managers/terms_of_service_user_statuses.py +++ b/box_sdk_gen/managers/terms_of_service_user_statuses.py @@ -142,7 +142,7 @@ def create_term_of_service_user_status( """ if extra_headers is None: extra_headers = {} - request_body = {'tos': tos, 'user': user, 'is_accepted': is_accepted} + request_body: Dict = {'tos': tos, 'user': user, 'is_accepted': is_accepted} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/terms_of_service_user_statuses']), @@ -176,7 +176,7 @@ def update_term_of_service_user_status_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'is_accepted': is_accepted} + request_body: Dict = {'is_accepted': is_accepted} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/terms_of_services.py b/box_sdk_gen/managers/terms_of_services.py index a282f42f..9de94dbd 100644 --- a/box_sdk_gen/managers/terms_of_services.py +++ b/box_sdk_gen/managers/terms_of_services.py @@ -123,7 +123,7 @@ def create_term_of_service( """ if extra_headers is None: extra_headers = {} - request_body = {'status': status, 'tos_type': tos_type, 'text': text} + request_body: Dict = {'status': status, 'tos_type': tos_type, 'text': text} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/terms_of_services']), @@ -194,7 +194,7 @@ def update_term_of_service_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'status': status, 'text': text} + request_body: Dict = {'status': status, 'text': text} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join( diff --git a/box_sdk_gen/managers/transfer.py b/box_sdk_gen/managers/transfer.py index ec289653..f208f981 100644 --- a/box_sdk_gen/managers/transfer.py +++ b/box_sdk_gen/managers/transfer.py @@ -151,7 +151,7 @@ def transfer_owned_folder( """ if extra_headers is None: extra_headers = {} - request_body = {'owned_by': owned_by} + request_body: Dict = {'owned_by': owned_by} query_params_map: Dict[str, str] = prepare_params( {'fields': to_string(fields), 'notify': to_string(notify)} ) diff --git a/box_sdk_gen/managers/trashed_files.py b/box_sdk_gen/managers/trashed_files.py index 78eafb03..f34871ea 100644 --- a/box_sdk_gen/managers/trashed_files.py +++ b/box_sdk_gen/managers/trashed_files.py @@ -94,7 +94,7 @@ def restore_file_from_trash( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'parent': parent} + request_body: Dict = {'name': name, 'parent': parent} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/trashed_folders.py b/box_sdk_gen/managers/trashed_folders.py index 8bd4590c..0640cfaf 100644 --- a/box_sdk_gen/managers/trashed_folders.py +++ b/box_sdk_gen/managers/trashed_folders.py @@ -114,7 +114,7 @@ def restore_folder_from_trash( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'parent': parent} + request_body: Dict = {'name': name, 'parent': parent} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/trashed_web_links.py b/box_sdk_gen/managers/trashed_web_links.py index e3ed758d..a99cb31f 100644 --- a/box_sdk_gen/managers/trashed_web_links.py +++ b/box_sdk_gen/managers/trashed_web_links.py @@ -35,7 +35,7 @@ from box_sdk_gen.fetch import FetchResponse -class CreateWebLinkByIdParentArg(BaseObject): +class RestoreWeblinkFromTrashParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -54,11 +54,11 @@ def __init__( self.auth = auth self.network_session = network_session - def create_web_link_by_id( + def restore_weblink_from_trash( self, web_link_id: str, name: Optional[str] = None, - parent: Optional[CreateWebLinkByIdParentArg] = None, + parent: Optional[RestoreWeblinkFromTrashParentArg] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TrashWebLinkRestored: @@ -89,7 +89,7 @@ def create_web_link_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'parent': parent} + request_body: Dict = {'name': name, 'parent': parent} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( diff --git a/box_sdk_gen/managers/uploads.py b/box_sdk_gen/managers/uploads.py index d9c64ae8..0b705e45 100644 --- a/box_sdk_gen/managers/uploads.py +++ b/box_sdk_gen/managers/uploads.py @@ -194,7 +194,7 @@ def upload_file_version( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'attributes': attributes, 'file': file, 'file_file_name': file_file_name, @@ -305,7 +305,7 @@ def upload_file( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'attributes': attributes, 'file': file, 'file_file_name': file_file_name, @@ -362,7 +362,7 @@ def preflight_file_upload( """ if extra_headers is None: extra_headers = {} - request_body = {'name': name, 'size': size, 'parent': parent} + request_body: Dict = {'name': name, 'size': size, 'parent': parent} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/files/content']), diff --git a/box_sdk_gen/managers/user_collaborations.py b/box_sdk_gen/managers/user_collaborations.py index 7010f2c7..80af618a 100644 --- a/box_sdk_gen/managers/user_collaborations.py +++ b/box_sdk_gen/managers/user_collaborations.py @@ -221,7 +221,7 @@ def update_collaboration_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'role': role, 'status': status, 'expires_at': expires_at, @@ -367,7 +367,7 @@ def create_collaboration( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'item': item, 'accessible_by': accessible_by, 'role': role, diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py index 3ee166fc..034e8c52 100644 --- a/box_sdk_gen/managers/users.py +++ b/box_sdk_gen/managers/users.py @@ -291,7 +291,7 @@ def create_user( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'name': name, 'login': login, 'is_platform_access_only': is_platform_access_only, @@ -559,7 +559,7 @@ def update_user_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'enterprise': enterprise, 'notify': notify, 'name': name, diff --git a/box_sdk_gen/managers/web_links.py b/box_sdk_gen/managers/web_links.py index 6a639dec..4f7a4671 100644 --- a/box_sdk_gen/managers/web_links.py +++ b/box_sdk_gen/managers/web_links.py @@ -139,7 +139,7 @@ def create_web_link( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'url': url, 'parent': parent, 'name': name, @@ -228,7 +228,7 @@ def update_web_link_by_id( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'url': url, 'parent': parent, 'name': name, diff --git a/box_sdk_gen/managers/webhooks.py b/box_sdk_gen/managers/webhooks.py index ccdc4607..1f789d80 100644 --- a/box_sdk_gen/managers/webhooks.py +++ b/box_sdk_gen/managers/webhooks.py @@ -247,7 +247,11 @@ def create_webhook( """ if extra_headers is None: extra_headers = {} - request_body = {'target': target, 'address': address, 'triggers': triggers} + request_body: Dict = { + 'target': target, + 'address': address, + 'triggers': triggers, + } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/webhooks']), @@ -314,7 +318,11 @@ def update_webhook_by_id( """ if extra_headers is None: extra_headers = {} - request_body = {'target': target, 'address': address, 'triggers': triggers} + request_body: Dict = { + 'target': target, + 'address': address, + 'triggers': triggers, + } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/webhooks/', to_string(webhook_id)]), diff --git a/box_sdk_gen/managers/workflows.py b/box_sdk_gen/managers/workflows.py index a0634102..539a8383 100644 --- a/box_sdk_gen/managers/workflows.py +++ b/box_sdk_gen/managers/workflows.py @@ -233,7 +233,7 @@ def create_workflow_start( """ if extra_headers is None: extra_headers = {} - request_body = { + request_body: Dict = { 'type': type, 'flow': flow, 'files': files, diff --git a/box_sdk_gen/managers/zip_downloads.py b/box_sdk_gen/managers/zip_downloads.py index bd80cfe0..52997366 100644 --- a/box_sdk_gen/managers/zip_downloads.py +++ b/box_sdk_gen/managers/zip_downloads.py @@ -12,8 +12,6 @@ from box_sdk_gen.serialization import deserialize -from box_sdk_gen.utils import to_string - from box_sdk_gen.schemas import ZipDownload from box_sdk_gen.schemas import ClientError @@ -41,7 +39,7 @@ class CreateZipDownloadItemsArgTypeField(str, Enum): FILE = 'file' - FOLDER_ = 'folder.' + FOLDER = 'folder' class CreateZipDownloadItemsArg(BaseObject): @@ -58,6 +56,25 @@ def __init__(self, type: CreateZipDownloadItemsArgTypeField, id: str, **kwargs): self.id = id +class DownloadZipItemsArgTypeField(str, Enum): + FILE = 'file' + FOLDER = 'folder' + + +class DownloadZipItemsArg(BaseObject): + def __init__(self, type: DownloadZipItemsArgTypeField, id: str, **kwargs): + """ + :param type: The type of the item to add to the archive. + :type type: DownloadZipItemsArgTypeField + :param id: The identifier of the item to add to the archive. When this item is + a folder then this can not be the root folder with ID `0`. + :type id: str + """ + super().__init__(**kwargs) + self.type = type + self.id = id + + class ZipDownloadsManager: def __init__( self, @@ -125,7 +142,7 @@ def create_zip_download( """ if extra_headers is None: extra_headers = {} - request_body = {'items': items, 'download_file_name': download_file_name} + request_body: Dict = {'items': items, 'download_file_name': download_file_name} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join(['https://api.box.com/2.0/zip_downloads']), @@ -143,7 +160,7 @@ def create_zip_download( def get_zip_download_content( self, - zip_download_id: str, + download_url: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ByteStream: """ @@ -178,9 +195,9 @@ def get_zip_download_content( this endpoint. - :param zip_download_id: The unique identifier that represent this `zip` archive. - Example: "Lu6fA9Ob-jyysp3AAvMF4AkLEwZwAYbL=tgj2zIC=eK9RvJnJbjJl9rNh2qBgHDpyOCAOhpM=vajg2mKq8Mdd" - :type zip_download_id: str + :param download_url: The URL that can be used to download created `zip` archive. + Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/content` + :type download_url: str :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -188,13 +205,7 @@ def get_zip_download_content( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join( - [ - 'https://dl.boxcloud.com/2.0/zip_downloads/', - to_string(zip_download_id), - '/content', - ] - ), + download_url, FetchOptions( method='GET', headers=headers_map, @@ -206,9 +217,7 @@ def get_zip_download_content( return response.content def get_zip_download_status( - self, - zip_download_id: str, - extra_headers: Optional[Dict[str, Optional[str]]] = None, + self, status_url: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> ZipDownloadStatus: """ Returns the download status of a `zip` archive, allowing an application to @@ -239,9 +248,9 @@ def get_zip_download_status( this endpoint. - :param zip_download_id: The unique identifier that represent this `zip` archive. - Example: "Lu6fA9Ob-jyysp3AAvMF4AkLEwZwAYbL=tgj2zIC=eK9RvJnJbjJl9rNh2qBgHDpyOCAOhpM=vajg2mKq8Mdd" - :type zip_download_id: str + :param status_url: The URL that can be used to get the status of the `zip` archive being downloaded. + Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/status` + :type status_url: str :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -249,13 +258,7 @@ def get_zip_download_status( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join( - [ - 'https://api.box.com/2.0/zip_downloads/', - to_string(zip_download_id), - '/status', - ] - ), + status_url, FetchOptions( method='GET', headers=headers_map, @@ -265,3 +268,30 @@ def get_zip_download_status( ), ) return deserialize(response.text, ZipDownloadStatus) + + def download_zip( + self, + items: List[DownloadZipItemsArg], + download_file_name: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ByteStream: + """ + Creates a zip and downloads its content + :param items: A list of items to add to the `zip` archive. These can + be folders or files. + :type items: List[DownloadZipItemsArg] + :param download_file_name: The optional name of the `zip` archive. This name will be appended by the + `.zip` file extension, for example `January Financials.zip`. + :type download_file_name: Optional[str], optional + :param extra_headers: Extra headers that will be included in the HTTP request. + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = {'items': items, 'download_file_name': download_file_name} + zip_download_session: ZipDownload = self.create_zip_download( + request_body['items'], request_body['download_file_name'], extra_headers + ) + return self.get_zip_download_content( + zip_download_session.download_url, extra_headers + ) diff --git a/box_sdk_gen/schemas.py b/box_sdk_gen/schemas.py index b5e3ae50..1f2bd640 100644 --- a/box_sdk_gen/schemas.py +++ b/box_sdk_gen/schemas.py @@ -195,7 +195,7 @@ def __init__( class ZipDownloadRequestItemsFieldTypeField(str, Enum): FILE = 'file' - FOLDER_ = 'folder.' + FOLDER = 'folder' class ZipDownloadRequestItemsField(BaseObject): @@ -614,7 +614,7 @@ def __init__( scope: Optional[str] = None, version: Optional[int] = None, type: Optional[str] = None, - type_version: Optional[int] = None, + type_version: Optional[float] = None, can_edit: Optional[bool] = None, **kwargs ): @@ -640,7 +640,7 @@ def __init__( :param type_version: The version of the metadata template. This version starts at 0 and increases every time the template is updated. This is mostly for internal use. - :type type_version: Optional[int], optional + :type type_version: Optional[float], optional :param can_edit: Whether an end user can change the classification. :type can_edit: Optional[bool], optional """ @@ -696,7 +696,7 @@ class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificati def __init__( self, classification_definition: Optional[str] = None, - color_id: Optional[int] = None, + color_id: Optional[float] = None, **kwargs ): """ @@ -715,7 +715,7 @@ def __init__( * `5`: Dark blue * `6`: Light green * `7`: Gray - :type color_id: Optional[int], optional + :type color_id: Optional[float], optional """ super().__init__(**kwargs) self.classification_definition = classification_definition @@ -5547,11 +5547,11 @@ class FileRequestStatusField(str, Enum): class FileRequest(BaseObject): def __init__( self, + id: str, + type: FileRequestTypeField, folder: FolderMini, created_at: str, updated_at: str, - id: Optional[str] = None, - type: Optional[FileRequestTypeField] = None, title: Optional[str] = None, description: Optional[str] = None, status: Optional[FileRequestStatusField] = None, @@ -5565,14 +5565,14 @@ def __init__( **kwargs ): """ + :param id: The unique identifier for this file request. + :type id: str + :param type: `file_request` + :type type: FileRequestTypeField :param created_at: The date and time when the file request was created. :type created_at: str :param updated_at: The date and time when the file request was last updated. :type updated_at: str - :param id: The unique identifier for this file request. - :type id: Optional[str], optional - :param type: `file_request` - :type type: Optional[FileRequestTypeField], optional :param title: The title of file request. This is shown in the Box UI to users uploading files. This defaults to title of the file request that was @@ -5622,11 +5622,11 @@ def __init__( :type etag: Optional[str], optional """ super().__init__(**kwargs) + self.id = id + self.type = type self.folder = folder self.created_at = created_at self.updated_at = updated_at - self.id = id - self.type = type self.title = title self.description = description self.status = status @@ -9752,7 +9752,7 @@ def __init__( class ZipDownloadStatusStateField(str, Enum): IN_PROGRESS = 'in_progress' FAILED = 'failed' - SUCCESS = 'success' + SUCCEEDED = 'succeeded' class ZipDownloadStatus(BaseObject): @@ -11212,12 +11212,12 @@ class TemplateSignerInputContentTypeField(str, Enum): class TemplateSignerInputCoordinatesField(BaseObject): - def __init__(self, x: Optional[int] = None, y: Optional[int] = None, **kwargs): + def __init__(self, x: Optional[float] = None, y: Optional[float] = None, **kwargs): """ :param x: Relative x coordinate to the page the input is on, ranging from 0 to 1. - :type x: Optional[int], optional + :type x: Optional[float], optional :param y: Relative y coordinate to the page the input is on, ranging from 0 to 1. - :type y: Optional[int], optional + :type y: Optional[float], optional """ super().__init__(**kwargs) self.x = x @@ -11226,13 +11226,13 @@ def __init__(self, x: Optional[int] = None, y: Optional[int] = None, **kwargs): class TemplateSignerInputDimensionsField(BaseObject): def __init__( - self, width: Optional[int] = None, height: Optional[int] = None, **kwargs + self, width: Optional[float] = None, height: Optional[float] = None, **kwargs ): """ :param width: Relative width to the page the input is on, ranging from 0 to 1. - :type width: Optional[int], optional + :type width: Optional[float], optional :param height: Relative height to the page the input is on, ranging from 0 to 1. - :type height: Optional[int], optional + :type height: Optional[float], optional """ super().__init__(**kwargs) self.width = width @@ -11868,18 +11868,20 @@ class MetadataFieldFilterMultiSelect(BaseObject): class MetadataFieldFilterFloatRangeMapValue(BaseObject): - def __init__(self, lt: Optional[int] = None, gt: Optional[int] = None, **kwargs): + def __init__( + self, lt: Optional[float] = None, gt: Optional[float] = None, **kwargs + ): """ :param lt: Specifies the (inclusive) upper bound for the metadata field value. The value of a field must be lower than (`lt`) or equal to this value for the search query to match this template. - :type lt: Optional[int], optional + :type lt: Optional[float], optional :param gt: Specifies the (inclusive) lower bound for the metadata field value. The value of a field must be greater than (`gt`) or equal to this value for the search query to match this template. - :type gt: Optional[int], optional + :type gt: Optional[float], optional """ super().__init__(**kwargs) self.lt = lt diff --git a/docs/sign_templates.md b/docs/sign_templates.md index 0a091e05..d54eed1a 100644 --- a/docs/sign_templates.md +++ b/docs/sign_templates.md @@ -12,7 +12,11 @@ This operation is performed by calling function `get_sign_templates`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-sign-templates/). -_Currently we don't have an example for calling `get_sign_templates` in integration tests_ + + +```python +client.sign_templates.get_sign_templates(limit=2) +``` ### Arguments @@ -38,7 +42,11 @@ This operation is performed by calling function `get_sign_template_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-sign-templates-id/). -_Currently we don't have an example for calling `get_sign_template_by_id` in integration tests_ + + +```python +client.sign_templates.get_sign_template_by_id(template_id=sign_templates.entries[0].id) +``` ### Arguments diff --git a/docs/trashed_web_links.md b/docs/trashed_web_links.md index e26eb0b5..92acfb85 100644 --- a/docs/trashed_web_links.md +++ b/docs/trashed_web_links.md @@ -11,12 +11,16 @@ Restores a web link that has been moved to the trash. An optional new parent ID can be provided to restore the web link to in case the original folder has been deleted. -This operation is performed by calling function `create_web_link_by_id`. +This operation is performed by calling function `restore_weblink_from_trash`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-web-links-id/). -_Currently we don't have an example for calling `create_web_link_by_id` in integration tests_ + + +```python +client.trashed_web_links.restore_weblink_from_trash(web_link_id=weblink.id) +``` ### Arguments @@ -24,7 +28,7 @@ _Currently we don't have an example for calling `create_web_link_by_id` in integ - The ID of the web link. Example: "12345" - name `Optional[str]` - An optional new name for the web link. -- parent `Optional[CreateWebLinkByIdParentArg]` +- parent `Optional[RestoreWeblinkFromTrashParentArg]` - - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -46,7 +50,11 @@ This operation is performed by calling function `get_web_link_trash`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-web-links-id-trash/). -_Currently we don't have an example for calling `get_web_link_trash` in integration tests_ + + +```python +client.trashed_web_links.get_web_link_trash(web_link_id=weblink.id) +``` ### Arguments @@ -75,7 +83,11 @@ This operation is performed by calling function `delete_web_link_trash`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-web-links-id-trash/). -_Currently we don't have an example for calling `delete_web_link_trash` in integration tests_ + + +```python +client.trashed_web_links.delete_web_link_trash(web_link_id=weblink.id) +``` ### Arguments diff --git a/docs/web_links.md b/docs/web_links.md index fcbdef88..11ca754e 100644 --- a/docs/web_links.md +++ b/docs/web_links.md @@ -17,7 +17,7 @@ See the endpoint docs at ```python -client.web_links.create_web_link(url=url, parent=parent, name=name, description=description) +client.web_links.create_web_link(url=url, parent=CreateWebLinkParentArg(id=parent.id), name=name, description=description) ``` ### Arguments diff --git a/docs/zip_downloads.md b/docs/zip_downloads.md index 4bfc2a02..d109bba9 100644 --- a/docs/zip_downloads.md +++ b/docs/zip_downloads.md @@ -3,6 +3,7 @@ - [Create zip download](#create-zip-download) - [Download zip archive](#download-zip-archive) - [Get zip download status](#get-zip-download-status) +- [](#) ## Create zip download @@ -28,7 +29,11 @@ This operation is performed by calling function `create_zip_download`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-zip-downloads/). -_Currently we don't have an example for calling `create_zip_download` in integration tests_ + + +```python +client.zip_downloads.create_zip_download(items=[CreateZipDownloadItemsArg(id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value), CreateZipDownloadItemsArg(id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value), CreateZipDownloadItemsArg(id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value)], download_file_name='zip') +``` ### Arguments @@ -68,12 +73,16 @@ This operation is performed by calling function `get_zip_download_content`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-zip-downloads-id-content/). -_Currently we don't have an example for calling `get_zip_download_content` in integration tests_ + + +```python +client.zip_downloads.get_zip_download_content(download_url=zip_download.download_url) +``` ### Arguments -- zip_download_id `str` - - The unique identifier that represent this `zip` archive. Example: "Lu6fA9Ob-jyysp3AAvMF4AkLEwZwAYbL=tgj2zIC=eK9RvJnJbjJl9rNh2qBgHDpyOCAOhpM=vajg2mKq8Mdd" +- download_url `str` + - The URL that can be used to download created `zip` archive. Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/content` - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -104,12 +113,16 @@ This operation is performed by calling function `get_zip_download_status`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-zip-downloads-id-status/). -_Currently we don't have an example for calling `get_zip_download_status` in integration tests_ + + +```python +client.zip_downloads.get_zip_download_status(status_url=zip_download.status_url) +``` ### Arguments -- zip_download_id `str` - - The unique identifier that represent this `zip` archive. Example: "Lu6fA9Ob-jyysp3AAvMF4AkLEwZwAYbL=tgj2zIC=eK9RvJnJbjJl9rNh2qBgHDpyOCAOhpM=vajg2mKq8Mdd" +- status_url `str` + - The URL that can be used to get the status of the `zip` archive being downloaded. Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/status` - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -118,3 +131,29 @@ _Currently we don't have an example for calling `get_zip_download_status` in int This function returns a value of type `ZipDownloadStatus`. Returns the status of the `zip` archive that is being downloaded. + +## + +This operation is performed by calling function `download_zip`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference//). + + + +```python +client.zip_downloads.download_zip(items=[DownloadZipItemsArg(id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value), DownloadZipItemsArg(id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value), DownloadZipItemsArg(id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value)], download_file_name='zip') +``` + +### Arguments + +- items `List[DownloadZipItemsArg]` + - A list of items to add to the `zip` archive. These can be folders or files. +- download_file_name `Optional[str]` + - The optional name of the `zip` archive. This name will be appended by the `.zip` file extension, for example `January Financials.zip`. +- extra_headers `Optional[Dict[str, Optional[str]]]` + - Extra headers that will be included in the HTTP request. + +### Returns + +This function returns a value of type `ByteStream`. diff --git a/test/auth.py b/test/auth.py index f64bda70..6b32e674 100644 --- a/test/auth.py +++ b/test/auth.py @@ -4,11 +4,17 @@ from box_sdk_gen.utils import get_env_var -from box_sdk_gen.client import BoxClient +from box_sdk_gen.utils import get_uuid -from box_sdk_gen.jwt_auth import BoxJWTAuth +from box_sdk_gen.utils import buffer_equals -from box_sdk_gen.jwt_auth import JWTConfig +from box_sdk_gen.utils import read_byte_stream + +from box_sdk_gen.utils import generate_byte_buffer + +from box_sdk_gen.utils import decode_base_64_byte_stream + +from box_sdk_gen.client import BoxClient from box_sdk_gen.ccg_auth import BoxCCGAuth @@ -22,63 +28,75 @@ from box_sdk_gen.schemas import UserFull +from box_sdk_gen.jwt_auth import BoxJWTAuth + +from box_sdk_gen.jwt_auth import JWTConfig + -def test_ccg_auth(): +def test_jwt_auth(): user_id: str = get_env_var('USER_ID') enterprise_id: str = get_env_var('ENTERPRISE_ID') - ccg_config: CCGConfig = CCGConfig( - client_id=get_env_var('CLIENT_ID'), - client_secret=get_env_var('CLIENT_SECRET'), - enterprise_id=enterprise_id, - user_id=user_id, + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) ) - auth: BoxCCGAuth = BoxCCGAuth(config=ccg_config) + auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) client: BoxClient = BoxClient(auth=auth) auth.as_user(user_id) current_user: UserFull = client.users.get_user_me() assert current_user.id == user_id auth.as_enterprise(enterprise_id) new_user: UserFull = client.users.get_user_me(fields=['enterprise']) - assert not new_user.enterprise == None and new_user.enterprise.id == enterprise_id + assert not new_user.enterprise == None + assert new_user.enterprise.id == enterprise_id assert not new_user.id == user_id -def test_jwt_auth(): +def test_oauth_auth(): + config: OAuthConfig = OAuthConfig( + client_id='OAUTH_CLIENT_ID', client_secret='OAUTH_CLIENT_SECRET' + ) + auth: BoxOAuth = BoxOAuth(config=config) + auth_url: str = auth.get_authorize_url() + expected_auth_url: str = ( + 'https://account.box.com/api/oauth2/authorize?client_id=OAUTH_CLIENT_ID&response_type=code' + ) + assert auth_url == expected_auth_url + + +def test_ccg_auth(): user_id: str = get_env_var('USER_ID') enterprise_id: str = get_env_var('ENTERPRISE_ID') - jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ccg_config: CCGConfig = CCGConfig( + client_id=get_env_var('CLIENT_ID'), + client_secret=get_env_var('CLIENT_SECRET'), + enterprise_id=enterprise_id, + user_id=user_id, ) - auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) + auth: BoxCCGAuth = BoxCCGAuth(config=ccg_config) client: BoxClient = BoxClient(auth=auth) auth.as_user(user_id) current_user: UserFull = client.users.get_user_me() assert current_user.id == user_id auth.as_enterprise(enterprise_id) new_user: UserFull = client.users.get_user_me(fields=['enterprise']) - assert not new_user.enterprise == None and new_user.enterprise.id == enterprise_id + assert not new_user.enterprise == None + assert new_user.enterprise.id == enterprise_id assert not new_user.id == user_id def test_developer_token_auth(): user_id: str = get_env_var('USER_ID') - jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + enterprise_id: str = get_env_var('ENTERPRISE_ID') + ccg_config: CCGConfig = CCGConfig( + client_id=get_env_var('CLIENT_ID'), + client_secret=get_env_var('CLIENT_SECRET'), + enterprise_id=enterprise_id, + user_id=user_id, ) - auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) + auth: BoxCCGAuth = BoxCCGAuth(config=ccg_config) auth.as_user(user_id) token: AccessToken = auth.retrieve_token() dev_auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token=token.access_token) client: BoxClient = BoxClient(auth=dev_auth) current_user: UserFull = client.users.get_user_me() assert current_user.id == user_id - - -def test_oauth_auth(): - config: OAuthConfig = OAuthConfig( - client_id='OAUTH_CLIENT_ID', client_secret='OAUTH_CLIENT_SECRET' - ) - auth: BoxOAuth = BoxOAuth(config=config) - auth_url: str = auth.get_authorize_url() - expected_auth_url: str = 'https://account.box.com/api/oauth2/authorize?client_id=OAUTH_CLIENT_ID&response_type=code' - assert auth_url == expected_auth_url diff --git a/test/avatars.py b/test/avatars.py index d4bb3814..e9d47513 100644 --- a/test/avatars.py +++ b/test/avatars.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import UserFull from box_sdk_gen.schemas import UserAvatar @@ -20,19 +22,9 @@ from box_sdk_gen.utils import decode_base_64_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testAvatars(): diff --git a/test/chunked_uploads.py b/test/chunked_uploads.py index 0c0b3fb5..7d8ccfd9 100644 --- a/test/chunked_uploads.py +++ b/test/chunked_uploads.py @@ -1,28 +1,16 @@ -from box_sdk_gen.utils import ByteStream - from box_sdk_gen.client import BoxClient -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var +from box_sdk_gen.utils import ByteStream from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.schemas import File - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) +from test.commons import get_default_client -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from box_sdk_gen.schemas import File -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testChunkedUpload(): diff --git a/test/collaboration_allowlist_entries.py b/test/collaboration_allowlist_entries.py index 09980c99..a89c72c9 100644 --- a/test/collaboration_allowlist_entries.py +++ b/test/collaboration_allowlist_entries.py @@ -1,28 +1,14 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import CollaborationAllowlistEntries from box_sdk_gen.schemas import CollaborationAllowlistEntry -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - -from box_sdk_gen.utils import get_uuid - -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig +from test.commons import get_default_client -client: BoxClient = BoxClient( - auth=BoxJWTAuth( - config=JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) - ) - ) -) +client: BoxClient = get_default_client() def collaborationAllowlistEntries(): diff --git a/test/collaboration_allowlist_exempt_targets.py b/test/collaboration_allowlist_exempt_targets.py index 0c195851..cf332e78 100644 --- a/test/collaboration_allowlist_exempt_targets.py +++ b/test/collaboration_allowlist_exempt_targets.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import CollaborationAllowlistExemptTargets from box_sdk_gen.schemas import User @@ -12,25 +14,11 @@ CreateCollaborationWhitelistExemptTargetUserArg, ) -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient +from test.commons import get_default_client -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -client: BoxClient = BoxClient( - auth=BoxJWTAuth( - config=JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) - ) - ) -) +client: BoxClient = get_default_client() def collaborationAllowlistExemptTargets(): @@ -43,13 +31,17 @@ def collaborationAllowlistExemptTargets(): login=''.join([get_uuid(), '@boxdemo.com']), is_platform_access_only=True, ) - new_exempt_target: CollaborationAllowlistExemptTarget = client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target( - user=CreateCollaborationWhitelistExemptTargetUserArg(id=user.id) + new_exempt_target: CollaborationAllowlistExemptTarget = ( + client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target( + user=CreateCollaborationWhitelistExemptTargetUserArg(id=user.id) + ) ) assert to_string(new_exempt_target.type) == 'collaboration_whitelist_exempt_target' assert new_exempt_target.user.id == user.id - exempt_target: CollaborationAllowlistExemptTarget = client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_target_by_id( - collaboration_whitelist_exempt_target_id=new_exempt_target.id + exempt_target: CollaborationAllowlistExemptTarget = ( + client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_target_by_id( + collaboration_whitelist_exempt_target_id=new_exempt_target.id + ) ) assert exempt_target.id == new_exempt_target.id assert exempt_target.user.id == user.id diff --git a/test/collections.py b/test/collections.py index 11231886..ebfb0913 100644 --- a/test/collections.py +++ b/test/collections.py @@ -1,3 +1,5 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Collections from box_sdk_gen.schemas import Collection @@ -10,25 +12,11 @@ from box_sdk_gen.managers.folders import UpdateFolderByIdCollectionsArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testCollections(): diff --git a/test/comments.py b/test/comments.py index 2dbe3142..b795d364 100644 --- a/test/comments.py +++ b/test/comments.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.utils import ByteStream from box_sdk_gen.schemas import Files @@ -16,27 +18,18 @@ from box_sdk_gen.managers.comments import CreateCommentItemArgTypeField -from box_sdk_gen.utils import decode_base_64 +from box_sdk_gen.schemas import CommentFull from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient +from test.commons import get_default_client -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig +client: BoxClient = get_default_client() def comments(): - jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) - ) - auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) - client: BoxClient = BoxClient(auth=auth) file_size: int = 256 file_name: str = get_uuid() file_byte_stream: ByteStream = generate_byte_stream(file_size) @@ -75,7 +68,10 @@ def comments(): new_comments: Comments = client.comments.get_file_comments(file_id=file_id) assert new_comments.total_count == 2 assert new_comments.entries[1].message == new_message - assert not client.comments.get_comment_by_id(comment_id=new_comment.id) == None + received_comment: CommentFull = client.comments.get_comment_by_id( + comment_id=new_comment.id + ) + assert received_comment.message == new_comment.message client.comments.delete_comment_by_id(comment_id=new_comment.id) with pytest.raises(Exception): client.comments.get_comment_by_id(comment_id=new_comment.id) diff --git a/test/commons.py b/test/commons.py index a6e39e07..1c06dff3 100644 --- a/test/commons.py +++ b/test/commons.py @@ -1,3 +1,7 @@ +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.managers.folders import CreateFolderParentArg + from box_sdk_gen.schemas import File from box_sdk_gen.utils import ByteStream @@ -8,10 +12,6 @@ from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField -from box_sdk_gen.schemas import FolderFull - -from box_sdk_gen.managers.folders import CreateFolderParentArg - from box_sdk_gen.utils import decode_base_64 from box_sdk_gen.utils import get_env_var @@ -26,16 +26,36 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +def get_jwt_auth() -> BoxJWTAuth: + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ) + auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) + return auth + + +def get_default_client_as_user(user_id: str) -> BoxClient: + auth: BoxJWTAuth = get_jwt_auth() + auth.as_user(user_id) + return BoxClient(auth=auth) + + +def get_default_client() -> BoxClient: + client: BoxClient = BoxClient(auth=get_jwt_auth()) + return client -client: BoxClient = BoxClient(auth=auth) + +def create_new_folder() -> FolderFull: + client: BoxClient = get_default_client() + new_folder_name: str = get_uuid() + return client.folders.create_folder( + name=new_folder_name, parent=CreateFolderParentArg(id='0') + ) def upload_new_file() -> File: + client: BoxClient = get_default_client() new_file_name: str = ''.join([get_uuid(), '.pdf']) file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files: Files = client.uploads.upload_file( @@ -45,10 +65,3 @@ def upload_new_file() -> File: file=file_content_stream, ) return uploaded_files.entries[0] - - -def create_new_folder() -> FolderFull: - new_folder_name: str = get_uuid() - return client.folders.create_folder( - name=new_folder_name, parent=CreateFolderParentArg(id='0') - ) diff --git a/test/downloads.py b/test/downloads.py index 6d6628ed..1ae4d6eb 100644 --- a/test/downloads.py +++ b/test/downloads.py @@ -1,3 +1,5 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.utils import Buffer from box_sdk_gen.utils import ByteStream @@ -10,10 +12,6 @@ from box_sdk_gen.schemas import File -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_buffer @@ -24,24 +22,14 @@ from box_sdk_gen.utils import read_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_download_file(): new_file_name: str = get_uuid() - file_buffer: Buffer = generate_byte_buffer(1048576) + file_buffer: Buffer = generate_byte_buffer(1024 * 1024) file_content_stream: ByteStream = generate_byte_stream_from_buffer(file_buffer) uploaded_files: Files = client.uploads.upload_file( attributes=UploadFileAttributesArg( diff --git a/test/email_aliases.py b/test/email_aliases.py index 8a4f0b9c..e7ecca59 100644 --- a/test/email_aliases.py +++ b/test/email_aliases.py @@ -1,28 +1,16 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import User from box_sdk_gen.schemas import EmailAliases from box_sdk_gen.schemas import EmailAlias -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testEmailAliases(): diff --git a/test/file_metadata.py b/test/file_metadata.py index ab0809ee..2d57276a 100644 --- a/test/file_metadata.py +++ b/test/file_metadata.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Files from box_sdk_gen.managers.uploads import UploadFileAttributesArg @@ -20,29 +22,16 @@ UpdateFileMetadataByIdRequestBodyArgOpField, ) -from box_sdk_gen.utils import decode_base_64 - from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient +from test.commons import get_default_client -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig +client: BoxClient = get_default_client() def testFileMetadata(): - client: BoxClient = BoxClient( - auth=BoxJWTAuth( - config=JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) - ) - ) - ) uploaded_files: Files = client.uploads.upload_file( attributes=UploadFileAttributesArg( name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0') diff --git a/test/file_versions.py b/test/file_versions.py index a5b7c297..41cad95e 100644 --- a/test/file_versions.py +++ b/test/file_versions.py @@ -1,3 +1,5 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Files from box_sdk_gen.managers.uploads import UploadFileAttributesArg @@ -16,27 +18,13 @@ from box_sdk_gen.schemas import FileFull -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testCreateListGetRestoreDeleteFileVersion(): diff --git a/test/files.py b/test/files.py index c185412f..756c77f7 100644 --- a/test/files.py +++ b/test/files.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import File from box_sdk_gen.schemas import Files @@ -16,10 +18,6 @@ from box_sdk_gen.managers.files import CopyFileParentArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream @@ -28,23 +26,13 @@ from box_sdk_gen.utils import buffer_equals -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -from test.commons import upload_new_file - from box_sdk_gen.utils import ByteStream -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) +from test.commons import upload_new_file -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def upload_file(file_name: str, file_stream: ByteStream) -> File: @@ -59,7 +47,7 @@ def upload_file(file_name: str, file_stream: ByteStream) -> File: def testGetFileThumbnail(): thumbnail_file_name: str = get_uuid() - thumbnail_content_stream: ByteStream = generate_byte_stream(1048576) + thumbnail_content_stream: ByteStream = generate_byte_stream(1024 * 1024) thumbnail_file: File = upload_file(thumbnail_file_name, thumbnail_content_stream) assert ( not buffer_equals( @@ -78,8 +66,8 @@ def testGetFileThumbnail(): def testGetFileFullExtraFields(): new_file_name: str = get_uuid() - file_content: ByteStream = generate_byte_stream(1048576) - uploaded_file: File = upload_file(new_file_name, file_content) + file_stream: ByteStream = generate_byte_stream(1024 * 1024) + uploaded_file: File = upload_file(new_file_name, file_stream) file: FileFull = client.files.get_file_by_id( file_id=uploaded_file.id, fields=['is_externally_owned', 'has_collaborations'] ) @@ -90,7 +78,7 @@ def testGetFileFullExtraFields(): def testCreateGetAndDeleteFile(): new_file_name: str = get_uuid() - updated_content_stream: ByteStream = generate_byte_stream(1048576) + updated_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_file: File = upload_file(new_file_name, updated_content_stream) file: FileFull = client.files.get_file_by_id(file_id=uploaded_file.id) with pytest.raises(Exception): diff --git a/test/folder_locks.py b/test/folder_locks.py index 232315b5..84761f91 100644 --- a/test/folder_locks.py +++ b/test/folder_locks.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.managers.folders import CreateFolderParentArg @@ -12,25 +14,11 @@ from box_sdk_gen.managers.folder_locks import CreateFolderLockFolderArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testFolderLocks(): diff --git a/test/folder_metadata.py b/test/folder_metadata.py index 61555341..31c24e42 100644 --- a/test/folder_metadata.py +++ b/test/folder_metadata.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.managers.folders import CreateFolderParentArg @@ -18,29 +20,14 @@ UpdateFolderMetadataByIdRequestBodyArgOpField, ) -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import generate_byte_stream - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth +from test.commons import get_default_client -from box_sdk_gen.jwt_auth import JWTConfig +client: BoxClient = get_default_client() def testFolderMetadata(): - client: BoxClient = BoxClient( - auth=BoxJWTAuth( - config=JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) - ) - ) - ) folder: FolderFull = client.folders.create_folder( name=get_uuid(), parent=CreateFolderParentArg(id='0') ) diff --git a/test/folders.py b/test/folders.py index 9d17f2a7..363cfc53 100644 --- a/test/folders.py +++ b/test/folders.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.managers.folders import CreateFolderParentArg @@ -10,25 +12,11 @@ from box_sdk_gen.schemas import Items -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_get_folder_info(): diff --git a/test/groups.py b/test/groups.py index e3ef456b..ed2522eb 100644 --- a/test/groups.py +++ b/test/groups.py @@ -1,30 +1,18 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Groups from box_sdk_gen.schemas import Group from box_sdk_gen.schemas import GroupFull -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_get_groups(): diff --git a/test/memberships.py b/test/memberships.py index 4fc2368a..d4533dc9 100644 --- a/test/memberships.py +++ b/test/memberships.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import User from box_sdk_gen.schemas import GroupMemberships @@ -16,25 +18,11 @@ from box_sdk_gen.managers.memberships import UpdateGroupMembershipByIdRoleArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testMemberships(): diff --git a/test/metadata_templates.py b/test/metadata_templates.py index cf435c4e..63a306a3 100644 --- a/test/metadata_templates.py +++ b/test/metadata_templates.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import MetadataTemplate from box_sdk_gen.managers.metadata_templates import ( @@ -16,25 +18,11 @@ from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateSchemaScopeArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testMetadataTemplates(): diff --git a/test/recent_items.py b/test/recent_items.py index 287eaa99..4dd52a61 100644 --- a/test/recent_items.py +++ b/test/recent_items.py @@ -1,3 +1,5 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import RecentItems from box_sdk_gen.utils import decode_base_64 @@ -6,21 +8,10 @@ from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client_as_user def testRecentItems(): - auth.as_user(get_env_var('USER_ID')) - client: BoxClient = BoxClient(auth=auth) + client: BoxClient = get_default_client_as_user(get_env_var('USER_ID')) recent_items: RecentItems = client.recent_items.get_recent_items() assert len(recent_items.entries) >= 0 diff --git a/test/retention_policies.py b/test/retention_policies.py index 4a258454..78af05f7 100644 --- a/test/retention_policies.py +++ b/test/retention_policies.py @@ -12,39 +12,29 @@ from box_sdk_gen.schemas import RetentionPolicies -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.client import BoxClient -from box_sdk_gen.jwt_auth import BoxJWTAuth +from test.commons import get_default_client -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) - -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testCreateUpdateGetDeleteRetentionPolicy(): retention_policy_name: str = get_uuid() retention_description: str = 'test description' - retention_policy: RetentionPolicy = client.retention_policies.create_retention_policy( - policy_name=retention_policy_name, - description=retention_description, - policy_type=CreateRetentionPolicyPolicyTypeArg.FINITE.value, - disposition_action=CreateRetentionPolicyDispositionActionArg.REMOVE_RETENTION.value, - retention_length='1', - retention_type=CreateRetentionPolicyRetentionTypeArg.MODIFIABLE.value, - can_owner_extend_retention=True, - are_owners_notified=True, + retention_policy: RetentionPolicy = ( + client.retention_policies.create_retention_policy( + policy_name=retention_policy_name, + description=retention_description, + policy_type=CreateRetentionPolicyPolicyTypeArg.FINITE.value, + disposition_action=CreateRetentionPolicyDispositionActionArg.REMOVE_RETENTION.value, + retention_length='1', + retention_type=CreateRetentionPolicyRetentionTypeArg.MODIFIABLE.value, + can_owner_extend_retention=True, + are_owners_notified=True, + ) ) assert retention_policy.policy_name == retention_policy_name assert retention_policy.description == retention_description diff --git a/test/search.py b/test/search.py index 98bc1f7c..d3ea6f32 100644 --- a/test/search.py +++ b/test/search.py @@ -2,6 +2,8 @@ from box_sdk_gen.utils import to_string +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import MetadataTemplate from box_sdk_gen.managers.metadata_templates import ( @@ -34,27 +36,13 @@ from box_sdk_gen.managers.search import GetSearchTrashContentArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testCreateMetaDataQueryExecuteRead(): diff --git a/test/sign_requests.py b/test/sign_requests.py index ff0fb38c..8b424706 100644 --- a/test/sign_requests.py +++ b/test/sign_requests.py @@ -1,5 +1,7 @@ from box_sdk_gen.utils import to_string +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import File from box_sdk_gen.schemas import FolderFull @@ -12,16 +14,14 @@ from box_sdk_gen.schemas import SignRequests -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from test.commons import upload_new_file from test.commons import create_new_folder +from test.commons import get_default_client + from box_sdk_gen.schemas import SignRequestCreateRequest from box_sdk_gen.schemas import SignRequestCreateSigner @@ -30,19 +30,7 @@ from box_sdk_gen.schemas import FileBase -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) - -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_create_get_cancel_and_list_sign_request(): @@ -70,6 +58,6 @@ def test_create_get_cancel_and_list_sign_request(): ) assert to_string(cancelled_sign_request.status) == 'cancelled' sign_requests: SignRequests = client.sign_requests.get_sign_requests() - assert sign_requests.entries[0].type == 'sign-request' + assert to_string(sign_requests.entries[0].type) == 'sign-request' client.folders.delete_folder_by_id(folder_id=destination_folder.id, recursive=True) client.files.delete_file_by_id(file_id=file_to_sign.id) diff --git a/test/sign_templates.py b/test/sign_templates.py new file mode 100644 index 00000000..80a5e53e --- /dev/null +++ b/test/sign_templates.py @@ -0,0 +1,31 @@ +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import SignTemplates + +from box_sdk_gen.schemas import SignTemplate + +from box_sdk_gen.utils import decode_base_64 + +from box_sdk_gen.utils import get_env_var + +from test.commons import get_default_client_as_user + + +def testGetSignTemplates(): + client: BoxClient = get_default_client_as_user(get_env_var('USER_ID')) + sign_templates: SignTemplates = client.sign_templates.get_sign_templates(limit=2) + assert len(sign_templates.entries) >= 0 + + +def testGetSignTemplate(): + client: BoxClient = get_default_client_as_user(get_env_var('USER_ID')) + sign_templates: SignTemplates = client.sign_templates.get_sign_templates(limit=2) + assert len(sign_templates.entries) >= 0 + if len(sign_templates.entries) > 0: + sign_template: SignTemplate = client.sign_templates.get_sign_template_by_id( + template_id=sign_templates.entries[0].id + ) + assert sign_template.id == sign_templates.entries[0].id + assert len(sign_template.source_files) > 0 + assert not sign_template.name == '' + assert not sign_template.parent_folder.id == '' diff --git a/test/tasks.py b/test/tasks.py index 97ab0353..3bd5d606 100644 --- a/test/tasks.py +++ b/test/tasks.py @@ -1,3 +1,5 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Files from box_sdk_gen.managers.uploads import UploadFileAttributesArg @@ -18,27 +20,13 @@ from box_sdk_gen.schemas import Tasks -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testCreateUpdateGetDeleteTask(): diff --git a/test/trashed_files.py b/test/trashed_files.py index b9ce94fd..e160f1d8 100644 --- a/test/trashed_files.py +++ b/test/trashed_files.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.utils import ByteStream from box_sdk_gen.schemas import Files @@ -18,27 +20,13 @@ from box_sdk_gen.schemas import TrashFileRestored -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testTrashedFiles(): diff --git a/test/trashed_folders.py b/test/trashed_folders.py index f15a7e13..76a9d2d0 100644 --- a/test/trashed_folders.py +++ b/test/trashed_folders.py @@ -1,5 +1,7 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.managers.folders import CreateFolderParentArg @@ -8,25 +10,11 @@ from box_sdk_gen.schemas import TrashFolderRestored -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testTrashedFolders(): diff --git a/test/trashed_web_links.py b/test/trashed_web_links.py new file mode 100644 index 00000000..afb1ba87 --- /dev/null +++ b/test/trashed_web_links.py @@ -0,0 +1,54 @@ +from box_sdk_gen.utils import to_string + +import pytest + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.schemas import WebLink + +from box_sdk_gen.managers.web_links import CreateWebLinkParentArg + +from box_sdk_gen.schemas import TrashWebLink + +from box_sdk_gen.schemas import TrashWebLinkRestored + +from box_sdk_gen.utils import get_uuid + +from test.commons import get_default_client + +client: BoxClient = get_default_client() + + +def testTrashedWebLinks(): + url: str = 'https://www.box.com' + parent: FolderFull = client.folders.get_folder_by_id(folder_id='0') + name: str = get_uuid() + description: str = 'Weblink description' + weblink: WebLink = client.web_links.create_web_link( + url=url, + parent=CreateWebLinkParentArg(id=parent.id), + name=name, + description=description, + ) + client.web_links.delete_web_link_by_id(web_link_id=weblink.id) + from_trash: TrashWebLink = client.trashed_web_links.get_web_link_trash( + web_link_id=weblink.id + ) + assert from_trash.id == weblink.id + assert from_trash.name == weblink.name + from_api_after_trashed: WebLink = client.web_links.get_web_link_by_id( + web_link_id=weblink.id + ) + assert to_string(from_api_after_trashed.item_status) == 'trashed' + restored_weblink: TrashWebLinkRestored = ( + client.trashed_web_links.restore_weblink_from_trash(web_link_id=weblink.id) + ) + from_api: WebLink = client.web_links.get_web_link_by_id(web_link_id=weblink.id) + assert restored_weblink.id == from_api.id + assert restored_weblink.name == from_api.name + client.web_links.delete_web_link_by_id(web_link_id=weblink.id) + client.trashed_web_links.delete_web_link_trash(web_link_id=weblink.id) + with pytest.raises(Exception): + client.trashed_web_links.get_web_link_trash(web_link_id=weblink.id) diff --git a/test/uploads.py b/test/uploads.py index 1a41e4d1..b3305633 100644 --- a/test/uploads.py +++ b/test/uploads.py @@ -10,34 +10,20 @@ from box_sdk_gen.managers.uploads import UploadFileVersionAttributesArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid from box_sdk_gen.utils import generate_byte_stream -from box_sdk_gen.utils import read_byte_stream - from box_sdk_gen.client import BoxClient -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() -def test_upload_file_and_file_version(): +def testUploadFileAndFileVersion(): new_file_name: str = get_uuid() - file_content_stream: ByteStream = generate_byte_stream(1048576) + file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files: Files = client.uploads.upload_file( attributes=UploadFileAttributesArg( name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') @@ -47,7 +33,7 @@ def test_upload_file_and_file_version(): uploaded_file: File = uploaded_files.entries[0] assert uploaded_file.name == new_file_name new_file_version_name: str = get_uuid() - new_file_content_stream: ByteStream = generate_byte_stream(1048576) + new_file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files_version: Files = client.uploads.upload_file_version( file_id=uploaded_file.id, attributes=UploadFileVersionAttributesArg(name=new_file_version_name), diff --git a/test/users.py b/test/users.py index 0d2ef04d..5e0ca8ab 100644 --- a/test/users.py +++ b/test/users.py @@ -1,30 +1,18 @@ from box_sdk_gen.utils import to_string +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import Users from box_sdk_gen.schemas import UserFull from box_sdk_gen.schemas import User -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_get_users(): diff --git a/test/webhooks.py b/test/webhooks.py index 881fcfd6..4af1d70c 100644 --- a/test/webhooks.py +++ b/test/webhooks.py @@ -2,6 +2,8 @@ import pytest +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.managers.folders import CreateFolderParentArg @@ -16,25 +18,11 @@ from box_sdk_gen.schemas import Webhooks -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var - from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def testWebhooksCRUD(): diff --git a/test/weblinks.py b/test/weblinks.py index 190f70f6..77536ca9 100644 --- a/test/weblinks.py +++ b/test/weblinks.py @@ -1,28 +1,18 @@ +from box_sdk_gen.client import BoxClient + from box_sdk_gen.schemas import FolderFull from box_sdk_gen.schemas import WebLink -from box_sdk_gen.managers.web_links import UpdateWebLinkByIdSharedLinkArg +from box_sdk_gen.managers.web_links import CreateWebLinkParentArg -from box_sdk_gen.utils import decode_base_64 - -from box_sdk_gen.utils import get_env_var +from box_sdk_gen.managers.web_links import UpdateWebLinkByIdSharedLinkArg from box_sdk_gen.utils import get_uuid -from box_sdk_gen.client import BoxClient - -from box_sdk_gen.jwt_auth import BoxJWTAuth - -from box_sdk_gen.jwt_auth import JWTConfig - -jwt_config: JWTConfig = JWTConfig.from_config_json_string( - decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) -) - -auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) +from test.commons import get_default_client -client: BoxClient = BoxClient(auth=auth) +client: BoxClient = get_default_client() def test_create_get_delete_weblink(): @@ -33,7 +23,10 @@ def test_create_get_delete_weblink(): shared_access: str = 'open' password: str = 'super-secret-password' weblink: WebLink = client.web_links.create_web_link( - url=url, parent=parent, name=name, description=description + url=url, + parent=CreateWebLinkParentArg(id=parent.id), + name=name, + description=description, ) assert weblink.url == url assert weblink.parent.id == parent.id diff --git a/test/zip_downloads.py b/test/zip_downloads.py new file mode 100644 index 00000000..dde38b0e --- /dev/null +++ b/test/zip_downloads.py @@ -0,0 +1,99 @@ +from box_sdk_gen.utils import to_string + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import File + +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.managers.zip_downloads import DownloadZipItemsArg + +from box_sdk_gen.managers.zip_downloads import DownloadZipItemsArgTypeField + +from box_sdk_gen.schemas import ZipDownload + +from box_sdk_gen.managers.zip_downloads import CreateZipDownloadItemsArg + +from box_sdk_gen.schemas import ZipDownloadStatus + +from test.commons import get_default_client + +from test.commons import upload_new_file + +from test.commons import create_new_folder + +from box_sdk_gen.utils import buffer_equals + +from box_sdk_gen.utils import read_byte_stream + +from box_sdk_gen.utils import generate_byte_buffer + +client: BoxClient = get_default_client() + + +def testZipDownload(): + file_1: File = upload_new_file() + file_2: File = upload_new_file() + folder_1: FolderFull = create_new_folder() + zip_stream: ByteStream = client.zip_downloads.download_zip( + items=[ + DownloadZipItemsArg( + id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value + ), + DownloadZipItemsArg( + id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value + ), + DownloadZipItemsArg( + id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value + ), + ], + download_file_name='zip', + ) + assert ( + buffer_equals(read_byte_stream(zip_stream), generate_byte_buffer(10)) == False + ) + client.files.delete_file_by_id(file_id=file_1.id) + client.files.delete_file_by_id(file_id=file_2.id) + client.folders.delete_folder_by_id(folder_id=folder_1.id) + + +def testManualZipDownloadAndCheckStatus(): + file_1: File = upload_new_file() + file_2: File = upload_new_file() + folder_1: FolderFull = create_new_folder() + zip_download: ZipDownload = client.zip_downloads.create_zip_download( + items=[ + CreateZipDownloadItemsArg( + id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value + ), + CreateZipDownloadItemsArg( + id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value + ), + CreateZipDownloadItemsArg( + id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value + ), + ], + download_file_name='zip', + ) + assert not zip_download.download_url == '' + assert not zip_download.status_url == '' + assert not zip_download.expires_at == '' + zip_stream: ByteStream = client.zip_downloads.get_zip_download_content( + download_url=zip_download.download_url + ) + assert ( + buffer_equals(read_byte_stream(zip_stream), generate_byte_buffer(10)) == False + ) + zip_download_status: ZipDownloadStatus = ( + client.zip_downloads.get_zip_download_status(status_url=zip_download.status_url) + ) + assert zip_download_status.total_file_count == 2 + assert zip_download_status.downloaded_file_count == 2 + assert zip_download_status.skipped_file_count == 0 + assert zip_download_status.skipped_folder_count == 0 + assert not to_string(zip_download_status.state) == 'failed' + client.files.delete_file_by_id(file_id=file_1.id) + client.files.delete_file_by_id(file_id=file_2.id) + client.folders.delete_folder_by_id(folder_id=folder_1.id)