From a3c80749e3c00ebbffbf91b414178373b8860fb2 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 30 May 2025 01:10:13 -0700 Subject: [PATCH 1/5] chore: Update .codegen.json with commit hash of codegen and openapi spec --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 0dced1f2..9c6a592d 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "fe574b1", "specHash": "a8825be", "version": "1.14.0" } +{ "engineHash": "56d8b65", "specHash": "a8825be", "version": "1.14.0" } From f344fefea52533f5d06a7b40e2a47d88e8c7e015 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 30 May 2025 01:11:31 -0700 Subject: [PATCH 2/5] fix: Fix downscope token to use retrieveToken method for token retrieval (box/box-codegen#731) --- .codegen.json | 2 +- box_sdk_gen/box/ccg_auth.py | 4 +- box_sdk_gen/box/developer_token_auth.py | 4 +- box_sdk_gen/box/jwt_auth.py | 4 +- box_sdk_gen/box/oauth.py | 4 +- test/auth.py | 62 +++++++++++++++++++++++++ test/events.py | 4 +- 7 files changed, 78 insertions(+), 6 deletions(-) diff --git a/.codegen.json b/.codegen.json index 9c6a592d..5b2eb349 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "56d8b65", "specHash": "a8825be", "version": "1.14.0" } +{ "engineHash": "20cb559", "specHash": "a8825be", "version": "1.14.0" } diff --git a/box_sdk_gen/box/ccg_auth.py b/box_sdk_gen/box/ccg_auth.py index eaeecd1f..f4dbd05a 100644 --- a/box_sdk_gen/box/ccg_auth.py +++ b/box_sdk_gen/box/ccg_auth.py @@ -191,7 +191,9 @@ def downscope_token( :param network_session: An object to keep network session state, defaults to None :type network_session: Optional[NetworkSession], optional """ - token: Optional[AccessToken] = self.token_storage.get() + token: Optional[AccessToken] = self.retrieve_token( + network_session=network_session + ) if token == None: raise BoxSDKError( message='No access token is available. Make an API call to retrieve a token before calling this method.' diff --git a/box_sdk_gen/box/developer_token_auth.py b/box_sdk_gen/box/developer_token_auth.py index 49f07142..8c803c8a 100644 --- a/box_sdk_gen/box/developer_token_auth.py +++ b/box_sdk_gen/box/developer_token_auth.py @@ -118,7 +118,9 @@ def downscope_token( :param network_session: An object to keep network session state, defaults to None :type network_session: Optional[NetworkSession], optional """ - token: Optional[AccessToken] = self.token_storage.get() + token: Optional[AccessToken] = self.retrieve_token( + network_session=network_session + ) if token == None or token.access_token == None: raise BoxSDKError(message='No access token is available.') auth_manager: AuthorizationManager = AuthorizationManager( diff --git a/box_sdk_gen/box/jwt_auth.py b/box_sdk_gen/box/jwt_auth.py index 331a0960..b2720de8 100644 --- a/box_sdk_gen/box/jwt_auth.py +++ b/box_sdk_gen/box/jwt_auth.py @@ -415,7 +415,9 @@ def downscope_token( :param network_session: An object to keep network session state, defaults to None :type network_session: Optional[NetworkSession], optional """ - token: Optional[AccessToken] = self.token_storage.get() + token: Optional[AccessToken] = self.retrieve_token( + network_session=network_session + ) if token == None: raise BoxSDKError( message='No access token is available. Make an API call to retrieve a token before calling this method.' diff --git a/box_sdk_gen/box/oauth.py b/box_sdk_gen/box/oauth.py index a0853f0d..1c62ead0 100644 --- a/box_sdk_gen/box/oauth.py +++ b/box_sdk_gen/box/oauth.py @@ -229,7 +229,9 @@ def downscope_token( :param network_session: An object to keep network session state, defaults to None :type network_session: Optional[NetworkSession], optional """ - token: Optional[AccessToken] = self.token_storage.get() + token: Optional[AccessToken] = self.retrieve_token( + network_session=network_session + ) if token == None or token.access_token == None: raise BoxSDKError(message='No access token is available.') auth_manager: AuthorizationManager = AuthorizationManager( diff --git a/test/auth.py b/test/auth.py index 446685cb..8bb0b6c3 100644 --- a/test/auth.py +++ b/test/auth.py @@ -99,6 +99,25 @@ def test_jwt_auth_downscope(): parent_client.files.delete_file_by_id(file.id) +def test_jwt_downscope_token_succeeds_if_no_token_available(): + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ) + auth: BoxJWTAuth = BoxJWTAuth(config=jwt_config) + downscoped_token: AccessToken = auth.downscope_token(['root_readonly']) + assert not downscoped_token.access_token == None + downscoped_client: BoxClient = BoxClient( + auth=BoxDeveloperTokenAuth(token=downscoped_token.access_token) + ) + with pytest.raises(Exception): + downscoped_client.uploads.upload_file( + UploadFileAttributes( + name=get_uuid(), parent=UploadFileAttributesParentField(id='0') + ), + generate_byte_stream(1024 * 1024), + ) + + def test_jwt_auth_revoke(): jwt_config: JWTConfig = JWTConfig.from_config_json_string( decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) @@ -128,6 +147,16 @@ def test_oauth_auth_authorizeUrl(): ) +def test_oauth_downscope_token_succeeds_if_no_token_available(): + config: OAuthConfig = OAuthConfig( + client_id=get_env_var('CLIENT_ID'), client_secret=get_env_var('CLIENT_SECRET') + ) + auth: BoxOAuth = BoxOAuth(config=config) + resource_path: str = ''.join(['https://api.box.com/2.0/files/12345']) + with pytest.raises(Exception): + auth.downscope_token(['item_rename', 'item_preview'], resource=resource_path) + + def test_ccg_auth(): user_id: str = get_env_var('USER_ID') enterprise_id: str = get_env_var('ENTERPRISE_ID') @@ -175,6 +204,27 @@ def test_ccg_auth_downscope(): parent_client.folders.delete_folder_by_id(folder.id) +def test_ccg_downscope_token_succeeds_if_no_token_available(): + ccg_config: CCGConfig = CCGConfig( + client_id=get_env_var('CLIENT_ID'), + client_secret=get_env_var('CLIENT_SECRET'), + user_id=get_env_var('USER_ID'), + ) + auth: BoxCCGAuth = BoxCCGAuth(config=ccg_config) + downscoped_token: AccessToken = auth.downscope_token(['root_readonly']) + assert not downscoped_token.access_token == None + downscoped_client: BoxClient = BoxClient( + auth=BoxDeveloperTokenAuth(token=downscoped_token.access_token) + ) + with pytest.raises(Exception): + downscoped_client.uploads.upload_file( + UploadFileAttributes( + name=get_uuid(), parent=UploadFileAttributesParentField(id='0') + ), + generate_byte_stream(1024 * 1024), + ) + + def test_ccg_auth_revoke(): ccg_config: CCGConfig = CCGConfig( client_id=get_env_var('CLIENT_ID'), @@ -192,6 +242,18 @@ def test_ccg_auth_revoke(): ) +def test_developer_downscope_token_succeeds_if_no_token_available(): + developer_token_config: DeveloperTokenConfig = DeveloperTokenConfig( + client_id=get_env_var('CLIENT_ID'), client_secret=get_env_var('CLIENT_SECRET') + ) + auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth( + token='', config=developer_token_config + ) + resource_path: str = ''.join(['https://api.box.com/2.0/folders/12345']) + with pytest.raises(Exception): + auth.downscope_token(['item_rename', 'item_preview'], resource=resource_path) + + def get_access_token() -> AccessToken: user_id: str = get_env_var('USER_ID') enterprise_id: str = get_env_var('ENTERPRISE_ID') diff --git a/test/events.py b/test/events.py index eb090b80..9dd4a1a3 100644 --- a/test/events.py +++ b/test/events.py @@ -73,7 +73,9 @@ def testEventSourceFileOrFolder(): assert len(events.entries) > 0 first_event: Event = events.entries[0] source: File = first_event.source - assert to_string(source.type) == 'file' or to_string(source.type) == 'folder' + assert ( + to_string(source.type) == 'file' or to_string(source.type) == 'folder' + ) or to_string(source.type) == 'collaboration' assert not source.id == '' From 377feed394e8ffde11b9168a3cdf1423b093a116 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 30 May 2025 01:12:48 -0700 Subject: [PATCH 3/5] docs: legal holds param update (box/box-openapi#526) --- .codegen.json | 2 +- .../managers/legal_hold_policy_assignments.py | 13 ++++++++++++- box_sdk_gen/schemas/ai_agent_ask.py | 4 ++++ box_sdk_gen/schemas/ai_agent_extract.py | 2 ++ box_sdk_gen/schemas/ai_agent_extract_structured.py | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.codegen.json b/.codegen.json index 5b2eb349..b28579f8 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "20cb559", "specHash": "a8825be", "version": "1.14.0" } +{ "engineHash": "20cb559", "specHash": "2da99e0", "version": "1.14.0" } diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py index aad1e235..01650501 100644 --- a/box_sdk_gen/managers/legal_hold_policy_assignments.py +++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py @@ -50,6 +50,8 @@ class GetLegalHoldPolicyAssignmentsAssignToType(str, Enum): FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' + OWNERSHIP = 'ownership' + INTERACTIONS = 'interactions' class CreateLegalHoldPolicyAssignmentAssignToTypeField(str, Enum): @@ -57,10 +59,19 @@ class CreateLegalHoldPolicyAssignmentAssignToTypeField(str, Enum): FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' + OWNERSHIP = 'ownership' + INTERACTION = 'interaction' class CreateLegalHoldPolicyAssignmentAssignTo(BaseObject): - _discriminator = 'type', {'file', 'file_version', 'folder', 'user'} + _discriminator = 'type', { + 'file', + 'file_version', + 'folder', + 'user', + 'ownership', + 'interaction', + } def __init__( self, type: CreateLegalHoldPolicyAssignmentAssignToTypeField, id: str, **kwargs diff --git a/box_sdk_gen/schemas/ai_agent_ask.py b/box_sdk_gen/schemas/ai_agent_ask.py index ebd95d54..e2557647 100644 --- a/box_sdk_gen/schemas/ai_agent_ask.py +++ b/box_sdk_gen/schemas/ai_agent_ask.py @@ -26,6 +26,8 @@ def __init__( basic_text: Optional[AiAgentBasicTextTool] = None, long_text_multi: Optional[AiAgentLongTextTool] = None, basic_text_multi: Optional[AiAgentBasicTextTool] = None, + basic_image: Optional[AiAgentBasicTextTool] = None, + basic_image_multi: Optional[AiAgentBasicTextTool] = None, **kwargs ): """ @@ -38,3 +40,5 @@ def __init__( self.basic_text = basic_text self.long_text_multi = long_text_multi self.basic_text_multi = basic_text_multi + self.basic_image = basic_image + self.basic_image_multi = basic_image_multi diff --git a/box_sdk_gen/schemas/ai_agent_extract.py b/box_sdk_gen/schemas/ai_agent_extract.py index d4038626..02a2e34c 100644 --- a/box_sdk_gen/schemas/ai_agent_extract.py +++ b/box_sdk_gen/schemas/ai_agent_extract.py @@ -24,6 +24,7 @@ def __init__( type: AiAgentExtractTypeField = AiAgentExtractTypeField.AI_AGENT_EXTRACT, long_text: Optional[AiAgentLongTextTool] = None, basic_text: Optional[AiAgentBasicTextTool] = None, + basic_image: Optional[AiAgentBasicTextTool] = None, **kwargs ): """ @@ -34,3 +35,4 @@ def __init__( self.type = type self.long_text = long_text self.basic_text = basic_text + self.basic_image = basic_image diff --git a/box_sdk_gen/schemas/ai_agent_extract_structured.py b/box_sdk_gen/schemas/ai_agent_extract_structured.py index ec31727b..142ae996 100644 --- a/box_sdk_gen/schemas/ai_agent_extract_structured.py +++ b/box_sdk_gen/schemas/ai_agent_extract_structured.py @@ -24,6 +24,7 @@ def __init__( type: AiAgentExtractStructuredTypeField = AiAgentExtractStructuredTypeField.AI_AGENT_EXTRACT_STRUCTURED, long_text: Optional[AiAgentLongTextTool] = None, basic_text: Optional[AiAgentBasicTextTool] = None, + basic_image: Optional[AiAgentBasicTextTool] = None, **kwargs ): """ @@ -34,3 +35,4 @@ def __init__( self.type = type self.long_text = long_text self.basic_text = basic_text + self.basic_image = basic_image From 285d6e56b22b1b703231f0210ce7f7364919df18 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 30 May 2025 01:14:07 -0700 Subject: [PATCH 4/5] fix: Fix issues in box-openapi (box/box-openapi#527) --- .codegen.json | 2 +- box_sdk_gen/managers/files.py | 5 ++++- box_sdk_gen/managers/folders.py | 24 +++++++++++++++++------- box_sdk_gen/managers/uploads.py | 10 ++++++++-- docs/files.md | 2 +- docs/folders.md | 4 ++-- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/.codegen.json b/.codegen.json index b28579f8..fb6e1d4b 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "20cb559", "specHash": "2da99e0", "version": "1.14.0" } +{ "engineHash": "20cb559", "specHash": "a54170e", "version": "1.14.0" } diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py index d8cbaa89..cf25f469 100644 --- a/box_sdk_gen/managers/files.py +++ b/box_sdk_gen/managers/files.py @@ -371,7 +371,10 @@ def update_file_by_id( Example: "12345" :type file_id: str :param name: An optional different name for the file. This can be used to - rename the file., defaults to None + rename the file. + + File names must be unique within their parent folder. The name check is case-insensitive, so a file + named `New File` cannot be created in a parent folder that already contains a folder named `new file`., defaults to None :type name: Optional[str], optional :param description: The description for a file. This can be seen in the right-hand sidebar panel when viewing a file in the Box web app. Additionally, this index is used in diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py index 99f1b2fb..22d25fb7 100644 --- a/box_sdk_gen/managers/folders.py +++ b/box_sdk_gen/managers/folders.py @@ -464,7 +464,7 @@ def update_folder_by_id( if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> FolderFull: - """ + r""" Updates a folder. This can be also be used to move the folder, create shared links, update collaborations, and more. @@ -481,7 +481,16 @@ def update_folder_by_id( always represented by the ID `0`. Example: "12345" :type folder_id: str - :param name: The optional new name for this folder., defaults to None + :param name: The optional new name for this folder. + + The following restrictions to folder names apply: names containing + non-printable ASCII characters, forward and backward slashes + (`/`, `\`), names with trailing spaces, and names `.` and `..` are + not allowed. + + Folder names must be unique within their parent folder. The name check is case-insensitive, + so a folder named `New Folder` cannot be created in a parent folder that already contains + a folder named `new folder`., defaults to None :type name: Optional[str], optional :param description: The optional description of this folder, defaults to None :type description: Optional[str], optional @@ -826,13 +835,14 @@ def create_folder( Creates a new empty folder within the specified parent folder. :param name: The name for the new folder. - There are some restrictions to the file name. Names containing + The following restrictions to folder names apply: names containing non-printable ASCII characters, forward and backward slashes - (`/`, `\`), as well as names with trailing spaces are - prohibited. + (`/`, `\`), names with trailing spaces, and names `.` and `..` are + not allowed. - Additionally, the names `.` and `..` are - not allowed either. + Folder names must be unique within their parent folder. The name check is case-insensitive, + so a folder named `New Folder` cannot be created in a parent folder that already contains + a folder named `new folder`. :type name: str :param parent: The parent folder to create the new folder within. :type parent: CreateFolderParent diff --git a/box_sdk_gen/managers/uploads.py b/box_sdk_gen/managers/uploads.py index 945c5b94..454402b0 100644 --- a/box_sdk_gen/managers/uploads.py +++ b/box_sdk_gen/managers/uploads.py @@ -97,7 +97,10 @@ def __init__( **kwargs ): """ - :param name: The name of the file + :param name: The name of the file. + + File names must be unique within their parent folder. The name check is case-insensitive, so a file + named `New File` cannot be created in a parent folder that already contains a folder named `new file`. :type name: str :param parent: The parent folder to upload the file to :type parent: UploadFileAttributesParentField @@ -140,7 +143,10 @@ def __init__( **kwargs ): """ - :param name: The name of the file + :param name: The name of the file. + + File names must be unique within their parent folder. The name check is case-insensitive, so a file + named `New File` cannot be created in a parent folder that already contains a folder named `new file`. :type name: str :param parent: The parent folder to upload the file to :type parent: UploadWithPreflightCheckAttributesParentField diff --git a/docs/files.md b/docs/files.md index 836cdc3f..bf4ba631 100644 --- a/docs/files.md +++ b/docs/files.md @@ -72,7 +72,7 @@ client.files.update_file_by_id( - file_id `str` - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345" - name `Optional[str]` - - An optional different name for the file. This can be used to rename the file. + - An optional different name for the file. This can be used to rename the file. File names must be unique within their parent folder. The name check is case-insensitive, so a file named `New File` cannot be created in a parent folder that already contains a folder named `new file`. - description `Optional[str]` - The description for a file. This can be seen in the right-hand sidebar panel when viewing a file in the Box web app. Additionally, this index is used in the search index of the file, allowing users to find the file by the content in the description. - parent `Optional[UpdateFileByIdParent]` diff --git a/docs/folders.md b/docs/folders.md index cc25a463..309ffff6 100644 --- a/docs/folders.md +++ b/docs/folders.md @@ -91,7 +91,7 @@ client.folders.update_folder_by_id( - folder_id `str` - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345" - name `Optional[str]` - - The optional new name for this folder. + - The optional new name for this folder. The following restrictions to folder names apply: names containing non-printable ASCII characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.` and `..` are not allowed. Folder names must be unique within their parent folder. The name check is case-insensitive, so a folder named `New Folder` cannot be created in a parent folder that already contains a folder named `new folder`. - description `Optional[str]` - The optional description of this folder - sync_state `Optional[UpdateFolderByIdSyncState]` @@ -234,7 +234,7 @@ client.folders.create_folder(new_folder_name, CreateFolderParent(id="0")) ### Arguments - name `str` - - The name for the new folder. There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes (`/`, `\`), as well as names with trailing spaces are prohibited. Additionally, the names `.` and `..` are not allowed either. + - The name for the new folder. The following restrictions to folder names apply: names containing non-printable ASCII characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.` and `..` are not allowed. Folder names must be unique within their parent folder. The name check is case-insensitive, so a folder named `New Folder` cannot be created in a parent folder that already contains a folder named `new folder`. - parent `CreateFolderParent` - The parent folder to create the new folder within. - folder_upload_email `Optional[CreateFolderFolderUploadEmail]` From 01460095578c6fcc4f8799430c68214321681719 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 30 May 2025 01:15:25 -0700 Subject: [PATCH 5/5] docs: Shield Lists documentation (box/box-openapi#528) --- .codegen.json | 2 +- box_sdk_gen/client.py | 5 + box_sdk_gen/managers/__init__.py | 2 + box_sdk_gen/managers/shield_lists.py | 284 ++++++++++++++++++ box_sdk_gen/schemas/v2025_r0/__init__.py | 24 ++ .../shield_list_content_country_v2025_r0.py | 32 ++ .../shield_list_content_domain_v2025_r0.py | 32 ++ .../shield_list_content_email_v2025_r0.py | 32 ++ ...hield_list_content_integration_v2025_r0.py | 44 +++ .../shield_list_content_ip_v2025_r0.py | 32 ++ .../shield_list_content_request_v2025_r0.py | 26 ++ .../v2025_r0/shield_list_content_v2025_r0.py | 31 ++ .../v2025_r0/shield_list_mini_v2025_r0.py | 50 +++ .../schemas/v2025_r0/shield_list_v2025_r0.py | 56 ++++ .../v2025_r0/shield_lists_create_v2025_r0.py | 32 ++ .../v2025_r0/shield_lists_update_v2025_r0.py | 32 ++ .../schemas/v2025_r0/shield_lists_v2025_r0.py | 21 ++ docs/README.md | 1 + docs/shield_lists.md | 145 +++++++++ 19 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 box_sdk_gen/managers/shield_lists.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py create mode 100644 box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py create mode 100644 docs/shield_lists.md diff --git a/.codegen.json b/.codegen.json index fb6e1d4b..192239db 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "20cb559", "specHash": "a54170e", "version": "1.14.0" } +{ "engineHash": "20cb559", "specHash": "630fc85", "version": "1.14.0" } diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index 0ee1e45f..78a6dae7 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -172,6 +172,8 @@ from box_sdk_gen.managers.docgen import DocgenManager +from box_sdk_gen.managers.shield_lists import ShieldListsManager + from box_sdk_gen.networking.auth import Authentication from box_sdk_gen.networking.network import NetworkSession @@ -417,6 +419,9 @@ def __init__(self, auth: Authentication, *, network_session: NetworkSession = No self.docgen = DocgenManager( auth=self.auth, network_session=self.network_session ) + self.shield_lists = ShieldListsManager( + auth=self.auth, network_session=self.network_session + ) def make_request(self, fetch_options: FetchOptions) -> FetchResponse: """ diff --git a/box_sdk_gen/managers/__init__.py b/box_sdk_gen/managers/__init__.py index b28704d8..c6fd2563 100644 --- a/box_sdk_gen/managers/__init__.py +++ b/box_sdk_gen/managers/__init__.py @@ -145,3 +145,5 @@ from box_sdk_gen.managers.docgen_template import * from box_sdk_gen.managers.docgen import * + +from box_sdk_gen.managers.shield_lists import * diff --git a/box_sdk_gen/managers/shield_lists.py b/box_sdk_gen/managers/shield_lists.py new file mode 100644 index 00000000..3804bb1a --- /dev/null +++ b/box_sdk_gen/managers/shield_lists.py @@ -0,0 +1,284 @@ +from typing import Optional + +from typing import Dict + +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.serialization.json import deserialize + +from box_sdk_gen.serialization.json import serialize + +from box_sdk_gen.networking.fetch_options import ResponseFormat + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import ( + ShieldListContentRequestV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_lists_v2025_r0 import ShieldListsV2025R0 + +from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import ( + BoxVersionHeaderV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_v2025_r0 import ShieldListV2025R0 + +from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0 + +from box_sdk_gen.schemas.v2025_r0.shield_lists_create_v2025_r0 import ( + ShieldListsCreateV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_lists_update_v2025_r0 import ( + ShieldListsUpdateV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +from box_sdk_gen.networking.auth import Authentication + +from box_sdk_gen.networking.network import NetworkSession + +from box_sdk_gen.networking.fetch_options import FetchOptions + +from box_sdk_gen.networking.fetch_response import FetchResponse + +from box_sdk_gen.internal.utils import prepare_params + +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.internal.utils import ByteStream + +from box_sdk_gen.serialization.json import sd_to_json + +from box_sdk_gen.serialization.json import SerializedData + + +class ShieldListsManager: + def __init__( + self, + *, + auth: Optional[Authentication] = None, + network_session: NetworkSession = None + ): + if network_session is None: + network_session = NetworkSession() + self.auth = auth + self.network_session = network_session + + def get_shield_lists_v2025_r0( + self, + *, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ShieldListsV2025R0: + """ + Retrieves all shield lists in the enterprise. + :param box_version: Version header, defaults to BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, optional + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [self.network_session.base_urls.base_url, '/2.0/shield_lists'] + ), + method='GET', + headers=headers_map, + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, ShieldListsV2025R0) + + def create_shield_list_v2025_r0( + self, + name: str, + content: ShieldListContentRequestV2025R0, + *, + description: Optional[str] = None, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ShieldListV2025R0: + """ + Creates a shield list. + :param name: The name of the shield list. + :type name: str + :param description: Description of Shield List: Optional., defaults to None + :type description: Optional[str], optional + :param box_version: Version header, defaults to BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, optional + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'name': name, + 'description': description, + 'content': content, + } + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [self.network_session.base_urls.base_url, '/2.0/shield_lists'] + ), + method='POST', + headers=headers_map, + data=serialize(request_body), + content_type='application/json', + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, ShieldListV2025R0) + + def get_shield_list_by_id_v2025_r0( + self, + shield_list_id: str, + *, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ShieldListV2025R0: + """ + Retrieves a single shield list by its ID. + :param shield_list_id: The unique identifier that represents a shield list. + The ID for any Shield List can be determined by the response from the endpoint + fetching all shield lists for the enterprise. + Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " + :type shield_list_id: str + :param box_version: Version header, defaults to BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, optional + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [ + self.network_session.base_urls.base_url, + '/2.0/shield_lists/', + to_string(shield_list_id), + ] + ), + method='GET', + headers=headers_map, + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, ShieldListV2025R0) + + def delete_shield_list_by_id_v2025_r0( + self, + shield_list_id: str, + *, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: + """ + Delete a single shield list by its ID. + :param shield_list_id: The unique identifier that represents a shield list. + The ID for any Shield List can be determined by the response from the endpoint + fetching all shield lists for the enterprise. + Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " + :type shield_list_id: str + :param box_version: Version header, defaults to BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, optional + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [ + self.network_session.base_urls.base_url, + '/2.0/shield_lists/', + to_string(shield_list_id), + ] + ), + method='DELETE', + headers=headers_map, + response_format=ResponseFormat.NO_CONTENT, + auth=self.auth, + network_session=self.network_session, + ) + ) + return None + + def update_shield_list_by_id_v2025_r0( + self, + shield_list_id: str, + name: str, + content: ShieldListContentRequestV2025R0, + *, + description: Optional[str] = None, + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, + extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ShieldListV2025R0: + """ + Updates a shield list. + :param shield_list_id: The unique identifier that represents a shield list. + The ID for any Shield List can be determined by the response from the endpoint + fetching all shield lists for the enterprise. + Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " + :type shield_list_id: str + :param name: The name of the shield list. + :type name: str + :param description: Description of Shield List: Optional., defaults to None + :type description: Optional[str], optional + :param box_version: Version header, defaults to BoxVersionHeaderV2025R0._2025_0 + :type box_version: BoxVersionHeaderV2025R0, optional + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'name': name, + 'description': description, + 'content': content, + } + headers_map: Dict[str, str] = prepare_params( + {'box-version': to_string(box_version), **extra_headers} + ) + response: FetchResponse = self.network_session.network_client.fetch( + FetchOptions( + url=''.join( + [ + self.network_session.base_urls.base_url, + '/2.0/shield_lists/', + to_string(shield_list_id), + ] + ), + method='PUT', + headers=headers_map, + data=serialize(request_body), + content_type='application/json', + response_format=ResponseFormat.JSON, + auth=self.auth, + network_session=self.network_session, + ) + ) + return deserialize(response.data, ShieldListV2025R0) diff --git a/box_sdk_gen/schemas/v2025_r0/__init__.py b/box_sdk_gen/schemas/v2025_r0/__init__.py index d42a5c26..974814f1 100644 --- a/box_sdk_gen/schemas/v2025_r0/__init__.py +++ b/box_sdk_gen/schemas/v2025_r0/__init__.py @@ -32,6 +32,30 @@ from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_create_request_v2025_r0 import * +from box_sdk_gen.schemas.v2025_r0.shield_list_mini_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_lists_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_integration_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_lists_update_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_lists_create_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_v2025_r0 import * + +from box_sdk_gen.schemas.v2025_r0.shield_list_v2025_r0 import * + from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import * from box_sdk_gen.schemas.v2025_r0.doc_gen_job_full_v2025_r0 import * diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py new file mode 100644 index 00000000..c1df40f1 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py @@ -0,0 +1,32 @@ +from enum import Enum + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListContentCountryV2025R0TypeField(str, Enum): + COUNTRY = 'country' + + +class ShieldListContentCountryV2025R0(BaseObject): + _discriminator = 'type', {'country'} + + def __init__( + self, + country_codes: List[str], + *, + type: ShieldListContentCountryV2025R0TypeField = ShieldListContentCountryV2025R0TypeField.COUNTRY, + **kwargs + ): + """ + :param country_codes: List of country codes values. + :type country_codes: List[str] + :param type: The type of content in the shield list., defaults to ShieldListContentCountryV2025R0TypeField.COUNTRY + :type type: ShieldListContentCountryV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.country_codes = country_codes + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py new file mode 100644 index 00000000..6a0c0dae --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py @@ -0,0 +1,32 @@ +from enum import Enum + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListContentDomainV2025R0TypeField(str, Enum): + DOMAIN = 'domain' + + +class ShieldListContentDomainV2025R0(BaseObject): + _discriminator = 'type', {'domain'} + + def __init__( + self, + domains: List[str], + *, + type: ShieldListContentDomainV2025R0TypeField = ShieldListContentDomainV2025R0TypeField.DOMAIN, + **kwargs + ): + """ + :param domains: List of domain. + :type domains: List[str] + :param type: The type of content in the shield list., defaults to ShieldListContentDomainV2025R0TypeField.DOMAIN + :type type: ShieldListContentDomainV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.domains = domains + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py new file mode 100644 index 00000000..436abdc6 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py @@ -0,0 +1,32 @@ +from enum import Enum + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListContentEmailV2025R0TypeField(str, Enum): + EMAIL = 'email' + + +class ShieldListContentEmailV2025R0(BaseObject): + _discriminator = 'type', {'email'} + + def __init__( + self, + email_addresses: List[str], + *, + type: ShieldListContentEmailV2025R0TypeField = ShieldListContentEmailV2025R0TypeField.EMAIL, + **kwargs + ): + """ + :param email_addresses: List of emails + :type email_addresses: List[str] + :param type: The type of content in the shield list., defaults to ShieldListContentEmailV2025R0TypeField.EMAIL + :type type: ShieldListContentEmailV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.email_addresses = email_addresses + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py new file mode 100644 index 00000000..c6e93815 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py @@ -0,0 +1,44 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from typing import List + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListContentIntegrationV2025R0TypeField(str, Enum): + INTEGRATION = 'integration' + + +class ShieldListContentIntegrationV2025R0IntegrationsField(BaseObject): + def __init__(self, *, id: Optional[str] = None, **kwargs): + """ + :param id: The ID of the integration., defaults to None + :type id: Optional[str], optional + """ + super().__init__(**kwargs) + self.id = id + + +class ShieldListContentIntegrationV2025R0(BaseObject): + _discriminator = 'type', {'integration'} + + def __init__( + self, + integrations: List[ShieldListContentIntegrationV2025R0IntegrationsField], + *, + type: ShieldListContentIntegrationV2025R0TypeField = ShieldListContentIntegrationV2025R0TypeField.INTEGRATION, + **kwargs + ): + """ + :param integrations: List of integration + :type integrations: List[ShieldListContentIntegrationV2025R0IntegrationsField] + :param type: The type of content in the shield list., defaults to ShieldListContentIntegrationV2025R0TypeField.INTEGRATION + :type type: ShieldListContentIntegrationV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.integrations = integrations + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py new file mode 100644 index 00000000..fdaef0ec --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py @@ -0,0 +1,32 @@ +from enum import Enum + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListContentIpV2025R0TypeField(str, Enum): + IP = 'ip' + + +class ShieldListContentIpV2025R0(BaseObject): + _discriminator = 'type', {'ip'} + + def __init__( + self, + ip_addresses: List[str], + *, + type: ShieldListContentIpV2025R0TypeField = ShieldListContentIpV2025R0TypeField.IP, + **kwargs + ): + """ + :param ip_addresses: List of ips and cidrs. + :type ip_addresses: List[str] + :param type: The type of content in the shield list., defaults to ShieldListContentIpV2025R0TypeField.IP + :type type: ShieldListContentIpV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.ip_addresses = ip_addresses + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py new file mode 100644 index 00000000..266a9624 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py @@ -0,0 +1,26 @@ +from typing import Union + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import ( + ShieldListContentCountryV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import ( + ShieldListContentDomainV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import ( + ShieldListContentEmailV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import ( + ShieldListContentIpV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +ShieldListContentRequestV2025R0 = Union[ + ShieldListContentCountryV2025R0, + ShieldListContentDomainV2025R0, + ShieldListContentEmailV2025R0, + ShieldListContentIpV2025R0, +] diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py new file mode 100644 index 00000000..9c5adacf --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py @@ -0,0 +1,31 @@ +from typing import Union + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import ( + ShieldListContentCountryV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import ( + ShieldListContentDomainV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import ( + ShieldListContentEmailV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import ( + ShieldListContentIpV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_integration_v2025_r0 import ( + ShieldListContentIntegrationV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +ShieldListContentV2025R0 = Union[ + ShieldListContentCountryV2025R0, + ShieldListContentDomainV2025R0, + ShieldListContentEmailV2025R0, + ShieldListContentIpV2025R0, + ShieldListContentIntegrationV2025R0, +] diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py new file mode 100644 index 00000000..f9e71e10 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py @@ -0,0 +1,50 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from typing import List + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListMiniV2025R0TypeField(str, Enum): + SHIELD_LIST = 'shield_list' + + +class ShieldListMiniV2025R0ContentField(BaseObject): + def __init__(self, *, type: Optional[str] = None, **kwargs): + """ + :param type: The type of content in the shield list., defaults to None + :type type: Optional[str], optional + """ + super().__init__(**kwargs) + self.type = type + + +class ShieldListMiniV2025R0(BaseObject): + _discriminator = 'type', {'shield_list'} + + def __init__( + self, + id: str, + name: str, + content: ShieldListMiniV2025R0ContentField, + *, + type: ShieldListMiniV2025R0TypeField = ShieldListMiniV2025R0TypeField.SHIELD_LIST, + **kwargs + ): + """ + :param id: Unique global identifier for this list + :type id: str + :param name: Name of Shield List + :type name: str + :param type: The type of object, defaults to ShieldListMiniV2025R0TypeField.SHIELD_LIST + :type type: ShieldListMiniV2025R0TypeField, optional + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.content = content + self.type = type diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py new file mode 100644 index 00000000..7435de6e --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py @@ -0,0 +1,56 @@ +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from typing import List + +from box_sdk_gen.schemas.v2025_r0.enterprise_reference_v2025_r0 import ( + EnterpriseReferenceV2025R0, +) + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_v2025_r0 import ( + ShieldListContentV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + +from box_sdk_gen.internal.utils import DateTime + + +class ShieldListV2025R0(BaseObject): + def __init__( + self, + id: str, + type: str, + name: str, + enterprise: EnterpriseReferenceV2025R0, + created_at: DateTime, + updated_at: DateTime, + content: ShieldListContentV2025R0, + *, + description: Optional[str] = None, + **kwargs + ): + """ + :param id: Unique identifier for the shield list. + :type id: str + :param type: Type of the object. + :type type: str + :param name: Name of the shield list. + :type name: str + :param created_at: ISO date time string when this shield list object was created. + :type created_at: DateTime + :param updated_at: ISO date time string when this shield list object was updated. + :type updated_at: DateTime + :param description: Description of Shield List, defaults to None + :type description: Optional[str], optional + """ + super().__init__(**kwargs) + self.id = id + self.type = type + self.name = name + self.enterprise = enterprise + self.created_at = created_at + self.updated_at = updated_at + self.content = content + self.description = description diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py new file mode 100644 index 00000000..c820f0b2 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py @@ -0,0 +1,32 @@ +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from typing import List + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import ( + ShieldListContentRequestV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListsCreateV2025R0(BaseObject): + def __init__( + self, + name: str, + content: ShieldListContentRequestV2025R0, + *, + description: Optional[str] = None, + **kwargs + ): + """ + :param name: The name of the shield list. + :type name: str + :param description: Description of Shield List: Optional., defaults to None + :type description: Optional[str], optional + """ + super().__init__(**kwargs) + self.name = name + self.content = content + self.description = description diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py new file mode 100644 index 00000000..4739d14d --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py @@ -0,0 +1,32 @@ +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from typing import List + +from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import ( + ShieldListContentRequestV2025R0, +) + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListsUpdateV2025R0(BaseObject): + def __init__( + self, + name: str, + content: ShieldListContentRequestV2025R0, + *, + description: Optional[str] = None, + **kwargs + ): + """ + :param name: The name of the shield list. + :type name: str + :param description: Description of Shield List: Optional., defaults to None + :type description: Optional[str], optional + """ + super().__init__(**kwargs) + self.name = name + self.content = content + self.description = description diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py new file mode 100644 index 00000000..6bcdc280 --- /dev/null +++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py @@ -0,0 +1,21 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.v2025_r0.shield_list_mini_v2025_r0 import ShieldListMiniV2025R0 + +from box_sdk_gen.box.errors import BoxSDKError + + +class ShieldListsV2025R0(BaseObject): + def __init__( + self, *, entries: Optional[List[ShieldListMiniV2025R0]] = None, **kwargs + ): + """ + :param entries: A list of shield list objects, defaults to None + :type entries: Optional[List[ShieldListMiniV2025R0]], optional + """ + super().__init__(**kwargs) + self.entries = entries diff --git a/docs/README.md b/docs/README.md index 73f0f359..e367d281 100644 --- a/docs/README.md +++ b/docs/README.md @@ -58,6 +58,7 @@ the SDK are available by topic: - [Shield information barrier segment restrictions](shield_information_barrier_segment_restrictions.md) - [Shield information barrier segments](shield_information_barrier_segments.md) - [Shield information barriers](shield_information_barriers.md) +- [Shield lists](shield_lists.md) - [Sign requests](sign_requests.md) - [Sign templates](sign_templates.md) - [Skills](skills.md) diff --git a/docs/shield_lists.md b/docs/shield_lists.md new file mode 100644 index 00000000..1714367c --- /dev/null +++ b/docs/shield_lists.md @@ -0,0 +1,145 @@ +# ShieldListsManager + +- [Get all shield lists in enterprise](#get-all-shield-lists-in-enterprise) +- [Create shield list](#create-shield-list) +- [Get single shield list by shield list id](#get-single-shield-list-by-shield-list-id) +- [Delete single shield list by shield list id](#delete-single-shield-list-by-shield-list-id) +- [Update shield list](#update-shield-list) + +## Get all shield lists in enterprise + +Retrieves all shield lists in the enterprise. + +This operation is performed by calling function `get_shield_lists_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists/). + +_Currently we don't have an example for calling `get_shield_lists_v2025_r0` in integration tests_ + +### Arguments + +- box_version `BoxVersionHeaderV2025R0` + - Version header +- 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 `ShieldListsV2025R0`. + +Returns the list of shield list objects. + +## Create shield list + +Creates a shield list. + +This operation is performed by calling function `create_shield_list_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/post-shield-lists/). + +_Currently we don't have an example for calling `create_shield_list_v2025_r0` in integration tests_ + +### Arguments + +- name `str` + - The name of the shield list. +- description `Optional[str]` + - Description of Shield List: Optional. +- content `ShieldListContentRequestV2025R0` + - +- box_version `BoxVersionHeaderV2025R0` + - Version header +- 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 `ShieldListV2025R0`. + +Returns the shield list object. + +## Get single shield list by shield list id + +Retrieves a single shield list by its ID. + +This operation is performed by calling function `get_shield_list_by_id_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists-id/). + +_Currently we don't have an example for calling `get_shield_list_by_id_v2025_r0` in integration tests_ + +### Arguments + +- shield_list_id `str` + - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " +- box_version `BoxVersionHeaderV2025R0` + - Version header +- 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 `ShieldListV2025R0`. + +Returns the shield list object. + +## Delete single shield list by shield list id + +Delete a single shield list by its ID. + +This operation is performed by calling function `delete_shield_list_by_id_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/delete-shield-lists-id/). + +_Currently we don't have an example for calling `delete_shield_list_by_id_v2025_r0` in integration tests_ + +### Arguments + +- shield_list_id `str` + - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " +- box_version `BoxVersionHeaderV2025R0` + - Version header +- 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 `None`. + +Shield List correctly removed. No content in response. + +## Update shield list + +Updates a shield list. + +This operation is performed by calling function `update_shield_list_by_id_v2025_r0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/put-shield-lists-id/). + +_Currently we don't have an example for calling `update_shield_list_by_id_v2025_r0` in integration tests_ + +### Arguments + +- shield_list_id `str` + - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 " +- name `str` + - The name of the shield list. +- description `Optional[str]` + - Description of Shield List: Optional. +- content `ShieldListContentRequestV2025R0` + - +- box_version `BoxVersionHeaderV2025R0` + - Version header +- 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 `ShieldListV2025R0`. + +Returns the shield list object.