From f3ec8c685575d65f9da64af895691b3c0e3b8374 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 14 May 2024 07:07:18 -0700 Subject: [PATCH] fix: Fix schemas for updating classification on a file and folder (box/box-openapi#423) --- .codegen.json | 2 +- .../managers/legal_hold_policy_assignments.py | 10 +++--- box_sdk_gen/managers/search.py | 2 +- box_sdk_gen/schemas/__init__.py | 4 +++ box_sdk_gen/schemas/events.py | 6 ++-- box_sdk_gen/schemas/file.py | 4 ++- box_sdk_gen/schemas/file_full.py | 4 ++- box_sdk_gen/schemas/file_versions_on_hold.py | 36 +++++++++++++++++++ box_sdk_gen/schemas/files_on_hold.py | 36 +++++++++++++++++++ box_sdk_gen/schemas/realtime_server.py | 8 ++--- docs/legal_hold_policy_assignments.md | 8 ++--- docs/search.md | 2 +- 12 files changed, 103 insertions(+), 19 deletions(-) create mode 100644 box_sdk_gen/schemas/file_versions_on_hold.py create mode 100644 box_sdk_gen/schemas/files_on_hold.py diff --git a/.codegen.json b/.codegen.json index 8062f3d8..0619c905 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "c8ba3d9", "specHash": "d5769a1", "version": "0.6.5" } +{ "engineHash": "c8ba3d9", "specHash": "98bca8f", "version": "0.6.5" } diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py index 9c225500..19b348db 100644 --- a/box_sdk_gen/managers/legal_hold_policy_assignments.py +++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py @@ -20,7 +20,9 @@ from box_sdk_gen.schemas.legal_hold_policy_assignment import LegalHoldPolicyAssignment -from box_sdk_gen.schemas.file_version_legal_holds import FileVersionLegalHolds +from box_sdk_gen.schemas.files_on_hold import FilesOnHold + +from box_sdk_gen.schemas.file_versions_on_hold import FileVersionsOnHold from box_sdk_gen.networking.auth import Authentication @@ -281,9 +283,9 @@ def get_legal_hold_policy_assignment_file_on_hold( limit: Optional[int] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None - ) -> FileVersionLegalHolds: + ) -> FilesOnHold: """ - Get a list of current file versions for a legal hold + Get a list of files with current file versions for a legal hold assignment. @@ -371,4 +373,4 @@ def get_legal_hold_policy_assignment_file_on_hold( network_session=self.network_session, ), ) - return deserialize(response.data, FileVersionLegalHolds) + return deserialize(response.data, FilesOnHold) diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index 749e27f0..70b81fff 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -432,7 +432,7 @@ def search_for_content( :type trash_content: Optional[SearchForContentTrashContent], optional :param mdfilters: Limits the search results to any items for which the metadata matches the provided filter. This parameter is a list that specifies exactly **one** metadata template used to filter the search results. - It unless the `query` parameter is provided., defaults to None + It is required unless the `query` parameter is provided., defaults to None :type mdfilters: Optional[List[MetadataFilter]], optional :param sort: Defines the order in which search results are returned. This API defaults to returning items by relevance unless this parameter is diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py index af47d774..2f8dcad4 100644 --- a/box_sdk_gen/schemas/__init__.py +++ b/box_sdk_gen/schemas/__init__.py @@ -50,6 +50,8 @@ from box_sdk_gen.schemas.file_mini import * +from box_sdk_gen.schemas.files_on_hold import * + from box_sdk_gen.schemas.files_under_retention import * from box_sdk_gen.schemas.file_conflict import * @@ -220,6 +222,8 @@ from box_sdk_gen.schemas.file_versions import * +from box_sdk_gen.schemas.file_versions_on_hold import * + from box_sdk_gen.schemas.file_request import * from box_sdk_gen.schemas.file import * diff --git a/box_sdk_gen/schemas/events.py b/box_sdk_gen/schemas/events.py index 04179010..739973fc 100644 --- a/box_sdk_gen/schemas/events.py +++ b/box_sdk_gen/schemas/events.py @@ -1,5 +1,7 @@ from typing import Optional +from typing import Union + from typing import List from box_sdk_gen.internal.base_object import BaseObject @@ -12,7 +14,7 @@ def __init__( self, *, chunk_size: Optional[int] = None, - next_stream_position: Optional[str] = None, + next_stream_position: Optional[Union[str, float]] = None, entries: Optional[List[Event]] = None, **kwargs ): @@ -21,7 +23,7 @@ def __init__( :type chunk_size: Optional[int], optional :param next_stream_position: The stream position of the start of the next page (chunk) of events., defaults to None - :type next_stream_position: Optional[str], optional + :type next_stream_position: Optional[Union[str, float]], optional :param entries: A list of events, defaults to None :type entries: Optional[List[Event]], optional """ diff --git a/box_sdk_gen/schemas/file.py b/box_sdk_gen/schemas/file.py index 4e190d02..bf77c50e 100644 --- a/box_sdk_gen/schemas/file.py +++ b/box_sdk_gen/schemas/file.py @@ -209,7 +209,9 @@ def __init__( for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. :type id: str - :param description: The optional description of this file, defaults to None + :param description: The optional description of this file. + If the description exceeds 255 characters, the first 255 characters + are set as a file description and the rest of it is ignored., defaults to None :type description: Optional[str], optional :param size: The file size in bytes. Be careful parsing this integer as it can get very large and cause an integer overflow., defaults to None diff --git a/box_sdk_gen/schemas/file_full.py b/box_sdk_gen/schemas/file_full.py index 107c1278..fa9a39bb 100644 --- a/box_sdk_gen/schemas/file_full.py +++ b/box_sdk_gen/schemas/file_full.py @@ -482,7 +482,9 @@ def __init__( :param shared_link_permission_options: A list of the types of roles that user can be invited at when sharing this file., defaults to None :type shared_link_permission_options: Optional[List[FileFullSharedLinkPermissionOptionsField]], optional - :param description: The optional description of this file, defaults to None + :param description: The optional description of this file. + If the description exceeds 255 characters, the first 255 characters + are set as a file description and the rest of it is ignored., defaults to None :type description: Optional[str], optional :param size: The file size in bytes. Be careful parsing this integer as it can get very large and cause an integer overflow., defaults to None diff --git a/box_sdk_gen/schemas/file_versions_on_hold.py b/box_sdk_gen/schemas/file_versions_on_hold.py new file mode 100644 index 00000000..1a6f2a78 --- /dev/null +++ b/box_sdk_gen/schemas/file_versions_on_hold.py @@ -0,0 +1,36 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.file_version import FileVersion + + +class FileVersionsOnHold(BaseObject): + def __init__( + self, + *, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = None, + entries: Optional[List[FileVersion]] = None, + **kwargs + ): + """ + :param limit: The limit that was used for these entries. This will be the same as the + `limit` query parameter unless that value exceeded the maximum value + allowed. The maximum value varies by API., defaults to None + :type limit: Optional[int], optional + :param next_marker: The marker for the start of the next page of results., defaults to None + :type next_marker: Optional[str], optional + :param prev_marker: The marker for the start of the previous page of results., defaults to None + :type prev_marker: Optional[str], optional + :param entries: A list of file versions on hold., defaults to None + :type entries: Optional[List[FileVersion]], optional + """ + super().__init__(**kwargs) + self.limit = limit + self.next_marker = next_marker + self.prev_marker = prev_marker + self.entries = entries diff --git a/box_sdk_gen/schemas/files_on_hold.py b/box_sdk_gen/schemas/files_on_hold.py new file mode 100644 index 00000000..f8ab95e7 --- /dev/null +++ b/box_sdk_gen/schemas/files_on_hold.py @@ -0,0 +1,36 @@ +from typing import Optional + +from typing import List + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.file_mini import FileMini + + +class FilesOnHold(BaseObject): + def __init__( + self, + *, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = None, + entries: Optional[List[FileMini]] = None, + **kwargs + ): + """ + :param limit: The limit that was used for these entries. This will be the same as the + `limit` query parameter unless that value exceeded the maximum value + allowed. The maximum value varies by API., defaults to None + :type limit: Optional[int], optional + :param next_marker: The marker for the start of the next page of results., defaults to None + :type next_marker: Optional[str], optional + :param prev_marker: The marker for the start of the previous page of results., defaults to None + :type prev_marker: Optional[str], optional + :param entries: A list of files, defaults to None + :type entries: Optional[List[FileMini]], optional + """ + super().__init__(**kwargs) + self.limit = limit + self.next_marker = next_marker + self.prev_marker = prev_marker + self.entries = entries diff --git a/box_sdk_gen/schemas/realtime_server.py b/box_sdk_gen/schemas/realtime_server.py index 3638a770..4ee5108f 100644 --- a/box_sdk_gen/schemas/realtime_server.py +++ b/box_sdk_gen/schemas/realtime_server.py @@ -9,8 +9,8 @@ def __init__( *, type: Optional[str] = None, url: Optional[str] = None, - ttl: Optional[int] = None, - max_retries: Optional[int] = None, + ttl: Optional[str] = None, + max_retries: Optional[str] = None, retry_timeout: Optional[int] = None, **kwargs ): @@ -20,11 +20,11 @@ def __init__( :param url: The URL for the server., defaults to None :type url: Optional[str], optional :param ttl: The time in minutes for which this server is available, defaults to None - :type ttl: Optional[int], optional + :type ttl: Optional[str], optional :param max_retries: The maximum number of retries this server will allow before a new long poll should be started by getting a [new list of server](#options-events)., defaults to None - :type max_retries: Optional[int], optional + :type max_retries: Optional[str], optional :param retry_timeout: The maximum number of seconds without a response after which you should retry the long poll connection. diff --git a/docs/legal_hold_policy_assignments.md b/docs/legal_hold_policy_assignments.md index 54f98797..880e507a 100644 --- a/docs/legal_hold_policy_assignments.md +++ b/docs/legal_hold_policy_assignments.md @@ -4,7 +4,7 @@ - [Assign legal hold policy](#assign-legal-hold-policy) - [Get legal hold policy assignment](#get-legal-hold-policy-assignment) - [Unassign legal hold policy](#unassign-legal-hold-policy) -- [List current file versions for legal hold policy assignment](#list-current-file-versions-for-legal-hold-policy-assignment) +- [List files with current file versions for legal hold policy assignment](#list-files-with-current-file-versions-for-legal-hold-policy-assignment) ## List legal hold policy assignments @@ -134,9 +134,9 @@ This function returns a value of type `None`. A blank response is returned if the assignment was successfully deleted. -## List current file versions for legal hold policy assignment +## List files with current file versions for legal hold policy assignment -Get a list of current file versions for a legal hold +Get a list of files with current file versions for a legal hold assignment. In some cases you may want to get previous file versions instead. In these @@ -175,7 +175,7 @@ _Currently we don't have an example for calling `get_legal_hold_policy_assignmen ### Returns -This function returns a value of type `FileVersionLegalHolds`. +This function returns a value of type `FilesOnHold`. Returns the list of current file versions held under legal hold for a specific legal hold policy assignment. diff --git a/docs/search.md b/docs/search.md index 3bb2c2d4..9566c646 100644 --- a/docs/search.md +++ b/docs/search.md @@ -93,7 +93,7 @@ client.search.search_for_content(ancestor_folder_ids=['0'], mdfilters=[MetadataF - trash_content `Optional[SearchForContentTrashContent]` - Determines if the search should look in the trash for items. By default, this API only returns search results for items not currently in the trash (`non_trashed_only`). _ `trashed_only` - Only searches for items currently in the trash _ `non_trashed_only` - Only searches for items currently not in the trash \* `all_items` - Searches for both trashed and non-trashed items. - mdfilters `Optional[List[MetadataFilter]]` - - Limits the search results to any items for which the metadata matches the provided filter. This parameter is a list that specifies exactly **one** metadata template used to filter the search results. It unless the `query` parameter is provided. + - Limits the search results to any items for which the metadata matches the provided filter. This parameter is a list that specifies exactly **one** metadata template used to filter the search results. It is required unless the `query` parameter is provided. - sort `Optional[SearchForContentSort]` - Defines the order in which search results are returned. This API defaults to returning items by relevance unless this parameter is explicitly specified. _ `relevance` (default) returns the results sorted by relevance to the query search term. The relevance is based on the occurrence of the search term in the items name, description, content, and additional properties. _ `modified_at` returns the results ordered in descending order by date at which the item was last modified. - direction `Optional[SearchForContentDirection]`