From 8d22ce20d57f4b5dcb5b344ff6bfc67bcaa3568d Mon Sep 17 00:00:00 2001 From: box-sdk-build <94016436+box-sdk-build@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:33:46 +0200 Subject: [PATCH] feat: add missing marker pagination fields and introduce new event type `AppItemEventSource` `(box/box-openapi#431)` (#189) --- .codegen.json | 2 +- .../managers/file_version_retentions.py | 24 +++++++++++ box_sdk_gen/schemas/__init__.py | 2 + box_sdk_gen/schemas/app_item_event_source.py | 43 +++++++++++++++++++ box_sdk_gen/schemas/collaborations.py | 20 ++++++--- box_sdk_gen/schemas/event.py | 6 ++- box_sdk_gen/schemas/items.py | 20 ++++++--- box_sdk_gen/schemas/users.py | 20 ++++++--- docs/file_version_retentions.md | 10 +++++ 9 files changed, 127 insertions(+), 20 deletions(-) create mode 100644 box_sdk_gen/schemas/app_item_event_source.py diff --git a/.codegen.json b/.codegen.json index 5776b3a0..b97beca3 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "3ed6b56", "specHash": "c3c012c", "version": "1.0.0" } +{ "engineHash": "3ed6b56", "specHash": "5e023b9", "version": "1.0.0" } diff --git a/box_sdk_gen/managers/file_version_retentions.py b/box_sdk_gen/managers/file_version_retentions.py index 70866665..ca598579 100644 --- a/box_sdk_gen/managers/file_version_retentions.py +++ b/box_sdk_gen/managers/file_version_retentions.py @@ -67,6 +67,18 @@ def get_file_version_retentions( ) -> FileVersionRetentions: """ Retrieves all file version retentions for the given enterprise. + + **Note**: + + + File retention API is now **deprecated**. + + + To get information about files and file versions under retention, + + + see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints. + :param file_id: Filters results by files with this ID., defaults to None :type file_id: Optional[str], optional :param file_version_id: Filters results by file versions with this ID., defaults to None @@ -133,6 +145,18 @@ def get_file_version_retention_by_id( ) -> FileVersionRetention: """ Returns information about a file version retention. + + **Note**: + + + File retention API is now **deprecated**. + + + To get information about files and file versions under retention, + + + see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints. + :param file_version_retention_id: The ID of the file version retention Example: "3424234" :type file_version_retention_id: str diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py index f1789654..4960fc5b 100644 --- a/box_sdk_gen/schemas/__init__.py +++ b/box_sdk_gen/schemas/__init__.py @@ -170,6 +170,8 @@ from box_sdk_gen.schemas.user_mini import * +from box_sdk_gen.schemas.app_item_event_source import * + from box_sdk_gen.schemas.event_source import * from box_sdk_gen.schemas.user import * diff --git a/box_sdk_gen/schemas/app_item_event_source.py b/box_sdk_gen/schemas/app_item_event_source.py new file mode 100644 index 00000000..cc98da01 --- /dev/null +++ b/box_sdk_gen/schemas/app_item_event_source.py @@ -0,0 +1,43 @@ +from enum import Enum + +from typing import Optional + +from box_sdk_gen.internal.base_object import BaseObject + +from box_sdk_gen.schemas.user_mini import UserMini + +from box_sdk_gen.schemas.group_mini import GroupMini + + +class AppItemEventSourceTypeField(str, Enum): + APP_ITEM = 'app_item' + + +class AppItemEventSource(BaseObject): + _discriminator = 'type', {'app_item'} + + def __init__( + self, + id: str, + app_item_type: str, + *, + type: AppItemEventSourceTypeField = AppItemEventSourceTypeField.APP_ITEM.value, + user: Optional[UserMini] = None, + group: Optional[GroupMini] = None, + **kwargs + ): + """ + :param id: The id of the `AppItem` + :type id: str + :param app_item_type: The type of the `AppItem` + :type app_item_type: str + :param type: The type of the source that this event represents. Can be only `app_item`. + , defaults to AppItemEventSourceTypeField.APP_ITEM.value + :type type: AppItemEventSourceTypeField, optional + """ + super().__init__(**kwargs) + self.id = id + self.app_item_type = app_item_type + self.type = type + self.user = user + self.group = group diff --git a/box_sdk_gen/schemas/collaborations.py b/box_sdk_gen/schemas/collaborations.py index d14fd5c1..735c89c8 100644 --- a/box_sdk_gen/schemas/collaborations.py +++ b/box_sdk_gen/schemas/collaborations.py @@ -37,14 +37,24 @@ class Collaborations(BaseObject): def __init__( self, *, - total_count: Optional[int] = None, limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = None, + total_count: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[CollaborationsOrderField]] = None, entries: Optional[List[Collaboration]] = 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 total_count: One greater than the offset of the last entry in the entire collection. The total number of entries in the collection may be less than `total_count`. @@ -52,10 +62,6 @@ def __init__( This field is only returned for calls that use offset-based pagination. For marker-based paginated APIs, this field will be omitted., defaults to None :type total_count: Optional[int], optional - :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 offset: The 0-based offset of the first entry in this set. This will be the same as the `offset` query parameter. @@ -71,8 +77,10 @@ def __init__( :type entries: Optional[List[Collaboration]], optional """ super().__init__(**kwargs) - self.total_count = total_count self.limit = limit + self.next_marker = next_marker + self.prev_marker = prev_marker + self.total_count = total_count self.offset = offset self.order = order self.entries = entries diff --git a/box_sdk_gen/schemas/event.py b/box_sdk_gen/schemas/event.py index ad208f30..bef031f7 100644 --- a/box_sdk_gen/schemas/event.py +++ b/box_sdk_gen/schemas/event.py @@ -18,6 +18,8 @@ from box_sdk_gen.schemas.folder import Folder +from box_sdk_gen.schemas.app_item_event_source import AppItemEventSource + from box_sdk_gen.internal.utils import DateTime @@ -191,7 +193,9 @@ def __init__( created_by: Optional[UserMini] = None, event_type: Optional[EventEventTypeField] = None, session_id: Optional[str] = None, - source: Optional[Union[User, EventSource, File, Folder, Dict]] = None, + source: Optional[ + Union[User, EventSource, File, Folder, Dict, AppItemEventSource] + ] = None, additional_details: Optional[EventAdditionalDetailsField] = None, **kwargs ): diff --git a/box_sdk_gen/schemas/items.py b/box_sdk_gen/schemas/items.py index 09348dba..891096c2 100644 --- a/box_sdk_gen/schemas/items.py +++ b/box_sdk_gen/schemas/items.py @@ -43,14 +43,24 @@ class Items(BaseObject): def __init__( self, *, - total_count: Optional[int] = None, limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = None, + total_count: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[ItemsOrderField]] = None, entries: Optional[List[Union[FileFull, FolderMini, WebLink]]] = 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 total_count: One greater than the offset of the last entry in the entire collection. The total number of entries in the collection may be less than `total_count`. @@ -58,10 +68,6 @@ def __init__( This field is only returned for calls that use offset-based pagination. For marker-based paginated APIs, this field will be omitted., defaults to None :type total_count: Optional[int], optional - :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 offset: The 0-based offset of the first entry in this set. This will be the same as the `offset` query parameter. @@ -77,8 +83,10 @@ def __init__( :type entries: Optional[List[Union[FileFull, FolderMini, WebLink]]], optional """ super().__init__(**kwargs) - self.total_count = total_count self.limit = limit + self.next_marker = next_marker + self.prev_marker = prev_marker + self.total_count = total_count self.offset = offset self.order = order self.entries = entries diff --git a/box_sdk_gen/schemas/users.py b/box_sdk_gen/schemas/users.py index 457bc2c1..ab585d76 100644 --- a/box_sdk_gen/schemas/users.py +++ b/box_sdk_gen/schemas/users.py @@ -37,14 +37,24 @@ class Users(BaseObject): def __init__( self, *, - total_count: Optional[int] = None, limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = None, + total_count: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[UsersOrderField]] = None, entries: Optional[List[UserFull]] = 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 total_count: One greater than the offset of the last entry in the entire collection. The total number of entries in the collection may be less than `total_count`. @@ -52,10 +62,6 @@ def __init__( This field is only returned for calls that use offset-based pagination. For marker-based paginated APIs, this field will be omitted., defaults to None :type total_count: Optional[int], optional - :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 offset: The 0-based offset of the first entry in this set. This will be the same as the `offset` query parameter. @@ -71,8 +77,10 @@ def __init__( :type entries: Optional[List[UserFull]], optional """ super().__init__(**kwargs) - self.total_count = total_count self.limit = limit + self.next_marker = next_marker + self.prev_marker = prev_marker + self.total_count = total_count self.offset = offset self.order = order self.entries = entries diff --git a/docs/file_version_retentions.md b/docs/file_version_retentions.md index 63a6af49..6f14e36e 100644 --- a/docs/file_version_retentions.md +++ b/docs/file_version_retentions.md @@ -7,6 +7,11 @@ Retrieves all file version retentions for the given enterprise. +**Note**: +File retention API is now **deprecated**. +To get information about files and file versions under retention, +see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints. + This operation is performed by calling function `get_file_version_retentions`. See the endpoint docs at @@ -49,6 +54,11 @@ Returns a list of all file version retentions for the enterprise. Returns information about a file version retention. +**Note**: +File retention API is now **deprecated**. +To get information about files and file versions under retention, +see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints. + This operation is performed by calling function `get_file_version_retention_by_id`. See the endpoint docs at